Merge lp:~dbarth/indicator-me/with-about-me into lp:indicator-me
- with-about-me
- Merge into trunk
Status: | Merged |
---|---|
Merge reported by: | David Barth |
Merged at revision: | not available |
Proposed branch: | lp:~dbarth/indicator-me/with-about-me |
Merge into: | lp:indicator-me |
Diff against target: |
685 lines (+440/-69) 7 files modified
src/Makefile.am (+2/-0) src/about-me-menu-item.c (+267/-0) src/about-me-menu-item.h (+65/-0) src/dbus-shared-names.h (+5/-2) src/entry-menu-item.c (+1/-1) src/indicator-me.c (+53/-31) src/me-service.c (+47/-35) |
To merge this branch: | bzr merge lp:~dbarth/indicator-me/with-about-me |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cody Russell (community) | Needs Fixing | ||
Review via email:
|
Commit message
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
David Barth (dbarth) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
David Barth (dbarth) wrote : | # |
The branch implements the proper layout for the entry, tests if gnome-about-me is installed or not, and makes the entry sensitive accordingly, calling the program on activation.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Cody Russell (bratsche) wrote : | # |
In get_pixels_
Small thing.. but in about_me_
And lastly, is there any chance at all I could convince you to have your text editor use spaces for indenting instead of tabs? The indentation looks really weird in the merge request and also in my emacs. :)
- 79. By David Barth
-
re-indent files properly
- 80. By David Barth
-
do g_return_
val_if_ fail in the right order; don't create a useless GtkObjectClass
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
David Barth (dbarth) wrote : | # |
re-pushed up to revision 80 with the 2 fixes and some re-indentation of the main source files
Preview Diff
1 | === modified file 'src/Makefile.am' | |||
2 | --- src/Makefile.am 2010-02-04 20:52:03 +0000 | |||
3 | +++ src/Makefile.am 2010-02-18 00:41:11 +0000 | |||
4 | @@ -8,6 +8,8 @@ | |||
5 | 8 | melibdir = $(INDICATORDIR) | 8 | melibdir = $(INDICATORDIR) |
6 | 9 | melib_LTLIBRARIES = libme.la | 9 | melib_LTLIBRARIES = libme.la |
7 | 10 | libme_la_SOURCES = \ | 10 | libme_la_SOURCES = \ |
8 | 11 | about-me-menu-item.c \ | ||
9 | 12 | about-me-menu-item.h \ | ||
10 | 11 | indicator-me.c \ | 13 | indicator-me.c \ |
11 | 12 | dbus-shared-names.h \ | 14 | dbus-shared-names.h \ |
12 | 13 | me-service-client.h | 15 | me-service-client.h |
13 | 14 | 16 | ||
14 | === added file 'src/about-me-menu-item.c' | |||
15 | --- src/about-me-menu-item.c 1970-01-01 00:00:00 +0000 | |||
16 | +++ src/about-me-menu-item.c 2010-02-18 00:41:11 +0000 | |||
17 | @@ -0,0 +1,267 @@ | |||
18 | 1 | /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */ | ||
19 | 2 | /* | ||
20 | 3 | * Copyright 2010 Canonical, Ltd. | ||
21 | 4 | * | ||
22 | 5 | * This program is free software: you can redistribute it and/or modify it | ||
23 | 6 | * under the terms of either or both of the following licenses: | ||
24 | 7 | * | ||
25 | 8 | * 1) the GNU Lesser General Public License version 3, as published by the | ||
26 | 9 | * Free Software Foundation; and/or | ||
27 | 10 | * 2) the GNU Lesser General Public License version 2.1, as published by | ||
28 | 11 | * the Free Software Foundation. | ||
29 | 12 | * | ||
30 | 13 | * This program is distributed in the hope that it will be useful, but | ||
31 | 14 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
32 | 15 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
33 | 16 | * PURPOSE. See the applicable version of the GNU Lesser General Public | ||
34 | 17 | * License for more details. | ||
35 | 18 | * | ||
36 | 19 | * You should have received a copy of both the GNU Lesser General Public | ||
37 | 20 | * License version 3 and version 2.1 along with this program. If not, see | ||
38 | 21 | * <http://www.gnu.org/licenses/> | ||
39 | 22 | * | ||
40 | 23 | * Authors: | ||
41 | 24 | * David Barth <david.barth@canonical.com> | ||
42 | 25 | * Cody Russell <crussell@canonical.com> | ||
43 | 26 | */ | ||
44 | 27 | |||
45 | 28 | #include <gtk/gtk.h> | ||
46 | 29 | #include "about-me-menu-item.h" | ||
47 | 30 | |||
48 | 31 | static GObject* about_me_menu_item_constructor (GType type, | ||
49 | 32 | guint n_construct_properties, | ||
50 | 33 | GObjectConstructParam *construct_params); | ||
51 | 34 | static void about_me_menu_item_set_property (GObject *object, | ||
52 | 35 | guint prop_id, | ||
53 | 36 | const GValue *value, | ||
54 | 37 | GParamSpec *pspec); | ||
55 | 38 | static void about_me_menu_item_get_property (GObject *object, | ||
56 | 39 | guint prop_id, | ||
57 | 40 | GValue *value, | ||
58 | 41 | GParamSpec *pspec); | ||
59 | 42 | |||
60 | 43 | struct _AboutMeMenuItemPrivate { | ||
61 | 44 | GtkWidget *label; | ||
62 | 45 | GtkWidget *image; | ||
63 | 46 | GtkWidget *hbox; | ||
64 | 47 | gchar *realname; | ||
65 | 48 | }; | ||
66 | 49 | |||
67 | 50 | enum { | ||
68 | 51 | PROP_0, | ||
69 | 52 | PROP_REALNAME | ||
70 | 53 | }; | ||
71 | 54 | |||
72 | 55 | G_DEFINE_TYPE (AboutMeMenuItem, about_me_menu_item, GTK_TYPE_MENU_ITEM) | ||
73 | 56 | |||
74 | 57 | #define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ABOUT_ME_TYPE_MENU_ITEM, AboutMeMenuItemPrivate)) | ||
75 | 58 | |||
76 | 59 | static void | ||
77 | 60 | about_me_menu_item_class_init (AboutMeMenuItemClass *item_class) | ||
78 | 61 | { | ||
79 | 62 | GObjectClass *gobject_class = G_OBJECT_CLASS (item_class); | ||
80 | 63 | |||
81 | 64 | gobject_class->constructor = about_me_menu_item_constructor; | ||
82 | 65 | gobject_class->set_property = about_me_menu_item_set_property; | ||
83 | 66 | gobject_class->get_property = about_me_menu_item_get_property; | ||
84 | 67 | |||
85 | 68 | g_object_class_install_property (gobject_class, | ||
86 | 69 | PROP_REALNAME, | ||
87 | 70 | g_param_spec_string ("realname", | ||
88 | 71 | "Realname", | ||
89 | 72 | "The \"Realname\" for the user", | ||
90 | 73 | NULL, | ||
91 | 74 | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); | ||
92 | 75 | |||
93 | 76 | g_type_class_add_private (gobject_class, sizeof (AboutMeMenuItemPrivate)); | ||
94 | 77 | } | ||
95 | 78 | |||
96 | 79 | static void | ||
97 | 80 | about_me_menu_item_init (AboutMeMenuItem *self) | ||
98 | 81 | { | ||
99 | 82 | AboutMeMenuItemPrivate *priv = GET_PRIVATE (self); | ||
100 | 83 | |||
101 | 84 | priv->label = NULL; | ||
102 | 85 | priv->image = NULL; | ||
103 | 86 | priv->realname = NULL; | ||
104 | 87 | } | ||
105 | 88 | |||
106 | 89 | static void | ||
107 | 90 | about_me_menu_item_set_property (GObject *object, | ||
108 | 91 | guint prop_id, | ||
109 | 92 | const GValue *value, | ||
110 | 93 | GParamSpec *pspec) | ||
111 | 94 | { | ||
112 | 95 | AboutMeMenuItem *menu_item = ABOUT_ME_MENU_ITEM (object); | ||
113 | 96 | AboutMeMenuItemPrivate *priv = GET_PRIVATE (menu_item); | ||
114 | 97 | |||
115 | 98 | switch (prop_id) | ||
116 | 99 | { | ||
117 | 100 | case PROP_REALNAME: | ||
118 | 101 | g_assert (priv->realname == NULL); | ||
119 | 102 | priv->realname = g_strdup (g_value_get_string (value)); | ||
120 | 103 | break; | ||
121 | 104 | |||
122 | 105 | default: | ||
123 | 106 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
124 | 107 | break; | ||
125 | 108 | } | ||
126 | 109 | } | ||
127 | 110 | |||
128 | 111 | static void | ||
129 | 112 | about_me_menu_item_get_property (GObject *object, | ||
130 | 113 | guint prop_id, | ||
131 | 114 | GValue *value, | ||
132 | 115 | GParamSpec *pspec) | ||
133 | 116 | { | ||
134 | 117 | AboutMeMenuItem *menu_item = ABOUT_ME_MENU_ITEM (object); | ||
135 | 118 | AboutMeMenuItemPrivate *priv = GET_PRIVATE (menu_item); | ||
136 | 119 | |||
137 | 120 | switch (prop_id) | ||
138 | 121 | { | ||
139 | 122 | case PROP_REALNAME: | ||
140 | 123 | g_value_set_string (value, priv->realname); | ||
141 | 124 | break; | ||
142 | 125 | |||
143 | 126 | default: | ||
144 | 127 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
145 | 128 | break; | ||
146 | 129 | } | ||
147 | 130 | } | ||
148 | 131 | |||
149 | 132 | #define DEFAULT_PIXELS_PER_EM 10.0f | ||
150 | 133 | |||
151 | 134 | static gdouble | ||
152 | 135 | get_pixels_per_em (GtkWidget *widget) | ||
153 | 136 | { | ||
154 | 137 | g_return_val_if_fail (GTK_IS_WIDGET (widget), DEFAULT_PIXELS_PER_EM); | ||
155 | 138 | |||
156 | 139 | /* Note: taken from indicator-session */ | ||
157 | 140 | GtkStyle * style = gtk_widget_get_style(widget); | ||
158 | 141 | |||
159 | 142 | PangoLayout * layout = pango_layout_new(gtk_widget_get_pango_context(widget)); | ||
160 | 143 | pango_layout_set_text(layout, "M", -1); | ||
161 | 144 | pango_layout_set_font_description(layout, style->font_desc); | ||
162 | 145 | |||
163 | 146 | gint width; | ||
164 | 147 | pango_layout_get_pixel_size(layout, &width, NULL); | ||
165 | 148 | |||
166 | 149 | gint point = pango_font_description_get_size(style->font_desc); | ||
167 | 150 | gdouble dpi = gdk_screen_get_resolution(gdk_screen_get_default()); | ||
168 | 151 | |||
169 | 152 | return ((point * dpi) / 72.0f) / PANGO_SCALE; | ||
170 | 153 | } | ||
171 | 154 | |||
172 | 155 | |||
173 | 156 | /* from n-osd */ | ||
174 | 157 | static GdkPixbuf* | ||
175 | 158 | load_icon (const gchar* filename, | ||
176 | 159 | gint icon_size) | ||
177 | 160 | { | ||
178 | 161 | GdkPixbuf* buffer = NULL; | ||
179 | 162 | GdkPixbuf* pixbuf = NULL; | ||
180 | 163 | GtkIconTheme* theme = NULL; | ||
181 | 164 | GError* error = NULL; | ||
182 | 165 | |||
183 | 166 | /* sanity check */ | ||
184 | 167 | g_return_val_if_fail (filename, NULL); | ||
185 | 168 | |||
186 | 169 | theme = gtk_icon_theme_get_default (); | ||
187 | 170 | buffer = gtk_icon_theme_load_icon (theme, | ||
188 | 171 | filename, | ||
189 | 172 | icon_size, | ||
190 | 173 | GTK_ICON_LOOKUP_FORCE_SVG | | ||
191 | 174 | GTK_ICON_LOOKUP_GENERIC_FALLBACK | | ||
192 | 175 | GTK_ICON_LOOKUP_FORCE_SIZE, | ||
193 | 176 | &error); | ||
194 | 177 | if (error) | ||
195 | 178 | { | ||
196 | 179 | g_print ("loading icon '%s' caused error: '%s'", | ||
197 | 180 | filename, | ||
198 | 181 | error->message); | ||
199 | 182 | g_error_free (error); | ||
200 | 183 | error = NULL; | ||
201 | 184 | pixbuf = NULL; | ||
202 | 185 | } | ||
203 | 186 | else | ||
204 | 187 | { | ||
205 | 188 | /* copy and unref buffer so on an icon-theme change old | ||
206 | 189 | ** icons are not kept in memory due to dangling | ||
207 | 190 | ** references, this also makes sure we do not need to | ||
208 | 191 | ** connect to GtkWidget::style-set signal for the | ||
209 | 192 | ** GdkPixbuf we get from gtk_icon_theme_load_icon() */ | ||
210 | 193 | pixbuf = gdk_pixbuf_copy (buffer); | ||
211 | 194 | g_object_unref (buffer); | ||
212 | 195 | } | ||
213 | 196 | |||
214 | 197 | return pixbuf; | ||
215 | 198 | } | ||
216 | 199 | |||
217 | 200 | static void | ||
218 | 201 | image_size_allocate (GtkWidget *widget, | ||
219 | 202 | GtkAllocation *allocation, | ||
220 | 203 | gpointer user_data) | ||
221 | 204 | { | ||
222 | 205 | gint max = MAX (allocation->width, allocation->height); | ||
223 | 206 | |||
224 | 207 | gtk_widget_set_size_request (widget, max, max); | ||
225 | 208 | } | ||
226 | 209 | |||
227 | 210 | static GObject* | ||
228 | 211 | about_me_menu_item_constructor (GType type, | ||
229 | 212 | guint n_construct_properties, | ||
230 | 213 | GObjectConstructParam *construct_params) | ||
231 | 214 | { | ||
232 | 215 | GObject *object; | ||
233 | 216 | GtkWidget *hbox; | ||
234 | 217 | GtkWidget *align; | ||
235 | 218 | AboutMeMenuItemPrivate *priv; | ||
236 | 219 | object = G_OBJECT_CLASS (about_me_menu_item_parent_class)->constructor (type, | ||
237 | 220 | n_construct_properties, | ||
238 | 221 | construct_params); | ||
239 | 222 | |||
240 | 223 | priv = GET_PRIVATE (object); | ||
241 | 224 | |||
242 | 225 | GtkWidget *frame = gtk_frame_new (NULL); | ||
243 | 226 | gdouble pixels_per_em = get_pixels_per_em (frame); | ||
244 | 227 | GdkPixbuf *pixbuf = load_icon ("stock_person", pixels_per_em * 3); | ||
245 | 228 | priv->image = gtk_image_new_from_pixbuf (pixbuf); | ||
246 | 229 | g_signal_connect (frame, "size-allocate", G_CALLBACK (image_size_allocate), NULL); | ||
247 | 230 | gint height, width; | ||
248 | 231 | gtk_widget_get_size_request (GTK_WIDGET (priv->image), &width, &height); | ||
249 | 232 | gtk_misc_set_padding (GTK_MISC (priv->image), 2, 2); | ||
250 | 233 | gtk_container_add (GTK_CONTAINER (frame), priv->image); | ||
251 | 234 | |||
252 | 235 | align = gtk_alignment_new (0, 0.3, 0, 0); | ||
253 | 236 | priv->label = gtk_label_new (priv->realname); | ||
254 | 237 | gtk_misc_set_padding (GTK_MISC (priv->label), 2, 2); | ||
255 | 238 | gtk_container_add (GTK_CONTAINER (align), priv->label); | ||
256 | 239 | |||
257 | 240 | hbox = gtk_hbox_new (FALSE, 0); | ||
258 | 241 | gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); | ||
259 | 242 | gtk_box_pack_start (GTK_BOX (hbox), align, TRUE, TRUE, DEFAULT_PIXELS_PER_EM); | ||
260 | 243 | |||
261 | 244 | gtk_container_add (GTK_CONTAINER (object), hbox); | ||
262 | 245 | gtk_widget_show_all (GTK_WIDGET(object)); | ||
263 | 246 | |||
264 | 247 | priv->hbox = hbox; | ||
265 | 248 | |||
266 | 249 | return object; | ||
267 | 250 | } | ||
268 | 251 | |||
269 | 252 | /** | ||
270 | 253 | * about_me_menu_item_new: | ||
271 | 254 | * @realname: the name to display in the new menu item. | ||
272 | 255 | * @returns: a new #AboutMeMenuItem. | ||
273 | 256 | * | ||
274 | 257 | * Creates a new #AboutMeMenuItem with a name. | ||
275 | 258 | **/ | ||
276 | 259 | GtkWidget* | ||
277 | 260 | about_me_menu_item_new (const gchar *realname) | ||
278 | 261 | { | ||
279 | 262 | return g_object_new (ABOUT_ME_TYPE_MENU_ITEM, | ||
280 | 263 | "realname", realname, | ||
281 | 264 | NULL); | ||
282 | 265 | } | ||
283 | 266 | |||
284 | 267 | #define __ABOUT_ME_MENU_ITEM_C__ | ||
285 | 0 | 268 | ||
286 | === added file 'src/about-me-menu-item.h' | |||
287 | --- src/about-me-menu-item.h 1970-01-01 00:00:00 +0000 | |||
288 | +++ src/about-me-menu-item.h 2010-02-18 00:41:11 +0000 | |||
289 | @@ -0,0 +1,65 @@ | |||
290 | 1 | /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */ | ||
291 | 2 | /* | ||
292 | 3 | * Copyright 2010 Canonical, Ltd. | ||
293 | 4 | * | ||
294 | 5 | * This program is free software: you can redistribute it and/or modify it | ||
295 | 6 | * under the terms of either or both of the following licenses: | ||
296 | 7 | * | ||
297 | 8 | * 1) the GNU Lesser General Public License version 3, as published by the | ||
298 | 9 | * Free Software Foundation; and/or | ||
299 | 10 | * 2) the GNU Lesser General Public License version 2.1, as published by | ||
300 | 11 | * the Free Software Foundation. | ||
301 | 12 | * | ||
302 | 13 | * This program is distributed in the hope that it will be useful, but | ||
303 | 14 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
304 | 15 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
305 | 16 | * PURPOSE. See the applicable version of the GNU Lesser General Public | ||
306 | 17 | * License for more details. | ||
307 | 18 | * | ||
308 | 19 | * You should have received a copy of both the GNU Lesser General Public | ||
309 | 20 | * License version 3 and version 2.1 along with this program. If not, see | ||
310 | 21 | * <http://www.gnu.org/licenses/> | ||
311 | 22 | * | ||
312 | 23 | * Authors: | ||
313 | 24 | * David Barth <david.barth@canonical.com> | ||
314 | 25 | * Cody Russell <crussell@canonical.com> | ||
315 | 26 | */ | ||
316 | 27 | |||
317 | 28 | #ifndef __ABOUT_ME_MENU_ITEM_H__ | ||
318 | 29 | #define __ABOUT_ME_MENU_ITEM_H__ | ||
319 | 30 | |||
320 | 31 | #include <gtk/gtkmenuitem.h> | ||
321 | 32 | |||
322 | 33 | G_BEGIN_DECLS | ||
323 | 34 | |||
324 | 35 | #define ABOUT_ME_TYPE_MENU_ITEM (about_me_menu_item_get_type ()) | ||
325 | 36 | #define ABOUT_ME_MENU_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ABOUT_ME_TYPE_MENU_ITEM, AboutMeMenuItem)) | ||
326 | 37 | #define ABOUT_ME_MENU_ITEM_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), ABOUT_ME_TYPE_MENU_ITEM, AboutMeMenuItemClass)) | ||
327 | 38 | #define ABOUT_IS_ME_MENU_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ABOUT_ME_TYPE_MENU_ITEM)) | ||
328 | 39 | #define ABOUT_IS_ME_MENU_ITEM_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), ABOUT_ME_TYPE_MENU_ITEM)) | ||
329 | 40 | #define ABOUT_ME_MENU_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ABOUT_ME_TYPE_MENU_ITEM, AboutMeMenuItemClass)) | ||
330 | 41 | |||
331 | 42 | |||
332 | 43 | typedef struct _AboutMeMenuItem AboutMeMenuItem; | ||
333 | 44 | typedef struct _AboutMeMenuItemClass AboutMeMenuItemClass; | ||
334 | 45 | typedef struct _AboutMeMenuItemPrivate AboutMeMenuItemPrivate; | ||
335 | 46 | |||
336 | 47 | struct _AboutMeMenuItem | ||
337 | 48 | { | ||
338 | 49 | GtkMenuItem parent_instance; | ||
339 | 50 | |||
340 | 51 | AboutMeMenuItemPrivate *priv; | ||
341 | 52 | }; | ||
342 | 53 | |||
343 | 54 | struct _AboutMeMenuItemClass | ||
344 | 55 | { | ||
345 | 56 | GtkMenuItemClass parent_class; | ||
346 | 57 | }; | ||
347 | 58 | |||
348 | 59 | |||
349 | 60 | GType about_me_menu_item_get_type (void) G_GNUC_CONST; | ||
350 | 61 | GtkWidget *about_me_menu_item_new (const gchar *name); | ||
351 | 62 | |||
352 | 63 | G_END_DECLS | ||
353 | 64 | |||
354 | 65 | #endif /* __ABOUT_ME_MENU_ITEM_H__ */ | ||
355 | 0 | 66 | ||
356 | === modified file 'src/dbus-shared-names.h' | |||
357 | --- src/dbus-shared-names.h 2010-02-04 20:52:03 +0000 | |||
358 | +++ src/dbus-shared-names.h 2010-02-18 00:41:11 +0000 | |||
359 | @@ -30,7 +30,10 @@ | |||
360 | 30 | #define INDICATOR_ME_SERVICE_DBUS_OBJECT "/org/ayatana/indicator/me/service" | 30 | #define INDICATOR_ME_SERVICE_DBUS_OBJECT "/org/ayatana/indicator/me/service" |
361 | 31 | #define INDICATOR_ME_SERVICE_DBUS_INTERFACE "org.ayatana.indicator.me.service" | 31 | #define INDICATOR_ME_SERVICE_DBUS_INTERFACE "org.ayatana.indicator.me.service" |
362 | 32 | 32 | ||
365 | 33 | #define ENTRY_MENUITEM_TYPE "x-canonical-entry-item" | 33 | #define DBUSMENU_ENTRY_MENUITEM_TYPE "x-canonical-entry-item" |
366 | 34 | #define ENTRY_MENUITEM_PROP_TEXT "text" | 34 | #define DBUSMENU_ENTRY_MENUITEM_PROP_TEXT "text" |
367 | 35 | |||
368 | 36 | #define DBUSMENU_ABOUT_ME_MENUITEM_TYPE "x-canonical-about-me-item" | ||
369 | 37 | #define DBUSMENU_ABOUT_ME_MENUITEM_PROP_NAME "name" | ||
370 | 35 | 38 | ||
371 | 36 | #endif /* __DBUS_SHARED_NAMES_H__ */ | 39 | #endif /* __DBUS_SHARED_NAMES_H__ */ |
372 | 37 | 40 | ||
373 | === modified file 'src/entry-menu-item.c' | |||
374 | --- src/entry-menu-item.c 2010-02-04 20:52:03 +0000 | |||
375 | +++ src/entry-menu-item.c 2010-02-18 00:41:11 +0000 | |||
376 | @@ -113,7 +113,7 @@ | |||
377 | 113 | EntryMenuItem * self = g_object_new(ENTRY_MENU_ITEM_TYPE, NULL); | 113 | EntryMenuItem * self = g_object_new(ENTRY_MENU_ITEM_TYPE, NULL); |
378 | 114 | /* EntryMenuItemPrivate * priv = ENTRY_MENU_ITEM_GET_PRIVATE(self); */ | 114 | /* EntryMenuItemPrivate * priv = ENTRY_MENU_ITEM_GET_PRIVATE(self); */ |
379 | 115 | 115 | ||
381 | 116 | dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, ENTRY_MENUITEM_TYPE); | 116 | dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_ENTRY_MENUITEM_TYPE); |
382 | 117 | 117 | ||
383 | 118 | return self; | 118 | return self; |
384 | 119 | } | 119 | } |
385 | 120 | 120 | ||
386 | === modified file 'src/indicator-me.c' | |||
387 | --- src/indicator-me.c 2010-02-05 00:43:12 +0000 | |||
388 | +++ src/indicator-me.c 2010-02-18 00:41:11 +0000 | |||
389 | @@ -1,23 +1,24 @@ | |||
390 | 1 | /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */ | ||
391 | 1 | /* | 2 | /* |
411 | 2 | A menu that should be close to the user, it's the user's status, | 3 | A menu that should be close to the user, it's the user's status, |
412 | 3 | their friends. All about them. It's a user-focused-menu. | 4 | their friends. All about them. It's a user-focused-menu. |
413 | 4 | 5 | ||
414 | 5 | Copyright 2009 Canonical Ltd. | 6 | Copyright 2009 Canonical Ltd. |
415 | 6 | 7 | ||
416 | 7 | Authors: | 8 | Authors: |
417 | 8 | Ted Gould <ted@canonical.com> | 9 | Ted Gould <ted@canonical.com> |
418 | 9 | 10 | ||
419 | 10 | This program is free software: you can redistribute it and/or modify it | 11 | This program is free software: you can redistribute it and/or modify it |
420 | 11 | under the terms of the GNU General Public License version 3, as published | 12 | under the terms of the GNU General Public License version 3, as published |
421 | 12 | by the Free Software Foundation. | 13 | by the Free Software Foundation. |
422 | 13 | 14 | ||
423 | 14 | This program is distributed in the hope that it will be useful, but | 15 | This program is distributed in the hope that it will be useful, but |
424 | 15 | WITHOUT ANY WARRANTY; without even the implied warranties of | 16 | WITHOUT ANY WARRANTY; without even the implied warranties of |
425 | 16 | MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | 17 | MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
426 | 17 | PURPOSE. See the GNU General Public License for more details. | 18 | PURPOSE. See the GNU General Public License for more details. |
427 | 18 | 19 | ||
428 | 19 | You should have received a copy of the GNU General Public License along | 20 | You should have received a copy of the GNU General Public License along |
429 | 20 | with this program. If not, see <http://www.gnu.org/licenses/>. | 21 | with this program. If not, see <http://www.gnu.org/licenses/>. |
430 | 21 | */ | 22 | */ |
431 | 22 | 23 | ||
432 | 23 | #include <glib.h> | 24 | #include <glib.h> |
433 | @@ -34,6 +35,8 @@ | |||
434 | 34 | #include <libindicator/indicator-service-manager.h> | 35 | #include <libindicator/indicator-service-manager.h> |
435 | 35 | #include <libido/idoentrymenuitem.h> | 36 | #include <libido/idoentrymenuitem.h> |
436 | 36 | 37 | ||
437 | 38 | #include "about-me-menu-item.h" | ||
438 | 39 | |||
439 | 37 | #include "dbus-shared-names.h" | 40 | #include "dbus-shared-names.h" |
440 | 38 | #include "me-service-client.h" | 41 | #include "me-service-client.h" |
441 | 39 | 42 | ||
442 | @@ -180,10 +183,10 @@ | |||
443 | 180 | DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); | 183 | DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); |
444 | 181 | 184 | ||
445 | 182 | status_proxy = dbus_g_proxy_new_for_name_owner(sbus, | 185 | status_proxy = dbus_g_proxy_new_for_name_owner(sbus, |
450 | 183 | INDICATOR_ME_DBUS_NAME, | 186 | INDICATOR_ME_DBUS_NAME, |
451 | 184 | INDICATOR_ME_SERVICE_DBUS_OBJECT, | 187 | INDICATOR_ME_SERVICE_DBUS_OBJECT, |
452 | 185 | INDICATOR_ME_SERVICE_DBUS_INTERFACE, | 188 | INDICATOR_ME_SERVICE_DBUS_INTERFACE, |
453 | 186 | &error); | 189 | &error); |
454 | 187 | 190 | ||
455 | 188 | if (error != NULL) { | 191 | if (error != NULL) { |
456 | 189 | g_warning("Unable to get status proxy: %s", error->message); | 192 | g_warning("Unable to get status proxy: %s", error->message); |
457 | @@ -206,13 +209,13 @@ | |||
458 | 206 | static void | 209 | static void |
459 | 207 | entry_prop_change_cb (DbusmenuMenuitem *mi, gchar *prop, GValue *value, GtkEntry *entry) | 210 | entry_prop_change_cb (DbusmenuMenuitem *mi, gchar *prop, GValue *value, GtkEntry *entry) |
460 | 208 | { | 211 | { |
462 | 209 | if (g_strcmp0 (prop, ENTRY_MENUITEM_PROP_TEXT) == 0) { | 212 | if (g_strcmp0 (prop, DBUSMENU_ENTRY_MENUITEM_PROP_TEXT) == 0) { |
463 | 210 | gtk_entry_set_text (entry, g_value_get_string (value)); | 213 | gtk_entry_set_text (entry, g_value_get_string (value)); |
464 | 211 | } | 214 | } |
465 | 212 | } | 215 | } |
466 | 213 | 216 | ||
467 | 214 | static void | 217 | static void |
469 | 215 | activate_cb (GtkEntry *entry, DbusmenuMenuitem *gmi) | 218 | entry_activate_cb (GtkEntry *entry, DbusmenuMenuitem *gmi) |
470 | 216 | { | 219 | { |
471 | 217 | GValue value = { 0 }; | 220 | GValue value = { 0 }; |
472 | 218 | g_value_init (&value, G_TYPE_STRING); | 221 | g_value_init (&value, G_TYPE_STRING); |
473 | @@ -225,8 +228,8 @@ | |||
474 | 225 | 228 | ||
475 | 226 | static gboolean | 229 | static gboolean |
476 | 227 | new_entry_item (DbusmenuMenuitem * newitem, | 230 | new_entry_item (DbusmenuMenuitem * newitem, |
479 | 228 | DbusmenuMenuitem * parent, | 231 | DbusmenuMenuitem * parent, |
480 | 229 | DbusmenuClient * client) | 232 | DbusmenuClient * client) |
481 | 230 | { | 233 | { |
482 | 231 | g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); | 234 | g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); |
483 | 232 | g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); | 235 | g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); |
484 | @@ -234,8 +237,9 @@ | |||
485 | 234 | 237 | ||
486 | 235 | IdoEntryMenuItem *ido = IDO_ENTRY_MENU_ITEM (ido_entry_menu_item_new ()); | 238 | IdoEntryMenuItem *ido = IDO_ENTRY_MENU_ITEM (ido_entry_menu_item_new ()); |
487 | 236 | GtkEntry *entry = GTK_ENTRY(ido_entry_menu_item_get_entry (ido)); | 239 | GtkEntry *entry = GTK_ENTRY(ido_entry_menu_item_get_entry (ido)); |
490 | 237 | if (dbusmenu_menuitem_property_get (newitem, ENTRY_MENUITEM_PROP_TEXT) != NULL) | 240 | if (dbusmenu_menuitem_property_get (newitem, DBUSMENU_ENTRY_MENUITEM_PROP_TEXT) != NULL) |
491 | 238 | gtk_entry_set_text(entry, dbusmenu_menuitem_property_get(newitem, ENTRY_MENUITEM_PROP_TEXT)); | 241 | gtk_entry_set_text(entry, dbusmenu_menuitem_property_get(newitem, DBUSMENU_ENTRY_MENUITEM_PROP_TEXT)); |
492 | 242 | gtk_entry_set_width_chars (entry, 23); /* set some nice aspect ratio for the menu */ | ||
493 | 239 | 243 | ||
494 | 240 | dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(ido), parent); | 244 | dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(ido), parent); |
495 | 241 | /* disconnect the activate signal that newitem_base connected with the wrong | 245 | /* disconnect the activate signal that newitem_base connected with the wrong |
496 | @@ -244,7 +248,24 @@ | |||
497 | 244 | g_signal_handler_disconnect(GTK_MENU_ITEM (ido), signal_id); | 248 | g_signal_handler_disconnect(GTK_MENU_ITEM (ido), signal_id); |
498 | 245 | 249 | ||
499 | 246 | g_signal_connect (DBUSMENU_MENUITEM (newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK (entry_prop_change_cb), entry); | 250 | g_signal_connect (DBUSMENU_MENUITEM (newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK (entry_prop_change_cb), entry); |
501 | 247 | g_signal_connect (GTK_ENTRY (entry), "activate", G_CALLBACK (activate_cb), newitem); | 251 | g_signal_connect (GTK_ENTRY (entry), "activate", G_CALLBACK (entry_activate_cb), newitem); |
502 | 252 | |||
503 | 253 | return TRUE; | ||
504 | 254 | } | ||
505 | 255 | |||
506 | 256 | static gboolean | ||
507 | 257 | new_about_me_item (DbusmenuMenuitem * newitem, | ||
508 | 258 | DbusmenuMenuitem * parent, | ||
509 | 259 | DbusmenuClient * client) | ||
510 | 260 | { | ||
511 | 261 | g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); | ||
512 | 262 | g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); | ||
513 | 263 | /* Note: not checking parent, it's reasonable for it to be NULL */ | ||
514 | 264 | |||
515 | 265 | const gchar *name = dbusmenu_menuitem_property_get (newitem, DBUSMENU_ABOUT_ME_MENUITEM_PROP_NAME); | ||
516 | 266 | AboutMeMenuItem *about = ABOUT_ME_MENU_ITEM (about_me_menu_item_new (name)); | ||
517 | 267 | |||
518 | 268 | dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(about), parent); | ||
519 | 248 | 269 | ||
520 | 249 | return TRUE; | 270 | return TRUE; |
521 | 250 | } | 271 | } |
522 | @@ -256,7 +277,8 @@ | |||
523 | 256 | DbusmenuGtkMenu *menu = dbusmenu_gtkmenu_new(INDICATOR_ME_DBUS_NAME, INDICATOR_ME_DBUS_OBJECT); | 277 | DbusmenuGtkMenu *menu = dbusmenu_gtkmenu_new(INDICATOR_ME_DBUS_NAME, INDICATOR_ME_DBUS_OBJECT); |
524 | 257 | DbusmenuGtkClient * client = dbusmenu_gtkmenu_get_client(menu); | 278 | DbusmenuGtkClient * client = dbusmenu_gtkmenu_get_client(menu); |
525 | 258 | 279 | ||
527 | 259 | dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), ENTRY_MENUITEM_TYPE, new_entry_item); | 280 | dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_ENTRY_MENUITEM_TYPE, new_entry_item); |
528 | 281 | dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_ABOUT_ME_MENUITEM_TYPE, new_about_me_item); | ||
529 | 260 | 282 | ||
530 | 261 | return GTK_MENU (menu); | 283 | return GTK_MENU (menu); |
531 | 262 | } | 284 | } |
532 | 263 | 285 | ||
533 | === modified file 'src/me-service.c' | |||
534 | --- src/me-service.c 2010-02-05 20:44:54 +0000 | |||
535 | +++ src/me-service.c 2010-02-18 00:41:11 +0000 | |||
536 | @@ -1,23 +1,24 @@ | |||
537 | 1 | /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */ | ||
538 | 1 | /* | 2 | /* |
558 | 2 | A small wrapper utility to load indicators and put them as menu items | 3 | A small wrapper utility to load indicators and put them as menu items |
559 | 3 | into the gnome-panel using it's applet interface. | 4 | into the gnome-panel using it's applet interface. |
560 | 4 | 5 | ||
561 | 5 | Copyright 2009 Canonical Ltd. | 6 | Copyright 2009 Canonical Ltd. |
562 | 6 | 7 | ||
563 | 7 | Authors: | 8 | Authors: |
564 | 8 | Ted Gould <ted@canonical.com> | 9 | Ted Gould <ted@canonical.com> |
565 | 9 | 10 | ||
566 | 10 | This program is free software: you can redistribute it and/or modify it | 11 | This program is free software: you can redistribute it and/or modify it |
567 | 11 | under the terms of the GNU General Public License version 3, as published | 12 | under the terms of the GNU General Public License version 3, as published |
568 | 12 | by the Free Software Foundation. | 13 | by the Free Software Foundation. |
569 | 13 | 14 | ||
570 | 14 | This program is distributed in the hope that it will be useful, but | 15 | This program is distributed in the hope that it will be useful, but |
571 | 15 | WITHOUT ANY WARRANTY; without even the implied warranties of | 16 | WITHOUT ANY WARRANTY; without even the implied warranties of |
572 | 16 | MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | 17 | MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
573 | 17 | PURPOSE. See the GNU General Public License for more details. | 18 | PURPOSE. See the GNU General Public License for more details. |
574 | 18 | 19 | ||
575 | 19 | You should have received a copy of the GNU General Public License along | 20 | You should have received a copy of the GNU General Public License along |
576 | 20 | with this program. If not, see <http://www.gnu.org/licenses/>. | 21 | with this program. If not, see <http://www.gnu.org/licenses/>. |
577 | 21 | */ | 22 | */ |
578 | 22 | 23 | ||
579 | 23 | #include <config.h> | 24 | #include <config.h> |
580 | @@ -142,7 +143,7 @@ | |||
581 | 142 | } | 143 | } |
582 | 143 | 144 | ||
583 | 144 | static void | 145 | static void |
585 | 145 | accounts_click (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data) | 146 | spawn_on_activate_cb (DbusmenuMenuitem *mi, guint timestamp, gpointer user_data) |
586 | 146 | { | 147 | { |
587 | 147 | GError * error = NULL; | 148 | GError * error = NULL; |
588 | 148 | 149 | ||
589 | @@ -161,24 +162,24 @@ | |||
590 | 161 | /* FIXME: find cmd line parameters with ken-vandine */ | 162 | /* FIXME: find cmd line parameters with ken-vandine */ |
591 | 162 | DbusmenuMenuitem *im_accounts_mi = dbusmenu_menuitem_new(); | 163 | DbusmenuMenuitem *im_accounts_mi = dbusmenu_menuitem_new(); |
592 | 163 | dbusmenu_menuitem_property_set(im_accounts_mi, DBUSMENU_MENUITEM_PROP_LABEL, | 164 | dbusmenu_menuitem_property_set(im_accounts_mi, DBUSMENU_MENUITEM_PROP_LABEL, |
594 | 164 | _("Chat Accounts...")); | 165 | _("Chat Accounts...")); |
595 | 165 | dbusmenu_menuitem_child_append(root, im_accounts_mi); | 166 | dbusmenu_menuitem_child_append(root, im_accounts_mi); |
596 | 166 | g_signal_connect(G_OBJECT(im_accounts_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, | 167 | g_signal_connect(G_OBJECT(im_accounts_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, |
598 | 167 | G_CALLBACK(accounts_click), "empathy -a"); | 168 | G_CALLBACK(spawn_on_activate_cb), "empathy -a"); |
599 | 168 | 169 | ||
600 | 169 | DbusmenuMenuitem *tw_accounts_mi = dbusmenu_menuitem_new(); | 170 | DbusmenuMenuitem *tw_accounts_mi = dbusmenu_menuitem_new(); |
601 | 170 | dbusmenu_menuitem_property_set(tw_accounts_mi, DBUSMENU_MENUITEM_PROP_LABEL, | 171 | dbusmenu_menuitem_property_set(tw_accounts_mi, DBUSMENU_MENUITEM_PROP_LABEL, |
603 | 171 | _("Broadcast Accounts...")); | 172 | _("Broadcast Accounts...")); |
604 | 172 | dbusmenu_menuitem_child_append(root, tw_accounts_mi); | 173 | dbusmenu_menuitem_child_append(root, tw_accounts_mi); |
605 | 173 | g_signal_connect(G_OBJECT(tw_accounts_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, | 174 | g_signal_connect(G_OBJECT(tw_accounts_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, |
607 | 174 | G_CALLBACK(accounts_click), "gwibber-accounts"); | 175 | G_CALLBACK(spawn_on_activate_cb), "gwibber-accounts"); |
608 | 175 | 176 | ||
609 | 176 | DbusmenuMenuitem *u1_accounts_mi = dbusmenu_menuitem_new(); | 177 | DbusmenuMenuitem *u1_accounts_mi = dbusmenu_menuitem_new(); |
610 | 177 | dbusmenu_menuitem_property_set(u1_accounts_mi, DBUSMENU_MENUITEM_PROP_LABEL, | 178 | dbusmenu_menuitem_property_set(u1_accounts_mi, DBUSMENU_MENUITEM_PROP_LABEL, |
612 | 178 | _("Ubuntu One...")); | 179 | _("Ubuntu One...")); |
613 | 179 | dbusmenu_menuitem_child_append(root, u1_accounts_mi); | 180 | dbusmenu_menuitem_child_append(root, u1_accounts_mi); |
614 | 180 | g_signal_connect(G_OBJECT(u1_accounts_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, | 181 | g_signal_connect(G_OBJECT(u1_accounts_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, |
616 | 181 | G_CALLBACK(accounts_click), "ubuntuone-client-preferences"); | 182 | G_CALLBACK(spawn_on_activate_cb), "ubuntuone-client-preferences"); |
617 | 182 | 183 | ||
618 | 183 | } | 184 | } |
619 | 184 | 185 | ||
620 | @@ -214,12 +215,23 @@ | |||
621 | 214 | 215 | ||
622 | 215 | if (name[0] != '\0') { | 216 | if (name[0] != '\0') { |
623 | 216 | DbusmenuMenuitem * useritem = dbusmenu_menuitem_new(); | 217 | DbusmenuMenuitem * useritem = dbusmenu_menuitem_new(); |
625 | 217 | dbusmenu_menuitem_property_set(useritem, DBUSMENU_MENUITEM_PROP_LABEL, name); | 218 | dbusmenu_menuitem_property_set(useritem, DBUSMENU_ABOUT_ME_MENUITEM_PROP_NAME, name); |
626 | 218 | dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); | 219 | dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); |
627 | 220 | dbusmenu_menuitem_property_set(useritem, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_ABOUT_ME_MENUITEM_TYPE); | ||
628 | 219 | dbusmenu_menuitem_child_append(root, useritem); | 221 | dbusmenu_menuitem_child_append(root, useritem); |
629 | 222 | |||
630 | 223 | gchar *gam = g_find_program_in_path("gnome-about-me"); | ||
631 | 224 | if (gam != NULL) { | ||
632 | 225 | dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); | ||
633 | 226 | g_free(gam); | ||
634 | 227 | } | ||
635 | 228 | |||
636 | 229 | g_signal_connect(G_OBJECT(useritem), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, | ||
637 | 230 | G_CALLBACK(spawn_on_activate_cb), "gnome-about-me"); | ||
638 | 220 | } | 231 | } |
639 | 221 | 232 | ||
640 | 222 | g_free(name); | 233 | g_free(name); |
641 | 234 | |||
642 | 223 | } else { | 235 | } else { |
643 | 224 | g_debug("PWD: %s", (pwd == NULL ? "(pwd null)" : (pwd->pw_gecos == NULL ? "(gecos null)" : pwd->pw_gecos))); | 236 | g_debug("PWD: %s", (pwd == NULL ? "(pwd null)" : (pwd->pw_gecos == NULL ? "(gecos null)" : pwd->pw_gecos))); |
644 | 225 | } | 237 | } |
645 | @@ -262,7 +274,7 @@ | |||
646 | 262 | 274 | ||
647 | 263 | DbusmenuMenuitem *separator = dbusmenu_menuitem_new(); | 275 | DbusmenuMenuitem *separator = dbusmenu_menuitem_new(); |
648 | 264 | dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, | 276 | dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, |
650 | 265 | DBUSMENU_CLIENT_TYPES_SEPARATOR); | 277 | DBUSMENU_CLIENT_TYPES_SEPARATOR); |
651 | 266 | dbusmenu_menuitem_child_append(root, separator); | 278 | dbusmenu_menuitem_child_append(root, separator); |
652 | 267 | 279 | ||
653 | 268 | build_accounts_menuitems(root); | 280 | build_accounts_menuitems(root); |
654 | @@ -281,7 +293,7 @@ | |||
655 | 281 | int | 293 | int |
656 | 282 | main (int argc, char ** argv) | 294 | main (int argc, char ** argv) |
657 | 283 | { | 295 | { |
659 | 284 | g_type_init(); | 296 | g_type_init(); |
660 | 285 | 297 | ||
661 | 286 | /* Setting up i18n and gettext. Apparently, we need | 298 | /* Setting up i18n and gettext. Apparently, we need |
662 | 287 | all of these. */ | 299 | all of these. */ |
663 | @@ -294,17 +306,17 @@ | |||
664 | 294 | 306 | ||
665 | 295 | g_idle_add(build_providers, NULL); | 307 | g_idle_add(build_providers, NULL); |
666 | 296 | 308 | ||
670 | 297 | root_menuitem = dbusmenu_menuitem_new(); | 309 | root_menuitem = dbusmenu_menuitem_new(); |
671 | 298 | DbusmenuServer * server = dbusmenu_server_new(INDICATOR_ME_DBUS_OBJECT); | 310 | DbusmenuServer * server = dbusmenu_server_new(INDICATOR_ME_DBUS_OBJECT); |
672 | 299 | dbusmenu_server_set_root(server, root_menuitem); | 311 | dbusmenu_server_set_root(server, root_menuitem); |
673 | 300 | 312 | ||
674 | 301 | g_idle_add(build_menu, root_menuitem); | 313 | g_idle_add(build_menu, root_menuitem); |
675 | 302 | 314 | ||
676 | 303 | dbus_interface = g_object_new(STATUS_SERVICE_DBUS_TYPE, NULL); | 315 | dbus_interface = g_object_new(STATUS_SERVICE_DBUS_TYPE, NULL); |
677 | 304 | 316 | ||
680 | 305 | mainloop = g_main_loop_new(NULL, FALSE); | 317 | mainloop = g_main_loop_new(NULL, FALSE); |
681 | 306 | g_main_loop_run(mainloop); | 318 | g_main_loop_run(mainloop); |
682 | 307 | 319 | ||
684 | 308 | return 0; | 320 | return 0; |
685 | 309 | } | 321 | } |
686 | 310 | 322 |
Adds the "me item" at the top of the menu. See https:/ /wiki.ubuntu. com/MeMenu# Me item
Doesn't support line wrapping or taking the user avatar yet.