[gnome-builder/wip/project-selector] project-selector: update delete sensitivity when selecting



commit ecece3a341a3911b8db4f9107b48b4c9e42b3ca3
Author: Christian Hergert <christian hergert me>
Date:   Tue Apr 7 22:48:37 2015 -0700

    project-selector: update delete sensitivity when selecting

 src/dialogs/gb-projects-dialog.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/dialogs/gb-projects-dialog.c b/src/dialogs/gb-projects-dialog.c
index 26ee7ec..382a497 100644
--- a/src/dialogs/gb-projects-dialog.c
+++ b/src/dialogs/gb-projects-dialog.c
@@ -76,9 +76,22 @@ gb_projects_dialog__listbox_row_activated_cb (GbProjectsDialog *self,
   if (gtk_toggle_button_get_active (self->select_button))
     {
       gboolean selected;
+      GList *children;
+      GList *iter;
+
+      selected = !gb_recent_project_row_get_selected (GB_RECENT_PROJECT_ROW (row));
+      gb_recent_project_row_set_selected (GB_RECENT_PROJECT_ROW (row), selected);
+
+      children = gtk_container_get_children (GTK_CONTAINER (listbox));
+      for (iter = children; !selected && iter; iter = iter->next)
+        {
+          if (gb_recent_project_row_get_selected (iter->data))
+            selected = TRUE;
+        }
+      g_list_free (children);
+
+      gtk_widget_set_sensitive (GTK_WIDGET (self->delete_button), selected);
 
-      selected = gb_recent_project_row_get_selected (GB_RECENT_PROJECT_ROW (row));
-      gb_recent_project_row_set_selected (GB_RECENT_PROJECT_ROW (row), !selected);
       return;
     }
 


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