From: Jim Evins Date: Wed, 20 Apr 2005 00:01:30 +0000 (+0000) Subject: 2005-04-19 Jim Evins X-Git-Tag: glabels-2_3_0~425 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2c6b6469e0956561eed729f5d56865456abfec50;p=glabels 2005-04-19 Jim Evins * data/glade/object-editor.glade: * src/object-editor-bc-page.c: (gl_object_editor_prepare_bc_page), (style_changed_cb), (gl_object_editor_set_bc_style), (gl_object_editor_get_bc_style), (gl_object_editor_set_bc_color), (gl_object_editor_get_bc_color): * src/object-editor-data-page.c: (gl_object_editor_prepare_data_page), (gl_object_editor_set_data), (gl_object_editor_get_data): * src/object-editor-edit-page.c: (gl_object_editor_prepare_edit_page), (insert_button_cb): * src/object-editor-fill-page.c: (gl_object_editor_prepare_fill_page), (gl_object_editor_set_fill_color), (gl_object_editor_get_fill_color): * src/object-editor-image-page.c: (gl_object_editor_prepare_image_page), (gl_object_editor_set_image), (gl_object_editor_get_image): * src/object-editor-line-page.c: (gl_object_editor_prepare_line_page), (gl_object_editor_set_line_color), (gl_object_editor_get_line_color): * src/object-editor-private.h: * src/object-editor-text-page.c: (gl_object_editor_prepare_text_page), (gl_object_editor_set_font_family), (gl_object_editor_get_font_family), (gl_object_editor_set_text_color), (gl_object_editor_get_text_color): * src/object-editor.c: (gl_object_editor_set_key_names): * src/ui-sidebar.c: In the object editor: replaced all instances of the deprecated GtkCombo widget with the new GtkComboBox. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@524 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index a47d3dff..b8924d38 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,38 @@ +2005-04-19 Jim Evins + + * data/glade/object-editor.glade: + * src/object-editor-bc-page.c: (gl_object_editor_prepare_bc_page), + (style_changed_cb), (gl_object_editor_set_bc_style), + (gl_object_editor_get_bc_style), (gl_object_editor_set_bc_color), + (gl_object_editor_get_bc_color): + * src/object-editor-data-page.c: + (gl_object_editor_prepare_data_page), (gl_object_editor_set_data), + (gl_object_editor_get_data): + * src/object-editor-edit-page.c: + (gl_object_editor_prepare_edit_page), (insert_button_cb): + * src/object-editor-fill-page.c: + (gl_object_editor_prepare_fill_page), + (gl_object_editor_set_fill_color), + (gl_object_editor_get_fill_color): + * src/object-editor-image-page.c: + (gl_object_editor_prepare_image_page), + (gl_object_editor_set_image), (gl_object_editor_get_image): + * src/object-editor-line-page.c: + (gl_object_editor_prepare_line_page), + (gl_object_editor_set_line_color), + (gl_object_editor_get_line_color): + * src/object-editor-private.h: + * src/object-editor-text-page.c: + (gl_object_editor_prepare_text_page), + (gl_object_editor_set_font_family), + (gl_object_editor_get_font_family), + (gl_object_editor_set_text_color), + (gl_object_editor_get_text_color): + * src/object-editor.c: (gl_object_editor_set_key_names): + * src/ui-sidebar.c: + In the object editor: replaced all instances of the deprecated + GtkCombo widget with the new GtkComboBox. + 2005-04-18 Jim Evins * src/stock.c: diff --git a/glabels2/data/glade/object-editor.glade b/glabels2/data/glade/object-editor.glade index f9bb0579..386e96fd 100644 --- a/glabels2/data/glade/object-editor.glade +++ b/glabels2/data/glade/object-editor.glade @@ -212,40 +212,15 @@ - + True - True - False - False - True - False - - - - 66 - True - True - False - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - + False + True 0 - False - False + True + True @@ -464,39 +439,15 @@ 12 - + True - True - False - False - True - False - - - - True - True - False - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - + False + True 0 - False - False + True + True @@ -872,40 +823,15 @@ 12 - - 80 + True - False - True - False - True - False - - - - True - True - False - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - + False + True 0 - False - False + True + True @@ -1199,40 +1125,15 @@ 12 - - 80 + True - False - True - False - True - False - - - - True - True - False - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - + False + True 0 - False - False + True + True @@ -1439,40 +1340,15 @@ 12 - - 80 + True - False - True - False - True - False - - - - True - True - False - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - + False + True 0 - False - False + True + True @@ -1625,45 +1501,6 @@ - - - True - False - True - False - True - False - - - - True - True - False - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - - 1 - 2 - 1 - 2 - - - - True @@ -1682,6 +1519,21 @@ fill + + + + True + False + True + + + 1 + 2 + 1 + 2 + fill + + 0 @@ -1821,39 +1673,15 @@ 12 - + True - False - True - False - True - False - - - - True - True - False - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - + False + True 0 - False - False + True + True @@ -2057,34 +1885,6 @@ 12 12 - - - True - Style: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - True @@ -2092,34 +1892,10 @@ 12 - + True - True - True - False - True - False - - - - True - True - False - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - + False + True 0 @@ -2155,29 +1931,6 @@ 2 1 2 - fill - - - - - - - True - True - Checksum - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - 2 - 2 - 3 - fill @@ -2281,40 +2034,15 @@ 12 - - 80 + True - False - True - False - True - False - - - - True - True - False - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - + False + True 0 - False - False + True + True @@ -2337,11 +2065,59 @@ 2 3 4 - fill fill + + + True + True + Checksum + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + 2 + 2 + 3 + + + + + + + True + Style: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + True diff --git a/glabels2/src/object-editor-bc-page.c b/glabels2/src/object-editor-bc-page.c index b026ef8d..b5b57fc7 100644 --- a/glabels2/src/object-editor-bc-page.c +++ b/glabels2/src/object-editor-bc-page.c @@ -26,9 +26,8 @@ #include #include #include -#include +#include #include -#include #include #include "prefs.h" @@ -72,8 +71,6 @@ gl_object_editor_prepare_bc_page (glObjectEditor *editor) /* Extract widgets from XML tree. */ editor->priv->bc_page_vbox = glade_xml_get_widget (editor->priv->gui, "bc_page_vbox"); - editor->priv->bc_style_entry = - glade_xml_get_widget (editor->priv->gui, "bc_style_entry"); editor->priv->bc_style_combo = glade_xml_get_widget (editor->priv->gui, "bc_style_combo"); editor->priv->bc_text_check = @@ -84,8 +81,6 @@ gl_object_editor_prepare_bc_page (glObjectEditor *editor) glade_xml_get_widget (editor->priv->gui, "bc_color_combo"); editor->priv->bc_key_combo = glade_xml_get_widget (editor->priv->gui, "bc_key_combo"); - editor->priv->bc_key_entry = - glade_xml_get_widget (editor->priv->gui, "bc_key_entry"); editor->priv->bc_key_radio = glade_xml_get_widget (editor->priv->gui, "bc_key_radio"); editor->priv->bc_color_radio = @@ -101,9 +96,13 @@ gl_object_editor_prepare_bc_page (glObjectEditor *editor) editor->priv->data_format_fixed_flag = FALSE; + gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->bc_style_combo)); + gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->bc_key_combo)); + /* Load barcode styles */ styles = gl_barcode_get_styles_list (); - gtk_combo_set_popdown_strings (GTK_COMBO(editor->priv->bc_style_combo), styles); + gl_util_combo_box_set_strings (GTK_COMBO_BOX(editor->priv->bc_style_combo), + styles); gl_barcode_free_styles_list (styles); /* Modify widgets */ @@ -115,7 +114,7 @@ gl_object_editor_prepare_bc_page (glObjectEditor *editor) gtk_widget_show_all (editor->priv->bc_page_vbox); /* Connect signals */ - g_signal_connect_swapped (G_OBJECT (editor->priv->bc_style_entry), + g_signal_connect_swapped (G_OBJECT (editor->priv->bc_style_combo), "changed", G_CALLBACK (style_changed_cb), G_OBJECT (editor)); @@ -131,7 +130,7 @@ gl_object_editor_prepare_bc_page (glObjectEditor *editor) "color_changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); - g_signal_connect_swapped (G_OBJECT (editor->priv->bc_key_entry), + g_signal_connect_swapped (G_OBJECT (editor->priv->bc_key_combo), "changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); @@ -163,7 +162,7 @@ style_changed_cb (glObjectEditor *editor) guint digits; style_string = - gtk_editable_get_chars (GTK_EDITABLE(editor->priv->bc_style_entry), 0, -1); + gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->bc_style_combo)); /* Don't emit if entry is empty. */ if ( *style_string != 0 ) { @@ -223,12 +222,11 @@ gl_object_editor_set_bc_style (glObjectEditor *editor, guint format_digits) { const gchar *style_string; - gint pos; gchar *ex_string; gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_style_entry), + g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_style_combo), G_CALLBACK (style_changed_cb), editor); g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_text_check), @@ -243,14 +241,8 @@ gl_object_editor_set_bc_style (glObjectEditor *editor, style_string = gl_barcode_id_to_name (id); - gtk_editable_delete_text (GTK_EDITABLE (editor->priv->bc_style_entry), - 0, -1); - - pos = 0; - gtk_editable_insert_text (GTK_EDITABLE (editor->priv->bc_style_entry), - style_string, - strlen (style_string), - &pos); + gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->bc_style_combo), + style_string); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->bc_text_check), text_flag); @@ -290,7 +282,7 @@ gl_object_editor_set_bc_style (glObjectEditor *editor, !editor->priv->data_format_fixed_flag); } - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_style_entry), + g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_style_combo), G_CALLBACK (style_changed_cb), editor); g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_text_check), @@ -321,8 +313,7 @@ gl_object_editor_get_bc_style (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); style_string = - gtk_editable_get_chars (GTK_EDITABLE(editor->priv->bc_style_entry), - 0, -1); + gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->bc_style_combo)); *id = g_strdup (gl_barcode_name_to_id (style_string)); *text_flag = @@ -349,14 +340,13 @@ gl_object_editor_set_bc_color (glObjectEditor *editor, glColorNode *color_node) { GdkColor *gdk_color; - gint pos; gl_debug (DEBUG_EDITOR, "START"); g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_color_combo), gl_object_editor_changed_cb, editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_key_entry), + g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_key_combo), gl_object_editor_changed_cb, editor); @@ -386,20 +376,14 @@ 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); - gtk_editable_delete_text (GTK_EDITABLE (editor->priv->bc_key_entry), 0, -1); - pos = 0; - if (color_node->key != NULL ) { - gtk_editable_insert_text (GTK_EDITABLE (editor->priv->bc_key_entry), - color_node->key, - strlen (color_node->key), - &pos); - } + gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->bc_key_combo), + color_node->key); } g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_color_combo), gl_object_editor_changed_cb, editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_key_entry), + g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_key_combo), gl_object_editor_changed_cb, editor); @@ -424,7 +408,7 @@ gl_object_editor_get_bc_color (glObjectEditor *editor) color_node->field_flag = TRUE; color_node->color = gl_prefs->default_line_color; color_node->key = - gtk_editable_get_chars (GTK_EDITABLE (editor->priv->bc_key_entry), 0, -1); + gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->bc_key_combo)); } else { color_node->field_flag = FALSE; color_node->key = NULL; diff --git a/glabels2/src/object-editor-data-page.c b/glabels2/src/object-editor-data-page.c index 518f1618..24b7e523 100644 --- a/glabels2/src/object-editor-data-page.c +++ b/glabels2/src/object-editor-data-page.c @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -75,8 +76,8 @@ gl_object_editor_prepare_data_page (glObjectEditor *editor) "data_text_entry"); editor->priv->data_key_combo = glade_xml_get_widget (editor->priv->gui, "data_key_combo"); - editor->priv->data_key_entry = glade_xml_get_widget (editor->priv->gui, - "data_key_entry"); + + gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->data_key_combo)); /* Un-hide */ gtk_widget_show_all (editor->priv->data_page_vbox); @@ -86,7 +87,7 @@ gl_object_editor_prepare_data_page (glObjectEditor *editor) "changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); - g_signal_connect_swapped (G_OBJECT (editor->priv->data_key_entry), + g_signal_connect_swapped (G_OBJECT (editor->priv->data_key_combo), "changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); @@ -149,7 +150,7 @@ gl_object_editor_set_data (glObjectEditor *editor, g_signal_handlers_block_by_func (G_OBJECT (editor->priv->data_text_entry), G_CALLBACK (gl_object_editor_changed_cb), editor); - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->data_key_entry), + g_signal_handlers_block_by_func (G_OBJECT (editor->priv->data_key_combo), G_CALLBACK (gl_object_editor_changed_cb), editor); @@ -189,19 +190,16 @@ gl_object_editor_set_data (glObjectEditor *editor, gtk_widget_set_sensitive (editor->priv->data_digits_spin, !editor->priv->data_format_fixed_flag); - gtk_editable_delete_text (GTK_EDITABLE (editor->priv->data_key_entry), 0, -1); - pos = 0; - gtk_editable_insert_text (GTK_EDITABLE (editor->priv->data_key_entry), - text_node->data, - strlen (text_node->data), - &pos); + + gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->data_key_combo), + text_node->data); } g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->data_text_entry), G_CALLBACK (gl_object_editor_changed_cb), editor); - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->data_key_entry), + g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->data_key_combo), G_CALLBACK (gl_object_editor_changed_cb), editor); @@ -228,8 +226,7 @@ gl_object_editor_get_data (glObjectEditor *editor) } else { text_node->field_flag = TRUE; text_node->data = - gtk_editable_get_chars (GTK_EDITABLE (editor->priv->data_key_entry), - 0, -1); + gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->data_key_combo)); } gl_debug (DEBUG_EDITOR, "text_node: field_flag=%d, data=%s", diff --git a/glabels2/src/object-editor-edit-page.c b/glabels2/src/object-editor-edit-page.c index d9e25ead..ba9c584b 100644 --- a/glabels2/src/object-editor-edit-page.c +++ b/glabels2/src/object-editor-edit-page.c @@ -24,9 +24,8 @@ #include "object-editor.h" #include -#include -#include #include +#include #include #include "prefs.h" @@ -63,7 +62,6 @@ void gl_object_editor_prepare_edit_page (glObjectEditor *editor) { GList *family_names = NULL; - GtkSizeGroup *label_size_group; GtkWidget *label; gl_debug (DEBUG_EDITOR, "START"); @@ -75,13 +73,13 @@ gl_object_editor_prepare_edit_page (glObjectEditor *editor) glade_xml_get_widget (editor->priv->gui, "edit_text_view"); editor->priv->edit_key_label = glade_xml_get_widget (editor->priv->gui, "edit_key_label"); - editor->priv->edit_key_entry = - glade_xml_get_widget (editor->priv->gui, "edit_key_entry"); editor->priv->edit_key_combo = glade_xml_get_widget (editor->priv->gui, "edit_key_combo"); editor->priv->edit_insert_field_button = glade_xml_get_widget (editor->priv->gui, "edit_insert_field_button"); + gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->edit_key_combo)); + /* Un-hide */ gtk_widget_show_all (editor->priv->edit_page_vbox); @@ -105,8 +103,7 @@ insert_button_cb (glObjectEditor *editor) gl_debug (DEBUG_EDITOR, "START"); - key = - gtk_editable_get_chars (GTK_EDITABLE (editor->priv->edit_key_entry), 0, -1); + key = gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->edit_key_combo)); field = g_strdup_printf ("${%s}", key); gl_debug (DEBUG_WDGT, "Inserting %s", field); diff --git a/glabels2/src/object-editor-fill-page.c b/glabels2/src/object-editor-fill-page.c index 8f264633..a09532b1 100644 --- a/glabels2/src/object-editor-fill-page.c +++ b/glabels2/src/object-editor-fill-page.c @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include "prefs.h" @@ -72,14 +72,14 @@ gl_object_editor_prepare_fill_page (glObjectEditor *editor) "fill_color_combo"); editor->priv->fill_key_combo = glade_xml_get_widget (editor->priv->gui, "fill_key_combo"); - editor->priv->fill_key_entry = glade_xml_get_widget (editor->priv->gui, - "fill_key_entry"); editor->priv->fill_key_radio = glade_xml_get_widget (editor->priv->gui, "fill_key_radio"); editor->priv->fill_color_radio = glade_xml_get_widget (editor->priv->gui, "fill_color_radio"); + gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->fill_key_combo)); + /* Modify widgets based on configuration */ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->fill_color_radio), TRUE); gtk_widget_set_sensitive (editor->priv->fill_color_combo, TRUE); @@ -96,7 +96,7 @@ gl_object_editor_prepare_fill_page (glObjectEditor *editor) "color_changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); - g_signal_connect_swapped (G_OBJECT (editor->priv->fill_key_entry), + g_signal_connect_swapped (G_OBJECT (editor->priv->fill_key_combo), "changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); @@ -120,14 +120,13 @@ gl_object_editor_set_fill_color (glObjectEditor *editor, glColorNode *color_node) { GdkColor *gdk_color; - gint pos; gl_debug (DEBUG_EDITOR, "START"); g_signal_handlers_block_by_func (G_OBJECT(editor->priv->fill_color_combo), G_CALLBACK (gl_object_editor_changed_cb), editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->fill_key_entry), + g_signal_handlers_block_by_func (G_OBJECT(editor->priv->fill_key_combo), G_CALLBACK (gl_object_editor_changed_cb), editor); @@ -158,20 +157,14 @@ 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); - gtk_editable_delete_text (GTK_EDITABLE (editor->priv->fill_key_entry), 0, -1); - pos = 0; - if (color_node->key != NULL ) { - gtk_editable_insert_text (GTK_EDITABLE (editor->priv->fill_key_entry), - color_node->key, - strlen (color_node->key), - &pos); - } + gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->fill_key_combo), + color_node->key); } g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->fill_color_combo), G_CALLBACK (gl_object_editor_changed_cb), editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->fill_key_entry), + g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->fill_key_combo), G_CALLBACK (gl_object_editor_changed_cb), editor); @@ -195,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_editable_get_chars (GTK_EDITABLE (editor->priv->fill_key_entry), 0, -1); + gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->fill_key_combo)); } else { color_node->field_flag = FALSE; color_node->key = NULL; diff --git a/glabels2/src/object-editor-image-page.c b/glabels2/src/object-editor-image-page.c index 114e29e4..d810604e 100644 --- a/glabels2/src/object-editor-image-page.c +++ b/glabels2/src/object-editor-image-page.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include @@ -84,8 +84,8 @@ gl_object_editor_prepare_image_page (glObjectEditor *editor) "img_file_button"); editor->priv->img_key_combo = glade_xml_get_widget (editor->priv->gui, "img_key_combo"); - editor->priv->img_key_entry = glade_xml_get_widget (editor->priv->gui, - "img_key_entry"); + + gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->img_key_combo)); /* Modify file button properties. */ add_image_filters_to_chooser (GTK_FILE_CHOOSER (editor->priv->img_file_button)); @@ -103,7 +103,7 @@ gl_object_editor_prepare_image_page (glObjectEditor *editor) "selection-changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); - g_signal_connect_swapped (G_OBJECT (editor->priv->img_key_entry), + g_signal_connect_swapped (G_OBJECT (editor->priv->img_key_combo), "changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); @@ -149,14 +149,12 @@ gl_object_editor_set_image (glObjectEditor *editor, gboolean merge_flag, glTextNode *text_node) { - gint pos; - gl_debug (DEBUG_EDITOR, "START"); g_signal_handlers_block_by_func (G_OBJECT (editor->priv->img_file_button), G_CALLBACK (gl_object_editor_changed_cb), editor); - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->img_key_entry), + g_signal_handlers_block_by_func (G_OBJECT (editor->priv->img_key_combo), G_CALLBACK (gl_object_editor_changed_cb), editor); @@ -183,18 +181,14 @@ 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); - gtk_editable_delete_text (GTK_EDITABLE (editor->priv->img_key_entry), 0, -1); - pos = 0; - gtk_editable_insert_text (GTK_EDITABLE (editor->priv->img_key_entry), - text_node->data, - strlen (text_node->data), - &pos); + gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->img_key_combo), + text_node->data); } g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->img_file_button), G_CALLBACK (gl_object_editor_changed_cb), editor); - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->img_key_entry), + g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->img_key_combo), G_CALLBACK (gl_object_editor_changed_cb), editor); @@ -220,8 +214,7 @@ gl_object_editor_get_image (glObjectEditor *editor) } else { text_node->field_flag = TRUE; text_node->data = - gtk_editable_get_chars (GTK_EDITABLE (editor->priv->img_key_entry), - 0, -1); + gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->img_key_combo)); } gl_debug (DEBUG_EDITOR, "text_node: field_flag=%d, data=%s", diff --git a/glabels2/src/object-editor-line-page.c b/glabels2/src/object-editor-line-page.c index 5e03bece..e1aa2831 100644 --- a/glabels2/src/object-editor-line-page.c +++ b/glabels2/src/object-editor-line-page.c @@ -26,9 +26,8 @@ #include #include #include -#include +#include #include -#include #include #include "prefs.h" @@ -76,13 +75,13 @@ gl_object_editor_prepare_line_page (glObjectEditor *editor) "line_color_combo"); editor->priv->line_key_combo = glade_xml_get_widget (editor->priv->gui, "line_key_combo"); - editor->priv->line_key_entry = glade_xml_get_widget (editor->priv->gui, - "line_key_entry"); editor->priv->line_key_radio = glade_xml_get_widget (editor->priv->gui, "line_key_radio"); editor->priv->line_color_radio = glade_xml_get_widget (editor->priv->gui, "line_color_radio"); + gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->line_key_combo)); + /* Modify widgets based on configuration */ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->line_color_radio), TRUE); gtk_widget_set_sensitive (editor->priv->line_color_combo, TRUE); @@ -105,7 +104,7 @@ gl_object_editor_prepare_line_page (glObjectEditor *editor) "color_changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); - g_signal_connect_swapped (G_OBJECT (editor->priv->line_key_entry), + g_signal_connect_swapped (G_OBJECT (editor->priv->line_key_combo), "changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); @@ -171,7 +170,6 @@ gl_object_editor_set_line_color (glObjectEditor *editor, glColorNode *color_node) { GdkColor *gdk_color; - gint pos; gl_debug (DEBUG_EDITOR, "START"); @@ -179,7 +177,7 @@ gl_object_editor_set_line_color (glObjectEditor *editor, gl_object_editor_changed_cb, editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->line_key_entry), + g_signal_handlers_block_by_func (G_OBJECT(editor->priv->line_key_combo), G_CALLBACK (gl_object_editor_changed_cb), editor); @@ -211,20 +209,14 @@ 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); - gtk_editable_delete_text (GTK_EDITABLE (editor->priv->line_key_entry), 0, -1); - pos = 0; - if (color_node->key != NULL ) { - gtk_editable_insert_text (GTK_EDITABLE (editor->priv->line_key_entry), - color_node->key, - strlen (color_node->key), - &pos); - } + gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->line_key_combo), + color_node->key); } g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->line_color_combo), gl_object_editor_changed_cb, editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->line_key_entry), + g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->line_key_combo), gl_object_editor_changed_cb, editor); @@ -248,7 +240,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_editable_get_chars (GTK_EDITABLE (editor->priv->line_key_entry), 0, -1); + gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->line_key_combo)); } else { color_node->field_flag = FALSE; color_node->key = NULL; diff --git a/glabels2/src/object-editor-private.h b/glabels2/src/object-editor-private.h index b8f4afc2..acb5045c 100644 --- a/glabels2/src/object-editor-private.h +++ b/glabels2/src/object-editor-private.h @@ -75,7 +75,6 @@ struct _glObjectEditorPrivate { GtkWidget *fill_page_vbox; GtkWidget *fill_color_combo; GtkWidget *fill_key_combo; - GtkWidget *fill_key_entry; GtkWidget *fill_key_radio; GtkWidget *fill_color_radio; @@ -85,17 +84,14 @@ struct _glObjectEditorPrivate { GtkWidget *line_color_combo; GtkWidget *line_key_radio; GtkWidget *line_key_combo; - GtkWidget *line_key_entry; GtkWidget *img_page_vbox; GtkWidget *img_file_radio; GtkWidget *img_key_radio; GtkWidget *img_file_button; GtkWidget *img_key_combo; - GtkWidget *img_key_entry; GtkWidget *text_page_vbox; - GtkWidget *text_family_entry; GtkWidget *text_family_combo; GtkWidget *text_size_spin; GtkWidget *text_bold_toggle; @@ -104,7 +100,6 @@ struct _glObjectEditorPrivate { GtkWidget *text_color_combo; GtkWidget *text_color_key_radio; GtkWidget *text_color_key_combo; - GtkWidget *text_color_key_entry; GtkWidget *text_left_toggle; GtkWidget *text_center_toggle; GtkWidget *text_right_toggle; @@ -114,12 +109,10 @@ struct _glObjectEditorPrivate { GtkWidget *edit_page_vbox; GtkWidget *edit_text_view; GtkWidget *edit_key_label; - GtkWidget *edit_key_entry; GtkWidget *edit_key_combo; GtkWidget *edit_insert_field_button; GtkWidget *bc_page_vbox; - GtkWidget *bc_style_entry; GtkWidget *bc_style_combo; GtkWidget *bc_text_check; GtkWidget *bc_cs_check; @@ -127,13 +120,11 @@ struct _glObjectEditorPrivate { GtkWidget *bc_color_combo; GtkWidget *bc_key_radio; GtkWidget *bc_key_combo; - GtkWidget *bc_key_entry; GtkWidget *data_page_vbox; GtkWidget *data_literal_radio; GtkWidget *data_key_radio; GtkWidget *data_text_entry; - GtkWidget *data_key_entry; GtkWidget *data_key_combo; GtkWidget *data_format_label; GtkWidget *data_ex_label; diff --git a/glabels2/src/object-editor-text-page.c b/glabels2/src/object-editor-text-page.c index c6d3fc5c..ab93283b 100644 --- a/glabels2/src/object-editor-text-page.c +++ b/glabels2/src/object-editor-text-page.c @@ -26,8 +26,7 @@ #include #include #include -#include -#include +#include #include #include "prefs.h" @@ -72,8 +71,6 @@ gl_object_editor_prepare_text_page (glObjectEditor *editor) /* Extract widgets from XML tree. */ editor->priv->text_page_vbox = glade_xml_get_widget (editor->priv->gui, "text_page_vbox"); - editor->priv->text_family_entry = - glade_xml_get_widget (editor->priv->gui, "text_family_entry"); editor->priv->text_family_combo = glade_xml_get_widget (editor->priv->gui, "text_family_combo"); editor->priv->text_size_spin = @@ -90,8 +87,6 @@ gl_object_editor_prepare_text_page (glObjectEditor *editor) glade_xml_get_widget (editor->priv->gui, "text_color_key_radio"); editor->priv->text_color_key_combo = glade_xml_get_widget (editor->priv->gui, "text_color_key_combo"); - editor->priv->text_color_key_entry = - glade_xml_get_widget (editor->priv->gui, "text_color_key_entry"); editor->priv->text_left_toggle = glade_xml_get_widget (editor->priv->gui, "text_left_toggle"); editor->priv->text_center_toggle = @@ -103,9 +98,12 @@ gl_object_editor_prepare_text_page (glObjectEditor *editor) editor->priv->text_auto_shrink_check = glade_xml_get_widget (editor->priv->gui, "text_auto_shrink_check"); + gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->text_family_combo)); + gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->text_color_key_combo)); + /* Load family names */ family_names = gnome_font_family_list (); - gtk_combo_set_popdown_strings (GTK_COMBO(editor->priv->text_family_combo), + gl_util_combo_box_set_strings (GTK_COMBO_BOX(editor->priv->text_family_combo), family_names); gnome_font_family_list_free (family_names); @@ -118,7 +116,7 @@ gl_object_editor_prepare_text_page (glObjectEditor *editor) gtk_widget_show_all (editor->priv->text_page_vbox); /* Connect signals */ - g_signal_connect_swapped (G_OBJECT (editor->priv->text_family_entry), + g_signal_connect_swapped (G_OBJECT (editor->priv->text_family_combo), "changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); @@ -138,7 +136,7 @@ gl_object_editor_prepare_text_page (glObjectEditor *editor) "color_changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); - g_signal_connect_swapped (G_OBJECT (editor->priv->text_color_key_entry), + g_signal_connect_swapped (G_OBJECT (editor->priv->text_color_key_combo), "changed", G_CALLBACK (gl_object_editor_changed_cb), G_OBJECT (editor)); @@ -229,7 +227,7 @@ gl_object_editor_set_font_family (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_family_entry), + g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_family_combo), gl_object_editor_changed_cb, editor); @@ -245,10 +243,10 @@ gl_object_editor_set_font_family (glObjectEditor *editor, } } gnome_font_family_list_free (family_names); - gtk_entry_set_text (GTK_ENTRY (editor->priv->text_family_entry), good_font_family); + gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->text_family_combo), good_font_family); g_free (good_font_family); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_family_entry), + g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_family_combo), gl_object_editor_changed_cb, editor); @@ -265,9 +263,7 @@ gl_object_editor_get_font_family (glObjectEditor *editor) gl_debug (DEBUG_EDITOR, "START"); - font_family = - gtk_editable_get_chars (GTK_EDITABLE (editor->priv->text_family_entry), - 0, -1); + font_family = gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->text_family_combo)); gl_debug (DEBUG_EDITOR, "END"); @@ -488,7 +484,7 @@ gl_object_editor_set_text_color (glObjectEditor *editor, g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_color_combo), gl_object_editor_changed_cb, editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_color_key_entry), + g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_color_key_combo), gl_object_editor_changed_cb, editor); @@ -520,22 +516,15 @@ 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); - gtk_editable_delete_text (GTK_EDITABLE (editor->priv->text_color_key_entry), 0, -1); - pos = 0; gl_debug (DEBUG_EDITOR, "color field true 1"); - if (text_color_node->key != NULL ) { - gtk_editable_insert_text (GTK_EDITABLE (editor->priv->text_color_key_entry), - text_color_node->key, - strlen (text_color_node->key), - &pos); - } + gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->text_color_key_combo)); gl_debug (DEBUG_EDITOR, "color field true 2"); } g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_color_combo), gl_object_editor_changed_cb, editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_color_key_entry), + g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_color_key_combo), gl_object_editor_changed_cb, editor); @@ -560,7 +549,7 @@ gl_object_editor_get_text_color (glObjectEditor *editor) color_node->field_flag = TRUE; color_node->color = gl_prefs->default_text_color; color_node->key = - gtk_editable_get_chars (GTK_EDITABLE (editor->priv->text_color_key_entry), 0, -1); + gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->text_color_key_combo)); } else { color_node->field_flag = FALSE; color_node->key = NULL; diff --git a/glabels2/src/object-editor.c b/glabels2/src/object-editor.c index 107428f2..cfc67c75 100644 --- a/glabels2/src/object-editor.c +++ b/glabels2/src/object-editor.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include @@ -489,37 +489,37 @@ gl_object_editor_set_key_names (glObjectEditor *editor, combo = editor->priv->img_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } combo = editor->priv->edit_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } combo = editor->priv->data_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } combo = editor->priv->fill_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } combo = editor->priv->text_color_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } combo = editor->priv->line_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } combo = editor->priv->bc_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } gl_merge_free_key_list (&keys); @@ -529,37 +529,37 @@ gl_object_editor_set_key_names (glObjectEditor *editor, combo = editor->priv->img_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } combo = editor->priv->edit_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } combo = editor->priv->data_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } combo = editor->priv->fill_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } combo = editor->priv->text_color_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } combo = editor->priv->line_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } combo = editor->priv->bc_key_combo; if (combo) { - gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys); + gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys); } g_list_free (keys); diff --git a/glabels2/src/ui-sidebar.c b/glabels2/src/ui-sidebar.c index 6ee0324a..2549c1b1 100644 --- a/glabels2/src/ui-sidebar.c +++ b/glabels2/src/ui-sidebar.c @@ -37,7 +37,7 @@ /* Private macros and constants. */ /*============================================================================*/ -#define DEFAULT_SIDEBAR_WIDTH 320 +#define DEFAULT_SIDEBAR_WIDTH 340 /*============================================================================*/ /* Private globals */