aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-09-16 16:34:21 -0500
committerTed Gould <ted@gould.cx>2010-09-16 16:34:21 -0500
commitebe26f6bfd0c74231864c9979d972bf8b944c7f5 (patch)
tree54ad85939bca8b212fcfafc5616f1e79f5733b86
parent0bcacdcdc45b229e955d9e9d748580f4c3fb3fd1 (diff)
parent6269aec66333ed1e308ebc22182ceaa57217ad36 (diff)
downloadlibayatana-indicator-ebe26f6bfd0c74231864c9979d972bf8b944c7f5.tar.gz
libayatana-indicator-ebe26f6bfd0c74231864c9979d972bf8b944c7f5.tar.bz2
libayatana-indicator-ebe26f6bfd0c74231864c9979d972bf8b944c7f5.zip
* Upstream Merge
* Adding a function to signal a menu is shown
-rw-r--r--debian/changelog7
-rw-r--r--libindicator/indicator-object.c25
-rw-r--r--libindicator/indicator-object.h9
-rw-r--r--tools/indicator-loader.c13
4 files changed, 54 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index f41decf..460125d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+libindicator (0.3.13-0ubuntu1~ppa2~ats1) UNRELEASED; urgency=low
+
+ * Upstream Merge
+ * Adding a function to signal a menu is shown
+
+ -- Ted Gould <ted@ubuntu.com> Thu, 16 Sep 2010 16:33:54 -0500
+
libindicator (0.3.13-0ubuntu1~ppa1) maverick; urgency=low
* New upstream release.
diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c
index a5fd740..41484a6 100644
--- a/libindicator/indicator-object.c
+++ b/libindicator/indicator-object.c
@@ -432,3 +432,28 @@ indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entr
return 0;
}
+
+/**
+ indicator_object_entry_activate:
+ @io: #IndicatorObject to query
+ @entry: The #IndicatorObjectEntry whose entry was shown
+ @timestamp: The X11 timestamp of the event
+
+ Used to signal to the indicator that the menu on an entry has
+ been clicked on. This can either be an activate or a showing
+ of the menu. Note, this does not actually show the menu that's
+ left up to the reader.
+*/
+void
+indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp)
+{
+ g_return_if_fail(INDICATOR_IS_OBJECT(io));
+ IndicatorObjectClass * class = INDICATOR_OBJECT_GET_CLASS(io);
+
+ if (class->entry_activate != NULL) {
+ return class->entry_activate(io, entry, timestamp);
+ }
+
+ return;
+}
+
diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h
index 32a35f9..79f4757 100644
--- a/libindicator/indicator-object.h
+++ b/libindicator/indicator-object.h
@@ -94,6 +94,8 @@ struct _IndicatorObjectClass {
GList * (*get_entries) (IndicatorObject * io);
guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry);
+ void (*entry_activate) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp);
+
/* Signals */
void (*entry_added) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
void (*entry_removed) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
@@ -102,6 +104,12 @@ struct _IndicatorObjectClass {
void (*menu_show) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data);
/* Reserved */
+ void (*reserved1) (void);
+ void (*reserved2) (void);
+ void (*reserved3) (void);
+ void (*reserved4) (void);
+ void (*reserved5) (void);
+ void (*reserved6) (void);
};
/**
@@ -132,6 +140,7 @@ IndicatorObject * indicator_object_new_from_file (const gchar * file);
GList * indicator_object_get_entries (IndicatorObject * io);
guint indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entry);
+void indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp);
G_END_DECLS
diff --git a/tools/indicator-loader.c b/tools/indicator-loader.c
index 747b216..03614aa 100644
--- a/tools/indicator-loader.c
+++ b/tools/indicator-loader.c
@@ -28,6 +28,17 @@ License along with this library. If not, see
#define ENTRY_DATA_NAME "indicator-custom-entry-data"
static void
+activate_entry (GtkWidget * widget, gpointer user_data)
+{
+ g_return_if_fail(INDICATOR_IS_OBJECT(user_data));
+ gpointer entry = g_object_get_data(G_OBJECT(widget), ENTRY_DATA_NAME);
+ g_return_if_fail(entry == NULL);
+
+ indicator_object_entry_activate(INDICATOR_OBJECT(user_data), (IndicatorObjectEntry *)entry, gtk_get_current_event_time());
+ return;
+}
+
+static void
entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data)
{
g_debug("Signal: Entry Added");
@@ -48,6 +59,8 @@ entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_d
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entry->menu));
}
+ g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(activate_entry), io);
+
gtk_menu_shell_append(GTK_MENU_SHELL(user_data), menuitem);
gtk_widget_show(menuitem);