[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add a macro for resetting properties

noreply at xfce.org noreply at xfce.org
Fri Jan 19 21:54:15 CET 2018


This is an automated email from the git hooks/post-receive script.

f   2   4   0   4       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-terminal.

commit 3449d292f4d5e143f538d52371eca8f7e7191c86
Author: Igor <f2404 at yandex.ru>
Date:   Fri Jan 19 15:52:21 2018 -0500

    Add a macro for resetting properties
---
 terminal/terminal-preferences-dialog.c | 51 +++++++++++++++-------------------
 1 file changed, 23 insertions(+), 28 deletions(-)

diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index 3a2838c..4b52ad8 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -125,6 +125,25 @@ terminal_preferences_dialog_class_init (TerminalPreferencesDialogClass *klass)
 
 
 
+#define RESET_PROPERTIES(properties) \
+  G_STMT_START { \
+  guint i; \
+  for (i = 0; i < G_N_ELEMENTS (properties); i++) \
+    { \
+      GParamSpec *spec = g_object_class_find_property (G_OBJECT_GET_CLASS (dialog->preferences), properties[i]); \
+      if (G_LIKELY (spec != NULL)) \
+        { \
+          GValue value = { 0, }; \
+          g_value_init (&value, spec->value_type); \
+          g_param_value_set_default (spec, &value); \
+          g_object_set_property (G_OBJECT (dialog->preferences), properties[i], &value); \
+          g_value_unset (&value); \
+        } \
+    } \
+  } G_STMT_END
+
+
+
 static void
 terminal_preferences_dialog_init (TerminalPreferencesDialog *dialog)
 {
@@ -398,7 +417,7 @@ error:
   /* hide */
   object = gtk_builder_get_object (GTK_BUILDER (dialog), "geo-box");
   terminal_return_if_fail (G_IS_OBJECT (object));
-  gtk_widget_hide (GTK_BOX (object));
+  gtk_widget_hide (GTK_WIDGET (object));
 #endif
 
   /* background widgets visibility */
@@ -918,23 +937,8 @@ static void
 terminal_preferences_dialog_reset_compat (GtkWidget                 *button,
                                           TerminalPreferencesDialog *dialog)
 {
-  GParamSpec  *spec;
-  GValue       value = { 0, };
   const gchar *properties[] = { "binding-backspace", "binding-delete", "binding-ambiguous-width" };
-  guint        i;
-
-  for (i = 0; i < G_N_ELEMENTS (properties); i++)
-    {
-      spec = g_object_class_find_property (G_OBJECT_GET_CLASS (dialog->preferences),
-                                           properties[i]);
-      if (G_LIKELY (spec != NULL))
-        {
-          g_value_init (&value, spec->value_type);
-          g_param_value_set_default (spec, &value);
-          g_object_set_property (G_OBJECT (dialog->preferences), properties[i], &value);
-          g_value_unset (&value);
-        }
-    }
+  RESET_PROPERTIES (properties);
 }
 
 
@@ -943,17 +947,8 @@ static void
 terminal_preferences_dialog_reset_word_chars (GtkWidget                 *button,
                                               TerminalPreferencesDialog *dialog)
 {
-  GParamSpec  *spec;
-  GValue       value = { 0, };
-
-  spec = g_object_class_find_property (G_OBJECT_GET_CLASS (dialog->preferences), "word-chars");
-  if (G_LIKELY (spec != NULL))
-    {
-      g_value_init (&value, spec->value_type);
-      g_param_value_set_default (spec, &value);
-      g_object_set_property (G_OBJECT (dialog->preferences), "word-chars", &value);
-      g_value_unset (&value);
-    }
+  const gchar *properties[] = { "word-chars" };
+  RESET_PROPERTIES (properties);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list