[gedit] menu stack switcher: use g_object_class_install_properties
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] menu stack switcher: use g_object_class_install_properties
- Date: Sun, 13 Sep 2015 19:16:24 +0000 (UTC)
commit fd120512b29c1e2f077ec2738e3c8effc6b68e0c
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Sep 13 20:31:08 2015 +0200
menu stack switcher: use g_object_class_install_properties
gedit/gedit-menu-stack-switcher.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/gedit/gedit-menu-stack-switcher.c b/gedit/gedit-menu-stack-switcher.c
index 642d190..4a2db39 100644
--- a/gedit/gedit-menu-stack-switcher.c
+++ b/gedit/gedit-menu-stack-switcher.c
@@ -42,9 +42,12 @@ struct _GeditMenuStackSwitcher
enum {
PROP_0,
- PROP_STACK
+ PROP_STACK,
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
+
G_DEFINE_TYPE (GeditMenuStackSwitcher, gedit_menu_stack_switcher, GTK_TYPE_MENU_BUTTON)
static void
@@ -319,7 +322,7 @@ gedit_menu_stack_switcher_set_stack (GeditMenuStackSwitcher *switcher,
gtk_widget_queue_resize (GTK_WIDGET (switcher));
- g_object_notify (G_OBJECT (switcher), "stack");
+ g_object_notify_by_pspec (G_OBJECT (switcher), properties[PROP_STACK]);
}
GtkStack *
@@ -400,14 +403,14 @@ gedit_menu_stack_switcher_class_init (GeditMenuStackSwitcherClass *klass)
object_class->dispose = gedit_menu_stack_switcher_dispose;
object_class->finalize = gedit_menu_stack_switcher_finalize;
- g_object_class_install_property (object_class,
- PROP_STACK,
- g_param_spec_object ("stack",
- "Stack",
- "Stack",
- GTK_TYPE_STACK,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
+ properties[PROP_STACK] =
+ g_param_spec_object ("stack",
+ "Stack",
+ "Stack",
+ GTK_TYPE_STACK,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROP, properties);
}
GtkWidget *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]