OSDN Git Service

LinGui: make status icon code backwards compatible to gtk 2.10
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 20 Jun 2009 18:08:06 +0000 (18:08 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 20 Jun 2009 18:08:06 +0000 (18:08 +0000)
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://localhost/HandBrake/trunk@2589 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/configure.ac
gtk/src/callbacks.c
gtk/src/ghb.ui
gtk/src/main.c

index 3e7ae4a..a7d9008 100644 (file)
@@ -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
index da6039c..b768fab 100644 (file)
@@ -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)
index 4f07360..428e388 100644 (file)
@@ -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">
index 2294666..edd5fec 100644 (file)
@@ -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"));