gtk_menu_new_from_model doesn't support custom menu items

Bug #1039476 reported by Lars Karlitski
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gtk+3.0 (Ubuntu)
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.

Revision history for this message
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)
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

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
Revision history for this message
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/ 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
Revision history for this message
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)
Changed in gtk+3.0 (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
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

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.


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

Other bug subscribers