[Xfce4-commits] [apps/xfce4-terminal] 01/01: Simplify preferences dialog bindings

noreply at xfce.org noreply at xfce.org
Tue Dec 20 12:33:45 CET 2016


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

f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.

commit 469ff432d520d69bec8d601193b0263752eab412
Author: Igor <f2404 at yandex.ru>
Date:   Tue Dec 20 14:33:39 2016 +0300

    Simplify preferences dialog bindings
---
 terminal/terminal-preferences-dialog.c | 93 +++++++---------------------------
 1 file changed, 18 insertions(+), 75 deletions(-)

diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index 1cf0882..f299d0c 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -64,12 +64,6 @@ static void terminal_preferences_dialog_background_set    (GtkFileChooserButton
                                                            TerminalPreferencesDialog *dialog);
 static void terminal_preferences_dialog_encoding_changed  (GtkComboBox               *combobox,
                                                            TerminalPreferencesDialog *dialog);
-static void terminal_preferences_dialog_custom_command    (GtkWidget                 *button,
-                                                           TerminalPreferencesDialog *dialog);
-static void terminal_preferences_dialog_scroll_unlimited  (GtkWidget                 *button,
-                                                           TerminalPreferencesDialog *dialog);
-static void terminal_preferences_dialog_font_use_system   (GtkWidget                 *button,
-                                                           TerminalPreferencesDialog *dialog);
 
 
 
@@ -247,27 +241,27 @@ error:
 
   /* run custom command button */
   object = gtk_builder_get_object (GTK_BUILDER (dialog), "run-custom-command");
-  terminal_return_if_fail (G_IS_OBJECT (object));
-  g_signal_connect (G_OBJECT (object), "realize",
-      G_CALLBACK (terminal_preferences_dialog_custom_command), dialog);
-  g_signal_connect (G_OBJECT (object), "clicked",
-      G_CALLBACK (terminal_preferences_dialog_custom_command), dialog);
+  object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "hbox3");
+  terminal_return_if_fail (G_IS_OBJECT (object) && G_IS_OBJECT (object2));
+  g_object_bind_property (G_OBJECT (object), "active",
+                          G_OBJECT (object2), "sensitive",
+                          G_BINDING_SYNC_CREATE);
 
   /* unlimited scrollback button */
   object = gtk_builder_get_object (GTK_BUILDER (dialog), "scrolling-unlimited");
-  terminal_return_if_fail (G_IS_OBJECT (object));
-  g_signal_connect (G_OBJECT (object), "realize",
-      G_CALLBACK (terminal_preferences_dialog_scroll_unlimited), dialog);
-  g_signal_connect (G_OBJECT (object), "clicked",
-      G_CALLBACK (terminal_preferences_dialog_scroll_unlimited), dialog);
+  object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "scrolling-lines");
+  terminal_return_if_fail (G_IS_OBJECT (object) && G_IS_OBJECT (object2));
+  g_object_bind_property (G_OBJECT (object), "active",
+                          G_OBJECT (object2), "sensitive",
+                          G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE);
 
   /* use system font button */
   object = gtk_builder_get_object (GTK_BUILDER (dialog), "font-use-system");
-  terminal_return_if_fail (G_IS_OBJECT (object));
-  g_signal_connect (G_OBJECT (object), "realize",
-      G_CALLBACK (terminal_preferences_dialog_font_use_system), dialog);
-  g_signal_connect (G_OBJECT (object), "clicked",
-      G_CALLBACK (terminal_preferences_dialog_font_use_system), dialog);
+  object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "font-name");
+  terminal_return_if_fail (G_IS_OBJECT (object) && G_IS_OBJECT (object2));
+  g_object_bind_property (G_OBJECT (object), "active",
+                          G_OBJECT (object2), "sensitive",
+                          G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE);
 
   /* reset comparibility button */
   object = gtk_builder_get_object (GTK_BUILDER (dialog), "reset-compatibility");
@@ -294,10 +288,12 @@ error:
                           G_OBJECT (object), "active",
                           G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
   object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "color-selection");
+  terminal_return_if_fail (G_IS_OBJECT (object2));
   g_object_bind_property (G_OBJECT (object), "active",
                           G_OBJECT (object2), "sensitive",
                           G_BINDING_SYNC_CREATE);
   object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "color-selection-bg");
+  terminal_return_if_fail (G_IS_OBJECT (objec2));
   g_object_bind_property (G_OBJECT (object), "active",
                           G_OBJECT (object2), "sensitive",
                           G_BINDING_SYNC_CREATE);
@@ -308,6 +304,7 @@ error:
                           G_OBJECT (object), "active",
                           G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
   object2 = gtk_builder_get_object (GTK_BUILDER (dialog), "color-bold");
+  terminal_return_if_fail (G_IS_OBJECT (object2));
   g_object_bind_property (G_OBJECT (object), "active",
                           G_OBJECT (object2), "sensitive",
                           G_BINDING_SYNC_CREATE);
@@ -964,60 +961,6 @@ terminal_preferences_dialog_encoding_changed (GtkComboBox               *combobo
 
 
 
-static void
-terminal_preferences_dialog_custom_command (GtkWidget                 *button,
-                                            TerminalPreferencesDialog *dialog)
-{
-  GObject *object;
-  gboolean run_custom_command;
-
-  terminal_return_if_fail (TERMINAL_IS_PREFERENCES_DIALOG (dialog));
-  terminal_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
-
-  run_custom_command = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
-  object = gtk_builder_get_object (GTK_BUILDER (dialog), "custom-command");
-  terminal_return_if_fail (G_IS_OBJECT (object));
-  g_object_set (G_OBJECT (object), "sensitive", run_custom_command, NULL);
-}
-
-
-
-static void
-terminal_preferences_dialog_scroll_unlimited (GtkWidget                 *button,
-                                              TerminalPreferencesDialog *dialog)
-{
-  GObject *object;
-  gboolean unlimited;
-
-  terminal_return_if_fail (TERMINAL_IS_PREFERENCES_DIALOG (dialog));
-  terminal_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
-
-  unlimited = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
-  object = gtk_builder_get_object (GTK_BUILDER (dialog), "scrolling-lines");
-  terminal_return_if_fail (G_IS_OBJECT (object));
-  g_object_set (G_OBJECT (object), "sensitive", !unlimited, NULL);
-}
-
-
-
-static void
-terminal_preferences_dialog_font_use_system (GtkWidget                 *button,
-                                             TerminalPreferencesDialog *dialog)
-{
-  GObject *object;
-  gboolean use_system;
-
-  terminal_return_if_fail (TERMINAL_IS_PREFERENCES_DIALOG (dialog));
-  terminal_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
-
-  use_system = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
-  object = gtk_builder_get_object (GTK_BUILDER (dialog), "font-name");
-  terminal_return_if_fail (G_IS_OBJECT (object));
-  g_object_set (G_OBJECT (object), "sensitive", !use_system, NULL);
-}
-
-
-
 /**
  * terminal_preferences_dialog_new:
  *

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


More information about the Xfce4-commits mailing list