aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk/parser.c
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-06-24 14:15:33 -0400
committerKen VanDine <ken.vandine@canonical.com>2011-06-24 14:15:33 -0400
commit9a8c84b879e78aa8e0a9c1759fc5b73a29efd116 (patch)
tree8471f1da76c5592c05fffb462337726c43b81db5 /libdbusmenu-gtk/parser.c
parent565603d992afa03da6a8f485fcdbe8b71677f7db (diff)
parentb08640dfaa65d54ac758e14f103e92bdc20990e0 (diff)
downloadlibdbusmenu-9a8c84b879e78aa8e0a9c1759fc5b73a29efd116.tar.gz
libdbusmenu-9a8c84b879e78aa8e0a9c1759fc5b73a29efd116.tar.bz2
libdbusmenu-9a8c84b879e78aa8e0a9c1759fc5b73a29efd116.zip
* debian/control, debian/*: Renaming packages for library version
bump from 3 to 4. * New upstream release. * Fixing visibility for Eclipse (LP: #770263 and LP: #618587) * Unseting a GValue properly (LP: #785828) * Memory leaks for GVariant usage (LP: #784890) * Making GTK 3 default build * Removing the SerializableMenuitem object * debian/rules: Making GTK2 the special build * New upstream release. - Fix a typo in the signal name to make it match the XML files (LP: #641209) - Ref'ing the server for the entire time we're getting the bus (LP: #738568) - Watch additions/removals from submenus that get added - Activate new toplevel menu items as they get added - Make sure we don't activate toplevel children that aren't menu items or don't have submenus (LP: #761112)
Diffstat (limited to 'libdbusmenu-gtk/parser.c')
-rw-r--r--libdbusmenu-gtk/parser.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/libdbusmenu-gtk/parser.c b/libdbusmenu-gtk/parser.c
index 4708a64..3243c81 100644
--- a/libdbusmenu-gtk/parser.c
+++ b/libdbusmenu-gtk/parser.c
@@ -28,7 +28,7 @@ License version 3 and version 2.1 along with this program. If not, see
#include "parser.h"
#include "menuitem.h"
-#include "serializablemenuitem.h"
+#include "client.h"
#define CACHED_MENUITEM "dbusmenu-gtk-parser-cached-item"
#define PARSER_DATA "dbusmenu-gtk-parser-data"
@@ -270,6 +270,16 @@ new_menuitem (GtkWidget * widget)
return item;
}
+static gboolean
+toggle_widget_visibility (GtkWidget * widget)
+{
+ gboolean vis = gtk_widget_get_visible (widget);
+ gtk_widget_set_visible (widget, !vis);
+ gtk_widget_set_visible (widget, vis);
+ g_object_unref (G_OBJECT (widget));
+ return FALSE;
+}
+
static void
watch_submenu(DbusmenuMenuitem * mi, GtkWidget * menu)
{
@@ -285,6 +295,14 @@ watch_submenu(DbusmenuMenuitem * mi, GtkWidget * menu)
G_CALLBACK (child_removed_cb),
mi);
g_object_add_weak_pointer(G_OBJECT (menu), (gpointer*)&pdata->shell);
+
+ /* Some apps (notably Eclipse RCP apps) don't fill contents of submenus
+ until the menu is shown. So we fake that by toggling the visibility of
+ any submenus we come across. Further, these apps need it done with a
+ delay while they finish initializing, so we put the call in the idle
+ queue. */
+ g_idle_add((GSourceFunc)toggle_widget_visibility,
+ g_object_ref (G_OBJECT (menu)));
}
static void
@@ -473,13 +491,6 @@ sanitize_label (GtkLabel * label)
static DbusmenuMenuitem *
construct_dbusmenu_for_widget (GtkWidget * widget)
{
- /* If it's a subclass of our serializable menu item then we can
- use its own build function */
- if (DBUSMENU_IS_GTK_SERIALIZABLE_MENU_ITEM(widget)) {
- DbusmenuGtkSerializableMenuItem * smi = DBUSMENU_GTK_SERIALIZABLE_MENU_ITEM(widget);
- return dbusmenu_gtk_serializable_menu_item_build_menuitem(smi);
- }
-
/* If it's a standard GTK Menu Item we need to do some of our own work */
if (GTK_IS_MENU_ITEM (widget))
{
@@ -862,6 +873,9 @@ label_notify_cb (GtkWidget *widget,
g_idle_add ((GSourceFunc)recreate_menu_item_in_idle_cb, child);
}
}
+
+ g_value_unset(&prop_value);
+ return;
}
static void