]> git.sur5r.net Git - glabels/commitdiff
2005-04-16 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Sat, 16 Apr 2005 18:05:01 +0000 (18:05 +0000)
committerJim Evins <evins@snaught.com>
Sat, 16 Apr 2005 18:05:01 +0000 (18:05 +0000)
* data/glade/Makefile.am:
* data/glade/merge-properties-dialog.glade:
Added merge properties dialog glade description file.
* src/merge-properties-dialog.h:
* src/merge-properties-dialog.c:
(gl_merge_properties_dialog_get_type),
(gl_merge_properties_dialog_init),
(gl_merge_properties_dialog_finalize),
(gl_merge_properties_dialog_new),
(gl_merge_properties_dialog_construct), (type_changed_cb),
(src_changed_cb), (response_cb), (load_tree),
(record_select_toggled_cb), (select_all_button_clicked_cb),
(unselect_all_button_clicked_cb):
Modified merge properties dialog to use libglade.  Added
"select all" and "unselect all" buttons.
* src/merge-text.c: (parse_line):
Handle empty lines better.
* src/merge.c: (gl_merge_eval_key):
Evaluate the key whether the record is selected or not.
* src/util.h:
* src/util.c: (gl_util_combo_box_add_text_model):
Since libglade does not use the gtk_combo_box_new_text()
constructor for GtkComboBoxes, a utility function was created
to add an appropriate text model to a GtkComboBox.
* src/view.c: (gl_view_edit_merge_props):
Removed unnecessary "show all's".

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@521 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/ChangeLog
glabels2/data/glade/Makefile.am
glabels2/data/glade/merge-properties-dialog.glade [new file with mode: 0644]
glabels2/src/merge-properties-dialog.c
glabels2/src/merge-properties-dialog.h
glabels2/src/merge-text.c
glabels2/src/merge.c
glabels2/src/util.c
glabels2/src/util.h
glabels2/src/view.c

index 70e15df1457600037fa54dfc9b53e54ed54f6748..2406a2a0ed2313e414c75edf89d3c2da1d0d819c 100644 (file)
@@ -1,3 +1,32 @@
+2005-04-16  Jim Evins  <evins@snaught.com>
+
+       * data/glade/Makefile.am:
+       * data/glade/merge-properties-dialog.glade:
+               Added merge properties dialog glade description file.
+       * src/merge-properties-dialog.h:
+       * src/merge-properties-dialog.c:
+       (gl_merge_properties_dialog_get_type),
+       (gl_merge_properties_dialog_init),
+       (gl_merge_properties_dialog_finalize),
+       (gl_merge_properties_dialog_new),
+       (gl_merge_properties_dialog_construct), (type_changed_cb),
+       (src_changed_cb), (response_cb), (load_tree),
+       (record_select_toggled_cb), (select_all_button_clicked_cb),
+       (unselect_all_button_clicked_cb):
+               Modified merge properties dialog to use libglade.  Added
+               "select all" and "unselect all" buttons.
+       * src/merge-text.c: (parse_line):
+               Handle empty lines better.
+       * src/merge.c: (gl_merge_eval_key):
+               Evaluate the key whether the record is selected or not.
+       * src/util.h:
+       * src/util.c: (gl_util_combo_box_add_text_model):
+               Since libglade does not use the gtk_combo_box_new_text()
+               constructor for GtkComboBoxes, a utility function was created
+               to add an appropriate text model to a GtkComboBox.
+       * src/view.c: (gl_view_edit_merge_props):
+               Removed unnecessary "show all's".
+
 2005-04-15  Jim Evins  <evins@snaught.com>
 
        * po/ru.po:
index 373e2cc18c8db02ca6fa2d00434cc56b1b4643f5..5572e3851b1f96e8aba016ec60c690d346ccc6c2 100644 (file)
@@ -5,7 +5,8 @@ gladedir = $(datadir)/glabels/glade/
 glade_DATA = \
        object-editor.glade             \
        prefs-dialog.glade              \
-       template-designer.glade
+       template-designer.glade         \
+       merge-properties-dialog.glade
 
 EXTRA_DIST = $(glade_DATA)
 
diff --git a/glabels2/data/glade/merge-properties-dialog.glade b/glabels2/data/glade/merge-properties-dialog.glade
new file mode 100644 (file)
index 0000000..0571d9f
--- /dev/null
@@ -0,0 +1,376 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkDialog" id="merge_properties_dialog">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">dialog1</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox1">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+       <widget class="GtkHButtonBox" id="dialog-action_area1">
+         <property name="visible">True</property>
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+         <child>
+           <widget class="GtkButton" id="cancelbutton1">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-cancel</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="response_id">-6</property>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="okbutton1">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-ok</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="response_id">-5</property>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+         <property name="pack_type">GTK_PACK_END</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkVBox" id="merge_properties_vbox">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkFrame" id="frame1">
+             <property name="visible">True</property>
+             <property name="label_xalign">0</property>
+             <property name="label_yalign">0.5</property>
+             <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+             <child>
+               <widget class="GtkAlignment" id="alignment1">
+                 <property name="visible">True</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xscale">1</property>
+                 <property name="yscale">1</property>
+                 <property name="top_padding">0</property>
+                 <property name="bottom_padding">0</property>
+                 <property name="left_padding">12</property>
+                 <property name="right_padding">0</property>
+
+                 <child>
+                   <widget class="GtkTable" id="table1">
+                     <property name="border_width">12</property>
+                     <property name="visible">True</property>
+                     <property name="n_rows">2</property>
+                     <property name="n_columns">2</property>
+                     <property name="homogeneous">False</property>
+                     <property name="row_spacing">6</property>
+                     <property name="column_spacing">6</property>
+
+                     <child>
+                       <widget class="GtkLabel" id="label3">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">Format:</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                         <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                         <property name="width_chars">-1</property>
+                         <property name="single_line_mode">False</property>
+                         <property name="angle">0</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">0</property>
+                         <property name="right_attach">1</property>
+                         <property name="top_attach">0</property>
+                         <property name="bottom_attach">1</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkComboBox" id="type_combo">
+                         <property name="visible">True</property>
+                         <property name="add_tearoffs">False</property>
+                         <property name="focus_on_click">True</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">0</property>
+                         <property name="bottom_attach">1</property>
+                         <property name="y_options">fill</property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkVBox" id="location_vbox">
+                         <property name="visible">True</property>
+                         <property name="homogeneous">False</property>
+                         <property name="spacing">0</property>
+
+                         <child>
+                           <placeholder/>
+                         </child>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options">fill</property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="label4">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">Location:</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                         <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                         <property name="width_chars">-1</property>
+                         <property name="single_line_mode">False</property>
+                         <property name="angle">0</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">0</property>
+                         <property name="right_attach">1</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+                   </widget>
+                 </child>
+               </widget>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="label1">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">&lt;b&gt;Source&lt;/b&gt;</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">True</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                 <property name="width_chars">-1</property>
+                 <property name="single_line_mode">False</property>
+                 <property name="angle">0</property>
+               </widget>
+               <packing>
+                 <property name="type">label_item</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkFrame" id="frame2">
+             <property name="border_width">6</property>
+             <property name="visible">True</property>
+             <property name="label_xalign">0</property>
+             <property name="label_yalign">0.5</property>
+             <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+             <child>
+               <widget class="GtkAlignment" id="alignment2">
+                 <property name="visible">True</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xscale">1</property>
+                 <property name="yscale">1</property>
+                 <property name="top_padding">0</property>
+                 <property name="bottom_padding">0</property>
+                 <property name="left_padding">12</property>
+                 <property name="right_padding">0</property>
+
+                 <child>
+                   <widget class="GtkVBox" id="vbox3">
+                     <property name="visible">True</property>
+                     <property name="homogeneous">False</property>
+                     <property name="spacing">6</property>
+
+                     <child>
+                       <widget class="GtkScrolledWindow" id="scrolledwindow1">
+                         <property name="border_width">6</property>
+                         <property name="width_request">500</property>
+                         <property name="height_request">350</property>
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                         <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                         <property name="shadow_type">GTK_SHADOW_IN</property>
+                         <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+                         <child>
+                           <widget class="GtkTreeView" id="treeview">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="headers_visible">True</property>
+                             <property name="rules_hint">False</property>
+                             <property name="reorderable">False</property>
+                             <property name="enable_search">True</property>
+                             <property name="fixed_height_mode">False</property>
+                             <property name="hover_selection">False</property>
+                             <property name="hover_expand">False</property>
+                           </widget>
+                         </child>
+                       </widget>
+                       <packing>
+                         <property name="padding">0</property>
+                         <property name="expand">True</property>
+                         <property name="fill">True</property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkHBox" id="hbox1">
+                         <property name="border_width">6</property>
+                         <property name="visible">True</property>
+                         <property name="homogeneous">False</property>
+                         <property name="spacing">12</property>
+
+                         <child>
+                           <widget class="GtkButton" id="select_all_button">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="label" translatable="yes">Select all</property>
+                             <property name="use_underline">True</property>
+                             <property name="relief">GTK_RELIEF_NORMAL</property>
+                             <property name="focus_on_click">True</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkButton" id="unselect_all_button">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="label" translatable="yes">Unselect all</property>
+                             <property name="use_underline">True</property>
+                             <property name="relief">GTK_RELIEF_NORMAL</property>
+                             <property name="focus_on_click">True</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+                       </widget>
+                       <packing>
+                         <property name="padding">0</property>
+                         <property name="expand">False</property>
+                         <property name="fill">True</property>
+                       </packing>
+                     </child>
+                   </widget>
+                 </child>
+               </widget>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="label2">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">&lt;b&gt;Record selection/preview&lt;/b&gt;</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">True</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                 <property name="width_chars">-1</property>
+                 <property name="single_line_mode">False</property>
+                 <property name="angle">0</property>
+               </widget>
+               <packing>
+                 <property name="type">label_item</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>
index e76bdfaa7c90f605a95c6fb04402dd2b02f2c1f5..120a1329e6f0bd24bb1ab77313266df8fa45cbac 100644 (file)
  */
 #include <config.h>
 
+#include "merge-properties-dialog.h"
+
 #include <glib/gi18n.h>
+#include <glade/glade-xml.h>
+#include <gtk/gtkfilechooserbutton.h>
+#include <gtk/gtkcombobox.h>
 
 #include "view.h"
 #include "merge.h"
-#include "merge-properties-dialog.h"
-#include "hig.h"
+#include "util.h"
 
 #include "debug.h"
 
 
 struct _glMergePropertiesDialogPrivate {
 
+       GladeXML     *gui;
+
        glView       *view;
        glLabel      *label;
        glMerge      *merge;
 
-       GtkWidget    *type_entry;
-       GtkWidget    *src_entry_holder;
+       GtkWidget    *type_combo;
+       GtkWidget    *location_vbox;
        GtkWidget    *src_entry;
 
        GtkTreeStore *store;
-       GtkWidget    *tree;
+       GtkWidget    *treeview;
+
+       GtkWidget    *select_all_button;
+       GtkWidget    *unselect_all_button;
 
        gchar        *saved_src;
 
@@ -68,7 +77,7 @@ enum {
 /* Private globals                           */
 /*===========================================*/
 
-static glHigDialogClass* parent_class = NULL;
+static GtkDialogClass* parent_class = NULL;
 
 /*===========================================*/
 /* Local function prototypes                 */
@@ -97,6 +106,11 @@ static void record_select_toggled_cb              (GtkCellRendererToggle
                                                   gchar                        *path_str,
                                                   GtkTreeStore                 *store);
 
+static void select_all_button_clicked_cb          (GtkWidget                    *widget,
+                                                  glMergePropertiesDialog      *dialog);
+
+static void unselect_all_button_clicked_cb        (GtkWidget                    *widget,
+                                                  glMergePropertiesDialog      *dialog);
 
 \f
 /*****************************************************************************/
@@ -123,7 +137,7 @@ gl_merge_properties_dialog_get_type (void)
                        NULL
                };
 
-               type = g_type_register_static (GL_TYPE_HIG_DIALOG,
+               type = g_type_register_static (GTK_TYPE_DIALOG,
                                               "glMergePropertiesDialog", &info, 0);
        }
 
@@ -145,18 +159,20 @@ gl_merge_properties_dialog_class_init (glMergePropertiesDialogClass *klass)
 static void
 gl_merge_properties_dialog_init (glMergePropertiesDialog *dialog)
 {
-       gl_debug (DEBUG_MERGE, "");
+       gl_debug (DEBUG_MERGE, "START");
 
-       dialog->private = g_new0 (glMergePropertiesDialogPrivate, 1);
+       dialog->priv = g_new0 (glMergePropertiesDialogPrivate, 1);
 
-       gtk_dialog_add_buttons (GTK_DIALOG(dialog),
-                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                               GTK_STOCK_OK, GTK_RESPONSE_OK,
-                               NULL);
+       dialog->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "merge-properties-dialog.glade",
+                                          "merge_properties_vbox",
+                                          NULL);
 
-       g_signal_connect (G_OBJECT(dialog), "response",
-                         G_CALLBACK(response_cb), NULL);
+       if (!dialog->priv->gui) {
+               g_warning ("Could not open merge-properties-dialog.glade, reinstall glabels!");
+               return;
+       }
 
+       gl_debug (DEBUG_MERGE, "END");
 }
 
 static void 
@@ -164,22 +180,24 @@ gl_merge_properties_dialog_finalize (GObject *object)
 {
        glMergePropertiesDialog* dialog;
        
-       gl_debug (DEBUG_MERGE, "");
+       gl_debug (DEBUG_MERGE, "START");
 
        g_return_if_fail (object != NULL);
        
        dialog = GL_MERGE_PROPERTIES_DIALOG (object);
 
        g_return_if_fail (GL_IS_MERGE_PROPERTIES_DIALOG (dialog));
-       g_return_if_fail (dialog->private != NULL);
+       g_return_if_fail (dialog->priv != NULL);
 
        G_OBJECT_CLASS (parent_class)->finalize (object);
 
-       if (dialog->private->merge != NULL) {
-               g_object_unref (G_OBJECT(dialog->private->merge));
+       if (dialog->priv->merge != NULL) {
+               g_object_unref (G_OBJECT (dialog->priv->merge));
        }
 
-       g_free (dialog->private);
+       g_free (dialog->priv);
+
+       gl_debug (DEBUG_MERGE, "END");
 }
 
 /*****************************************************************************/
@@ -190,13 +208,15 @@ gl_merge_properties_dialog_new (glView *view)
 {
        GtkWidget *dialog;
 
-       gl_debug (DEBUG_MERGE, "");
+       gl_debug (DEBUG_MERGE, "START");
 
        dialog = GTK_WIDGET (g_object_new (GL_TYPE_MERGE_PROPERTIES_DIALOG, NULL));
 
-       gl_merge_properties_dialog_construct (GL_MERGE_PROPERTIES_DIALOG(dialog),
+       gl_merge_properties_dialog_construct (GL_MERGE_PROPERTIES_DIALOG (dialog),
                                              view);
 
+       gl_debug (DEBUG_MERGE, "END");
+
        return dialog;
 }
 
@@ -207,26 +227,56 @@ static void
 gl_merge_properties_dialog_construct (glMergePropertiesDialog *dialog,
                                      glView                  *view)
 {
-       GtkWidget         *wframe, *whbox, *wtable, *wlabel, *wcombo, *wscroll, *wentry;
-       GList             *texts;
        gchar             *description;
        glMergeSrcType     src_type;
        gchar             *src;
-       GtkSizeGroup      *label_size_group;
+       gchar             *name, *title;
+       GList             *texts;
+       GtkWidget         *vbox;
        GtkCellRenderer   *renderer;
        GtkTreeViewColumn *column;
        GtkTreeSelection  *selection;
-       gchar             *name, *title;
 
        gl_debug (DEBUG_MERGE, "START");
 
-       dialog->private->view  = view;
-       dialog->private->label = view->label;
+       g_return_if_fail (GL_IS_MERGE_PROPERTIES_DIALOG (dialog));
+       g_return_if_fail (dialog->priv != NULL);
+
+       gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                               GTK_STOCK_OK, GTK_RESPONSE_OK,
+                               NULL);
+
+       gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+       g_signal_connect(G_OBJECT (dialog), "response",
+                        G_CALLBACK (response_cb), NULL);
+
+       vbox = glade_xml_get_widget (dialog->priv->gui,
+                                    "merge_properties_vbox");
+       gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
 
-       dialog->private->merge = gl_label_get_merge (dialog->private->label);
-       description            = gl_merge_get_description (dialog->private->merge);
-       src_type               = gl_merge_get_src_type (dialog->private->merge);
-       src                    = gl_merge_get_src (dialog->private->merge);
+       dialog->priv->type_combo    = glade_xml_get_widget (dialog->priv->gui,
+                                                           "type_combo");
+       dialog->priv->location_vbox = glade_xml_get_widget (dialog->priv->gui,
+                                                           "location_vbox");
+       dialog->priv->treeview      = glade_xml_get_widget (dialog->priv->gui,
+                                                           "treeview");
+
+       dialog->priv->select_all_button   = glade_xml_get_widget (dialog->priv->gui,
+                                                               "select_all_button");
+       dialog->priv->unselect_all_button = glade_xml_get_widget (dialog->priv->gui,
+                                                               "unselect_all_button");
+
+       gl_util_combo_box_add_text_model (GTK_COMBO_BOX (dialog->priv->type_combo));
+
+       dialog->priv->view  = view;
+       dialog->priv->label = view->label;
+
+       dialog->priv->merge = gl_label_get_merge (dialog->priv->label);
+       description         = gl_merge_get_description (dialog->priv->merge);
+       src_type            = gl_merge_get_src_type (dialog->priv->merge);
+       src                 = gl_merge_get_src (dialog->priv->merge);
 
        /* --- Window title --- */
        name = gl_label_get_short_name (view->label);
@@ -235,21 +285,6 @@ gl_merge_properties_dialog_construct (glMergePropertiesDialog *dialog,
        g_free (name);
        g_free (title);
 
-       /* ---- Source section ---- */
-       wframe = gl_hig_category_new (_("Source"));
-       gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wframe);
-       label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
-       /* Format line */
-       whbox = gl_hig_hbox_new();
-       gl_hig_category_add_widget (GL_HIG_CATEGORY (wframe), whbox);
-
-       wlabel = gtk_label_new (_("Format:"));
-       gtk_size_group_add_widget (label_size_group, wlabel);
-       gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5);
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wlabel);
-
-       wcombo = gtk_combo_new ();
        texts = gl_merge_get_descriptions ();
        gl_debug (DEBUG_MERGE, "DESCRIPTIONS:");
        {
@@ -259,95 +294,84 @@ gl_merge_properties_dialog_construct (glMergePropertiesDialog *dialog,
                        gl_debug (DEBUG_MERGE, "    \"%s\"", p->data);
                }
        }
-       gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), texts);
+       gl_util_combo_box_set_strings (GTK_COMBO_BOX (dialog->priv->type_combo),
+                                      texts);
        gl_merge_free_descriptions (&texts);
-       dialog->private->type_entry = GTK_COMBO (wcombo)->entry;
-       gtk_entry_set_editable (GTK_ENTRY (dialog->private->type_entry), FALSE);
-       gtk_entry_set_text (GTK_ENTRY (dialog->private->type_entry), description);
-       gl_hig_hbox_add_widget_justify (GL_HIG_HBOX(whbox), wcombo);
-       g_signal_connect (G_OBJECT (dialog->private->type_entry), "changed",
+       gl_util_combo_box_set_active_text (GTK_COMBO_BOX (dialog->priv->type_combo),
+                                          description);
+       g_signal_connect (G_OBJECT (dialog->priv->type_combo), "changed",
                          G_CALLBACK (type_changed_cb), dialog);
 
-       whbox = gl_hig_hbox_new();
-       gl_hig_category_add_widget (GL_HIG_CATEGORY (wframe), whbox);
-
-       /* Location line */
-       wlabel = gtk_label_new (_("Location:"));
-       gtk_size_group_add_widget (label_size_group, wlabel);
-       gtk_misc_set_alignment (GTK_MISC (wlabel), 0, 0.5);
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wlabel);
-
        gl_debug (DEBUG_MERGE, "Src_type = %d", src_type);
        switch (src_type) {
        case GL_MERGE_SRC_IS_FILE:
-               dialog->private->src_entry =
-                       gnome_file_entry_new (NULL, _("Select merge-database source"));
-               wentry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY(dialog->private->src_entry));
-               gtk_entry_set_text (GTK_ENTRY(wentry), src);
-               g_signal_connect (G_OBJECT (wentry), "changed",
+               dialog->priv->src_entry =
+                       gtk_file_chooser_button_new (_("Select merge-database source"),
+                                                    GTK_FILE_CHOOSER_ACTION_OPEN);
+               gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog->priv->src_entry),
+                                              src);
+               g_signal_connect (G_OBJECT (dialog->priv->src_entry),
+                                 "selection-changed",
                                  G_CALLBACK (src_changed_cb), dialog);
                break;
        default:
-               dialog->private->src_entry = gtk_label_new (_("N/A"));
-               gtk_misc_set_alignment (GTK_MISC (dialog->private->src_entry), 0.0, 0.5);
+               dialog->priv->src_entry = gtk_label_new (_("N/A"));
+               gtk_misc_set_alignment (GTK_MISC (dialog->priv->src_entry), 0.0, 0.5);
                break;
        }
-       dialog->private->src_entry_holder = gtk_hbox_new (FALSE, 0);
-       gtk_container_add( GTK_CONTAINER(dialog->private->src_entry_holder),
-                          dialog->private->src_entry);
-       gl_hig_hbox_add_widget_justify (GL_HIG_HBOX(whbox),
-                                       dialog->private->src_entry_holder);
-
-       /* ---- Sample Fields section ---- */
-       wframe = gl_hig_category_new (_("Record selection/preview:"));
-       gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wframe);
-
-       wscroll = gtk_scrolled_window_new (NULL, NULL);
-       gtk_container_set_border_width (GTK_CONTAINER (wscroll), 5);
-       gtk_widget_set_usize (wscroll, 500, 350);
-       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wscroll),
-                                       GTK_POLICY_AUTOMATIC,
-                                       GTK_POLICY_AUTOMATIC);
-       gl_hig_category_add_widget (GL_HIG_CATEGORY (wframe), wscroll);
-
-       dialog->private->store = gtk_tree_store_new (N_COLUMNS,
+       gtk_box_pack_start (GTK_BOX (dialog->priv->location_vbox),
+                           dialog->priv->src_entry, FALSE, FALSE, 0);
+       gtk_widget_show_all (GTK_WIDGET (dialog->priv->location_vbox));
+
+       dialog->priv->store = gtk_tree_store_new (N_COLUMNS,
                                          G_TYPE_BOOLEAN, /* Record selector */
                                          G_TYPE_STRING,  /* Record/Field name */
                                          G_TYPE_STRING,  /* Field value */
                                          G_TYPE_BOOLEAN, /* Is Record? */
                                          G_TYPE_POINTER  /* Pointer to record */);
-       load_tree (dialog->private->store, dialog->private->merge);
-       dialog->private->tree =
-               gtk_tree_view_new_with_model (GTK_TREE_MODEL(dialog->private->store));
-       gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(dialog->private->tree), TRUE);
-       selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dialog->private->tree));
+       load_tree (dialog->priv->store, dialog->priv->merge);
+
+       gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->priv->treeview),
+                                GTK_TREE_MODEL (dialog->priv->store));
+
+       gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (dialog->priv->treeview),
+                                     TRUE);
+       selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->priv->treeview));
        gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
        renderer = gtk_cell_renderer_toggle_new ();
        g_signal_connect (G_OBJECT (renderer), "toggled",
-                         G_CALLBACK (record_select_toggled_cb), dialog->private->store);
+                         G_CALLBACK (record_select_toggled_cb), dialog->priv->store);
        column = gtk_tree_view_column_new_with_attributes (_("Select"), renderer,
                                                           "active", SELECT_COLUMN,
                                                           "visible", IS_RECORD_COLUMN,
                                                           NULL);
        gtk_tree_view_column_set_clickable (column, TRUE);
-       gtk_tree_view_append_column (GTK_TREE_VIEW(dialog->private->tree), column);
+       gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->priv->treeview), column);
        renderer = gtk_cell_renderer_text_new ();
-       gtk_object_set (GTK_OBJECT(renderer), "yalign", 0.0, NULL);
+       gtk_object_set (GTK_OBJECT (renderer), "yalign", 0.0, NULL);
        column = gtk_tree_view_column_new_with_attributes (_("Record/Field"), renderer,
                                                           "text", RECORD_FIELD_COLUMN,
                                                           NULL);
        gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-       gtk_tree_view_append_column (GTK_TREE_VIEW(dialog->private->tree), column);
-       gtk_tree_view_set_expander_column (GTK_TREE_VIEW(dialog->private->tree), column);
+       gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->priv->treeview), column);
+       gtk_tree_view_set_expander_column (GTK_TREE_VIEW (dialog->priv->treeview), column);
        renderer = gtk_cell_renderer_text_new ();
-       gtk_object_set (GTK_OBJECT(renderer), "yalign", 0.0, NULL);
+       gtk_object_set (GTK_OBJECT (renderer), "yalign", 0.0, NULL);
        column = gtk_tree_view_column_new_with_attributes (_("Data"), renderer,
                                                           "text", VALUE_COLUMN,
                                                           NULL);
        gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-       gtk_tree_view_append_column (GTK_TREE_VIEW(dialog->private->tree), column);
-       gtk_container_add (GTK_CONTAINER (wscroll), dialog->private->tree);
-       
+       gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->priv->treeview), column);
+
+       g_signal_connect (G_OBJECT (dialog->priv->select_all_button),
+                         "clicked",
+                         G_CALLBACK (select_all_button_clicked_cb), dialog);
+
+       g_signal_connect (G_OBJECT (dialog->priv->unselect_all_button),
+                         "clicked",
+                         G_CALLBACK (unselect_all_button_clicked_cb), dialog);
+
+
        g_free (src);
        g_free (description);
 
@@ -371,46 +395,48 @@ type_changed_cb (GtkWidget               *widget,
 
        gl_debug (DEBUG_MERGE, "START");
 
-       description = gtk_editable_get_chars (GTK_EDITABLE (dialog->private->type_entry),
-                                             0, -1);
+       description = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog->priv->type_combo));
        name = gl_merge_description_to_name (description);
 
-       src = gl_merge_get_src (dialog->private->merge); /* keep current src if possible */
+       src = gl_merge_get_src (dialog->priv->merge); /* keep current src if possible */
        if ( src != NULL ) {
                gl_debug (DEBUG_MERGE, "Saving src = \"%s\"", src);
-               g_free (dialog->private->saved_src);
-               dialog->private->saved_src = src;
+               g_free (dialog->priv->saved_src);
+               dialog->priv->saved_src = src;
        }
 
-       if (dialog->private->merge != NULL) {
-               g_object_unref (G_OBJECT(dialog->private->merge));
+       if (dialog->priv->merge != NULL) {
+               g_object_unref (G_OBJECT(dialog->priv->merge));
        }
-       dialog->private->merge = gl_merge_new (name);
+       dialog->priv->merge = gl_merge_new (name);
 
-       gtk_widget_destroy (dialog->private->src_entry);
-       src_type = gl_merge_get_src_type (dialog->private->merge);
+       gtk_widget_destroy (dialog->priv->src_entry);
+       src_type = gl_merge_get_src_type (dialog->priv->merge);
        switch (src_type) {
        case GL_MERGE_SRC_IS_FILE:
-               dialog->private->src_entry =
-                       gnome_file_entry_new (NULL, _("Select merge-database source"));
-               wentry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY(dialog->private->src_entry));
-               if (dialog->private->saved_src != NULL) {
-                       gl_debug (DEBUG_MERGE, "Setting src = \"%s\"", dialog->private->saved_src);
-                       gtk_entry_set_text (GTK_ENTRY(wentry), dialog->private->saved_src);
-                       gl_merge_set_src (dialog->private->merge, dialog->private->saved_src);
+               dialog->priv->src_entry =
+                       gtk_file_chooser_button_new (_("Select merge-database source"),
+                                                    GTK_FILE_CHOOSER_ACTION_OPEN);
+               if (dialog->priv->saved_src != NULL) {
+                       gl_debug (DEBUG_MERGE, "Setting src = \"%s\"", dialog->priv->saved_src);
+                       gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog->priv->src_entry),
+                                                      dialog->priv->saved_src);
+                       gl_merge_set_src (dialog->priv->merge, dialog->priv->saved_src);
                }
-               g_signal_connect (G_OBJECT (wentry), "changed",
+               g_signal_connect (G_OBJECT (dialog->priv->src_entry),
+                                 "selection-changed",
                                  G_CALLBACK (src_changed_cb), dialog);
                break;
        default:
-               dialog->private->src_entry = gtk_label_new (_("N/A"));
-               gtk_misc_set_alignment (GTK_MISC (dialog->private->src_entry), 0.0, 0.5);
+               dialog->priv->src_entry = gtk_label_new (_("N/A"));
+               gtk_misc_set_alignment (GTK_MISC (dialog->priv->src_entry), 0.0, 0.5);
                break;
        }
-       gtk_container_add( GTK_CONTAINER(dialog->private->src_entry_holder), dialog->private->src_entry);
-       gtk_widget_show (dialog->private->src_entry);
+       gtk_box_pack_start( GTK_BOX (dialog->priv->location_vbox),
+                           dialog->priv->src_entry, FALSE, FALSE, 0);
+       gtk_widget_show_all (dialog->priv->location_vbox);
 
-       load_tree (dialog->private->store, dialog->private->merge);
+       load_tree (dialog->priv->store, dialog->priv->merge);
 
        g_free (description);
        g_free (name);
@@ -425,17 +451,24 @@ static void
 src_changed_cb (GtkWidget               *widget,
                glMergePropertiesDialog *dialog)
 {
-       gchar     *src;
+       gchar     *src, *orig_src;
        GtkWidget *wentry;
 
        gl_debug (DEBUG_MERGE, "START");
 
-       wentry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY(dialog->private->src_entry));
-       src = gtk_editable_get_chars (GTK_EDITABLE (wentry), 0, -1);
-       gl_merge_set_src (dialog->private->merge, src);
+       orig_src = gl_merge_get_src (dialog->priv->merge);
+       src = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog->priv->src_entry));
+
+       gl_debug (DEBUG_MERGE, "orig=\"%s\", new=\"%s\"\n", orig_src, src);
+
+       if (!orig_src || strcmp (src, orig_src)) {
+               gl_merge_set_src (dialog->priv->merge, src);
+               load_tree (dialog->priv->store, dialog->priv->merge);
+       }
+
+       g_free (orig_src);
        g_free (src);
 
-       load_tree (dialog->private->store, dialog->private->merge);
 
        gl_debug (DEBUG_MERGE, "END");
 }
@@ -453,13 +486,20 @@ response_cb (glMergePropertiesDialog *dialog,
        switch (response) {
 
        case GTK_RESPONSE_OK:
-
-               gl_label_set_merge (dialog->private->label, dialog->private->merge);
+               gl_label_set_merge (dialog->priv->label, dialog->priv->merge);
+               gtk_widget_hide (GTK_WIDGET (dialog));
+               break;
+       case GTK_RESPONSE_CANCEL:
+               /* Let the dialog get rebuilt next time to recover state. */
+               gtk_widget_destroy (GTK_WIDGET (dialog));
                break;
+       case GTK_RESPONSE_DELETE_EVENT:
+               break;
+       default:
+               g_print ("response = %d", response);
+               g_assert_not_reached ();
        }
 
-       gtk_widget_destroy (GTK_WIDGET(dialog));
-
        gl_debug (DEBUG_MERGE, "END");
 }
 
@@ -478,6 +518,8 @@ load_tree (GtkTreeStore           *store,
        gchar         *primary_key;
        gchar         *primary_value;
 
+       gl_debug (DEBUG_MERGE, "START");
+
        gtk_tree_store_clear (store);
 
        primary_key = gl_merge_get_primary_key (merge);
@@ -511,7 +553,8 @@ load_tree (GtkTreeStore           *store,
        }
 
        g_free (primary_key);
-       
+
+       gl_debug (DEBUG_MERGE, "END");
 }
 
 /*--------------------------------------------------------------------------*/
@@ -522,28 +565,107 @@ record_select_toggled_cb (GtkCellRendererToggle *cell,
                          gchar                 *path_str,
                          GtkTreeStore          *store)
 {
-  GtkTreePath   *path;
-  GtkTreeIter    iter;
-  glMergeRecord *record;
+       GtkTreePath   *path;
+       GtkTreeIter    iter;
+       glMergeRecord *record;
+
+       gl_debug (DEBUG_MERGE, "START");
+
+       /* get toggled iter */
+       path = gtk_tree_path_new_from_string (path_str);
+       gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path);
+
+       /* get current data */
+       gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
+                           DATA_COLUMN,   &record,
+                           -1);
+
+       /* toggle the select flag within the record */
+       record->select_flag ^= 1;
+
+       /* set new value in store */
+       gtk_tree_store_set (store, &iter,
+                           SELECT_COLUMN, record->select_flag,
+                           -1);
+
+       /* clean up */
+       gtk_tree_path_free (path);
+
+       gl_debug (DEBUG_MERGE, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  "Select All" button callback.                                  */
+/*--------------------------------------------------------------------------*/
+static void
+select_all_button_clicked_cb (GtkWidget                    *widget,
+                             glMergePropertiesDialog      *dialog)
+{
+       GtkTreeModel  *store = GTK_TREE_MODEL (dialog->priv->store);
+       GtkTreeIter    iter;
+       glMergeRecord *record;
+       gboolean       good;
+
+       gl_debug (DEBUG_MERGE, "START");
 
-  /* get toggled iter */
-  path = gtk_tree_path_new_from_string (path_str);
-  gtk_tree_model_get_iter (GTK_TREE_MODEL(store), &iter, path);
+       for ( good = gtk_tree_model_get_iter_first (store, &iter);
+             good;
+             good = gtk_tree_model_iter_next (store, &iter) )
+       {
+               
+               /* get current data */
+               gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
+                                   DATA_COLUMN,   &record,
+                                   -1);
 
-  /* get current data */
-  gtk_tree_model_get (GTK_TREE_MODEL(store), &iter,
-                     DATA_COLUMN,   &record,
-                     -1);
+               
+               /* Set select flag within the record */
+               record->select_flag = TRUE;
 
-  /* toggle the select flag within the record */
-  record->select_flag ^= 1;
+               /* set new value in store */
+               gtk_tree_store_set (GTK_TREE_STORE (store), &iter,
+                                   SELECT_COLUMN, record->select_flag,
+                                   -1);
 
-  /* set new value in store */
-  gtk_tree_store_set (store, &iter,
-                     SELECT_COLUMN, record->select_flag,
-                     -1);
+       }
 
-  /* clean up */
-  gtk_tree_path_free (path);
+       gl_debug (DEBUG_MERGE, "END");
 }
 
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  "Unselect All" button callback.                                */
+/*--------------------------------------------------------------------------*/
+static void
+unselect_all_button_clicked_cb (GtkWidget                    *widget,
+                               glMergePropertiesDialog      *dialog)
+{
+       GtkTreeModel  *store = GTK_TREE_MODEL (dialog->priv->store);
+       GtkTreeIter    iter;
+       glMergeRecord *record;
+       gboolean       good;
+
+       gl_debug (DEBUG_MERGE, "START");
+
+       for ( good = gtk_tree_model_get_iter_first (store, &iter);
+             good;
+             good = gtk_tree_model_iter_next (store, &iter) )
+       {
+               
+               /* get current data */
+               gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
+                                   DATA_COLUMN,   &record,
+                                   -1);
+
+               
+               /* Set select flag within the record */
+               record->select_flag = FALSE;
+
+               /* set new value in store */
+               gtk_tree_store_set (GTK_TREE_STORE (store), &iter,
+                                   SELECT_COLUMN, record->select_flag,
+                                   -1);
+
+       }
+
+       gl_debug (DEBUG_MERGE, "END");
+}
index c7e71f714651ad06ac866e11951db89f7f61a834..eb5a7a9b5ea8560d6562de79bf1d489fc9186e2d 100644 (file)
@@ -22,8 +22,7 @@
 #ifndef __MERGE_PROPERTIES_DIALOG_H__
 #define __MERGE_PROPERTIES_DIALOG_H__
 
-#include <gtk/gtk.h>
-#include "hig.h"
+#include <gtk/gtkdialog.h>
 #include "view.h"
 
 G_BEGIN_DECLS
@@ -43,15 +42,15 @@ typedef struct _glMergePropertiesDialogPrivate  glMergePropertiesDialogPrivate;
 
 struct _glMergePropertiesDialog
 {
-       glHigDialog                     parent_instance;
+       GtkDialog                       parent_instance;
 
-       glMergePropertiesDialogPrivate *private;
+       glMergePropertiesDialogPrivate *priv;
 
 };
 
 struct  _glMergePropertiesDialogClass
 {
-       glHigDialogClass                parent_class;
+       GtkDialogClass                  parent_class;
 };
 
 GType      gl_merge_properties_dialog_get_type    (void) G_GNUC_CONST;
index 637badbed98b95e0fe7bfafbc845c6499fef8ebb..8802235a3534578644cd256eb9071f9965c14abb 100644 (file)
 
 #include <config.h>
 
-#include <stdio.h>
-
 #include "merge-text.h"
 
+#include <stdio.h>
+
 #include "debug.h"
 
 #define LINE_BUF_LEN 1024
@@ -413,6 +413,11 @@ parse_line (FILE  *fp,
                                state = NORMAL;
                                break;
                        case '\n':
+                               /* treat as one empty field. */
+                               list = g_list_append (list,
+                                                     g_strdup (""));
+                               state = DONE;
+                               break;
                        case EOF:
                                state = DONE;
                                break;
index 2edebc104d373d243b929ae9131408a88cd408c4..744ca257279af1b668353c846f693bc3ee2b96b9 100644 (file)
  */
 #include <config.h>
 
+#include "merge.h"
+
 #include <glib/gi18n.h>
 #include <gobject/gvaluecollector.h>
 #include <string.h>
 
-#include "merge.h"
-
 #include "debug.h"
 
 /*========================================================*/
@@ -697,7 +697,7 @@ gl_merge_eval_key (glMergeRecord *record,
 
        gl_debug (DEBUG_MERGE, "START");
 
-       if ( (record != NULL) && record->select_flag  ) {
+       if ( (record != NULL) ) {
                for (p = record->field_list; p != NULL; p = p->next) {
                        field = (glMergeField *) p->data;
 
index 53f3deeea333695eba213031c2bd380d9465ec80..7678233c981e930614a464ce3078805ba6602f1f 100644 (file)
 
 #include <config.h>
 
+#include "util.h"
+
 #include <string.h>
 #include <glib.h>
-#include <libgnome/gnome-util.h>
 #include <math.h>
 #include <libgnomeprint/gnome-font.h>
 
-#include "util.h"
-
 #define FRAC_EPSILON 0.00005
 
 \f
@@ -193,6 +192,9 @@ gl_util_string_to_weight (const gchar *string)
 
 }
 
+/****************************************************************************/
+/* Convienience function to set strings in a text combo_box from a GList    */
+/****************************************************************************/
 void
 gl_util_combo_box_set_strings (GtkComboBox       *combo,
                               GList             *list)
@@ -208,6 +210,10 @@ gl_util_combo_box_set_strings (GtkComboBox       *combo,
        }
 }
 
+/*---------------------------------------------------------------------------*/
+/* PRIVATE.  gl_util_combo_box_set_active_text support.                      */
+/*---------------------------------------------------------------------------*/
+
 typedef struct {
   const gchar *text;
   GtkTreeIter  iter;
@@ -235,6 +241,9 @@ search_text_func (GtkTreeModel *model,
   return FALSE;
 }
 
+/****************************************************************************/
+/* Convienience function to set active text in a text combo_box from text   */
+/****************************************************************************/
 void
 gl_util_combo_box_set_active_text (GtkComboBox       *combo,
                                   const gchar       *text)
@@ -265,3 +274,25 @@ gl_util_combo_box_set_active_text (GtkComboBox       *combo,
 
 }
 
+/****************************************************************************/
+/* Convienience function to add a simple text model to an existing          */
+/* combo_box.  This is needed since combo_boxes created with glade do not   */
+/* use the gtk_combo_box_new_text() constructor.                            */
+/****************************************************************************/
+void
+gl_util_combo_box_add_text_model (GtkComboBox       *combo)
+{
+       GtkCellRenderer *cell;
+       GtkListStore *store;
+
+       store = gtk_list_store_new (1, G_TYPE_STRING);
+       gtk_combo_box_set_model (combo, GTK_TREE_MODEL (store));
+       g_object_unref (store);
+
+       cell = gtk_cell_renderer_text_new ();
+       gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
+       gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell,
+                                       "text", 0,
+                                       NULL);
+}
+
index 89af5b031397411529e73bb8cd7873d9824e044d..cef32b6d6d1d78d2cb4af1a4a58660ad19f72d2f 100644 (file)
@@ -45,6 +45,7 @@ void gl_util_combo_box_set_strings     (GtkComboBox       *combo,
                                        GList             *list);
 void gl_util_combo_box_set_active_text (GtkComboBox       *combo,
                                        const gchar       *text);
+void gl_util_combo_box_add_text_model  (GtkComboBox       *combo);
 
 G_END_DECLS
 
index c302dccaad4f986f978870a6e4d9171cb6b85a73..1b9620157c1d49497747cae22ebe9ebc999a4627 100644 (file)
@@ -3291,13 +3291,12 @@ gl_view_edit_merge_props (glView *view)
        g_return_if_fail (view && GL_IS_VIEW (view));
 
        if (view->merge_props_dialog != NULL) {
-               gtk_widget_show_all (view->merge_props_dialog);
                gtk_window_present (GTK_WINDOW(view->merge_props_dialog));
                return;
        }
 
        view->merge_props_dialog = gl_merge_properties_dialog_new (view);
-       gtk_widget_show_all (view->merge_props_dialog);
+       gtk_window_present (GTK_WINDOW (view->merge_props_dialog));
 
        g_signal_connect (G_OBJECT(view->merge_props_dialog), "destroy",
                          G_CALLBACK (gtk_widget_destroyed),