[Xfce4-commits] [panel-plugins/xfce4-clipman-plugin] 26/28: Convert enable-actions checkbutton to switch

noreply at xfce.org noreply at xfce.org
Thu May 19 20:06:28 CEST 2016


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

ochosi pushed a commit to branch master
in repository panel-plugins/xfce4-clipman-plugin.

commit 4a10d86276fb0231baef631214adc3d51a2c2b23
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Wed May 18 22:31:11 2016 +0200

    Convert enable-actions checkbutton to switch
---
 panel-plugin/settings-dialog.ui       | 40 ++++++++++++++++++++++++++---------
 panel-plugin/xfce4-clipman-settings.c | 30 ++++++++++++--------------
 2 files changed, 44 insertions(+), 26 deletions(-)

diff --git a/panel-plugin/settings-dialog.ui b/panel-plugin/settings-dialog.ui
index 27e57dc..d678492 100644
--- a/panel-plugin/settings-dialog.ui
+++ b/panel-plugin/settings-dialog.ui
@@ -795,19 +795,39 @@
                 <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
-                  <object class="GtkCheckButton" id="enable-actions">
-                    <property name="label" translatable="yes">Enable _actions</property>
+                  <object class="GtkBox" id="box1">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">If checked, the clipboard texts will be matched against regular expressions and a menu will display possible actions</property>
-                    <property name="use_underline">True</property>
-                    <property name="xalign">0.5</property>
-                    <property name="draw_indicator">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkLabel" id="label1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">_Enable actions</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSwitch" id="enable-actions">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="tooltip_text" translatable="yes">If checked, the clipboard texts will be matched against regular expressions and a menu will display possible actions</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
+                    <property name="fill">True</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -943,7 +963,7 @@
                   <packing>
                     <property name="expand">True</property>
                     <property name="fill">True</property>
-                    <property name="position">1</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
               </object>
diff --git a/panel-plugin/xfce4-clipman-settings.c b/panel-plugin/xfce4-clipman-settings.c
index 60c4597..044dc03 100644
--- a/panel-plugin/xfce4-clipman-settings.c
+++ b/panel-plugin/xfce4-clipman-settings.c
@@ -42,7 +42,9 @@ static void             cb_show_help                    (GtkButton *button);
 static void             setup_actions_treeview          (GtkTreeView *treeview);
 static void             refresh_actions_treeview        (GtkTreeView *treeview);
 static void             apply_action                    (const gchar *original_action_name);
-static void             cb_enable_actions               (GtkCheckButton *checkbutton);
+static void             cb_enable_actions               (GtkSwitch *enable_actions,
+                                                         gboolean state,
+                                                         gpointer user_data);
 static void             cb_actions_selection_changed    (GtkTreeSelection *selection);
 static void             cb_add_action                   (GtkButton *button);
 static void             cb_edit_action                  (GtkButton *button);
@@ -77,7 +79,7 @@ prop_dialog_run (void)
 {
   GtkWidget *action_dialog;
   GtkWidget *combobox;
-  GtkWidget *checkbutton;
+  GtkWidget *enable_actions;
 
   builder = gtk_builder_new ();
   gtk_builder_add_from_string (builder, settings_dialog_ui, settings_dialog_ui_length, NULL);
@@ -120,13 +122,13 @@ prop_dialog_run (void)
                           gtk_builder_get_object (builder, "max-texts-in-history"), "value");
 
   /* Actions tab and dialog */
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "enable-actions")),
+  gtk_switch_set_state (GTK_SWITCH (gtk_builder_get_object (builder, "enable-actions")),
                                 DEFAULT_ENABLE_ACTIONS);
   xfconf_g_property_bind (xfconf_channel, "/settings/enable-actions", G_TYPE_BOOLEAN,
                           gtk_builder_get_object (builder, "enable-actions"), "active");
 
-  checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "enable-actions"));
-  g_signal_connect (GTK_WIDGET (checkbutton), "toggled", G_CALLBACK (cb_enable_actions), NULL);
+  enable_actions = GTK_WIDGET (gtk_builder_get_object (builder, "enable-actions"));
+  g_signal_connect (GTK_WIDGET (enable_actions), "state-set", G_CALLBACK (cb_enable_actions), NULL);
   g_signal_connect (gtk_builder_get_object (builder, "button-add-action"), "clicked", G_CALLBACK (cb_add_action), NULL);
   g_signal_connect (gtk_builder_get_object (builder, "button-edit-action"), "clicked", G_CALLBACK (cb_edit_action), NULL);
   g_signal_connect (gtk_builder_get_object (builder, "button-delete-action"), "clicked", G_CALLBACK (cb_delete_action), NULL);
@@ -144,7 +146,7 @@ prop_dialog_run (void)
 
   setup_actions_treeview (GTK_TREE_VIEW (gtk_builder_get_object (builder, "actions")));
   setup_commands_treeview (GTK_TREE_VIEW (gtk_builder_get_object (builder, "commands")));
-  cb_enable_actions (GTK_CHECK_BUTTON (checkbutton));
+  cb_enable_actions (GTK_SWITCH (enable_actions), gtk_switch_get_state(GTK_SWITCH(enable_actions)), NULL);
   setup_test_regex_dialog ();
 
   /* Callbacks for the OK button sensitivity in the edit action dialog */
@@ -390,17 +392,13 @@ apply_action (const gchar *original_action_name)
 }
 
 static void
-cb_enable_actions (GtkCheckButton *checkbutton)
+cb_enable_actions (GtkSwitch *enable_actions, gboolean state, gpointer user_data)
 {
-    gboolean sensitive;
-
-    sensitive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(checkbutton));
-
-    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "actions")), sensitive);
-    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "button-add-action")), sensitive);
-    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "button-edit-action")), sensitive);
-    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "button-delete-action")), sensitive);
-    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "button-reset-actions")), sensitive);
+    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "actions")), state);
+    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "button-add-action")), state);
+    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "button-edit-action")), state);
+    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "button-delete-action")), state);
+    gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "button-reset-actions")), state);
 }
 
 static void

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


More information about the Xfce4-commits mailing list