[Xfce4-commits] [xfce/xfce4-power-manager] 01/02: Fix g_type_class_add_private is deprecated

noreply at xfce.org noreply at xfce.org
Sun Apr 14 22:20:50 CEST 2019


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

a   n   d   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 xfce/xfce4-power-manager.

commit 8c356dd9591ee6189c2df1831939b1e68d0868cb
Author: Andre Miranda <andreldm at xfce.org>
Date:   Sun Apr 14 17:09:45 2019 -0300

    Fix g_type_class_add_private is deprecated
---
 common/xfpm-brightness.c                           |  9 ++----
 libdbus/xfpm-dbus-monitor.c                        |  6 ++--
 .../power-manager-plugin/power-manager-button.c    |  9 ++----
 panel-plugins/power-manager-plugin/scalemenuitem.c | 35 ++++++++++------------
 settings/xfpm-settings-app.c                       | 14 ++++-----
 src/egg-idletime.c                                 |  9 ++----
 src/xfce-screensaver.c                             |  9 ++----
 src/xfpm-backlight.c                               |  9 ++----
 src/xfpm-battery.c                                 |  9 ++----
 src/xfpm-button.c                                  |  9 ++----
 src/xfpm-console-kit.c                             |  9 ++----
 src/xfpm-dpms.c                                    |  9 ++----
 src/xfpm-inhibit.c                                 |  9 ++----
 src/xfpm-kbd-backlight.c                           |  9 ++----
 src/xfpm-manager.c                                 |  9 ++----
 src/xfpm-notify.c                                  |  9 ++----
 src/xfpm-polkit.c                                  |  9 ++----
 src/xfpm-power.c                                   | 10 ++-----
 src/xfpm-systemd.c                                 |  9 ++----
 src/xfpm-xfconf.c                                  |  9 ++----
 20 files changed, 57 insertions(+), 152 deletions(-)

diff --git a/common/xfpm-brightness.c b/common/xfpm-brightness.c
index 563c12c..0114735 100644
--- a/common/xfpm-brightness.c
+++ b/common/xfpm-brightness.c
@@ -41,9 +41,6 @@
 
 static void xfpm_brightness_finalize   (GObject *object);
 
-#define XFPM_BRIGHTNESS_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_BRIGHTNESS, XfpmBrightnessPrivate))
-
 struct XfpmBrightnessPrivate
 {
     XRRScreenResources *resource;
@@ -58,7 +55,7 @@ struct XfpmBrightnessPrivate
     gint32		step;
 };
 
-G_DEFINE_TYPE (XfpmBrightness, xfpm_brightness, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmBrightness, xfpm_brightness, G_TYPE_OBJECT)
 
 static gboolean
 xfpm_brightness_xrand_get_limit (XfpmBrightness *brightness, RROutput output, gint *min, gint *max)
@@ -542,14 +539,12 @@ xfpm_brightness_class_init (XfpmBrightnessClass *klass)
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
     object_class->finalize = xfpm_brightness_finalize;
-
-    g_type_class_add_private (klass, sizeof (XfpmBrightnessPrivate));
 }
 
 static void
 xfpm_brightness_init (XfpmBrightness *brightness)
 {
-    brightness->priv = XFPM_BRIGHTNESS_GET_PRIVATE (brightness);
+    brightness->priv = xfpm_brightness_get_instance_private (brightness);
 
     brightness->priv->resource = NULL;
     brightness->priv->xrandr_has_hw = FALSE;
diff --git a/libdbus/xfpm-dbus-monitor.c b/libdbus/xfpm-dbus-monitor.c
index af6c29f..06d77d2 100644
--- a/libdbus/xfpm-dbus-monitor.c
+++ b/libdbus/xfpm-dbus-monitor.c
@@ -68,7 +68,7 @@ enum
 
 static guint signals [LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE (XfpmDBusMonitor, xfpm_dbus_monitor, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmDBusMonitor, xfpm_dbus_monitor, G_TYPE_OBJECT)
 
 static void
 xfpm_dbus_monitor_free_watch_data (XfpmWatchData *data)
@@ -248,14 +248,12 @@ xfpm_dbus_monitor_class_init (XfpmDBusMonitorClass *klass)
 		      G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
 		     
     object_class->finalize = xfpm_dbus_monitor_finalize;
-
-    g_type_class_add_private (klass, sizeof (XfpmDBusMonitorPrivate));
 }
 
 static void
 xfpm_dbus_monitor_init (XfpmDBusMonitor *monitor)
 {
-    monitor->priv = XFPM_DBUS_MONITOR_GET_PRIVATE (monitor);
+    monitor->priv = xfpm_dbus_monitor_get_instance_private (monitor);
     
     monitor->priv->names_array = g_ptr_array_new ();
     monitor->priv->services_array = g_ptr_array_new ();
diff --git a/panel-plugins/power-manager-plugin/power-manager-button.c b/panel-plugins/power-manager-plugin/power-manager-button.c
index d59a8bb..a197afc 100644
--- a/panel-plugins/power-manager-plugin/power-manager-button.c
+++ b/panel-plugins/power-manager-plugin/power-manager-button.c
@@ -52,9 +52,6 @@
 #define PANEL_DEFAULT_ICON ("battery-full-charged")
 #define PANEL_DEFAULT_ICON_SYMBOLIC ("battery-full-charged-symbolic")
 
-#define POWER_MANAGER_BUTTON_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), POWER_MANAGER_TYPE_BUTTON, PowerManagerButtonPrivate))
-
 struct PowerManagerButtonPrivate
 {
 #ifdef XFCE_PLUGIN
@@ -135,7 +132,7 @@ enum {
 
 static guint __signals[SIG_N_SIGNALS] = { 0, };
 
-G_DEFINE_TYPE (PowerManagerButton, power_manager_button, GTK_TYPE_TOGGLE_BUTTON)
+G_DEFINE_TYPE_WITH_PRIVATE (PowerManagerButton, power_manager_button, GTK_TYPE_TOGGLE_BUTTON)
 
 static void power_manager_button_finalize   (GObject *object);
 static GList* find_device_in_list (PowerManagerButton *button, const gchar *object_path);
@@ -857,8 +854,6 @@ power_manager_button_class_init (PowerManagerButtonClass *klass)
     widget_class->button_press_event = power_manager_button_press_event;
     widget_class->scroll_event = power_manager_button_scroll_event;
 
-    g_type_class_add_private (klass, sizeof (PowerManagerButtonPrivate));
-
     __signals[SIG_TOOLTIP_CHANGED] = g_signal_new ("tooltip-changed",
                                                    POWER_MANAGER_TYPE_BUTTON,
                                                    G_SIGNAL_RUN_LAST,
@@ -924,7 +919,7 @@ power_manager_button_init (PowerManagerButton *button)
     GError *error = NULL;
     GtkCssProvider *css_provider;
 
-    button->priv = POWER_MANAGER_BUTTON_GET_PRIVATE (button);
+    button->priv = power_manager_button_get_instance_private (button);
 
     gtk_widget_set_can_default (GTK_WIDGET (button), FALSE);
     gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE);
diff --git a/panel-plugins/power-manager-plugin/scalemenuitem.c b/panel-plugins/power-manager-plugin/scalemenuitem.c
index 600c127..8d85c8c 100644
--- a/panel-plugins/power-manager-plugin/scalemenuitem.c
+++ b/panel-plugins/power-manager-plugin/scalemenuitem.c
@@ -78,11 +78,9 @@ enum {
 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 void
@@ -90,7 +88,7 @@ scale_menu_item_scale_value_changed (GtkRange *range,
                                      gpointer  user_data)
 {
   ScaleMenuItem *self = user_data;
-  ScaleMenuItemPrivate *priv = GET_PRIVATE (self);
+  ScaleMenuItemPrivate *priv = scale_menu_item_get_instance_private (self);
 
   /* The signal is not sent when it was set through
    * scale_menu_item_set_value().  */
@@ -156,9 +154,6 @@ scale_menu_item_class_init (ScaleMenuItemClass *item_class)
                                          g_cclosure_marshal_VOID__DOUBLE,
                                          G_TYPE_NONE,
                                          1, G_TYPE_DOUBLE);
-
-
-  g_type_class_add_private (item_class, sizeof (ScaleMenuItemPrivate));
 }
 
 static void
@@ -174,7 +169,7 @@ remove_children (GtkContainer *container)
 static void
 update_packing (ScaleMenuItem *self)
 {
-  ScaleMenuItemPrivate *priv = GET_PRIVATE (self);
+  ScaleMenuItemPrivate *priv = scale_menu_item_get_instance_private (self);
   GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   GtkWidget *vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
 
@@ -243,7 +238,7 @@ static gboolean
 scale_menu_item_button_press_event (GtkWidget      *menuitem,
                                     GdkEventButton *event)
 {
-  ScaleMenuItemPrivate *priv = GET_PRIVATE (menuitem);
+  ScaleMenuItemPrivate *priv = scale_menu_item_get_instance_private (SCALE_MENU_ITEM (menuitem));
   GtkAllocation alloc;
   gint x, y;
 
@@ -269,7 +264,7 @@ static gboolean
 scale_menu_item_button_release_event (GtkWidget *menuitem,
                                       GdkEventButton *event)
 {
-  ScaleMenuItemPrivate *priv = GET_PRIVATE (menuitem);
+  ScaleMenuItemPrivate *priv = scale_menu_item_get_instance_private (SCALE_MENU_ITEM (menuitem));
 
   TRACE("entering");
 
@@ -288,7 +283,7 @@ static gboolean
 scale_menu_item_motion_notify_event (GtkWidget      *menuitem,
                                      GdkEventMotion *event)
 {
-  ScaleMenuItemPrivate *priv = GET_PRIVATE (menuitem);
+  ScaleMenuItemPrivate *priv = scale_menu_item_get_instance_private (SCALE_MENU_ITEM (menuitem));
   GtkWidget *scale = priv->scale;
   GtkAllocation alloc;
   gint x, y;
@@ -316,7 +311,7 @@ static gboolean
 scale_menu_item_grab_broken (GtkWidget *menuitem,
                              GdkEventGrabBroken *event)
 {
-  ScaleMenuItemPrivate *priv = GET_PRIVATE (menuitem);
+  ScaleMenuItemPrivate *priv = scale_menu_item_get_instance_private (SCALE_MENU_ITEM (menuitem));
 
   TRACE("entering");
 
@@ -329,7 +324,7 @@ static void
 menu_hidden (GtkWidget        *menu,
              ScaleMenuItem *scale)
 {
-  ScaleMenuItemPrivate *priv = GET_PRIVATE (scale);
+  ScaleMenuItemPrivate *priv = scale_menu_item_get_instance_private (scale);
 
   if (priv->grabbed)
     {
@@ -372,7 +367,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);
 
   priv->scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, min, max, step);
   priv->vbox = NULL;
@@ -406,7 +401,7 @@ scale_menu_item_get_scale (ScaleMenuItem *menuitem)
 
   g_return_val_if_fail (IS_SCALE_MENU_ITEM (menuitem), NULL);
 
-  priv = GET_PRIVATE (menuitem);
+  priv = scale_menu_item_get_instance_private (menuitem);
 
   return priv->scale;
 }
@@ -426,7 +421,7 @@ scale_menu_item_get_description_label (ScaleMenuItem *menuitem)
 
   g_return_val_if_fail (IS_SCALE_MENU_ITEM (menuitem), NULL);
 
-  priv = GET_PRIVATE (menuitem);
+  priv = scale_menu_item_get_instance_private (menuitem);
 
   return gtk_label_get_text (GTK_LABEL (priv->description_label));
 }
@@ -446,7 +441,7 @@ scale_menu_item_get_percentage_label (ScaleMenuItem *menuitem)
 
   g_return_val_if_fail (IS_SCALE_MENU_ITEM (menuitem), NULL);
 
-  priv = GET_PRIVATE (menuitem);
+  priv = scale_menu_item_get_instance_private (menuitem);
 
   return gtk_label_get_text (GTK_LABEL (priv->percentage_label));
 }
@@ -467,7 +462,7 @@ scale_menu_item_set_description_label (ScaleMenuItem *menuitem,
 
   g_return_if_fail (IS_SCALE_MENU_ITEM (menuitem));
 
-  priv = GET_PRIVATE (menuitem);
+  priv = scale_menu_item_get_instance_private (menuitem);
 
   if (label == NULL && priv->description_label)
     {
@@ -511,7 +506,7 @@ scale_menu_item_set_percentage_label (ScaleMenuItem *menuitem,
 
   g_return_if_fail (IS_SCALE_MENU_ITEM (menuitem));
 
-  priv = GET_PRIVATE (menuitem);
+  priv = scale_menu_item_get_instance_private (menuitem);
 
   if (label == NULL && priv->percentage_label)
     {
@@ -547,7 +542,7 @@ void
 scale_menu_item_set_value (ScaleMenuItem *item,
                            gdouble        value)
 {
-  ScaleMenuItemPrivate *priv = GET_PRIVATE (item);
+  ScaleMenuItemPrivate *priv = scale_menu_item_get_instance_private (item);
 
   /* set ignore_value_changed to signify to the scale menu item that it
    * should not emit its own value-changed signal, as that should only
diff --git a/settings/xfpm-settings-app.c b/settings/xfpm-settings-app.c
index 388405f..f1b4fa4 100644
--- a/settings/xfpm-settings-app.c
+++ b/settings/xfpm-settings-app.c
@@ -63,11 +63,9 @@ static void activate_quit                (GSimpleAction  *action,
                                           GVariant       *parameter,
                                           gpointer        data);
 
-G_DEFINE_TYPE(XfpmSettingsApp, xfpm_settings_app, GTK_TYPE_APPLICATION);
+G_DEFINE_TYPE_WITH_PRIVATE(XfpmSettingsApp, xfpm_settings_app, GTK_TYPE_APPLICATION);
 
 
-#define XFPM_SETTINGS_APP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_SETTINGS_APP, XfpmSettingsAppPrivate))
-
 
 static void
 xfpm_settings_app_init (XfpmSettingsApp *app)
@@ -118,7 +116,7 @@ xfpm_settings_app_activate (GApplication *app)
 static void
 xfpm_settings_app_launch (GApplication *app)
 {
-    XfpmSettingsAppPrivate *priv = XFPM_SETTINGS_APP_GET_PRIVATE (app);
+    XfpmSettingsAppPrivate *priv = xfpm_settings_app_get_instance_private (XFPM_SETTINGS_APP (app));
 
     XfpmPowerManager *manager;
     XfconfChannel    *channel;
@@ -276,7 +274,7 @@ activate_socket (GSimpleAction  *action,
                  gpointer        data)
 {
     XfpmSettingsApp *app = XFPM_SETTINGS_APP (data);
-    XfpmSettingsAppPrivate *priv = XFPM_SETTINGS_APP_GET_PRIVATE (app);
+    XfpmSettingsAppPrivate *priv = xfpm_settings_app_get_instance_private (app);
 
     TRACE ("entering");
 
@@ -291,7 +289,7 @@ activate_device (GSimpleAction  *action,
                  gpointer        data)
 {
     XfpmSettingsApp *app = XFPM_SETTINGS_APP (data);
-    XfpmSettingsAppPrivate *priv = XFPM_SETTINGS_APP_GET_PRIVATE (app);
+    XfpmSettingsAppPrivate *priv = xfpm_settings_app_get_instance_private (app);
 
     TRACE ("entering");
 
@@ -306,7 +304,7 @@ activate_debug (GSimpleAction  *action,
                 gpointer        data)
 {
     XfpmSettingsApp *app = XFPM_SETTINGS_APP (data);
-    XfpmSettingsAppPrivate *priv = XFPM_SETTINGS_APP_GET_PRIVATE (app);
+    XfpmSettingsAppPrivate *priv = xfpm_settings_app_get_instance_private (app);
 
     TRACE ("entering");
 
@@ -418,8 +416,6 @@ xfpm_settings_app_class_init (XfpmSettingsAppClass *class)
     gapplication_class->handle_local_options = xfpm_settings_app_local_options;
     gapplication_class->startup              = xfpm_settings_app_startup;
     gapplication_class->activate             = xfpm_settings_app_activate;
-
-    g_type_class_add_private (class, sizeof (XfpmSettingsAppPrivate));
 }
 
 XfpmSettingsApp *
diff --git a/src/egg-idletime.c b/src/egg-idletime.c
index 2c04be7..cb23ba8 100644
--- a/src/egg-idletime.c
+++ b/src/egg-idletime.c
@@ -41,8 +41,6 @@
 
 static void     egg_idletime_finalize   (GObject       *object);
 
-#define EGG_IDLETIME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EGG_IDLETIME_TYPE, EggIdletimePrivate))
-
 /*
  * Undef and use the function instead of the macro
  * as the macro is buggy.
@@ -83,7 +81,7 @@ typedef enum {
 static guint signals [LAST_SIGNAL] = { 0 };
 static gpointer egg_idletime_object = NULL;
 
-G_DEFINE_TYPE (EggIdletime, egg_idletime, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (EggIdletime, egg_idletime, G_TYPE_OBJECT)
 
 /**
  * egg_idletime_xsyncvalue_to_int64:
@@ -363,7 +361,6 @@ egg_idletime_class_init (EggIdletimeClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 	object_class->finalize = egg_idletime_finalize;
-	g_type_class_add_private (klass, sizeof (EggIdletimePrivate));
 
 	signals [SIGNAL_ALARM_EXPIRED] =
 		g_signal_new ("alarm-expired",
@@ -393,7 +390,7 @@ egg_idletime_init (EggIdletime *idletime)
 	EggIdletimeAlarm *eggalarm;
 	guint i;
 
-	idletime->priv = EGG_IDLETIME_GET_PRIVATE (idletime);
+	idletime->priv = egg_idletime_get_instance_private (idletime);
 
 	idletime->priv->array = g_ptr_array_new ();
 
@@ -444,7 +441,7 @@ egg_idletime_finalize (GObject *object)
 	g_return_if_fail (EGG_IS_IDLETIME (object));
 
 	idletime = EGG_IDLETIME (object);
-	idletime->priv = EGG_IDLETIME_GET_PRIVATE (idletime);
+	idletime->priv = egg_idletime_get_instance_private (idletime);
 
 	/* free all counters, including reset counter */
 	for (i=0; i<idletime->priv->array->len; i++) {
diff --git a/src/xfce-screensaver.c b/src/xfce-screensaver.c
index ebfaf8f..35dc49d 100644
--- a/src/xfce-screensaver.c
+++ b/src/xfce-screensaver.c
@@ -61,9 +61,6 @@ static void xfce_screensaver_get_property(GObject *object,
                                           GParamSpec *pspec);
 
 
-#define XFCE_SCREENSAVER_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFCE_TYPE_SCREENSAVER, XfceScreenSaverPrivate))
-
 
 typedef enum
 {
@@ -96,7 +93,7 @@ struct XfceScreenSaverPrivate
 };
 
 
-G_DEFINE_TYPE (XfceScreenSaver, xfce_screensaver, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfceScreenSaver, xfce_screensaver, G_TYPE_OBJECT)
 
 
 static void
@@ -108,8 +105,6 @@ xfce_screensaver_class_init (XfceScreenSaverClass *klass)
     object_class->set_property = xfce_screensaver_set_property;
     object_class->get_property = xfce_screensaver_get_property;
 
-    g_type_class_add_private (klass, sizeof (XfceScreenSaverPrivate));
-
 #define XFCE_PARAM_FLAGS  (G_PARAM_READWRITE \
                          | G_PARAM_CONSTRUCT \
                          | G_PARAM_STATIC_NAME \
@@ -275,7 +270,7 @@ xfce_screensaver_init (XfceScreenSaver *saver)
 {
     GError *error = NULL;
 
-    saver->priv = XFCE_SCREENSAVER_GET_PRIVATE (saver);
+    saver->priv = xfce_screensaver_get_instance_private (saver);
 
     if ( !xfconf_init (&error) )
     {
diff --git a/src/xfpm-backlight.c b/src/xfpm-backlight.c
index adf1d82..c72386f 100644
--- a/src/xfpm-backlight.c
+++ b/src/xfpm-backlight.c
@@ -62,9 +62,6 @@ static void xfpm_backlight_set_property (GObject *object,
 
 #define ALARM_DISABLED 9
 
-#define XFPM_BACKLIGHT_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_BACKLIGHT, XfpmBacklightPrivate))
-
 struct XfpmBacklightPrivate
 {
     XfpmBrightness *brightness;
@@ -98,7 +95,7 @@ enum
     N_PROPERTIES
 };
 
-G_DEFINE_TYPE (XfpmBacklight, xfpm_backlight, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmBacklight, xfpm_backlight, G_TYPE_OBJECT)
 
 
 static void
@@ -327,14 +324,12 @@ xfpm_backlight_class_init (XfpmBacklightClass *klass)
                                                        1,
                                                        -1,
                                                        G_PARAM_READWRITE));
-
-    g_type_class_add_private (klass, sizeof (XfpmBacklightPrivate));
 }
 
 static void
 xfpm_backlight_init (XfpmBacklight *backlight)
 {
-    backlight->priv = XFPM_BACKLIGHT_GET_PRIVATE (backlight);
+    backlight->priv = xfpm_backlight_get_instance_private (backlight);
 
     backlight->priv->brightness = xfpm_brightness_new ();
     backlight->priv->has_hw     = xfpm_brightness_setup (backlight->priv->brightness);
diff --git a/src/xfpm-battery.c b/src/xfpm-battery.c
index b81e1f6..4d204d6 100644
--- a/src/xfpm-battery.c
+++ b/src/xfpm-battery.c
@@ -50,9 +50,6 @@
 
 static void xfpm_battery_finalize   (GObject *object);
 
-#define XFPM_BATTERY_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_BATTERY, XfpmBatteryPrivate))
-
 struct XfpmBatteryPrivate
 {
     XfpmXfconf             *conf;
@@ -95,7 +92,7 @@ enum
 
 static guint signals [LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE (XfpmBattery, xfpm_battery, GTK_TYPE_WIDGET)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmBattery, xfpm_battery, GTK_TYPE_WIDGET)
 
 
 static gchar *
@@ -399,14 +396,12 @@ xfpm_battery_class_init (XfpmBatteryClass *klass)
 							XFPM_TYPE_BATTERY_CHARGE,
 							XFPM_BATTERY_CHARGE_UNKNOWN,
                                                         G_PARAM_READABLE));
-
-    g_type_class_add_private (klass, sizeof (XfpmBatteryPrivate));
 }
 
 static void
 xfpm_battery_init (XfpmBattery *battery)
 {
-    battery->priv = XFPM_BATTERY_GET_PRIVATE (battery);
+    battery->priv = xfpm_battery_get_instance_private (battery);
 
     battery->priv->conf          = xfpm_xfconf_new ();
     battery->priv->notify        = xfpm_notify_new ();
diff --git a/src/xfpm-button.c b/src/xfpm-button.c
index dcf639c..6453d60 100644
--- a/src/xfpm-button.c
+++ b/src/xfpm-button.c
@@ -54,9 +54,6 @@
 
 static void xfpm_button_finalize   (GObject *object);
 
-#define XFPM_BUTTON_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE((o), XFPM_TYPE_BUTTON, XfpmButtonPrivate))
-
 static struct
 {
     XfpmButtonKey    key;
@@ -81,7 +78,7 @@ enum
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE(XfpmButton, xfpm_button, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmButton, xfpm_button, G_TYPE_OBJECT)
 
 static guint
 xfpm_button_get_key (unsigned int keycode)
@@ -244,14 +241,12 @@ xfpm_button_class_init(XfpmButtonClass *klass)
                       G_TYPE_NONE, 1, XFPM_TYPE_BUTTON_KEY);
 
     object_class->finalize = xfpm_button_finalize;
-
-    g_type_class_add_private (klass, sizeof (XfpmButtonPrivate));
 }
 
 static void
 xfpm_button_init (XfpmButton *button)
 {
-    button->priv = XFPM_BUTTON_GET_PRIVATE (button);
+    button->priv = xfpm_button_get_instance_private (button);
     
     button->priv->mapped_buttons = 0;
     button->priv->screen = NULL;
diff --git a/src/xfpm-console-kit.c b/src/xfpm-console-kit.c
index 5f2f941..2909a30 100644
--- a/src/xfpm-console-kit.c
+++ b/src/xfpm-console-kit.c
@@ -40,9 +40,6 @@ static void xfpm_console_kit_get_property (GObject *object,
 					   guint prop_id,
 					   GValue *value,
 					   GParamSpec *pspec);
-	    
-#define XFPM_CONSOLE_KIT_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_CONSOLE_KIT, XfpmConsoleKitPrivate))
 
 struct XfpmConsoleKitPrivate
 {
@@ -66,7 +63,7 @@ enum
     PROP_CAN_HIBERNATE
 };
 
-G_DEFINE_TYPE (XfpmConsoleKit, xfpm_console_kit, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmConsoleKit, xfpm_console_kit, G_TYPE_OBJECT)
 
 static void
 xfpm_console_kit_get_info (XfpmConsoleKit *console)
@@ -204,8 +201,6 @@ xfpm_console_kit_class_init (XfpmConsoleKitClass *klass)
                                                            NULL, NULL,
                                                            FALSE,
                                                            G_PARAM_READABLE));
-
-    g_type_class_add_private (klass, sizeof (XfpmConsoleKitPrivate));
 }
 
 static void
@@ -213,7 +208,7 @@ xfpm_console_kit_init (XfpmConsoleKit *console)
 {
     GError *error = NULL;
     
-    console->priv = XFPM_CONSOLE_KIT_GET_PRIVATE (console);
+    console->priv = xfpm_console_kit_get_instance_private (console);
     console->priv->can_shutdown = FALSE;
     console->priv->can_restart  = FALSE;
     
diff --git a/src/xfpm-dpms.c b/src/xfpm-dpms.c
index c117bbc..e18d4b3 100644
--- a/src/xfpm-dpms.c
+++ b/src/xfpm-dpms.c
@@ -45,9 +45,6 @@
 
 static void xfpm_dpms_finalize   (GObject *object);
 
-#define XFPM_DPMS_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE((o), XFPM_TYPE_DPMS, XfpmDpmsPrivate))
-
 struct XfpmDpmsPrivate
 {
     XfpmXfconf      *conf;
@@ -61,7 +58,7 @@ struct XfpmDpmsPrivate
     gulong	     switch_on_timeout_id;
 };
 
-G_DEFINE_TYPE (XfpmDpms, xfpm_dpms, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmDpms, xfpm_dpms, G_TYPE_OBJECT)
 
 static void
 xfpm_dpms_set_timeouts (XfpmDpms *dpms, guint16 standby, guint16 suspend, guint off)
@@ -208,8 +205,6 @@ xfpm_dpms_class_init(XfpmDpmsClass *klass)
     GObjectClass *object_class = G_OBJECT_CLASS(klass);
     
     object_class->finalize = xfpm_dpms_finalize;
-
-    g_type_class_add_private(klass,sizeof(XfpmDpmsPrivate));
 }
 
 /*
@@ -218,7 +213,7 @@ xfpm_dpms_class_init(XfpmDpmsClass *klass)
 static void
 xfpm_dpms_init(XfpmDpms *dpms)
 {
-    dpms->priv = XFPM_DPMS_GET_PRIVATE(dpms);
+    dpms->priv = xfpm_dpms_get_instance_private(dpms);
     
     dpms->priv->dpms_capable = DPMSCapable (gdk_x11_get_default_xdisplay());
     dpms->priv->switch_off_timeout_id = 0;
diff --git a/src/xfpm-inhibit.c b/src/xfpm-inhibit.c
index fba4a6e..510b24e 100644
--- a/src/xfpm-inhibit.c
+++ b/src/xfpm-inhibit.c
@@ -44,9 +44,6 @@ static void xfpm_inhibit_finalize   (GObject *object);
 static void xfpm_inhibit_dbus_class_init  (XfpmInhibitClass *klass);
 static void xfpm_inhibit_dbus_init	  (XfpmInhibit *inhibit);
 
-#define XFPM_INHIBIT_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE((o), XFPM_TYPE_INHIBIT, XfpmInhibitPrivate))
-
 struct XfpmInhibitPrivate
 {
     XfpmDBusMonitor *monitor;
@@ -71,7 +68,7 @@ enum
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE (XfpmInhibit, xfpm_inhibit, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmInhibit, xfpm_inhibit, G_TYPE_OBJECT)
 
 static void
 xfpm_inhibit_free_inhibitor (XfpmInhibit *inhibit, Inhibitor *inhibitor)
@@ -233,8 +230,6 @@ xfpm_inhibit_class_init(XfpmInhibitClass *klass)
 			 G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
 
     object_class->finalize = xfpm_inhibit_finalize;
-
-    g_type_class_add_private (klass, sizeof (XfpmInhibitPrivate));
     
     xfpm_inhibit_dbus_class_init (klass);
 }
@@ -242,7 +237,7 @@ xfpm_inhibit_class_init(XfpmInhibitClass *klass)
 static void
 xfpm_inhibit_init (XfpmInhibit *inhibit)
 {
-    inhibit->priv = XFPM_INHIBIT_GET_PRIVATE(inhibit);
+    inhibit->priv = xfpm_inhibit_get_instance_private (inhibit);
     
     inhibit->priv->array   = g_ptr_array_new ();
     inhibit->priv->monitor = xfpm_dbus_monitor_new ();
diff --git a/src/xfpm-kbd-backlight.c b/src/xfpm-kbd-backlight.c
index 3dbb406..f450fa3 100644
--- a/src/xfpm-kbd-backlight.c
+++ b/src/xfpm-kbd-backlight.c
@@ -33,9 +33,6 @@
 #include "xfpm-notify.h"
 #include "xfpm-power.h"
 
-#define XFPM_KBD_BACKLIGHT_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_KBD_BACKLIGHT, XfpmKbdBacklightPrivate))
-
 static void xfpm_kbd_backlight_finalize     (GObject *object);
 
 struct XfpmKbdBacklightPrivate
@@ -56,7 +53,7 @@ struct XfpmKbdBacklightPrivate
     NotifyNotification *n;
 };
 
-G_DEFINE_TYPE (XfpmKbdBacklight, xfpm_kbd_backlight, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmKbdBacklight, xfpm_kbd_backlight, G_TYPE_OBJECT)
 
 
 static gint
@@ -251,8 +248,6 @@ xfpm_kbd_backlight_class_init (XfpmKbdBacklightClass *klass)
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
     object_class->finalize = xfpm_kbd_backlight_finalize;
-
-    g_type_class_add_private (klass, sizeof (XfpmKbdBacklightPrivate));
 }
 
 
@@ -261,7 +256,7 @@ xfpm_kbd_backlight_init (XfpmKbdBacklight *backlight)
 {
     GError *error = NULL;
 
-    backlight->priv = XFPM_KBD_BACKLIGHT_GET_PRIVATE (backlight);
+    backlight->priv = xfpm_kbd_backlight_get_instance_private (backlight);
 
     backlight->priv->bus = NULL;
     backlight->priv->proxy = NULL;
diff --git a/src/xfpm-manager.c b/src/xfpm-manager.c
index ad96a5b..88231f3 100644
--- a/src/xfpm-manager.c
+++ b/src/xfpm-manager.c
@@ -83,9 +83,6 @@ static gboolean xfpm_manager_quit (XfpmManager *manager);
 static void xfpm_manager_show_tray_icon (XfpmManager *manager);
 static void xfpm_manager_hide_tray_icon (XfpmManager *manager);
 
-#define XFPM_MANAGER_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE((o), XFPM_TYPE_MANAGER, XfpmManagerPrivate))
-
 #define SLEEP_KEY_TIMEOUT 6.0f
 
 struct XfpmManagerPrivate
@@ -126,7 +123,7 @@ enum
     PROP_SHOW_TRAY_ICON
 };
 
-G_DEFINE_TYPE (XfpmManager, xfpm_manager, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmManager, xfpm_manager, G_TYPE_OBJECT)
 
 static void
 xfpm_manager_class_init (XfpmManagerClass *klass)
@@ -137,8 +134,6 @@ xfpm_manager_class_init (XfpmManagerClass *klass)
     object_class->set_property = xfpm_manager_set_property;
     object_class->get_property = xfpm_manager_get_property;
 
-    g_type_class_add_private (klass, sizeof (XfpmManagerPrivate));
-
 #define XFPM_PARAM_FLAGS  (G_PARAM_READWRITE \
                            | G_PARAM_CONSTRUCT \
                            | G_PARAM_STATIC_NAME \
@@ -157,7 +152,7 @@ xfpm_manager_class_init (XfpmManagerClass *klass)
 static void
 xfpm_manager_init (XfpmManager *manager)
 {
-    manager->priv = XFPM_MANAGER_GET_PRIVATE (manager);
+    manager->priv = xfpm_manager_get_instance_private (manager);
 
     manager->priv->timer = g_timer_new ();
 
diff --git a/src/xfpm-notify.c b/src/xfpm-notify.c
index c670f12..c1845a6 100644
--- a/src/xfpm-notify.c
+++ b/src/xfpm-notify.c
@@ -54,9 +54,6 @@ static NotifyNotification * xfpm_notify_new_notification_internal (const gchar *
 								   guint timeout,
 								   XfpmNotifyUrgency urgency) G_GNUC_MALLOC;
 
-#define XFPM_NOTIFY_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE((o), XFPM_TYPE_NOTIFY, XfpmNotifyPrivate))
-
 struct XfpmNotifyPrivate
 {
     XfpmDBusMonitor    *monitor;
@@ -78,7 +75,7 @@ enum
     PROP_SYNC
 };
 
-G_DEFINE_TYPE(XfpmNotify, xfpm_notify, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmNotify, xfpm_notify, G_TYPE_OBJECT)
 
 static void
 xfpm_notify_get_server_caps (XfpmNotify *notify)
@@ -157,14 +154,12 @@ xfpm_notify_class_init (XfpmNotifyClass *klass)
                                                            NULL, NULL,
                                                            FALSE,
                                                            G_PARAM_READABLE));
-
-    g_type_class_add_private (klass, sizeof (XfpmNotifyPrivate));
 }
 
 static void
 xfpm_notify_init (XfpmNotify *notify)
 {
-    notify->priv = XFPM_NOTIFY_GET_PRIVATE (notify);
+    notify->priv = xfpm_notify_get_instance_private (notify);
 
     notify->priv->notification = NULL;
     notify->priv->critical = NULL;
diff --git a/src/xfpm-polkit.c b/src/xfpm-polkit.c
index 4fc14ef..2183170 100644
--- a/src/xfpm-polkit.c
+++ b/src/xfpm-polkit.c
@@ -64,9 +64,6 @@
 
 static void xfpm_polkit_finalize   (GObject *object);
 
-#define XFPM_POLKIT_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_POLKIT, XfpmPolkitPrivate))
-
 struct XfpmPolkitPrivate
 {
     GDBusConnection   *bus;
@@ -89,7 +86,7 @@ enum
 
 static guint signals [LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE (XfpmPolkit, xfpm_polkit, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmPolkit, xfpm_polkit, G_TYPE_OBJECT)
 
 #ifdef ENABLE_POLKIT
 #if defined(__FreeBSD__)
@@ -394,8 +391,6 @@ xfpm_polkit_class_init (XfpmPolkitClass *klass)
                       NULL, NULL,
                       g_cclosure_marshal_VOID__VOID,
                       G_TYPE_NONE, 0, G_TYPE_NONE);
-
-    g_type_class_add_private (klass, sizeof (XfpmPolkitPrivate));
 }
 
 static void
@@ -403,7 +398,7 @@ xfpm_polkit_init (XfpmPolkit *polkit)
 {
     GError *error = NULL;
     
-    polkit->priv = XFPM_POLKIT_GET_PRIVATE (polkit);
+    polkit->priv = xfpm_polkit_get_instance_private (polkit);
 
 #ifdef ENABLE_POLKIT
     polkit->priv->destroy_id   = 0;
diff --git a/src/xfpm-power.c b/src/xfpm-power.c
index 766a705..2aacd84 100644
--- a/src/xfpm-power.c
+++ b/src/xfpm-power.c
@@ -83,10 +83,6 @@ static void xfpm_update_blank_time (XfpmPower *power);
 static void xfpm_power_dbus_class_init (XfpmPowerClass * klass);
 static void xfpm_power_dbus_init (XfpmPower *power);
 
-
-#define XFPM_POWER_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_POWER, XfpmPowerPrivate))
-
 struct XfpmPowerPrivate
 {
     GDBusConnection *bus;
@@ -168,7 +164,7 @@ enum
 static guint signals [LAST_SIGNAL] = { 0 };
 
 
-G_DEFINE_TYPE (XfpmPower, xfpm_power, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmPower, xfpm_power, G_TYPE_OBJECT)
 
 
 /* This checks if consolekit returns TRUE for either suspend or
@@ -1168,8 +1164,6 @@ xfpm_power_class_init (XfpmPowerClass *klass)
                                                         XFPM_PARAM_FLAGS));
 #undef XFPM_PARAM_FLAGS
 
-    g_type_class_add_private (klass, sizeof (XfpmPowerPrivate));
-
     xfpm_power_dbus_class_init (klass);
 }
 
@@ -1178,7 +1172,7 @@ xfpm_power_init (XfpmPower *power)
 {
     GError *error = NULL;
 
-    power->priv = XFPM_POWER_GET_PRIVATE (power);
+    power->priv = xfpm_power_get_instance_private (power);
 
     power->priv->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
     power->priv->lid_is_present  = FALSE;
diff --git a/src/xfpm-systemd.c b/src/xfpm-systemd.c
index 32beeca..4aa3047 100644
--- a/src/xfpm-systemd.c
+++ b/src/xfpm-systemd.c
@@ -43,9 +43,6 @@ static void xfpm_systemd_get_property (GObject *object,
                                        GValue *value,
                                        GParamSpec *pspec);
 
-#define XFPM_SYSTEMD_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_SYSTEMD, XfpmSystemdPrivate))
-
 struct XfpmSystemdPrivate
 {
     gboolean         can_shutdown;
@@ -66,7 +63,7 @@ enum
     PROP_CAN_HIBERNATE,
 };
 
-G_DEFINE_TYPE (XfpmSystemd, xfpm_systemd, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmSystemd, xfpm_systemd, G_TYPE_OBJECT)
 
 #define SYSTEMD_DBUS_NAME               "org.freedesktop.login1"
 #define SYSTEMD_DBUS_PATH               "/org/freedesktop/login1"
@@ -114,8 +111,6 @@ xfpm_systemd_class_init (XfpmSystemdClass *klass)
                                                            NULL, NULL,
                                                            FALSE,
                                                            G_PARAM_READABLE));
-
-    g_type_class_add_private (klass, sizeof (XfpmSystemdPrivate));
 }
 
 static gboolean
@@ -137,7 +132,7 @@ xfpm_systemd_can_method (XfpmSystemd  *systemd,
 static void
 xfpm_systemd_init (XfpmSystemd *systemd)
 {
-    systemd->priv = XFPM_SYSTEMD_GET_PRIVATE (systemd);
+    systemd->priv = xfpm_systemd_get_instance_private (systemd);
     systemd->priv->can_shutdown = FALSE;
     systemd->priv->can_restart  = FALSE;
 #ifdef ENABLE_POLKIT
diff --git a/src/xfpm-xfconf.c b/src/xfpm-xfconf.c
index 37868bf..3218a5f 100644
--- a/src/xfpm-xfconf.c
+++ b/src/xfpm-xfconf.c
@@ -43,9 +43,6 @@
 
 static void xfpm_xfconf_finalize   (GObject *object);
 
-#define XFPM_XFCONF_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_XFCONF, XfpmXfconfPrivate ))
-
 struct XfpmXfconfPrivate
 {
     XfconfChannel 	*channel;
@@ -97,7 +94,7 @@ enum
     N_PROPERTIES
 };
 
-G_DEFINE_TYPE(XfpmXfconf, xfpm_xfconf, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (XfpmXfconf, xfpm_xfconf, G_TYPE_OBJECT)
 
 static void 
 xfpm_xfconf_set_property (GObject *object,
@@ -620,8 +617,6 @@ xfpm_xfconf_class_init (XfpmXfconfClass *klass)
                                                            NULL, NULL,
                                                            NULL,
                                                            G_PARAM_READWRITE));
-
-    g_type_class_add_private (klass, sizeof (XfpmXfconfPrivate));
 }
 
 static void
@@ -631,7 +626,7 @@ xfpm_xfconf_init (XfpmXfconf *conf)
     gboolean channel_valid;
     gboolean lock_screen;
       
-    conf->priv = XFPM_XFCONF_GET_PRIVATE (conf);
+    conf->priv = xfpm_xfconf_get_instance_private (conf);
     
     conf->priv->values = g_new0 (GValue, N_PROPERTIES);
     

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


More information about the Xfce4-commits mailing list