[maemo-commits] [maemo-commits] r16379 - in projects/haf/trunk/gtk+: . docs/reference/gtk/tmpl gtk
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Thu Oct 9 12:18:26 EEST 2008
- Previous message: [maemo-commits] r16378 - projects/haf/trunk/hildon-thumbnail/thumbs
- Next message: [maemo-commits] r16381 - in projects/haf/trunk/osso-af-startup: debian top-scripts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: mitch Date: 2008-10-09 12:18:23 +0300 (Thu, 09 Oct 2008) New Revision: 16379 Modified: projects/haf/trunk/gtk+/ChangeLog projects/haf/trunk/gtk+/docs/reference/gtk/tmpl/gtkuimanager.sgml projects/haf/trunk/gtk+/gtk/gtkuimanager.c projects/haf/trunk/gtk+/gtk/gtkuimanager.h Log: 2008-10-09 Michael Natterer <mitch at imendio.com> Fixes NB#87440: Accelerator Labels not shown in menus created with GtkUIManager Merged from upstream trunk: 2008-10-09 Michael Natterer <mitch at imendio.com> Bug 516425 ?\226?\128?\147 Optionally display accelerators in popups * gtk/gtkuimanager.h (enum GtkUIManagerItemType): add value GTK_UI_MANAGER_POPUP_WITH_ACCELS which works like _POPUP but shows the actions' accelerators. * gtk/gtkuimanager.c: honor the new enum value for programmatically created UIs, and support <popup accelerators="true"> in the XML for the same purpose. * docs/reference/gtk/tmpl/gtkuimanager.sgml: document the enhanced XML syntax and the new enum value for popups with accelerators. 2008-06-13 Michael Natterer <mitch at imendio.com> * gtk/gtkuimanager.c (start_element_handler): silently skip unknown attributes instead of bailing out with an error in order to be compatible with possible future attribute names. This is related to the discussion in bug #516425 but actually needed for any kind of XML format extension. Modified: projects/haf/trunk/gtk+/ChangeLog =================================================================== --- projects/haf/trunk/gtk+/ChangeLog 2008-10-08 14:39:16 UTC (rev 16378) +++ projects/haf/trunk/gtk+/ChangeLog 2008-10-09 09:18:23 UTC (rev 16379) @@ -1,3 +1,34 @@ +2008-10-09 Michael Natterer <mitch at imendio.com> + + Fixes NB#87440: Accelerator Labels not shown in menus created with + GtkUIManager + + Merged from upstream trunk: + + 2008-10-09 Michael Natterer <mitch at imendio.com> + + Bug 516425 – Optionally display accelerators in popups + + * gtk/gtkuimanager.h (enum GtkUIManagerItemType): add value + GTK_UI_MANAGER_POPUP_WITH_ACCELS which works like _POPUP but + shows the actions' accelerators. + + * gtk/gtkuimanager.c: honor the new enum value for programmatically + created UIs, and support <popup accelerators="true"> in the XML + for the same purpose. + + * docs/reference/gtk/tmpl/gtkuimanager.sgml: document the enhanced + XML syntax and the new enum value for popups with accelerators. + + 2008-06-13 Michael Natterer <mitch at imendio.com> + + * gtk/gtkuimanager.c (start_element_handler): silently skip + unknown attributes instead of bailing out with an error in order + to be compatible with possible future attribute names. + + This is related to the discussion in bug #516425 but actually + needed for any kind of XML format extension. + 2008-10-06 Claudio Saavedra <csaavedra at igalia.com> Released 2:2.12.12-1maemo2 Modified: projects/haf/trunk/gtk+/docs/reference/gtk/tmpl/gtkuimanager.sgml =================================================================== --- projects/haf/trunk/gtk+/docs/reference/gtk/tmpl/gtkuimanager.sgml 2008-10-08 14:39:16 UTC (rev 16378) +++ projects/haf/trunk/gtk+/docs/reference/gtk/tmpl/gtkuimanager.sgml 2008-10-09 09:18:23 UTC (rev 16379) @@ -32,28 +32,29 @@ <!ELEMENT toolitem (menu?) > <!ELEMENT separator EMPTY > <!ELEMENT accelerator EMPTY > -<!ATTLIST menubar name #IMPLIED - action #IMPLIED > -<!ATTLIST toolbar name #IMPLIED - action #IMPLIED > -<!ATTLIST popup name #IMPLIED - action #IMPLIED > -<!ATTLIST placeholder name #IMPLIED - action #IMPLIED > -<!ATTLIST separator name #IMPLIED - action #IMPLIED - expand (true|false) #IMPLIED > -<!ATTLIST menu name #IMPLIED - action #REQUIRED - position (top|bot) #IMPLIED > -<!ATTLIST menuitem name #IMPLIED - action #REQUIRED - position (top|bot) #IMPLIED > -<!ATTLIST toolitem name #IMPLIED - action #REQUIRED - position (top|bot) #IMPLIED > -<!ATTLIST accelerator name #IMPLIED - action #REQUIRED > +<!ATTLIST menubar name #IMPLIED + action #IMPLIED > +<!ATTLIST toolbar name #IMPLIED + action #IMPLIED > +<!ATTLIST popup name #IMPLIED + action #IMPLIED + accelerators (true|false) #IMPLIED > +<!ATTLIST placeholder name #IMPLIED + action #IMPLIED > +<!ATTLIST separator name #IMPLIED + action #IMPLIED + expand (true|false) #IMPLIED > +<!ATTLIST menu name #IMPLIED + action #REQUIRED + position (top|bot) #IMPLIED > +<!ATTLIST menuitem name #IMPLIED + action #REQUIRED + position (top|bot) #IMPLIED > +<!ATTLIST toolitem name #IMPLIED + action #REQUIRED + position (top|bot) #IMPLIED > +<!ATTLIST accelerator name #IMPLIED + action #REQUIRED > ]]></programlisting> There are some additional restrictions beyond those specified in the DTD, e.g. every toolitem must have a toolbar in its anchestry and @@ -458,6 +459,7 @@ @GTK_UI_MANAGER_TOOLITEM: Create a toolitem. @GTK_UI_MANAGER_SEPARATOR: Create a separator. @GTK_UI_MANAGER_ACCELERATOR: Install an accelerator. + at GTK_UI_MANAGER_POPUP_WITH_ACCELS: Same as %GTK_UI_MANAGER_POPUP, but the actions' accelerators are shown. <!-- ##### FUNCTION gtk_ui_manager_add_ui ##### --> <para> Modified: projects/haf/trunk/gtk+/gtk/gtkuimanager.c =================================================================== --- projects/haf/trunk/gtk+/gtk/gtkuimanager.c 2008-10-08 14:39:16 UTC (rev 16378) +++ projects/haf/trunk/gtk+/gtk/gtkuimanager.c 2008-10-09 09:18:23 UTC (rev 16379) @@ -80,6 +80,7 @@ guint dirty : 1; guint expand : 1; /* used for separators */ + guint popup_accels : 1; }; #define GTK_UI_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_UI_MANAGER, GtkUIManagerPrivate)) @@ -1187,7 +1188,8 @@ GQuark action_quark; gboolean top; gboolean expand = FALSE; - + gboolean accelerators = FALSE; + gboolean raise_error = TRUE; node_name = NULL; @@ -1214,20 +1216,13 @@ { expand = !strcmp (attribute_values[i], "true"); } - else - { - gint line_number, char_number; - - g_markup_parse_context_get_position (context, - &line_number, &char_number); - g_set_error (error, - G_MARKUP_ERROR, - G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, - _("Unknown attribute '%s' on line %d char %d"), - attribute_names[i], - line_number, char_number); - return; - } + else if (!strcmp (attribute_names[i], "accelerators")) + { + accelerators = !strcmp (attribute_values[i], "true"); + } + /* else silently skip unknown attributes to be compatible with + * future additional attributes. + */ } /* Work out a name for this node. Either the name attribute, or @@ -1337,6 +1332,9 @@ node_name, strlen (node_name), NODE_TYPE_POPUP, TRUE, FALSE); + + NODE_INFO (ctx->current)->popup_accels = accelerators; + if (NODE_INFO (ctx->current)->action_name == 0) NODE_INFO (ctx->current)->action_name = action_quark; @@ -1789,6 +1787,7 @@ node_type = NODE_TYPE_TOOLBAR; break; case GTK_UI_MANAGER_POPUP: + case GTK_UI_MANAGER_POPUP_WITH_ACCELS: node_type = NODE_TYPE_POPUP; break; case GTK_UI_MANAGER_ACCELERATOR: @@ -1813,6 +1812,9 @@ name, name ? strlen (name) : 0, node_type, TRUE, top); + if (type == GTK_UI_MANAGER_POPUP_WITH_ACCELS) + NODE_INFO (child)->popup_accels = TRUE; + if (action != NULL) action_quark = g_quark_from_string (action); @@ -2189,7 +2191,8 @@ static void update_node (GtkUIManager *self, GNode *node, - gboolean in_popup) + gboolean in_popup, + gboolean popup_accels) { Node *info; GNode *child; @@ -2209,7 +2212,11 @@ if (!info->dirty) return; - in_popup = in_popup || (info->type == NODE_TYPE_POPUP); + if (info->type == NODE_TYPE_POPUP) + { + in_popup = TRUE; + popup_accels = info->popup_accels; + } #ifdef DEBUG_UI_MANAGER g_print ("update_node name=%s dirty=%d popup %d (", @@ -2566,7 +2573,7 @@ { g_signal_connect (info->proxy, "notify::visible", G_CALLBACK (update_smart_separators), NULL); - if (in_popup) + if (in_popup && !popup_accels) { /* don't show accels in popups */ GtkWidget *label = GTK_BIN (info->proxy)->child; @@ -2705,7 +2712,7 @@ current = child; child = current->next; - update_node (self, current, in_popup); + update_node (self, current, in_popup, popup_accels); } if (info->proxy) @@ -2747,7 +2754,7 @@ * the proxy is reconnected to the new action (or a new proxy widget * is created and added to the parent container). */ - update_node (self, self->private_data->root_node, FALSE); + update_node (self, self->private_data->root_node, FALSE, FALSE); self->private_data->update_tag = 0; Modified: projects/haf/trunk/gtk+/gtk/gtkuimanager.h =================================================================== --- projects/haf/trunk/gtk+/gtk/gtkuimanager.h 2008-10-08 14:39:16 UTC (rev 16378) +++ projects/haf/trunk/gtk+/gtk/gtkuimanager.h 2008-10-09 09:18:23 UTC (rev 16379) @@ -90,16 +90,17 @@ }; typedef enum { - GTK_UI_MANAGER_AUTO = 0, - GTK_UI_MANAGER_MENUBAR = 1 << 0, - GTK_UI_MANAGER_MENU = 1 << 1, - GTK_UI_MANAGER_TOOLBAR = 1 << 2, - GTK_UI_MANAGER_PLACEHOLDER = 1 << 3, - GTK_UI_MANAGER_POPUP = 1 << 4, - GTK_UI_MANAGER_MENUITEM = 1 << 5, - GTK_UI_MANAGER_TOOLITEM = 1 << 6, - GTK_UI_MANAGER_SEPARATOR = 1 << 7, - GTK_UI_MANAGER_ACCELERATOR = 1 << 8 + GTK_UI_MANAGER_AUTO = 0, + GTK_UI_MANAGER_MENUBAR = 1 << 0, + GTK_UI_MANAGER_MENU = 1 << 1, + GTK_UI_MANAGER_TOOLBAR = 1 << 2, + GTK_UI_MANAGER_PLACEHOLDER = 1 << 3, + GTK_UI_MANAGER_POPUP = 1 << 4, + GTK_UI_MANAGER_MENUITEM = 1 << 5, + GTK_UI_MANAGER_TOOLITEM = 1 << 6, + GTK_UI_MANAGER_SEPARATOR = 1 << 7, + GTK_UI_MANAGER_ACCELERATOR = 1 << 8, + GTK_UI_MANAGER_POPUP_WITH_ACCELS = 1 << 9 } GtkUIManagerItemType; #ifdef G_OS_WIN32
- Previous message: [maemo-commits] r16378 - projects/haf/trunk/hildon-thumbnail/thumbs
- Next message: [maemo-commits] r16381 - in projects/haf/trunk/osso-af-startup: debian top-scripts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]