[gcr/wip/nielsdg/g-add-private: 3/3] gcr-ui: g_type_class_add_private() is deprecated
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcr/wip/nielsdg/g-add-private: 3/3] gcr-ui: g_type_class_add_private() is deprecated
- Date: Fri, 24 May 2019 07:11:35 +0000 (UTC)
commit 34d674ded9af6404822b06a3f97178781266a5d9
Author: Niels De Graef <nielsdegraef gmail com>
Date: Fri May 24 09:08:38 2019 +0200
gcr-ui: g_type_class_add_private() is deprecated
Use `G_ADD_PRIVATE()` (or the convenience macro
`G_DEFINE_TYPE_WITH_PRIVATE()`) instead.
ui/eggimagemenuitem.c | 6 ++----
ui/gcr-certificate-exporter.c | 5 ++---
ui/gcr-certificate-renderer.c | 4 ++--
ui/gcr-certificate-request-renderer.c | 6 ++----
ui/gcr-certificate-widget.c | 5 ++---
ui/gcr-collection-model.c | 5 ++---
ui/gcr-combo-selector.c | 6 ++----
ui/gcr-display-scrolled.c | 11 +++++------
ui/gcr-display-view.c | 10 +++++-----
ui/gcr-failure-renderer.c | 6 ++----
ui/gcr-gnupg-renderer.c | 5 ++---
ui/gcr-import-button.c | 6 ++----
ui/gcr-key-renderer.c | 4 ++--
ui/gcr-key-widget.c | 5 ++---
ui/gcr-list-selector.c | 6 ++----
ui/gcr-live-search.c | 9 +++------
ui/gcr-prompt-dialog.c | 6 ++----
ui/gcr-secure-entry-buffer.c | 6 ++----
ui/gcr-tree-selector.c | 6 ++----
ui/gcr-unlock-options-widget.c | 5 ++---
ui/gcr-unlock-renderer.c | 6 ++----
ui/gcr-viewer-widget.c | 7 ++-----
ui/gcr-viewer-window.c | 7 ++-----
23 files changed, 53 insertions(+), 89 deletions(-)
---
diff --git a/ui/eggimagemenuitem.c b/ui/eggimagemenuitem.c
index 6b165c5..7490892 100644
--- a/ui/eggimagemenuitem.c
+++ b/ui/eggimagemenuitem.c
@@ -92,7 +92,7 @@ static void egg_image_menu_item_screen_changed (GtkWidget *widget,
static void egg_image_menu_item_recalculate (EggImageMenuItem *image_menu_item);
-G_DEFINE_TYPE (EggImageMenuItem, egg_image_menu_item, GTK_TYPE_MENU_ITEM);
+G_DEFINE_TYPE_WITH_PRIVATE (EggImageMenuItem, egg_image_menu_item, GTK_TYPE_MENU_ITEM);
static void
egg_image_menu_item_class_init (EggImageMenuItemClass *klass)
@@ -137,8 +137,6 @@ egg_image_menu_item_class_init (EggImageMenuItemClass *klass)
"Whether the image will always be shown",
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
G_PARAM_CONSTRUCT));
-
- g_type_class_add_private (gobject_class, sizeof (EggImageMenuItemPrivate));
}
static void
@@ -146,7 +144,7 @@ egg_image_menu_item_init (EggImageMenuItem *image_menu_item)
{
EggImageMenuItemPrivate *priv;
- image_menu_item->priv = G_TYPE_INSTANCE_GET_PRIVATE (image_menu_item, EGG_TYPE_IMAGE_MENU_ITEM,
EggImageMenuItemPrivate);
+ image_menu_item->priv = egg_image_menu_item_get_instance_private (image_menu_item);
priv = image_menu_item->priv;
priv->image = NULL;
diff --git a/ui/gcr-certificate-exporter.c b/ui/gcr-certificate-exporter.c
index 5c3e816..e72c07b 100644
--- a/ui/gcr-certificate-exporter.c
+++ b/ui/gcr-certificate-exporter.c
@@ -63,6 +63,7 @@ static void _gcr_certificate_exporter_async_result_init (GAsyncResultIface *ifac
static void write_to_outputstream (GcrCertificateExporter *self, GOutputStream *os);
G_DEFINE_TYPE_WITH_CODE (GcrCertificateExporter, _gcr_certificate_exporter, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GcrCertificateExporter);
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_RESULT,
_gcr_certificate_exporter_async_result_init));
typedef void (*PrepareDataFunc) (GcrCertificateExporter *self);
@@ -350,8 +351,7 @@ exporter_display_chooser (GcrCertificateExporter *self)
static void
_gcr_certificate_exporter_init (GcrCertificateExporter *self)
{
- self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_CERTIFICATE_EXPORTER,
- GcrCertificateExporterPrivate));
+ self->pv = _gcr_certificate_exporter_get_instance_private (self);
}
static void
@@ -448,7 +448,6 @@ _gcr_certificate_exporter_class_init (GcrCertificateExporterClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
_gcr_certificate_exporter_parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (GcrCertificateExporterPrivate));
gobject_class->dispose = _gcr_certificate_exporter_dispose;
gobject_class->finalize = _gcr_certificate_exporter_finalize;
diff --git a/ui/gcr-certificate-renderer.c b/ui/gcr-certificate-renderer.c
index efd5911..ff1c3af 100644
--- a/ui/gcr-certificate-renderer.c
+++ b/ui/gcr-certificate-renderer.c
@@ -73,6 +73,7 @@ static void gcr_renderer_iface_init (GcrRendererIface *iface);
static void gcr_renderer_certificate_iface_init (GcrCertificateIface *iface);
G_DEFINE_TYPE_WITH_CODE (GcrCertificateRenderer, gcr_certificate_renderer, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GcrCertificateRenderer);
G_IMPLEMENT_INTERFACE (GCR_TYPE_RENDERER, gcr_renderer_iface_init);
GCR_CERTIFICATE_MIXIN_IMPLEMENT_COMPARABLE ();
G_IMPLEMENT_INTERFACE (GCR_TYPE_CERTIFICATE, gcr_renderer_certificate_iface_init);
@@ -328,7 +329,7 @@ on_certificate_export (GtkMenuItem *menuitem, gpointer user_data)
static void
gcr_certificate_renderer_init (GcrCertificateRenderer *self)
{
- self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_CERTIFICATE_RENDERER,
GcrCertificateRendererPrivate));
+ self->pv = gcr_certificate_renderer_get_instance_private (self);
}
static void
@@ -424,7 +425,6 @@ gcr_certificate_renderer_class_init (GcrCertificateRendererClass *klass)
GckBuilder builder = GCK_BUILDER_INIT;
gcr_certificate_renderer_parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (GcrCertificateRendererPrivate));
gobject_class->dispose = gcr_certificate_renderer_dispose;
gobject_class->finalize = gcr_certificate_renderer_finalize;
diff --git a/ui/gcr-certificate-request-renderer.c b/ui/gcr-certificate-request-renderer.c
index 06aca3b..6a42f2e 100644
--- a/ui/gcr-certificate-request-renderer.c
+++ b/ui/gcr-certificate-request-renderer.c
@@ -64,6 +64,7 @@ struct _GcrCertificateRequestRendererPrivate {
static void _gcr_certificate_request_renderer_iface (GcrRendererIface *iface);
G_DEFINE_TYPE_WITH_CODE (GcrCertificateRequestRenderer, _gcr_certificate_request_renderer, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GcrCertificateRequestRenderer);
G_IMPLEMENT_INTERFACE (GCR_TYPE_RENDERER, _gcr_certificate_request_renderer_iface);
);
@@ -97,8 +98,7 @@ calculate_label (GcrCertificateRequestRenderer *self)
static void
_gcr_certificate_request_renderer_init (GcrCertificateRequestRenderer *self)
{
- self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_CERTIFICATE_REQUEST_RENDERER,
- GcrCertificateRequestRendererPrivate));
+ self->pv = _gcr_certificate_request_renderer_get_instance_private (self);
}
static void
@@ -169,8 +169,6 @@ _gcr_certificate_request_renderer_class_init (GcrCertificateRequestRendererClass
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GckBuilder builder = GCK_BUILDER_INIT;
- g_type_class_add_private (klass, sizeof (GcrCertificateRequestRendererPrivate));
-
gobject_class->finalize = _gcr_certificate_request_renderer_finalize;
gobject_class->set_property = _gcr_certificate_request_renderer_set_property;
gobject_class->get_property = _gcr_certificate_request_renderer_get_property;
diff --git a/ui/gcr-certificate-widget.c b/ui/gcr-certificate-widget.c
index aff1059..1f998e9 100644
--- a/ui/gcr-certificate-widget.c
+++ b/ui/gcr-certificate-widget.c
@@ -69,7 +69,7 @@ struct _GcrCertificateWidgetPrivate {
GcrCertificateRenderer *renderer;
};
-G_DEFINE_TYPE (GcrCertificateWidget, gcr_certificate_widget, GTK_TYPE_BIN);
+G_DEFINE_TYPE_WITH_PRIVATE (GcrCertificateWidget, gcr_certificate_widget, GTK_TYPE_BIN);
/* -----------------------------------------------------------------------------
* OBJECT
@@ -96,7 +96,7 @@ gcr_certificate_widget_constructor (GType type, guint n_props, GObjectConstructP
static void
gcr_certificate_widget_init (GcrCertificateWidget *self)
{
- self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_CERTIFICATE_WIDGET,
GcrCertificateWidgetPrivate));
+ self->pv = gcr_certificate_widget_get_instance_private (self);
self->pv->renderer = gcr_certificate_renderer_new (NULL);
}
@@ -159,7 +159,6 @@ gcr_certificate_widget_class_init (GcrCertificateWidgetClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gcr_certificate_widget_parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (GcrCertificateWidgetPrivate));
gobject_class->constructor = gcr_certificate_widget_constructor;
gobject_class->finalize = gcr_certificate_widget_finalize;
diff --git a/ui/gcr-collection-model.c b/ui/gcr-collection-model.c
index d4f7c10..c1a2fa0 100644
--- a/ui/gcr-collection-model.c
+++ b/ui/gcr-collection-model.c
@@ -134,6 +134,7 @@ static void gcr_collection_model_tree_model_init (GtkTreeModelIface *iface);
static void gcr_collection_model_tree_sortable_init (GtkTreeSortableIface *iface);
G_DEFINE_TYPE_EXTENDED (GcrCollectionModel, gcr_collection_model, G_TYPE_OBJECT, 0,
+ G_ADD_PRIVATE (GcrCollectionModel);
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, gcr_collection_model_tree_model_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_SORTABLE,
gcr_collection_model_tree_sortable_init)
);
@@ -1136,7 +1137,7 @@ gcr_collection_model_tree_sortable_init (GtkTreeSortableIface *iface)
static void
gcr_collection_model_init (GcrCollectionModel *self)
{
- self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_COLLECTION_MODEL, GcrCollectionModelPrivate);
+ self->pv = gcr_collection_model_get_instance_private (self);
self->pv->root_sequence = g_sequence_new (NULL);
self->pv->object_to_seq = g_hash_table_new (g_direct_hash, g_direct_equal);
@@ -1259,8 +1260,6 @@ gcr_collection_model_class_init (GcrCollectionModelClass *klass)
g_object_class_install_property (gobject_class, PROP_COLUMNS,
g_param_spec_pointer ("columns", "Columns", "Columns for the model",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
- g_type_class_add_private (klass, sizeof (GcrCollectionModelPrivate));
}
/**
diff --git a/ui/gcr-combo-selector.c b/ui/gcr-combo-selector.c
index d225491..013c82f 100644
--- a/ui/gcr-combo-selector.c
+++ b/ui/gcr-combo-selector.c
@@ -59,7 +59,7 @@ struct _GcrComboSelectorPrivate {
GcrCollectionModel *model;
};
-G_DEFINE_TYPE (GcrComboSelector, gcr_combo_selector, GTK_TYPE_COMBO_BOX);
+G_DEFINE_TYPE_WITH_PRIVATE (GcrComboSelector, gcr_combo_selector, GTK_TYPE_COMBO_BOX);
/* -----------------------------------------------------------------------------
* INTERNAL
@@ -102,7 +102,7 @@ gcr_combo_selector_constructor (GType type, guint n_props, GObjectConstructParam
static void
gcr_combo_selector_init (GcrComboSelector *self)
{
- self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_COMBO_SELECTOR, GcrComboSelectorPrivate);
+ self->pv = gcr_combo_selector_get_instance_private (self);
}
static void
@@ -177,8 +177,6 @@ gcr_combo_selector_class_init (GcrComboSelectorClass *klass)
gobject_class->set_property = gcr_combo_selector_set_property;
gobject_class->get_property = gcr_combo_selector_get_property;
- g_type_class_add_private (gobject_class, sizeof (GcrComboSelectorPrivate));
-
/**
* GcrComboSelector:collection:
*
diff --git a/ui/gcr-display-scrolled.c b/ui/gcr-display-scrolled.c
index e4e63e1..964acee 100644
--- a/ui/gcr-display-scrolled.c
+++ b/ui/gcr-display-scrolled.c
@@ -25,13 +25,14 @@
static void _gcr_display_scrolled_viewer_iface (GcrViewerIface *iface);
-G_DEFINE_TYPE_WITH_CODE (GcrDisplayScrolled, _gcr_display_scrolled, GTK_TYPE_SCROLLED_WINDOW,
- G_IMPLEMENT_INTERFACE (GCR_TYPE_VIEWER, _gcr_display_scrolled_viewer_iface));
-
struct _GcrDisplayScrolledPrivate {
GcrViewer *internal;
};
+G_DEFINE_TYPE_WITH_CODE (GcrDisplayScrolled, _gcr_display_scrolled, GTK_TYPE_SCROLLED_WINDOW,
+ G_ADD_PRIVATE (GcrDisplayScrolled);
+ G_IMPLEMENT_INTERFACE (GCR_TYPE_VIEWER, _gcr_display_scrolled_viewer_iface));
+
/* -----------------------------------------------------------------------------
* INTERNAL
*/
@@ -43,7 +44,7 @@ struct _GcrDisplayScrolledPrivate {
static void
_gcr_display_scrolled_init (GcrDisplayScrolled *self)
{
- self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_DISPLAY_SCROLLED, GcrDisplayScrolledPrivate));
+ self->pv = _gcr_display_scrolled_get_instance_private (self);
self->pv->internal = gcr_viewer_new ();
}
@@ -112,8 +113,6 @@ _gcr_display_scrolled_class_init (GcrDisplayScrolledClass *klass)
widget_class->get_preferred_width = _gcr_display_scrolled_get_preferred_width;
object_class->constructed = _gcr_display_scrolled_constructed;
-
- g_type_class_add_private (klass, sizeof (GcrDisplayScrolledPrivate));
}
static void
diff --git a/ui/gcr-display-view.c b/ui/gcr-display-view.c
index bc97c2e..abd10fb 100644
--- a/ui/gcr-display-view.c
+++ b/ui/gcr-display-view.c
@@ -29,9 +29,6 @@
static void _gcr_display_view_viewer_iface (GcrViewerIface *iface);
-G_DEFINE_TYPE_WITH_CODE (GcrDisplayView, _gcr_display_view, GTK_TYPE_TEXT_VIEW,
- G_IMPLEMENT_INTERFACE (GCR_TYPE_VIEWER, _gcr_display_view_viewer_iface));
-
#define ZWSP "\342\200\213"
#define NORMAL_MARGIN 10
#define FIELD_MARGIN 17
@@ -77,6 +74,10 @@ struct _GcrDisplayViewPrivate {
gint natural_height;
};
+G_DEFINE_TYPE_WITH_CODE (GcrDisplayView, _gcr_display_view, GTK_TYPE_TEXT_VIEW,
+ G_ADD_PRIVATE (GcrDisplayView);
+ G_IMPLEMENT_INTERFACE (GCR_TYPE_VIEWER, _gcr_display_view_viewer_iface));
+
/* -----------------------------------------------------------------------------
* INTERNAL
*/
@@ -579,7 +580,7 @@ _gcr_display_view_constructor (GType type, guint n_props, GObjectConstructParam
static void
_gcr_display_view_init (GcrDisplayView *self)
{
- self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_DISPLAY_VIEW, GcrDisplayViewPrivate));
+ self->pv = _gcr_display_view_get_instance_private (self);
self->pv->items = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, destroy_display_item);
self->pv->renderers = g_ptr_array_new_with_free_func (g_object_unref);
}
@@ -765,7 +766,6 @@ _gcr_display_view_class_init (GcrDisplayViewClass *klass)
GtkTextViewClass *text_view_class = GTK_TEXT_VIEW_CLASS (klass);
_gcr_display_view_parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (GcrDisplayViewPrivate));
gobject_class->constructor = _gcr_display_view_constructor;
gobject_class->dispose = _gcr_display_view_dispose;
diff --git a/ui/gcr-failure-renderer.c b/ui/gcr-failure-renderer.c
index 30b7ef7..6029fd8 100644
--- a/ui/gcr-failure-renderer.c
+++ b/ui/gcr-failure-renderer.c
@@ -41,14 +41,14 @@ struct _GcrFailureRendererPrivate {
static void gcr_renderer_iface_init (GcrRendererIface *iface);
G_DEFINE_TYPE_WITH_CODE (GcrFailureRenderer, gcr_failure_renderer, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GcrFailureRenderer);
G_IMPLEMENT_INTERFACE (GCR_TYPE_RENDERER, gcr_renderer_iface_init);
);
static void
gcr_failure_renderer_init (GcrFailureRenderer *self)
{
- self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_FAILURE_RENDERER,
- GcrFailureRendererPrivate));
+ self->pv = gcr_failure_renderer_get_instance_private (self);
}
static void
@@ -111,8 +111,6 @@ gcr_failure_renderer_class_init (GcrFailureRendererClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (GcrFailureRendererPrivate));
-
gobject_class->finalize = gcr_failure_renderer_finalize;
gobject_class->set_property = gcr_failure_renderer_set_property;
gobject_class->get_property = gcr_failure_renderer_get_property;
diff --git a/ui/gcr-gnupg-renderer.c b/ui/gcr-gnupg-renderer.c
index 31559b1..c1836a9 100644
--- a/ui/gcr-gnupg-renderer.c
+++ b/ui/gcr-gnupg-renderer.c
@@ -54,6 +54,7 @@ struct _GcrGnupgRendererPrivate {
static void _gcr_gnupg_renderer_iface_init (GcrRendererIface *iface);
G_DEFINE_TYPE_WITH_CODE (GcrGnupgRenderer, _gcr_gnupg_renderer, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GcrGnupgRenderer);
G_IMPLEMENT_INTERFACE (GCR_TYPE_RENDERER, _gcr_gnupg_renderer_iface_init);
);
@@ -90,8 +91,7 @@ calculate_label (GcrGnupgRenderer *self)
static void
_gcr_gnupg_renderer_init (GcrGnupgRenderer *self)
{
- self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_GNUPG_RENDERER,
- GcrGnupgRendererPrivate));
+ self->pv = _gcr_gnupg_renderer_get_instance_private (self);
}
static void
@@ -165,7 +165,6 @@ _gcr_gnupg_renderer_class_init (GcrGnupgRendererClass *klass)
GckBuilder builder = GCK_BUILDER_INIT;
_gcr_gnupg_renderer_parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (GcrGnupgRendererPrivate));
gobject_class->finalize = _gcr_gnupg_renderer_finalize;
gobject_class->set_property = _gcr_gnupg_renderer_set_property;
diff --git a/ui/gcr-import-button.c b/ui/gcr-import-button.c
index 33cc443..1fc5fca 100644
--- a/ui/gcr-import-button.c
+++ b/ui/gcr-import-button.c
@@ -91,12 +91,12 @@ static GQuark QUARK_IMPORTER = 0;
#error Port this class to derive from GtkMenuButton during 4.x ABI bump
#endif
-G_DEFINE_TYPE (GcrImportButton, gcr_import_button, GTK_TYPE_BUTTON);
+G_DEFINE_TYPE_WITH_PRIVATE (GcrImportButton, gcr_import_button, GTK_TYPE_BUTTON);
static void
gcr_import_button_init (GcrImportButton *self)
{
- self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_IMPORT_BUTTON, GcrImportButtonPrivate);
+ self->pv = gcr_import_button_get_instance_private (self);
self->pv->cancellable = g_cancellable_new ();
self->pv->label = gtk_label_new ("");
}
@@ -523,8 +523,6 @@ gcr_import_button_class_init (GcrImportButtonClass *klass)
G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_ERROR);
QUARK_IMPORTER = g_quark_from_static_string ("gcr-import-button-importer");
-
- g_type_class_add_private (klass, sizeof (GcrImportButtonPrivate));
}
/**
diff --git a/ui/gcr-key-renderer.c b/ui/gcr-key-renderer.c
index e2a8c4c..a8c73cf 100644
--- a/ui/gcr-key-renderer.c
+++ b/ui/gcr-key-renderer.c
@@ -66,6 +66,7 @@ struct _GcrKeyRendererPrivate {
static void gcr_key_renderer_renderer_iface (GcrRendererIface *iface);
G_DEFINE_TYPE_WITH_CODE (GcrKeyRenderer, gcr_key_renderer, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (GcrKeyRenderer);
G_IMPLEMENT_INTERFACE (GCR_TYPE_RENDERER, gcr_key_renderer_renderer_iface));
/* -----------------------------------------------------------------------------
@@ -173,7 +174,7 @@ on_object_cache_attributes (GObject *obj,
static void
gcr_key_renderer_init (GcrKeyRenderer *self)
{
- self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_KEY_RENDERER, GcrKeyRendererPrivate));
+ self->pv = gcr_key_renderer_get_instance_private (self);
self->pv->icon = g_themed_icon_new (GCR_ICON_KEY);
}
@@ -284,7 +285,6 @@ gcr_key_renderer_class_init (GcrKeyRendererClass *klass)
GckBuilder builder = GCK_BUILDER_INIT;
gcr_key_renderer_parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (GcrKeyRendererPrivate));
gobject_class->dispose = gcr_key_renderer_dispose;
gobject_class->finalize = gcr_key_renderer_finalize;
diff --git a/ui/gcr-key-widget.c b/ui/gcr-key-widget.c
index 75f861b..5f5f192 100644
--- a/ui/gcr-key-widget.c
+++ b/ui/gcr-key-widget.c
@@ -76,7 +76,7 @@ struct _GcrKeyWidgetPrivate {
GcrKeyRenderer *renderer;
};
-G_DEFINE_TYPE (GcrKeyWidget, gcr_key_widget, GTK_TYPE_BIN);
+G_DEFINE_TYPE_WITH_PRIVATE (GcrKeyWidget, gcr_key_widget, GTK_TYPE_BIN);
/* -----------------------------------------------------------------------------
* OBJECT
@@ -103,7 +103,7 @@ gcr_key_widget_constructor (GType type, guint n_props, GObjectConstructParam *pr
static void
gcr_key_widget_init (GcrKeyWidget *self)
{
- self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_KEY_WIDGET, GcrKeyWidgetPrivate));
+ self->pv = gcr_key_widget_get_instance_private (self);
self->pv->renderer = gcr_key_renderer_new (NULL, NULL);
}
@@ -160,7 +160,6 @@ gcr_key_widget_class_init (GcrKeyWidgetClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gcr_key_widget_parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (GcrKeyWidgetPrivate));
gobject_class->constructor = gcr_key_widget_constructor;
gobject_class->finalize = gcr_key_widget_finalize;
diff --git a/ui/gcr-list-selector.c b/ui/gcr-list-selector.c
index c924e27..5edd272 100644
--- a/ui/gcr-list-selector.c
+++ b/ui/gcr-list-selector.c
@@ -67,7 +67,7 @@ struct _GcrListSelectorPrivate {
GtkWidget *search_widget;
};
-G_DEFINE_TYPE (GcrListSelector, gcr_list_selector, GTK_TYPE_TREE_VIEW);
+G_DEFINE_TYPE_WITH_PRIVATE (GcrListSelector, gcr_list_selector, GTK_TYPE_TREE_VIEW);
static gboolean
object_is_visible (GcrListSelector *self, GObject *object)
@@ -260,7 +260,7 @@ gcr_list_selector_constructed (GObject *object)
static void
gcr_list_selector_init (GcrListSelector *self)
{
- self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_LIST_SELECTOR, GcrListSelectorPrivate);
+ self->pv = gcr_list_selector_get_instance_private (self);
}
static void
@@ -341,8 +341,6 @@ gcr_list_selector_class_init (GcrListSelectorClass *klass)
gobject_class->set_property = gcr_list_selector_set_property;
gobject_class->get_property = gcr_list_selector_get_property;
- g_type_class_add_private (gobject_class, sizeof (GcrListSelectorPrivate));
-
/**
* GcrListSelector:collection:
*
diff --git a/ui/gcr-live-search.c b/ui/gcr-live-search.c
index f8483bf..283ffc6 100644
--- a/ui/gcr-live-search.c
+++ b/ui/gcr-live-search.c
@@ -36,14 +36,14 @@
#include <string.h>
-G_DEFINE_TYPE (GcrLiveSearch, _gcr_live_search, GTK_TYPE_BOX)
-
struct _GcrLiveSearchPrivate {
GtkWidget *search_entry;
GtkWidget *hook_widget;
GPtrArray *stripped_words;
};
+G_DEFINE_TYPE_WITH_PRIVATE (GcrLiveSearch, _gcr_live_search, GTK_TYPE_BOX)
+
enum {
PROP_0,
PROP_HOOK_WIDGET,
@@ -512,15 +512,12 @@ _gcr_live_search_class_init (GcrLiveSearchClass *klass)
"The text of the live search entry",
"", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_TEXT, param_spec);
-
- g_type_class_add_private (klass, sizeof (GcrLiveSearchPrivate));
}
static void
_gcr_live_search_init (GcrLiveSearch *self)
{
- self->pv = G_TYPE_INSTANCE_GET_PRIVATE ((self), GCR_TYPE_LIVE_SEARCH,
- GcrLiveSearchPrivate);
+ self->pv = _gcr_live_search_get_instance_private (self);
gtk_widget_set_no_show_all (GTK_WIDGET (self), TRUE);
diff --git a/ui/gcr-prompt-dialog.c b/ui/gcr-prompt-dialog.c
index 48088d7..e77f219 100644
--- a/ui/gcr-prompt-dialog.c
+++ b/ui/gcr-prompt-dialog.c
@@ -120,6 +120,7 @@ static gboolean ungrab_keyboard (GtkWidget *win,
gpointer unused);
G_DEFINE_TYPE_WITH_CODE (GcrPromptDialog, gcr_prompt_dialog, GTK_TYPE_DIALOG,
+ G_ADD_PRIVATE (GcrPromptDialog);
G_IMPLEMENT_INTERFACE (GCR_TYPE_PROMPT, gcr_prompt_dialog_prompt_iface);
);
@@ -163,8 +164,7 @@ update_transient_for (GcrPromptDialog *self)
static void
gcr_prompt_dialog_init (GcrPromptDialog *self)
{
- self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_PROMPT_DIALOG,
- GcrPromptDialogPrivate);
+ self->pv = gcr_prompt_dialog_get_instance_private (self);
/*
* This is a stupid hack to work around to help the window act like
@@ -762,8 +762,6 @@ gcr_prompt_dialog_class_init (GcrPromptDialogClass *klass)
dialog_class->response = gcr_prompt_dialog_response;
- g_type_class_add_private (gobject_class, sizeof (GcrPromptDialogPrivate));
-
g_object_class_override_property (gobject_class, PROP_MESSAGE, "message");
g_object_class_override_property (gobject_class, PROP_DESCRIPTION, "description");
diff --git a/ui/gcr-secure-entry-buffer.c b/ui/gcr-secure-entry-buffer.c
index d00ccd2..6642061 100644
--- a/ui/gcr-secure-entry-buffer.c
+++ b/ui/gcr-secure-entry-buffer.c
@@ -71,7 +71,7 @@ struct _GcrSecureEntryBufferPrivate
guint text_chars;
};
-G_DEFINE_TYPE (GcrSecureEntryBuffer, gcr_secure_entry_buffer, GTK_TYPE_ENTRY_BUFFER);
+G_DEFINE_TYPE_WITH_PRIVATE (GcrSecureEntryBuffer, gcr_secure_entry_buffer, GTK_TYPE_ENTRY_BUFFER);
static const gchar *
gcr_secure_entry_buffer_real_get_text (GtkEntryBuffer *buffer,
@@ -176,7 +176,7 @@ static void
gcr_secure_entry_buffer_init (GcrSecureEntryBuffer *self)
{
GcrSecureEntryBufferPrivate *pv;
- pv = self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_SECURE_ENTRY_BUFFER,
GcrSecureEntryBufferPrivate);
+ pv = self->pv = gcr_secure_entry_buffer_get_instance_private (self);
pv->text = NULL;
pv->text_chars = 0;
@@ -212,8 +212,6 @@ gcr_secure_entry_buffer_class_init (GcrSecureEntryBufferClass *klass)
buffer_class->get_length = gcr_secure_entry_buffer_real_get_length;
buffer_class->insert_text = gcr_secure_entry_buffer_real_insert_text;
buffer_class->delete_text = gcr_secure_entry_buffer_real_delete_text;
-
- g_type_class_add_private (gobject_class, sizeof (GcrSecureEntryBufferPrivate));
}
/**
diff --git a/ui/gcr-tree-selector.c b/ui/gcr-tree-selector.c
index 78568b8..0a3f7a0 100644
--- a/ui/gcr-tree-selector.c
+++ b/ui/gcr-tree-selector.c
@@ -61,7 +61,7 @@ struct _GcrTreeSelectorPrivate {
GcrCollectionModel *model;
};
-G_DEFINE_TYPE (GcrTreeSelector, gcr_tree_selector, GTK_TYPE_TREE_VIEW);
+G_DEFINE_TYPE_WITH_PRIVATE (GcrTreeSelector, gcr_tree_selector, GTK_TYPE_TREE_VIEW);
/* -----------------------------------------------------------------------------
* INTERNAL
@@ -174,7 +174,7 @@ gcr_tree_selector_constructor (GType type, guint n_props, GObjectConstructParam
static void
gcr_tree_selector_init (GcrTreeSelector *self)
{
- self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_TREE_SELECTOR, GcrTreeSelectorPrivate);
+ self->pv = gcr_tree_selector_get_instance_private (self);
}
static void
@@ -256,8 +256,6 @@ gcr_tree_selector_class_init (GcrTreeSelectorClass *klass)
gobject_class->set_property = gcr_tree_selector_set_property;
gobject_class->get_property = gcr_tree_selector_get_property;
- g_type_class_add_private (gobject_class, sizeof (GcrTreeSelectorPrivate));
-
/**
* GcrTreeSelector:collection:
*
diff --git a/ui/gcr-unlock-options-widget.c b/ui/gcr-unlock-options-widget.c
index c81862c..b4bdace 100644
--- a/ui/gcr-unlock-options-widget.c
+++ b/ui/gcr-unlock-options-widget.c
@@ -93,7 +93,7 @@ struct _GcrUnlockOptionsWidgetPrivate {
gchar *choice;
};
-G_DEFINE_TYPE (GcrUnlockOptionsWidget, gcr_unlock_options_widget, GTK_TYPE_BIN);
+G_DEFINE_TYPE_WITH_PRIVATE (GcrUnlockOptionsWidget, gcr_unlock_options_widget, GTK_TYPE_BIN);
/* -----------------------------------------------------------------------------
* INTERNAL
@@ -215,7 +215,7 @@ gcr_unlock_options_widget_constructor (GType type, guint n_props, GObjectConstru
static void
gcr_unlock_options_widget_init (GcrUnlockOptionsWidget *self)
{
- self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_UNLOCK_OPTIONS_WIDGET,
GcrUnlockOptionsWidgetPrivate));
+ self->pv = gcr_unlock_options_widget_get_instance_private (self);
self->pv->builder = gtk_builder_new ();
}
@@ -287,7 +287,6 @@ gcr_unlock_options_widget_class_init (GcrUnlockOptionsWidgetClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gcr_unlock_options_widget_parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private (klass, sizeof (GcrUnlockOptionsWidgetPrivate));
gobject_class->constructor = gcr_unlock_options_widget_constructor;
gobject_class->dispose = gcr_unlock_options_widget_dispose;
diff --git a/ui/gcr-unlock-renderer.c b/ui/gcr-unlock-renderer.c
index aa9dbdc..823fa92 100644
--- a/ui/gcr-unlock-renderer.c
+++ b/ui/gcr-unlock-renderer.c
@@ -57,6 +57,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
static void gcr_renderer_iface_init (GcrRendererIface *iface);
G_DEFINE_TYPE_WITH_CODE (GcrUnlockRenderer, _gcr_unlock_renderer, GTK_TYPE_BIN,
+ G_ADD_PRIVATE (GcrUnlockRenderer);
G_IMPLEMENT_INTERFACE (GCR_TYPE_RENDERER, gcr_renderer_iface_init);
);
@@ -108,8 +109,7 @@ _gcr_unlock_renderer_init (GcrUnlockRenderer *self)
GtkWidget *button;
GtkEntryBuffer *buffer;
- self->pv = (G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_UNLOCK_RENDERER,
- GcrUnlockRendererPrivate));
+ self->pv = _gcr_unlock_renderer_get_instance_private (self);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
@@ -200,8 +200,6 @@ _gcr_unlock_renderer_class_init (GcrUnlockRendererClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (GcrUnlockRendererPrivate));
-
gobject_class->finalize = _gcr_unlock_renderer_finalize;
gobject_class->set_property = _gcr_unlock_renderer_set_property;
gobject_class->get_property = _gcr_unlock_renderer_get_property;
diff --git a/ui/gcr-viewer-widget.c b/ui/gcr-viewer-widget.c
index f2c6e71..28c60b7 100644
--- a/ui/gcr-viewer-widget.c
+++ b/ui/gcr-viewer-widget.c
@@ -115,7 +115,7 @@ static guint signals[LAST_SIGNAL] = { 0, };
static void viewer_load_next_file (GcrViewerWidget *self);
static void viewer_stop_loading_files (GcrViewerWidget *self);
-G_DEFINE_TYPE (GcrViewerWidget, gcr_viewer_widget, GTK_TYPE_BOX);
+G_DEFINE_TYPE_WITH_PRIVATE (GcrViewerWidget, gcr_viewer_widget, GTK_TYPE_BOX);
static const gchar *
get_parsed_label_or_display_name (GcrViewerWidget *self,
@@ -236,8 +236,7 @@ gcr_viewer_widget_init (GcrViewerWidget *self)
{
GtkWidget *area;
- self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_VIEWER_WIDGET,
- GcrViewerWidgetPrivate);
+ self->pv = gcr_viewer_widget_get_instance_private (self);
gtk_orientable_set_orientation (GTK_ORIENTABLE (self),
GTK_ORIENTATION_VERTICAL);
@@ -352,8 +351,6 @@ gcr_viewer_widget_class_init (GcrViewerWidgetClass *klass)
gobject_class->get_property = gcr_viewer_widget_get_property;
gobject_class->set_property = gcr_viewer_widget_set_property;
- g_type_class_add_private (klass, sizeof (GcrViewerWidgetPrivate));
-
/**
* GcrViewerWidget:parser:
*
diff --git a/ui/gcr-viewer-window.c b/ui/gcr-viewer-window.c
index 99a6d4f..a25e10e 100644
--- a/ui/gcr-viewer-window.c
+++ b/ui/gcr-viewer-window.c
@@ -35,7 +35,7 @@ struct _GcrViewerWindowPrivate {
GcrImportButton *import;
};
-G_DEFINE_TYPE (GcrViewerWindow, gcr_viewer_window, GTK_TYPE_WINDOW);
+G_DEFINE_TYPE_WITH_PRIVATE (GcrViewerWindow, gcr_viewer_window, GTK_TYPE_WINDOW);
static void
on_viewer_renderer_added (GcrViewerWidget *viewer,
@@ -50,8 +50,7 @@ on_viewer_renderer_added (GcrViewerWidget *viewer,
static void
gcr_viewer_window_init (GcrViewerWindow *self)
{
- self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, GCR_TYPE_VIEWER_WINDOW,
- GcrViewerWindowPrivate);
+ self->pv = gcr_viewer_window_get_instance_private (self);
}
static void
@@ -154,8 +153,6 @@ gcr_viewer_window_class_init (GcrViewerWindowClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->constructed = gcr_viewer_window_constructed;
-
- g_type_class_add_private (klass, sizeof (GcrViewerWindow));
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]