[gedit/wip/loader-saver: 8/54] encodings-dialog: use GtkSourceEncoding



commit cb48505f55aec8aa86b7e1aa91b7dfcaede8c82a
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Jun 11 23:51:03 2014 +0200

    encodings-dialog: use GtkSourceEncoding

 gedit/gedit-encodings-dialog.c |   32 ++++++++++++++------------------
 1 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/gedit/gedit-encodings-dialog.c b/gedit/gedit-encodings-dialog.c
index 362796f..11d2225 100644
--- a/gedit/gedit-encodings-dialog.c
+++ b/gedit/gedit-encodings-dialog.c
@@ -24,12 +24,10 @@
 
 #include <string.h>
 
-#include <glib.h>
 #include <glib/gi18n.h>
-#include <gtk/gtk.h>
+#include <gtksourceview/gtksource.h>
 
 #include "gedit-encodings-dialog.h"
-#include "gedit-encodings.h"
 #include "gedit-utils.h"
 #include "gedit-debug.h"
 #include "gedit-dirs.h"
@@ -182,12 +180,12 @@ get_selected_encodings_func (GtkTreeModel *model,
 {
        GSList **list = data;
        gchar *charset;
-       const GeditEncoding *enc;
+       const GtkSourceEncoding *enc;
 
        charset = NULL;
        gtk_tree_model_get (model, iter, COLUMN_CHARSET, &charset, -1);
 
-       enc = gedit_encoding_get_from_charset (charset);
+       enc = gtk_source_encoding_get_from_charset (charset);
        g_free (charset);
 
        *list = g_slist_prepend (*list, (gpointer)enc);
@@ -203,16 +201,16 @@ update_shown_in_menu_tree_model (GtkListStore *store,
 
        while (list != NULL)
        {
-               const GeditEncoding *enc;
+               const GtkSourceEncoding *enc;
 
-               enc = (const GeditEncoding*) list->data;
+               enc = list->data;
 
                gtk_list_store_append (store, &iter);
                gtk_list_store_set (store, &iter,
                                    COLUMN_CHARSET,
-                                   gedit_encoding_get_charset (enc),
+                                   gtk_source_encoding_get_charset (enc),
                                    COLUMN_NAME,
-                                   gedit_encoding_get_name (enc), -1);
+                                   gtk_source_encoding_get_name (enc), -1);
 
                list = g_slist_next (list);
        }
@@ -296,9 +294,7 @@ init_shown_in_menu_tree_model (GeditEncodingsDialog *dialog)
 
        for (tmp = list; tmp != NULL; tmp = g_slist_next (tmp))
        {
-               const GeditEncoding *enc;
-
-               enc = (const GeditEncoding *) tmp->data;
+               const GtkSourceEncoding *enc = tmp->data;
 
                dialog->priv->show_in_menu_list = g_slist_prepend (dialog->priv->show_in_menu_list,
                                                                   tmp->data);
@@ -308,9 +304,9 @@ init_shown_in_menu_tree_model (GeditEncodingsDialog *dialog)
                gtk_list_store_set (dialog->priv->displayed_liststore,
                                    &iter,
                                    COLUMN_CHARSET,
-                                   gedit_encoding_get_charset (enc),
+                                   gtk_source_encoding_get_charset (enc),
                                    COLUMN_NAME,
-                                   gedit_encoding_get_name (enc), -1);
+                                   gtk_source_encoding_get_name (enc), -1);
        }
 
        g_slist_free (list);
@@ -321,7 +317,7 @@ gedit_encodings_dialog_init (GeditEncodingsDialog *dlg)
 {
        GtkTreeIter parent_iter;
        GtkTreeSelection *selection;
-       const GeditEncoding *enc;
+       const GtkSourceEncoding *enc;
        int i;
 
        dlg->priv = gedit_encodings_dialog_get_instance_private (dlg);
@@ -346,16 +342,16 @@ gedit_encodings_dialog_init (GeditEncodingsDialog *dlg)
 
        /* Add the data */
        i = 0;
-       while ((enc = gedit_encoding_get_from_index (i)) != NULL)
+       while ((enc = gtk_source_encoding_get_from_index (i)) != NULL)
        {
                gtk_list_store_append (dlg->priv->available_liststore,
                                       &parent_iter);
                gtk_list_store_set (dlg->priv->available_liststore,
                                    &parent_iter,
                                    COLUMN_CHARSET,
-                                   gedit_encoding_get_charset (enc),
+                                   gtk_source_encoding_get_charset (enc),
                                    COLUMN_NAME,
-                                   gedit_encoding_get_name (enc), -1);
+                                   gtk_source_encoding_get_name (enc), -1);
 
                ++i;
        }


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