[nautilus/wip/alexpandelea/batchRename] Override constructor



commit 080b96c907c9f1e78a4f4e4236230ea7d098ffe2
Author: Alexandru Pandelea <alexandru pandelea gmail com>
Date:   Fri Jun 17 15:05:53 2016 +0300

    Override constructor
    
    The constructor was overriden to set the use-header-bar property.
    This was needed because the init function was called before the constructor,
    so the property was set in the ui file, then unset by the constructor.
    This was also needed because this property is construct only.

 src/nautilus-batch-rename.c                      |   19 +++++++++++++++++++
 src/resources/ui/nautilus-batch-rename-dialog.ui |    2 --
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-batch-rename.c b/src/nautilus-batch-rename.c
index 44daf7c..c8289ce 100644
--- a/src/nautilus-batch-rename.c
+++ b/src/nautilus-batch-rename.c
@@ -420,11 +420,30 @@ file_names_widget_on_activate (NautilusBatchRename *dialog)
         g_list_free (new_names);
 }
 
+static GObject*
+nautilus_batch_rename_constructor (GType                  type,
+                                   guint                  n_construct_properties,
+                                   GObjectConstructParam *construct_params)
+{
+        GObject *object;
+
+        object = (* G_OBJECT_CLASS (nautilus_batch_rename_parent_class)->constructor) (type,
+                                                                                       
n_construct_properties,
+                                                                                       construct_params);
+
+        g_object_set (object,"use-header-bar",1, NULL);
+
+        return object;
+}
+
 static void
 nautilus_batch_rename_class_init (NautilusBatchRenameClass *klass)
 {
         GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass);
         GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+        GObjectClass   *oclass       = G_OBJECT_CLASS (klass);
+
+        oclass->constructor = nautilus_batch_rename_constructor;
 
         dialog_class->close = batch_rename_dialog_on_closed;
 
diff --git a/src/resources/ui/nautilus-batch-rename-dialog.ui 
b/src/resources/ui/nautilus-batch-rename-dialog.ui
index ca8290d..5a60043 100644
--- a/src/resources/ui/nautilus-batch-rename-dialog.ui
+++ b/src/resources/ui/nautilus-batch-rename-dialog.ui
@@ -6,8 +6,6 @@
     <property name="window_position">center-on-parent</property>
     <property name="destroy_with_parent">True</property>
     <property name="title">Batch rename</property>
-    <property name="use-header-bar">1</property>
-
     <child type="action">
       <object class="GtkButton" id="cancel_button">
         <property name="label" translatable="yes">_Cancel</property>


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