[Xfce4-commits] [xfce/xfce4-panel] 01/01: libxfce4panel: Fix deprecated instance private data API

noreply at xfce.org noreply at xfce.org
Sat Dec 15 10:49:30 CET 2018


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

a   j   b       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-panel.

commit dc9bb3e612d7473c3917c2e5da9f01bf17148c03
Author: Alistair Buxton <a.j.buxton at gmail.com>
Date:   Tue Dec 4 21:45:31 2018 +0000

    libxfce4panel: Fix deprecated instance private data API
    
    Remove g_type_class_add_private and use G_DEFINE_TYPE_WITH_PRIVATE
    and G_ADD_PRIVATE instead.
    
    This re-introduces code previously reverted due to bug #14860. The
    new version should take care of that bug.
---
 libxfce4panel/xfce-arrow-button.c | 6 ++----
 libxfce4panel/xfce-panel-image.c  | 6 ++----
 libxfce4panel/xfce-panel-plugin.c | 7 +++----
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/libxfce4panel/xfce-arrow-button.c b/libxfce4panel/xfce-arrow-button.c
index f14c2e4..c49bcc0 100644
--- a/libxfce4panel/xfce-arrow-button.c
+++ b/libxfce4panel/xfce-arrow-button.c
@@ -119,7 +119,7 @@ static guint arrow_button_signals[LAST_SIGNAL];
 
 
 
-G_DEFINE_TYPE (XfceArrowButton, xfce_arrow_button, GTK_TYPE_TOGGLE_BUTTON)
+G_DEFINE_TYPE_WITH_PRIVATE (XfceArrowButton, xfce_arrow_button, GTK_TYPE_TOGGLE_BUTTON)
 
 
 
@@ -129,8 +129,6 @@ xfce_arrow_button_class_init (XfceArrowButtonClass * klass)
   GObjectClass   *gobject_class;
   GtkWidgetClass *gtkwidget_class;
 
-  g_type_class_add_private (klass, sizeof (XfceArrowButtonPrivate));
-
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->get_property = xfce_arrow_button_get_property;
   gobject_class->set_property = xfce_arrow_button_set_property;
@@ -191,7 +189,7 @@ xfce_arrow_button_init (XfceArrowButton *button)
   GtkCssProvider  *provider;
 #endif
 
-  button->priv = G_TYPE_INSTANCE_GET_PRIVATE (button, XFCE_TYPE_ARROW_BUTTON, XfceArrowButtonPrivate);
+  button->priv = xfce_arrow_button_get_instance_private (button);
 
   /* initialize button values */
   button->priv->arrow_type = GTK_ARROW_UP;
diff --git a/libxfce4panel/xfce-panel-image.c b/libxfce4panel/xfce-panel-image.c
index e75632d..bc96016 100644
--- a/libxfce4panel/xfce-panel-image.c
+++ b/libxfce4panel/xfce-panel-image.c
@@ -148,7 +148,7 @@ static GdkPixbuf *xfce_panel_image_scale_pixbuf         (GdkPixbuf       *source
 
 
 
-G_DEFINE_TYPE (XfcePanelImage, xfce_panel_image, GTK_TYPE_WIDGET)
+G_DEFINE_TYPE_WITH_PRIVATE (XfcePanelImage, xfce_panel_image, GTK_TYPE_WIDGET)
 
 
 
@@ -158,8 +158,6 @@ xfce_panel_image_class_init (XfcePanelImageClass *klass)
   GObjectClass   *gobject_class;
   GtkWidgetClass *gtkwidget_class;
 
-  g_type_class_add_private (klass, sizeof (XfcePanelImagePrivate));
-
   gobject_class = G_OBJECT_CLASS (klass);
   gobject_class->set_property = xfce_panel_image_set_property;
   gobject_class->get_property = xfce_panel_image_get_property;
@@ -224,7 +222,7 @@ xfce_panel_image_init (XfcePanelImage *image)
 {
   gtk_widget_set_has_window (GTK_WIDGET (image), FALSE);
 
-  image->priv = G_TYPE_INSTANCE_GET_PRIVATE (image, XFCE_TYPE_PANEL_IMAGE, XfcePanelImagePrivate);
+  image->priv = xfce_panel_image_get_instance_private (image);
 
   image->priv->pixbuf = NULL;
   image->priv->cache = NULL;
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 6673551..8e41c3d 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -211,8 +211,9 @@ static GParamSpec *plugin_props[N_PROPERTIES] = { NULL, };
 
 
 G_DEFINE_TYPE_WITH_CODE (XfcePanelPlugin, xfce_panel_plugin, GTK_TYPE_EVENT_BOX,
+                         G_ADD_PRIVATE (XfcePanelPlugin)
                          G_IMPLEMENT_INTERFACE (XFCE_TYPE_PANEL_PLUGIN_PROVIDER,
-                         xfce_panel_plugin_provider_init));
+                                                xfce_panel_plugin_provider_init));
 
 
 
@@ -222,8 +223,6 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
   GObjectClass   *gobject_class;
   GtkWidgetClass *gtkwidget_class;
 
-  g_type_class_add_private (klass, sizeof (XfcePanelPluginPrivate));
-
   klass->construct = NULL;
 
   gobject_class = G_OBJECT_CLASS (klass);
@@ -701,7 +700,7 @@ xfce_panel_plugin_class_init (XfcePanelPluginClass *klass)
 static void
 xfce_panel_plugin_init (XfcePanelPlugin *plugin)
 {
-  plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin, XFCE_TYPE_PANEL_PLUGIN, XfcePanelPluginPrivate);
+  plugin->priv = xfce_panel_plugin_get_instance_private (plugin);
 
   plugin->priv->name = NULL;
   plugin->priv->display_name = NULL;

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


More information about the Xfce4-commits mailing list