From: Jim Evins Date: Wed, 16 Dec 2009 03:39:39 +0000 (-0500) Subject: Use glFieldButton instead of GtkComboBox for field selection X-Git-Tag: glabels-2_3_0~112 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cbfbbff95d01ff6daffbb24159aa6fa0a4ae2e1c;p=glabels Use glFieldButton instead of GtkComboBox for field selection Extended glFieldButton so that it could be used instead of a GtkComboBox for field selectors in the object editor. This unifies the dropdown style with the "Insert field" button on the text editor page. --- diff --git a/data/builder/object-editor.builder b/data/builder/object-editor.builder index 117e3608..b618a8ac 100644 --- a/data/builder/object-editor.builder +++ b/data/builder/object-editor.builder @@ -10,10 +10,12 @@ True + vertical True 6 + vertical 12 @@ -57,6 +59,7 @@ True 12 + vertical 6 @@ -124,6 +127,7 @@ True 12 + vertical 12 @@ -293,6 +297,7 @@ True + vertical 6 @@ -352,16 +357,11 @@ - + True 12 - - True - - - 0 - + @@ -552,6 +552,7 @@ True 12 + vertical 12 @@ -631,6 +632,7 @@ True + vertical 6 @@ -690,16 +692,11 @@ - + True 12 - - True - - - 0 - + @@ -742,6 +739,7 @@ True 12 + vertical True @@ -762,6 +760,7 @@ True + vertical 6 @@ -822,16 +821,11 @@ - + True 12 - - True - - - 0 - + @@ -874,6 +868,7 @@ True 12 + vertical 12 @@ -934,8 +929,11 @@ - + True + + + 1 @@ -967,6 +965,7 @@ True 12 + vertical 12 @@ -1024,8 +1023,11 @@ - + True + + + 1 @@ -1155,6 +1157,7 @@ True 12 + vertical 12 @@ -1237,6 +1240,7 @@ True + vertical 6 @@ -1296,16 +1300,11 @@ - + True 12 - - True - - - 0 - + @@ -1527,6 +1526,7 @@ True 12 + vertical 12 @@ -1781,6 +1781,7 @@ True 12 + vertical 12 @@ -1800,6 +1801,7 @@ True + vertical 12 @@ -1933,6 +1935,7 @@ True + vertical 6 @@ -1994,16 +1997,11 @@ - + True 12 - - True - - - 0 - + diff --git a/src/field-button.c b/src/field-button.c index a0061a8f..aad5f510 100644 --- a/src/field-button.c +++ b/src/field-button.c @@ -37,6 +37,9 @@ /** GL_FIELD_BUTTON Private fields */ struct _glFieldButtonPrivate { + gboolean label_is_key; + gchar *key; + GtkWidget *label; GtkWidget *menu; @@ -44,6 +47,7 @@ struct _glFieldButtonPrivate { enum { KEY_SELECTED, + CHANGED, LAST_SIGNAL }; @@ -102,6 +106,15 @@ gl_field_button_class_init (glFieldButtonClass *class) NULL, NULL, gl_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); + + signals[CHANGED] = + g_signal_new ("changed", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (glFieldButtonClass, changed), + NULL, NULL, + gl_marshal_VOID__VOID, + G_TYPE_NONE, 0); } @@ -159,7 +172,14 @@ gl_field_button_new (const gchar *name) this = g_object_new (TYPE_GL_FIELD_BUTTON, NULL); - gtk_label_set_text (GTK_LABEL (this->priv->label), name); + if ( name ) + { + gtk_label_set_text (GTK_LABEL (this->priv->label), name); + } + else + { + this->priv->label_is_key = TRUE; + } this->priv->menu = gl_field_button_menu_new (); @@ -183,11 +203,43 @@ gl_field_button_set_keys (glFieldButton *this, { gl_field_button_menu_set_keys (GL_FIELD_BUTTON_MENU (this->priv->menu), key_list); + this->priv->key = g_strdup (key_list->data); + if ( this->priv->label_is_key ) + { + gtk_label_set_text (GTK_LABEL (this->priv->label), key_list->data); + } gtk_widget_show_all (this->priv->menu); } +/*****************************************************************************/ +/* Set current key. */ +/*****************************************************************************/ +void +gl_field_button_set_key (glFieldButton *this, + const gchar *key) +{ + g_free (this->priv->key); + this->priv->key = g_strdup (key); + + if ( this->priv->label_is_key ) + { + gtk_label_set_text (GTK_LABEL (this->priv->label), key); + } +} + + +/*****************************************************************************/ +/* Get current key. */ +/*****************************************************************************/ +gchar * +gl_field_button_get_key (glFieldButton *this) +{ + return g_strdup (this->priv->key); +} + + /*****************************************************************************/ /* Menu positioning function. */ /*****************************************************************************/ @@ -301,10 +353,19 @@ button_press_event_cb (GtkWidget *widget, /*****************************************************************************/ static void menu_key_selected_cb (glFieldButtonMenu *menu, - gchar *field, + gchar *key, glFieldButton *this) { - g_signal_emit (this, signals[KEY_SELECTED], 0, field); + if (this->priv->label_is_key) + { + gtk_label_set_text (GTK_LABEL (this->priv->label), key); + } + + g_free (this->priv->key); + this->priv->key = g_strdup (key); + + g_signal_emit (this, signals[KEY_SELECTED], 0, key); + g_signal_emit (this, signals[CHANGED], 0); } diff --git a/src/field-button.h b/src/field-button.h index 883558dd..1bd990f1 100644 --- a/src/field-button.h +++ b/src/field-button.h @@ -56,6 +56,9 @@ struct _glFieldButtonClass { gchar *key, gpointer user_data); + void (*changed) (glFieldButton *object, + gpointer user_data); + }; @@ -66,6 +69,12 @@ GtkWidget *gl_field_button_new (const gchar *name); void gl_field_button_set_keys (glFieldButton *this, GList *key_list); +void gl_field_button_set_key (glFieldButton *this, + const gchar *key); + +gchar *gl_field_button_get_key (glFieldButton *this); + + G_END_DECLS #endif /* __GL_COLOR_COMBO_H__ */ diff --git a/src/object-editor-bc-page.c b/src/object-editor-bc-page.c index 24129513..b3b2fe24 100644 --- a/src/object-editor-bc-page.c +++ b/src/object-editor-bc-page.c @@ -29,6 +29,7 @@ #include "prefs.h" #include "color-combo.h" #include "color.h" +#include "field-button.h" #include "combo-util.h" #include "builder-util.h" @@ -77,7 +78,7 @@ gl_object_editor_prepare_bc_page (glObjectEditor *editor) "bc_text_check", &editor->priv->bc_text_check, "bc_cs_check", &editor->priv->bc_cs_check, "bc_color_hbox", &editor->priv->bc_color_hbox, - "bc_key_combo", &editor->priv->bc_key_combo, + "bc_key_hbox", &editor->priv->bc_key_hbox, "bc_key_radio", &editor->priv->bc_key_radio, "bc_color_radio", &editor->priv->bc_color_radio, "data_format_label", &editor->priv->data_format_label, @@ -95,8 +96,12 @@ gl_object_editor_prepare_bc_page (glObjectEditor *editor) editor->priv->bc_color_combo, FALSE, FALSE, 0); + editor->priv->bc_key_combo = gl_field_button_new (NULL); + gtk_box_pack_start (GTK_BOX (editor->priv->bc_key_hbox), + editor->priv->bc_key_combo, + TRUE, TRUE, 0); + gl_combo_util_add_text_model ( GTK_COMBO_BOX(editor->priv->bc_style_combo)); - gl_combo_util_add_text_model ( GTK_COMBO_BOX(editor->priv->bc_key_combo)); /* Load barcode styles */ styles = gl_barcode_get_styles_list (); @@ -257,7 +262,7 @@ gl_object_editor_set_bc_style (glObjectEditor *editor, g_free (ex_string); gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->data_digits_spin), - format_digits); + format_digits); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->data_literal_radio))) { gtk_widget_set_sensitive (editor->priv->data_format_label, FALSE); @@ -349,8 +354,8 @@ gl_object_editor_set_bc_color (glObjectEditor *editor, gtk_widget_set_sensitive (editor->priv->bc_color_combo, FALSE); gtk_widget_set_sensitive (editor->priv->bc_key_combo, TRUE); - gl_combo_util_set_active_text (GTK_COMBO_BOX (editor->priv->bc_key_combo), - color_node->key); + gl_field_button_set_key (GL_FIELD_BUTTON (editor->priv->bc_key_combo), + color_node->key); } editor->priv->stop_signals = FALSE; @@ -377,7 +382,7 @@ gl_object_editor_get_bc_color (glObjectEditor *editor) color_node->field_flag = TRUE; color_node->color = gl_prefs_model_get_default_line_color (gl_prefs); color_node->key = - gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->bc_key_combo)); + gl_field_button_get_key (GL_FIELD_BUTTON (editor->priv->bc_key_combo)); } else { color_node->field_flag = FALSE; color_node->key = NULL; diff --git a/src/object-editor-data-page.c b/src/object-editor-data-page.c index 3c483698..bb2ba930 100644 --- a/src/object-editor-data-page.c +++ b/src/object-editor-data-page.c @@ -28,7 +28,7 @@ #include #include "prefs.h" -#include "combo-util.h" +#include "field-button.h" #include "builder-util.h" #include "object-editor-private.h" @@ -72,10 +72,13 @@ gl_object_editor_prepare_data_page (glObjectEditor *editor) "data_literal_radio", &editor->priv->data_literal_radio, "data_key_radio", &editor->priv->data_key_radio, "data_text_entry", &editor->priv->data_text_entry, - "data_key_combo", &editor->priv->data_key_combo, + "data_key_hbox", &editor->priv->data_key_hbox, NULL); - gl_combo_util_add_text_model ( GTK_COMBO_BOX(editor->priv->data_key_combo)); + editor->priv->data_key_combo = gl_field_button_new (NULL); + gtk_box_pack_start (GTK_BOX (editor->priv->data_key_hbox), + editor->priv->data_key_combo, + TRUE, TRUE, 0); /* Un-hide */ gtk_widget_show_all (editor->priv->data_page_vbox); @@ -187,8 +190,8 @@ gl_object_editor_set_data (glObjectEditor *editor, !editor->priv->data_format_fixed_flag); - gl_combo_util_set_active_text (GTK_COMBO_BOX (editor->priv->data_key_combo), - text_node->data); + gl_field_button_set_key (GL_FIELD_BUTTON (editor->priv->data_key_combo), + text_node->data); } @@ -218,7 +221,7 @@ gl_object_editor_get_data (glObjectEditor *editor) } else { text_node->field_flag = TRUE; text_node->data = - gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->data_key_combo)); + gl_field_button_get_key (GL_FIELD_BUTTON (editor->priv->data_key_combo)); } gl_debug (DEBUG_EDITOR, "text_node: field_flag=%d, data=%s", diff --git a/src/object-editor-fill-page.c b/src/object-editor-fill-page.c index ac60772e..45895d72 100644 --- a/src/object-editor-fill-page.c +++ b/src/object-editor-fill-page.c @@ -29,7 +29,7 @@ #include "prefs.h" #include "color-combo.h" #include "color.h" -#include "combo-util.h" +#include "field-button.h" #include "builder-util.h" #include "object-editor-private.h" @@ -71,7 +71,7 @@ gl_object_editor_prepare_fill_page (glObjectEditor *editor) gl_builder_util_get_widgets (editor->priv->builder, "fill_page_vbox", &editor->priv->fill_page_vbox, "fill_color_hbox", &editor->priv->fill_color_hbox, - "fill_key_combo", &editor->priv->fill_key_combo, + "fill_key_hbox", &editor->priv->fill_key_hbox, "fill_key_radio", &editor->priv->fill_key_radio, "fill_color_radio", &editor->priv->fill_color_radio, NULL); @@ -83,7 +83,10 @@ gl_object_editor_prepare_fill_page (glObjectEditor *editor) editor->priv->fill_color_combo, FALSE, FALSE, 0); - gl_combo_util_add_text_model ( GTK_COMBO_BOX(editor->priv->fill_key_combo)); + editor->priv->fill_key_combo = gl_field_button_new (NULL); + gtk_box_pack_start (GTK_BOX (editor->priv->fill_key_hbox), + editor->priv->fill_key_combo, + TRUE, TRUE, 0); /* Modify widgets based on configuration */ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->fill_color_radio), TRUE); @@ -158,8 +161,8 @@ gl_object_editor_set_fill_color (glObjectEditor *editor, gtk_widget_set_sensitive (editor->priv->fill_color_combo, FALSE); gtk_widget_set_sensitive (editor->priv->fill_key_combo, TRUE); - gl_combo_util_set_active_text (GTK_COMBO_BOX (editor->priv->fill_key_combo), - color_node->key); + gl_field_button_set_key (GL_FIELD_BUTTON (editor->priv->fill_key_combo), + color_node->key); } editor->priv->stop_signals = FALSE; @@ -185,7 +188,7 @@ gl_object_editor_get_fill_color (glObjectEditor *editor) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->fill_key_radio))) { color_node->field_flag = TRUE; color_node->key = - gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->fill_key_combo)); + gl_field_button_get_key (GL_FIELD_BUTTON (editor->priv->fill_key_combo)); } else { color_node->field_flag = FALSE; color_node->key = NULL; diff --git a/src/object-editor-image-page.c b/src/object-editor-image-page.c index 072334e5..c655a113 100644 --- a/src/object-editor-image-page.c +++ b/src/object-editor-image-page.c @@ -27,7 +27,7 @@ #include #include "prefs.h" -#include "combo-util.h" +#include "field-button.h" #include "builder-util.h" #include "object-editor-private.h" @@ -80,10 +80,14 @@ gl_object_editor_prepare_image_page (glObjectEditor *editor) "img_file_radio", &editor->priv->img_file_radio, "img_key_radio", &editor->priv->img_key_radio, "img_file_button", &editor->priv->img_file_button, - "img_key_combo", &editor->priv->img_key_combo, + "img_key_hbox", &editor->priv->img_key_hbox, NULL); - gl_combo_util_add_text_model ( GTK_COMBO_BOX(editor->priv->img_key_combo)); + editor->priv->img_key_combo = gl_field_button_new (NULL); + gtk_box_pack_start (GTK_BOX (editor->priv->img_key_hbox), + editor->priv->img_key_combo, + TRUE, TRUE, 0); + /* Modify file button properties. */ add_image_filters_to_chooser (GTK_FILE_CHOOSER (editor->priv->img_file_button)); @@ -177,8 +181,8 @@ gl_object_editor_set_image (glObjectEditor *editor, gtk_widget_set_sensitive (editor->priv->img_file_button, FALSE); gtk_widget_set_sensitive (editor->priv->img_key_combo, TRUE); - gl_combo_util_set_active_text (GTK_COMBO_BOX (editor->priv->img_key_combo), - text_node->data); + gl_field_button_set_key (GL_FIELD_BUTTON (editor->priv->img_key_combo), + text_node->data); } editor->priv->stop_signals = FALSE; @@ -206,7 +210,7 @@ gl_object_editor_get_image (glObjectEditor *editor) } else { text_node->field_flag = TRUE; text_node->data = - gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->img_key_combo)); + gl_field_button_get_key (GL_FIELD_BUTTON (editor->priv->img_key_combo)); } gl_debug (DEBUG_EDITOR, "text_node: field_flag=%d, data=%s", diff --git a/src/object-editor-line-page.c b/src/object-editor-line-page.c index 957f2620..5622be76 100644 --- a/src/object-editor-line-page.c +++ b/src/object-editor-line-page.c @@ -29,7 +29,7 @@ #include "prefs.h" #include "color-combo.h" #include "color.h" -#include "combo-util.h" +#include "field-button.h" #include "builder-util.h" #include "object-editor-private.h" @@ -71,7 +71,7 @@ gl_object_editor_prepare_line_page (glObjectEditor *editor) "line_page_vbox", &editor->priv->line_page_vbox, "line_width_spin", &editor->priv->line_width_spin, "line_color_hbox", &editor->priv->line_color_hbox, - "line_key_combo", &editor->priv->line_key_combo, + "line_key_hbox", &editor->priv->line_key_hbox, "line_key_radio", &editor->priv->line_key_radio, "line_color_radio", &editor->priv->line_color_radio, NULL); @@ -83,7 +83,10 @@ gl_object_editor_prepare_line_page (glObjectEditor *editor) editor->priv->line_color_combo, FALSE, FALSE, 0); - gl_combo_util_add_text_model ( GTK_COMBO_BOX(editor->priv->line_key_combo)); + editor->priv->line_key_combo = gl_field_button_new (NULL); + gtk_box_pack_start (GTK_BOX (editor->priv->line_key_hbox), + editor->priv->line_key_combo, + TRUE, TRUE, 0); /* Modify widgets based on configuration */ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->line_color_radio), TRUE); @@ -205,8 +208,8 @@ gl_object_editor_set_line_color (glObjectEditor *editor, gtk_widget_set_sensitive (editor->priv->line_color_combo, FALSE); gtk_widget_set_sensitive (editor->priv->line_key_combo, TRUE); - gl_combo_util_set_active_text (GTK_COMBO_BOX (editor->priv->line_key_combo), - color_node->key); + gl_field_button_set_key (GL_FIELD_BUTTON (editor->priv->line_key_combo), + color_node->key); } editor->priv->stop_signals = FALSE; @@ -232,7 +235,7 @@ gl_object_editor_get_line_color (glObjectEditor *editor) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->line_key_radio))) { color_node->field_flag = TRUE; color_node->key = - gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->line_key_combo)); + gl_field_button_get_key (GL_FIELD_BUTTON (editor->priv->line_key_combo)); } else { color_node->field_flag = FALSE; color_node->key = NULL; diff --git a/src/object-editor-private.h b/src/object-editor-private.h index a17efb26..c7ad1dad 100644 --- a/src/object-editor-private.h +++ b/src/object-editor-private.h @@ -77,6 +77,7 @@ struct _glObjectEditorPrivate { GtkWidget *fill_page_vbox; GtkWidget *fill_color_hbox; GtkWidget *fill_color_combo; + GtkWidget *fill_key_hbox; GtkWidget *fill_key_combo; GtkWidget *fill_key_radio; GtkWidget *fill_color_radio; @@ -87,12 +88,14 @@ struct _glObjectEditorPrivate { GtkWidget *line_color_hbox; GtkWidget *line_color_combo; GtkWidget *line_key_radio; + GtkWidget *line_key_hbox; GtkWidget *line_key_combo; GtkWidget *img_page_vbox; GtkWidget *img_file_radio; GtkWidget *img_key_radio; GtkWidget *img_file_button; + GtkWidget *img_key_hbox; GtkWidget *img_key_combo; GtkWidget *text_page_vbox; @@ -105,6 +108,7 @@ struct _glObjectEditorPrivate { GtkWidget *text_color_hbox; GtkWidget *text_color_combo; GtkWidget *text_color_key_radio; + GtkWidget *text_color_key_hbox; GtkWidget *text_color_key_combo; GtkWidget *text_left_toggle; GtkWidget *text_center_toggle; @@ -125,12 +129,14 @@ struct _glObjectEditorPrivate { GtkWidget *bc_color_hbox; GtkWidget *bc_color_combo; GtkWidget *bc_key_radio; + GtkWidget *bc_key_hbox; GtkWidget *bc_key_combo; GtkWidget *data_page_vbox; GtkWidget *data_literal_radio; GtkWidget *data_key_radio; GtkWidget *data_text_entry; + GtkWidget *data_key_hbox; GtkWidget *data_key_combo; GtkWidget *data_format_label; GtkWidget *data_ex_label; @@ -149,6 +155,7 @@ struct _glObjectEditorPrivate { GtkWidget *shadow_key_radio; GtkWidget *shadow_color_hbox; GtkWidget *shadow_color_combo; + GtkWidget *shadow_key_hbox; GtkWidget *shadow_key_combo; GtkWidget *shadow_opacity_spin; gdouble shadow_x; diff --git a/src/object-editor-shadow-page.c b/src/object-editor-shadow-page.c index 4afadc95..6f9b0620 100644 --- a/src/object-editor-shadow-page.c +++ b/src/object-editor-shadow-page.c @@ -29,7 +29,7 @@ #include "prefs.h" #include "color-combo.h" #include "color.h" -#include "combo-util.h" +#include "field-button.h" #include "builder-util.h" #include "units-util.h" @@ -86,7 +86,7 @@ gl_object_editor_prepare_shadow_page (glObjectEditor *editor) "shadow_color_radio", &editor->priv->shadow_color_radio, "shadow_key_radio", &editor->priv->shadow_key_radio, "shadow_color_hbox", &editor->priv->shadow_color_hbox, - "shadow_key_combo", &editor->priv->shadow_key_combo, + "shadow_key_hbox", &editor->priv->shadow_key_hbox, "shadow_opacity_spin", &editor->priv->shadow_opacity_spin, NULL); @@ -96,7 +96,11 @@ gl_object_editor_prepare_shadow_page (glObjectEditor *editor) gtk_container_add (GTK_CONTAINER (editor->priv->shadow_color_hbox), editor->priv->shadow_color_combo); - gl_combo_util_add_text_model ( GTK_COMBO_BOX(editor->priv->shadow_key_combo)); + editor->priv->shadow_key_combo = gl_field_button_new (NULL); + gtk_box_pack_start (GTK_BOX (editor->priv->shadow_key_hbox), + editor->priv->shadow_key_combo, + TRUE, TRUE, 0); + /* Get configuration information */ units = gl_prefs_model_get_units (gl_prefs); @@ -245,8 +249,8 @@ gl_object_editor_set_shadow_color (glObjectEditor *editor, gtk_widget_set_sensitive (editor->priv->shadow_color_combo, FALSE); gtk_widget_set_sensitive (editor->priv->shadow_key_combo, TRUE); - gl_combo_util_set_active_text (GTK_COMBO_BOX (editor->priv->shadow_key_combo), - color_node->key); + gl_field_button_set_key (GL_FIELD_BUTTON (editor->priv->shadow_key_combo), + color_node->key); } editor->priv->stop_signals = FALSE; @@ -372,7 +376,7 @@ gl_object_editor_get_shadow_color (glObjectEditor *editor) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->shadow_key_radio))) { color_node->field_flag = TRUE; color_node->key = - gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->shadow_key_combo)); + gl_field_button_get_key (GL_FIELD_BUTTON (editor->priv->shadow_key_combo)); } else { color_node->field_flag = FALSE; color_node->key = NULL; diff --git a/src/object-editor-text-page.c b/src/object-editor-text-page.c index 8da1b876..b19d212d 100644 --- a/src/object-editor-text-page.c +++ b/src/object-editor-text-page.c @@ -31,7 +31,7 @@ #include "color.h" #include "font-combo.h" #include "font-util.h" -#include "combo-util.h" +#include "field-button.h" #include "builder-util.h" #include "object-editor-private.h" @@ -81,7 +81,7 @@ gl_object_editor_prepare_text_page (glObjectEditor *editor) "text_color_hbox", &editor->priv->text_color_hbox, "text_color_radio", &editor->priv->text_color_radio, "text_color_key_radio", &editor->priv->text_color_key_radio, - "text_color_key_combo", &editor->priv->text_color_key_combo, + "text_color_key_hbox", &editor->priv->text_color_key_hbox, "text_left_toggle", &editor->priv->text_left_toggle, "text_center_toggle", &editor->priv->text_center_toggle, "text_right_toggle", &editor->priv->text_right_toggle, @@ -101,7 +101,11 @@ gl_object_editor_prepare_text_page (glObjectEditor *editor) editor->priv->text_color_combo, FALSE, FALSE, 0); - gl_combo_util_add_text_model ( GTK_COMBO_BOX(editor->priv->text_color_key_combo)); + editor->priv->text_color_key_combo = gl_field_button_new (NULL); + gtk_box_pack_start (GTK_BOX (editor->priv->text_color_key_hbox), + editor->priv->text_color_key_combo, + TRUE, TRUE, 0); + /* Modify widgets */ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_radio), TRUE); @@ -488,7 +492,7 @@ gl_object_editor_set_text_color (glObjectEditor *editor, gtk_widget_set_sensitive (editor->priv->text_color_combo, FALSE); gtk_widget_set_sensitive (editor->priv->text_color_key_combo, TRUE); - gl_combo_util_set_active_text (GTK_COMBO_BOX (editor->priv->text_color_key_combo), ""); + gl_field_button_set_key (GL_FIELD_BUTTON (editor->priv->text_color_key_combo), ""); } editor->priv->stop_signals = FALSE; @@ -515,7 +519,7 @@ gl_object_editor_get_text_color (glObjectEditor *editor) color_node->field_flag = TRUE; color_node->color = gl_prefs_model_get_default_text_color (gl_prefs); color_node->key = - gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->text_color_key_combo)); + gl_field_button_get_key (GL_FIELD_BUTTON (editor->priv->text_color_key_combo)); } else { color_node->field_flag = FALSE; color_node->key = NULL; diff --git a/src/object-editor.c b/src/object-editor.c index dd5d5cca..ed5f6764 100644 --- a/src/object-editor.c +++ b/src/object-editor.c @@ -580,7 +580,6 @@ set_key_names (glObjectEditor *editor, glMerge *merge) { GList *keys; - GtkWidget *combo; GtkWidget *button; gboolean fixed_flag; gboolean state; @@ -693,29 +692,29 @@ set_key_names (glObjectEditor *editor, keys = g_list_append (keys, g_strdup ("")); } - combo = editor->priv->img_key_combo; - gl_combo_util_set_strings (GTK_COMBO_BOX (combo), keys); + button = editor->priv->img_key_combo; + gl_field_button_set_keys (GL_FIELD_BUTTON (button), keys); button = editor->priv->edit_insert_field_button; gl_field_button_set_keys (GL_FIELD_BUTTON(button), keys); - combo = editor->priv->data_key_combo; - gl_combo_util_set_strings (GTK_COMBO_BOX (combo), keys); + button = editor->priv->data_key_combo; + gl_field_button_set_keys (GL_FIELD_BUTTON (button), keys); - combo = editor->priv->fill_key_combo; - gl_combo_util_set_strings (GTK_COMBO_BOX (combo), keys); + button = editor->priv->fill_key_combo; + gl_field_button_set_keys (GL_FIELD_BUTTON (button), keys); - combo = editor->priv->text_color_key_combo; - gl_combo_util_set_strings (GTK_COMBO_BOX (combo), keys); + button = editor->priv->text_color_key_combo; + gl_field_button_set_keys (GL_FIELD_BUTTON (button), keys); - combo = editor->priv->line_key_combo; - gl_combo_util_set_strings (GTK_COMBO_BOX (combo), keys); + button = editor->priv->line_key_combo; + gl_field_button_set_keys (GL_FIELD_BUTTON (button), keys); - combo = editor->priv->bc_key_combo; - gl_combo_util_set_strings (GTK_COMBO_BOX (combo), keys); + button = editor->priv->bc_key_combo; + gl_field_button_set_keys (GL_FIELD_BUTTON (button), keys); - combo = editor->priv->shadow_key_combo; - gl_combo_util_set_strings (GTK_COMBO_BOX (combo), keys); + button = editor->priv->shadow_key_combo; + gl_field_button_set_keys (GL_FIELD_BUTTON (button), keys); gl_merge_free_key_list (&keys);