From: Jim Evins Date: Thu, 19 May 2005 02:41:21 +0000 (+0000) Subject: 2005-05-18 Jim Evins X-Git-Tag: glabels-2_3_0~414 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=43beed37015c722577065ec11a431f75651b8199;p=glabels 2005-05-18 Jim Evins * src/hig.h: * src/hig.c: Removed glHigDialog class. * src/file.c: (gl_file_new), (create_new_dialog_widgets), (gl_file_properties), (create_properties_dialog_widgets): * src/prefs-dialog.h: * src/prefs-dialog.c: (gl_prefs_dialog_get_type), (gl_prefs_dialog_init), (gl_prefs_dialog_construct): * src/print-dialog.h: * src/prefs-dialog.h: * src/print-dialog.c: (gl_print_dialog_get_type), (gl_print_dialog_init), (gl_print_dialog_construct): Replaced all instances of glHigDialog with GtkDialog. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@535 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index dd825c0e..d739599f 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,19 @@ +2005-05-18 Jim Evins + + * src/hig.h: + * src/hig.c: + Removed glHigDialog class. + * src/file.c: (gl_file_new), (create_new_dialog_widgets), + (gl_file_properties), (create_properties_dialog_widgets): + * src/prefs-dialog.h: + * src/prefs-dialog.c: (gl_prefs_dialog_get_type), + (gl_prefs_dialog_init), (gl_prefs_dialog_construct): + * src/print-dialog.h: + * src/prefs-dialog.h: + * src/print-dialog.c: (gl_print_dialog_get_type), + (gl_print_dialog_init), (gl_print_dialog_construct): + Replaced all instances of glHigDialog with GtkDialog. + 2005-05-17 Jim Evins * src/hig.h: diff --git a/glabels2/src/file.c b/glabels2/src/file.c index cd8ac652..5359dfba 100644 --- a/glabels2/src/file.c +++ b/glabels2/src/file.c @@ -57,14 +57,14 @@ static gchar *save_path = NULL; /*===========================================*/ /* Local function prototypes. */ /*===========================================*/ -static void create_new_dialog_widgets (glHigDialog *dlg); +static void create_new_dialog_widgets (GtkDialog *dlg); static void new_template_changed (glWdgtMediaSelect *select, gpointer data); static void new_response (GtkDialog *dlg, gint response, gpointer user_data); -static void create_properties_dialog_widgets (glHigDialog *dlg, +static void create_properties_dialog_widgets (GtkDialog *dlg, glLabel *label); static void properties_template_changed (glWdgtMediaSelect *select, gpointer data); @@ -92,16 +92,17 @@ gl_file_new (glWindow *window) g_return_if_fail (window != NULL); - dlg = gl_hig_dialog_new_with_buttons (_("New Label or Card"), - GTK_WINDOW (window), - GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + dlg = gtk_dialog_new_with_buttons (_("New Label or Card"), + GTK_WINDOW (window), + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_OK); + gtk_container_set_border_width (GTK_CONTAINER(dlg), GL_HIG_PAD2); - create_new_dialog_widgets (GL_HIG_DIALOG (dlg)); + create_new_dialog_widgets (GTK_DIALOG (dlg)); g_object_set_data (G_OBJECT (dlg), "parent_window", window); @@ -118,20 +119,23 @@ gl_file_new (glWindow *window) /* PRIVATE. Create widgets. */ /*---------------------------------------------------------------------------*/ static void -create_new_dialog_widgets (glHigDialog *dlg) +create_new_dialog_widgets (GtkDialog *dlg) { - GtkWidget *wframe, *template_entry, *rotate_sel; + GtkWidget *wvbox, *wframe, *template_entry, *rotate_sel; gl_debug (DEBUG_FILE, "START"); + wvbox = gtk_vbox_new (FALSE, GL_HIG_PAD2); + gtk_box_pack_start (GTK_BOX(dlg->vbox), wvbox, FALSE, FALSE, 0); + wframe = gl_hig_category_new (_("Media Type")); - gl_hig_dialog_add_widget (dlg, wframe); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); template_entry = gl_wdgt_media_select_new (); gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), template_entry); wframe = gl_hig_category_new (_("Label orientation")); - gl_hig_dialog_add_widget (dlg, wframe); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); rotate_sel = gl_wdgt_rotate_label_new (); gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), rotate_sel); @@ -261,16 +265,17 @@ gl_file_properties (glLabel *label, g_return_if_fail (label && GL_IS_LABEL (label)); g_return_if_fail (window && GTK_IS_WINDOW (window)); - dlg = gl_hig_dialog_new_with_buttons (_("Label properties"), - GTK_WINDOW (window), - GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); + dlg = gtk_dialog_new_with_buttons (_("Label properties"), + GTK_WINDOW (window), + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OK, GTK_RESPONSE_OK, + NULL); + gtk_container_set_border_width (GTK_CONTAINER(dlg), GL_HIG_PAD2); gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_OK); - create_properties_dialog_widgets (GL_HIG_DIALOG (dlg), label); + create_properties_dialog_widgets (GTK_DIALOG (dlg), label); g_object_set_data (G_OBJECT (dlg), "label", label); @@ -287,23 +292,26 @@ gl_file_properties (glLabel *label, /* PRIVATE. Create widgets. */ /*---------------------------------------------------------------------------*/ static void -create_properties_dialog_widgets (glHigDialog *dlg, +create_properties_dialog_widgets (GtkDialog *dlg, glLabel *label) { - GtkWidget *wframe, *template_entry, *rotate_sel; + GtkWidget *wvbox, *wframe, *template_entry, *rotate_sel; glTemplate *template; gboolean rotate_flag; gl_debug (DEBUG_FILE, "START"); + wvbox = gtk_vbox_new (FALSE, GL_HIG_PAD2); + gtk_box_pack_start (GTK_BOX(dlg->vbox), wvbox, FALSE, FALSE, 0); + wframe = gl_hig_category_new (_("Media Type")); - gl_hig_dialog_add_widget (dlg, wframe); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); template_entry = gl_wdgt_media_select_new (); gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), template_entry); wframe = gl_hig_category_new (_("Label orientation")); - gl_hig_dialog_add_widget (dlg, wframe); + gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0); rotate_sel = gl_wdgt_rotate_label_new (); gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), rotate_sel); diff --git a/glabels2/src/hig.c b/glabels2/src/hig.c index 4140520e..81643c63 100644 --- a/glabels2/src/hig.c +++ b/glabels2/src/hig.c @@ -48,7 +48,6 @@ /*===========================================*/ /* Private globals */ /*===========================================*/ -static GtkDialogClass *hig_dialog_parent_class; static GtkVBoxClass *hig_category_parent_class; static GtkVBoxClass *hig_vbox_parent_class; static GtkHBoxClass *hig_hbox_parent_class; @@ -58,14 +57,6 @@ static GtkHBoxClass *hig_hbox_parent_class; /* Local function prototypes */ /*===========================================*/ -static void gl_hig_dialog_class_init (glHigDialogClass *class); -static void gl_hig_dialog_init (glHigDialog *hig_dialog); -static void gl_hig_dialog_finalize (GObject *object); - -static void add_buttons_valist (glHigDialog *dialog, - const gchar *first_button_text, - va_list args); - static void gl_hig_category_class_init (glHigCategoryClass *class); static void gl_hig_category_init (glHigCategory *hig_category); static void gl_hig_category_finalize (GObject *object); @@ -78,168 +69,6 @@ static void gl_hig_hbox_class_init (glHigHBoxClass *class); static void gl_hig_hbox_init (glHigHBox *hig_hbox); static void gl_hig_hbox_finalize (GObject *object); -/****************************************************************************/ -/****************************************************************************/ -/* Boilerplate Dialog Object stuff. */ -/****************************************************************************/ -/****************************************************************************/ -GType -gl_hig_dialog_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glHigDialogClass), - NULL, - NULL, - (GClassInitFunc) gl_hig_dialog_class_init, - NULL, - NULL, - sizeof (glHigDialog), - 0, - (GInstanceInitFunc) gl_hig_dialog_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_DIALOG, - "glHigDialog", &info, 0); - } - - return type; -} - -static void -gl_hig_dialog_class_init (glHigDialogClass *class) -{ - GObjectClass *object_class = (GObjectClass *) class; - - hig_dialog_parent_class = g_type_class_peek_parent (class); - - object_class->finalize = gl_hig_dialog_finalize; -} - -static void -gl_hig_dialog_init (glHigDialog *hig_dialog) -{ - gtk_container_set_border_width (GTK_CONTAINER(hig_dialog), - HIG_DIALOG_BORDER); - - hig_dialog->vbox = gtk_vbox_new (FALSE, HIG_DIALOG_VBOX_SPACING); - gtk_box_pack_start (GTK_BOX(GTK_DIALOG(hig_dialog)->vbox), - hig_dialog->vbox, FALSE, FALSE, 0); - - gtk_box_set_spacing (GTK_BOX(GTK_DIALOG(hig_dialog)->vbox), - HIG_DIALOG_OUTER_VBOX_SPACING); -} - -static void -gl_hig_dialog_finalize (GObject *object) -{ - glHigDialog *hig_dialog; - - g_return_if_fail (object != NULL); - g_return_if_fail (GL_IS_HIG_DIALOG (object)); - - hig_dialog = GL_HIG_DIALOG (object); - - G_OBJECT_CLASS (hig_dialog_parent_class)->finalize (object); -} - - -/****************************************************************************/ -/* Create a dialog that attempts to be HIG compliant. */ -/****************************************************************************/ -GtkWidget* gl_hig_dialog_new (void) -{ - GtkWidget *dialog; - - dialog = g_object_new (gl_hig_dialog_get_type (), NULL); - - return dialog; -} - - - -/****************************************************************************/ -/* Create a dialog that attempts to be HIG compliant with buttons. */ -/****************************************************************************/ -GtkWidget *gl_hig_dialog_new_with_buttons (const gchar *title, - GtkWindow *parent, - GtkDialogFlags flags, - const gchar *first_button_text, - ...) -{ - GtkWidget *dialog; - va_list args; - - /* Create bare dialog */ - dialog = g_object_new (gl_hig_dialog_get_type (), NULL); - - /* Title */ - gtk_window_set_title (GTK_WINDOW(dialog), title); - - /* Parent */ - gtk_window_set_transient_for (GTK_WINDOW(dialog), parent); - - /* Flags */ - if ( flags & GTK_DIALOG_MODAL ) { - gtk_window_set_modal (GTK_WINDOW(dialog), TRUE); - } - if ( flags & GTK_DIALOG_DESTROY_WITH_PARENT ) { - gtk_window_set_destroy_with_parent (GTK_WINDOW(dialog), TRUE); - } - - /* Buttons */ - va_start (args, first_button_text); - add_buttons_valist (GL_HIG_DIALOG(dialog), first_button_text, args); - va_end (args); - - - return dialog; -} - -/*---------------------------------------------------------------------------*/ -/* PRIVATE. Add buttons to dialog from va_list. */ -/*---------------------------------------------------------------------------*/ -static void -add_buttons_valist(glHigDialog *dialog, - const gchar *first_button_text, - va_list args) -{ - const gchar* text; - gint response_id; - - g_return_if_fail (GL_IS_HIG_DIALOG (dialog)); - - if (first_button_text == NULL) - return; - - text = first_button_text; - response_id = va_arg (args, gint); - - while (text != NULL) - { - gtk_dialog_add_button (GTK_DIALOG(dialog), text, response_id); - - text = va_arg (args, gchar*); - if (text == NULL) - break; - response_id = va_arg (args, int); - } -} - -/****************************************************************************/ -/* Add widget (from top) to dialog's vbox. */ -/****************************************************************************/ -void -gl_hig_dialog_add_widget (glHigDialog *dialog, - GtkWidget *widget) -{ - gtk_box_pack_start (GTK_BOX (dialog->vbox), widget, FALSE, FALSE, 0); -} - - /****************************************************************************/ /****************************************************************************/ /* Boilerplate Category Object stuff. */ diff --git a/glabels2/src/hig.h b/glabels2/src/hig.h index 1f5bed8c..8fb170ad 100644 --- a/glabels2/src/hig.h +++ b/glabels2/src/hig.h @@ -33,47 +33,6 @@ G_BEGIN_DECLS #define GL_HIG_PAD2 12 -/*===========================================================================*/ -/* HIG Dialog wrapper. */ -/*===========================================================================*/ - -#define GL_TYPE_HIG_DIALOG (gl_hig_dialog_get_type ()) -#define GL_HIG_DIALOG(obj) \ - (GTK_CHECK_CAST((obj), GL_TYPE_HIG_DIALOG, glHigDialog )) -#define GL_HIG_DIALOG_CLASS(klass) \ - (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_HIG_DIALOG, glHigDialogClass)) -#define GL_IS_HIG_DIALOG(obj) \ - (GTK_CHECK_TYPE ((obj), GL_TYPE_HIG_DIALOG)) -#define GL_IS_HIG_DIALOG_CLASS(klass) \ - (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_HIG_DIALOG)) - -typedef struct _glHigDialog glHigDialog; -typedef struct _glHigDialogClass glHigDialogClass; - -struct _glHigDialog { - GtkDialog parent_widget; - - GtkWidget *vbox; -}; - -struct _glHigDialogClass { - GtkDialogClass parent_class; -}; - -GType gl_hig_dialog_get_type (void) G_GNUC_CONST; - -GtkWidget *gl_hig_dialog_new (void); - -GtkWidget *gl_hig_dialog_new_with_buttons (const gchar *title, - GtkWindow *parent, - GtkDialogFlags flags, - const gchar *first_button_text, - ...); - -void gl_hig_dialog_add_widget (glHigDialog *dialog, - GtkWidget *widget); - - /*===========================================================================*/ /* HIG Category (analogous to a gtk_frame). */ /*===========================================================================*/ diff --git a/glabels2/src/prefs-dialog.c b/glabels2/src/prefs-dialog.c index 33f9456f..f2d47336 100644 --- a/glabels2/src/prefs-dialog.c +++ b/glabels2/src/prefs-dialog.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -32,6 +34,7 @@ #include #include "prefs.h" +#include "hig.h" #include "mygal/widget-color-combo.h" #include "color.h" #include "util.h" @@ -85,7 +88,7 @@ struct _glPrefsDialogPrivate /* Private globals. */ /*========================================================*/ -static glHigDialogClass* parent_class = NULL; +static GtkDialogClass* parent_class = NULL; /*========================================================*/ /* Private function prototypes. */ @@ -137,7 +140,7 @@ gl_prefs_dialog_get_type (void) NULL }; - type = g_type_register_static (GL_TYPE_HIG_DIALOG, + type = g_type_register_static (GTK_TYPE_DIALOG, "glPrefsDialog", &info, 0); } @@ -172,6 +175,19 @@ gl_prefs_dialog_init (glPrefsDialog *dlg) return; } + gtk_container_set_border_width (GTK_CONTAINER(dlg), GL_HIG_PAD2); + + gtk_dialog_set_has_separator (GTK_DIALOG(dlg), FALSE); + gtk_dialog_add_button (GTK_DIALOG(dlg), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); + gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_CLOSE); + + g_signal_connect(G_OBJECT (dlg), "response", + G_CALLBACK (response_cb), NULL); + + gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); + gtk_window_set_title (GTK_WINDOW (dlg), _("gLabels Preferences")); + gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); + gl_debug (DEBUG_PREFS, "END"); } @@ -231,16 +247,8 @@ gl_prefs_dialog_construct (glPrefsDialog *dlg) g_return_if_fail (GL_IS_PREFS_DIALOG (dlg)); g_return_if_fail (dlg->priv != NULL); - gtk_dialog_add_button (GTK_DIALOG(dlg), - GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); - - gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_CLOSE); - - g_signal_connect(G_OBJECT (dlg), "response", - G_CALLBACK (response_cb), NULL); - notebook = glade_xml_get_widget (dlg->priv->gui, "prefs_notebook"); - gl_hig_dialog_add_widget (GL_HIG_DIALOG(dlg), notebook); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), notebook, FALSE, FALSE, 0); construct_locale_page (dlg); construct_object_page (dlg); @@ -249,10 +257,6 @@ gl_prefs_dialog_construct (glPrefsDialog *dlg) update_object_page_from_prefs (dlg); gtk_widget_show_all (GTK_DIALOG (dlg)->vbox); - - gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); - gtk_window_set_title (GTK_WINDOW (dlg), _("gLabels Preferences")); - gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); } /*---------------------------------------------------------------------------*/ diff --git a/glabels2/src/prefs-dialog.h b/glabels2/src/prefs-dialog.h index bc33a646..45fcc761 100644 --- a/glabels2/src/prefs-dialog.h +++ b/glabels2/src/prefs-dialog.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -24,7 +26,7 @@ #define __PREFS_DIALOG_H__ #include -#include "hig.h" +#include G_BEGIN_DECLS @@ -43,7 +45,7 @@ typedef struct _glPrefsDialogPrivate glPrefsDialogPrivate; struct _glPrefsDialog { - glHigDialog parent_instance; + GtkDialog parent_instance; glPrefsDialogPrivate *priv; @@ -51,7 +53,7 @@ struct _glPrefsDialog struct _glPrefsDialogClass { - glHigDialogClass parent_class; + GtkDialogClass parent_class; }; GType gl_prefs_dialog_get_type (void) G_GNUC_CONST; diff --git a/glabels2/src/print-dialog.c b/glabels2/src/print-dialog.c index f0a5edbb..f9a940c6 100644 --- a/glabels2/src/print-dialog.c +++ b/glabels2/src/print-dialog.c @@ -78,7 +78,7 @@ struct _glPrintDialogPrivate { /* Private globals */ /*===========================================*/ -static glHigDialogClass* parent_class = NULL; +static GtkDialogClass* parent_class = NULL; /*===========================================*/ /* Local function prototypes */ @@ -158,7 +158,7 @@ gl_print_dialog_get_type (void) NULL }; - type = g_type_register_static (GL_TYPE_HIG_DIALOG, + type = g_type_register_static (GTK_TYPE_DIALOG, "glPrintDialog", &info, 0); } @@ -186,6 +186,9 @@ gl_print_dialog_init (glPrintDialog *dialog) dialog->priv = g_new0 (glPrintDialogPrivate, 1); + gtk_container_set_border_width (GTK_CONTAINER(dialog), GL_HIG_PAD2); + + gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE); gtk_dialog_add_buttons (GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_PRINT, GNOME_PRINT_DIALOG_RESPONSE_PRINT, @@ -278,7 +281,7 @@ gl_print_dialog_construct (glPrintDialog *dialog, } notebook = gtk_notebook_new (); - gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), notebook); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, FALSE, FALSE, 0); /* ----- Create Job notebook page ----- */ page = job_page_new (dialog, label); diff --git a/glabels2/src/print-dialog.h b/glabels2/src/print-dialog.h index 5f909503..b084197d 100644 --- a/glabels2/src/print-dialog.h +++ b/glabels2/src/print-dialog.h @@ -25,7 +25,7 @@ #define __PRINT_DIALOG_H__ #include -#include "hig.h" +#include #include "view.h" G_BEGIN_DECLS @@ -45,7 +45,7 @@ typedef struct _glPrintDialogPrivate glPrintDialogPrivate; struct _glPrintDialog { - glHigDialog parent_instance; + GtkDialog parent_instance; glPrintDialogPrivate *priv; @@ -53,7 +53,7 @@ struct _glPrintDialog struct _glPrintDialogClass { - glHigDialogClass parent_class; + GtkDialogClass parent_class; };