[gedit] window: use g_object_class_install_properties
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] window: use g_object_class_install_properties
- Date: Sun, 13 Sep 2015 19:16:54 +0000 (UTC)
commit 51f11187fa11d84347c88dd7cb9a90231ae37b02
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Sep 13 20:32:35 2015 +0200
window: use g_object_class_install_properties
gedit/gedit-window.c | 40 +++++++++++++++++++++-------------------
1 files changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 3bb733c..14f4b70 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -64,7 +64,15 @@
#define TAB_WIDTH_DATA "GeditWindowTabWidthData"
#define FULLSCREEN_ANIMATION_SPEED 500
-/* Signals */
+enum
+{
+ PROP_0,
+ PROP_STATE,
+ LAST_PROP
+};
+
+static GParamSpec *properties[LAST_PROP];
+
enum
{
TAB_ADDED,
@@ -75,13 +83,7 @@ enum
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
-
-enum
-{
- PROP_0,
- PROP_STATE
-};
+static guint signals[LAST_SIGNAL];
enum
{
@@ -423,6 +425,16 @@ gedit_window_class_init (GeditWindowClass *klass)
widget_class->configure_event = gedit_window_configure_event;
widget_class->key_press_event = gedit_window_key_press_event;
+ properties[PROP_STATE] =
+ g_param_spec_flags ("state",
+ "State",
+ "The window's state",
+ GEDIT_TYPE_WINDOW_STATE,
+ GEDIT_WINDOW_STATE_NORMAL,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROP, properties);
+
signals[TAB_ADDED] =
g_signal_new ("tab-added",
G_OBJECT_CLASS_TYPE (object_class),
@@ -467,16 +479,6 @@ gedit_window_class_init (GeditWindowClass *klass)
G_TYPE_NONE,
0);
- g_object_class_install_property (object_class,
- PROP_STATE,
- g_param_spec_flags ("state",
- "State",
- "The window's state",
- GEDIT_TYPE_WINDOW_STATE,
- GEDIT_WINDOW_STATE_NORMAL,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
-
/* Bind class to template */
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/gedit/ui/gedit-window.ui");
@@ -1553,7 +1555,7 @@ update_window_state (GeditWindow *window)
window->priv->state,
window->priv->num_tabs_with_error);
- g_object_notify (G_OBJECT (window), "state");
+ g_object_notify_by_pspec (G_OBJECT (window), properties[PROP_STATE]);
}
else if (old_num_of_errors != window->priv->num_tabs_with_error)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]