Remove App menu
Related to https://gitlab.gnome.org/GNOME/Initiatives/issues/4
This commit is contained in:
@@ -1418,71 +1418,6 @@ shell_get_dialog_parent_cb (ECredentialsPrompter *prompter,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
shell_app_menu_activate_cb (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
EShell *shell = user_data;
|
||||
const gchar *name;
|
||||
|
||||
g_return_if_fail (G_IS_ACTION (action));
|
||||
g_return_if_fail (E_IS_SHELL (shell));
|
||||
|
||||
name = g_action_get_name (G_ACTION (action));
|
||||
g_return_if_fail (name != NULL);
|
||||
|
||||
if (g_str_equal (name, "new-window")) {
|
||||
shell_action_new_window_cb (action, parameter, shell);
|
||||
} else if (g_str_equal (name, "preferences")) {
|
||||
e_shell_utils_run_preferences (shell);
|
||||
} else if (g_str_equal (name, "help")) {
|
||||
e_shell_utils_run_help_contents (shell);
|
||||
} else if (g_str_equal (name, "about")) {
|
||||
e_shell_utils_run_help_about (shell);
|
||||
} else {
|
||||
g_warning ("%s: Unknown app-menu action '%s'", G_STRFUNC, name);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
shell_create_app_menu (GtkApplication *application)
|
||||
{
|
||||
const GActionEntry actions[] = {
|
||||
{ "new-window", shell_app_menu_activate_cb, NULL, NULL, NULL },
|
||||
{ "preferences", shell_app_menu_activate_cb, NULL, NULL, NULL },
|
||||
{ "help", shell_app_menu_activate_cb, NULL, NULL, NULL },
|
||||
{ "about", shell_app_menu_activate_cb, NULL, NULL, NULL }
|
||||
};
|
||||
GMenu *app_menu, *section;
|
||||
|
||||
g_return_if_fail (GTK_IS_APPLICATION (application));
|
||||
|
||||
app_menu = g_menu_new ();
|
||||
|
||||
section = g_menu_new ();
|
||||
g_menu_append (section, _("New _Window"), "app.new-window");
|
||||
g_menu_append_section (app_menu, NULL, G_MENU_MODEL (section));
|
||||
g_object_unref (section);
|
||||
|
||||
section = g_menu_new ();
|
||||
g_menu_append (section, _("_Preferences"), "app.preferences");
|
||||
g_menu_append_section (app_menu, NULL, G_MENU_MODEL (section));
|
||||
g_object_unref (section);
|
||||
|
||||
section = g_menu_new ();
|
||||
g_menu_append (section, _("_Help"), "app.help");
|
||||
g_menu_append (section, _("_About"), "app.about");
|
||||
g_menu_append (section, _("_Quit"), "app.quit");
|
||||
g_menu_append_section (app_menu, NULL, G_MENU_MODEL (section));
|
||||
g_object_unref (section);
|
||||
|
||||
gtk_application_set_app_menu (application, G_MENU_MODEL (app_menu));
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (application), actions, G_N_ELEMENTS (actions), application);
|
||||
|
||||
g_object_unref (app_menu);
|
||||
}
|
||||
|
||||
static void
|
||||
shell_sm_quit_cb (EShell *shell,
|
||||
gpointer user_data)
|
||||
@@ -1762,9 +1697,6 @@ shell_startup (GApplication *application)
|
||||
|
||||
/* Chain up to parent's startup() method. */
|
||||
G_APPLICATION_CLASS (e_shell_parent_class)->startup (application);
|
||||
|
||||
if (e_util_is_running_gnome ())
|
||||
shell_create_app_menu (GTK_APPLICATION (application));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user