Merge lp:~ken-vandine/indicator-me/remove_about_me into lp:indicator-me

Proposed by Ken VanDine
Status: Merged
Approved by: Ted Gould
Approved revision: 151
Merged at revision: 151
Proposed branch: lp:~ken-vandine/indicator-me/remove_about_me
Merge into: lp:indicator-me
Diff against target: 603 lines (+0/-501)
6 files modified
src/Makefile.am (+0/-2)
src/about-me-menu-item.c (+0/-313)
src/about-me-menu-item.h (+0/-66)
src/dbus-shared-names.h (+0/-1)
src/indicator-me.c (+0/-48)
src/me-service.c (+0/-71)
To merge this branch: bzr merge lp:~ken-vandine/indicator-me/remove_about_me
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+66023@code.launchpad.net

Description of the change

Removed the about me menu, it doesn't exist in oneiric.

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2011-02-17 15:58:10 +0000
+++ src/Makefile.am 2011-06-27 16:40:07 +0000
@@ -8,8 +8,6 @@
8melibdir = $(INDICATORDIR)8melibdir = $(INDICATORDIR)
9melib_LTLIBRARIES = libme.la9melib_LTLIBRARIES = libme.la
10libme_la_SOURCES = \10libme_la_SOURCES = \
11 about-me-menu-item.c \
12 about-me-menu-item.h \
13 indicator-me.c \11 indicator-me.c \
14 dbus-shared-names.h \12 dbus-shared-names.h \
15 gen-me-service.xml.h \13 gen-me-service.xml.h \
1614
=== removed file 'src/about-me-menu-item.c'
--- src/about-me-menu-item.c 2010-04-14 14:52:10 +0000
+++ src/about-me-menu-item.c 1970-01-01 00:00:00 +0000
@@ -1,313 +0,0 @@
1/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
2/*
3 * Copyright 2010 Canonical, Ltd.
4 *
5 * This program is free software: you can redistribute it and/or modify it
6 * under the terms of either or both of the following licenses:
7 *
8 * 1) the GNU Lesser General Public License version 3, as published by the
9 * Free Software Foundation; and/or
10 * 2) the GNU Lesser General Public License version 2.1, as published by
11 * the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranties of
15 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
16 * PURPOSE. See the applicable version of the GNU Lesser General Public
17 * License for more details.
18 *
19 * You should have received a copy of both the GNU Lesser General Public
20 * License version 3 and version 2.1 along with this program. If not, see
21 * <http://www.gnu.org/licenses/>
22 *
23 * Authors:
24 * David Barth <david.barth@canonical.com>
25 * Cody Russell <crussell@canonical.com>
26 */
27
28#include <sys/types.h>
29#include <sys/stat.h>
30#include <unistd.h>
31
32#include <glib/gstdio.h>
33
34#include <gtk/gtk.h>
35#include "about-me-menu-item.h"
36
37static GObject* about_me_menu_item_constructor (GType type,
38 guint n_construct_properties,
39 GObjectConstructParam *construct_params);
40static void about_me_menu_item_set_property (GObject *object,
41 guint prop_id,
42 const GValue *value,
43 GParamSpec *pspec);
44static void about_me_menu_item_get_property (GObject *object,
45 guint prop_id,
46 GValue *value,
47 GParamSpec *pspec);
48
49struct _AboutMeMenuItemPrivate {
50 GtkWidget *label;
51 GtkWidget *image;
52 GtkWidget *hbox;
53 gchar *realname;
54};
55
56enum {
57 PROP_0,
58 PROP_REALNAME
59};
60
61G_DEFINE_TYPE (AboutMeMenuItem, about_me_menu_item, GTK_TYPE_MENU_ITEM)
62
63#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ABOUT_ME_TYPE_MENU_ITEM, AboutMeMenuItemPrivate))
64
65static void
66about_me_menu_item_class_init (AboutMeMenuItemClass *item_class)
67{
68 GObjectClass *gobject_class = G_OBJECT_CLASS (item_class);
69
70 gobject_class->constructor = about_me_menu_item_constructor;
71 gobject_class->set_property = about_me_menu_item_set_property;
72 gobject_class->get_property = about_me_menu_item_get_property;
73
74 g_object_class_install_property (gobject_class,
75 PROP_REALNAME,
76 g_param_spec_string ("realname",
77 "Realname",
78 "The \"Realname\" for the user",
79 NULL,
80 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
81
82 g_type_class_add_private (gobject_class, sizeof (AboutMeMenuItemPrivate));
83}
84
85static void
86about_me_menu_item_init (AboutMeMenuItem *self)
87{
88 AboutMeMenuItemPrivate *priv = GET_PRIVATE (self);
89
90 priv->label = NULL;
91 priv->image = NULL;
92 priv->realname = NULL;
93}
94
95static void
96about_me_menu_item_set_property (GObject *object,
97 guint prop_id,
98 const GValue *value,
99 GParamSpec *pspec)
100{
101 AboutMeMenuItem *menu_item = ABOUT_ME_MENU_ITEM (object);
102 AboutMeMenuItemPrivate *priv = GET_PRIVATE (menu_item);
103
104 switch (prop_id)
105 {
106 case PROP_REALNAME:
107 g_assert (priv->realname == NULL);
108 priv->realname = g_strdup (g_value_get_string (value));
109 break;
110
111 default:
112 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
113 break;
114 }
115}
116
117static void
118about_me_menu_item_get_property (GObject *object,
119 guint prop_id,
120 GValue *value,
121 GParamSpec *pspec)
122{
123 AboutMeMenuItem *menu_item = ABOUT_ME_MENU_ITEM (object);
124 AboutMeMenuItemPrivate *priv = GET_PRIVATE (menu_item);
125
126 switch (prop_id)
127 {
128 case PROP_REALNAME:
129 g_value_set_string (value, priv->realname);
130 break;
131
132 default:
133 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
134 break;
135 }
136}
137
138#define DEFAULT_PIXELS_PER_EM 10.0f
139
140static gdouble
141get_pixels_per_em (GtkWidget *widget)
142{
143 g_return_val_if_fail (GTK_IS_WIDGET (widget), DEFAULT_PIXELS_PER_EM);
144
145 /* Note: taken from indicator-session */
146 GtkStyle * style = gtk_widget_get_style(widget);
147
148 PangoLayout * layout = pango_layout_new(gtk_widget_get_pango_context(widget));
149 pango_layout_set_text(layout, "M", -1);
150 pango_layout_set_font_description(layout, style->font_desc);
151
152 gint width;
153 pango_layout_get_pixel_size(layout, &width, NULL);
154
155 gint point = pango_font_description_get_size(style->font_desc);
156 gdouble dpi = gdk_screen_get_resolution(gdk_screen_get_default());
157
158 return ((point * dpi) / 72.0f) / PANGO_SCALE;
159}
160
161
162/* from n-osd */
163static GdkPixbuf*
164load_icon (const gchar* filename,
165 gint icon_size)
166{
167 GdkPixbuf* buffer = NULL;
168 GdkPixbuf* pixbuf = NULL;
169 GtkIconTheme* theme = NULL;
170 GError* error = NULL;
171
172 /* sanity check */
173 g_return_val_if_fail (filename, NULL);
174
175 theme = gtk_icon_theme_get_default ();
176 buffer = gtk_icon_theme_load_icon (theme,
177 filename,
178 icon_size,
179 GTK_ICON_LOOKUP_FORCE_SVG |
180 GTK_ICON_LOOKUP_GENERIC_FALLBACK |
181 GTK_ICON_LOOKUP_FORCE_SIZE,
182 &error);
183 if (error)
184 {
185 g_print ("loading icon '%s' caused error: '%s'",
186 filename,
187 error->message);
188 g_error_free (error);
189 error = NULL;
190 pixbuf = NULL;
191 }
192 else
193 {
194 /* copy and unref buffer so on an icon-theme change old
195 ** icons are not kept in memory due to dangling
196 ** references, this also makes sure we do not need to
197 ** connect to GtkWidget::style-set signal for the
198 ** GdkPixbuf we get from gtk_icon_theme_load_icon() */
199 pixbuf = gdk_pixbuf_copy (buffer);
200 g_object_unref (buffer);
201 }
202
203 return pixbuf;
204}
205
206gboolean
207about_me_menu_item_load_avatar (AboutMeMenuItem *self, const gchar *file)
208{
209 g_return_val_if_fail (ABOUT_IS_ME_MENU_ITEM (self), FALSE);
210
211 AboutMeMenuItemPrivate *priv = GET_PRIVATE (self);
212
213 g_debug ("loading avatar from file %s", file);
214
215 struct stat buf;
216 if (! (g_stat (file, &buf) == 0 && buf.st_size > 0)) {
217 g_warning ("%s: not found or empty", file);
218 return FALSE;
219 }
220
221 if (buf.st_size > 1024*1024) {
222 g_warning ("avatar file too large (%lld)", (long long)buf.st_size);
223 return FALSE;
224 }
225
226 GError *error = NULL;
227 int size = get_pixels_per_em (priv->image) * 3;
228
229 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_scale (file, -1, size, TRUE,
230 &error);
231 if (pixbuf == NULL) {
232 if (error != NULL) {
233 g_warning ("Couldn't read file %s: %s", file, error->message);
234 g_error_free (error);
235 }
236 return FALSE;
237 }
238
239 gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf);
240
241 g_object_unref (pixbuf);
242
243 return TRUE;
244}
245
246static void
247image_size_allocate (GtkWidget *widget,
248 GtkAllocation *allocation,
249 gpointer user_data)
250{
251 gint max = MAX (allocation->width, allocation->height);
252
253 gtk_widget_set_size_request (widget, max, max);
254}
255
256static GObject*
257about_me_menu_item_constructor (GType type,
258 guint n_construct_properties,
259 GObjectConstructParam *construct_params)
260{
261 GObject *object;
262 GtkWidget *hbox;
263 GtkWidget *align;
264 AboutMeMenuItemPrivate *priv;
265 object = G_OBJECT_CLASS (about_me_menu_item_parent_class)->constructor (type,
266 n_construct_properties,
267 construct_params);
268
269 priv = GET_PRIVATE (object);
270
271 GtkWidget *frame = gtk_frame_new (NULL);
272 gdouble pixels_per_em = get_pixels_per_em (frame);
273 GdkPixbuf *pixbuf = load_icon ("stock_person-panel", pixels_per_em * 3);
274 if (pixbuf == NULL)
275 pixbuf = load_icon ("stock_person", pixels_per_em * 3);
276 priv->image = gtk_image_new_from_pixbuf (pixbuf);
277 g_signal_connect (frame, "size-allocate", G_CALLBACK (image_size_allocate), NULL);
278 gtk_misc_set_padding (GTK_MISC (priv->image), 2, 2);
279 gtk_container_add (GTK_CONTAINER (frame), priv->image);
280
281 align = gtk_alignment_new (0, 0.3, 0, 0);
282 priv->label = gtk_label_new (priv->realname);
283 gtk_misc_set_padding (GTK_MISC (priv->label), 2, 2);
284 gtk_container_add (GTK_CONTAINER (align), priv->label);
285
286 hbox = gtk_hbox_new (FALSE, 0);
287 gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
288 gtk_box_pack_start (GTK_BOX (hbox), align, TRUE, TRUE, DEFAULT_PIXELS_PER_EM);
289
290 gtk_container_add (GTK_CONTAINER (object), hbox);
291 gtk_widget_show_all (GTK_WIDGET(object));
292
293 priv->hbox = hbox;
294
295 return object;
296}
297
298/**
299 * about_me_menu_item_new:
300 * @realname: the name to display in the new menu item.
301 * @returns: a new #AboutMeMenuItem.
302 *
303 * Creates a new #AboutMeMenuItem with a name.
304 **/
305GtkWidget*
306about_me_menu_item_new (const gchar *realname)
307{
308 return g_object_new (ABOUT_ME_TYPE_MENU_ITEM,
309 "realname", realname,
310 NULL);
311}
312
313#define __ABOUT_ME_MENU_ITEM_C__
3140
=== removed file 'src/about-me-menu-item.h'
--- src/about-me-menu-item.h 2011-06-22 18:29:03 +0000
+++ src/about-me-menu-item.h 1970-01-01 00:00:00 +0000
@@ -1,66 +0,0 @@
1/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
2/*
3 * Copyright 2010 Canonical, Ltd.
4 *
5 * This program is free software: you can redistribute it and/or modify it
6 * under the terms of either or both of the following licenses:
7 *
8 * 1) the GNU Lesser General Public License version 3, as published by the
9 * Free Software Foundation; and/or
10 * 2) the GNU Lesser General Public License version 2.1, as published by
11 * the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranties of
15 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
16 * PURPOSE. See the applicable version of the GNU Lesser General Public
17 * License for more details.
18 *
19 * You should have received a copy of both the GNU Lesser General Public
20 * License version 3 and version 2.1 along with this program. If not, see
21 * <http://www.gnu.org/licenses/>
22 *
23 * Authors:
24 * David Barth <david.barth@canonical.com>
25 * Cody Russell <crussell@canonical.com>
26 */
27
28#ifndef __ABOUT_ME_MENU_ITEM_H__
29#define __ABOUT_ME_MENU_ITEM_H__
30
31#include <gtk/gtk.h>
32
33G_BEGIN_DECLS
34
35#define ABOUT_ME_TYPE_MENU_ITEM (about_me_menu_item_get_type ())
36#define ABOUT_ME_MENU_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ABOUT_ME_TYPE_MENU_ITEM, AboutMeMenuItem))
37#define ABOUT_ME_MENU_ITEM_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), ABOUT_ME_TYPE_MENU_ITEM, AboutMeMenuItemClass))
38#define ABOUT_IS_ME_MENU_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ABOUT_ME_TYPE_MENU_ITEM))
39#define ABOUT_IS_ME_MENU_ITEM_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), ABOUT_ME_TYPE_MENU_ITEM))
40#define ABOUT_ME_MENU_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ABOUT_ME_TYPE_MENU_ITEM, AboutMeMenuItemClass))
41
42
43typedef struct _AboutMeMenuItem AboutMeMenuItem;
44typedef struct _AboutMeMenuItemClass AboutMeMenuItemClass;
45typedef struct _AboutMeMenuItemPrivate AboutMeMenuItemPrivate;
46
47struct _AboutMeMenuItem
48{
49 GtkMenuItem parent_instance;
50
51 AboutMeMenuItemPrivate *priv;
52};
53
54struct _AboutMeMenuItemClass
55{
56 GtkMenuItemClass parent_class;
57};
58
59
60GType about_me_menu_item_get_type (void) G_GNUC_CONST;
61GtkWidget *about_me_menu_item_new (const gchar *name);
62gboolean about_me_menu_item_load_avatar (AboutMeMenuItem *self, const gchar *file);
63
64G_END_DECLS
65
66#endif /* __ABOUT_ME_MENU_ITEM_H__ */
670
=== modified file 'src/dbus-shared-names.h'
--- src/dbus-shared-names.h 2011-01-14 21:30:09 +0000
+++ src/dbus-shared-names.h 2011-06-27 16:40:07 +0000
@@ -34,7 +34,6 @@
34#define DBUSMENU_ENTRY_MENUITEM_PROP_TEXT "text"34#define DBUSMENU_ENTRY_MENUITEM_PROP_TEXT "text"
35#define DBUSMENU_ENTRY_MENUITEM_PROP_HINT "hint"35#define DBUSMENU_ENTRY_MENUITEM_PROP_HINT "hint"
3636
37#define DBUSMENU_ABOUT_ME_MENUITEM_TYPE "x-canonical-about-me-item"
38#define DBUSMENU_ABOUT_ME_MENUITEM_PROP_NAME "name"37#define DBUSMENU_ABOUT_ME_MENUITEM_PROP_NAME "name"
39#define DBUSMENU_ABOUT_ME_MENUITEM_PROP_ICON "icon"38#define DBUSMENU_ABOUT_ME_MENUITEM_PROP_ICON "icon"
4039
4140
=== modified file 'src/indicator-me.c'
--- src/indicator-me.c 2011-06-22 18:29:03 +0000
+++ src/indicator-me.c 2011-06-27 16:40:07 +0000
@@ -41,8 +41,6 @@
41#include <libindicator/indicator-image-helper.h>41#include <libindicator/indicator-image-helper.h>
42#include <libido/idoentrymenuitem.h>42#include <libido/idoentrymenuitem.h>
4343
44#include "about-me-menu-item.h"
45
46#include "dbus-shared-names.h"44#include "dbus-shared-names.h"
47#include "gen-me-service.xml.h"45#include "gen-me-service.xml.h"
4846
@@ -101,10 +99,6 @@
101 DbusmenuMenuitem * parent,99 DbusmenuMenuitem * parent,
102 DbusmenuClient * client,100 DbusmenuClient * client,
103 gpointer user_data);101 gpointer user_data);
104static gboolean new_about_me_item (DbusmenuMenuitem * newitem,
105 DbusmenuMenuitem * parent,
106 DbusmenuClient * client,
107 gpointer user_data);
108static void entry_activate_cb (GtkEntry *entry, DbusmenuMenuitem *mi);102static void entry_activate_cb (GtkEntry *entry, DbusmenuMenuitem *mi);
109static void entry_prop_change_cb (DbusmenuMenuitem *mi, gchar *prop, GVariant *value, GtkEntry *entry);103static void entry_prop_change_cb (DbusmenuMenuitem *mi, gchar *prop, GVariant *value, GtkEntry *entry);
110static gboolean entry_hint_is_shown (GtkWidget *widget);104static gboolean entry_hint_is_shown (GtkWidget *widget);
@@ -665,47 +659,6 @@
665 return TRUE;659 return TRUE;
666}660}
667661
668/* Whenever we have a property change on a DbusmenuMenuitem
669 we need to be responsive to that. */
670static void
671about_me_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant * value, AboutMeMenuItem *item)
672{
673 g_return_if_fail (ABOUT_IS_ME_MENU_ITEM (item));
674
675 if (!g_strcmp0(prop, DBUSMENU_ABOUT_ME_MENUITEM_PROP_ICON)) {
676 /* reload the avatar icon */
677 about_me_menu_item_load_avatar (item, g_variant_get_string(value, NULL));
678 } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_VISIBLE)) {
679 /* normal, ignore */
680 } else {
681 g_warning("Indicator Item property '%s' unknown", prop);
682 }
683
684 return;
685}
686
687static gboolean
688new_about_me_item (DbusmenuMenuitem * newitem,
689 DbusmenuMenuitem * parent,
690 DbusmenuClient * client,
691 gpointer user_data)
692{
693 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE);
694 g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE);
695 /* Note: not checking parent, it's reasonable for it to be NULL */
696
697 const gchar *name = dbusmenu_menuitem_property_get (newitem, DBUSMENU_ABOUT_ME_MENUITEM_PROP_NAME);
698 AboutMeMenuItem *about = ABOUT_ME_MENU_ITEM (about_me_menu_item_new (name));
699 if (about != NULL) {
700 dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(about), parent);
701 const gchar *avatar = dbusmenu_menuitem_property_get (newitem, DBUSMENU_ABOUT_ME_MENUITEM_PROP_ICON);
702 about_me_menu_item_load_avatar (about, avatar);
703 g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(about_me_prop_change_cb), about);
704 }
705
706 return TRUE;
707}
708
709/* Builds the dbusmenu for the service. */662/* Builds the dbusmenu for the service. */
710static GtkMenu *663static GtkMenu *
711get_menu (IndicatorObject * io)664get_menu (IndicatorObject * io)
@@ -714,7 +667,6 @@
714 DbusmenuGtkClient * client = dbusmenu_gtkmenu_get_client(menu);667 DbusmenuGtkClient * client = dbusmenu_gtkmenu_get_client(menu);
715668
716 dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_ENTRY_MENUITEM_TYPE, new_entry_item);669 dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_ENTRY_MENUITEM_TYPE, new_entry_item);
717 dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_ABOUT_ME_MENUITEM_TYPE, new_about_me_item);
718670
719 return GTK_MENU (menu);671 return GTK_MENU (menu);
720}672}
721673
=== modified file 'src/me-service.c'
--- src/me-service.c 2011-04-18 04:00:53 +0000
+++ src/me-service.c 2011-06-27 16:40:07 +0000
@@ -88,7 +88,6 @@
88static GMainLoop * mainloop = NULL;88static GMainLoop * mainloop = NULL;
89static StatusServiceDbus * dbus_interface = NULL;89static StatusServiceDbus * dbus_interface = NULL;
90static StatusProviderStatus global_status = STATUS_PROVIDER_STATUS_DISCONNECTED;90static StatusProviderStatus global_status = STATUS_PROVIDER_STATUS_DISCONNECTED;
91static GFileMonitor *avatar_monitor = NULL;
92static DbusmenuMenuitem *broadcast_field = NULL;91static DbusmenuMenuitem *broadcast_field = NULL;
93static DbusmenuMenuitem * useritem = NULL;92static DbusmenuMenuitem * useritem = NULL;
94static GSettings *gsettings = NULL;93static GSettings *gsettings = NULL;
@@ -341,48 +340,6 @@
341 (value == 0) ? FALSE : TRUE);340 (value == 0) ? FALSE : TRUE);
342}341}
343342
344
345/* disabled for this release */
346#if 0
347static void
348avatar_changed_cb (GFileMonitor * monitor, GFile * file, GFile * other_file, GFileMonitorEvent event_type, gpointer user_data)
349{
350 g_debug("avatar changed!");
351
352 g_return_if_fail (DBUSMENU_IS_MENUITEM (user_data));
353
354 DbusmenuMenuitem *mi = DBUSMENU_MENUITEM (user_data);
355
356 /* whatever happened, we just update the icon property
357 and let the indicator reload the image */
358 gchar * path = g_file_get_path (file);
359 dbusmenu_menuitem_property_set (mi, DBUSMENU_ABOUT_ME_MENUITEM_PROP_ICON, path);
360}
361
362static void
363build_avatar_item (DbusmenuMenuitem * root)
364{
365 useritem = dbusmenu_menuitem_new();
366 dbusmenu_menuitem_property_set(useritem, DBUSMENU_ABOUT_ME_MENUITEM_PROP_NAME, g_get_real_name ());
367 dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE);
368 dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
369 dbusmenu_menuitem_property_set(useritem, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_ABOUT_ME_MENUITEM_TYPE);
370 dbusmenu_menuitem_child_append(root, useritem);
371
372 /* avatar icon */
373 gchar *filename = g_build_filename (g_get_home_dir (), ".face", NULL);
374 dbusmenu_menuitem_property_set (useritem, DBUSMENU_ABOUT_ME_MENUITEM_PROP_ICON, filename);
375 GFile *file = g_file_new_for_path (filename);
376 avatar_monitor = g_file_monitor (file, G_FILE_MONITOR_NONE, NULL, NULL);
377 if (avatar_monitor != NULL)
378 g_signal_connect (G_OBJECT (avatar_monitor), "changed", G_CALLBACK (avatar_changed_cb), useritem);
379
380 g_free (filename);
381
382 return;
383}
384#endif
385
386#define GSETTINGS_SCHEMA "com.canonical.indicator.me"343#define GSETTINGS_SCHEMA "com.canonical.indicator.me"
387#define GSETTINGS_DISPLAY "display"344#define GSETTINGS_DISPLAY "display"
388345
@@ -392,10 +349,6 @@
392 DbusmenuMenuitem * root = DBUSMENU_MENUITEM(data);349 DbusmenuMenuitem * root = DBUSMENU_MENUITEM(data);
393 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(root), FALSE);350 g_return_val_if_fail(DBUSMENU_IS_MENUITEM(root), FALSE);
394351
395 /* disabled for this release */
396#if 0
397 build_avatar_item(root);
398#endif
399352
400 broadcast_field = DBUSMENU_MENUITEM (entry_menu_item_new());353 broadcast_field = DBUSMENU_MENUITEM (entry_menu_item_new());
401 dbusmenu_menuitem_property_set (broadcast_field, DBUSMENU_ENTRY_MENUITEM_PROP_HINT, _("Post message..."));354 dbusmenu_menuitem_property_set (broadcast_field, DBUSMENU_ENTRY_MENUITEM_PROP_HINT, _("Post message..."));
@@ -433,27 +386,6 @@
433386
434 build_accounts_menuitems(root);387 build_accounts_menuitems(root);
435388
436 /* add a standard "About Me..." menu item at the end of the menu */
437 DbusmenuMenuitem *separator = dbusmenu_menuitem_new();
438 dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE,
439 DBUSMENU_CLIENT_TYPES_SEPARATOR);
440 dbusmenu_menuitem_child_append(root, separator);
441
442 useritem = dbusmenu_menuitem_new();
443 dbusmenu_menuitem_property_set(useritem, DBUSMENU_MENUITEM_PROP_LABEL, _("About Me..."));
444 dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE);
445 dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
446 dbusmenu_menuitem_child_append(root, useritem);
447
448 gchar *gam = g_find_program_in_path("gnome-about-me");
449 if (gam != NULL) {
450 dbusmenu_menuitem_property_set_bool(useritem, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
451 g_signal_connect(G_OBJECT(useritem),
452 DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
453 G_CALLBACK(spawn_on_activate_cb), "gnome-about-me");
454 g_free(gam);
455 }
456
457 /* finally set the menu name and update items visibility according389 /* finally set the menu name and update items visibility according
458 to a gsettings key and receive display mode notifications to update it390 to a gsettings key and receive display mode notifications to update it
459 later */391 later */
@@ -470,9 +402,6 @@
470{402{
471 g_debug("Service shutting down");403 g_debug("Service shutting down");
472404
473 if (avatar_monitor != NULL)
474 g_object_unref (avatar_monitor);
475
476 g_main_loop_quit(mainloop);405 g_main_loop_quit(mainloop);
477 return;406 return;
478}407}

Subscribers

People subscribed via source and target branches