[libgd/wip/igaldino/fix-private-warning] compile: Fix obsolete warnings
- From: Isaque Galdino de Araujo <igaldino src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd/wip/igaldino/fix-private-warning] compile: Fix obsolete warnings
- Date: Sat, 20 Oct 2018 00:56:06 +0000 (UTC)
commit 865df33e0f6c3020622ce43b548f2a30681e94c1
Author: Isaque Galdino <igaldino gmail com>
Date: Fri Oct 19 21:37:51 2018 -0300
compile: Fix obsolete warnings
This commit removes the usage of g_type_class_add_private function and
starts to use G_DEFINE_TYPE_WITH_PRIVATE or G_DEFINE_TYPE_WITH_CODE
(... G_ADD_PRIVATE ...) in order to define a class with private members.
g_type_class_add_private is being deprecated since glib 2.58.
libgd/gd-main-list-view.c | 5 ++---
libgd/gd-margin-container.c | 6 ++----
libgd/gd-notification.c | 9 ++-------
libgd/gd-tagged-entry.c | 10 ++++------
4 files changed, 10 insertions(+), 20 deletions(-)
---
diff --git a/libgd/gd-main-list-view.c b/libgd/gd-main-list-view.c
index 26128af..ae985a1 100644
--- a/libgd/gd-main-list-view.c
+++ b/libgd/gd-main-list-view.c
@@ -37,6 +37,7 @@ struct _GdMainListViewPrivate {
static void gd_main_view_generic_iface_init (GdMainViewGenericIface *iface);
G_DEFINE_TYPE_WITH_CODE (GdMainListView, gd_main_list_view, GTK_TYPE_TREE_VIEW,
+ G_ADD_PRIVATE (GdMainListView)
G_IMPLEMENT_INTERFACE (GD_TYPE_MAIN_VIEW_GENERIC,
gd_main_view_generic_iface_init))
@@ -184,8 +185,6 @@ gd_main_list_view_class_init (GdMainListViewClass *klass)
wclass->drag_data_get = gd_main_list_view_drag_data_get;
wclass->draw = gd_main_list_view_draw;
- g_type_class_add_private (klass, sizeof (GdMainListViewPrivate));
-
for (i = 0; i < G_N_ELEMENTS (activate_modifiers); i++)
{
gtk_binding_entry_add_signal (binding_set, GDK_KEY_space, activate_modifiers[i],
@@ -210,7 +209,7 @@ gd_main_list_view_class_init (GdMainListViewClass *klass)
static void
gd_main_list_view_init (GdMainListView *self)
{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GD_TYPE_MAIN_LIST_VIEW, GdMainListViewPrivate);
+ self->priv = gd_main_list_view_get_instance_private (self);
g_signal_connect (self, "notify::model",
G_CALLBACK (set_attributes_from_model), NULL);
diff --git a/libgd/gd-margin-container.c b/libgd/gd-margin-container.c
index 51bbdd1..20f2046 100644
--- a/libgd/gd-margin-container.c
+++ b/libgd/gd-margin-container.c
@@ -24,6 +24,7 @@
#include "gd-margin-container.h"
G_DEFINE_TYPE_WITH_CODE (GdMarginContainer, gd_margin_container, GTK_TYPE_BIN,
+ G_ADD_PRIVATE (GdMarginContainer)
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
NULL))
@@ -326,8 +327,7 @@ gd_margin_container_get_preferred_height_for_width (GtkWidget *widget,
static void
gd_margin_container_init (GdMarginContainer *self)
{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GD_TYPE_MARGIN_CONTAINER,
- GdMarginContainerPrivate);
+ self->priv = gd_margin_container_get_instance_private (self);
self->priv->orientation = GTK_ORIENTATION_HORIZONTAL;
@@ -368,8 +368,6 @@ gd_margin_container_class_init (GdMarginContainerClass *klass)
G_PARAM_CONSTRUCT));
g_object_class_override_property (oclass, PROP_ORIENTATION,
"orientation");
-;
- g_type_class_add_private (klass, sizeof (GdMarginContainerPrivate));
}
GdMarginContainer *
diff --git a/libgd/gd-notification.c b/libgd/gd-notification.c
index 2ed1e3d..ba006fa 100644
--- a/libgd/gd-notification.c
+++ b/libgd/gd-notification.c
@@ -101,7 +101,7 @@ static void gd_notification_add (GtkContainer
static void gd_notification_close_button_clicked_cb (GtkWidget *widget,
gpointer user_data);
-G_DEFINE_TYPE(GdNotification, gd_notification, GTK_TYPE_BIN)
+G_DEFINE_TYPE_WITH_PRIVATE (GdNotification, gd_notification, GTK_TYPE_BIN)
static void
gd_notification_init (GdNotification *notification)
@@ -119,10 +119,7 @@ gd_notification_init (GdNotification *notification)
gtk_widget_set_has_window (GTK_WIDGET (notification), TRUE);
- priv = notification->priv =
- G_TYPE_INSTANCE_GET_PRIVATE (notification,
- GD_TYPE_NOTIFICATION,
- GdNotificationPrivate);
+ priv = notification->priv = gd_notification_get_instance_private (notification);
priv->animate_y = 0;
priv->close_button = gtk_button_new ();
@@ -536,8 +533,6 @@ gd_notification_class_init (GdNotificationClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
-
- g_type_class_add_private (object_class, sizeof (GdNotificationPrivate));
}
static void
diff --git a/libgd/gd-tagged-entry.c b/libgd/gd-tagged-entry.c
index 380962c..5db139e 100644
--- a/libgd/gd-tagged-entry.c
+++ b/libgd/gd-tagged-entry.c
@@ -69,8 +69,8 @@ enum {
NUM_TAG_PROPERTIES
};
-G_DEFINE_TYPE (GdTaggedEntry, gd_tagged_entry, GTK_TYPE_SEARCH_ENTRY)
-G_DEFINE_TYPE (GdTaggedEntryTag, gd_tagged_entry_tag, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GdTaggedEntry, gd_tagged_entry, GTK_TYPE_SEARCH_ENTRY)
+G_DEFINE_TYPE_WITH_PRIVATE (GdTaggedEntryTag, gd_tagged_entry_tag, G_TYPE_OBJECT)
static guint signals[LAST_SIGNAL] = { 0, };
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
@@ -871,7 +871,7 @@ gd_tagged_entry_button_press_event (GtkWidget *widget,
static void
gd_tagged_entry_init (GdTaggedEntry *self)
{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GD_TYPE_TAGGED_ENTRY, GdTaggedEntryPrivate);
+ self->priv = gd_tagged_entry_get_instance_private (self);
self->priv->button_visible = TRUE;
}
@@ -957,7 +957,6 @@ gd_tagged_entry_class_init (GdTaggedEntryClass *klass)
"Whether the close button should be shown in tags.", TRUE,
G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
- g_type_class_add_private (klass, sizeof (GdTaggedEntryPrivate));
g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
}
@@ -966,7 +965,7 @@ gd_tagged_entry_tag_init (GdTaggedEntryTag *self)
{
GdTaggedEntryTagPrivate *priv;
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GD_TYPE_TAGGED_ENTRY_TAG, GdTaggedEntryTagPrivate);
+ self->priv = gd_tagged_entry_tag_get_instance_private (self);
priv = self->priv;
priv->last_button_state = GTK_STATE_FLAG_NORMAL;
@@ -1059,7 +1058,6 @@ gd_tagged_entry_tag_class_init (GdTaggedEntryTagClass *klass)
"Style of the tag.", "entry-tag",
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_type_class_add_private (klass, sizeof (GdTaggedEntryTagPrivate));
g_object_class_install_properties (oclass, NUM_TAG_PROPERTIES, tag_properties);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]