gtk_menu_new_from_model doesn't support custom menu items

Bug #1039476 reported by Lars Karlitski on 2012-08-21
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gtk+3.0 (Ubuntu)
Wishlist
Lars Karlitski

Bug Description

indicator-messages is the first indicator that uses GMenuModel instead of Dbusmenu to send its menus to the panel. Its panel plugin uses gtk_menu_new_from_model to create a GtkMenu widget from a GMenuModel.

Most of the menu items in the messaging menu are custom widgets (to show icons, message counts, and the application-is-running triangles). However, gtk_menu_new_from_model always creates GtkCheckMenuItems.

The attached patch solves this problem by introducing a new menu item attribute ("x-canonical-type"). The value of this attribute should be a valid GType name (as passed to g_type_from_name). An instance of this type is created to represent the menu item if the type is a subclass of GtkMenuItem and it has these two properties:

  - "menu-item": a GMenuItem from which to build the item
  - "action-group": a GActionGroup which contains the action for this menu item

indicator-messages already depends on this patch and is a first "test-case" for this API.

The patch doesn't introduce new public functions. "x-canonical-type" should be considered private for now.

Lars Karlitski (larsu) wrote :
Changed in gtk+3.0 (Ubuntu):
assignee: nobody → Lars Uebernickel (larsu)
Changed in gtk+3.0 (Ubuntu):
importance: Undecided → Wishlist
status: New → In Progress
affects: gtk+3.0 (Ubuntu) → ubuntu
Changed in ubuntu:
status: In Progress → Fix Committed
affects: ubuntu → gtk+3.0 (Ubuntu)

The attachment "gtk-custom-menu-items.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gtk+3.0 - 3.5.12-0ubuntu2

---------------
gtk+3.0 (3.5.12-0ubuntu2) quantal-proposed; urgency=low

  * debian/control.in: updated glib requirement
  * debian/patches/ubuntu_gtk_custom_menu_items.patch:
    - define new gtk_model_menu_create_custom_item function, it's required
      for the indicator-message on gmenu update, thanks Lars Uebernickel
      (lp: #1039476)
 -- Sebastien Bacher <email address hidden> Tue, 21 Aug 2012 13:57:05 +0200

Changed in gtk+3.0 (Ubuntu):
status: Fix Committed → Fix Released
Lars Karlitski (larsu) wrote :

Attached an updated patch that applies against gtk+-3.5.18.

Changed in gtk+3.0 (Ubuntu):
status: Fix Released → In Progress
Didier Roche (didrocks) on 2012-09-19
Changed in gtk+3.0 (Ubuntu):
status: In Progress → Fix Released
quequotion (quequotion) wrote :

I'm trying to reconcile the ubuntu gtk3 patches from bzr against gtk3 from git and I've almost got it.

I'm stuck on this one, since GMenuModel (gtkmodelmenu?) is deprecated for GtkMenuTracker

https://git.gnome.org/browse/gtk+/commit/?id=5617b584202b1f967f287dfd03a4560975f1389b

I've worked out where most of the code would go, but not how it would be written; the layout is almost the same, but the syntax has changed significantly.

Help?

http://pastebin.com/W5b4nBDN

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers