[gnome-calendar/calendar-management] source-manager-dialog: setup sensitivity of remove button



commit 66ac8058ee61fed0f81477db9365e8cfcc60a727
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Jan 30 14:20:37 2015 -0200

    source-manager-dialog: setup sensitivity of remove button

 data/ui/source-manager-dialog.ui |    1 +
 src/gcal-source-manager-dialog.c |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/source-manager-dialog.ui b/data/ui/source-manager-dialog.ui
index 8405efc..7c56853 100644
--- a/data/ui/source-manager-dialog.ui
+++ b/data/ui/source-manager-dialog.ui
@@ -111,6 +111,7 @@
                                 <child>
                                   <object class="GtkButton" id="remove_button">
                                     <property name="visible">True</property>
+                                    <property name="sensitive">False</property>
                                     <property name="can_focus">True</property>
                                     <property name="receives_default">True</property>
                                     <child>
diff --git a/src/gcal-source-manager-dialog.c b/src/gcal-source-manager-dialog.c
index e2bd591..c0c3996 100644
--- a/src/gcal-source-manager-dialog.c
+++ b/src/gcal-source-manager-dialog.c
@@ -27,6 +27,7 @@ struct _GcalSourceManagerDialogPrivate
   GtkWidget               *edit_color_button;
   GtkWidget               *edit_stack;
   GtkWidget               *headerbar;
+  GtkWidget               *remove_button;
   GtkWidget               *sources_listbox;
 
   /*
@@ -120,6 +121,8 @@ row_selected_cb (GtkListBox    *listbox,
   GcalSourceManagerDialogPrivate *priv;
   priv = gcal_source_manager_dialog_get_instance_private (GCAL_SOURCE_MANAGER_DIALOG (user_data));
 
+  gtk_widget_set_sensitive (priv->remove_button, row != NULL);
+
   if (row != NULL)
     {
       ESource *source;
@@ -317,6 +320,7 @@ gcal_source_manager_dialog_class_init (GcalSourceManagerDialogClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceManagerDialog, edit_color_button);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceManagerDialog, edit_stack);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceManagerDialog, headerbar);
+  gtk_widget_class_bind_template_child_private (widget_class, GcalSourceManagerDialog, remove_button);
   gtk_widget_class_bind_template_child_private (widget_class, GcalSourceManagerDialog, sources_listbox);
 
   gtk_widget_class_bind_template_callback (widget_class, row_selected_cb);


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