[gedit/zbrown/deteplification-src: 436/633] File choosers: ::get_encoding vfunc
- From: Zander Brown <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/zbrown/deteplification-src: 436/633] File choosers: ::get_encoding vfunc
- Date: Sat, 10 Apr 2021 12:48:05 +0000 (UTC)
commit c7462c795ef8f136090f0ad4fcdc7e351718e337
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Jun 13 22:23:46 2020 +0200
File choosers: ::get_encoding vfunc
gedit/gedit-file-chooser-open-dialog.c | 9 +++++++++
gedit/gedit-file-chooser.c | 8 ++++++--
gedit/gedit-file-chooser.h | 4 +++-
3 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/gedit/gedit-file-chooser-open-dialog.c b/gedit/gedit-file-chooser-open-dialog.c
index 1e8e3e2f6..8fe69eb15 100644
--- a/gedit/gedit-file-chooser-open-dialog.c
+++ b/gedit/gedit-file-chooser-open-dialog.c
@@ -90,6 +90,14 @@ chooser_create_gtk_file_chooser (GeditFileChooser *chooser)
return GTK_FILE_CHOOSER (file_chooser);
}
+static const GtkSourceEncoding *
+chooser_get_encoding (GeditFileChooser *_chooser)
+{
+ GeditFileChooserOpenDialog *chooser = GEDIT_FILE_CHOOSER_OPEN_DIALOG (_chooser);
+
+ return gedit_encodings_combo_box_get_selected_encoding (chooser->priv->encodings_combo_box);
+}
+
static void
_gedit_file_chooser_open_dialog_class_init (GeditFileChooserOpenDialogClass *klass)
{
@@ -99,6 +107,7 @@ _gedit_file_chooser_open_dialog_class_init (GeditFileChooserOpenDialogClass *kla
object_class->dispose = _gedit_file_chooser_open_dialog_dispose;
file_chooser_class->create_gtk_file_chooser = chooser_create_gtk_file_chooser;
+ file_chooser_class->get_encoding = chooser_get_encoding;
}
static void
diff --git a/gedit/gedit-file-chooser.c b/gedit/gedit-file-chooser.c
index cf1d320a4..97322effa 100644
--- a/gedit/gedit-file-chooser.c
+++ b/gedit/gedit-file-chooser.c
@@ -765,8 +765,12 @@ _gedit_file_chooser_set_current_folder_uri (GeditFileChooser *chooser,
const GtkSourceEncoding *
_gedit_file_chooser_get_encoding (GeditFileChooser *chooser)
{
+ GeditFileChooserClass *klass;
+
g_return_val_if_fail (GEDIT_IS_FILE_CHOOSER (chooser), NULL);
- /* Stub */
- return NULL;
+ klass = GEDIT_FILE_CHOOSER_GET_CLASS (chooser);
+ g_return_val_if_fail (klass->get_encoding != NULL, NULL);
+
+ return klass->get_encoding (chooser);
}
diff --git a/gedit/gedit-file-chooser.h b/gedit/gedit-file-chooser.h
index 3c6a1d50e..d47cb9f99 100644
--- a/gedit/gedit-file-chooser.h
+++ b/gedit/gedit-file-chooser.h
@@ -47,7 +47,9 @@ struct _GeditFileChooserClass
GObjectClass parent_class;
/* Returns: (transfer full). */
- GtkFileChooser * (* create_gtk_file_chooser) (GeditFileChooser *chooser);
+ GtkFileChooser * (* create_gtk_file_chooser) (GeditFileChooser *chooser);
+
+ const GtkSourceEncoding * (* get_encoding) (GeditFileChooser *chooser);
};
G_GNUC_INTERNAL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]