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
This commit is contained in:
@ -34,7 +34,7 @@ G_GNUC_INTERNAL
|
||||
GType gtk_model_menu_item_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
GtkMenuItem * gtk_model_menu_item_new (GMenuModel *model,
|
||||
GtkWidget * gtk_model_menu_item_new (GMenuModel *model,
|
||||
gint item_index,
|
||||
const gchar *action_namespace);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user