[Xfce4-commits] [xfce/xfce4-settings] 24/57: color: Conditionally enable the ok button

noreply at xfce.org noreply at xfce.org
Thu Mar 21 22:14:12 CET 2019


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

o   c   h   o   s   i       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 xfce/xfce4-settings.

commit b1d8aa4bcce87489f3e908d14e0418e85752c5c3
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Wed Feb 13 00:31:20 2019 +0100

    color: Conditionally enable the ok button
---
 dialogs/color-settings/main.c | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/dialogs/color-settings/main.c b/dialogs/color-settings/main.c
index c571191..2acc193 100644
--- a/dialogs/color-settings/main.c
+++ b/dialogs/color-settings/main.c
@@ -410,6 +410,23 @@ color_settings_add_profiles_suitable_for_devices (ColorSettings *settings,
 
 
 static void
+color_settings_profiles_treeview_clicked_cb (GtkTreeSelection *selection,
+                                        ColorSettings *settings)
+{
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+
+  /* get selection */
+  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+    return;
+
+  /* as soon as anything is selected, make the Add button sensitive */
+  gtk_widget_set_sensitive (GTK_WIDGET (settings->button_assign_ok), TRUE);
+}
+
+
+
+static void
 color_settings_button_assign_cancel_cb (GtkWidget *widget, ColorSettings *settings)
 {
     gtk_widget_hide (GTK_WIDGET (settings->dialog_assign));
@@ -490,12 +507,11 @@ color_settings_profile_add_cb (GtkButton *button, ColorSettings *settings)
     profiles = cd_device_get_profiles (settings->current_device);
     color_settings_add_profiles_suitable_for_devices (settings, profiles);
 
-    /* make insensitve until we have a selection */
-    //gtk_widget_set_sensitive (settings->button_assign_ok, FALSE);
+    /* make insensitive until we have a selection */
+    gtk_widget_set_sensitive (GTK_WIDGET (settings->button_assign_ok), FALSE);
 
     /* show the dialog */
     gtk_widget_show (GTK_WIDGET (settings->dialog_assign));
-    //gtk_window_set_transient_for (GTK_WINDOW (settings->dialog_assign), GTK_WINDOW (settings->main_window));
 }
 
 
@@ -975,6 +991,7 @@ static void
 color_settings_dialog_init (GtkBuilder *builder)
 {
     ColorSettings *settings;
+    GtkTreeSelection *selection;
 
     settings = g_new0 (ColorSettings, 1);
     settings->cancellable = g_cancellable_new ();
@@ -1043,11 +1060,11 @@ color_settings_dialog_init (GtkBuilder *builder)
     settings->liststore_assign = gtk_builder_get_object (builder, "liststore-assign");
     settings->treeview_assign = gtk_builder_get_object (builder, "treeview-assign");
     color_settings_add_profiles_columns (settings, GTK_TREE_VIEW (settings->treeview_assign));
-/*    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (settings->treeview_assign));
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (settings->treeview_assign));
     g_signal_connect (selection, "changed",
                       G_CALLBACK (color_settings_profiles_treeview_clicked_cb),
                       settings);
-    g_signal_connect (GTK_TREE_VIEW (settings->treeview_assign), "row-activated",
+/*    g_signal_connect (GTK_TREE_VIEW (settings->treeview_assign), "row-activated",
                       G_CALLBACK (color_settings_profiles_row_activated_cb),
                       settings); */
     settings->button_assign_import = gtk_builder_get_object (builder, "assign-import");

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


More information about the Xfce4-commits mailing list