]> git.sur5r.net Git - glabels/commitdiff
Use glFieldButton instead of GtkComboBox for field selection
authorJim Evins <evins@snaught.com>
Wed, 16 Dec 2009 03:39:39 +0000 (22:39 -0500)
committerJim Evins <evins@snaught.com>
Wed, 16 Dec 2009 03:39:39 +0000 (22:39 -0500)
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.

12 files changed:
data/builder/object-editor.builder
src/field-button.c
src/field-button.h
src/object-editor-bc-page.c
src/object-editor-data-page.c
src/object-editor-fill-page.c
src/object-editor-image-page.c
src/object-editor-line-page.c
src/object-editor-private.h
src/object-editor-shadow-page.c
src/object-editor-text-page.c
src/object-editor.c

index 117e3608e1d361abd64b81dd8d99cfcc378c2cab..b618a8ac9d7337f7f678baec15459c4855a0d57f 100644 (file)
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox1">
         <property name="visible">True</property>
+        <property name="orientation">vertical</property>
         <child>
           <object class="GtkVBox" id="editor_vbox">
             <property name="visible">True</property>
             <property name="border_width">6</property>
+            <property name="orientation">vertical</property>
             <property name="spacing">12</property>
             <child>
               <object class="GtkHBox" id="title_hbox">
@@ -57,6 +59,7 @@
                   <object class="GtkVBox" id="edit_page_vbox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
+                    <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
                       <object class="GtkHBox" id="hbox30">
                   <object class="GtkVBox" id="text_page_vbox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
+                    <property name="orientation">vertical</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkHBox" id="hbox65">
                         <child>
                           <object class="GtkVBox" id="vbox3">
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">6</property>
                             <child>
                               <object class="GtkHBox" id="hbox42">
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkHBox" id="hbox45">
+                                  <object class="GtkHBox" id="text_color_key_hbox">
                                     <property name="visible">True</property>
                                     <property name="spacing">12</property>
                                     <child>
-                                      <object class="GtkComboBox" id="text_color_key_combo">
-                                        <property name="visible">True</property>
-                                      </object>
-                                      <packing>
-                                        <property name="position">0</property>
-                                      </packing>
+                                      <placeholder/>
                                     </child>
                                   </object>
                                   <packing>
                   <object class="GtkVBox" id="line_page_vbox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
+                    <property name="orientation">vertical</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkHBox" id="hbox71">
                         <child>
                           <object class="GtkVBox" id="vbox2">
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">6</property>
                             <child>
                               <object class="GtkHBox" id="hbox38">
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkHBox" id="hbox41">
+                                  <object class="GtkHBox" id="line_key_hbox">
                                     <property name="visible">True</property>
                                     <property name="spacing">12</property>
                                     <child>
-                                      <object class="GtkComboBox" id="line_key_combo">
-                                        <property name="visible">True</property>
-                                      </object>
-                                      <packing>
-                                        <property name="position">0</property>
-                                      </packing>
+                                      <placeholder/>
                                     </child>
                                   </object>
                                   <packing>
                   <object class="GtkVBox" id="fill_page_vbox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
+                    <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkHBox" id="hbox73">
                         <property name="visible">True</property>
                         <child>
                           <object class="GtkVBox" id="vbox5">
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">6</property>
                             <child>
                               <object class="GtkHBox" id="hbox50">
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkHBox" id="hbox53">
+                                  <object class="GtkHBox" id="fill_key_hbox">
                                     <property name="visible">True</property>
                                     <property name="spacing">12</property>
                                     <child>
-                                      <object class="GtkComboBox" id="fill_key_combo">
-                                        <property name="visible">True</property>
-                                      </object>
-                                      <packing>
-                                        <property name="position">0</property>
-                                      </packing>
+                                      <placeholder/>
                                     </child>
                                   </object>
                                   <packing>
                   <object class="GtkVBox" id="img_page_vbox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
+                    <property name="orientation">vertical</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkHBox" id="hbox74">
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkComboBox" id="img_key_combo">
+                          <object class="GtkHBox" id="img_key_hbox">
                             <property name="visible">True</property>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </object>
                           <packing>
                             <property name="position">1</property>
                   <object class="GtkVBox" id="data_page_vbox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
+                    <property name="orientation">vertical</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkHBox" id="hbox76">
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkComboBox" id="data_key_combo">
+                          <object class="GtkHBox" id="data_key_hbox">
                             <property name="visible">True</property>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </object>
                           <packing>
                             <property name="position">1</property>
                   <object class="GtkVBox" id="bc_page_vbox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
+                    <property name="orientation">vertical</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkHBox" id="hbox79">
                         <child>
                           <object class="GtkVBox" id="vbox4">
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">6</property>
                             <child>
                               <object class="GtkHBox" id="hbox46">
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkHBox" id="hbox49">
+                                  <object class="GtkHBox" id="bc_key_hbox">
                                     <property name="visible">True</property>
                                     <property name="spacing">12</property>
                                     <child>
-                                      <object class="GtkComboBox" id="bc_key_combo">
-                                        <property name="visible">True</property>
-                                      </object>
-                                      <packing>
-                                        <property name="position">0</property>
-                                      </packing>
+                                      <placeholder/>
                                     </child>
                                   </object>
                                   <packing>
                   <object class="GtkVBox" id="lsize_page_vbox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
+                    <property name="orientation">vertical</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkTable" id="table7">
                   <object class="GtkVBox" id="shadow_page_vbox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
+                    <property name="orientation">vertical</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkCheckButton" id="shadow_enable_check">
                     <child>
                       <object class="GtkVBox" id="shadow_controls_table">
                         <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
                         <property name="spacing">12</property>
                         <child>
                           <object class="GtkHBox" id="hbox63">
                             <child>
                               <object class="GtkVBox" id="vbox7">
                                 <property name="visible">True</property>
+                                <property name="orientation">vertical</property>
                                 <property name="spacing">6</property>
                                 <child>
                                   <object class="GtkHBox" id="hbox57">
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkHBox" id="hbox60">
+                                      <object class="GtkHBox" id="shadow_key_hbox">
                                         <property name="visible">True</property>
                                         <property name="spacing">12</property>
                                         <child>
-                                          <object class="GtkComboBox" id="shadow_key_combo">
-                                            <property name="visible">True</property>
-                                          </object>
-                                          <packing>
-                                            <property name="position">0</property>
-                                          </packing>
+                                          <placeholder/>
                                         </child>
                                       </object>
                                       <packing>
index a0061a8fe98f1a66f6e099701de833afd406f51c..aad5f5105c3d3038584feb9402ec9f82ca63dda8 100644 (file)
@@ -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);
 }
 
 
index 883558dd6f09a4e031ba8c4f64dfaab516499fa9..1bd990f1754a00306f826bac759c6fe756b3346e 100644 (file)
@@ -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__ */
index 2412951300495717f54d9215adeac3f6fe398d3b..b3b2fe24887c147b8d61de4d4317f5c008f8e6c4 100644 (file)
@@ -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;
index 3c483698ed1106c2ac251886dcd06c221a1a3d40..bb2ba930aaaeff094732ddec4d83332890102590 100644 (file)
@@ -28,7 +28,7 @@
 #include <math.h>
 
 #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",
index ac60772e389cbf6c68e6684ee115ea444ea7c3fc..45895d72554cac258ecb052e554ad9027db62134 100644 (file)
@@ -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;
index 072334e56e04596c86b23a800226191946405343..c655a113d6935499b5b590c3ca7ee71728f65331 100644 (file)
@@ -27,7 +27,7 @@
 #include <math.h>
 
 #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",
index 957f2620923223ed530d36308d9fb6a4773a7728..5622be76d65d5feae0fd82731435a963406de7c4 100644 (file)
@@ -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;
index a17efb261d3fac52ff34f4b0c80f3af93d8c0ba1..c7ad1dad731c4c59a640af9ce69c418f3dd334ca 100644 (file)
@@ -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;
index 4afadc9580be77233e181226490b211d16943819..6f9b06202f1cfba36cda6c5778ae8bc624b075a3 100644 (file)
@@ -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;
index 8da1b87636ae5b366928770688634451feeecaf3..b19d212dcc2ab51df5f0d4fc2e5d8ddf1a3bc691 100644 (file)
@@ -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;
index dd5d5cca6c2f480c940e16a587a7e9913a5a5095..ed5f67649a5ac7b760db1a55c7c4586e243328bd 100644 (file)
@@ -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);