mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
menus: add dashboard-menu with proper placeholder support.
This commit is contained in:
parent
987f86a218
commit
e800159847
5 changed files with 65 additions and 16 deletions
|
@ -5001,30 +5001,21 @@ void
|
||||||
gimp_dashboard_menu_setup (GimpUIManager *manager,
|
gimp_dashboard_menu_setup (GimpUIManager *manager,
|
||||||
const gchar *ui_path)
|
const gchar *ui_path)
|
||||||
{
|
{
|
||||||
guint merge_id;
|
|
||||||
Group group;
|
Group group;
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
|
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
|
||||||
g_return_if_fail (ui_path != NULL);
|
g_return_if_fail (ui_path != NULL);
|
||||||
|
|
||||||
merge_id = gimp_ui_manager_new_merge_id (manager);
|
|
||||||
|
|
||||||
for (group = FIRST_GROUP; group < N_GROUPS; group++)
|
for (group = FIRST_GROUP; group < N_GROUPS; group++)
|
||||||
{
|
{
|
||||||
const GroupInfo *group_info = &groups[group];
|
const GroupInfo *group_info = &groups[group];
|
||||||
gchar *action_name;
|
gchar *action_name;
|
||||||
gchar *action_path;
|
|
||||||
|
|
||||||
action_name = g_strdup_printf ("dashboard-group-%s", group_info->name);
|
action_name = g_strdup_printf ("dashboard-group-%s", group_info->name);
|
||||||
action_path = g_strdup_printf ("%s/Groups/Groups", ui_path);
|
|
||||||
|
|
||||||
/* TODO GMenu: for the "/dashboard-popup/Groups/" apparently. */
|
gimp_ui_manager_add_ui2 (manager, "/Dashboard Menu/Groups",
|
||||||
gimp_ui_manager_add_ui (manager, merge_id,
|
action_name, "Groups", FALSE);
|
||||||
action_path, action_name, action_name,
|
|
||||||
GTK_UI_MANAGER_MENUITEM,
|
|
||||||
FALSE);
|
|
||||||
|
|
||||||
g_free (action_name);
|
g_free (action_name);
|
||||||
g_free (action_path);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,10 @@ static gchar ** gimp_menu_shell_break_path (GimpMenuShell *
|
||||||
const gchar *path);
|
const gchar *path);
|
||||||
static gchar * gimp_menu_shell_make_canonical_path (const gchar *path);
|
static gchar * gimp_menu_shell_make_canonical_path (const gchar *path);
|
||||||
|
|
||||||
|
static gboolean gimp_menu_shell_copy_placeholders (gpointer key,
|
||||||
|
gpointer item,
|
||||||
|
GTree *placeholders);
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_INTERFACE (GimpMenuShell, gimp_menu_shell, GTK_TYPE_MENU_SHELL)
|
G_DEFINE_INTERFACE (GimpMenuShell, gimp_menu_shell, GTK_TYPE_MENU_SHELL)
|
||||||
|
|
||||||
|
@ -189,8 +193,12 @@ gimp_menu_shell_merge (GimpMenuShell *shell,
|
||||||
g_object_unref (item);
|
g_object_unref (item);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_list_free (children);
|
g_tree_foreach (GET_PRIVATE (shell2)->placeholders,
|
||||||
|
(GTraverseFunc) gimp_menu_shell_copy_placeholders,
|
||||||
|
GET_PRIVATE (shell)->placeholders);
|
||||||
|
|
||||||
gtk_widget_destroy (GTK_WIDGET (shell2));
|
gtk_widget_destroy (GTK_WIDGET (shell2));
|
||||||
|
g_list_free (children);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -877,3 +885,12 @@ gimp_menu_shell_make_canonical_path (const gchar *path)
|
||||||
|
|
||||||
return canon_path;
|
return canon_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gimp_menu_shell_copy_placeholders (gpointer key,
|
||||||
|
gpointer item,
|
||||||
|
GTree *placeholders)
|
||||||
|
{
|
||||||
|
g_tree_insert (placeholders, g_strdup ((gchar *) key), item);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
@ -742,7 +742,7 @@ gimp_ui_manager_ui_popup_at_widget (GimpUIManager *manager,
|
||||||
model = gimp_ui_manager_get_model (manager, ui_path);
|
model = gimp_ui_manager_get_model (manager, ui_path);
|
||||||
menu = gimp_menu_new (manager);
|
menu = gimp_menu_new (manager);
|
||||||
gtk_menu_attach_to_widget (GTK_MENU (menu), widget, NULL);
|
gtk_menu_attach_to_widget (GTK_MENU (menu), widget, NULL);
|
||||||
gimp_menu_shell_fill (GIMP_MENU_SHELL (menu), model, NULL, TRUE);
|
gimp_menu_shell_fill (GIMP_MENU_SHELL (menu), model, "ui-added", TRUE);
|
||||||
|
|
||||||
if (! menu)
|
if (! menu)
|
||||||
return;
|
return;
|
||||||
|
@ -755,7 +755,7 @@ gimp_ui_manager_ui_popup_at_widget (GimpUIManager *manager,
|
||||||
/* TODO GMenu: the "icon" attribute set in the .ui file should be visible. */
|
/* TODO GMenu: the "icon" attribute set in the .ui file should be visible. */
|
||||||
child_model = gimp_ui_manager_get_model (child_ui_manager, child_ui_path);
|
child_model = gimp_ui_manager_get_model (child_ui_manager, child_ui_path);
|
||||||
child_menu = gimp_menu_new (child_ui_manager);
|
child_menu = gimp_menu_new (child_ui_manager);
|
||||||
gimp_menu_shell_fill (GIMP_MENU_SHELL (child_menu), child_model, NULL, FALSE);
|
gimp_menu_shell_fill (GIMP_MENU_SHELL (child_menu), child_model, "ui-added", FALSE);
|
||||||
|
|
||||||
gimp_menu_shell_merge (GIMP_MENU_SHELL (menu), GIMP_MENU_SHELL (child_menu), TRUE);
|
gimp_menu_shell_merge (GIMP_MENU_SHELL (menu), GIMP_MENU_SHELL (child_menu), TRUE);
|
||||||
}
|
}
|
||||||
|
@ -795,7 +795,7 @@ gimp_ui_manager_ui_popup_at_pointer (GimpUIManager *manager,
|
||||||
model = gimp_ui_manager_get_model (manager, ui_path);
|
model = gimp_ui_manager_get_model (manager, ui_path);
|
||||||
menu = gimp_menu_new (manager);
|
menu = gimp_menu_new (manager);
|
||||||
gtk_menu_attach_to_widget (GTK_MENU (menu), attached_widget, NULL);
|
gtk_menu_attach_to_widget (GTK_MENU (menu), attached_widget, NULL);
|
||||||
gimp_menu_shell_fill (GIMP_MENU_SHELL (menu), model, NULL, TRUE);
|
gimp_menu_shell_fill (GIMP_MENU_SHELL (menu), model, "ui-added", TRUE);
|
||||||
|
|
||||||
if (! menu)
|
if (! menu)
|
||||||
return;
|
return;
|
||||||
|
@ -836,7 +836,7 @@ gimp_ui_manager_ui_popup_at_rect (GimpUIManager *manager,
|
||||||
model = gimp_ui_manager_get_model (manager, ui_path);
|
model = gimp_ui_manager_get_model (manager, ui_path);
|
||||||
menu = gimp_menu_new (manager);
|
menu = gimp_menu_new (manager);
|
||||||
gtk_menu_attach_to_widget (GTK_MENU (menu), attached_widget, NULL);
|
gtk_menu_attach_to_widget (GTK_MENU (menu), attached_widget, NULL);
|
||||||
gimp_menu_shell_fill (GIMP_MENU_SHELL (menu), model, NULL, TRUE);
|
gimp_menu_shell_fill (GIMP_MENU_SHELL (menu), model, "ui-added", TRUE);
|
||||||
|
|
||||||
if (! menu)
|
if (! menu)
|
||||||
return;
|
return;
|
||||||
|
|
40
menus/dashboard-menu.ui
Normal file
40
menus/dashboard-menu.ui
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<interface>
|
||||||
|
<menu id="/dashboard-popup">
|
||||||
|
<submenu>
|
||||||
|
<attribute name="label" translatable="yes" context="dashboard-action">Dashboard Menu</attribute>
|
||||||
|
<attribute name="icon">gimp-dashboard</attribute>
|
||||||
|
<submenu>
|
||||||
|
<attribute name="label" translatable="yes" context="dashboard-action">Groups</attribute>
|
||||||
|
<!-- Placeholder for recently used filters and plug-ins. -->
|
||||||
|
<item><attribute name="label" translatable="no">Groups</attribute></item>
|
||||||
|
</submenu>
|
||||||
|
<submenu>
|
||||||
|
<attribute name="label" translatable="yes" context="dashboard-action">_Update Interval</attribute>
|
||||||
|
<item><attribute name="action">app.dashboard-update-interval-0-25-sec</attribute></item>
|
||||||
|
<item><attribute name="action">app.dashboard-update-interval-0-5-sec</attribute></item>
|
||||||
|
<item><attribute name="action">app.dashboard-update-interval-1-sec</attribute></item>
|
||||||
|
<item><attribute name="action">app.dashboard-update-interval-2-sec</attribute></item>
|
||||||
|
<item><attribute name="action">app.dashboard-update-interval-4-sec</attribute></item>
|
||||||
|
</submenu>
|
||||||
|
<submenu>
|
||||||
|
<attribute name="label" translatable="yes" context="dashboard-action">_History Duration</attribute>
|
||||||
|
<item><attribute name="action">app.dashboard-history-duration-15-sec</attribute></item>
|
||||||
|
<item><attribute name="action">app.dashboard-history-duration-30-sec</attribute></item>
|
||||||
|
<item><attribute name="action">app.dashboard-history-duration-60-sec</attribute></item>
|
||||||
|
<item><attribute name="action">app.dashboard-history-duration-120-sec</attribute></item>
|
||||||
|
<item><attribute name="action">app.dashboard-history-duration-240-sec</attribute></item>
|
||||||
|
</submenu>
|
||||||
|
<section>
|
||||||
|
<item><attribute name="action">app.dashboard-log-record</attribute></item>
|
||||||
|
<item><attribute name="action">app.dashboard-log-add-marker</attribute></item>
|
||||||
|
<item><attribute name="action">app.dashboard-log-add-empty-marker</attribute></item>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<item><attribute name="action">app.dashboard-reset</attribute></item>
|
||||||
|
</section>
|
||||||
|
<item><attribute name="action">app.dashboard-low-swap-space-warning</attribute></item>
|
||||||
|
</submenu>
|
||||||
|
</menu>
|
||||||
|
</interface>
|
|
@ -44,6 +44,7 @@ ui_menus_files = files(
|
||||||
'buffers-menu.ui',
|
'buffers-menu.ui',
|
||||||
'channels-menu.ui',
|
'channels-menu.ui',
|
||||||
'colormap-menu.ui',
|
'colormap-menu.ui',
|
||||||
|
'dashboard-menu.ui',
|
||||||
'documents-menu.ui',
|
'documents-menu.ui',
|
||||||
'dynamics-menu.ui',
|
'dynamics-menu.ui',
|
||||||
'error-console-menu.ui',
|
'error-console-menu.ui',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue