[gnome-terminal] window: Remove encodings submenu
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] window: Remove encodings submenu
- Date: Sat, 2 Nov 2019 18:38:49 +0000 (UTC)
commit abf89f4cf3bc1de09388e3b411ee76e734e654c2
Author: Christian Persch <chpe src gnome org>
Date: Sat Nov 2 19:38:19 2019 +0100
window: Remove encodings submenu
Changing encoding is still supported by using the Compatibility section
in the profile Preferences.
Fixes: https://gitlab.gnome.org/GNOME/gnome-terminal/issues/49
src/terminal-app.c | 16 ----------
src/terminal-encoding.c | 75 ----------------------------------------------
src/terminal-encoding.h | 2 --
src/terminal-menubar.ui.in | 3 --
src/terminal-window.c | 54 ---------------------------------
5 files changed, 150 deletions(-)
---
diff --git a/src/terminal-app.c b/src/terminal-app.c
index db2eb6cd..bc04661e 100644
--- a/src/terminal-app.c
+++ b/src/terminal-app.c
@@ -107,12 +107,10 @@ struct _TerminalApp
GMenuModel *menubar;
GMenu *menubar_new_terminal_section;
GMenu *menubar_set_profile_section;
- GMenu *menubar_set_encoding_submenu;
GMenuModel *profilemenu;
GMenuModel *headermenu;
GMenu *headermenu_set_profile_section;
- GMenu *headermenu_set_encoding_submenu;
GMenu *set_profile_menu;
@@ -596,12 +594,8 @@ terminal_app_create_menubar (TerminalApp *app,
"menubar", &app->menubar,
"new-terminal-section", &app->menubar_new_terminal_section,
"set-profile-section", &app->menubar_set_profile_section,
- "set-encoding-submenu", &app->menubar_set_encoding_submenu,
NULL);
- /* Install the encodings submenu */
- terminal_encodings_append_menu (app->menubar_set_encoding_submenu);
-
/* Install profile sections */
terminal_app_update_profile_menus (app);
@@ -614,16 +608,8 @@ terminal_app_create_headermenu (TerminalApp *app)
terminal_util_load_objects_resource ("/org/gnome/terminal/ui/headerbar-menu.ui",
"headermenu", &app->headermenu,
"set-profile-section", &app->headermenu_set_profile_section,
-#if 0
- "set-encoding-submenu", &app->headermenu_set_encoding_submenu,
-#endif
NULL);
-#if 0
- /* Install the encodings submenu */
- terminal_encodings_append_menu (app->headermenu_set_encoding_submenu);
-#endif
-
/* Install profile sections */
terminal_app_update_profile_menus (app);
}
@@ -881,11 +867,9 @@ terminal_app_finalize (GObject *object)
g_clear_object (&app->menubar);
g_clear_object (&app->menubar_new_terminal_section);
g_clear_object (&app->menubar_set_profile_section);
- g_clear_object (&app->menubar_set_encoding_submenu);
g_clear_object (&app->profilemenu);
g_clear_object (&app->headermenu);
g_clear_object (&app->headermenu_set_profile_section);
- g_clear_object (&app->headermenu_set_encoding_submenu);
g_clear_object (&app->set_profile_menu);
terminal_accels_shutdown ();
diff --git a/src/terminal-encoding.c b/src/terminal-encoding.c
index 31c064d8..de99ab3f 100644
--- a/src/terminal-encoding.c
+++ b/src/terminal-encoding.c
@@ -35,9 +35,6 @@
/* Overview
*
- * There's a list of character sets stored in gsettings, indicating
- * which encodings to display in the encoding menu.
- *
* We have a pre-canned list of available encodings
* (hardcoded in the table below) that can be added to
* the encoding menu, and to give a human-readable name
@@ -138,80 +135,8 @@ static const EncodingEntry encodings[] = {
{ "WINDOWS-1258", N_("Vietnamese"), GROUP_OBSOLETE },
};
-static const struct {
- EncodingGroup group;
- const char *name;
-} group_names[] = {
- { GROUP_UNICODE, N_("Unicode") },
- { GROUP_CJKV, N_("Legacy CJK Encodings") },
- { GROUP_OBSOLETE, N_("Obsolete Encodings") },
-};
-
#define EM_DASH "—"
-static int
-compare_encoding_entry_cb (const void *ap,
- const void *bp)
-{
- const EncodingEntry *a = ap;
- const EncodingEntry *b = bp;
-
- int r = a->group - b->group;
- if (r != 0)
- return r;
-
- r = g_utf8_collate (a->name, b->name);
- if (r != 0)
- return r;
-
- return strcmp (a->charset, b->charset);
-}
-
-/**
- * terminal_encodings_append_menu:
- *
- * Appends to known encodings to a #GMenu, sorted in groups and
- * alphabetically by name inside the groups. The action name
- * used when activating the menu items is "win.encoding".
- */
-void
-terminal_encodings_append_menu (GMenu *menu)
-{
- /* First, sort the encodings */
- gs_free EncodingEntry *array = g_memdup (encodings, sizeof encodings);
- for (guint i = 0; i < G_N_ELEMENTS (encodings); i++)
- array[i].name = _(array[i].name); /* translate */
-
- qsort (array, G_N_ELEMENTS (encodings), sizeof array[0],
- compare_encoding_entry_cb);
-
- for (guint group = 0 ; group < LAST_GROUP; group++) {
- gs_unref_object GMenu *section = g_menu_new ();
-
- for (guint i = 0; i < G_N_ELEMENTS (encodings); i++) {
- if (array[i].group != group)
- continue;
-
- gs_free_gstring GString *str = g_string_sized_new (128);
- g_string_append (str, array[i].name);
- g_string_append (str, " " EM_DASH " ");
- for (const char *p = array[i].charset; *p; p++) {
- if (*p == '_')
- g_string_append (str, "__");
- else
- g_string_append_c (str, *p);
- }
-
- gs_unref_object GMenuItem *item = g_menu_item_new (str->str, NULL);
- g_menu_item_set_action_and_target (item, "win.encoding", "s", array[i].charset);
-
- g_menu_append_item (section, item);
- }
-
- g_menu_append_section (menu, _(group_names[group].name), G_MENU_MODEL (section));
- }
-}
-
/**
* terminal_encodings_list_store_new:
*
diff --git a/src/terminal-encoding.h b/src/terminal-encoding.h
index c3336dfc..6c787ea2 100644
--- a/src/terminal-encoding.h
+++ b/src/terminal-encoding.h
@@ -23,8 +23,6 @@
gboolean terminal_encodings_is_known_charset (const char *charset);
-void terminal_encodings_append_menu (GMenu *menu);
-
GtkListStore *terminal_encodings_list_store_new (int column_id,
int column_text);
diff --git a/src/terminal-menubar.ui.in b/src/terminal-menubar.ui.in
index 39048941..6dcbb0af 100644
--- a/src/terminal-menubar.ui.in
+++ b/src/terminal-menubar.ui.in
@@ -149,9 +149,6 @@
<attribute name="action">win.set-title</attribute>
<attribute name="hidden-when">action-missing</attribute>
</item>
- <submenu id="set-encoding-submenu">
- <attribute name="label" translatable="yes">Set _Character Encoding</attribute>
- </submenu>
</section>
<section>
<item>
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 012c152c..16ea682b 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -31,7 +31,6 @@
#include "terminal-app.h"
#include "terminal-debug.h"
#include "terminal-enums.h"
-#include "terminal-encoding.h"
#include "terminal-headerbar.h"
#include "terminal-icon-button.h"
#include "terminal-intl.h"
@@ -1301,28 +1300,6 @@ action_profile_state_cb (GSimpleAction *action,
terminal_screen_set_profile (priv->active_screen, profile);
}
-static void
-action_encoding_state_cb (GSimpleAction *action,
- GVariant *state,
- gpointer user_data)
-{
- TerminalWindow *window = user_data;
- TerminalWindowPrivate *priv = window->priv;
-
- g_assert_nonnull (state);
-
- if (priv->active_screen == NULL)
- return;
-
- const char *charset = g_variant_get_string (state, NULL);
- g_warn_if_fail (terminal_encodings_is_known_charset (charset));
-
- /* Only change the state if changing encoding worked */
- if (vte_terminal_set_encoding (VTE_TERMINAL (priv->active_screen), charset, NULL)) {
- g_simple_action_set_state (action, state);
- }
-}
-
static void
action_active_tab_set_cb (GSimpleAction *action,
GVariant *parameter,
@@ -1465,19 +1442,6 @@ terminal_window_update_set_profile_menu_active_profile (TerminalWindow *window)
g_variant_new_take_string (uuid));
}
-static void
-terminal_window_update_encoding_menu_active_encoding (TerminalWindow *window)
-{
- TerminalWindowPrivate *priv = window->priv;
-
- if (priv->active_screen == NULL)
- return;
-
- const char *charset = vte_terminal_get_encoding (VTE_TERMINAL (priv->active_screen));
- g_simple_action_set_state (lookup_action (window, "encoding"),
- g_variant_new_string (charset));
-}
-
static void
terminal_window_update_terminal_menu (TerminalWindow *window)
{
@@ -2096,7 +2060,6 @@ terminal_window_init (TerminalWindow *window)
/* Actions with state */
{ "active-tab", action_active_tab_set_cb, "i", "@i 0", action_active_tab_state_cb },
- { "encoding", NULL /* changes state */, "s", "'UTF-8'", action_encoding_state_cb },
{ "header-menu", NULL /* toggles state */, NULL, "false", NULL },
{ "fullscreen", NULL /* toggles state */, NULL, "false", action_fullscreen_state_cb },
{ "menubar-visible", NULL /* toggles state */, NULL, "true", action_menubar_visible_state_cb },
@@ -2459,16 +2422,6 @@ screen_hyperlink_hover_uri_changed (TerminalScreen *screen,
gtk_widget_set_tooltip_text (GTK_WIDGET (screen), label);
}
-static void
-screen_encoding_changed_cb (TerminalScreen *screen,
- GParamSpec *psepc,
- gpointer user_data)
-{
- TerminalWindow *window = user_data;
-
- terminal_window_update_encoding_menu_active_encoding (window);
-}
-
/* MDI container callbacks */
static void
@@ -2770,7 +2723,6 @@ mdi_screen_switched_cb (TerminalMdiContainer *container,
terminal_window_update_size (window);
terminal_window_update_tabs_actions_sensitivity (window);
- terminal_window_update_encoding_menu_active_encoding (window);
terminal_window_update_terminal_menu (window);
terminal_window_update_set_profile_menu_active_profile (window);
terminal_window_update_copy_sensitivity (screen, window);
@@ -2806,8 +2758,6 @@ mdi_screen_added_cb (TerminalMdiContainer *container,
G_CALLBACK (screen_font_any_changed_cb), window);
g_signal_connect (screen, "notify::cell-width-scale",
G_CALLBACK (screen_font_any_changed_cb), window);
- g_signal_connect (screen, "notify::encoding",
- G_CALLBACK (screen_encoding_changed_cb), window);
g_signal_connect (screen, "selection-changed",
G_CALLBACK (terminal_window_update_copy_sensitivity), window);
g_signal_connect (screen, "hyperlink-hover-uri-changed",
@@ -2883,10 +2833,6 @@ mdi_screen_removed_cb (TerminalMdiContainer *container,
G_CALLBACK (screen_font_any_changed_cb),
window);
- g_signal_handlers_disconnect_by_func (G_OBJECT (screen),
- G_CALLBACK (screen_encoding_changed_cb),
- window);
-
g_signal_handlers_disconnect_by_func (G_OBJECT (screen),
G_CALLBACK (terminal_window_update_copy_sensitivity),
window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]