[epiphany/overview: 22/26] gd-main-view-generic: add "delete-element-clicked" signal to the interface



commit 72cc10c358f464e507c9b565df29dd5d22203d55
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Fri May 25 10:48:54 2012 +0200

    gd-main-view-generic: add "delete-element-clicked" signal to the interface
    
    Implementors of this interface may connect emit this signal to notify
    the GdMainView when a user is requesting to delete one item from the
    view.

 lib/widgets/gd-main-view-generic.c |   23 ++++++++++++++++++++++-
 lib/widgets/gd-main-view-generic.h |    2 ++
 2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/lib/widgets/gd-main-view-generic.c b/lib/widgets/gd-main-view-generic.c
index 9372845..190eb61 100644
--- a/lib/widgets/gd-main-view-generic.c
+++ b/lib/widgets/gd-main-view-generic.c
@@ -25,10 +25,24 @@
 typedef GdMainViewGenericIface GdMainViewGenericInterface;
 G_DEFINE_INTERFACE (GdMainViewGeneric, gd_main_view_generic, GTK_TYPE_WIDGET)
 
+enum {
+  DELETE_ITEM_CLICKED,
+  LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
 static void
 gd_main_view_generic_default_init (GdMainViewGenericInterface *iface)
 {
-  /* nothing */
+  signals[DELETE_ITEM_CLICKED] =
+    g_signal_new ("delete-item-clicked",
+                  GD_TYPE_MAIN_VIEW_GENERIC,
+                  G_SIGNAL_RUN_LAST,
+                  0,
+                  NULL, NULL, NULL,
+                  G_TYPE_NONE, 1,
+                  G_TYPE_STRING);
 }
 
 /**
@@ -153,3 +167,10 @@ _gd_main_view_generic_dnd_common (GtkTreeModel *model,
   gtk_selection_data_set_uris (data, uris);
   g_strfreev (uris);
 }
+
+void
+_gd_main_view_generic_item_delete_clicked (GdMainViewGeneric *self,
+					   const gchar *path)
+{
+  g_signal_emit (self, signals[DELETE_ITEM_CLICKED], 0, path);
+}
diff --git a/lib/widgets/gd-main-view-generic.h b/lib/widgets/gd-main-view-generic.h
index 61bfab2..3dee4dd 100644
--- a/lib/widgets/gd-main-view-generic.h
+++ b/lib/widgets/gd-main-view-generic.h
@@ -91,6 +91,8 @@ void _gd_main_view_generic_dnd_common (GtkTreeModel *model,
                                        gboolean selection_mode,
                                        GtkTreePath *path,
                                        GtkSelectionData *data);
+void _gd_main_view_generic_item_delete_clicked (GdMainViewGeneric *self,
+						const gchar *path);
 
 G_END_DECLS
 



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