summaryrefslogtreecommitdiff
path: root/gtk/gtkmenushellprivate.h
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/gtkmenushellprivate.h
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/gtkmenushellprivate.h')
-rw-r--r--gtk/gtkmenushellprivate.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gtk/gtkmenushellprivate.h b/gtk/gtkmenushellprivate.h
index 9ef04f3a21..40a858bd1c 100644
--- a/gtk/gtkmenushellprivate.h
+++ b/gtk/gtkmenushellprivate.h
@@ -22,7 +22,7 @@
#include <gtk/gtkmenushell.h>
#include <gtk/gtkmnemonichash.h>
#include <gtk/gtkkeyhash.h>
-
+#include <gtk/gtkmenutracker.h>
G_BEGIN_DECLS
@@ -38,6 +38,7 @@ struct _GtkMenuShellPrivate
GList *children;
GtkWidget *active_menu_item;
GtkWidget *parent_menu_shell;
+ GtkMenuTracker *tracker; // if bound to a GMenuModel
guint button;
guint32 activate_time;