[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 01/01: Replace g_type_class_add_private deprecations

noreply at xfce.org noreply at xfce.org
Sun Mar 29 04:02:14 CEST 2020


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-pulseaudio-plugin.

commit 0c18d067916146dcca436bd05aecdd7b388f241d
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sat Mar 28 22:02:08 2020 -0400

    Replace g_type_class_add_private deprecations
---
 panel-plugin/devicemenuitem.c | 16 ++++++---------
 panel-plugin/mprismenuitem.c  | 46 ++++++++++++++++++++-----------------------
 panel-plugin/scalemenuitem.c  | 34 +++++++++++++-------------------
 3 files changed, 41 insertions(+), 55 deletions(-)

diff --git a/panel-plugin/devicemenuitem.c b/panel-plugin/devicemenuitem.c
index 32a650f..e02b38a 100644
--- a/panel-plugin/devicemenuitem.c
+++ b/panel-plugin/devicemenuitem.c
@@ -48,11 +48,9 @@ enum {
 static guint signals[LAST_SIGNAL] = { 0 };
 
 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-G_DEFINE_TYPE (DeviceMenuItem, device_menu_item, GTK_TYPE_MENU_ITEM)
+G_DEFINE_TYPE_WITH_PRIVATE (DeviceMenuItem, device_menu_item, GTK_TYPE_MENU_ITEM)
 G_GNUC_END_IGNORE_DEPRECATIONS
 
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_DEVICE_MENU_ITEM, DeviceMenuItemPrivate))
-
 
 
 /* Static Declarations */
@@ -73,7 +71,7 @@ device_menu_item_new_with_label (const gchar *label)
 
   device_item = DEVICE_MENU_ITEM (g_object_new (TYPE_DEVICE_MENU_ITEM, NULL));
 
-  priv = GET_PRIVATE (device_item);
+  priv = device_menu_item_get_instance_private (device_item);
 
   priv->submenu = gtk_menu_new ();
   priv->title = g_strdup (label);
@@ -106,7 +104,7 @@ device_menu_item_add_device (DeviceMenuItem *item,
   DeviceMenuItemPrivate *priv;
   GtkWidget             *mi;
 
-  priv = GET_PRIVATE (item);
+  priv = device_menu_item_get_instance_private (item);
 
   mi = gtk_radio_menu_item_new_with_label (priv->group, description);
   g_object_set_data_full (G_OBJECT (mi), "name", g_strdup (name), (GDestroyNotify) g_free);
@@ -132,7 +130,7 @@ device_menu_item_set_device_by_name (DeviceMenuItem *item,
 
   g_return_if_fail (IS_DEVICE_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = device_menu_item_get_instance_private (item);
 
   children = gtk_container_get_children (GTK_CONTAINER (priv->submenu));
 
@@ -179,8 +177,6 @@ device_menu_item_class_init (DeviceMenuItemClass *item_class)
                                           g_cclosure_marshal_VOID__STRING,
                                           G_TYPE_NONE,
                                           1, G_TYPE_STRING);
-
-  g_type_class_add_private (item_class, sizeof (DeviceMenuItemPrivate));
 }
 
 
@@ -190,7 +186,7 @@ device_menu_item_init (DeviceMenuItem *item)
 {
   DeviceMenuItemPrivate *priv;
 
-  priv = GET_PRIVATE (item);
+  priv = device_menu_item_get_instance_private (item);
 
   priv->submenu = NULL;
   priv->label = NULL;
@@ -207,7 +203,7 @@ device_menu_item_finalize (GObject *object)
   DeviceMenuItemPrivate *priv;
 
   item = DEVICE_MENU_ITEM (object);
-  priv = GET_PRIVATE (item);
+  priv = device_menu_item_get_instance_private (item);
 
   if (priv->title)
     g_free (priv->title);
diff --git a/panel-plugin/mprismenuitem.c b/panel-plugin/mprismenuitem.c
index df5b6ab..43ed266 100644
--- a/panel-plugin/mprismenuitem.c
+++ b/panel-plugin/mprismenuitem.c
@@ -82,11 +82,9 @@ enum {
 static guint signals[LAST_SIGNAL] = { 0 };
 
 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-G_DEFINE_TYPE (MprisMenuItem, mpris_menu_item, GTK_TYPE_IMAGE_MENU_ITEM)
+G_DEFINE_TYPE_WITH_PRIVATE (MprisMenuItem, mpris_menu_item, GTK_TYPE_IMAGE_MENU_ITEM)
 G_GNUC_END_IGNORE_DEPRECATIONS
 
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_MPRIS_MENU_ITEM, MprisMenuItemPrivate))
-
 
 
 /* Static Declarations */
@@ -133,7 +131,7 @@ mpris_menu_item_new_with_player (const gchar *player,
 
   menu_item = MPRIS_MENU_ITEM (g_object_new (TYPE_MPRIS_MENU_ITEM, NULL));
 
-  priv = GET_PRIVATE (menu_item);
+  priv = mpris_menu_item_get_instance_private (menu_item);
 
   priv->player = g_strdup(player);
   if (title != NULL)
@@ -189,7 +187,7 @@ mpris_menu_item_get_player (MprisMenuItem *item)
 
   g_return_val_if_fail (IS_MPRIS_MENU_ITEM (item), NULL);
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   return priv->player;
 }
@@ -204,7 +202,7 @@ mpris_menu_item_set_title (MprisMenuItem *item,
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   if (title == NULL || *title == '\0')
     gtk_label_set_markup_printf_escaped (GTK_LABEL (priv->title_label), "<b>%s</b>", priv->title);
@@ -222,7 +220,7 @@ mpris_menu_item_set_artist (MprisMenuItem *item,
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   if (artist == NULL || *artist == '\0')
     gtk_label_set_label (GTK_LABEL (priv->artist_label), NULL);
@@ -240,7 +238,7 @@ mpris_menu_item_set_can_go_previous (MprisMenuItem *item,
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   priv->can_go_previous = enabled;
 
@@ -260,7 +258,7 @@ mpris_menu_item_set_can_play (MprisMenuItem *item,
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   priv->can_play = enabled;
 
@@ -280,7 +278,7 @@ mpris_menu_item_set_can_pause (MprisMenuItem *item,
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   priv->can_pause = enabled;
 
@@ -305,7 +303,7 @@ mpris_menu_item_set_can_go_next (MprisMenuItem *item,
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   priv->can_go_next = enabled;
 
@@ -325,7 +323,7 @@ mpris_menu_item_set_can_raise (MprisMenuItem *item,
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   priv->can_raise = can_raise;
 }
@@ -340,7 +338,7 @@ mpris_menu_item_set_can_raise_wnck (MprisMenuItem *item,
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   priv->can_raise_wnck = can_raise;
 }
@@ -355,7 +353,7 @@ mpris_menu_item_set_is_running (MprisMenuItem *item,
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   priv->is_running = running;
 
@@ -391,7 +389,7 @@ mpris_menu_item_set_is_playing (MprisMenuItem *item,
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   priv->is_playing = playing;
 
@@ -423,7 +421,7 @@ mpris_menu_item_set_is_stopped (MprisMenuItem *item,
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   priv->is_stopped = stopped;
 
@@ -466,8 +464,6 @@ mpris_menu_item_class_init (MprisMenuItemClass *item_class)
                                         g_cclosure_marshal_VOID__STRING,
                                         G_TYPE_NONE,
                                         1, G_TYPE_STRING);
-
-  g_type_class_add_private (item_class, sizeof (MprisMenuItemPrivate));
 }
 
 
@@ -477,7 +473,7 @@ mpris_menu_item_init (MprisMenuItem *item)
 {
   MprisMenuItemPrivate *priv;
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   priv->title_label = NULL;
   priv->artist_label = NULL;
@@ -502,7 +498,7 @@ mpris_menu_item_finalize (GObject *object)
   MprisMenuItemPrivate *priv;
 
   item = MPRIS_MENU_ITEM (object);
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   if (priv->player)
     g_free (priv->player);
@@ -533,7 +529,7 @@ mpris_menu_item_raise (MprisMenuItem *item)
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   if (priv->is_running)
     {
@@ -560,7 +556,7 @@ mpris_menu_item_launch (MprisMenuItem *item)
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   if (priv->is_running)
     return;
@@ -582,7 +578,7 @@ mpris_menu_item_raise_or_launch (MprisMenuItem *item)
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   if (priv->is_running)
     mpris_menu_item_raise (item);
@@ -602,7 +598,7 @@ mpris_menu_item_get_widget_at_event (MprisMenuItem  *item,
 
   g_return_val_if_fail (IS_MPRIS_MENU_ITEM (item), NULL);
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   gtk_widget_get_allocation (priv->button_box, &alloc);
   gtk_widget_translate_coordinates (GTK_WIDGET (item), priv->button_box, event->x, event->y, &x, &y);
@@ -768,7 +764,7 @@ update_packing (MprisMenuItem *item)
 
   g_return_if_fail (IS_MPRIS_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = mpris_menu_item_get_instance_private (item);
 
   TRACE("entering");
 
diff --git a/panel-plugin/scalemenuitem.c b/panel-plugin/scalemenuitem.c
index 1503e84..5782a6c 100644
--- a/panel-plugin/scalemenuitem.c
+++ b/panel-plugin/scalemenuitem.c
@@ -66,15 +66,11 @@ static guint signals[LAST_SIGNAL] = { 0 };
 
 
 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-G_DEFINE_TYPE (ScaleMenuItem, scale_menu_item, GTK_TYPE_IMAGE_MENU_ITEM)
+G_DEFINE_TYPE_WITH_PRIVATE (ScaleMenuItem, scale_menu_item, GTK_TYPE_IMAGE_MENU_ITEM)
 G_GNUC_END_IGNORE_DEPRECATIONS
 
 
 
-#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_SCALE_MENU_ITEM, ScaleMenuItemPrivate))
-
-
-
 /* Static Declarations */
 static void         scale_menu_item_finalize                (GObject            *object);
 static void         scale_menu_item_update_icon             (ScaleMenuItem      *self);
@@ -106,7 +102,7 @@ scale_menu_item_new_with_range (gdouble min,
 
   scale_item = SCALE_MENU_ITEM (g_object_new (TYPE_SCALE_MENU_ITEM, NULL));
 
-  priv = GET_PRIVATE (scale_item);
+  priv = scale_menu_item_get_instance_private (scale_item);
 
   /* Configure the menu item image */
   priv->image = gtk_image_new ();
@@ -159,7 +155,7 @@ scale_menu_item_get_value (ScaleMenuItem *item)
 
   g_return_val_if_fail (IS_SCALE_MENU_ITEM (item), 0.0);
 
-  priv = GET_PRIVATE (item);
+  priv = scale_menu_item_get_instance_private (item);
 
   return gtk_range_get_value (GTK_RANGE (priv->scale));
 }
@@ -174,7 +170,7 @@ scale_menu_item_set_value (ScaleMenuItem *item,
 
   g_return_if_fail (IS_SCALE_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = scale_menu_item_get_instance_private (item);
 
   gtk_range_set_value (GTK_RANGE (priv->scale), value);
 }
@@ -188,7 +184,7 @@ scale_menu_item_get_muted (ScaleMenuItem *item)
 
   g_return_val_if_fail (IS_SCALE_MENU_ITEM (item), TRUE);
 
-  priv = GET_PRIVATE (item);
+  priv = scale_menu_item_get_instance_private (item);
 
   return !gtk_switch_get_active (GTK_SWITCH (priv->mute_toggle));
 }
@@ -203,7 +199,7 @@ scale_menu_item_set_muted (ScaleMenuItem *item,
 
   g_return_if_fail (IS_SCALE_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = scale_menu_item_get_instance_private (item);
 
   gtk_switch_set_active (GTK_SWITCH (priv->mute_toggle), !muted);
 
@@ -220,7 +216,7 @@ scale_menu_item_set_base_icon_name (ScaleMenuItem *item,
 
   g_return_if_fail (IS_SCALE_MENU_ITEM (item));
 
-  priv = GET_PRIVATE (item);
+  priv = scale_menu_item_get_instance_private (item);
 
   if (priv->icon_name)
     g_free (priv->icon_name);
@@ -302,8 +298,6 @@ scale_menu_item_class_init (ScaleMenuItemClass *item_class)
                                     NULL, NULL,
                                     g_cclosure_marshal_VOID__VOID,
                                     G_TYPE_NONE, 0);
-
-  g_type_class_add_private (item_class, sizeof (ScaleMenuItemPrivate));
 }
 
 
@@ -313,7 +307,7 @@ scale_menu_item_init (ScaleMenuItem *self)
 {
   ScaleMenuItemPrivate *priv;
 
-  priv = GET_PRIVATE (self);
+  priv = scale_menu_item_get_instance_private (self);
 
   priv->scale = NULL;
   priv->image = NULL;
@@ -332,7 +326,7 @@ scale_menu_item_finalize (GObject *object)
   ScaleMenuItemPrivate *priv;
 
   self = SCALE_MENU_ITEM (object);
-  priv = GET_PRIVATE (self);
+  priv = scale_menu_item_get_instance_private (self);
 
   if (priv->icon_name)
     g_free (priv->icon_name);
@@ -351,7 +345,7 @@ scale_menu_item_finalize (GObject *object)
 static void
 scale_menu_item_update_icon (ScaleMenuItem *self)
 {
-  ScaleMenuItemPrivate *priv = GET_PRIVATE (self);
+  ScaleMenuItemPrivate *priv = scale_menu_item_get_instance_private (self);
   gchar                *icon_name = NULL;
   gdouble               value = gtk_range_get_value (GTK_RANGE (priv->scale));
 
@@ -397,7 +391,7 @@ scale_menu_item_button_press_event (GtkWidget      *item,
 
   g_return_val_if_fail (IS_SCALE_MENU_ITEM (item), FALSE);
 
-  priv = GET_PRIVATE (item);
+  priv = scale_menu_item_get_instance_private (SCALE_MENU_ITEM (item));
 
   gtk_widget_get_allocation (priv->mute_toggle, &alloc);
   gtk_widget_translate_coordinates (GTK_WIDGET (item), priv->mute_toggle, event->x, event->y, &x, &y);
@@ -436,7 +430,7 @@ scale_menu_item_button_release_event (GtkWidget      *item,
 
   g_return_val_if_fail (IS_SCALE_MENU_ITEM (item), FALSE);
 
-  priv = GET_PRIVATE (item);
+  priv = scale_menu_item_get_instance_private (SCALE_MENU_ITEM (item));
 
   gtk_widget_get_allocation (priv->mute_toggle, &alloc);
   gtk_widget_translate_coordinates (GTK_WIDGET (item), priv->mute_toggle, event->x, event->y, &x, &y);
@@ -476,7 +470,7 @@ scale_menu_item_motion_notify_event (GtkWidget      *item,
 
   g_return_val_if_fail (IS_SCALE_MENU_ITEM (item), FALSE);
 
-  priv = GET_PRIVATE (item);
+  priv = scale_menu_item_get_instance_private (SCALE_MENU_ITEM (item));
   scale = priv->scale;
 
   gtk_widget_get_allocation (priv->scale, &alloc);
@@ -501,7 +495,7 @@ menu_hidden (GtkWidget     *menu,
   g_return_if_fail (IS_SCALE_MENU_ITEM (scale));
   g_return_if_fail (GTK_IS_MENU (menu));
 
-  priv = GET_PRIVATE (scale);
+  priv = scale_menu_item_get_instance_private (scale);
 
   if (priv->grabbed)
     {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list