[gedit] open document selector: use g_object_class_install_properties



commit 64c0ad99eb3c96d9e90e1bd53be96424ed766f58
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Sep 13 20:31:23 2015 +0200

    open document selector: use g_object_class_install_properties

 gedit/gedit-open-document-selector.c |   43 +++++++++++++++++----------------
 1 files changed, 22 insertions(+), 21 deletions(-)
---
diff --git a/gedit/gedit-open-document-selector.c b/gedit/gedit-open-document-selector.c
index 1e2d0b2..e61b01a 100644
--- a/gedit/gedit-open-document-selector.c
+++ b/gedit/gedit-open-document-selector.c
@@ -84,21 +84,23 @@ enum
        N_COLUMNS
 };
 
-/* Signals */
 enum
 {
-       SELECTOR_FILE_ACTIVATED,
-       LAST_SIGNAL
+       PROP_0,
+       PROP_WINDOW,
+       LAST_PROP
 };
 
-static guint signals[LAST_SIGNAL] = { 0 };
+static GParamSpec *properties[LAST_PROP];
 
 enum
 {
-       PROP_0,
-       PROP_WINDOW
+       SELECTOR_FILE_ACTIVATED,
+       LAST_SIGNAL
 };
 
+static guint signals[LAST_SIGNAL];
+
 /* Value 0xFF is reserved to mark the end of the array */
 #define BYTE_ARRAY_END 0xFF
 
@@ -940,19 +942,28 @@ gedit_open_document_selector_file_activated (GeditOpenDocumentSelector *selector
 static void
 gedit_open_document_selector_class_init (GeditOpenDocumentSelectorClass *klass)
 {
-       GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
        GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-       gobject_class->constructed = gedit_open_document_selector_constructed;
-       gobject_class->dispose = gedit_open_document_selector_dispose;
+       object_class->constructed = gedit_open_document_selector_constructed;
+       object_class->dispose = gedit_open_document_selector_dispose;
 
-       gobject_class->get_property = gedit_open_document_selector_get_property;
-       gobject_class->set_property = gedit_open_document_selector_set_property;
+       object_class->get_property = gedit_open_document_selector_get_property;
+       object_class->set_property = gedit_open_document_selector_set_property;
 
        widget_class->get_request_mode = gedit_open_document_selector_get_request_mode;
        widget_class->get_preferred_width = gedit_open_document_selector_get_preferred_width;
        widget_class->map = gedit_open_document_selector_mapped;
 
+       properties[PROP_WINDOW] =
+               g_param_spec_object ("window",
+                                    "Window",
+                                    "The GeditWindow this GeditOpenDocumentSelector is associated with",
+                                    GEDIT_TYPE_WINDOW,
+                                    G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+
+       g_object_class_install_properties (object_class, LAST_PROP, properties);
+
        signals[SELECTOR_FILE_ACTIVATED] =
                g_signal_new_class_handler ("file-activated",
                                            G_TYPE_FROM_CLASS (klass),
@@ -971,16 +982,6 @@ gedit_open_document_selector_class_init (GeditOpenDocumentSelectorClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GeditOpenDocumentSelector, placeholder_box);
        gtk_widget_class_bind_template_child (widget_class, GeditOpenDocumentSelector, scrolled_window);
        gtk_widget_class_bind_template_child (widget_class, GeditOpenDocumentSelector, search_entry);
-
-       g_object_class_install_property (gobject_class,
-                                        PROP_WINDOW,
-                                        g_param_spec_object ("window",
-                                                             "Window",
-                                                             "The GeditWindow this GeditOpenDocumentSelector 
is associated with",
-                                                             GEDIT_TYPE_WINDOW,
-                                                             G_PARAM_READWRITE |
-                                                             G_PARAM_CONSTRUCT_ONLY |
-                                                             G_PARAM_STATIC_STRINGS));
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]