--- appmenu-gtk-0.0.9.orig/debian/copyright +++ appmenu-gtk-0.0.9/debian/copyright @@ -0,0 +1,33 @@ +This package was debianized by Ken VanDine on +Thu, 27 May 2010 16:52:44 -0400 + + +It was downloaded from + +Upstream Author: + + Cody Russell + +Copyright: + + Copyright (C) 2010 Canonical Ltd. + +License: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License version 3, as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, see . + +On Debian systems, the complete text of the GNU Lesser General +Public License can be found in `/usr/share/common-licenses/LGPL-3'. + +The Debian packaging is (C) 2010, Canonical Ltd. and +is licensed under the GPLv3, see `/usr/share/common-licenses/GPL-3'. --- appmenu-gtk-0.0.9.orig/debian/watch +++ appmenu-gtk-0.0.9/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://launchpad.net/appmenu-gtk/+download .*/appmenu-gtk-([0-9.]+)\.tar\.gz --- appmenu-gtk-0.0.9.orig/debian/control +++ appmenu-gtk-0.0.9/debian/control @@ -0,0 +1,24 @@ +Source: appmenu-gtk +Section: libs +Priority: optional +Maintainer: Ubuntu Desktop Team +Build-Depends: debhelper (>= 5.0), + cdbs (>= 0.4.41), + libgtk2.0-dev (>= 2.21.1-1ubuntu2), + libdbus-glib-1-dev, + libdbusmenu-glib-dev (>= 0.3.3), + libdbusmenu-gtk-dev (>= 0.3.3), + libtool +Standards-Version: 3.8.4 +Homepage: https://launchpad.net/appmenu-gtk +Vcs-Bzr: https://code.launchpad.net/~ubuntu-desktop/appmenu-gtk/ubuntu +Vcs-Browser: http://bazaar.launchpad.net/~ubuntu-desktop/appmenu-gtk/ubuntu + +Package: appmenu-gtk +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, + ${misc:Depends} +Description: Export GTK menus over DBus + . + This package provides support for application menus. --- appmenu-gtk-0.0.9.orig/debian/rules +++ appmenu-gtk-0.0.9/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/gnome.mk + +LDFLAGS += -Wl,-z,defs -Wl,--as-needed --- appmenu-gtk-0.0.9.orig/debian/changelog +++ appmenu-gtk-0.0.9/debian/changelog @@ -0,0 +1,119 @@ +appmenu-gtk (0.0.9-0ubuntu4) maverick; urgency=low + + * Backport extra upstream fixes for softwares not working + + -- Sebastien Bacher Fri, 02 Jul 2010 12:31:21 +0200 + +appmenu-gtk (0.0.9-0ubuntu3) maverick; urgency=low + + * Backport another set of upstream changes to fix crashing issues + + -- Sebastien Bacher Tue, 29 Jun 2010 23:54:41 +0200 + +appmenu-gtk (0.0.9-0ubuntu2) maverick; urgency=low + + * Backport upstream commit to fix missing menu items issues (lp: #598623) + + -- Sebastien Bacher Tue, 29 Jun 2010 10:42:00 +0200 + +appmenu-gtk (0.0.9-0ubuntu1) maverick; urgency=low + + * New upstream version: + - Fix bug #598244 - Unexpected separators in menus (lp: #598244) + - Fix bug #598311 - Missing menus and menu items (lp: #598311) + + -- Sebastien Bacher Fri, 25 Jun 2010 20:20:12 +0200 + +appmenu-gtk (0.0.8-0ubuntu2) maverick; urgency=low + + * Backport upstream r35 to fix some extra issues + + -- Sebastien Bacher Thu, 24 Jun 2010 22:10:12 +0200 + +appmenu-gtk (0.0.8-0ubuntu1) maverick; urgency=low + + * New upstream release + - memset recurse to 0, then check for NULL before setting root. + - Fix for valid roots always. + - Skip duplicate separator menuitems (LP: #594867) + - Add support for shortcuts (LP: #591293) + - check that the boolean ubuntu-no-proxy exists before using a potential + value to remove proxy support + * debian/control + - build build depends for libdbusmenu to >= 0.3.3 + + -- Ken VanDine Thu, 24 Jun 2010 13:53:20 -0400 + +appmenu-gtk (0.0.7-0ubuntu2) maverick; urgency=low + + * Backporting upstream commit to fix issues in unity + + -- Sebastien Bacher Fri, 18 Jun 2010 12:42:34 +0200 + +appmenu-gtk (0.0.7-0ubuntu1) maverick; urgency=low + + * New upstream release + + -- Ken VanDine Thu, 17 Jun 2010 16:39:13 -0400 + +appmenu-gtk (0.0.6-0ubuntu1) maverick; urgency=low + + * New upstream release + - Sets needed session variables in /etc/X11/Xsession.d + + -- Ken VanDine Fri, 11 Jun 2010 11:47:35 -0400 + +appmenu-gtk (0.0.5-0ubuntu1) maverick; urgency=low + + * New upstream release + * debian/control + - build build-dep version for libgtk2.0-dev to >= 2.21.1-1ubuntu2 + + -- Ken VanDine Thu, 10 Jun 2010 17:30:03 -0400 + +appmenu-gtk (0.0.4-0ubuntu1~ppa1) lucid; urgency=low + + * New upstream release + + -- Ken VanDine Fri, 04 Jun 2010 13:47:36 -0400 + +appmenu-gtk (0.0.3-0ubuntu1~ppa1) lucid; urgency=low + + * New upstream version + * debian/control + - Added Vcs lings + * debian/copyright added + * debian/watch added + + -- Ken VanDine Thu, 27 May 2010 16:52:44 -0400 + +appmenu-gtk (0.0.2~dev-0ubuntu1~ppa1) lucid; urgency=low + + * Version bump to 0.0.2 + + -- Cody Russell Wed, 26 May 2010 11:26:17 -0500 + +appmenu-gtk (0.0.1~dev-0ubuntu1~ppa4) lucid; urgency=low + + * Updates for the latest GtkMenuProxy interface. + + -- Cody Russell Wed, 26 May 2010 09:00:08 -0500 + +appmenu-gtk (0.0.1~dev-0ubuntu1~ppa3) lucid; urgency=low + + * debian/control: Adding libdbusmenu-gtk-dev to the dependency + list. + + -- Ted Gould Wed, 12 May 2010 16:44:47 +0200 + +appmenu-gtk (0.0.1~dev-0ubuntu1~ppa2) lucid; urgency=low + + * Fixing packaging to make it so there aren't two .so's + + -- Ted Gould Tue, 11 May 2010 13:30:04 +0200 + +appmenu-gtk (0.0.1~dev-0ubuntu1~ppa1) lucid; urgency=low + + * Initial release. + + -- Ted Gould Tue, 11 May 2010 13:18:19 +0200 --- appmenu-gtk-0.0.9.orig/src/bridge.c +++ appmenu-gtk-0.0.9/src/bridge.c @@ -60,6 +60,8 @@ UbuntuMenuProxy *proxy); static void rebuild_window_items (AppMenuBridge *bridge, GtkWidget *toplevel); +static void rebuild (AppMenuBridge *bridge, + GtkWidget *toplevel); typedef struct _AppWindowContext AppWindowContext; @@ -90,10 +92,19 @@ gint count; DbusmenuMenuitem *stack[30]; + gboolean mode[30]; } RecurseContext; +enum { + SEPARATOR_MODE_SMART, + SEPARATOR_MODE_VISIBLE, + SEPARATOR_MODE_HIDDEN +}; + G_DEFINE_DYNAMIC_TYPE(AppMenuBridge, app_menu_bridge, UBUNTU_TYPE_MENU_PROXY) +static GHashTable *rebuild_ids = NULL; + static void app_menu_bridge_setup_proxy (AppMenuBridge *bridge) { @@ -417,7 +428,7 @@ if (toplevel == window) { - rebuild_window_items (context->bridge, window); + rebuild (context->bridge, window); } /* We only care about this once, so let's disconnect now. */ @@ -443,8 +454,29 @@ dbusmenu_menuitem_property_set_shortcut_menuitem (mi, GTK_MENU_ITEM (widget)); } +static void +action_notify_cb (GtkAction *action, + GParamSpec *pspec, + gpointer data) +{ + DbusmenuMenuitem *mi = (DbusmenuMenuitem *)data; + + if (pspec->name == g_intern_static_string ("active")) + { + dbusmenu_menuitem_property_set_bool (mi, + DBUSMENU_MENUITEM_PROP_TOGGLE_STATE, + gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); + } + else if (pspec->name == g_intern_static_string ("label")) + { + dbusmenu_menuitem_property_set (mi, + DBUSMENU_MENUITEM_PROP_LABEL, + gtk_action_get_label (action)); + } +} + static DbusmenuMenuitem * -construct_dbusmenu_for_widget (GtkWidget *widget) +construct_dbusmenu_for_widget (GtkWidget *widget, gboolean previous_separator) { DbusmenuMenuitem *mi = dbusmenu_menuitem_new (); @@ -455,9 +487,19 @@ dbusmenu_menuitem_property_set (mi, "type", "separator"); + + gint mode = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "gtk-separator-mode")); + + // g_print ("mode == %d, previous_separator == %d\n", mode, previous_separator); + + dbusmenu_menuitem_property_set_bool (mi, + DBUSMENU_MENUITEM_PROP_VISIBLE, + mode == SEPARATOR_MODE_SMART && !previous_separator); } else { + gboolean visible = FALSE; + g_signal_connect (widget, "accel-closures-changed", G_CALLBACK (accel_changed), @@ -483,9 +525,14 @@ "label", get_menu_label_text (widget)); + if (!g_object_get_data (G_OBJECT (widget), "gtk-empty-menu-item") && !GTK_IS_TEAROFF_MENU_ITEM (widget)) + { + visible = gtk_widget_get_visible (widget); + } + dbusmenu_menuitem_property_set_bool (mi, DBUSMENU_MENUITEM_PROP_VISIBLE, - gtk_widget_get_visible (widget)); + visible); dbusmenu_menuitem_property_set_bool (mi, DBUSMENU_MENUITEM_PROP_ENABLED, @@ -498,8 +545,26 @@ G_CALLBACK (widget_notify_cb), mi); + if (GTK_IS_ACTIVATABLE (widget)) + { + GtkActivatable *activatable = GTK_ACTIVATABLE (widget); + + if (gtk_activatable_get_use_action_appearance (activatable)) + { + GtkAction *action = gtk_activatable_get_related_action (activatable); + + if (action) + { + g_signal_connect_object (action, "notify", + G_CALLBACK (action_notify_cb), + mi, + G_CONNECT_AFTER); + } + } + } + g_signal_connect (G_OBJECT (mi), - "item_activated", + DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK (item_activated), widget); } @@ -515,13 +580,23 @@ if (GTK_IS_CONTAINER (widget)) { gboolean increment = GTK_IS_MENU_BAR (widget) || GTK_IS_MENU_ITEM (widget); - gboolean skip = FALSE; + gboolean previous_separator = FALSE; if (increment) recurse->count++; if (recurse->count > -1 && increment) { + /* If this is a separator, find out if we've already displayed a visible separator during + * this run. GtkUIManager internally defines the following separator modes: + * + * SEPARATOR_MODE_SMART + * SEPARATOR_MODE_VISIBLE + * SEPARATOR_MODE_HIDDEN + * + * construct_dbusmenu_for_widget() will mark a smart separator as visible in a run of + * separators unless it is following another smart separator anywhere in that run. + */ if (GTK_IS_SEPARATOR_MENU_ITEM (widget)) { if (recurse->stack[recurse->count] != NULL) @@ -531,14 +606,30 @@ if (g_strcmp0 (type, "separator") == 0) { - skip = TRUE; + /* Get the previous separator mode. */ + gint mode = recurse->mode[recurse->count]; + + if (mode == SEPARATOR_MODE_SMART) + previous_separator = TRUE; } } } - if (!gtk_widget_get_visible (widget)) + recurse->stack[recurse->count] = construct_dbusmenu_for_widget (widget, previous_separator); + + if (GTK_IS_SEPARATOR_MENU_ITEM (widget)) { - skip = TRUE; + /* If the previous separator was mode 1, let's pretend that this separator is also mode 1. + * That means for the remainder of this run of separators, all will be marked as mode 1. + */ + if (previous_separator) + { + recurse->mode[recurse->count] = SEPARATOR_MODE_SMART; + } + else + { + recurse->mode[recurse->count] = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "gtk-separator-mode")); + } } if (!gtk_widget_get_visible (widget)) @@ -547,22 +638,25 @@ "notify", G_CALLBACK (menuitem_notify_cb), recurse->context); - skip = TRUE; } - if (!skip) + // g_print ("%d: %s %s\n", recurse->count, G_OBJECT_TYPE_NAME (widget), get_menu_label_text (widget)); + + if (GTK_IS_TEAROFF_MENU_ITEM (widget)) { - recurse->stack[recurse->count] = construct_dbusmenu_for_widget (widget); + dbusmenu_menuitem_property_set_bool (recurse->stack[recurse->count], + DBUSMENU_MENUITEM_PROP_VISIBLE, + FALSE); + } - if (recurse->count > 0) - { - if (recurse->count == 1) - dbusmenu_menuitem_child_append (recurse->stack[recurse->count - 1], - recurse->stack[recurse->count]); - else - dbusmenu_menuitem_child_prepend (recurse->stack[recurse->count - 1], - recurse->stack[recurse->count]); - } + if (recurse->count > 0) + { + if (recurse->count == 1) + dbusmenu_menuitem_child_append (recurse->stack[recurse->count - 1], + recurse->stack[recurse->count]); + else + dbusmenu_menuitem_child_prepend (recurse->stack[recurse->count - 1], + recurse->stack[recurse->count]); } } @@ -585,6 +679,62 @@ } } +typedef struct _RebuildData { + AppMenuBridge *bridge; + GtkWidget *widget; +} RebuildData; + +static gboolean +do_rebuild (RebuildData *data) +{ + rebuild_window_items (data->bridge, + data->widget); + + g_hash_table_remove (rebuild_ids, data->widget); + if (g_hash_table_size (rebuild_ids) == 0) + { + g_hash_table_destroy (rebuild_ids); + } + + g_free (data); + + return FALSE; +} + +static void +rebuild (AppMenuBridge *bridge, + GtkWidget *toplevel) +{ + guint id = 0; + + if (rebuild_ids != NULL) + { + id = GPOINTER_TO_UINT (g_hash_table_lookup (rebuild_ids, toplevel)); + + if (id > 0) + { + g_source_remove (id); + g_hash_table_remove (rebuild_ids, toplevel); + id = 0; + } + } + + RebuildData *data = g_new0 (RebuildData, 1); + data->bridge = bridge; + data->widget = toplevel; + + id = g_timeout_add (500, + (GSourceFunc)do_rebuild, + data); + + if (rebuild_ids == NULL) + { + rebuild_ids = g_hash_table_new (g_direct_hash, g_direct_equal); + } + + g_hash_table_insert (rebuild_ids, GUINT_TO_POINTER (id), toplevel); +} + static void rebuild_window_items (AppMenuBridge *bridge, GtkWidget *toplevel) @@ -676,6 +826,8 @@ dbusmenu_server_set_root (context->server, context->root); } + + register_application_windows (bridge); } @@ -687,8 +839,8 @@ if (GTK_IS_WINDOW (widget)) { - rebuild_window_items (bridge, widget); - register_application_windows (bridge); + rebuild (bridge, widget); + //register_application_windows (bridge); return; } @@ -704,7 +856,7 @@ GtkWidget *toplevel = gtk_widget_get_toplevel (widget); AppMenuBridge *bridge = APP_MENU_BRIDGE (proxy); - rebuild_window_items (bridge, toplevel); + rebuild (bridge, toplevel); } } @@ -719,7 +871,7 @@ g_object_get (widget, "attach-widget", &attach, NULL); - rebuild_window_items (bridge, attach); + rebuild (bridge, attach); } } @@ -771,6 +923,12 @@ bridge); return; } + else + { + toplevel = gtk_widget_get_toplevel (attach); + + rebuild (bridge, toplevel); + } } if (GTK_IS_WINDOW (toplevel)) @@ -793,16 +951,18 @@ static gboolean app_menu_brige_shouldnt_load (void) { - const char *prg = g_get_prgname (); + const char *prg = g_get_prgname (); - if ((g_strrstr (prg, "indicator-applet") != NULL) - || (g_strcmp0 (prg, "indicator-loader") == 0) - || (g_strcmp0 (prg, "mutter") == 0)) { - g_print ("*** Warning: menu proxy blacklisting: %s\n", prg); - return TRUE; - } + if ((g_strrstr (prg, "indicator-applet") != NULL) + || (g_strcmp0 (prg, "indicator-loader") == 0) + || (g_strcmp0 (prg, "mutter") == 0) + || (g_strcmp0 (prg, "firefox-bin") == 0)) + { + g_print ("*** Warning: menu proxy blacklisting: %s\n", prg); + return TRUE; + } - return FALSE; + return FALSE; }