[gedit/wip/merge-encoding-settings: 7/23] Remove shown-in-menu encoding gsetting



commit 4e48eb2454037afe90223865c72151640d9b10c9
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Mar 15 17:12:28 2015 +0100

    Remove shown-in-menu encoding gsetting
    
    Use candidate-encodings instead.

 data/gedit.convert                  |    3 ---
 data/org.gnome.gedit.gschema.xml.in |    7 -------
 gedit/gedit-encoding-items.c        |    2 +-
 gedit/gedit-encodings-dialog.c      |   31 +++++++++++++++----------------
 gedit/gedit-settings.h              |    1 -
 5 files changed, 16 insertions(+), 28 deletions(-)
---
diff --git a/data/gedit.convert b/data/gedit.convert
index 52ced85..9b38bbe 100644
--- a/data/gedit.convert
+++ b/data/gedit.convert
@@ -37,8 +37,5 @@ print-font-body-pango = /apps/gedit-2/preferences/print/fonts/print_font_body_pa
 print-font-header-pango = /apps/gedit-2/preferences/print/fonts/print_font_header_pango
 print-font-numbers-pango = /apps/gedit-2/preferences/print/fonts/print_font_numbers_pango
 
-[org.gnome.gedit.preferences.encodings]
-shown-in-menu = /apps/gedit-2/preferences/encodings/shown_in_menu
-
 [org.gnome.gedit.plugins]
 active-plugins = /apps/gedit-2/plugins/active-plugins
diff --git a/data/org.gnome.gedit.gschema.xml.in b/data/org.gnome.gedit.gschema.xml.in
index 312e3e9..0c88b97 100644
--- a/data/org.gnome.gedit.gschema.xml.in
+++ b/data/org.gnome.gedit.gschema.xml.in
@@ -224,13 +224,6 @@
     </key>
   </schema>
   <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.gedit.preferences.encodings" 
path="/org/gnome/gedit/preferences/encodings/">
-    <key name="shown-in-menu" type="as">
-      <!-- Translators: This is the list of encodings shown by default in the Character Encoding
-           menu in open/save file selector. Only recognized encodings are displayed.-->
-      <default l10n="messages">['ISO-8859-15']</default>
-      <summary>Encodings shown in menu</summary>
-      <description>List of encodings shown in the Character Encoding menu in open/save file selector. Only 
recognized encodings are used.</description>
-    </key>
     <key name="candidate-encodings" type="as">
       <default>['']</default>
       <summary>Candidate Encodings</summary>
diff --git a/gedit/gedit-encoding-items.c b/gedit/gedit-encoding-items.c
index aee0030..6348c09 100644
--- a/gedit/gedit-encoding-items.c
+++ b/gedit/gedit-encoding-items.c
@@ -108,7 +108,7 @@ gedit_encoding_items_get (void)
                ret = g_slist_prepend (ret, gedit_encoding_item_new (current_encoding, str));
        }
 
-       enc_strv = g_settings_get_strv (enc_settings, GEDIT_SETTINGS_ENCODING_SHOWN_IN_MENU);
+       enc_strv = g_settings_get_strv (enc_settings, GEDIT_SETTINGS_CANDIDATE_ENCODINGS);
 
        encodings = _gedit_utils_encoding_strv_to_list ((const gchar * const *)enc_strv);
        g_strfreev (enc_strv);
diff --git a/gedit/gedit-encodings-dialog.c b/gedit/gedit-encodings-dialog.c
index c959d1f..ac54653 100644
--- a/gedit/gedit-encodings-dialog.c
+++ b/gedit/gedit-encodings-dialog.c
@@ -43,7 +43,7 @@ struct _GeditEncodingsDialogPrivate
        GtkWidget *add_button;
        GtkWidget *remove_button;
 
-       GSList *show_in_menu_list;
+       GSList *candidates_list;
 };
 
 enum
@@ -60,7 +60,7 @@ gedit_encodings_dialog_finalize (GObject *object)
 {
        GeditEncodingsDialogPrivate *priv = GEDIT_ENCODINGS_DIALOG (object)->priv;
 
-       g_slist_free (priv->show_in_menu_list);
+       g_slist_free (priv->candidates_list);
 
        G_OBJECT_CLASS (gedit_encodings_dialog_parent_class)->finalize (object);
 }
@@ -94,9 +94,9 @@ gedit_encodings_dialog_response (GtkDialog *dialog,
                {
                        gchar **enc_strv;
 
-                       enc_strv = _gedit_utils_encoding_list_to_strv (priv->show_in_menu_list);
+                       enc_strv = _gedit_utils_encoding_list_to_strv (priv->candidates_list);
                        g_settings_set_strv (priv->enc_settings,
-                                            GEDIT_SETTINGS_ENCODING_SHOWN_IN_MENU,
+                                            GEDIT_SETTINGS_CANDIDATE_ENCODINGS,
                                             (const gchar * const *)enc_strv);
 
                        g_strfreev (enc_strv);
@@ -194,7 +194,7 @@ update_liststore_displayed (GeditEncodingsDialog *dialog)
 
        gtk_list_store_clear (dialog->priv->liststore_displayed);
 
-       for (l = dialog->priv->show_in_menu_list; l != NULL; l = l->next)
+       for (l = dialog->priv->candidates_list; l != NULL; l = l->next)
        {
                const GtkSourceEncoding *enc = l->data;
                GtkTreeIter iter;
@@ -223,10 +223,10 @@ add_button_clicked_cb (GtkWidget            *button,
        {
                gpointer cur_encoding = l->data;
 
-               if (g_slist_find (dialog->priv->show_in_menu_list, cur_encoding) == NULL)
+               if (g_slist_find (dialog->priv->candidates_list, cur_encoding) == NULL)
                {
-                       dialog->priv->show_in_menu_list = g_slist_prepend (dialog->priv->show_in_menu_list,
-                                                                          cur_encoding);
+                       dialog->priv->candidates_list = g_slist_prepend (dialog->priv->candidates_list,
+                                                                        cur_encoding);
                }
        }
 
@@ -248,8 +248,8 @@ remove_button_clicked_cb (GtkWidget            *button,
        {
                gpointer cur_encoding = l->data;
 
-               dialog->priv->show_in_menu_list = g_slist_remove (dialog->priv->show_in_menu_list,
-                                                                 cur_encoding);
+               dialog->priv->candidates_list = g_slist_remove (dialog->priv->candidates_list,
+                                                               cur_encoding);
        }
 
        g_slist_free (encodings);
@@ -258,16 +258,15 @@ remove_button_clicked_cb (GtkWidget            *button,
 }
 
 static void
-init_shown_in_menu_tree_model (GeditEncodingsDialog *dialog)
+init_candidates_tree_model (GeditEncodingsDialog *dialog)
 {
        GtkTreeIter iter;
        gchar **enc_strv;
        GSList *list;
        GSList *l;
 
-       /* add data to the list store */
        enc_strv = g_settings_get_strv (dialog->priv->enc_settings,
-                                       GEDIT_SETTINGS_ENCODING_SHOWN_IN_MENU);
+                                       GEDIT_SETTINGS_CANDIDATE_ENCODINGS);
 
        list = _gedit_utils_encoding_strv_to_list ((const gchar * const *)enc_strv);
 
@@ -275,8 +274,8 @@ init_shown_in_menu_tree_model (GeditEncodingsDialog *dialog)
        {
                const GtkSourceEncoding *cur_encoding = l->data;
 
-               dialog->priv->show_in_menu_list = g_slist_prepend (dialog->priv->show_in_menu_list,
-                                                                  (gpointer) cur_encoding);
+               dialog->priv->candidates_list = g_slist_prepend (dialog->priv->candidates_list,
+                                                                (gpointer) cur_encoding);
 
                gtk_list_store_append (dialog->priv->liststore_displayed, &iter);
                gtk_list_store_set (dialog->priv->liststore_displayed, &iter,
@@ -357,7 +356,7 @@ gedit_encodings_dialog_init (GeditEncodingsDialog *dlg)
        /* Tree view of selected encodings */
 
        /* Add the data */
-       init_shown_in_menu_tree_model (dlg);
+       init_candidates_tree_model (dlg);
 
        selection = gtk_tree_view_get_selection (dlg->priv->treeview_displayed);
 
diff --git a/gedit/gedit-settings.h b/gedit/gedit-settings.h
index e882f4e..cd8228d 100644
--- a/gedit/gedit-settings.h
+++ b/gedit/gedit-settings.h
@@ -106,7 +106,6 @@ void                         gedit_settings_set_list                        (GSettings    
 *settings,
 #define GEDIT_SETTINGS_PRINT_FONT_BODY_PANGO           "print-font-body-pango"
 #define GEDIT_SETTINGS_PRINT_FONT_HEADER_PANGO         "print-font-header-pango"
 #define GEDIT_SETTINGS_PRINT_FONT_NUMBERS_PANGO                "print-font-numbers-pango"
-#define GEDIT_SETTINGS_ENCODING_SHOWN_IN_MENU          "shown-in-menu"
 #define GEDIT_SETTINGS_CANDIDATE_ENCODINGS             "candidate-encodings"
 #define GEDIT_SETTINGS_ACTIVE_PLUGINS                  "active-plugins"
 #define GEDIT_SETTINGS_ENSURE_TRAILING_NEWLINE         "ensure-trailing-newline"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]