diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2009-08-27 14:52:00 -0400 |
---|---|---|
committer | Ken VanDine <ken.vandine@canonical.com> | 2009-08-27 14:52:00 -0400 |
commit | f6d0564a4d48f60e52959eeb0cdc64c6170e0372 (patch) | |
tree | faac1c5ff643a6aba420f2248ac0390f317ad685 /src/indicator-session.c | |
parent | 3a18ed4b656b9ee146e6f3fd5fdd56416d335724 (diff) | |
parent | 94f3cd1c8817d7203c5ba2b9abb57992f577f3a0 (diff) | |
download | ayatana-indicator-session-f6d0564a4d48f60e52959eeb0cdc64c6170e0372.tar.gz ayatana-indicator-session-f6d0564a4d48f60e52959eeb0cdc64c6170e0372.tar.bz2 ayatana-indicator-session-f6d0564a4d48f60e52959eeb0cdc64c6170e0372.zip |
* Upstream version 0.1
* debian/control: Looking for libdbusmenu* >= 0.1.0
* debian/control: Shortening the short description and lengthening
the long one. Fixes a bug (LP: #412024)
Diffstat (limited to 'src/indicator-session.c')
-rw-r--r-- | src/indicator-session.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/indicator-session.c b/src/indicator-session.c index 07efc86..43c568f 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -61,6 +61,7 @@ static void child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, gu static guint status_menu_pos_offset (void); static guint users_menu_pos_offset (void); static guint session_menu_pos_offset (void); +static void child_realized (DbusmenuMenuitem * child, gpointer userdata); GtkLabel * get_label (void) @@ -79,14 +80,44 @@ get_icon (void) return status_image; } +typedef struct _realized_data_t realized_data_t; +struct _realized_data_t { + guint position; + section_t section; +}; + static void child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint position, gpointer section) { + realized_data_t * data = g_new0(realized_data_t, 1); + if (data == NULL) { + g_warning("Unable to allocate data for realization of item"); + return; + } + + data->position = position; + data->section = GPOINTER_TO_UINT(section); + + g_signal_connect(G_OBJECT(child), DBUSMENU_MENUITEM_SIGNAL_REALIZED, G_CALLBACK(child_realized), data); + return; +} + +static void +child_realized (DbusmenuMenuitem * child, gpointer userdata) +{ + g_return_if_fail(userdata != NULL); + g_return_if_fail(DBUSMENU_IS_MENUITEM(child)); + + realized_data_t * data = (realized_data_t *)userdata; + guint position = data->position; + section_t section = data->section; + g_free(data); + DbusmenuGtkClient * client = NULL; gchar * errorstr = NULL; guint (*posfunc) (void) = NULL; - switch (GPOINTER_TO_UINT(section)) { + switch (section) { case STATUS_SECTION: client = status_client; errorstr = "Status"; |