From c41ee6a35575304bc9a08337f75b7e2a1c658e7e Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Mon, 21 Sep 2009 21:02:45 +0000 Subject: [PATCH] 2009-09-21 Jim Evins * po/POTFILES.in: * data/builder/Makefile.am: * data/builder/new-label-dialog.builder: Removed trivial builder file for new label dialog. * data/builder/wdgt-media-select.builder: Changed focus behavior of widgets. * src/new-label-dialog.c: (gl_new_label_dialog_init), (gl_new_label_dialog_construct): - Removed use of trivial builder file -- populate explicitely. - Moved population code to init. - OK button now has default focus. - Some formatting cleanup. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@893 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/ChangeLog | 15 +++ glabels2/data/builder/Makefile.am | 1 - .../data/builder/new-label-dialog.builder | 78 ----------- .../data/builder/wdgt-media-select.builder | 6 +- glabels2/po/POTFILES.in | 1 - glabels2/src/new-label-dialog.c | 123 +++++++----------- 6 files changed, 68 insertions(+), 156 deletions(-) delete mode 100644 glabels2/data/builder/new-label-dialog.builder diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index 332e7835..bda4f565 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,18 @@ +2009-09-21 Jim Evins + + * po/POTFILES.in: + * data/builder/Makefile.am: + * data/builder/new-label-dialog.builder: + Removed trivial builder file for new label dialog. + * data/builder/wdgt-media-select.builder: + Changed focus behavior of widgets. + * src/new-label-dialog.c: (gl_new_label_dialog_init), + (gl_new_label_dialog_construct): + - Removed use of trivial builder file -- populate explicitely. + - Moved population code to init. + - OK button now has default focus. + - Some formatting cleanup. + 2009-09-19 Jim Evins * COPYING: diff --git a/glabels2/data/builder/Makefile.am b/glabels2/data/builder/Makefile.am index 1f057753..9279a65b 100644 --- a/glabels2/data/builder/Makefile.am +++ b/glabels2/data/builder/Makefile.am @@ -7,7 +7,6 @@ builder_DATA = \ print-op-dialog-custom-widget.builder \ wdgt-media-select.builder \ merge-properties-dialog.builder \ - new-label-dialog.builder \ template-designer.builder \ prefs-dialog.builder \ object-editor.builder diff --git a/glabels2/data/builder/new-label-dialog.builder b/glabels2/data/builder/new-label-dialog.builder deleted file mode 100644 index e46715a8..00000000 --- a/glabels2/data/builder/new-label-dialog.builder +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - True - window1 - - - True - 12 - 12 - - - True - 0 - none - - - True - 12 - - - True - - - - - - - - - - True - <b>Media type</b> - True - - - - - 0 - - - - - True - 0 - none - - - True - 12 - - - True - - - - - - - - - - True - <b>Label orientation</b> - True - - - - - 1 - - - - - - diff --git a/glabels2/data/builder/wdgt-media-select.builder b/glabels2/data/builder/wdgt-media-select.builder index 1a41a4e2..80ab2f1f 100644 --- a/glabels2/data/builder/wdgt-media-select.builder +++ b/glabels2/data/builder/wdgt-media-select.builder @@ -11,7 +11,6 @@ True - True 12 @@ -29,7 +28,6 @@ True - True False @@ -75,6 +73,7 @@ True + False False @@ -106,6 +105,7 @@ True + False False @@ -136,6 +136,7 @@ True + False False @@ -167,7 +168,6 @@ True - True False diff --git a/glabels2/po/POTFILES.in b/glabels2/po/POTFILES.in index 9790b336..adfdd1d0 100644 --- a/glabels2/po/POTFILES.in +++ b/glabels2/po/POTFILES.in @@ -160,7 +160,6 @@ libglabels/xml-template.c libglabels/xml-template.h [type: gettext/glade]data/builder/merge-properties-dialog.builder -[type: gettext/glade]data/builder/new-label-dialog.builder [type: gettext/glade]data/builder/object-editor.builder [type: gettext/glade]data/builder/prefs-dialog.builder [type: gettext/glade]data/builder/property-bar.builder diff --git a/glabels2/src/new-label-dialog.c b/glabels2/src/new-label-dialog.c index afaa5a18..8e850c74 100644 --- a/glabels2/src/new-label-dialog.c +++ b/glabels2/src/new-label-dialog.c @@ -39,8 +39,6 @@ struct _glNewLabelDialogPrivate { - GtkBuilder *builder; - GtkWidget *media_select; GtkWidget *rotate_label; @@ -58,9 +56,6 @@ struct _glNewLabelDialogPrivate { static void gl_new_label_dialog_finalize (GObject *object); -static void gl_new_label_dialog_construct (glNewLabelDialog *dialog, - GtkWindow *win); - static void template_changed_cb (glWdgtMediaSelect *select, gpointer data); @@ -71,6 +66,9 @@ static void template_changed_cb (glWdgtMediaSelect *se G_DEFINE_TYPE (glNewLabelDialog, gl_new_label_dialog, GTK_TYPE_DIALOG); +/*****************************************************************************/ +/* Class Init Function. */ +/*****************************************************************************/ static void gl_new_label_dialog_class_init (glNewLabelDialogClass *class) { @@ -84,29 +82,69 @@ gl_new_label_dialog_class_init (glNewLabelDialogClass *class) } +/*****************************************************************************/ +/* Object Instance Init Function. */ +/*****************************************************************************/ static void gl_new_label_dialog_init (glNewLabelDialog *dialog) { + GtkWidget *label; + GtkWidget *frame; + gchar *name; + gl_debug (DEBUG_FILE, "START"); g_return_if_fail (GL_IS_NEW_LABEL_DIALOG (dialog)); dialog->priv = g_new0 (glNewLabelDialogPrivate, 1); - gtk_container_set_border_width (GTK_CONTAINER(dialog), GL_HIG_PAD2); + gtk_container_set_border_width (GTK_CONTAINER (dialog), GL_HIG_PAD1); - gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE); - gtk_dialog_add_buttons (GTK_DIALOG(dialog), - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); + 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); gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + + label = gtk_label_new (_("Media type")); + gtk_label_set_use_markup (GTK_LABEL (label), TRUE); + frame = gtk_frame_new (""); + gtk_frame_set_label_widget (GTK_FRAME (frame), label); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); + gtk_box_pack_start (GTK_BOX( GTK_DIALOG (dialog)->vbox), frame, FALSE, FALSE, GL_HIG_PAD1); + + dialog->priv->media_select = gl_wdgt_media_select_new (); + gtk_container_add (GTK_CONTAINER (frame), dialog->priv->media_select); + + label = gtk_label_new (_("Label orientation")); + gtk_label_set_use_markup (GTK_LABEL (label), TRUE); + frame = gtk_frame_new (""); + gtk_frame_set_label_widget (GTK_FRAME (frame), label); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); + gtk_box_pack_start (GTK_BOX( GTK_DIALOG (dialog)->vbox), frame, FALSE, FALSE, 0); + + dialog->priv->rotate_label = gl_rotate_label_button_new (); + gtk_container_add (GTK_CONTAINER (frame), dialog->priv->rotate_label); + + /* Sync template name from media select with rotate widget. */ + name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (dialog->priv->media_select)); + gl_rotate_label_button_set_template_name (GL_ROTATE_LABEL_BUTTON (dialog->priv->rotate_label), + name); + + g_signal_connect (G_OBJECT (dialog->priv->media_select), "changed", + G_CALLBACK (template_changed_cb), dialog); + gl_debug (DEBUG_FILE, "END"); } +/*****************************************************************************/ +/* Finalize Function. */ +/*****************************************************************************/ static void gl_new_label_dialog_finalize (GObject *object) { @@ -118,10 +156,6 @@ gl_new_label_dialog_finalize (GObject *object) g_return_if_fail (GL_IS_NEW_LABEL_DIALOG (dialog)); g_return_if_fail (dialog->priv != NULL); - if (dialog->priv->builder) - { - g_object_unref (dialog->priv->builder); - } g_free (dialog->priv); G_OBJECT_CLASS (gl_new_label_dialog_parent_class)->finalize (object); @@ -143,66 +177,9 @@ gl_new_label_dialog_new (GtkWindow *win) dialog = GTK_WIDGET (g_object_new (GL_TYPE_NEW_LABEL_DIALOG, NULL)); - gl_new_label_dialog_construct (GL_NEW_LABEL_DIALOG(dialog), win); - - return dialog; -} - - -/*--------------------------------------------------------------------------*/ -/* PRIVATE. Construct dialog. */ -/*--------------------------------------------------------------------------*/ -static void -gl_new_label_dialog_construct (glNewLabelDialog *dialog, - GtkWindow *win) -{ - GtkBuilder *builder; - static gchar *object_ids[] = { "new_label_dialog_vbox", NULL }; - GError *error = NULL; - GtkWidget *vbox, *media_select_vbox, *rotate_label_vbox; - gchar *name; - - gl_debug (DEBUG_FILE, "START"); - gtk_window_set_transient_for (GTK_WINDOW (dialog), win); - builder = gtk_builder_new (); - gtk_builder_add_objects_from_file (builder, - GLABELS_BUILDER_DIR "new-label-dialog.builder", - object_ids, - &error); - if (error) { - g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); - g_error_free (error); - return; - } - - gl_util_get_builder_widgets (builder, - "new_label_dialog_vbox", &vbox, - "media_select_vbox", &media_select_vbox, - "rotate_label_vbox", &rotate_label_vbox, - NULL); - - gtk_box_pack_start (GTK_BOX( GTK_DIALOG (dialog)->vbox), vbox, FALSE, FALSE, 0); - dialog->priv->builder = builder; - - dialog->priv->media_select = gl_wdgt_media_select_new (); - gtk_box_pack_start (GTK_BOX (media_select_vbox), - dialog->priv->media_select, FALSE, FALSE, 0); - - dialog->priv->rotate_label = gl_rotate_label_button_new (); - gtk_box_pack_start (GTK_BOX (rotate_label_vbox), - dialog->priv->rotate_label, FALSE, FALSE, 0); - - /* Sync template name from media select with rotate widget. */ - name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (dialog->priv->media_select)); - gl_rotate_label_button_set_template_name (GL_ROTATE_LABEL_BUTTON (dialog->priv->rotate_label), - name); - - g_signal_connect (G_OBJECT (dialog->priv->media_select), "changed", - G_CALLBACK (template_changed_cb), dialog); - - gl_debug (DEBUG_FILE, "END"); + return dialog; } -- 2.39.5