[gnome-calendar/calendar-management] sources-dialog: remove source when signal is emited



commit f4d5bd773cbe836183c77fd48561113df81a09c8
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Jan 18 10:54:30 2015 -0200

    sources-dialog: remove source when signal is emited
    
    Since the hash table was constructed with gtk_widget_destroy as destroy func, the row is automatically 
removed too.

 src/gcal-source-manager-dialog.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/src/gcal-source-manager-dialog.c b/src/gcal-source-manager-dialog.c
index 99c7438..6dcc6f4 100644
--- a/src/gcal-source-manager-dialog.c
+++ b/src/gcal-source-manager-dialog.c
@@ -177,7 +177,27 @@ source_removed_cb (GcalManager *manager,
                    ESource     *source,
                    gpointer     user_data)
 {
-  g_message ("Source removed CB");
+  GcalSourceManagerDialogPrivate *priv;
+  GList *keys, *aux;
+
+  priv = gcal_source_manager_dialog_get_instance_private (GCAL_SOURCE_MANAGER_DIALOG (user_data));
+  keys = g_hash_table_get_keys (priv->row_to_source);
+
+  for (aux = keys; aux != NULL; aux = aux->next)
+    {
+      ESource *current;
+
+      current = g_hash_table_lookup (priv->row_to_source, aux->data);
+
+      /* remove the entry */
+      if (current == source)
+        {
+          g_hash_table_remove (priv->row_to_source, aux->data);
+          break;
+        }
+    }
+
+  g_list_free (keys);
 }
 
 /**


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