Merge lp:~ted/libappindicator/unity-parser into lp:libappindicator/13.10
- unity-parser
- Merge into trunk.13.10
Status: | Work in progress |
---|---|
Proposed branch: | lp:~ted/libappindicator/unity-parser |
Merge into: | lp:libappindicator/13.10 |
Prerequisite: | lp:~ted/libappindicator/saucy-fix |
Diff against target: |
818 lines (+333/-157) 8 files modified
configure.ac (+2/-2) debian/control (+2/-3) example/simple-client.c (+0/-2) src/app-indicator.c (+283/-84) src/app-indicator.h (+0/-4) src/notification-item.xml (+2/-0) tests/test-libappindicator.c (+35/-55) tests/test-simple-app.c (+9/-7) |
To merge this branch: | bzr merge lp:~ted/libappindicator/unity-parser |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Indicator Applet Developers | Pending | ||
Review via email: mp+168286@code.launchpad.net |
This proposal supersedes a proposal from 2013-05-02.
Commit message
Convert from DBusMenu to GMenu
Description of the change
Changing the backend of libappindicator to be based on GMenuModel instead of DBusmenu.
Pushing this up for review and people to start looking at, but if it lands the world will end. Okay, probably not that, but nothing will work as indicator-
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
Charles Kerr (charlesk) wrote : Posted in a previous version of this proposal | # |
> Pushing this up for review and people to start looking at, but if it lands the world will end.
Some people just want to watch the world burn. APPROVE
Ted Gould (ted) wrote : Posted in a previous version of this proposal | # |
Okay, I think I'm happy with this now. Had to clean up some of the action groups stuff. But it should work in most cases now. Next rev we can add a way to put GMenu/GActionGroups in with supported functions. For now we just need to support the old API.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:289
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
Ted Gould (ted) wrote : Posted in a previous version of this proposal | # |
Wanted to note here so no one else investigates that the reason Jenkins is failing is because Raring doesn't have the required dependencies. They are in Saucy and the job is on the list to be updated.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:289
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
Ted Gould (ted) wrote : | # |
Rebased on the saucy fix to see if we can make Jenkins happy.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:289
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:289
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
- 289. By Ted Gould
-
Blocking a silly warning that isn't useful. Remember this when commenting on the quality of the GLib API.
- 288. By Ted Gould
-
Make GTK doc happy
- 287. By Ted Gould
-
Upgrade to a pop culture reference
- 286. By Ted Gould
-
Handling the debug property using boxed types
- 285. By Ted Gould
-
Switch over to using the ActionInfo array
- 284. By Ted Gould
-
Putting the bus stuff in the action info structure
- 283. By Ted Gould
-
Adds in a structure and an array so that we can start tracking action groups as a set
- 282. By Ted Gould
-
Fixing some docs errors
- 281. By Ted Gould
-
Adding support for the properties in their current form.
- 280. By Ted Gould
-
Add properties for the GMenuModels
Preview Diff
1 | === modified file 'configure.ac' | |||
2 | --- configure.ac 2013-01-29 17:50:13 +0000 | |||
3 | +++ configure.ac 2013-06-09 14:13:32 +0000 | |||
4 | @@ -58,7 +58,7 @@ | |||
5 | 58 | glib-2.0 >= $GLIB_REQUIRED_VERSION | 58 | glib-2.0 >= $GLIB_REQUIRED_VERSION |
6 | 59 | gio-2.0 >= $GIO_REQUIRED_VERSION | 59 | gio-2.0 >= $GIO_REQUIRED_VERSION |
7 | 60 | indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION | 60 | indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION |
9 | 61 | dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION) | 61 | unity-gtk3-parser) |
10 | 62 | AC_DEFINE(HAVE_GTK3, 1, [whether gtk3 is available]) | 62 | AC_DEFINE(HAVE_GTK3, 1, [whether gtk3 is available]) |
11 | 63 | ], | 63 | ], |
12 | 64 | [test "x$with_gtk" = x2], | 64 | [test "x$with_gtk" = x2], |
13 | @@ -66,7 +66,7 @@ | |||
14 | 66 | glib-2.0 >= $GLIB_REQUIRED_VERSION | 66 | glib-2.0 >= $GLIB_REQUIRED_VERSION |
15 | 67 | gio-2.0 >= $GIO_REQUIRED_VERSION | 67 | gio-2.0 >= $GIO_REQUIRED_VERSION |
16 | 68 | indicator-0.4 >= $INDICATOR_REQUIRED_VERSION | 68 | indicator-0.4 >= $INDICATOR_REQUIRED_VERSION |
18 | 69 | dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION) | 69 | unity-gtk2-parser) |
19 | 70 | ], | 70 | ], |
20 | 71 | [AC_MSG_FAILURE([Value for --with-gtk was neither 2 nor 3])] | 71 | [AC_MSG_FAILURE([Value for --with-gtk was neither 2 nor 3])] |
21 | 72 | ) | 72 | ) |
22 | 73 | 73 | ||
23 | === modified file 'debian/control' | |||
24 | --- debian/control 2013-03-11 12:59:43 +0000 | |||
25 | +++ debian/control 2013-06-09 14:13:32 +0000 | |||
26 | @@ -26,9 +26,8 @@ | |||
27 | 26 | libdbus-glib-1-dev (>= 0.82), | 26 | libdbus-glib-1-dev (>= 0.82), |
28 | 27 | libindicator-dev (>= 0.3.90), | 27 | libindicator-dev (>= 0.3.90), |
29 | 28 | libindicator3-dev (>= 0.3.90), | 28 | libindicator3-dev (>= 0.3.90), |
33 | 29 | libdbusmenu-glib-dev (>= 0.5.90), | 29 | libunity-gtk2-parser-dev, |
34 | 30 | libdbusmenu-gtk-dev (>= 0.5.90), | 30 | libunity-gtk3-parser-dev, |
32 | 31 | libdbusmenu-gtk3-dev (>= 0.5.90), | ||
35 | 32 | libgirepository1.0-dev, | 31 | libgirepository1.0-dev, |
36 | 33 | gir1.2-glib-2.0, | 32 | gir1.2-glib-2.0, |
37 | 34 | gir1.2-gtk-2.0, | 33 | gir1.2-gtk-2.0, |
38 | 35 | 34 | ||
39 | === modified file 'example/simple-client.c' | |||
40 | --- example/simple-client.c 2012-01-29 03:38:55 +0000 | |||
41 | +++ example/simple-client.c 2013-06-09 14:13:32 +0000 | |||
42 | @@ -21,8 +21,6 @@ | |||
43 | 21 | */ | 21 | */ |
44 | 22 | 22 | ||
45 | 23 | #include "app-indicator.h" | 23 | #include "app-indicator.h" |
46 | 24 | #include "libdbusmenu-glib/server.h" | ||
47 | 25 | #include "libdbusmenu-glib/menuitem.h" | ||
48 | 26 | 24 | ||
49 | 27 | GMainLoop * mainloop = NULL; | 25 | GMainLoop * mainloop = NULL; |
50 | 28 | static gboolean active = TRUE; | 26 | static gboolean active = TRUE; |
51 | 29 | 27 | ||
52 | === modified file 'src/app-indicator.c' | |||
53 | --- src/app-indicator.c 2013-04-19 12:07:21 +0000 | |||
54 | +++ src/app-indicator.c 2013-06-09 14:13:32 +0000 | |||
55 | @@ -31,10 +31,7 @@ | |||
56 | 31 | #include "config.h" | 31 | #include "config.h" |
57 | 32 | #endif | 32 | #endif |
58 | 33 | 33 | ||
63 | 34 | #include <libdbusmenu-glib/menuitem.h> | 34 | #include <unity-gtk-parser.h> |
60 | 35 | #include <libdbusmenu-glib/server.h> | ||
61 | 36 | #include <libdbusmenu-gtk/client.h> | ||
62 | 37 | #include <libdbusmenu-gtk/parser.h> | ||
64 | 38 | 35 | ||
65 | 39 | #include <libindicator/indicator-desktop-shortcuts.h> | 36 | #include <libindicator/indicator-desktop-shortcuts.h> |
66 | 40 | 37 | ||
67 | @@ -52,16 +49,8 @@ | |||
68 | 52 | 49 | ||
69 | 53 | /** | 50 | /** |
70 | 54 | * AppIndicatorPrivate: | 51 | * AppIndicatorPrivate: |
71 | 52 | * | ||
72 | 55 | * All of the private data in an instance of an application indicator. | 53 | * All of the private data in an instance of an application indicator. |
73 | 56 | * | ||
74 | 57 | * Private Fields | ||
75 | 58 | * @id: The ID of the indicator. Maps to AppIndicator:id. | ||
76 | 59 | * @category: Which category the indicator is. Maps to AppIndicator:category. | ||
77 | 60 | * @status: The status of the indicator. Maps to AppIndicator:status. | ||
78 | 61 | * @icon_name: The name of the icon to use. Maps to AppIndicator:icon-name. | ||
79 | 62 | * @attention_icon_name: The name of the attention icon to use. Maps to AppIndicator:attention-icon-name. | ||
80 | 63 | * @menu: The menu for this indicator. Maps to AppIndicator:menu | ||
81 | 64 | * @watcher_proxy: The proxy connection to the watcher we're connected to. If we're not connected to one this will be %NULL. | ||
82 | 65 | */ | 54 | */ |
83 | 66 | struct _AppIndicatorPrivate { | 55 | struct _AppIndicatorPrivate { |
84 | 67 | /*< Private >*/ | 56 | /*< Private >*/ |
85 | @@ -73,7 +62,6 @@ | |||
86 | 73 | gchar *icon_name; | 62 | gchar *icon_name; |
87 | 74 | gchar *attention_icon_name; | 63 | gchar *attention_icon_name; |
88 | 75 | gchar *icon_theme_path; | 64 | gchar *icon_theme_path; |
89 | 76 | DbusmenuServer *menuservice; | ||
90 | 77 | GtkWidget *menu; | 65 | GtkWidget *menu; |
91 | 78 | GtkWidget *sec_activate_target; | 66 | GtkWidget *sec_activate_target; |
92 | 79 | gboolean sec_activate_enabled; | 67 | gboolean sec_activate_enabled; |
93 | @@ -88,6 +76,12 @@ | |||
94 | 88 | GtkStatusIcon * status_icon; | 76 | GtkStatusIcon * status_icon; |
95 | 89 | gint fallback_timer; | 77 | gint fallback_timer; |
96 | 90 | 78 | ||
97 | 79 | /* Menu Stuff */ | ||
98 | 80 | GMenuModel * menu_model; | ||
99 | 81 | guint menu_model_export; | ||
100 | 82 | gchar * menu_shell_path; | ||
101 | 83 | GArray * menu_groups; | ||
102 | 84 | |||
103 | 91 | /* Fun stuff */ | 85 | /* Fun stuff */ |
104 | 92 | GDBusProxy *watcher_proxy; | 86 | GDBusProxy *watcher_proxy; |
105 | 93 | GDBusConnection *connection; | 87 | GDBusConnection *connection; |
106 | @@ -98,6 +92,16 @@ | |||
107 | 98 | IndicatorDesktopShortcuts * shorties; | 92 | IndicatorDesktopShortcuts * shorties; |
108 | 99 | }; | 93 | }; |
109 | 100 | 94 | ||
110 | 95 | typedef struct _ActionInfo ActionInfo; | ||
111 | 96 | struct _ActionInfo { | ||
112 | 97 | gchar * prefix; | ||
113 | 98 | gchar * path; | ||
114 | 99 | GActionGroup * group; | ||
115 | 100 | |||
116 | 101 | GDBusConnection * bus; | ||
117 | 102 | guint export; | ||
118 | 103 | }; | ||
119 | 104 | |||
120 | 101 | /* Signals Stuff */ | 105 | /* Signals Stuff */ |
121 | 102 | enum { | 106 | enum { |
122 | 103 | NEW_ICON, | 107 | NEW_ICON, |
123 | @@ -129,6 +133,8 @@ | |||
124 | 129 | PROP_LABEL_GUIDE, | 133 | PROP_LABEL_GUIDE, |
125 | 130 | PROP_ORDERING_INDEX, | 134 | PROP_ORDERING_INDEX, |
126 | 131 | PROP_DBUS_MENU_SERVER, | 135 | PROP_DBUS_MENU_SERVER, |
127 | 136 | PROP_MENU_MODEL, | ||
128 | 137 | PROP_ACTION_GROUPS, | ||
129 | 132 | PROP_TITLE | 138 | PROP_TITLE |
130 | 133 | }; | 139 | }; |
131 | 134 | 140 | ||
132 | @@ -147,6 +153,8 @@ | |||
133 | 147 | #define PROP_ORDERING_INDEX_S "ordering-index" | 153 | #define PROP_ORDERING_INDEX_S "ordering-index" |
134 | 148 | #define PROP_DBUS_MENU_SERVER_S "dbus-menu-server" | 154 | #define PROP_DBUS_MENU_SERVER_S "dbus-menu-server" |
135 | 149 | #define PROP_TITLE_S "title" | 155 | #define PROP_TITLE_S "title" |
136 | 156 | #define PROP_MENU_MODEL_S "menu-model" | ||
137 | 157 | #define PROP_ACTION_GROUPS_S "action-groups" | ||
138 | 150 | 158 | ||
139 | 151 | /* Private macro, shhhh! */ | 159 | /* Private macro, shhhh! */ |
140 | 152 | #define APP_INDICATOR_GET_PRIVATE(o) \ | 160 | #define APP_INDICATOR_GET_PRIVATE(o) \ |
141 | @@ -194,6 +202,10 @@ | |||
142 | 194 | static void bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * method, GVariant * params, GDBusMethodInvocation * invocation, gpointer user_data); | 202 | static void bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * method, GVariant * params, GDBusMethodInvocation * invocation, gpointer user_data); |
143 | 195 | static void bus_creation (GObject * obj, GAsyncResult * res, gpointer user_data); | 203 | static void bus_creation (GObject * obj, GAsyncResult * res, gpointer user_data); |
144 | 196 | static void bus_watcher_ready (GObject * obj, GAsyncResult * res, gpointer user_data); | 204 | static void bus_watcher_ready (GObject * obj, GAsyncResult * res, gpointer user_data); |
145 | 205 | static void setup_dbusmenu (AppIndicator *self); | ||
146 | 206 | static void unexport_menu (AppIndicator *self); | ||
147 | 207 | static void export_me_maybe (AppIndicator *self); | ||
148 | 208 | static void action_info_clear (gpointer datain); | ||
149 | 197 | 209 | ||
150 | 198 | static const GDBusInterfaceVTable item_interface_table = { | 210 | static const GDBusInterfaceVTable item_interface_table = { |
151 | 199 | method_call: bus_method_call, | 211 | method_call: bus_method_call, |
152 | @@ -399,7 +411,6 @@ | |||
153 | 399 | "A way to override the default ordering of the applications by providing a very specific idea of where this entry should be placed.", | 411 | "A way to override the default ordering of the applications by providing a very specific idea of where this entry should be placed.", |
154 | 400 | 0, G_MAXUINT32, 0, | 412 | 0, G_MAXUINT32, 0, |
155 | 401 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); | 413 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
156 | 402 | |||
157 | 403 | /** | 414 | /** |
158 | 404 | * AppIndicator:dbus-menu-server: | 415 | * AppIndicator:dbus-menu-server: |
159 | 405 | * | 416 | * |
160 | @@ -411,7 +422,7 @@ | |||
161 | 411 | g_param_spec_object (PROP_DBUS_MENU_SERVER_S, | 422 | g_param_spec_object (PROP_DBUS_MENU_SERVER_S, |
162 | 412 | "The internal DBusmenu Server", | 423 | "The internal DBusmenu Server", |
163 | 413 | "DBusmenu server which is available for testing the application indicators.", | 424 | "DBusmenu server which is available for testing the application indicators.", |
165 | 414 | DBUSMENU_TYPE_SERVER, | 425 | G_TYPE_OBJECT, |
166 | 415 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); | 426 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
167 | 416 | /** | 427 | /** |
168 | 417 | * AppIndicator:title: | 428 | * AppIndicator:title: |
169 | @@ -429,6 +440,34 @@ | |||
170 | 429 | NULL, | 440 | NULL, |
171 | 430 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); | 441 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
172 | 431 | 442 | ||
173 | 443 | /** | ||
174 | 444 | * AppIndicator:menu-model: | ||
175 | 445 | * | ||
176 | 446 | * The built menu model. This is only used for testing and should | ||
177 | 447 | * not be considered stable. | ||
178 | 448 | */ | ||
179 | 449 | g_object_class_install_property(object_class, | ||
180 | 450 | PROP_MENU_MODEL, | ||
181 | 451 | g_param_spec_object (PROP_MENU_MODEL_S, | ||
182 | 452 | "Internal Menu Model", | ||
183 | 453 | "TESTING ONLY: Property to get the menu model", | ||
184 | 454 | G_TYPE_MENU_MODEL, | ||
185 | 455 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); | ||
186 | 456 | |||
187 | 457 | /** | ||
188 | 458 | * AppIndicator:action-groups: | ||
189 | 459 | * | ||
190 | 460 | * The built action group. This is only used for testing and should | ||
191 | 461 | * not be considered stable. | ||
192 | 462 | */ | ||
193 | 463 | g_object_class_install_property(object_class, | ||
194 | 464 | PROP_ACTION_GROUPS, | ||
195 | 465 | g_param_spec_boxed (PROP_ACTION_GROUPS_S, | ||
196 | 466 | "Internal Action Group", | ||
197 | 467 | "TESTING ONLY: Property to get the action group", | ||
198 | 468 | G_TYPE_ARRAY, | ||
199 | 469 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); | ||
200 | 470 | |||
201 | 432 | /* Signals */ | 471 | /* Signals */ |
202 | 433 | 472 | ||
203 | 434 | /** | 473 | /** |
204 | @@ -479,7 +518,7 @@ | |||
205 | 479 | * AppIndicator::new-label: | 518 | * AppIndicator::new-label: |
206 | 480 | * @arg0: The #AppIndicator object | 519 | * @arg0: The #AppIndicator object |
207 | 481 | * @arg1: The string for the label | 520 | * @arg1: The string for the label |
209 | 482 | * @arg1: The string for the guide | 521 | * @arg2: The string for the guide |
210 | 483 | * | 522 | * |
211 | 484 | * Emitted when either #AppIndicator:label or #AppIndicator:label-guide are | 523 | * Emitted when either #AppIndicator:label or #AppIndicator:label-guide are |
212 | 485 | * changed. | 524 | * changed. |
213 | @@ -591,7 +630,7 @@ | |||
214 | 591 | priv->attention_icon_name = NULL; | 630 | priv->attention_icon_name = NULL; |
215 | 592 | priv->icon_theme_path = NULL; | 631 | priv->icon_theme_path = NULL; |
216 | 593 | priv->menu = NULL; | 632 | priv->menu = NULL; |
218 | 594 | priv->menuservice = NULL; | 633 | priv->menu_shell_path = NULL; |
219 | 595 | priv->ordering_index = 0; | 634 | priv->ordering_index = 0; |
220 | 596 | priv->title = NULL; | 635 | priv->title = NULL; |
221 | 597 | priv->label = NULL; | 636 | priv->label = NULL; |
222 | @@ -611,6 +650,9 @@ | |||
223 | 611 | priv->sec_activate_target = NULL; | 650 | priv->sec_activate_target = NULL; |
224 | 612 | priv->sec_activate_enabled = FALSE; | 651 | priv->sec_activate_enabled = FALSE; |
225 | 613 | 652 | ||
226 | 653 | priv->menu_groups = g_array_new(FALSE /* zero term */, FALSE /* clear */, sizeof(ActionInfo)); | ||
227 | 654 | g_array_set_clear_func(priv->menu_groups, action_info_clear); | ||
228 | 655 | |||
229 | 614 | self->priv = priv; | 656 | self->priv = priv; |
230 | 615 | 657 | ||
231 | 616 | /* Start getting the session bus */ | 658 | /* Start getting the session bus */ |
232 | @@ -663,8 +705,12 @@ | |||
233 | 663 | priv->menu = NULL; | 705 | priv->menu = NULL; |
234 | 664 | } | 706 | } |
235 | 665 | 707 | ||
238 | 666 | if (priv->menuservice != NULL) { | 708 | unexport_menu(self); |
239 | 667 | g_object_unref (priv->menuservice); | 709 | |
240 | 710 | g_clear_object(&priv->menu_model); | ||
241 | 711 | |||
242 | 712 | if (priv->menu_groups->len > 0) { | ||
243 | 713 | g_array_remove_range(priv->menu_groups, 0, priv->menu_groups->len); | ||
244 | 668 | } | 714 | } |
245 | 669 | 715 | ||
246 | 670 | if (priv->watcher_proxy != NULL) { | 716 | if (priv->watcher_proxy != NULL) { |
247 | @@ -765,10 +811,37 @@ | |||
248 | 765 | priv->path = NULL; | 811 | priv->path = NULL; |
249 | 766 | } | 812 | } |
250 | 767 | 813 | ||
251 | 814 | g_clear_pointer(&priv->menu_shell_path, g_free); | ||
252 | 815 | |||
253 | 816 | if (priv->menu_groups != NULL) { | ||
254 | 817 | g_array_free(priv->menu_groups, TRUE /* destroy segment */); | ||
255 | 818 | priv->menu_groups = NULL; | ||
256 | 819 | } | ||
257 | 820 | |||
258 | 768 | G_OBJECT_CLASS (app_indicator_parent_class)->finalize (object); | 821 | G_OBJECT_CLASS (app_indicator_parent_class)->finalize (object); |
259 | 769 | return; | 822 | return; |
260 | 770 | } | 823 | } |
261 | 771 | 824 | ||
262 | 825 | /* Cleans up an action info struct */ | ||
263 | 826 | static void | ||
264 | 827 | action_info_clear (gpointer datain) | ||
265 | 828 | { | ||
266 | 829 | ActionInfo * ainfo = (ActionInfo *)datain; | ||
267 | 830 | |||
268 | 831 | g_clear_pointer(&ainfo->prefix, g_free); | ||
269 | 832 | g_clear_pointer(&ainfo->path, g_free); | ||
270 | 833 | g_clear_object(&ainfo->group); | ||
271 | 834 | |||
272 | 835 | if (ainfo->export != 0) { | ||
273 | 836 | g_dbus_connection_unexport_action_group(ainfo->bus, ainfo->export); | ||
274 | 837 | ainfo->export = 0; | ||
275 | 838 | } | ||
276 | 839 | |||
277 | 840 | g_clear_object(&ainfo->bus); | ||
278 | 841 | |||
279 | 842 | return; | ||
280 | 843 | } | ||
281 | 844 | |||
282 | 772 | #define WARN_BAD_TYPE(prop, value) g_warning("Can not work with property '%s' with value of type '%s'.", prop, G_VALUE_TYPE_NAME(value)) | 845 | #define WARN_BAD_TYPE(prop, value) g_warning("Can not work with property '%s' with value of type '%s'.", prop, G_VALUE_TYPE_NAME(value)) |
283 | 773 | 846 | ||
284 | 774 | /* Set some properties */ | 847 | /* Set some properties */ |
285 | @@ -926,10 +999,28 @@ | |||
286 | 926 | break; | 999 | break; |
287 | 927 | 1000 | ||
288 | 928 | case PROP_DBUS_MENU_SERVER: | 1001 | case PROP_DBUS_MENU_SERVER: |
293 | 929 | g_clear_object (&priv->menuservice); | 1002 | g_warning("DBus Menu Server is a testing parameter. Why are you using it? Please stop."); |
294 | 930 | priv->menuservice = DBUSMENU_SERVER (g_value_dup_object(value)); | 1003 | break; |
295 | 931 | break; | 1004 | |
296 | 932 | 1005 | case PROP_MENU_MODEL: | |
297 | 1006 | unexport_menu(self); | ||
298 | 1007 | |||
299 | 1008 | g_clear_object(&priv->menu_model); | ||
300 | 1009 | priv->menu_model = g_value_dup_object(value); | ||
301 | 1010 | |||
302 | 1011 | export_me_maybe(self); | ||
303 | 1012 | break; | ||
304 | 1013 | case PROP_ACTION_GROUPS: | ||
305 | 1014 | if (priv->menu_groups != NULL) { | ||
306 | 1015 | g_array_free(priv->menu_groups, TRUE /* destroy segment */); | ||
307 | 1016 | priv->menu_groups = NULL; | ||
308 | 1017 | } | ||
309 | 1018 | |||
310 | 1019 | priv->menu_groups = g_value_get_boxed(value); | ||
311 | 1020 | g_array_ref(priv->menu_groups); | ||
312 | 1021 | |||
313 | 1022 | export_me_maybe(self); | ||
314 | 1023 | break; | ||
315 | 933 | default: | 1024 | default: |
316 | 934 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 1025 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
317 | 935 | break; | 1026 | break; |
318 | @@ -1009,13 +1100,22 @@ | |||
319 | 1009 | break; | 1100 | break; |
320 | 1010 | 1101 | ||
321 | 1011 | case PROP_DBUS_MENU_SERVER: | 1102 | case PROP_DBUS_MENU_SERVER: |
323 | 1012 | g_value_set_object(value, priv->menuservice); | 1103 | g_warning("DBus Menu Server is a testing parameter. Why are you using it? Please stop."); |
324 | 1104 | g_value_set_object(value, NULL); | ||
325 | 1013 | break; | 1105 | break; |
326 | 1014 | 1106 | ||
327 | 1015 | case PROP_TITLE: | 1107 | case PROP_TITLE: |
328 | 1016 | g_value_set_string(value, priv->title); | 1108 | g_value_set_string(value, priv->title); |
329 | 1017 | break; | 1109 | break; |
330 | 1018 | 1110 | ||
331 | 1111 | case PROP_MENU_MODEL: | ||
332 | 1112 | g_value_set_object(value, priv->menu_model); | ||
333 | 1113 | break; | ||
334 | 1114 | |||
335 | 1115 | case PROP_ACTION_GROUPS: | ||
336 | 1116 | g_value_set_boxed(value, priv->menu_groups); | ||
337 | 1117 | break; | ||
338 | 1118 | |||
339 | 1019 | default: | 1119 | default: |
340 | 1020 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 1120 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
341 | 1021 | break; | 1121 | break; |
342 | @@ -1138,16 +1238,7 @@ | |||
343 | 1138 | } else if (g_strcmp0(property, "IconThemePath") == 0) { | 1238 | } else if (g_strcmp0(property, "IconThemePath") == 0) { |
344 | 1139 | return g_variant_new_string(priv->icon_theme_path ? priv->icon_theme_path : ""); | 1239 | return g_variant_new_string(priv->icon_theme_path ? priv->icon_theme_path : ""); |
345 | 1140 | } else if (g_strcmp0(property, "Menu") == 0) { | 1240 | } else if (g_strcmp0(property, "Menu") == 0) { |
356 | 1141 | if (priv->menuservice != NULL) { | 1241 | return g_variant_new("o", "/"); |
347 | 1142 | GValue strval = { 0 }; | ||
348 | 1143 | g_value_init(&strval, G_TYPE_STRING); | ||
349 | 1144 | g_object_get_property (G_OBJECT (priv->menuservice), DBUSMENU_SERVER_PROP_DBUS_OBJECT, &strval); | ||
350 | 1145 | GVariant * var = g_variant_new("o", g_value_get_string(&strval)); | ||
351 | 1146 | g_value_unset(&strval); | ||
352 | 1147 | return var; | ||
353 | 1148 | } else { | ||
354 | 1149 | return g_variant_new("o", "/"); | ||
355 | 1150 | } | ||
357 | 1151 | } else if (g_strcmp0(property, "XAyatanaLabel") == 0) { | 1242 | } else if (g_strcmp0(property, "XAyatanaLabel") == 0) { |
358 | 1152 | return g_variant_new_string(priv->label ? priv->label : ""); | 1243 | return g_variant_new_string(priv->label ? priv->label : ""); |
359 | 1153 | } else if (g_strcmp0(property, "XAyatanaLabelGuide") == 0) { | 1244 | } else if (g_strcmp0(property, "XAyatanaLabelGuide") == 0) { |
360 | @@ -1158,6 +1249,31 @@ | |||
361 | 1158 | return g_variant_new_string(priv->accessible_desc ? priv->accessible_desc : ""); | 1249 | return g_variant_new_string(priv->accessible_desc ? priv->accessible_desc : ""); |
362 | 1159 | } else if (g_strcmp0(property, "AttentionAccessibleDesc") == 0) { | 1250 | } else if (g_strcmp0(property, "AttentionAccessibleDesc") == 0) { |
363 | 1160 | return g_variant_new_string(priv->att_accessible_desc ? priv->att_accessible_desc : ""); | 1251 | return g_variant_new_string(priv->att_accessible_desc ? priv->att_accessible_desc : ""); |
364 | 1252 | } else if (g_strcmp0(property, "XCanonicalMenuModel") == 0) { | ||
365 | 1253 | if (priv->menu_shell_path != NULL) { | ||
366 | 1254 | return g_variant_new_object_path(priv->menu_shell_path); | ||
367 | 1255 | } else { | ||
368 | 1256 | return g_variant_new_object_path("/"); | ||
369 | 1257 | } | ||
370 | 1258 | } else if (g_strcmp0(property, "XCanonicalActionGroups") == 0) { | ||
371 | 1259 | if (priv->menu_groups->len != 0) { | ||
372 | 1260 | GVariantBuilder array; | ||
373 | 1261 | g_variant_builder_init(&array, G_VARIANT_TYPE_ARRAY); | ||
374 | 1262 | |||
375 | 1263 | int i; | ||
376 | 1264 | for (i = 0; i < priv->menu_groups->len; i++) { | ||
377 | 1265 | ActionInfo * ainfo = &g_array_index(priv->menu_groups, ActionInfo, i); | ||
378 | 1266 | |||
379 | 1267 | g_variant_builder_open(&array, G_VARIANT_TYPE_TUPLE); | ||
380 | 1268 | g_variant_builder_add_value(&array, g_variant_new_string(ainfo->prefix)); | ||
381 | 1269 | g_variant_builder_add_value(&array, g_variant_new_object_path(ainfo->path)); | ||
382 | 1270 | g_variant_builder_close(&array); | ||
383 | 1271 | } | ||
384 | 1272 | |||
385 | 1273 | return g_variant_builder_end(&array); | ||
386 | 1274 | } else { | ||
387 | 1275 | return g_variant_new_array(G_VARIANT_TYPE("(so)"), NULL, 0); | ||
388 | 1276 | } | ||
389 | 1161 | } | 1277 | } |
390 | 1162 | 1278 | ||
391 | 1163 | *error = g_error_new(0, 0, "Unknown property: %s", property); | 1279 | *error = g_error_new(0, 0, "Unknown property: %s", property); |
392 | @@ -1261,6 +1377,8 @@ | |||
393 | 1261 | } | 1377 | } |
394 | 1262 | } | 1378 | } |
395 | 1263 | 1379 | ||
396 | 1380 | export_me_maybe(self); | ||
397 | 1381 | |||
398 | 1264 | /* NOTE: It's really important the order here. We make sure to *publish* | 1382 | /* NOTE: It's really important the order here. We make sure to *publish* |
399 | 1265 | the object on the bus and *then* get the proxy. The reason is that we | 1383 | the object on the bus and *then* get the proxy. The reason is that we |
400 | 1266 | want to ensure all the filters are setup before talking to the watcher | 1384 | want to ensure all the filters are setup before talking to the watcher |
401 | @@ -1746,6 +1864,79 @@ | |||
402 | 1746 | self->priv->sec_activate_enabled = widget_is_menu_child(self, menuitem); | 1864 | self->priv->sec_activate_enabled = widget_is_menu_child(self, menuitem); |
403 | 1747 | } | 1865 | } |
404 | 1748 | 1866 | ||
405 | 1867 | /* Unexport the menu, doesn't unref objects */ | ||
406 | 1868 | static void | ||
407 | 1869 | unexport_menu (AppIndicator *self) | ||
408 | 1870 | { | ||
409 | 1871 | AppIndicatorPrivate *priv = self->priv; | ||
410 | 1872 | |||
411 | 1873 | if (priv->connection == NULL) { | ||
412 | 1874 | return; | ||
413 | 1875 | } | ||
414 | 1876 | |||
415 | 1877 | if (priv->menu_model_export != 0) { | ||
416 | 1878 | g_dbus_connection_unexport_menu_model(priv->connection, priv->menu_model_export); | ||
417 | 1879 | priv->menu_model_export = 0; | ||
418 | 1880 | } | ||
419 | 1881 | |||
420 | 1882 | if (priv->menu_groups->len > 0) { | ||
421 | 1883 | g_array_remove_range(priv->menu_groups, 0, priv->menu_groups->len); | ||
422 | 1884 | } | ||
423 | 1885 | |||
424 | 1886 | g_clear_pointer(&priv->menu_shell_path, g_free); | ||
425 | 1887 | |||
426 | 1888 | return; | ||
427 | 1889 | } | ||
428 | 1890 | |||
429 | 1891 | /* We just met, and I know this is crazy, but export me maybe? */ | ||
430 | 1892 | /* Export the menu if we've got everything we need */ | ||
431 | 1893 | static void | ||
432 | 1894 | export_me_maybe (AppIndicator *self) | ||
433 | 1895 | { | ||
434 | 1896 | AppIndicatorPrivate *priv = self->priv; | ||
435 | 1897 | |||
436 | 1898 | if (priv->connection == NULL) { | ||
437 | 1899 | return; | ||
438 | 1900 | } | ||
439 | 1901 | |||
440 | 1902 | if (priv->menu_model == NULL) { | ||
441 | 1903 | return; | ||
442 | 1904 | } | ||
443 | 1905 | |||
444 | 1906 | if (priv->menu_groups->len == 0) { | ||
445 | 1907 | return; | ||
446 | 1908 | } | ||
447 | 1909 | |||
448 | 1910 | if (priv->menu_model_export != 0) { | ||
449 | 1911 | return; | ||
450 | 1912 | } | ||
451 | 1913 | |||
452 | 1914 | GError * error = NULL; | ||
453 | 1915 | int i; | ||
454 | 1916 | for (i = 0; i < priv->menu_groups->len; i++) { | ||
455 | 1917 | ActionInfo * ainfo = &g_array_index(priv->menu_groups, ActionInfo, i); | ||
456 | 1918 | |||
457 | 1919 | ainfo->bus = g_object_ref(priv->connection); | ||
458 | 1920 | |||
459 | 1921 | ainfo->export = g_dbus_connection_export_action_group(ainfo->bus, ainfo->path, ainfo->group, &error); | ||
460 | 1922 | |||
461 | 1923 | if (error != NULL) { | ||
462 | 1924 | g_warning("Unable to export action group as '%s': %s", ainfo->path, error->message); | ||
463 | 1925 | g_error_free(error); | ||
464 | 1926 | error = NULL; | ||
465 | 1927 | } | ||
466 | 1928 | } | ||
467 | 1929 | |||
468 | 1930 | priv->menu_model_export = g_dbus_connection_export_menu_model(priv->connection, priv->menu_shell_path, priv->menu_model, NULL); | ||
469 | 1931 | |||
470 | 1932 | if (error != NULL) { | ||
471 | 1933 | g_warning("Unable to export menu model as '%s': %s", priv->menu_shell_path, error->message); | ||
472 | 1934 | g_error_free(error); | ||
473 | 1935 | error = NULL; | ||
474 | 1936 | } | ||
475 | 1937 | |||
476 | 1938 | return; | ||
477 | 1939 | } | ||
478 | 1749 | 1940 | ||
479 | 1750 | /* ************************* */ | 1941 | /* ************************* */ |
480 | 1751 | /* Public Functions */ | 1942 | /* Public Functions */ |
481 | @@ -2072,25 +2263,26 @@ | |||
482 | 2072 | setup_dbusmenu (AppIndicator *self) | 2263 | setup_dbusmenu (AppIndicator *self) |
483 | 2073 | { | 2264 | { |
484 | 2074 | AppIndicatorPrivate *priv; | 2265 | AppIndicatorPrivate *priv; |
485 | 2075 | DbusmenuMenuitem *root = NULL; | ||
486 | 2076 | |||
487 | 2077 | priv = self->priv; | 2266 | priv = self->priv; |
488 | 2078 | 2267 | ||
489 | 2268 | unexport_menu(self); | ||
490 | 2269 | |||
491 | 2270 | g_clear_object(&priv->menu_model); | ||
492 | 2271 | |||
493 | 2079 | if (priv->menu) { | 2272 | if (priv->menu) { |
508 | 2080 | root = dbusmenu_gtk_parse_menu_structure(priv->menu); | 2273 | ActionInfo ainfo; |
509 | 2081 | } | 2274 | |
510 | 2082 | 2275 | priv->menu_model = G_MENU_MODEL(unity_gtk_menu_shell_new(GTK_MENU_SHELL(priv->menu))); | |
511 | 2083 | if (priv->menuservice == NULL) { | 2276 | priv->menu_shell_path = g_strdup_printf(DEFAULT_ITEM_PATH "/%s/Menu", priv->clean_id); |
512 | 2084 | gchar * path = g_strdup_printf(DEFAULT_ITEM_PATH "/%s/Menu", priv->clean_id); | 2277 | |
513 | 2085 | priv->menuservice = dbusmenu_server_new (path); | 2278 | ainfo.group = G_ACTION_GROUP(unity_gtk_action_group_new(NULL)); |
514 | 2086 | g_free(path); | 2279 | ainfo.prefix = g_strdup("unity"); |
515 | 2087 | } | 2280 | ainfo.path = g_strdup(priv->menu_shell_path); |
516 | 2088 | 2281 | g_array_append_val(priv->menu_groups, ainfo); | |
517 | 2089 | dbusmenu_server_set_root (priv->menuservice, root); | 2282 | |
518 | 2090 | 2283 | unity_gtk_action_group_connect_shell(UNITY_GTK_ACTION_GROUP(ainfo.group), UNITY_GTK_MENU_SHELL(priv->menu_model)); | |
519 | 2091 | /* Drop our local ref as set_root should get it's own. */ | 2284 | |
520 | 2092 | if (root != NULL) { | 2285 | export_me_maybe(self); |
507 | 2093 | g_object_unref(root); | ||
521 | 2094 | } | 2286 | } |
522 | 2095 | 2287 | ||
523 | 2096 | return; | 2288 | return; |
524 | @@ -2463,14 +2655,13 @@ | |||
525 | 2463 | return GTK_WIDGET(self->priv->sec_activate_target); | 2655 | return GTK_WIDGET(self->priv->sec_activate_target); |
526 | 2464 | } | 2656 | } |
527 | 2465 | 2657 | ||
528 | 2466 | #define APP_INDICATOR_SHORTY_NICK "app-indicator-shorty-nick" | ||
529 | 2467 | |||
530 | 2468 | /* Callback when an item from the desktop shortcuts gets | 2658 | /* Callback when an item from the desktop shortcuts gets |
531 | 2469 | called. */ | 2659 | called. */ |
532 | 2470 | static void | 2660 | static void |
534 | 2471 | shorty_activated_cb (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data) | 2661 | shorty_activated_cb (GSimpleAction * action, GVariant * param, gpointer user_data) |
535 | 2472 | { | 2662 | { |
537 | 2473 | gchar * nick = g_object_get_data(G_OBJECT(mi), APP_INDICATOR_SHORTY_NICK); | 2663 | gchar * nick = NULL; |
538 | 2664 | g_object_get(G_OBJECT(action), "name", &nick, NULL); | ||
539 | 2474 | g_return_if_fail(nick != NULL); | 2665 | g_return_if_fail(nick != NULL); |
540 | 2475 | 2666 | ||
541 | 2476 | g_return_if_fail(IS_APP_INDICATOR(user_data)); | 2667 | g_return_if_fail(IS_APP_INDICATOR(user_data)); |
542 | @@ -2500,45 +2691,53 @@ | |||
543 | 2500 | AppIndicatorPrivate *priv = self->priv; | 2691 | AppIndicatorPrivate *priv = self->priv; |
544 | 2501 | 2692 | ||
545 | 2502 | /* Build a new shortcuts object */ | 2693 | /* Build a new shortcuts object */ |
550 | 2503 | if (priv->shorties != NULL) { | 2694 | g_clear_object(&priv->shorties); |
547 | 2504 | g_object_unref(priv->shorties); | ||
548 | 2505 | priv->shorties = NULL; | ||
549 | 2506 | } | ||
551 | 2507 | priv->shorties = indicator_desktop_shortcuts_new(desktop_file, desktop_profile); | 2695 | priv->shorties = indicator_desktop_shortcuts_new(desktop_file, desktop_profile); |
552 | 2508 | g_return_if_fail(priv->shorties != NULL); | 2696 | g_return_if_fail(priv->shorties != NULL); |
553 | 2509 | 2697 | ||
554 | 2698 | /* Remove the exported menu */ | ||
555 | 2699 | unexport_menu(self); | ||
556 | 2700 | |||
557 | 2701 | g_clear_object(&priv->menu_model); | ||
558 | 2702 | |||
559 | 2703 | /* Get the 'nicks' */ | ||
560 | 2510 | const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(priv->shorties); | 2704 | const gchar ** nicks = indicator_desktop_shortcuts_get_nicks(priv->shorties); |
561 | 2705 | |||
562 | 2706 | if (nicks[0] == NULL) { | ||
563 | 2707 | g_warning("Desktop file '%s' doesn't contain any usable actions", desktop_file); | ||
564 | 2708 | return; | ||
565 | 2709 | } | ||
566 | 2710 | |||
567 | 2711 | /* Build new menus and action groups */ | ||
568 | 2712 | GMenu * menu = g_menu_new(); | ||
569 | 2713 | priv->menu_model = G_MENU_MODEL(menu); | ||
570 | 2714 | priv->menu_shell_path = g_strdup_printf(DEFAULT_ITEM_PATH "/%s/Menu", priv->clean_id); | ||
571 | 2715 | |||
572 | 2716 | ActionInfo ainfo; | ||
573 | 2717 | GSimpleActionGroup * actions = g_simple_action_group_new(); | ||
574 | 2718 | ainfo.group = G_ACTION_GROUP(actions); | ||
575 | 2719 | ainfo.prefix = g_strdup(""); | ||
576 | 2720 | ainfo.path = g_strdup(priv->menu_shell_path); | ||
577 | 2721 | g_array_append_val(priv->menu_groups, ainfo); | ||
578 | 2722 | |||
579 | 2511 | int nick_num; | 2723 | int nick_num; |
580 | 2512 | |||
581 | 2513 | /* Place the items on a dbusmenu */ | ||
582 | 2514 | DbusmenuMenuitem * root = dbusmenu_menuitem_new(); | ||
583 | 2515 | |||
584 | 2516 | for (nick_num = 0; nicks[nick_num] != NULL; nick_num++) { | 2724 | for (nick_num = 0; nicks[nick_num] != NULL; nick_num++) { |
587 | 2517 | DbusmenuMenuitem * item = dbusmenu_menuitem_new(); | 2725 | GSimpleAction * action = g_simple_action_new(nicks[nick_num], NULL); |
588 | 2518 | g_object_set_data(G_OBJECT(item), APP_INDICATOR_SHORTY_NICK, (gpointer)nicks[nick_num]); | 2726 | g_signal_connect(action, "activate", G_CALLBACK(shorty_activated_cb), self); |
589 | 2519 | 2727 | ||
590 | 2520 | gchar * name = indicator_desktop_shortcuts_nick_get_name(priv->shorties, nicks[nick_num]); | 2728 | gchar * name = indicator_desktop_shortcuts_nick_get_name(priv->shorties, nicks[nick_num]); |
592 | 2521 | dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, name); | 2729 | GMenuItem * item = g_menu_item_new(name, nicks[nick_num]); |
593 | 2522 | g_free(name); | 2730 | g_free(name); |
594 | 2523 | 2731 | ||
613 | 2524 | g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(shorty_activated_cb), self); | 2732 | g_simple_action_group_insert(actions, G_ACTION(action)); |
614 | 2525 | 2733 | g_menu_append_item(menu, item); | |
615 | 2526 | dbusmenu_menuitem_child_append(root, item); | 2734 | |
616 | 2527 | } | 2735 | g_object_unref(action); |
617 | 2528 | 2736 | g_object_unref(item); | |
618 | 2529 | /* Swap it if needed */ | 2737 | } |
619 | 2530 | if (priv->menuservice == NULL) { | 2738 | |
620 | 2531 | gchar * path = g_strdup_printf(DEFAULT_ITEM_PATH "/%s/Menu", priv->clean_id); | 2739 | /* Export the menu and action group */ |
621 | 2532 | priv->menuservice = dbusmenu_server_new (path); | 2740 | export_me_maybe(self); |
604 | 2533 | g_free(path); | ||
605 | 2534 | } | ||
606 | 2535 | |||
607 | 2536 | dbusmenu_server_set_root (priv->menuservice, root); | ||
608 | 2537 | |||
609 | 2538 | if (priv->menu != NULL) { | ||
610 | 2539 | g_object_unref(G_OBJECT(priv->menu)); | ||
611 | 2540 | priv->menu = NULL; | ||
612 | 2541 | } | ||
622 | 2542 | 2741 | ||
623 | 2543 | return; | 2742 | return; |
624 | 2544 | } | 2743 | } |
625 | 2545 | 2744 | ||
626 | === modified file 'src/app-indicator.h' | |||
627 | --- src/app-indicator.h 2012-02-03 20:37:56 +0000 | |||
628 | +++ src/app-indicator.h 2013-06-09 14:13:32 +0000 | |||
629 | @@ -238,10 +238,6 @@ | |||
630 | 238 | * unique status in the panel for an application. In general, applications | 238 | * unique status in the panel for an application. In general, applications |
631 | 239 | * should try to fit in the other indicators that are available on the | 239 | * should try to fit in the other indicators that are available on the |
632 | 240 | * panel before using this. But, sometimes it is necissary. | 240 | * panel before using this. But, sometimes it is necissary. |
633 | 241 | * | ||
634 | 242 | * Private fields | ||
635 | 243 | * @parent: Parent object. | ||
636 | 244 | * @priv: Internal data. | ||
637 | 245 | */ | 241 | */ |
638 | 246 | struct _AppIndicator { | 242 | struct _AppIndicator { |
639 | 247 | GObject parent; | 243 | GObject parent; |
640 | 248 | 244 | ||
641 | === modified file 'src/notification-item.xml' | |||
642 | --- src/notification-item.xml 2012-02-03 20:37:56 +0000 | |||
643 | +++ src/notification-item.xml 2013-06-09 14:13:32 +0000 | |||
644 | @@ -18,6 +18,8 @@ | |||
645 | 18 | <property name="XAyatanaLabel" type="s" access="read" /> | 18 | <property name="XAyatanaLabel" type="s" access="read" /> |
646 | 19 | <property name="XAyatanaLabelGuide" type="s" access="read" /> | 19 | <property name="XAyatanaLabelGuide" type="s" access="read" /> |
647 | 20 | <property name="XAyatanaOrderingIndex" type="u" access="read" /> | 20 | <property name="XAyatanaOrderingIndex" type="u" access="read" /> |
648 | 21 | <property name="XCanonicalMenuModel" type="o" access="read" /> | ||
649 | 22 | <property name="XCanonicalActionGroups" type="a(so)" access="read" /> | ||
650 | 21 | 23 | ||
651 | 22 | <!-- Methods --> | 24 | <!-- Methods --> |
652 | 23 | <method name="Scroll"> | 25 | <method name="Scroll"> |
653 | 24 | 26 | ||
654 | === modified file 'tests/test-libappindicator.c' | |||
655 | --- tests/test-libappindicator.c 2013-01-10 22:18:55 +0000 | |||
656 | +++ tests/test-libappindicator.c 2013-06-09 14:13:32 +0000 | |||
657 | @@ -22,12 +22,10 @@ | |||
658 | 22 | 22 | ||
659 | 23 | #include <glib.h> | 23 | #include <glib.h> |
660 | 24 | #include <glib-object.h> | 24 | #include <glib-object.h> |
661 | 25 | #include <gio/gio.h> | ||
662 | 25 | 26 | ||
663 | 26 | #include <app-indicator.h> | 27 | #include <app-indicator.h> |
664 | 27 | 28 | ||
665 | 28 | #include <libdbusmenu-glib/menuitem.h> | ||
666 | 29 | #include <libdbusmenu-glib/server.h> | ||
667 | 30 | |||
668 | 31 | static gboolean | 29 | static gboolean |
669 | 32 | allow_warnings (const gchar *log_domain, GLogLevelFlags log_level, | 30 | allow_warnings (const gchar *log_domain, GLogLevelFlags log_level, |
670 | 33 | const gchar *message, gpointer user_data) | 31 | const gchar *message, gpointer user_data) |
671 | @@ -270,26 +268,26 @@ | |||
672 | 270 | 268 | ||
673 | 271 | g_assert(app_indicator_get_menu(ci) != NULL); | 269 | g_assert(app_indicator_get_menu(ci) != NULL); |
674 | 272 | 270 | ||
693 | 273 | GValue serverval = {0}; | 271 | GValue modelval = {0}; |
694 | 274 | g_value_init(&serverval, DBUSMENU_TYPE_SERVER); | 272 | g_value_init(&modelval, G_TYPE_MENU_MODEL); |
695 | 275 | g_object_get_property(G_OBJECT(ci), "dbus-menu-server", &serverval); | 273 | g_object_get_property(G_OBJECT(ci), "menu-model", &modelval); |
696 | 276 | 274 | ||
697 | 277 | DbusmenuServer * server = DBUSMENU_SERVER(g_value_get_object(&serverval)); | 275 | GMenuModel * model = G_MENU_MODEL(g_value_get_object(&modelval)); |
698 | 278 | g_assert(server != NULL); | 276 | g_assert(model != NULL); |
699 | 279 | 277 | ||
700 | 280 | GValue rootval = {0}; | 278 | g_assert_cmpint(g_menu_model_get_n_items(model), ==, 1); |
701 | 281 | g_value_init(&rootval, DBUSMENU_TYPE_MENUITEM); | 279 | |
702 | 282 | g_object_get_property(G_OBJECT(server), DBUSMENU_SERVER_PROP_ROOT_NODE, &rootval); | 280 | GMenuModel * section = g_menu_model_get_item_link(model, 0, G_MENU_LINK_SECTION); |
703 | 283 | DbusmenuMenuitem * root = DBUSMENU_MENUITEM(g_value_get_object(&rootval)); | 281 | g_assert(section != NULL); |
704 | 284 | g_assert(root != NULL); | 282 | |
705 | 285 | 283 | g_assert_cmpint(g_menu_model_get_n_items(section), ==, 1); | |
706 | 286 | GList * children = dbusmenu_menuitem_get_children(root); | 284 | |
707 | 287 | g_assert(children != NULL); | 285 | GVariant * label = g_menu_model_get_item_attribute_value(section, 0, G_MENU_ATTRIBUTE_LABEL, G_VARIANT_TYPE_STRING); |
690 | 288 | g_assert(g_list_length(children) == 1); | ||
691 | 289 | |||
692 | 290 | const gchar * label = dbusmenu_menuitem_property_get(DBUSMENU_MENUITEM(children->data), DBUSMENU_MENUITEM_PROP_LABEL); | ||
708 | 291 | g_assert(label != NULL); | 286 | g_assert(label != NULL); |
710 | 292 | g_assert(g_strcmp0(label, "Test Label") == 0); | 287 | g_assert(g_strcmp0("Test Label", g_variant_get_string(label, NULL)) == 0); |
711 | 288 | |||
712 | 289 | g_variant_unref(label); | ||
713 | 290 | g_object_unref(model); | ||
714 | 293 | 291 | ||
715 | 294 | /* Interesting, eh? We need this because we send out events on the bus | 292 | /* Interesting, eh? We need this because we send out events on the bus |
716 | 295 | but they don't come back until the idle is run. So we need those | 293 | but they don't come back until the idle is run. So we need those |
717 | @@ -388,24 +386,15 @@ | |||
718 | 388 | 386 | ||
719 | 389 | app_indicator_build_menu_from_desktop(ci, SRCDIR "/test-libappindicator.desktop", "Test Program"); | 387 | app_indicator_build_menu_from_desktop(ci, SRCDIR "/test-libappindicator.desktop", "Test Program"); |
720 | 390 | 388 | ||
739 | 391 | GValue serverval = {0}; | 389 | GValue modelval = {0}; |
740 | 392 | g_value_init(&serverval, DBUSMENU_TYPE_SERVER); | 390 | g_value_init(&modelval, G_TYPE_MENU_MODEL); |
741 | 393 | g_object_get_property(G_OBJECT(ci), "dbus-menu-server", &serverval); | 391 | g_object_get_property(G_OBJECT(ci), "menu-model", &modelval); |
742 | 394 | 392 | ||
743 | 395 | DbusmenuServer * server = DBUSMENU_SERVER(g_value_get_object(&serverval)); | 393 | GMenuModel * model = G_MENU_MODEL(g_value_get_object(&modelval)); |
744 | 396 | g_assert(server != NULL); | 394 | g_assert(model != NULL); |
745 | 397 | 395 | ||
746 | 398 | GValue rootval = {0}; | 396 | g_assert(g_menu_model_get_n_items(model) == 3); |
747 | 399 | g_value_init(&rootval, DBUSMENU_TYPE_MENUITEM); | 397 | g_object_unref(model); |
730 | 400 | g_object_get_property(G_OBJECT(server), DBUSMENU_SERVER_PROP_ROOT_NODE, &rootval); | ||
731 | 401 | DbusmenuMenuitem * root = DBUSMENU_MENUITEM(g_value_get_object(&rootval)); | ||
732 | 402 | g_assert(root != NULL); | ||
733 | 403 | |||
734 | 404 | GList * children = dbusmenu_menuitem_get_children(root); | ||
735 | 405 | g_assert(children != NULL); | ||
736 | 406 | g_assert(g_list_length(children) == 3); | ||
737 | 407 | |||
738 | 408 | |||
748 | 409 | 398 | ||
749 | 410 | g_object_unref(G_OBJECT(ci)); | 399 | g_object_unref(G_OBJECT(ci)); |
750 | 411 | return; | 400 | return; |
751 | @@ -426,21 +415,12 @@ | |||
752 | 426 | 415 | ||
753 | 427 | app_indicator_build_menu_from_desktop(ci, SRCDIR "/test-libappindicator.desktop", "Not Test Program"); | 416 | app_indicator_build_menu_from_desktop(ci, SRCDIR "/test-libappindicator.desktop", "Not Test Program"); |
754 | 428 | 417 | ||
770 | 429 | GValue serverval = {0}; | 418 | GValue modelval = {0}; |
771 | 430 | g_value_init(&serverval, DBUSMENU_TYPE_SERVER); | 419 | g_value_init(&modelval, G_TYPE_MENU_MODEL); |
772 | 431 | g_object_get_property(G_OBJECT(ci), "dbus-menu-server", &serverval); | 420 | g_object_get_property(G_OBJECT(ci), "menu-model", &modelval); |
773 | 432 | 421 | ||
774 | 433 | DbusmenuServer * server = DBUSMENU_SERVER(g_value_get_object(&serverval)); | 422 | GMenuModel * model = G_MENU_MODEL(g_value_get_object(&modelval)); |
775 | 434 | g_assert(server != NULL); | 423 | g_assert(model == NULL); |
761 | 435 | |||
762 | 436 | GValue rootval = {0}; | ||
763 | 437 | g_value_init(&rootval, DBUSMENU_TYPE_MENUITEM); | ||
764 | 438 | g_object_get_property(G_OBJECT(server), DBUSMENU_SERVER_PROP_ROOT_NODE, &rootval); | ||
765 | 439 | DbusmenuMenuitem * root = DBUSMENU_MENUITEM(g_value_get_object(&rootval)); | ||
766 | 440 | g_assert(root != NULL); | ||
767 | 441 | |||
768 | 442 | GList * children = dbusmenu_menuitem_get_children(root); | ||
769 | 443 | g_assert(g_list_length(children) == 0); | ||
776 | 444 | 424 | ||
777 | 445 | g_object_unref(G_OBJECT(ci)); | 425 | g_object_unref(G_OBJECT(ci)); |
778 | 446 | return; | 426 | return; |
779 | 447 | 427 | ||
780 | === modified file 'tests/test-simple-app.c' | |||
781 | --- tests/test-simple-app.c 2013-01-16 19:53:52 +0000 | |||
782 | +++ tests/test-simple-app.c 2013-06-09 14:13:32 +0000 | |||
783 | @@ -20,10 +20,8 @@ | |||
784 | 20 | */ | 20 | */ |
785 | 21 | 21 | ||
786 | 22 | 22 | ||
787 | 23 | #include <dbus/dbus-glib.h> | ||
788 | 24 | #include <dbus/dbus-glib-lowlevel.h> | ||
789 | 25 | #include <glib.h> | 23 | #include <glib.h> |
791 | 26 | #include <libdbusmenu-glib/server.h> | 24 | #include <gio/gio.h> |
792 | 27 | #include <app-indicator.h> | 25 | #include <app-indicator.h> |
793 | 28 | 26 | ||
794 | 29 | static GMainLoop * mainloop = NULL; | 27 | static GMainLoop * mainloop = NULL; |
795 | @@ -31,15 +29,19 @@ | |||
796 | 31 | int | 29 | int |
797 | 32 | main (int argc, char ** argv) | 30 | main (int argc, char ** argv) |
798 | 33 | { | 31 | { |
802 | 34 | DbusmenuServer * dms = dbusmenu_server_new("/menu"); | 32 | GMenu * menu = g_menu_new(); |
803 | 35 | DbusmenuMenuitem * dmi = dbusmenu_menuitem_new(); | 33 | g_menu_append(menu, "Bob", "action"); |
804 | 36 | dbusmenu_menuitem_property_set(dmi, "label", "Bob"); | 34 | |
805 | 35 | GSimpleActionGroup * actions = g_simple_action_group_new(); | ||
806 | 36 | GSimpleAction * action = g_simple_action_new("action", NULL); | ||
807 | 37 | g_simple_action_group_insert(actions, G_ACTION(action)); | ||
808 | 37 | 38 | ||
809 | 38 | AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, | 39 | AppIndicator * ci = APP_INDICATOR(g_object_new(APP_INDICATOR_TYPE, |
810 | 39 | "id", "test-application", | 40 | "id", "test-application", |
811 | 40 | "status-enum", APP_INDICATOR_STATUS_ACTIVE, | 41 | "status-enum", APP_INDICATOR_STATUS_ACTIVE, |
812 | 41 | "icon-name", "system-shutdown", | 42 | "icon-name", "system-shutdown", |
814 | 42 | "menu-object", dms, | 43 | "menu-model", menu, |
815 | 44 | "action-group", actions, | ||
816 | 43 | NULL)); | 45 | NULL)); |
817 | 44 | 46 | ||
818 | 45 | mainloop = g_main_loop_new(NULL, FALSE); | 47 | mainloop = g_main_loop_new(NULL, FALSE); |
FAILED: Continuous integration, rev:277 jenkins. qa.ubuntu. com/job/ libappindicator -ci/8/ jenkins. qa.ubuntu. com/job/ libappindicator -raring- amd64-ci/ 9/console
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ libappindicator -ci/8/rebuild
http://