Unify search GtkComboBox so it work in gtk+-2 and gtk+-3
This commit is contained in:
parent
cc28312a3f
commit
1bfcadb0c0
|
@ -385,27 +385,19 @@ populate_tag_groups_combo (PlumaTaglistPluginPanel *panel)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
GtkComboBox *combo;
|
GtkComboBox *combo;
|
||||||
#if GTK_CHECK_VERSION (3, 0, 0)
|
|
||||||
GtkComboBoxText *combotext;
|
GtkComboBoxText *combotext;
|
||||||
#endif
|
|
||||||
|
|
||||||
pluma_debug (DEBUG_PLUGINS);
|
pluma_debug (DEBUG_PLUGINS);
|
||||||
|
|
||||||
combo = GTK_COMBO_BOX (panel->priv->tag_groups_combo);
|
combo = GTK_COMBO_BOX (panel->priv->tag_groups_combo);
|
||||||
#if GTK_CHECK_VERSION (3, 0, 0)
|
|
||||||
combotext = GTK_COMBO_BOX_TEXT (panel->priv->tag_groups_combo);
|
combotext = GTK_COMBO_BOX_TEXT (panel->priv->tag_groups_combo);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (taglist == NULL)
|
if (taglist == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (l = taglist->tag_groups; l != NULL; l = g_list_next (l))
|
for (l = taglist->tag_groups; l != NULL; l = g_list_next (l))
|
||||||
{
|
{
|
||||||
#if GTK_CHECK_VERSION (3, 0, 0)
|
|
||||||
gtk_combo_box_text_append_text (combotext,
|
gtk_combo_box_text_append_text (combotext,
|
||||||
#else
|
|
||||||
gtk_combo_box_append_text (combo,
|
|
||||||
#endif
|
|
||||||
(gchar *)((TagGroup*)l->data)->name);
|
(gchar *)((TagGroup*)l->data)->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,11 +414,7 @@ selected_group_changed (GtkComboBox *combo,
|
||||||
|
|
||||||
pluma_debug (DEBUG_PLUGINS);
|
pluma_debug (DEBUG_PLUGINS);
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION (3, 0, 0)
|
|
||||||
group_name = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo));
|
group_name = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo));
|
||||||
#else
|
|
||||||
group_name = gtk_combo_box_get_active_text (combo);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((group_name == NULL) || (strlen (group_name) <= 0))
|
if ((group_name == NULL) || (strlen (group_name) <= 0))
|
||||||
{
|
{
|
||||||
|
@ -691,11 +679,7 @@ pluma_taglist_plugin_panel_init (PlumaTaglistPluginPanel *panel)
|
||||||
panel->priv->data_dir = NULL;
|
panel->priv->data_dir = NULL;
|
||||||
|
|
||||||
/* Build the window content */
|
/* Build the window content */
|
||||||
#if GTK_CHECK_VERSION (3, 0, 0)
|
|
||||||
panel->priv->tag_groups_combo = gtk_combo_box_text_new ();
|
panel->priv->tag_groups_combo = gtk_combo_box_text_new ();
|
||||||
#else
|
|
||||||
panel->priv->tag_groups_combo = gtk_combo_box_new_text ();
|
|
||||||
#endif
|
|
||||||
gtk_box_pack_start (GTK_BOX (panel),
|
gtk_box_pack_start (GTK_BOX (panel),
|
||||||
panel->priv->tag_groups_combo,
|
panel->priv->tag_groups_combo,
|
||||||
FALSE,
|
FALSE,
|
||||||
|
|
|
@ -64,11 +64,7 @@ struct _PlumaHistoryEntryPrivate
|
||||||
GSettings *settings;
|
GSettings *settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION (3, 0, 0)
|
|
||||||
G_DEFINE_TYPE(PlumaHistoryEntry, pluma_history_entry, GTK_TYPE_COMBO_BOX_TEXT)
|
G_DEFINE_TYPE(PlumaHistoryEntry, pluma_history_entry, GTK_TYPE_COMBO_BOX_TEXT)
|
||||||
#else
|
|
||||||
G_DEFINE_TYPE(PlumaHistoryEntry, pluma_history_entry, GTK_TYPE_COMBO_BOX_ENTRY)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pluma_history_entry_set_property (GObject *object,
|
pluma_history_entry_set_property (GObject *object,
|
||||||
|
@ -514,12 +510,8 @@ pluma_history_entry_new (const gchar *history_id,
|
||||||
ret = g_object_new (PLUMA_TYPE_HISTORY_ENTRY,
|
ret = g_object_new (PLUMA_TYPE_HISTORY_ENTRY,
|
||||||
"history-id", history_id,
|
"history-id", history_id,
|
||||||
"model", store,
|
"model", store,
|
||||||
#if GTK_CHECK_VERSION (3, 0, 0)
|
|
||||||
"has-entry", TRUE,
|
"has-entry", TRUE,
|
||||||
"id-column", 0,
|
"entry-text-column", 0,
|
||||||
#else
|
|
||||||
"text-column", 0,
|
|
||||||
#endif
|
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_object_unref (store);
|
g_object_unref (store);
|
||||||
|
|
|
@ -48,20 +48,12 @@ typedef struct _PlumaHistoryEntryPrivate PlumaHistoryEntryPrivate;
|
||||||
|
|
||||||
struct _PlumaHistoryEntryClass
|
struct _PlumaHistoryEntryClass
|
||||||
{
|
{
|
||||||
#if GTK_CHECK_VERSION (3, 0, 0)
|
|
||||||
GtkComboBoxTextClass parent_class;
|
GtkComboBoxTextClass parent_class;
|
||||||
#else
|
|
||||||
GtkComboBoxEntryClass parent_class;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _PlumaHistoryEntry
|
struct _PlumaHistoryEntry
|
||||||
{
|
{
|
||||||
#if GTK_CHECK_VERSION (3, 0, 0)
|
|
||||||
GtkComboBoxText parent_instance;
|
GtkComboBoxText parent_instance;
|
||||||
#else
|
|
||||||
GtkComboBoxEntry parent_instance;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PlumaHistoryEntryPrivate *priv;
|
PlumaHistoryEntryPrivate *priv;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue