[Xfce4-commits] <xfce4-mixer:master> Do not use deprecated APIs and adjust requirements to Xfce 4.10

Guido Berhoerster noreply at xfce.org
Thu Sep 27 16:46:15 CEST 2012


Updating branch refs/heads/master
         to 2be23d2118b673e869d25f00d9ea5f1b427add3c (commit)
       from 397c3ea65a63d770509b141b4db45a11541e5ba3 (commit)

commit 2be23d2118b673e869d25f00d9ea5f1b427add3c
Author: Guido Berhoerster <guido+xfce at berhoerster.name>
Date:   Thu Sep 27 16:31:08 2012 +0200

    Do not use deprecated APIs and adjust requirements to Xfce 4.10
    
    Raise the minimum requirements of Xfce components to 4.10 which is the
    currently supported version.
    Raise the minimum requirements of GTK/glib to match those of Xfce 4.10.
    Raise the minimum required gstreamer version to 0.10.23, it was released in
    2009 and will allow us to use GST_MIXER_FLAG_HAS_WHITELIST in the mixer.
    Replace the usage of GTK/glib API parts which have been deprecated in the
    minimum required GTK version.

 NEWS                              |    1 +
 configure.ac.in                   |   33 +++++++--------------------------
 libxfce4mixer/libxfce4mixer.c     |   10 ----------
 libxfce4mixer/libxfce4mixer.h     |    4 ----
 panel-plugin/xfce-mixer-plugin.c  |   22 ----------------------
 panel-plugin/xfce-volume-button.c |    3 ++-
 xfce4-mixer/xfce-mixer-window.c   |    7 ++++---
 xfce4-mixer/xfce-mixer.c          |   13 -------------
 8 files changed, 14 insertions(+), 79 deletions(-)

diff --git a/NEWS b/NEWS
index cf8b487..853354f 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,7 @@
   value (bug #8291).
 - Add an item to the panel plugin context menu for muting (bug #7944).
 - Make name and description more meaningful (bug #5817).
+- Do not use deprecated APIs and adjust requirements to Xfce 4.10.
 
 
 4.8.0
diff --git a/configure.ac.in b/configure.ac.in
index f391d31..37eccde 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -93,28 +93,14 @@ AC_CHECK_LIB([m],[round])
 dnl ***********************************
 dnl *** Check for required packages ***
 dnl ***********************************
-XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.18.0])
-XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.18.0])
-XDT_CHECK_PACKAGE([GST_PLUGINS_BASE], [gstreamer-plugins-base-0.10], [0.10.2])
-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.14.0])
-XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.8.0])
-XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.8.0])
-XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.8.0])
+XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.24.0])
+XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.24.0])
+XDT_CHECK_PACKAGE([GST_PLUGINS_BASE], [gstreamer-plugins-base-0.10], [0.10.23])
+XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.20.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.10.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.10.0])
 XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.10.0])
-XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.8.0])
-
-dnl **************************************
-dnl *** Check for GstMixer bus support ***
-dnl **************************************
-HAVE_GST_MIXER_NOTIFICATION=no
-PKG_CHECK_MODULES(GST_MIXER_NOTIFICATION_API, 
-                  gstreamer-plugins-base-0.10 >= 0.10.14,
-                  HAVE_GST_MIXER_NOTIFICATION=yes, 
-                  HAVE_GST_MIXER_NOTIFICATION=no)
-if test "x$HAVE_GST_MIXER_NOTIFICATION" = "xyes"; then
-  AC_DEFINE(HAVE_GST_MIXER_NOTIFICATION, 1, 
-            [Have GStreamer mixer notification API])
-fi
+XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.10.0])
 
 dnl ***********************************
 dnl *** Check for debugging support ***
@@ -157,10 +143,5 @@ dnl ***************************
 echo
 echo "Build Configuration:"
 echo
-if test "x$HAVE_GST_MIXER_NOTIFICATION" = "xyes"; then
-echo " * GStreamer mixer notification support: yes"
-else
-echo " * GStreamer mixer notification support: no"
-fi
 echo " * Debug Support:                        $enable_debug"
 echo
diff --git a/libxfce4mixer/libxfce4mixer.c b/libxfce4mixer/libxfce4mixer.c
index 86ea5db..b25ecc5 100644
--- a/libxfce4mixer/libxfce4mixer.c
+++ b/libxfce4mixer/libxfce4mixer.c
@@ -42,10 +42,8 @@ static void     _xfce_mixer_destroy_mixer (GstMixer *mixer);
 
 static guint       refcount = 0;
 static GList      *mixers = NULL;
-#ifdef HAVE_GST_MIXER_NOTIFICATION
 static GstBus     *bus = NULL;
 static GstElement *selected_card = NULL;
-#endif
 
 
 
@@ -64,11 +62,9 @@ xfce_mixer_init (void)
       /* Get list of all available mixer devices */
       mixers = gst_audio_default_registry_mixer_filter (_xfce_mixer_filter_mixer, FALSE, &counter);
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
       /* Create a GstBus for notifications */
       bus = gst_bus_new ();
       gst_bus_add_signal_watch (bus);
-#endif
     }
 }
 
@@ -82,10 +78,8 @@ xfce_mixer_shutdown (void)
       g_list_foreach (mixers, (GFunc) _xfce_mixer_destroy_mixer, NULL);
       g_list_free (mixers);
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
       gst_bus_remove_signal_watch (bus);
       gst_object_unref (bus);
-#endif
     }
 }
 
@@ -168,10 +162,8 @@ xfce_mixer_select_card (GstElement *card)
 {
   g_return_if_fail (GST_IS_MIXER (card));
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
   gst_element_set_bus (card, bus);
   selected_card = card;
-#endif
 }
 
 
@@ -241,7 +233,6 @@ xfce_mixer_get_default_track (GstElement *card)
 
 
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
 guint
 xfce_mixer_bus_connect (GCallback callback,
                         gpointer  user_data)
@@ -259,7 +250,6 @@ xfce_mixer_bus_disconnect (guint signal_handler_id)
   if (signal_handler_id != 0)
     g_signal_handler_disconnect (bus, signal_handler_id);
 }
-#endif
 
 
 
diff --git a/libxfce4mixer/libxfce4mixer.h b/libxfce4mixer/libxfce4mixer.h
index 93365dd..41f5816 100644
--- a/libxfce4mixer/libxfce4mixer.h
+++ b/libxfce4mixer/libxfce4mixer.h
@@ -45,13 +45,9 @@ void           xfce_mixer_select_card            (GstElement    *card);
 GstMixerTrack *xfce_mixer_get_track              (GstElement    *card,
                                                   const gchar   *track_name);
 GstMixerTrack *xfce_mixer_get_default_track      (GstElement    *card);
-
-#ifdef HAVE_GST_MIXER_NOTIFICATION
 guint          xfce_mixer_bus_connect            (GCallback      callback,
                                                   gpointer       user_data);
 void           xfce_mixer_bus_disconnect         (guint          signal_handler_id);
-#endif
-
 gint           xfce_mixer_get_max_volume         (gint          *volumes,
                                                   gint           num_channels);
 int            xfce_mixer_utf8_cmp               (const gchar   *s1,
diff --git a/panel-plugin/xfce-mixer-plugin.c b/panel-plugin/xfce-mixer-plugin.c
index a382cf1..eb2042a 100644
--- a/panel-plugin/xfce-mixer-plugin.c
+++ b/panel-plugin/xfce-mixer-plugin.c
@@ -80,11 +80,9 @@ static void     xfce_mixer_plugin_is_muted_property_changed   (XfceMixerPlugin
                                                                GParamSpec       *pspec,
                                                                GObject          *object);
 static void     xfce_mixer_plugin_update_track                (XfceMixerPlugin  *mixer_plugin);
-#ifdef HAVE_GST_MIXER_NOTIFICATION
 static void     xfce_mixer_plugin_bus_message                 (GstBus           *bus,
                                                                GstMessage       *message,
                                                                XfceMixerPlugin  *mixer_plugin);
-#endif
 
 
 
@@ -121,13 +119,11 @@ struct _XfceMixerPlugin
   /* Reference to the plugin private xfconf channel */
   XfconfChannel   *plugin_channel;
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
   /* Flag for ignoring messages from the GstBus */
   gboolean         ignore_bus_messages;
 
   /* GstBus connection id */
   guint            message_handler_id;
-#endif
 };
 
 
@@ -192,10 +188,8 @@ xfce_mixer_plugin_init (XfceMixerPlugin *mixer_plugin)
 
   mixer_plugin->plugin_channel = NULL;
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
   mixer_plugin->ignore_bus_messages = FALSE;
   mixer_plugin->message_handler_id = 0;
-#endif
 
   mixer_plugin->mute_menu_item = NULL;
 
@@ -304,17 +298,13 @@ xfce_mixer_plugin_set_property (GObject      *object,
             mixer_plugin->card = card;
             mixer_plugin->card_name = g_strdup (card_name);
             xfce_mixer_select_card (mixer_plugin->card);
-#ifdef HAVE_GST_MIXER_NOTIFICATION
             mixer_plugin->message_handler_id = xfce_mixer_bus_connect (G_CALLBACK (xfce_mixer_plugin_bus_message), mixer_plugin);
-#endif
             track_label = xfconf_channel_get_string (mixer_plugin->plugin_channel, "/track", NULL);
           }
         else
           {
             track_label = NULL;
-#ifdef HAVE_GST_MIXER_NOTIFICATION
             xfce_mixer_bus_disconnect (mixer_plugin->message_handler_id);
-#endif
           }
         g_object_set (object, "track", track_label, NULL);
 
@@ -411,10 +401,8 @@ xfce_mixer_plugin_free_data (XfcePanelPlugin *plugin)
   g_free (mixer_plugin->card_name);
   g_free (mixer_plugin->track_label);
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
   /* Disconnect from GstBus */
   xfce_mixer_bus_disconnect (mixer_plugin->message_handler_id);
-#endif
 
   /* Shutdown the mixer library */
   xfce_mixer_shutdown ();
@@ -543,9 +531,7 @@ xfce_mixer_plugin_volume_changed (XfceMixerPlugin  *mixer_plugin,
   g_return_if_fail (GST_IS_MIXER (mixer_plugin->card));
   g_return_if_fail (GST_IS_MIXER_TRACK (mixer_plugin->track));
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
   mixer_plugin->ignore_bus_messages = TRUE;
-#endif
 
   /* Allocate array for track volumes */
   volumes = g_new (gint, mixer_plugin->track->num_channels);
@@ -566,9 +552,7 @@ xfce_mixer_plugin_volume_changed (XfceMixerPlugin  *mixer_plugin,
   /* Free volume array */
   g_free (volumes);
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
   mixer_plugin->ignore_bus_messages = FALSE;
-#endif
 }
 
 
@@ -580,9 +564,7 @@ xfce_mixer_plugin_mute_changed (XfceMixerPlugin *mixer_plugin,
   g_return_if_fail (GST_IS_MIXER (mixer_plugin->card));
   g_return_if_fail (GST_IS_MIXER_TRACK (mixer_plugin->track));
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
   mixer_plugin->ignore_bus_messages = TRUE;
-#endif
 
 
   if (G_LIKELY (xfce_mixer_track_type_new (mixer_plugin->track) == XFCE_MIXER_TRACK_TYPE_PLAYBACK))
@@ -600,9 +582,7 @@ xfce_mixer_plugin_mute_changed (XfceMixerPlugin *mixer_plugin,
   if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (mixer_plugin->mute_menu_item)) != muted)
     gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mixer_plugin->mute_menu_item), muted);
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
   mixer_plugin->ignore_bus_messages = FALSE;
-#endif
 }
 
 
@@ -691,7 +671,6 @@ xfce_mixer_plugin_update_track (XfceMixerPlugin *mixer_plugin)
 
 
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
 static void
 xfce_mixer_plugin_bus_message (GstBus          *bus,
                                GstMessage      *message,
@@ -757,4 +736,3 @@ xfce_mixer_plugin_bus_message (GstBus          *bus,
         break;
     }
 }
-#endif
diff --git a/panel-plugin/xfce-volume-button.c b/panel-plugin/xfce-volume-button.c
index 826d4be..5f4b07f 100644
--- a/panel-plugin/xfce-volume-button.c
+++ b/panel-plugin/xfce-volume-button.c
@@ -261,7 +261,8 @@ xfce_volume_button_init (XfceVolumeButton *button)
   /* Make the button look flat and make it never grab the focus */
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
   gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
-  GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (button), GTK_CAN_DEFAULT|GTK_CAN_FOCUS);
+  gtk_widget_set_can_default (GTK_WIDGET (button), FALSE);
+  gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE);
 
   /* Connect to button signals */
 #if 0
diff --git a/xfce4-mixer/xfce-mixer-window.c b/xfce4-mixer/xfce-mixer-window.c
index 14bd6f3..85ffe04 100644
--- a/xfce4-mixer/xfce-mixer-window.c
+++ b/xfce4-mixer/xfce-mixer-window.c
@@ -222,8 +222,8 @@ xfce_mixer_window_init (XfceMixerWindow *window)
   gtk_container_set_border_width (GTK_CONTAINER (bbox), 6);
 
   window->select_controls_button = gtk_button_new ();
-  gtk_action_connect_proxy (gtk_action_group_get_action (window->action_group, "select-controls"), 
-                            window->select_controls_button);
+  gtk_activatable_set_related_action (GTK_ACTIVATABLE (window->select_controls_button),
+                                      gtk_action_group_get_action (window->action_group, "select-controls"));
   gtk_button_set_image (GTK_BUTTON (window->select_controls_button), 
                         gtk_image_new_from_icon_name ("preferences-desktop", GTK_ICON_SIZE_BUTTON));
   gtk_widget_set_sensitive (window->select_controls_button, FALSE);
@@ -231,7 +231,8 @@ xfce_mixer_window_init (XfceMixerWindow *window)
   gtk_widget_show (window->select_controls_button);
 
   button = gtk_button_new ();
-  gtk_action_connect_proxy (gtk_action_group_get_action (window->action_group, "quit"), button);
+  gtk_activatable_set_related_action (GTK_ACTIVATABLE (button),
+                                      gtk_action_group_get_action (window->action_group, "quit"));
   gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON));
   gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, TRUE, 0);
   gtk_widget_show (button);
diff --git a/xfce4-mixer/xfce-mixer.c b/xfce4-mixer/xfce-mixer.c
index ddcade7..26cb625 100644
--- a/xfce4-mixer/xfce-mixer.c
+++ b/xfce4-mixer/xfce-mixer.c
@@ -57,11 +57,9 @@ static void xfce_mixer_set_property    (GObject        *object,
                                         guint           prop_id,
                                         const GValue   *value,
                                         GParamSpec     *pspec);
-#ifdef HAVE_GST_MIXER_NOTIFICATION
 static void xfce_mixer_bus_message     (GstBus         *bus,
                                         GstMessage     *message,
                                         XfceMixer      *mixer);
-#endif
 
 
 
@@ -125,9 +123,7 @@ xfce_mixer_class_init (XfceMixerClass *klass)
   xfce_mixer_parent_class = g_type_class_peek_parent (klass);
 
   gobject_class = G_OBJECT_CLASS (klass);
-#if GLIB_CHECK_VERSION (2,14,0)
   gobject_class->constructed = xfce_mixer_constructed;
-#endif
   gobject_class->finalize = xfce_mixer_finalize;
   gobject_class->get_property = xfce_mixer_get_property;
   gobject_class->set_property = xfce_mixer_set_property;
@@ -313,9 +309,7 @@ xfce_mixer_constructed (GObject *object)
       gtk_notebook_append_page (GTK_NOTEBOOK (mixer), label2, label1);
     }
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
   mixer->message_handler_id = xfce_mixer_bus_connect (G_CALLBACK (xfce_mixer_bus_message), mixer);
-#endif
 
   g_object_unref (preferences);
 }
@@ -327,9 +321,7 @@ xfce_mixer_finalize (GObject *object)
 {
   XfceMixer *mixer = XFCE_MIXER (object);
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
   xfce_mixer_bus_disconnect (mixer->message_handler_id);
-#endif
 
   g_object_unref (mixer->card);
   g_hash_table_unref (mixer->widgets);
@@ -389,16 +381,12 @@ xfce_mixer_new (GstElement *card)
   g_return_val_if_fail (GST_IS_MIXER (card), NULL);
  
   object = g_object_new (TYPE_XFCE_MIXER, "card", card, NULL);
-#if !GLIB_CHECK_VERSION (2,14,0)
-  xfce_mixer_constructed (object);
-#endif
 
   return GTK_WIDGET (object);
 }
 
 
 
-#ifdef HAVE_GST_MIXER_NOTIFICATION
 static void
 xfce_mixer_bus_message (GstBus     *bus,
                         GstMessage *message,
@@ -471,4 +459,3 @@ xfce_mixer_bus_message (GstBus     *bus,
         xfce_mixer_option_update (XFCE_MIXER_OPTION (widget));
     }
 }
-#endif


More information about the Xfce4-commits mailing list