Commit 0820b385 authored by Christian Persch's avatar Christian Persch Committed by Christian Persch

all: Port to GMenu

Port from GtkAction and GtkMenuManager to GAction and GMenu.

(Initial patch by Lars Uebernickel <lars.uebernickel@canonical.com>)

https://bugzilla.gnome.org/show_bug.cgi?id=745329
parent 42fbb7e0
...@@ -13,6 +13,8 @@ AC_CONFIG_MACRO_DIR([m4]) ...@@ -13,6 +13,8 @@ AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-bzip2]) AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-bzip2])
AC_USE_SYSTEM_EXTENSIONS
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
GETTEXT_PACKAGE=gnome-terminal GETTEXT_PACKAGE=gnome-terminal
...@@ -26,7 +28,7 @@ AM_MAINTAINER_MODE([enable]) ...@@ -26,7 +28,7 @@ AM_MAINTAINER_MODE([enable])
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
AC_PROG_MKDIR_P AC_PROG_MKDIR_P
AC_PROG_CC AC_PROG_CC_C99
AC_ISC_POSIX AC_ISC_POSIX
AC_HEADER_STDC AC_HEADER_STDC
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
...@@ -294,7 +296,6 @@ CC_CHECK_FLAGS_APPEND([WARN_CFLAGS],[CFLAGS],[ \ ...@@ -294,7 +296,6 @@ CC_CHECK_FLAGS_APPEND([WARN_CFLAGS],[CFLAGS],[ \
-Wall \ -Wall \
-Wcast-align \ -Wcast-align \
-Wendif-labels \ -Wendif-labels \
-Werror=declaration-after-statement \
"-Werror=format=2 -Werror=format-nonliteral -Werror=format-security" \ "-Werror=format=2 -Werror=format-nonliteral -Werror=format-security" \
-Werror=implicit-function-declaration \ -Werror=implicit-function-declaration \
-Werror=init-self \ -Werror=init-self \
......
...@@ -61,6 +61,8 @@ gnome_terminal_server_SOURCES = \ ...@@ -61,6 +61,8 @@ gnome_terminal_server_SOURCES = \
terminal-libgsystem.h \ terminal-libgsystem.h \
terminal-mdi-container.c \ terminal-mdi-container.c \
terminal-mdi-container.h \ terminal-mdi-container.h \
terminal-menu-button.h \
terminal-menu-button.c \
terminal-notebook.c \ terminal-notebook.c \
terminal-notebook.h \ terminal-notebook.h \
terminal-pcre2.h \ terminal-pcre2.h \
...@@ -80,8 +82,6 @@ gnome_terminal_server_SOURCES = \ ...@@ -80,8 +82,6 @@ gnome_terminal_server_SOURCES = \
terminal-search-popover.h \ terminal-search-popover.h \
terminal-tab-label.c \ terminal-tab-label.c \
terminal-tab-label.h \ terminal-tab-label.h \
terminal-tabs-menu.c \
terminal-tabs-menu.h \
terminal-util.c \ terminal-util.c \
terminal-util.h \ terminal-util.h \
terminal-version.h \ terminal-version.h \
...@@ -94,7 +94,6 @@ nodist_gnome_terminal_server_SOURCES = $(gnome_terminal_server_built) ...@@ -94,7 +94,6 @@ nodist_gnome_terminal_server_SOURCES = $(gnome_terminal_server_built)
gnome_terminal_server_CPPFLAGS = \ gnome_terminal_server_CPPFLAGS = \
-DTERMINAL_COMPILATION \ -DTERMINAL_COMPILATION \
-DTERM_LOCALEDIR="\"$(datadir)/locale\"" \ -DTERM_LOCALEDIR="\"$(datadir)/locale\"" \
-DTERM_HELPDIR="\"$(HELP_DIR)\"" \
-DTERM_LIBEXECDIR="\"$(libexecdir)\"" \ -DTERM_LIBEXECDIR="\"$(libexecdir)\"" \
$(AM_CPPFLAGS) $(AM_CPPFLAGS)
...@@ -416,7 +415,6 @@ CLEANFILES = \ ...@@ -416,7 +415,6 @@ CLEANFILES = \
EXTRA_DIST = \ EXTRA_DIST = \
terminal.about \ terminal.about \
terminal.xml \
terminal-menus.ui \ terminal-menus.ui \
terminal-window.ui \ terminal-window.ui \
terminal.gresource.xml \ terminal.gresource.xml \
......
...@@ -205,6 +205,7 @@ migrate_string (GConfClient *client, ...@@ -205,6 +205,7 @@ migrate_string (GConfClient *client,
gconf_value_free (value); gconf_value_free (value);
} }
#if 0
static void static void
migrate_string_list (GConfClient *client, migrate_string_list (GConfClient *client,
const char *gconf_path, const char *gconf_path,
...@@ -235,6 +236,7 @@ migrate_string_list (GConfClient *client, ...@@ -235,6 +236,7 @@ migrate_string_list (GConfClient *client,
if (value) if (value)
gconf_value_free (value); gconf_value_free (value);
} }
#endif
static void static void
migrate_enum (GConfClient *client, migrate_enum (GConfClient *client,
...@@ -328,8 +330,6 @@ migrate_global_prefs (GSettings *settings, ...@@ -328,8 +330,6 @@ migrate_global_prefs (GSettings *settings,
migrate_bool (client, GCONF_GLOBAL_PREFIX, "use_menu_accelerator", migrate_bool (client, GCONF_GLOBAL_PREFIX, "use_menu_accelerator",
settings, TERMINAL_SETTING_ENABLE_MENU_BAR_ACCEL_KEY, settings, TERMINAL_SETTING_ENABLE_MENU_BAR_ACCEL_KEY,
FALSE); FALSE);
migrate_string_list (client, GCONF_GLOBAL_PREFIX, "active_encodings",
settings, TERMINAL_SETTING_ENCODINGS_KEY);
g_object_unref (client); g_object_unref (client);
......
...@@ -310,7 +310,11 @@ ...@@ -310,7 +310,11 @@
<choice value="ISO-8859-14" /> <choice value="ISO-8859-14" />
<choice value="ISO-8859-15" /> <choice value="ISO-8859-15" />
<choice value="ISO-8859-16" /> <choice value="ISO-8859-16" />
<!-- <choice value="UTF-7" /> -->
<choice value="UTF-8" /> <choice value="UTF-8" />
<!-- <choice value="UTF-16" /> -->
<!-- <choice value="UTF-32" /> -->
<!-- <choice value="UCS-4" /> -->
<choice value="ARMSCII-8" /> <choice value="ARMSCII-8" />
<choice value="BIG5" /> <choice value="BIG5" />
<choice value="BIG5-HKSCS" /> <choice value="BIG5-HKSCS" />
...@@ -331,6 +335,7 @@ ...@@ -331,6 +335,7 @@
<choice value="ISO-2022-JP" /> <choice value="ISO-2022-JP" />
<choice value="ISO-2022-KR" /> <choice value="ISO-2022-KR" />
<choice value="ISO-IR-111" /> <choice value="ISO-IR-111" />
<!-- <choice value="JOHAB" /> -->
<choice value="KOI8-R" /> <choice value="KOI8-R" />
<choice value="KOI8-U" /> <choice value="KOI8-U" />
<choice value="MAC_ARABIC" /> <choice value="MAC_ARABIC" />
...@@ -391,6 +396,14 @@ ...@@ -391,6 +396,14 @@
<default>'disabled'</default> <default>'disabled'</default>
<summary>Keyboard shortcut to save the current tab contents to file</summary> <summary>Keyboard shortcut to save the current tab contents to file</summary>
</key> </key>
<key name="export" type="s">
<default>'disabled'</default>
<summary>Keyboard shortcut to export the current tab contents to file in various formats</summary>
</key>
<key name="print" type="s">
<default>'disabled'</default>
<summary>Keyboard shortcut to print the current tab contents to printer or file</summary>
</key>
<key name="close-tab" type="s"> <key name="close-tab" type="s">
<default>'&lt;Ctrl&gt;&lt;Shift&gt;w'</default> <default>'&lt;Ctrl&gt;&lt;Shift&gt;w'</default>
<summary>Keyboard shortcut to close a tab</summary> <summary>Keyboard shortcut to close a tab</summary>
...@@ -619,6 +632,10 @@ ...@@ -619,6 +632,10 @@
<default>'disabled'</default> <default>'disabled'</default>
<summary>Keyboard shortcut to switch to the numbered tab</summary> <summary>Keyboard shortcut to switch to the numbered tab</summary>
</key> </key>
<key name="switch-to-tab-last" type="s">
<default>'disabled'</default>
<summary>Keyboard shortcut to switch to the last tab</summary>
</key>
<key name="help" type="s"> <key name="help" type="s">
<default>'F1'</default> <default>'F1'</default>
<summary>Keyboard shortcut to launch help</summary> <summary>Keyboard shortcut to launch help</summary>
...@@ -677,21 +694,9 @@ ...@@ -677,21 +694,9 @@
<summary>Whether the shell integration is enabled</summary> <summary>Whether the shell integration is enabled</summary>
</key> </key>
<!-- This one is deprecated and unused -->
<key name="encodings" type="as"> <key name="encodings" type="as">
<!-- Translators: Please note that this has to be a list of
valid encodings (which are to be taken from the list in src/encoding.c).
It has to include UTF-8 the list entries themselves are not to be
translated. This is provided for customization of the default encoding
menu; see bug 144810 for an use case. In most cases, this should be
left alone.
-->
<default>["UTF-8"]</default> <default>["UTF-8"]</default>
<summary>List of available encodings</summary>
<description>
A subset of possible encodings are presented in
the Encoding submenu. This is a list of encodings
to appear there.
</description>
</key> </key>
<key name="confirm-close" type="b"> <key name="confirm-close" type="b">
......
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="label480"> <object class="GtkLabel" id="new-terminal-mode-label">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
...@@ -429,75 +429,6 @@ ...@@ -429,75 +429,6 @@
<property name="tab_fill">False</property> <property name="tab_fill">False</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox" id="encodings">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="encodings-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">E_ncodings shown in menu:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">encodings-treeview</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="encodings-treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscroll_policy">natural</property>
<property name="vscroll_policy">natural</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="rules_hint">True</property>
<property name="enable_search">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
<accessibility>
<relation type="labelled-by" target="encodings-label"/>
</accessibility>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Encodings</property>
</object>
<packing>
<property name="position">3</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* /*
* Copyright © 2002 Havoc Pennington * Copyright © 2002 Havoc Pennington
* Copyright © 2002 Mathias Hasselmann * Copyright © 2002 Mathias Hasselmann
* Copyright © 2008, 2011 Christian Persch * Copyright © 2008, 2011, 2017 Christian Persch
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <gio/gio.h> #include <gio/gio.h>
#include "terminal-app.h" #include "terminal-app.h"
#include "terminal-encoding.h"
#include "terminal-enums.h" #include "terminal-enums.h"
#include "profile-editor.h" #include "profile-editor.h"
#include "terminal-schemas.h" #include "terminal-schemas.h"
...@@ -486,55 +487,36 @@ init_color_scheme_menu (GtkWidget *widget) ...@@ -486,55 +487,36 @@ init_color_scheme_menu (GtkWidget *widget)
} }
enum { enum {
ENCODINGS_COLUMN_ID, ENCODINGS_COLUMN_ID = 0,
ENCODINGS_COLUMN_MARKUP ENCODINGS_COLUMN_TEXT = 1
}; };
static void static void
init_encodings_combo (GtkWidget *widget) init_encodings_combo (GtkWidget *widget)
{ {
GtkCellRenderer *renderer; gs_unref_object GtkListStore *store = terminal_encodings_list_store_new (ENCODINGS_COLUMN_ID,
GHashTableIter ht_iter; ENCODINGS_COLUMN_TEXT);
gpointer key, value;
gs_unref_object GtkListStore *store;
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
g_hash_table_iter_init (&ht_iter, terminal_app_get_encodings (terminal_app_get ()));
while (g_hash_table_iter_next (&ht_iter, &key, &value)) {
TerminalEncoding *encoding = value;
GtkTreeIter iter;
gs_free char *name;
name = g_markup_printf_escaped ("%s <span size=\"small\">%s</span>",
terminal_encoding_get_charset (encoding),
encoding->name);
gtk_list_store_insert_with_values (store, &iter, -1,
ENCODINGS_COLUMN_MARKUP, name,
ENCODINGS_COLUMN_ID, terminal_encoding_get_charset (encoding),
-1);
}
/* Now turn on sorting */ /* Now turn on sorting */
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
ENCODINGS_COLUMN_MARKUP, ENCODINGS_COLUMN_TEXT,
GTK_SORT_ASCENDING); GTK_SORT_ASCENDING);
gtk_combo_box_set_id_column (GTK_COMBO_BOX (widget), ENCODINGS_COLUMN_ID); gtk_combo_box_set_id_column (GTK_COMBO_BOX (widget), ENCODINGS_COLUMN_ID);
gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store)); gtk_combo_box_set_model (GTK_COMBO_BOX (widget), GTK_TREE_MODEL (store));
/* Cell renderer */ /* Cell renderer */
renderer = gtk_cell_renderer_text_new (); GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget), renderer, TRUE); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget), renderer, gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget), renderer,
"markup", ENCODINGS_COLUMN_MARKUP, NULL); "text", ENCODINGS_COLUMN_TEXT, NULL);
} }
static void static void
editor_help_button_clicked_cb (GtkWidget *button, editor_help_button_clicked_cb (GtkWidget *button,
GtkWidget *editor) GtkWidget *editor)
{ {
terminal_util_show_help ("profile", GTK_WINDOW (editor)); terminal_util_show_help ("profile");
} }
static void static void
...@@ -799,7 +781,6 @@ fixup_color_chooser_button (void) ...@@ -799,7 +781,6 @@ fixup_color_chooser_button (void)
/** /**
* terminal_profile_edit: * terminal_profile_edit:
* @profile: a #GSettings * @profile: a #GSettings
* @transient_parent: a #GtkWindow, or %NULL
* @widget_name: a widget name in the profile editor's UI, or %NULL * @widget_name: a widget name in the profile editor's UI, or %NULL
* *
* Shows the profile editor with @profile, anchored to @transient_parent. * Shows the profile editor with @profile, anchored to @transient_parent.
...@@ -808,7 +789,6 @@ fixup_color_chooser_button (void) ...@@ -808,7 +789,6 @@ fixup_color_chooser_button (void)
*/ */
void void
terminal_profile_edit (GSettings *profile, terminal_profile_edit (GSettings *profile,
GtkWindow *transient_parent,
const char *widget_name) const char *widget_name)
{ {
TerminalSettingsList *profiles_list; TerminalSettingsList *profiles_list;
...@@ -823,8 +803,6 @@ terminal_profile_edit (GSettings *profile, ...@@ -823,8 +803,6 @@ terminal_profile_edit (GSettings *profile,
{ {
terminal_util_dialog_focus_widget (editor, widget_name); terminal_util_dialog_focus_widget (editor, widget_name);
gtk_window_set_transient_for (GTK_WINDOW (editor),
GTK_WINDOW (transient_parent));
gtk_window_present (GTK_WINDOW (editor)); gtk_window_present (GTK_WINDOW (editor));
return; return;
} }
...@@ -1220,7 +1198,5 @@ terminal_profile_edit (GSettings *profile, ...@@ -1220,7 +1198,5 @@ terminal_profile_edit (GSettings *profile,
terminal_util_dialog_focus_widget (editor, widget_name); terminal_util_dialog_focus_widget (editor, widget_name);
gtk_window_set_transient_for (GTK_WINDOW (editor),
GTK_WINDOW (transient_parent));
gtk_window_present (GTK_WINDOW (editor)); gtk_window_present (GTK_WINDOW (editor));
} }
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
G_BEGIN_DECLS G_BEGIN_DECLS
void terminal_profile_edit (GSettings *profile, void terminal_profile_edit (GSettings *profile,
GtkWindow *transient_parent,
const char *widget_name); const char *widget_name);
G_END_DECLS G_END_DECLS
......
...@@ -100,13 +100,11 @@ increase_rlimit_nofile (void) ...@@ -100,13 +100,11 @@ increase_rlimit_nofile (void)
return TRUE; return TRUE;
} }
int static int
main (int argc, char **argv) init_server (int argc,
char *argv[],
GApplication **application)
{ {
gs_unref_object GApplication *app = NULL;
const char *home_dir, *charset;
GError *error = NULL;
if (G_UNLIKELY ((getuid () != geteuid () || if (G_UNLIKELY ((getuid () != geteuid () ||
getgid () != getegid ()) && getgid () != getegid ()) &&
geteuid () == 0 && geteuid () == 0 &&
...@@ -121,7 +119,7 @@ main (int argc, char **argv) ...@@ -121,7 +119,7 @@ main (int argc, char **argv)
} }
terminal_i18n_init (TRUE); terminal_i18n_init (TRUE);
const char *charset;
if (!g_get_charset (&charset)) { if (!g_get_charset (&charset)) {
g_printerr ("Non UTF-8 locale (%s) is not supported!\n", charset); g_printerr ("Non UTF-8 locale (%s) is not supported!\n", charset);
return _EXIT_FAILURE_NO_UTF8; return _EXIT_FAILURE_NO_UTF8;
...@@ -134,36 +132,38 @@ main (int argc, char **argv) ...@@ -134,36 +132,38 @@ main (int argc, char **argv)
if (g_getenv ("G_ENABLE_DIAGNOSTIC") == NULL) if (g_getenv ("G_ENABLE_DIAGNOSTIC") == NULL)
g_setenv ("G_ENABLE_DIAGNOSTIC", "0", TRUE); g_setenv ("G_ENABLE_DIAGNOSTIC", "0", TRUE);
#ifndef ENABLE_DISTRO_PACKAGING
#ifdef HAVE_UBUNTU #ifdef HAVE_UBUNTU
#ifndef ENABLE_DISTRO_PACKAGING
/* Set some env vars to disable the ubuntu modules. Their package will be /* Set some env vars to disable the ubuntu modules. Their package will be
* built using --enable-distro-packaging, but anyone running from git will * built using --enable-distro-packaging, but anyone running from git will
* get the right behaviour. * get the right behaviour.
*/ */
g_setenv ("LIBOVERLAY_SCROLLBAR", "0", TRUE); g_setenv ("LIBOVERLAY_SCROLLBAR", "0", TRUE);
#endif
g_setenv ("UBUNTU_MENUPROXY", "0", TRUE); g_setenv ("UBUNTU_MENUPROXY", "0", TRUE);
g_setenv ("NO_UNITY_GTK_MODULE", "1", TRUE); g_setenv ("NO_UNITY_GTK_MODULE", "1", TRUE);
#endif
#endif #endif
_terminal_debug_init (); _terminal_debug_init ();
// FIXMEchpe: just use / here but make sure #565328 doesn't regress
/* Change directory to $HOME so we don't prevent unmounting, e.g. if the /* Change directory to $HOME so we don't prevent unmounting, e.g. if the
* factory is started by nautilus-open-terminal. See bug #565328. * factory is started by nautilus-open-terminal. See bug #565328.
* On failure back to /. * On failure back to /.
*/ */
home_dir = g_get_home_dir (); const char *home_dir = g_get_home_dir ();
if (home_dir == NULL || chdir (home_dir) < 0) if (home_dir == NULL || chdir (home_dir) < 0)
(void) chdir ("/"); (void) chdir ("/");
g_set_prgname ("gnome-terminal-server"); g_set_prgname ("gnome-terminal-server");
g_set_application_name (_("Terminal")); g_set_application_name (_("Terminal"));
GError *error = NULL;
if (!gtk_init_with_args (&argc, &argv, NULL, options, NULL, &error)) { if (!gtk_init_with_args (&argc, &argv, NULL, options, NULL, &error)) {
g_printerr ("Failed to parse arguments: %s\n", error->message); if (error != NULL) {
g_error_free (error); g_printerr ("Failed to parse arguments: %s\n", error->message);
exit (_EXIT_FAILURE_GTK_INIT); g_error_free (error);
}
return _EXIT_FAILURE_GTK_INIT;
} }
if (!increase_rlimit_nofile ()) { if (!increase_rlimit_nofile ()) {
...@@ -171,11 +171,25 @@ main (int argc, char **argv) ...@@ -171,11 +171,25 @@ main (int argc, char **argv)
} }
/* Now we can create the app */ /* Now we can create the app */
app = terminal_app_new (app_id); GApplication *app = terminal_app_new (app_id);
g_free (app_id); g_free (app_id);
app_id = NULL;
/* We stay around a bit after the last window closed */ /* We stay around a bit after the last window closed */
g_application_set_inactivity_timeout (app, INACTIVITY_TIMEOUT); g_application_set_inactivity_timeout (app, INACTIVITY_TIMEOUT);
*application = app;
return 0;
}
int
main (int argc,
char *argv[])
{
gs_unref_object GApplication *app = NULL;
int r = init_server (argc, argv, &app);
if (r != 0)
return r;
return g_application_run (app, 0, NULL); return g_application_run (app, 0, NULL);
} }
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#define KEY_COPY "copy" #define KEY_COPY "copy"
#define KEY_COPY_HTML "copy-html" #define KEY_COPY_HTML "copy-html"
#define KEY_DETACH_TAB "detach-tab" #define KEY_DETACH_TAB "detach-tab"
#define KEY_EXPORT "export"
#define KEY_FIND "find" #define KEY_FIND "find"
#define KEY_FIND_CLEAR "find-clear" #define KEY_FIND_CLEAR "find-clear"
#define KEY_FIND_PREV "find-previous" #define KEY_FIND_PREV "find-previous"
...@@ -69,6 +70,7 @@ ...@@ -69,6 +70,7 @@
#define KEY_PASTE "paste" #define KEY_PASTE "paste"
#define KEY_PREFERENCES "preferences" #define KEY_PREFERENCES "preferences"
#define KEY_PREV_TAB "prev-tab" #define KEY_PREV_TAB "prev-tab"
#define KEY_PRINT "print"
#define KEY_PROFILE_PREFERENCES "profile-preferences" #define KEY_PROFILE_PREFERENCES "profile-preferences"
#define KEY_READ_ONLY "read-only" #define KEY_READ_ONLY "read-only"
#define KEY_RESET_AND_CLEAR "reset-and-clear" #define KEY_RESET_AND_CLEAR "reset-and-clear"
...@@ -81,40 +83,6 @@ ...@@ -81,40 +83,6 @@
#define KEY_ZOOM_OUT "zoom-out" #define KEY_ZOOM_OUT "zoom-out"
#define KEY_SWITCH_TAB_PREFIX "switch-to-tab-" #define KEY_SWITCH_TAB_PREFIX "switch-to-tab-"
/* Accel paths for the gtkuimanager based menus */
#define ACCEL_PATH_ROOT "<Actions>/Main/"
#define ACCEL_PATH_KEY_CLOSE_TAB ACCEL_PATH_ROOT "FileCloseTab"
#define ACCEL_PATH_KEY_CLOSE_WINDOW ACCEL_PATH_ROOT "FileCloseWindow"
#define ACCEL_PATH_KEY_COPY ACCEL_PATH_ROOT "EditCopy"
#define ACCEL_PATH_KEY_COPY_HTML ACCEL_PATH_ROOT "EditCopyHtml"
#define ACCEL_PATH_KEY_DETACH_TAB ACCEL_PATH_ROOT "TabsDetach"
#define ACCEL_PATH_KEY_FIND ACCEL_PATH_ROOT "SearchFind"
#define ACCEL_PATH_KEY_FIND_CLEAR ACCEL_PATH_ROOT "SearchClearHighlight"
#define ACCEL_PATH_KEY_FIND_PREV ACCEL_PATH_ROOT "SearchFindPrevious"
#define ACCEL_PATH_KEY_FIND_NEXT ACCEL_PATH_ROOT "SearchFindNext"
#define ACCEL_PATH_KEY_FULL_SCREEN ACCEL_PATH_ROOT "ViewFullscreen"
#define ACCEL_PATH_KEY_HELP ACCEL_PATH_ROOT "HelpContents"
#define ACCEL_PATH_KEY_MOVE_TAB_LEFT ACCEL_PATH_ROOT "TabsMoveLeft"
#define ACCEL_PATH_KEY_MOVE_TAB_RIGHT ACCEL_PATH_ROOT "TabsMoveRight"
#define ACCEL_PATH_KEY_NEW_PROFILE ACCEL_PATH_ROOT "FileNewProfile"
#define ACCEL_PATH_KEY_NEW_TAB ACCEL_PATH_ROOT "FileNewTab"
#define ACCEL_PATH_KEY_NEW_WINDOW ACCEL_PATH_ROOT "FileNewWindow"
#define ACCEL_PATH_KEY_NEXT_TAB ACCEL_PATH_ROOT "TabsNext"
#define ACCEL_PATH_KEY_PASTE ACCEL_PATH_ROOT "EditPaste"
#define ACCEL_PATH_KEY_PREFERENCES ACCEL_PATH_ROOT "EditPreferences"
#define ACCEL_PATH_KEY_PREV_TAB ACCEL_PATH_ROOT "TabsPrevious"
#define ACCEL_PATH_KEY_PROFILE_PREFERENCES ACCEL_PATH_ROOT "EditCurrentProfile"
#define ACCEL_PATH_KEY_READ_ONLY ACCEL_PATH_ROOT "TerminalReadOnly"
#define ACCEL_PATH_KEY_RESET ACCEL_PATH_ROOT "TerminalReset"
#define ACCEL_PATH_KEY_RESET_AND_CLEAR ACCEL_PATH_ROOT "TerminalResetClear"
#define ACCEL_PATH_KEY_SAVE_CONTENTS ACCEL_PATH_ROOT "FileSaveContents"
#define ACCEL_PATH_KEY_SELECT_ALL ACCEL_PATH_ROOT "EditSelectAll"
#define ACCEL_PATH_KEY_TOGGLE_MENUBAR ACCEL_PATH_ROOT "ViewMenubar"
#define ACCEL_PATH_KEY_ZOOM_IN ACCEL_PATH_ROOT "ViewZoomIn"
#define ACCEL_PATH_KEY_ZOOM_NORMAL ACCEL_PATH_ROOT "ViewZoom100"
#define ACCEL_PATH_KEY_ZOOM_OUT ACCEL_PATH_ROOT "ViewZoomOut"
#define ACCEL_PATH_KEY_SWITCH_TAB_PREFIX ACCEL_PATH_ROOT "TabsSwitch"
#if 1 #if 1
/* /*
* We don't want to enable content saving until vte supports it async. * We don't want to enable content saving until vte supports it async.
...@@ -137,11 +105,7 @@ typedef struct ...@@ -137,11 +105,7 @@ typedef struct
const GVariantType *action_parameter_type; const GVariantType *action_parameter_type;
const char *action_parameter; const char *action_parameter;
GVariant *parameter; GVariant *parameter;
gboolean installed; const char *shadow_action_name;
#if 1
/* Legacy gtkuimanager menu accelerator */
const char *legacy_accel_path;
#endif
} KeyEntry; } KeyEntry;
typedef struct typedef struct
...@@ -151,42 +115,52 @@ typedef struct ...@@ -151,42 +115,52 @@ typedef struct
const char *user_visible_name; const char *user_visible_name;
} KeyEntryList; } KeyEntryList;
#define ENTRY_FULL(name, key, action, type, parameter, shadow_name) \
{ name, key, "win." action, (const GVariantType *) type, parameter, NULL, shadow_name }
#define ENTRY(name, key, action, type, parameter) \ #define ENTRY(name, key, action, type, parameter) \
{ name, key, "win." action, (const GVariantType *) type, parameter, NULL, FALSE, ACCEL_PATH_##key } ENTRY_FULL (name, key, action, type, parameter, "win.shadow")
#define ENTRY_MDI(name, key, action, type, parameter) \
ENTRY_FULL (name, key, action, type, parameter, "win.shadow-mdi")
static KeyEntry file_entries[] = { static KeyEntry file_entries[] = {
ENTRY (N_("New Terminal in New Tab"), KEY_NEW_TAB, "new-terminal", "(ss)", "('tab','current')" ), ENTRY (N_("New Tab"), KEY_NEW_TAB, "new-terminal", "(ss)", "('tab','current')" ),
ENTRY (N_("New Terminal in New Window"), KEY_NEW_WINDOW, "new-terminal", "(ss)", "('window','current')"), ENTRY (N_("New Window"), KEY_NEW_WINDOW, "new-terminal", "(ss)", "('window','current')"),
ENTRY (N_("New Profile"), KEY_NEW_PROFILE, "new-profile", NULL, NULL ), ENTRY (N_("New Profile"), KEY_NEW_PROFILE, "new-profile", NULL, NULL ),
#ifdef ENABLE_SAVE #ifdef ENABLE_SAVE
ENTRY (N_("Save Contents"), KEY_SAVE_CONTENTS, "save-contents", NULL, NULL ), ENTRY (N_("Save Contents"), KEY_SAVE_CONTENTS, "save-contents", NULL, NULL ),
#endif
#ifdef ENABLE_EXPORT
ENTRY (N_("Export"), KEY_EXPORT, "export", NULL, NULL ),
#endif #endif
ENTRY (N_("Close Terminal"), KEY_CLOSE_TAB, "close", "s", "'tab'" ), #ifdef ENABLE_PRINT
ENTRY (N_("Clo