]> git.sur5r.net Git - glabels/commitdiff
Merge property dialog now a widget.
authorJim Evins <evins@snaught.com>
Fri, 27 Dec 2002 06:33:25 +0000 (06:33 +0000)
committerJim Evins <evins@snaught.com>
Fri, 27 Dec 2002 06:33:25 +0000 (06:33 +0000)
One merge property dialog per view.

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

glabels2/src/merge-properties-dialog.c
glabels2/src/merge-properties-dialog.h
glabels2/src/tools.c
glabels2/src/view.c
glabels2/src/view.h

index 601658b2dcd64574c03a41974987e72fc47bbde9..98cb62808596a5bd6cf40befeb5fe42c7de3438f 100644 (file)
@@ -32,9 +32,7 @@
 /* Private data types                        */
 /*===========================================*/
 
-typedef struct {
-
-       GtkWidget *dialog;
+struct _glMergePropertiesDialogPrivate {
 
        glView       *view;
        glLabel      *label;
@@ -49,7 +47,7 @@ typedef struct {
 
        gchar        *saved_src;
 
-} PropertyDialogPassback;
+};
 
 enum {
        /* Real columns */
@@ -68,74 +66,145 @@ enum {
 /* Private globals                           */
 /*===========================================*/
 
+static glHigDialogClass* parent_class = NULL;
+
 /*===========================================*/
 /* Local function prototypes                 */
 /*===========================================*/
 
-static void create_merge_dialog_widgets (glHigDialog            *dialog,
-                                        PropertyDialogPassback *data);
+static void gl_merge_properties_dialog_class_init (glMergePropertiesDialogClass *klass);
+static void gl_merge_properties_dialog_init       (glMergePropertiesDialog      *dlg);
+static void gl_merge_properties_dialog_finalize   (GObject                      *object);
+static void gl_merge_properties_dialog_construct  (glMergePropertiesDialog      *dialog,
+                                                  glView                       *view);
 
-static void type_changed_cb             (GtkWidget              *widget,
-                                        PropertyDialogPassback *data);
+static void type_changed_cb                       (GtkWidget                    *widget,
+                                                  glMergePropertiesDialog      *dialog);
 
-static void src_changed_cb              (GtkWidget              *widget,
-                                        PropertyDialogPassback *data);
+static void src_changed_cb                        (GtkWidget                    *widget,
+                                                  glMergePropertiesDialog      *dialog);
 
-static void response_cb                 (glHigDialog            *dialog,
-                                        gint                    response,
-                                        PropertyDialogPassback *data);
+static void response_cb                           (glMergePropertiesDialog      *dialog,
+                                                  gint                          response,
+                                                  gpointer                      user_data);
 
-static void load_tree                   (GtkTreeStore           *store,
-                                        glMerge                *merge);
+static void load_tree                             (GtkTreeStore                 *store,
+                                                  glMerge                      *merge);
 
-static void
-record_select_toggled_cb                (GtkCellRendererToggle  *cell,
-                                        gchar                  *path_str,
-                                        GtkTreeStore           *store);
+static void record_select_toggled_cb              (GtkCellRendererToggle        *cell,
+                                                  gchar                        *path_str,
+                                                  GtkTreeStore                 *store);
 
 
 \f
-/****************************************************************************/
-/* Launch merge properties dialog.                                          */
-/****************************************************************************/
-void
-gl_merge_properties_dialog (glView *view)
+/*****************************************************************************/
+/* Boilerplate object stuff.                                                 */
+/*****************************************************************************/
+GType
+gl_merge_properties_dialog_get_type (void)
 {
-       PropertyDialogPassback *data;
-       GtkWidget *dialog;
+       static GType dialog_type = 0;
+
+       if (!dialog_type)
+       {
+               static const GTypeInfo dialog_info =
+               {
+                       sizeof (glMergePropertiesDialogClass),
+                       NULL,           /* base_init */
+                       NULL,           /* base_finalize */
+                       (GClassInitFunc) gl_merge_properties_dialog_class_init,
+                       NULL,           /* class_finalize */
+                       NULL,           /* class_data */
+                       sizeof (glMergePropertiesDialog),
+                       0,              /* n_preallocs */
+                       (GInstanceInitFunc) gl_merge_properties_dialog_init
+               };
+
+               dialog_type = g_type_register_static (GL_TYPE_HIG_DIALOG,
+                                                     "glMergePropertiesDialog",
+                                                     &dialog_info, 
+                                                     0);
+       }
+
+       return dialog_type;
+}
 
-       gl_debug (DEBUG_MERGE, "START");
+static void
+gl_merge_properties_dialog_class_init (glMergePropertiesDialogClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-       data = g_new0 (PropertyDialogPassback, 1);
+       gl_debug (DEBUG_MERGE, "");
+       
+       parent_class = g_type_class_peek_parent (klass);
+
+       object_class->finalize = gl_merge_properties_dialog_finalize;   
+}
 
-       dialog = gl_hig_dialog_new_with_buttons (
-               _("Edit document-merge properties"),
-               NULL,
-               GTK_DIALOG_DESTROY_WITH_PARENT,
-               GTK_STOCK_OK, GTK_RESPONSE_OK,
-               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-               NULL);
+static void
+gl_merge_properties_dialog_init (glMergePropertiesDialog *dialog)
+{
+       gl_debug (DEBUG_MERGE, "");
 
-       data->dialog = dialog;
-       data->view = view;
-       data->label = view->label;
+       dialog->private = g_new0 (glMergePropertiesDialogPrivate, 1);
 
-       create_merge_dialog_widgets (GL_HIG_DIALOG (dialog), data);
+       gtk_dialog_add_buttons (GTK_DIALOG(dialog),
+                               GTK_STOCK_OK, GTK_RESPONSE_OK,
+                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                               NULL);
 
        g_signal_connect (G_OBJECT(dialog), "response",
-                         G_CALLBACK(response_cb), data);
+                         G_CALLBACK(response_cb), NULL);
 
-       gtk_widget_show_all (GTK_WIDGET (dialog));
+}
 
-       gl_debug (DEBUG_MERGE, "END");
+static void 
+gl_merge_properties_dialog_finalize (GObject *object)
+{
+       glMergePropertiesDialog* dialog;
+       
+       gl_debug (DEBUG_MERGE, "");
+
+       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_OBJECT_CLASS (parent_class)->finalize (object);
+
+       if (dialog->private->merge != NULL) {
+               g_object_unref (G_OBJECT(dialog->private->merge));
+       }
+
+       g_free (dialog->private);
+}
+
+/*****************************************************************************/
+/* NEW merge properties dialog.                                              */
+/*****************************************************************************/
+GtkWidget*
+gl_merge_properties_dialog_new (glView *view)
+{
+       GtkWidget *dialog;
+
+       gl_debug (DEBUG_MERGE, "");
+
+       dialog = GTK_WIDGET (g_object_new (GL_TYPE_MERGE_PROPERTIES_DIALOG, NULL));
+
+       gl_merge_properties_dialog_construct (GL_MERGE_PROPERTIES_DIALOG(dialog),
+                                             view);
+
+       return dialog;
 }
 
 /*--------------------------------------------------------------------------*/
 /* PRIVATE.  Create merge widgets.                                          */
 /*--------------------------------------------------------------------------*/
 static void
-create_merge_dialog_widgets (glHigDialog            *dialog,
-                            PropertyDialogPassback *data)
+gl_merge_properties_dialog_construct (glMergePropertiesDialog *dialog,
+                                     glView                  *view)
 {
        GtkWidget         *wframe, *whbox, *wtable, *wlabel, *wcombo, *wscroll, *wentry;
        GList             *texts;
@@ -146,17 +215,28 @@ create_merge_dialog_widgets (glHigDialog            *dialog,
        GtkCellRenderer   *renderer;
        GtkTreeViewColumn *column;
        GtkTreeSelection  *selection;
+       gchar             *name, *title;
 
        gl_debug (DEBUG_MERGE, "START");
 
-       data->merge = gl_label_get_merge (data->label);
-       description = gl_merge_get_description (data->merge);
-       src_type    = gl_merge_get_src_type (data->merge);
-       src         = gl_merge_get_src (data->merge);
+       dialog->private->view  = view;
+       dialog->private->label = view->label;
+
+       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);
+
+       /* --- Window title --- */
+       name = gl_label_get_short_name (view->label);
+       title = g_strdup_printf ("%s %s", name, _("Merge Properties"));
+       gtk_window_set_title (GTK_WINDOW (dialog), title);
+       g_free (name);
+       g_free (title);
 
        /* ---- Source section ---- */
        wframe = gl_hig_category_new (_("Source"));
-       gl_hig_dialog_add_widget (dialog, wframe);
+       gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wframe);
        label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
        /* Format line */
@@ -180,12 +260,12 @@ create_merge_dialog_widgets (glHigDialog            *dialog,
        }
        gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), texts);
        gl_merge_free_descriptions (&texts);
-       data->type_entry = GTK_COMBO (wcombo)->entry;
-       gtk_entry_set_editable (GTK_ENTRY (data->type_entry), FALSE);
-       gtk_entry_set_text (GTK_ENTRY (data->type_entry), description);
+       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 (data->type_entry), "changed",
-                         G_CALLBACK (type_changed_cb), data);
+       g_signal_connect (G_OBJECT (dialog->private->type_entry), "changed",
+                         G_CALLBACK (type_changed_cb), dialog);
 
        whbox = gl_hig_hbox_new();
        gl_hig_category_add_widget (GL_HIG_CATEGORY (wframe), whbox);
@@ -199,25 +279,27 @@ create_merge_dialog_widgets (glHigDialog            *dialog,
        gl_debug (DEBUG_MERGE, "Src_type = %d", src_type);
        switch (src_type) {
        case GL_MERGE_SRC_IS_FILE:
-               data->src_entry =
+               dialog->private->src_entry =
                        gnome_file_entry_new (NULL, _("Select merge-database source"));
-               wentry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY(data->src_entry));
+               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",
-                                 G_CALLBACK (src_changed_cb), data);
+                                 G_CALLBACK (src_changed_cb), dialog);
                break;
        default:
-               data->src_entry = gtk_label_new (_("N/A"));
-               gtk_misc_set_alignment (GTK_MISC (data->src_entry), 0.0, 0.5);
+               dialog->private->src_entry = gtk_label_new (_("N/A"));
+               gtk_misc_set_alignment (GTK_MISC (dialog->private->src_entry), 0.0, 0.5);
                break;
        }
-       data->src_entry_holder = gtk_hbox_new (FALSE, 0);
-       gtk_container_add( GTK_CONTAINER(data->src_entry_holder), data->src_entry);
-       gl_hig_hbox_add_widget_justify (GL_HIG_HBOX(whbox), data->src_entry_holder);
+       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 (dialog, wframe);
+       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);
@@ -227,42 +309,43 @@ create_merge_dialog_widgets (glHigDialog            *dialog,
                                        GTK_POLICY_AUTOMATIC);
        gl_hig_category_add_widget (GL_HIG_CATEGORY (wframe), wscroll);
 
-       data->store = gtk_tree_store_new (N_COLUMNS,
+       dialog->private->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 (data->store, data->merge);
-       data->tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL(data->store));
-       gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(data->tree), TRUE);
-       selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(data->tree));
+       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));
        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), data->store);
+                         G_CALLBACK (record_select_toggled_cb), dialog->private->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(data->tree), column);
+       gtk_tree_view_append_column (GTK_TREE_VIEW(dialog->private->tree), column);
        renderer = gtk_cell_renderer_text_new ();
        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(data->tree), column);
-       gtk_tree_view_set_expander_column (GTK_TREE_VIEW(data->tree), column);
+       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);
        renderer = gtk_cell_renderer_text_new ();
        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(data->tree), column);
-       gtk_container_add (GTK_CONTAINER (wscroll), data->tree);
+       gtk_tree_view_append_column (GTK_TREE_VIEW(dialog->private->tree), column);
+       gtk_container_add (GTK_CONTAINER (wscroll), dialog->private->tree);
        
        g_free (src);
        g_free (description);
@@ -276,8 +359,8 @@ create_merge_dialog_widgets (glHigDialog            *dialog,
 /* PRIVATE.  type "changed" callback.                                       */
 /*--------------------------------------------------------------------------*/
 static void
-type_changed_cb (GtkWidget              *widget,
-                PropertyDialogPassback *data)
+type_changed_cb (GtkWidget               *widget,
+                glMergePropertiesDialog *dialog)
 {
        gchar             *description;
        gchar             *name;
@@ -287,46 +370,46 @@ type_changed_cb (GtkWidget              *widget,
 
        gl_debug (DEBUG_MERGE, "START");
 
-       description = gtk_editable_get_chars (GTK_EDITABLE (data->type_entry),
+       description = gtk_editable_get_chars (GTK_EDITABLE (dialog->private->type_entry),
                                              0, -1);
        name = gl_merge_description_to_name (description);
 
-       src = gl_merge_get_src (data->merge); /* keep current source if possible */
+       src = gl_merge_get_src (dialog->private->merge); /* keep current src if possible */
        if ( src != NULL ) {
                gl_debug (DEBUG_MERGE, "Saving src = \"%s\"", src);
-               g_free (data->saved_src);
-               data->saved_src = src;
+               g_free (dialog->private->saved_src);
+               dialog->private->saved_src = src;
        }
 
-       if (data->merge != NULL) {
-               g_object_unref (G_OBJECT(data->merge));
+       if (dialog->private->merge != NULL) {
+               g_object_unref (G_OBJECT(dialog->private->merge));
        }
-       data->merge = gl_merge_new (name);
+       dialog->private->merge = gl_merge_new (name);
 
-       gtk_widget_destroy (data->src_entry);
-       src_type = gl_merge_get_src_type (data->merge);
+       gtk_widget_destroy (dialog->private->src_entry);
+       src_type = gl_merge_get_src_type (dialog->private->merge);
        switch (src_type) {
        case GL_MERGE_SRC_IS_FILE:
-               data->src_entry =
+               dialog->private->src_entry =
                        gnome_file_entry_new (NULL, _("Select merge-database source"));
-               wentry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY(data->src_entry));
-               if (data->saved_src != NULL) {
-                       gl_debug (DEBUG_MERGE, "Setting src = \"%s\"", data->saved_src);
-                       gtk_entry_set_text (GTK_ENTRY(wentry), data->saved_src);
-                       gl_merge_set_src (data->merge, data->saved_src);
+               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);
                }
                g_signal_connect (G_OBJECT (wentry), "changed",
-                                 G_CALLBACK (src_changed_cb), data);
+                                 G_CALLBACK (src_changed_cb), dialog);
                break;
        default:
-               data->src_entry = gtk_label_new (_("N/A"));
-               gtk_misc_set_alignment (GTK_MISC (data->src_entry), 0.0, 0.5);
+               dialog->private->src_entry = gtk_label_new (_("N/A"));
+               gtk_misc_set_alignment (GTK_MISC (dialog->private->src_entry), 0.0, 0.5);
                break;
        }
-       gtk_container_add( GTK_CONTAINER(data->src_entry_holder), data->src_entry);
-       gtk_widget_show (data->src_entry);
+       gtk_container_add( GTK_CONTAINER(dialog->private->src_entry_holder), dialog->private->src_entry);
+       gtk_widget_show (dialog->private->src_entry);
 
-       load_tree (data->store, data->merge);
+       load_tree (dialog->private->store, dialog->private->merge);
 
        g_free (description);
        g_free (name);
@@ -338,20 +421,20 @@ type_changed_cb (GtkWidget              *widget,
 /* PRIVATE.  source "changed" callback.                                     */
 /*--------------------------------------------------------------------------*/
 static void
-src_changed_cb (GtkWidget              *widget,
-               PropertyDialogPassback *data)
+src_changed_cb (GtkWidget               *widget,
+               glMergePropertiesDialog *dialog)
 {
        gchar     *src;
        GtkWidget *wentry;
 
        gl_debug (DEBUG_MERGE, "START");
 
-       wentry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY(data->src_entry));
+       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 (data->merge, src);
+       gl_merge_set_src (dialog->private->merge, src);
        g_free (src);
 
-       load_tree (data->store, data->merge);
+       load_tree (dialog->private->store, dialog->private->merge);
 
        gl_debug (DEBUG_MERGE, "END");
 }
@@ -360,9 +443,9 @@ src_changed_cb (GtkWidget              *widget,
 /* PRIVATE.  response callback.                                             */
 /*--------------------------------------------------------------------------*/
 static void
-response_cb (glHigDialog            *dialog,
-            gint                    response,
-            PropertyDialogPassback *data)
+response_cb (glMergePropertiesDialog *dialog,
+            gint                     response,
+            gpointer                 user_data)
 {
        gl_debug (DEBUG_MERGE, "START");
 
@@ -370,15 +453,10 @@ response_cb (glHigDialog            *dialog,
 
        case GTK_RESPONSE_OK:
 
-               gl_label_set_merge (data->label, data->merge);
+               gl_label_set_merge (dialog->private->label, dialog->private->merge);
                break;
        }
 
-
-       if (data->merge != NULL) {
-               g_object_unref (G_OBJECT(data->merge));
-       }
-       g_free (data);
        gtk_widget_destroy (GTK_WIDGET(dialog));
 
        gl_debug (DEBUG_MERGE, "END");
index 4f516ec0a4fff2e8cdce28eca479a7f7b1ab980d..5d16a1a31e3b514fed9e16f37c03e80a63ba2706 100644 (file)
 #ifndef __MERGE_PROPERTIES_DIALOG_H__
 #define __MERGE_PROPERTIES_DIALOG_H__
 
+#include <gtk/gtk.h>
+#include "hig.h"
 #include "view.h"
 
 G_BEGIN_DECLS
 
-extern void gl_merge_properties_dialog (glView *view);
+#define GL_TYPE_MERGE_PROPERTIES_DIALOG            (gl_merge_properties_dialog_get_type ())
+#define GL_MERGE_PROPERTIES_DIALOG(obj)            (GTK_CHECK_CAST ((obj), GL_TYPE_MERGE_PROPERTIES_DIALOG, glMergePropertiesDialog))
+#define GL_MERGE_PROPERTIES_DIALOG_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_MERGE_PROPERTIES_DIALOG, glMergePropertiesDialogClass))
+#define GL_IS_MERGE_PROPERTIES_DIALOG(obj)         (GTK_CHECK_TYPE ((obj), GL_TYPE_MERGE_PROPERTIES_DIALOG))
+#define GL_IS_MERGE_PROPERTIES_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_MERGE_PROPERTIES_DIALOG))
+#define GL_MERGE_PROPERTIES_DIALOG_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), GL_TYPE_MERGE_PROPERTIES_DIALOG, glMergePropertiesDialogClass))
+
+
+typedef struct _glMergePropertiesDialog         glMergePropertiesDialog;
+typedef struct _glMergePropertiesDialogClass    glMergePropertiesDialogClass;
+
+typedef struct _glMergePropertiesDialogPrivate  glMergePropertiesDialogPrivate;
+
+struct _glMergePropertiesDialog
+{
+       glHigDialog                     parent_instance;
+
+       glMergePropertiesDialogPrivate *private;
+
+};
+
+struct  _glMergePropertiesDialogClass
+{
+       glHigDialogClass                parent_class;
+};
+
+GtkType    gl_merge_properties_dialog_get_type    (void) G_GNUC_CONST;
+
+GtkWidget *gl_merge_properties_dialog_new         (glView *view);
 
 G_END_DECLS
 
index e964f55baa320832a4df12bc5ec003a264d4ebff..1085e433c2df816c9f1e7878674a9e7c5abc2472 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "tools.h"
 #include "window.h"
-#include "merge-properties-dialog.h"
 
 /*===========================================*/
 /* Private types.                            */
@@ -239,7 +238,7 @@ gl_tools_merge_properties (BonoboUIComponent *uic,
        window = GL_WINDOW (user_data);
 
        if (window->view != NULL) {
-               gl_merge_properties_dialog (GL_VIEW(window->view));
+               gl_view_edit_merge_props (GL_VIEW(window->view));
        }
 }
 
index be0e5ad215ae6a00746a3719f522c1bfa86e2bd2..c1006858415d1bd44737c3698cd9bafb35a67602 100644 (file)
@@ -39,6 +39,7 @@
 #include "xml-label.h"
 #include "color.h"
 #include "stock.h"
+#include "merge-properties-dialog.h"
 #include "marshal.h"
 
 #include "debug.h"
@@ -2378,6 +2379,30 @@ gl_view_is_zoom_min (glView *view)
        return view->scale <= scales[N_SCALES-1];
 }
 
+/*****************************************************************************/
+/* Launch merge properties dialog.                                           */
+/*****************************************************************************/
+void
+gl_view_edit_merge_props (glView *view)
+{
+       gl_debug (DEBUG_VIEW, "");
+
+       g_return_if_fail (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);
+
+       g_signal_connect (G_OBJECT(view->merge_props_dialog), "destroy",
+                         G_CALLBACK (gtk_widget_destroyed),
+                         &view->merge_props_dialog);
+}
+
 /*---------------------------------------------------------------------------*/
 /* PRIVATE.  Canvas event handler.                                           */
 /*---------------------------------------------------------------------------*/
index 43177d0216ba9b1ffc79862d689eeb9aa69ab56a..6b6a49948959649ebd8f7347b1e276e7fb26e253 100644 (file)
@@ -77,6 +77,9 @@ struct _glView {
        GList             *multi_selection_items;
        GtkWidget         *selection_menu;
        GtkWidget         *empty_selection_menu;
+
+       /* Merge Properties Dialog */
+       GtkWidget         *merge_props_dialog;
 };
 
 struct _glViewClass {
@@ -200,6 +203,9 @@ gboolean   gl_view_is_zoom_max             (glView            *view);
 gboolean   gl_view_is_zoom_min             (glView            *view);
 
 
+void       gl_view_edit_merge_props        (glView            *view);
+
+
 int        gl_view_item_event_handler      (GnomeCanvasItem   *item,
                                            GdkEvent          *event,
                                            glViewObject      *view_object);