Merge lp:~ted/libindicator/about-to-show-root into lp:libindicator/0.4

Proposed by Ted Gould on 2010-09-17
Status: Merged
Merged at revision: 378
Proposed branch: lp:~ted/libindicator/about-to-show-root
Merge into: lp:libindicator/0.4
Diff against target: 125 lines (+53/-1)
5 files modified
libindicator/Makefile.am (+5/-0)
libindicator/indicator-object.c (+25/-0)
libindicator/indicator-object.h (+9/-0)
libindicator/indicator.pc.in (+1/-1)
tools/indicator-loader.c (+13/-0)
To merge this branch: bzr merge lp:~ted/libindicator/about-to-show-root
Reviewer Review Type Date Requested Status
Neil J. Patel (community) 2010-09-17 Approve on 2010-09-19
Review via email: mp+35891@code.launchpad.net

Description of the change

Adding a way to signal down into the entries that a high level item has been clicked on. NOTE: Breaks ABI

To post a comment you must log in.
Neil J. Patel (njpatel) wrote :

Looks good, approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libindicator/Makefile.am'
2--- libindicator/Makefile.am 2010-04-09 17:51:25 +0000
3+++ libindicator/Makefile.am 2010-09-17 21:19:22 +0000
4@@ -42,6 +42,11 @@
5 libindicator_la_LIBADD = \
6 $(LIBINDICATOR_LIBS)
7
8+libindicator_la_LDFLAGS = \
9+ -version-info 1:0:0 \
10+ -no-undefined \
11+ -export-symbols-regex "^[^_].*"
12+
13 pkgconfig_DATA = indicator.pc
14 pkgconfigdir = $(libdir)/pkgconfig
15
16
17=== modified file 'libindicator/indicator-object.c'
18--- libindicator/indicator-object.c 2010-09-14 14:55:16 +0000
19+++ libindicator/indicator-object.c 2010-09-17 21:19:22 +0000
20@@ -432,3 +432,28 @@
21
22 return 0;
23 }
24+
25+/**
26+ indicator_object_entry_activate:
27+ @io: #IndicatorObject to query
28+ @entry: The #IndicatorObjectEntry whose entry was shown
29+ @timestamp: The X11 timestamp of the event
30+
31+ Used to signal to the indicator that the menu on an entry has
32+ been clicked on. This can either be an activate or a showing
33+ of the menu. Note, this does not actually show the menu that's
34+ left up to the reader.
35+*/
36+void
37+indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp)
38+{
39+ g_return_if_fail(INDICATOR_IS_OBJECT(io));
40+ IndicatorObjectClass * class = INDICATOR_OBJECT_GET_CLASS(io);
41+
42+ if (class->entry_activate != NULL) {
43+ return class->entry_activate(io, entry, timestamp);
44+ }
45+
46+ return;
47+}
48+
49
50=== modified file 'libindicator/indicator-object.h'
51--- libindicator/indicator-object.h 2010-09-14 14:51:06 +0000
52+++ libindicator/indicator-object.h 2010-09-17 21:19:22 +0000
53@@ -94,6 +94,8 @@
54 GList * (*get_entries) (IndicatorObject * io);
55 guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry);
56
57+ void (*entry_activate) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp);
58+
59 /* Signals */
60 void (*entry_added) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
61 void (*entry_removed) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
62@@ -102,6 +104,12 @@
63 void (*menu_show) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data);
64
65 /* Reserved */
66+ void (*reserved1) (void);
67+ void (*reserved2) (void);
68+ void (*reserved3) (void);
69+ void (*reserved4) (void);
70+ void (*reserved5) (void);
71+ void (*reserved6) (void);
72 };
73
74 /**
75@@ -132,6 +140,7 @@
76
77 GList * indicator_object_get_entries (IndicatorObject * io);
78 guint indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entry);
79+void indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp);
80
81 G_END_DECLS
82
83
84=== modified file 'libindicator/indicator.pc.in'
85--- libindicator/indicator.pc.in 2009-11-04 17:34:44 +0000
86+++ libindicator/indicator.pc.in 2010-09-17 21:19:22 +0000
87@@ -4,7 +4,7 @@
88 bindir=@bindir@
89 includedir=@includedir@
90
91-indicatordir=${libdir}/indicators/3/
92+indicatordir=${libdir}/indicators/4/
93 iconsdir=@datarootdir@/@PACKAGE@/icons/
94
95 Cflags: -I${includedir}/libindicator-0.3
96
97=== modified file 'tools/indicator-loader.c'
98--- tools/indicator-loader.c 2010-09-15 13:58:07 +0000
99+++ tools/indicator-loader.c 2010-09-17 21:19:22 +0000
100@@ -28,6 +28,17 @@
101 #define ENTRY_DATA_NAME "indicator-custom-entry-data"
102
103 static void
104+activate_entry (GtkWidget * widget, gpointer user_data)
105+{
106+ g_return_if_fail(INDICATOR_IS_OBJECT(user_data));
107+ gpointer entry = g_object_get_data(G_OBJECT(widget), ENTRY_DATA_NAME);
108+ g_return_if_fail(entry == NULL);
109+
110+ indicator_object_entry_activate(INDICATOR_OBJECT(user_data), (IndicatorObjectEntry *)entry, gtk_get_current_event_time());
111+ return;
112+}
113+
114+static void
115 entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data)
116 {
117 g_debug("Signal: Entry Added");
118@@ -48,6 +59,8 @@
119 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entry->menu));
120 }
121
122+ g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(activate_entry), io);
123+
124 gtk_menu_shell_append(GTK_MENU_SHELL(user_data), menuitem);
125 gtk_widget_show(menuitem);
126

Subscribers

People subscribed via source and target branches