summaryrefslogtreecommitdiff
path: root/gtk/gtkmodelmenuitem.c
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2013-03-22 17:24:46 -0400
committerRyan Lortie <desrt@desrt.ca>2013-04-01 16:45:19 -0400
commit5617b584202b1f967f287dfd03a4560975f1389b (patch)
tree293e53b55dad608d229ee0e59b81498a1c8f100b /gtk/gtkmodelmenuitem.c
parente250e52175d5f62e99c7491d95923ad521e1421c (diff)
downloadgtk+-5617b584202b1f967f287dfd03a4560975f1389b.tar.gz
Introduce GtkMenuTracker
GtkMenuTracker folds a nested structure of sections in a GMenuModel into a single linear menu, which it expresses to its user by means of 'insert item at position' and 'remove item at position' callbacks. The logic for where to insert separators and how to handle action namespaces is contained within the tracker, removing the need to have this logic duplicated in the 3 or 4 places that consume GMenuModel. In comparison with the previous code, the tracker no longer completely destroys and rebuilds menus every time a single change occurs. As a result, the new gtkmenu testcase now runs in approximately 3 seconds instead of ~60 before. https://bugzilla.gnome.org/show_bug.cgi?id=696468
Diffstat (limited to 'gtk/gtkmodelmenuitem.c')
-rw-r--r--gtk/gtkmodelmenuitem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gtk/gtkmodelmenuitem.c b/gtk/gtkmodelmenuitem.c
index 6d902c2352..a71f2ecbae 100644
--- a/gtk/gtkmodelmenuitem.c
+++ b/gtk/gtkmodelmenuitem.c
@@ -275,7 +275,7 @@ gtk_model_menu_item_class_init (GtkModelMenuItemClass *class)
0, 2, 0, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
}
-GtkMenuItem *
+GtkWidget *
gtk_model_menu_item_new (GMenuModel *model,
gint item_index,
const gchar *action_namespace)
@@ -286,5 +286,5 @@ gtk_model_menu_item_new (GMenuModel *model,
gtk_model_menu_item_setup (item, model, item_index, action_namespace);
- return GTK_MENU_ITEM (item);
+ return GTK_WIDGET (item);
}