summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-06-20 18:08:06 +0000
committerjstebbins <[email protected]>2009-06-20 18:08:06 +0000
commit0865bab7662ff6e7e831705c5b0f2aa6916f855b (patch)
tree7f6d9422e04dffc7ed5cd8b1ca7e6e016b679ad0
parent2c92194ddde3710dba84abea10aa123b835a8d4f (diff)
LinGui: make status icon code backwards compatible to gtk 2.10
There's a new status icon api in 2.16 that is not backwards compatible. The depricated interface is broken in 2.16, so ifdef the code to use older api only when older gtk versions are used. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2589 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--gtk/configure.ac6
-rw-r--r--gtk/src/callbacks.c14
-rw-r--r--gtk/src/ghb.ui1
-rw-r--r--gtk/src/main.c11
4 files changed, 28 insertions, 4 deletions
diff --git a/gtk/configure.ac b/gtk/configure.ac
index 3e7ae4a90..a7d900831 100644
--- a/gtk/configure.ac
+++ b/gtk/configure.ac
@@ -69,14 +69,14 @@ AM_PROG_LIBTOOL
case $host in
*-*-mingw*)
if test "x$w32_gst" = "xyes" ; then
- GHB_PACKAGES="gtk+-2.0 >= 2.8 gthread-2.0 gstreamer-0.10 gstreamer-interfaces-0.10 gstreamer-video-0.10 gstreamer-pbutils-0.10 gio-2.0 hal hal-storage webkit-1.0"
+ GHB_PACKAGES="gtk+-2.0 >= 2.10 gthread-2.0 gstreamer-0.10 gstreamer-interfaces-0.10 gstreamer-video-0.10 gstreamer-pbutils-0.10 gio-2.0 hal hal-storage webkit-1.0"
else
- GHB_PACKAGES="gtk+-2.0 >= 2.8 gthread-2.0 gio-2.0"
+ GHB_PACKAGES="gtk+-2.0 >= 2.10 gthread-2.0 gio-2.0"
fi
mingw_flag=yes
;;
*)
- GHB_PACKAGES="gtk+-2.0 >= 2.8 gthread-2.0 gstreamer-0.10 gstreamer-interfaces-0.10 gstreamer-video-0.10 gstreamer-pbutils-0.10 gio-2.0 hal hal-storage webkit-1.0 libnotify"
+ GHB_PACKAGES="gtk+-2.0 >= 2.10 gthread-2.0 gstreamer-0.10 gstreamer-interfaces-0.10 gstreamer-video-0.10 gstreamer-pbutils-0.10 gio-2.0 hal hal-storage webkit-1.0 libnotify"
mingw_flag=no
;;
esac
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index da6039ce6..b768fabb0 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -2230,6 +2230,12 @@ ghb_backend_events(signal_user_data_t *ud)
ghb_settings_set_int(js, "job_status", qstatus);
ghb_save_queue(ud->queue);
ud->cancel_encode = FALSE;
+#if !GTK_CHECK_VERSION(2, 16, 0)
+ GtkStatusIcon *si;
+
+ si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
+ gtk_status_icon_set_tooltip(si, "HandBrake");
+#endif
}
else if (status.queue.state & GHB_STATE_MUXING)
{
@@ -2276,6 +2282,12 @@ ghb_backend_events(signal_user_data_t *ud)
status_str = working_status_string(ud, &status.queue);
label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_status"));
gtk_label_set_text (label, status_str);
+#if !GTK_CHECK_VERSION(2, 16, 0)
+ GtkStatusIcon *si;
+
+ si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
+ gtk_status_icon_set_tooltip(si, status_str);
+#endif
g_free(status_str);
}
if (status.scan.state & GHB_STATE_WORKING)
@@ -2305,6 +2317,7 @@ ghb_backend_events(signal_user_data_t *ud)
}
}
+#if GTK_CHECK_VERSION(2, 16, 0)
G_MODULE_EXPORT gboolean
status_icon_query_tooltip_cb(
GtkStatusIcon *si,
@@ -2330,6 +2343,7 @@ status_icon_query_tooltip_cb(
g_free(status_str);
return TRUE;
}
+#endif
G_MODULE_EXPORT gboolean
ghb_timer_cb(gpointer data)
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index 4f0736015..428e388f2 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -5757,7 +5757,6 @@ libx264 authors:
</object>
<object class="GtkStatusIcon" id="hb_status">
<property name="icon_name">hb-icon</property>
- <signal handler="status_icon_query_tooltip_cb" name="query-tooltip"/>
<signal handler="status_activate_cb" name="activate"/>
</object>
<object class="GtkDialog" id="update_dialog">
diff --git a/gtk/src/main.c b/gtk/src/main.c
index 2294666e3..edd5fecf1 100644
--- a/gtk/src/main.c
+++ b/gtk/src/main.c
@@ -630,6 +630,10 @@ const gchar *hud_rcstyle =
"widget \"preview_window.*.preview_hud.*\" style \"ghb-hud\"\n"
"widget \"preview_window\" style \"ghb-preview\"\n";
+#if GTK_CHECK_VERSION(2, 16, 0)
+extern G_MODULE_EXPORT void status_icon_query_tooltip_cb(void);
+#endif
+
int
main (int argc, char *argv[])
{
@@ -793,7 +797,14 @@ main (int argc, char *argv[])
GtkStatusIcon *si;
si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));
+
+#if GTK_CHECK_VERSION(2, 16, 0)
gtk_status_icon_set_has_tooltip(si, TRUE);
+ g_signal_connect(si, "query-tooltip",
+ status_icon_query_tooltip_cb, ud);
+#else
+ gtk_status_icon_set_tooltip(si, "HandBrake");
+#endif
GtkWindow *window;
window = GTK_WINDOW(GHB_WIDGET (ud->builder, "hb_window"));