[gnome-calendar/calendar-management] source-manager: implement sources.remove action



commit a660347290641929cbb20bc6cf28e91dff6395fe
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Feb 5 16:34:33 2015 -0200

    source-manager: implement sources.remove action
    
    Added sources can now be removed

 src/gcal-source-manager-dialog.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/src/gcal-source-manager-dialog.c b/src/gcal-source-manager-dialog.c
index e50e76c..7efd5f4 100644
--- a/src/gcal-source-manager-dialog.c
+++ b/src/gcal-source-manager-dialog.c
@@ -86,6 +86,10 @@ static void     local_action_activated                     (GSimpleAction
                                                             GVariant            *value,
                                                             gpointer             user_data);
 
+static void     remove_action_activated                    (GSimpleAction       *menu_item,
+                                                            GVariant            *value,
+                                                            gpointer             user_data);
+
 static void     row_activated_cb                           (GtkListBox          *listbox,
                                                             GtkListBoxRow       *row,
                                                             gpointer             user_data);
@@ -148,7 +152,7 @@ static GActionEntry action_entries[] =
   { "default", NULL, NULL, "false", default_action_state_changed },
   { "rename", NULL, NULL, NULL, NULL },
   { "color", color_action_activated, NULL, NULL, NULL },
-  { "remove", NULL, NULL, NULL, NULL },
+  { "remove", remove_action_activated, NULL, NULL, NULL },
 };
 
 /**
@@ -449,6 +453,25 @@ local_action_activated (GSimpleAction *menu_item,
 }
 
 /**
+ * remove_action_activated:
+ *
+ * Remove the selected source.
+ *
+ * Returns:
+ */
+static void
+remove_action_activated (GSimpleAction *menu_item,
+                         GVariant      *value,
+                         gpointer       user_data)
+{
+  GcalSourceManagerDialogPrivate *priv;
+  priv = gcal_source_manager_dialog_get_instance_private (GCAL_SOURCE_MANAGER_DIALOG (user_data));
+
+  if (priv->selected_source != NULL)
+    gcal_manager_remove_source (priv->manager, priv->selected_source);
+}
+
+/**
  * row_activated_cb:
  *
  * Updates the edit stack properties,


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