Port encoding option menu widget to use a combobox.

This patch is based on Maxim Ermilov's patch. Fixes bug #562052.
parent cd9dcbd6
......@@ -97,7 +97,7 @@ INST_H_FILES = \
gedit-debug.h \
gedit-document.h \
gedit-encodings.h \
gedit-encodings-option-menu.h \
gedit-encodings-combo-box.h \
gedit-file-chooser-dialog.h \
gedit-help.h \
gedit-message-bus.h \
......@@ -157,7 +157,7 @@ libgedit_la_SOURCES = \
gedit-gio-document-saver.c \
gedit-documents-panel.c \
gedit-encodings.c \
gedit-encodings-option-menu.c \
gedit-encodings-combo-box.c \
gedit-file-chooser-dialog.c \
gedit-help.c \
gedit-history-entry.c \
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-encodings-option-menu.c
* gedit-encodings-combo-box.c
* This file is part of gedit
*
* Copyright (C) 2003-2005 - Paolo Maggi
......@@ -26,7 +26,7 @@
* list of people on the gedit Team.
* See the ChangeLog files for a list of changes.
*
* $Id$
* $Id: gedit-encodings-combo-box.c 6112 2008-01-23 08:26:24Z sfre $
*/
#ifdef HAVE_CONFIG_H
......@@ -36,133 +36,168 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gedit/gedit-encodings-option-menu.h>
#include <gedit/gedit-encodings-combo-box.h>
#include <gedit/gedit-prefs-manager.h>
#include <gedit/dialogs/gedit-encodings-dialog.h>
#define ENCODING_KEY "Enconding"
static void update_menu (GeditEncodingsOptionMenu *option_menu);
#define GEDIT_ENCODINGS_COMBO_BOX_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
GEDIT_TYPE_ENCODINGS_COMBO_BOX, \
GeditEncodingsComboBoxPrivate))
/* Properties */
enum {
PROP_0,
PROP_SAVE_MODE
};
struct _GeditEncodingsComboBoxPrivate
{
GtkListStore *store;
glong changed_id;
#define GEDIT_ENCODINGS_OPTION_MENU_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
GEDIT_TYPE_ENCODINGS_OPTION_MENU, \
GeditEncodingsOptionMenuPrivate))
guint activated_item;
struct _GeditEncodingsOptionMenuPrivate
guint save_mode : 1;
};
enum
{
gint activated_item;
NAME_COLUMN,
ENCODING_COLUMN,
ADD_COLUMN,
N_COLUMNS
};
gboolean save_mode;
/* Properties */
enum
{
PROP_0,
PROP_SAVE_MODE
};
G_DEFINE_TYPE(GeditEncodingsOptionMenu, gedit_encodings_option_menu, GTK_TYPE_OPTION_MENU)
G_DEFINE_TYPE(GeditEncodingsComboBox, gedit_encodings_combo_box, GTK_TYPE_COMBO_BOX)
static void update_menu (GeditEncodingsComboBox *combo_box);
static void
gedit_encodings_option_menu_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
gedit_encodings_combo_box_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GeditEncodingsOptionMenu *om;
GeditEncodingsComboBox *combo;
g_return_if_fail (GEDIT_IS_ENCODINGS_OPTION_MENU (object));
om = GEDIT_ENCODINGS_OPTION_MENU (object);
combo = GEDIT_ENCODINGS_COMBO_BOX (object);
switch (prop_id)
{
case PROP_SAVE_MODE:
om->priv->save_mode = g_value_get_boolean (value);
update_menu (om);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_SAVE_MODE:
combo->priv->save_mode = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gedit_encodings_option_menu_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
gedit_encodings_combo_box_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GeditEncodingsOptionMenu *om;
g_return_if_fail (GEDIT_IS_ENCODINGS_OPTION_MENU (object));
GeditEncodingsComboBox *combo;
om = GEDIT_ENCODINGS_OPTION_MENU (object);
combo = GEDIT_ENCODINGS_COMBO_BOX (object);
switch (prop_id)
{
case PROP_SAVE_MODE:
g_value_set_boolean (value, om->priv->save_mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_SAVE_MODE:
g_value_set_boolean (value, combo->priv->save_mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gedit_encodings_option_menu_class_init (GeditEncodingsOptionMenuClass *klass)
gedit_encodings_combo_box_dispose (GObject *object)
{
GeditEncodingsComboBox *combo = GEDIT_ENCODINGS_COMBO_BOX (object);
if (combo->priv->store != NULL)
{
g_object_unref (combo->priv->store);
combo->priv->store = NULL;
}
G_OBJECT_CLASS (gedit_encodings_combo_box_parent_class)->dispose (object);
}
static void
gedit_encodings_combo_box_class_init (GeditEncodingsComboBoxClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gedit_encodings_option_menu_set_property;
object_class->get_property = gedit_encodings_option_menu_get_property;
object_class->set_property = gedit_encodings_combo_box_set_property;
object_class->get_property = gedit_encodings_combo_box_get_property;
object_class->dispose = gedit_encodings_combo_box_dispose;
g_object_class_install_property (object_class,
PROP_SAVE_MODE,
g_param_spec_boolean ("save-mode",
("Save Mode"),
("Save Mode"),
"Save Mode",
"Save Mode",
FALSE,
G_PARAM_READWRITE |
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
g_type_class_add_private (object_class, sizeof(GeditEncodingsOptionMenuPrivate));
g_type_class_add_private (object_class, sizeof (GeditEncodingsComboBoxPrivate));
}
static void
dialog_response_cb (GtkDialog *dialog,
gint response_id,
GeditEncodingsOptionMenu *option_menu)
dialog_response_cb (GtkDialog *dialog,
gint response_id,
GeditEncodingsComboBox *menu)
{
update_menu (option_menu);
if (response_id == GTK_RESPONSE_OK)
{
update_menu (menu);
}
gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
add_or_remove (GtkMenuItem *menu_item,
GeditEncodingsOptionMenu *option_menu)
add_or_remove (GeditEncodingsComboBox *menu,
GtkTreeModel *model)
{
if (GTK_IS_RADIO_MENU_ITEM (menu_item))
GtkTreeIter iter;
gboolean add_item = FALSE;
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (menu), &iter))
{
option_menu->priv->activated_item =
gtk_option_menu_get_history (GTK_OPTION_MENU (option_menu));
gtk_tree_model_get (model, &iter,
ADD_COLUMN, &add_item,
-1);
}
if (!add_item)
{
menu->priv->activated_item = gtk_combo_box_get_active (GTK_COMBO_BOX (menu));
}
else
{
GtkWidget *dialog;
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (option_menu));
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menu));
if (!GTK_WIDGET_TOPLEVEL (toplevel))
toplevel = NULL;
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu),
option_menu->priv->activated_item);
toplevel = NULL;
g_signal_handler_block (menu, menu->priv->changed_id);
gtk_combo_box_set_active (GTK_COMBO_BOX (menu),
menu->priv->activated_item);
g_signal_handler_unblock (menu, menu->priv->changed_id);
dialog = gedit_encodings_dialog_new();
......@@ -173,7 +208,7 @@ add_or_remove (GtkMenuItem *menu_item,
gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW (toplevel));
wg = gtk_window_get_group (GTK_WINDOW (toplevel));
wg = GTK_WINDOW (toplevel)->group;
if (wg == NULL)
{
wg = gtk_window_group_new ();
......@@ -186,233 +221,244 @@ add_or_remove (GtkMenuItem *menu_item,
}
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
g_signal_connect (dialog,
"response",
G_CALLBACK (dialog_response_cb),
option_menu);
menu);
gtk_widget_show (dialog);
}
}
static void
update_menu (GeditEncodingsOptionMenu *option_menu)
static gboolean
separator_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
{
GtkWidget *menu;
GtkWidget *menu_item;
GSList *group = NULL;
GSList *encodings, *list;
gchar *str;
gchar *str;
gtk_tree_model_get (model, iter, NAME_COLUMN, &str, -1);
if (str != NULL && *str != '\0')
return FALSE;
return TRUE;
}
static void
update_menu (GeditEncodingsComboBox *menu)
{
GtkListStore *store;
GtkTreeIter iter;
GSList *encodings, *l;
gchar *str;
const GeditEncoding *utf8_encoding;
const GeditEncoding *current_encoding;
menu = gtk_menu_new ();
store = menu->priv->store;
encodings = list = gedit_prefs_manager_get_shown_in_menu_encodings ();
/* Unset the previous model */
g_signal_handler_block (menu, menu->priv->changed_id);
gtk_list_store_clear (store);
gtk_combo_box_set_model (GTK_COMBO_BOX (menu),
NULL);
utf8_encoding = gedit_encoding_get_utf8 ();
current_encoding = gedit_encoding_get_current ();
if (!option_menu->priv->save_mode)
if (!menu->priv->save_mode)
{
menu_item = gtk_radio_menu_item_new_with_label (group, _("Auto Detected"));
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_item));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
g_signal_connect (menu_item,
"activate",
G_CALLBACK (add_or_remove),
option_menu);
menu_item = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
NAME_COLUMN, _("Auto Detected"),
ENCODING_COLUMN, NULL,
ADD_COLUMN, FALSE,
-1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
NAME_COLUMN, "",
ENCODING_COLUMN, NULL,
ADD_COLUMN, FALSE,
-1);
}
if (current_encoding != utf8_encoding)
str = gedit_encoding_to_string (utf8_encoding);
else
str = g_strdup_printf (_("Current Locale (%s)"),
str = g_strdup_printf (_("Current Locale (%s)"),
gedit_encoding_get_charset (utf8_encoding));
menu_item = gtk_radio_menu_item_new_with_label (group, str);
g_signal_connect (menu_item,
"activate",
G_CALLBACK (add_or_remove),
option_menu);
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_item));
g_object_set_data (G_OBJECT (menu_item), ENCODING_KEY, (gpointer)utf8_encoding);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
NAME_COLUMN, str,
ENCODING_COLUMN, utf8_encoding,
ADD_COLUMN, FALSE,
-1);
g_free (str);
if ((utf8_encoding != current_encoding) &&
if ((utf8_encoding != current_encoding) &&
(current_encoding != NULL))
{
str = g_strdup_printf (_("Current Locale (%s)"),
str = g_strdup_printf (_("Current Locale (%s)"),
gedit_encoding_get_charset (current_encoding));
menu_item = gtk_radio_menu_item_new_with_label (group, str);
g_signal_connect (menu_item,
"activate",
G_CALLBACK (add_or_remove),
option_menu);
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_item));
g_object_set_data (G_OBJECT (menu_item),
ENCODING_KEY, (gpointer)current_encoding);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
NAME_COLUMN, str,
ENCODING_COLUMN, current_encoding,
ADD_COLUMN, FALSE,
-1);
g_free (str);
}
while (list != NULL)
encodings = gedit_prefs_manager_get_shown_in_menu_encodings ();
for (l = encodings; l != NULL; l = g_slist_next (l))
{
const GeditEncoding *enc;
enc = (const GeditEncoding *)list->data;
const GeditEncoding *enc = (const GeditEncoding *)l->data;
if ((enc != current_encoding) &&
(enc != utf8_encoding) &&
if ((enc != current_encoding) &&
(enc != utf8_encoding) &&
(enc != NULL))
{
str = gedit_encoding_to_string (enc);
menu_item = gtk_radio_menu_item_new_with_label (group, str);
g_signal_connect (menu_item,
"activate",
G_CALLBACK (add_or_remove),
option_menu);
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_item));
g_object_set_data (G_OBJECT (menu_item), ENCODING_KEY, (gpointer)enc);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
NAME_COLUMN, str,
ENCODING_COLUMN, enc,
ADD_COLUMN, FALSE,
-1);
g_free (str);
}
list = g_slist_next (list);
}
g_slist_free (encodings);
if (gedit_prefs_manager_shown_in_menu_encodings_can_set ())
{
menu_item = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
menu_item = gtk_menu_item_new_with_mnemonic (_("Add or _Remove..."));
g_signal_connect (menu_item,
"activate",
G_CALLBACK (add_or_remove),
option_menu);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
gtk_list_store_append (store, &iter);
/* separator */
gtk_list_store_set (store, &iter,
NAME_COLUMN, "",
ENCODING_COLUMN, NULL,
ADD_COLUMN, FALSE,
-1);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
NAME_COLUMN, _("Add or Remove..."),
ENCODING_COLUMN, NULL,
ADD_COLUMN, TRUE,
-1);
}
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
/* set the model back */
gtk_combo_box_set_model (GTK_COMBO_BOX (menu),
GTK_TREE_MODEL (menu->priv->store));
gtk_combo_box_set_active (GTK_COMBO_BOX (menu), 0);
g_signal_handler_unblock (menu, menu->priv->changed_id);
}
static void
gedit_encodings_option_menu_init (GeditEncodingsOptionMenu *menu)
gedit_encodings_combo_box_init (GeditEncodingsComboBox *menu)
{
menu->priv = GEDIT_ENCODINGS_OPTION_MENU_GET_PRIVATE (menu);
GtkCellRenderer *text_renderer;
menu->priv = GEDIT_ENCODINGS_COMBO_BOX_GET_PRIVATE (menu);
menu->priv->store = gtk_list_store_new (N_COLUMNS,
G_TYPE_STRING,
G_TYPE_POINTER,
G_TYPE_BOOLEAN);
/* Setup up the cells */
text_renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (menu),
text_renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (menu),
text_renderer,
"text",
NAME_COLUMN,
NULL);
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (menu),
separator_func, NULL,
NULL);
menu->priv->changed_id = g_signal_connect (menu, "changed",
G_CALLBACK (add_or_remove),
menu->priv->store);
update_menu (menu);
}
GtkWidget *
gedit_encodings_option_menu_new (gboolean save_mode)
gedit_encodings_combo_box_new (gboolean save_mode)
{
return g_object_new (GEDIT_TYPE_ENCODINGS_OPTION_MENU,
return g_object_new (GEDIT_TYPE_ENCODINGS_COMBO_BOX,
"save_mode", save_mode,
NULL);
}
const GeditEncoding *
gedit_encodings_option_menu_get_selected_encoding (GeditEncodingsOptionMenu *menu)
gedit_encodings_combo_box_get_selected_encoding (GeditEncodingsComboBox *menu)
{
GtkWidget *active_widget;
GtkTreeIter iter;
GtkOptionMenu *option_menu;
g_return_val_if_fail (GEDIT_IS_ENCODINGS_COMBO_BOX (menu), NULL);
g_return_val_if_fail (GEDIT_IS_ENCODINGS_OPTION_MENU (menu), NULL);
option_menu = GTK_OPTION_MENU (menu);
g_return_val_if_fail (option_menu != NULL, NULL);
if (option_menu->menu)
{
active_widget = gtk_menu_get_active (GTK_MENU (option_menu->menu));
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (menu), &iter))
{
const GeditEncoding *ret;
GtkTreeModel *model;
if (active_widget != NULL)
{
const GeditEncoding *ret;
model = gtk_combo_box_get_model (GTK_COMBO_BOX (menu));
ret = (const GeditEncoding *)g_object_get_data (G_OBJECT (active_widget),
ENCODING_KEY);
gtk_tree_model_get (model, &iter,
ENCODING_COLUMN, &ret,
-1);
return ret;
}
return ret;
}
return NULL;
}
void
gedit_encodings_option_menu_set_selected_encoding (GeditEncodingsOptionMenu *menu,
const GeditEncoding *encoding)
gedit_encodings_combo_box_set_selected_encoding (GeditEncodingsComboBox *menu,
const GeditEncoding *encoding)
{
GtkOptionMenu *option_menu;
GList *list;
GList *l;
gint i;
g_return_if_fail (GEDIT_IS_ENCODINGS_OPTION_MENU (menu));
GtkTreeIter iter;
GtkTreeModel *model;
gboolean b;
g_return_if_fail (GEDIT_IS_ENCODINGS_COMBO_BOX (menu));
g_return_if_fail (GTK_IS_COMBO_BOX (menu));
option_menu = GTK_OPTION_MENU (menu);
g_return_if_fail (option_menu != NULL);
model = gtk_combo_box_get_model (GTK_COMBO_BOX (menu));
b = gtk_tree_model_get_iter_first (model, &iter);
list = gtk_container_get_children (GTK_CONTAINER (option_menu->menu));
i = 0;
for (l = list; l != NULL; l = g_list_next (l))
while (b)
{
GtkWidget *menu_item;
const GeditEncoding *enc;
menu_item = GTK_WIDGET (l->data);
enc = (const GeditEncoding *)g_object_get_data (G_OBJECT (menu_item),
ENCODING_KEY);
gtk_tree_model_get (model, &iter,
ENCODING_COLUMN, &enc,
-1);
if (enc == encoding)
{
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE);
gtk_option_menu_set_history (GTK_OPTION_MENU (menu), i);
break;
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (menu),
&iter);
return;
}
++i;
b = gtk_tree_model_iter_next (model, &iter);
}
g_list_free (list);
}
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-encodings-option-menu.h
* gedit-encodings-combo-box.h
* This file is part of gedit
*
* Copyright (C) 2003-2005 - Paolo Maggi
......@@ -26,53 +26,53 @@
* list of people on the gedit Team.
* See the ChangeLog files for a list of changes.
*
* $Id$
* $Id: gedit-encodings-option-menu.h 4429 2005-12-12 17:28:04Z pborelli $
*/
#ifndef __GEDIT_ENCODINGS_OPTION_MENU_H__
#define __GEDIT_ENCODINGS_OPTION_MENU_H__
#ifndef __GEDIT_ENCODINGS_COMBO_BOX_H__
#define __GEDIT_ENCODINGS_COMBO_BOX_H__
#include <gtk/gtk.h>
#include <gtk/gtkoptionmenu.h>
#include <gedit/gedit-encodings.h>
G_BEGIN_DECLS
#define GEDIT_TYPE_ENCODINGS_OPTION_MENU (gedit_encodings_option_menu_get_type ())
#define GEDIT_ENCODINGS_OPTION_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_ENCODINGS_OPTION_MENU, GeditEncodingsOptionMenu))
#define GEDIT_ENCODINGS_OPTION_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_ENCODINGS_OPTION_MENU, GeditEncodingsOptionMenuClass))
#define GEDIT_IS_ENCODINGS_OPTION_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_ENCODINGS_OPTION_MENU))
#define GEDIT_IS_ENCODINGS_OPTION_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_ENCODINGS_OPTION_MENU))
#define GEDIT_ENCODINGS_OPTION_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_ENCODINGS_OPTION_MENU, GeditEncodingsOptionMenuClass))
#define GEDIT_TYPE_ENCODINGS_COMBO_BOX (gedit_encodings_combo_box_get_type ())
#define GEDIT_ENCODINGS_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_ENCODINGS_COMBO_BOX, GeditEncodingsComboBox))
#define GEDIT_ENCODINGS_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_ENCODINGS_COMBO_BOX, GeditEncodingsComboBoxClass))
#define GEDIT_IS_ENCODINGS_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_ENCODINGS_COMBO_BOX))
#define GEDIT_IS_ENCODINGS_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_ENCODINGS_COMBO_BOX))
#define GEDIT_ENCODINGS_COMBO_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_ENCODINGS_COMBO_BOX, GeditEncodingsComboBoxClass))
typedef struct _GeditEncodingsOptionMenu GeditEncodingsOptionMenu;
typedef struct _GeditEncodingsOptionMenuClass GeditEncodingsOptionMenuClass;
typedef struct _GeditEncodingsComboBox GeditEncodingsComboBox;
typedef struct _GeditEncodingsComboBoxClass GeditEncodingsComboBoxClass;
typedef struct _GeditEncodingsOptionMenuPrivate GeditEncodingsOptionMenuPrivate;
typedef struct _GeditEncodingsComboBoxPrivate GeditEncodingsComboBoxPrivate;
struct _GeditEncodingsOptionMenu
struct _GeditEncodingsComboBox
{
GtkOptionMenu parent;
GtkComboBox parent;
GeditEncodingsOptionMenuPrivate *priv;
GeditEncodingsComboBoxPrivate *priv;
};
struct _GeditEncodingsOptionMenuClass
struct _GeditEncodingsComboBoxClass
{
GtkOptionMenuClass parent_class;
GtkComboBoxClass parent_class;
};
GType gedit_encodings_option_menu_get_type (void) G_GNUC_CONST;
GType gedit_encodings_combo_box_get_type (void) G_GNUC_CONST;
/* Constructor */
GtkWidget *gedit_encodings_option_menu_new (gboolean save_mode);
GtkWidget *gedit_encodings_combo_box_new (gboolean save_mode);
const GeditEncoding *gedit_encodings_option_menu_get_selected_encoding (GeditEncodingsOptionMenu *menu);