From 6d7d332d28475ac2f27f4259b8f00ddc790da963 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Fri, 20 Sep 2002 16:41:28 +0000 Subject: [PATCH] More refinements to HIG module. New label and print dialogs along with associated widget now use HIG module. Full-page labels are now named "Generic %s full page." git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@126 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/src/file.c | 10 +- glabels2/src/hig.c | 242 ++++++++++++++++++++++++++++++- glabels2/src/hig.h | 83 ++++++++++- glabels2/src/print-dialog.c | 42 ++---- glabels2/src/template.c | 3 +- glabels2/src/wdgt-media-select.c | 131 ++++++++--------- glabels2/src/wdgt-media-select.h | 5 +- glabels2/src/wdgt-print-copies.c | 51 +++---- glabels2/src/wdgt-print-copies.h | 5 +- glabels2/src/wdgt-print-merge.c | 69 +++++---- glabels2/src/wdgt-print-merge.h | 5 +- glabels2/src/wdgt-rotate-label.c | 46 ++++-- glabels2/src/wdgt-rotate-label.h | 5 +- 13 files changed, 495 insertions(+), 202 deletions(-) diff --git a/glabels2/src/file.c b/glabels2/src/file.c index 0b3b1cf3..8ab64d8f 100644 --- a/glabels2/src/file.c +++ b/glabels2/src/file.c @@ -112,18 +112,16 @@ create_new_dialog_widgets (glHigDialog *dlg) gl_debug (DEBUG_FILE, "START"); wframe = gl_hig_category_new (_("Media Type")); - gtk_box_pack_start (GTK_BOX (dlg->vbox), wframe, FALSE, FALSE, 0); + gl_hig_dialog_add_widget (dlg, wframe); template_entry = gl_wdgt_media_select_new (); - gtk_box_pack_start (GTK_BOX (GL_HIG_CATEGORY(wframe)->vbox), - template_entry, FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), template_entry); wframe = gl_hig_category_new (_("Label orientation")); - gtk_box_pack_start (GTK_BOX (dlg->vbox), wframe, FALSE, FALSE, 0); + gl_hig_dialog_add_widget (dlg, wframe); rotate_sel = gl_wdgt_rotate_label_new (); - gtk_box_pack_start (GTK_BOX (GL_HIG_CATEGORY(wframe)->vbox), - rotate_sel, FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), rotate_sel); g_object_set_data (G_OBJECT (dlg), "template_entry", template_entry); diff --git a/glabels2/src/hig.c b/glabels2/src/hig.c index a3343721..5315daa6 100644 --- a/glabels2/src/hig.c +++ b/glabels2/src/hig.c @@ -29,17 +29,24 @@ /*========================================================*/ /* Private macros and constants. */ /*========================================================*/ -#define HIG_DIALOG_BORDER 12 -#define HIG_DIALOG_VBOX_SPACING 18 -#define HIG_DIALOG_ACTION_BORDER 0 +#define HIG_DIALOG_BORDER 12 +#define HIG_DIALOG_VBOX_SPACING 18 +#define HIG_DIALOG_OUTER_VBOX_SPACING 12 -#define HIG_GENERAL_SPACING 6 +#define HIG_VBOX_OUTER_SPACING 18 +#define HIG_VBOX_OUTER_BORDER 12 + +#define HIG_VBOX_INNER_SPACING 6 + +#define HIG_HBOX_SPACING 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,6 +65,14 @@ 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); +static void gl_hig_vbox_class_init (glHigVBoxClass *class); +static void gl_hig_vbox_init (glHigVBox *hig_vbox); +static void gl_hig_vbox_finalize (GObject *object); + +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. */ @@ -108,8 +123,9 @@ gl_hig_dialog_init (glHigDialog *hig_dialog) 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_VBOX_SPACING); + HIG_DIALOG_OUTER_VBOX_SPACING); } static void @@ -208,6 +224,16 @@ add_buttons_valist(glHigDialog *dialog, } } +/****************************************************************************/ +/* 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. */ @@ -254,7 +280,7 @@ gl_hig_category_init (glHigCategory *hig_category) { GtkWidget *hbox; - gtk_box_set_spacing (GTK_BOX(hig_category), HIG_GENERAL_SPACING); + gtk_box_set_spacing (GTK_BOX(hig_category), HIG_VBOX_INNER_SPACING); /* 1st row: Label */ hig_category->label = gtk_label_new (""); @@ -264,7 +290,7 @@ gl_hig_category_init (glHigCategory *hig_category) hig_category->label, FALSE, FALSE, 0); /* 2nd row: HBOX */ - hbox = gtk_hbox_new (FALSE, HIG_GENERAL_SPACING); + hbox = gtk_hbox_new (FALSE, HIG_VBOX_INNER_SPACING); gtk_box_pack_start (GTK_BOX(hig_category), hbox, FALSE, FALSE, 0); /* 2nd row, Column 1: Indentation spacing */ @@ -272,7 +298,7 @@ gl_hig_category_init (glHigCategory *hig_category) gtk_label_new (" "), FALSE, FALSE, 0); /* 2nd row, Column 2: User area (inner vbox) */ - hig_category->vbox = gtk_vbox_new (FALSE, HIG_GENERAL_SPACING); + hig_category->vbox = gtk_vbox_new (FALSE, HIG_VBOX_INNER_SPACING); gtk_box_pack_start (GTK_BOX(hbox), hig_category->vbox, FALSE, FALSE, 0); } @@ -313,3 +339,203 @@ GtkWidget* gl_hig_category_new (const gchar *header) return category; } +/****************************************************************************/ +/* Add widget (from top) to category's vbox. */ +/****************************************************************************/ +void +gl_hig_category_add_widget (glHigCategory *cat, + GtkWidget *widget) +{ + gtk_box_pack_start (GTK_BOX (cat->vbox), widget, FALSE, FALSE, 0); +} + + + +/****************************************************************************/ +/* Boilerplate VBox Object stuff. */ +/****************************************************************************/ +guint +gl_hig_vbox_get_type (void) +{ + static guint hig_vbox_type = 0; + + if (!hig_vbox_type) { + GTypeInfo hig_vbox_info = { + sizeof (glHigVBoxClass), + NULL, + NULL, + (GClassInitFunc) gl_hig_vbox_class_init, + NULL, + NULL, + sizeof (glHigVBox), + 0, + (GInstanceInitFunc) gl_hig_vbox_init, + }; + + hig_vbox_type = + g_type_register_static (gtk_vbox_get_type (), + "glHigVBox", + &hig_vbox_info, 0); + } + + return hig_vbox_type; +} + +static void +gl_hig_vbox_class_init (glHigVBoxClass *class) +{ + GObjectClass *object_class = (GObjectClass *) class; + + hig_vbox_parent_class = g_type_class_peek_parent (class); + + object_class->finalize = gl_hig_vbox_finalize; +} + +static void +gl_hig_vbox_init (glHigVBox *hig_vbox) +{ + /* defaults to an INNER VBox */ + gtk_box_set_spacing (GTK_BOX(hig_vbox), HIG_VBOX_INNER_SPACING); + gtk_container_set_border_width (GTK_CONTAINER(hig_vbox), 0); +} + +static void +gl_hig_vbox_finalize (GObject *object) +{ + glHigVBox *hig_vbox; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_HIG_VBOX (object)); + + hig_vbox = GL_HIG_VBOX (object); + + G_OBJECT_CLASS (hig_vbox_parent_class)->finalize (object); +} + + +/****************************************************************************/ +/* Create a vbox wrapper that attempts to be HIG compliant. */ +/****************************************************************************/ +GtkWidget* gl_hig_vbox_new (glHigVBoxType type) +{ + GtkWidget *hig_vbox; + + hig_vbox = g_object_new (gl_hig_vbox_get_type (), NULL); + + switch (type) { + + case GL_HIG_VBOX_OUTER: + gtk_box_set_spacing (GTK_BOX(hig_vbox), + HIG_VBOX_OUTER_SPACING); + gtk_container_set_border_width (GTK_CONTAINER(hig_vbox), + HIG_VBOX_OUTER_BORDER); + break; + + case GL_HIG_VBOX_INNER: + gtk_box_set_spacing (GTK_BOX(hig_vbox), + HIG_VBOX_INNER_SPACING); + gtk_container_set_border_width (GTK_CONTAINER(hig_vbox), 0); + + default: + break; + + } + + return hig_vbox; +} + +/****************************************************************************/ +/* Add widget (from top) to vbox. */ +/****************************************************************************/ +void +gl_hig_vbox_add_widget (glHigVBox *hig_vbox, + GtkWidget *widget) +{ + gtk_box_pack_start (GTK_BOX (hig_vbox), widget, FALSE, FALSE, 0); +} + + +/****************************************************************************/ +/* Boilerplate HBox Object stuff. */ +/****************************************************************************/ +guint +gl_hig_hbox_get_type (void) +{ + static guint hig_hbox_type = 0; + + if (!hig_hbox_type) { + GTypeInfo hig_hbox_info = { + sizeof (glHigHBoxClass), + NULL, + NULL, + (GClassInitFunc) gl_hig_hbox_class_init, + NULL, + NULL, + sizeof (glHigHBox), + 0, + (GInstanceInitFunc) gl_hig_hbox_init, + }; + + hig_hbox_type = + g_type_register_static (gtk_hbox_get_type (), + "glHigHBox", + &hig_hbox_info, 0); + } + + return hig_hbox_type; +} + +static void +gl_hig_hbox_class_init (glHigHBoxClass *class) +{ + GObjectClass *object_class = (GObjectClass *) class; + + hig_hbox_parent_class = g_type_class_peek_parent (class); + + object_class->finalize = gl_hig_hbox_finalize; +} + +static void +gl_hig_hbox_init (glHigHBox *hig_hbox) +{ + gtk_box_set_spacing (GTK_BOX(hig_hbox), HIG_HBOX_SPACING); + gtk_container_set_border_width (GTK_CONTAINER(hig_hbox), 0); +} + +static void +gl_hig_hbox_finalize (GObject *object) +{ + glHigHBox *hig_hbox; + + g_return_if_fail (object != NULL); + g_return_if_fail (GL_IS_HIG_HBOX (object)); + + hig_hbox = GL_HIG_HBOX (object); + + G_OBJECT_CLASS (hig_hbox_parent_class)->finalize (object); +} + + +/****************************************************************************/ +/* Create a hbox wrapper that attempts to be HIG compliant. */ +/****************************************************************************/ +GtkWidget* gl_hig_hbox_new (void) +{ + GtkWidget *hig_hbox; + + hig_hbox = g_object_new (gl_hig_hbox_get_type (), NULL); + + return hig_hbox; +} + +/****************************************************************************/ +/* Add widget (from left) to hbox. */ +/****************************************************************************/ +void +gl_hig_hbox_add_widget (glHigHBox *hig_hbox, + GtkWidget *widget) +{ + gtk_box_pack_start (GTK_BOX (hig_hbox), widget, FALSE, FALSE, 0); +} + + diff --git a/glabels2/src/hig.h b/glabels2/src/hig.h index 1e1a1965..c130fed8 100644 --- a/glabels2/src/hig.h +++ b/glabels2/src/hig.h @@ -27,10 +27,8 @@ G_BEGIN_DECLS -#define GL_HIG_SPACING 6 - /*===========================================================================*/ -/* HIG Dialog. */ +/* HIG Dialog wrapper. */ /*===========================================================================*/ #define GL_TYPE_HIG_DIALOG (gl_hig_dialog_get_type ()) @@ -66,9 +64,12 @@ GtkWidget *gl_hig_dialog_new_with_buttons (const gchar *title, const gchar *first_button_text, ...); +void gl_hig_dialog_add_widget (glHigDialog *dialog, + GtkWidget *widget); + /*===========================================================================*/ -/* HIG Category. */ +/* HIG Category (analogous to a gtk_frame). */ /*===========================================================================*/ #define GL_TYPE_HIG_CATEGORY (gl_hig_category_get_type ()) @@ -99,6 +100,80 @@ guint gl_hig_category_get_type (void); GtkWidget *gl_hig_category_new (const gchar *header); +void gl_hig_category_add_widget (glHigCategory *cat, + GtkWidget *widget); + +G_END_DECLS + +/*===========================================================================*/ +/* HIG VBOX wrapper. */ +/*===========================================================================*/ + +typedef enum { + GL_HIG_VBOX_OUTER, + GL_HIG_VBOX_INNER, +} glHigVBoxType; + +#define GL_TYPE_HIG_VBOX (gl_hig_vbox_get_type ()) +#define GL_HIG_VBOX(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_HIG_VBOX, glHigVBox )) +#define GL_HIG_VBOX_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_HIG_VBOX, glHigVBoxClass)) +#define GL_IS_HIG_VBOX(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_HIG_VBOX)) +#define GL_IS_HIG_VBOX_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_HIG_VBOX)) + +typedef struct _glHigVBox glHigVBox; +typedef struct _glHigVBoxClass glHigVBoxClass; + +struct _glHigVBox { + GtkVBox parent_widget; +}; + +struct _glHigVBoxClass { + GtkVBoxClass parent_class; +}; + +guint gl_hig_vbox_get_type (void); + +GtkWidget *gl_hig_vbox_new (glHigVBoxType type); + +void gl_hig_vbox_add_widget (glHigVBox *hig_vbox, + GtkWidget *widget); + +/*===========================================================================*/ +/* HIG HBOX wrapper. */ +/*===========================================================================*/ + +#define GL_TYPE_HIG_HBOX (gl_hig_hbox_get_type ()) +#define GL_HIG_HBOX(obj) \ + (GTK_CHECK_CAST((obj), GL_TYPE_HIG_HBOX, glHigHBox )) +#define GL_HIG_HBOX_CLASS(klass) \ + (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_HIG_HBOX, glHigHBoxClass)) +#define GL_IS_HIG_HBOX(obj) \ + (GTK_CHECK_TYPE ((obj), GL_TYPE_HIG_HBOX)) +#define GL_IS_HIG_HBOX_CLASS(klass) \ + (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_HIG_HBOX)) + +typedef struct _glHigHBox glHigHBox; +typedef struct _glHigHBoxClass glHigHBoxClass; + +struct _glHigHBox { + GtkHBox parent_widget; +}; + +struct _glHigHBoxClass { + GtkHBoxClass parent_class; +}; + +guint gl_hig_hbox_get_type (void); + +GtkWidget *gl_hig_hbox_new (void); + +void gl_hig_hbox_add_widget (glHigHBox *hig_hbox, + GtkWidget *widget); + G_END_DECLS #endif /* __HIG_H__ */ diff --git a/glabels2/src/print-dialog.c b/glabels2/src/print-dialog.c index c4c6b9e2..f11e53b0 100644 --- a/glabels2/src/print-dialog.c +++ b/glabels2/src/print-dialog.c @@ -32,6 +32,7 @@ #include #include "print-dialog.h" +#include "hig.h" #include "print.h" #include "label.h" #include "bc.h" @@ -94,7 +95,7 @@ gl_print_dialog (glLabel *label, BonoboWindow *win) g_return_if_fail (win != NULL); /* ----- Contstruct basic print dialog with notebook ----- */ - dlg = gtk_dialog_new_with_buttons (_("Print"), GTK_WINDOW(win), + dlg = gl_hig_dialog_new_with_buttons (_("Print"), GTK_WINDOW(win), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_PRINT, GNOME_PRINT_DIALOG_RESPONSE_PRINT, @@ -108,10 +109,8 @@ gl_print_dialog (glLabel *label, BonoboWindow *win) gtk_dialog_set_default_response (GTK_DIALOG (dlg), GNOME_PRINT_DIALOG_RESPONSE_PRINT); notebook = gtk_notebook_new (); - gtk_container_set_border_width (GTK_CONTAINER (notebook), 4); gtk_widget_show (notebook); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox), notebook); - + gl_hig_dialog_add_widget (GL_HIG_DIALOG(dlg), notebook); /* ----- Create Job notebook page ----- */ page = job_page_new (dlg, label); @@ -144,19 +143,17 @@ job_page_new (GtkWidget *dlg, GList *record_list; gint n_records; - vbox = gtk_vbox_new (FALSE, 0); + vbox = gl_hig_vbox_new (GL_HIG_VBOX_OUTER); merge = gl_label_get_merge (label); if (merge->type == GL_MERGE_NONE) { /* ----------- Add simple-copies widget ------------ */ - wframe = gtk_frame_new (_("Copies")); - gtk_box_pack_start (GTK_BOX (vbox), wframe, FALSE, FALSE, 0); + wframe = gl_hig_category_new (_("Copies")); + gl_hig_vbox_add_widget (GL_HIG_VBOX(vbox), wframe); copies = gl_wdgt_print_copies_new (label); - gtk_container_set_border_width (GTK_CONTAINER (copies), - GNOME_PAD_SMALL); - gtk_container_add (GTK_CONTAINER (wframe), copies); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), copies); if (n_sheets) { gl_wdgt_print_copies_set_range (GL_WDGT_PRINT_COPIES (copies), @@ -166,13 +163,11 @@ job_page_new (GtkWidget *dlg, } else { /* ------- Otherwise add merge control widget ------------ */ - wframe = gtk_frame_new (_("Document merge control")); - gtk_box_pack_start (GTK_BOX (vbox), wframe, FALSE, FALSE, 0); + wframe = gl_hig_category_new (_("Document merge control")); + gl_hig_vbox_add_widget (GL_HIG_VBOX(vbox), wframe); prmerge = gl_wdgt_print_merge_new (label); - gtk_container_set_border_width (GTK_CONTAINER (prmerge), - GNOME_PAD_SMALL); - gtk_container_add (GTK_CONTAINER (wframe), prmerge); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), prmerge); record_list = gl_merge_read_data (merge->type, merge->field_defs, @@ -187,18 +182,14 @@ job_page_new (GtkWidget *dlg, g_object_set_data (G_OBJECT(dlg), "prmerge", prmerge); /* ----------- Add custom print options area ------------ */ - wframe = gtk_frame_new (_("Options")); - gtk_box_pack_start (GTK_BOX (vbox), wframe, FALSE, FALSE, 0); - wvbox = gtk_vbox_new (FALSE, GNOME_PAD); - gtk_container_set_border_width (GTK_CONTAINER (wvbox), - GNOME_PAD_SMALL); - gtk_container_add (GTK_CONTAINER (wframe), wvbox); + wframe = gl_hig_category_new (_("Options")); + gl_hig_vbox_add_widget (GL_HIG_VBOX(vbox), wframe); /* add Outline check button */ outline_check = gtk_check_button_new_with_label ( _("print outlines (to test printer alignment)")); - gtk_box_pack_start (GTK_BOX (wvbox), outline_check, FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), outline_check); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (outline_check), outline_flag); g_object_set_data (G_OBJECT(dlg), "outline_check", outline_check); @@ -207,7 +198,7 @@ job_page_new (GtkWidget *dlg, reverse_check = gtk_check_button_new_with_label ( _("print in reverse (i.e. a mirror image)")); - gtk_box_pack_start (GTK_BOX (wvbox), reverse_check, FALSE, FALSE, 0); + gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), reverse_check); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (reverse_check), reverse_flag); g_object_set_data (G_OBJECT(dlg), "reverse_check", reverse_check); @@ -227,13 +218,12 @@ printer_page_new (GtkWidget *dlg, GtkWidget *vbox; GtkWidget *printer_select; - vbox = gtk_vbox_new (FALSE, 0); + vbox = gl_hig_vbox_new (GL_HIG_VBOX_OUTER); printer_select = gnome_printer_selection_new (gnome_print_config_default ()); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 4); gtk_widget_show (printer_select); - gtk_box_pack_start (GTK_BOX(vbox), printer_select, FALSE, FALSE, 0); + gl_hig_vbox_add_widget (GL_HIG_VBOX(vbox), printer_select); g_object_set_data (G_OBJECT(dlg), "printer_select", printer_select); diff --git a/glabels2/src/template.c b/glabels2/src/template.c index 8110cece..f625681f 100644 --- a/glabels2/src/template.c +++ b/glabels2/src/template.c @@ -364,7 +364,8 @@ template_full_page (const gchar *page_size) template = g_new0 (glTemplate, 1); template->name = g_list_append (template->name, - g_strdup_printf("*%s", page_size)); + g_strdup_printf(_("Generic %s full page"), + page_size)); template->page_size = g_strdup(page_size); template->description = g_strdup(FULL_PAGE); diff --git a/glabels2/src/wdgt-media-select.c b/glabels2/src/wdgt-media-select.c index 05ddb0df..0238783b 100644 --- a/glabels2/src/wdgt-media-select.c +++ b/glabels2/src/wdgt-media-select.c @@ -94,7 +94,7 @@ gl_wdgt_media_select_get_type (void) }; wdgt_media_select_type = - g_type_register_static (gtk_vbox_get_type (), + g_type_register_static (gl_hig_vbox_get_type (), "glWdgtMediaSelect", &wdgt_media_select_info, 0); } @@ -111,7 +111,7 @@ gl_wdgt_media_select_class_init (glWdgtMediaSelectClass * class) object_class = (GObjectClass *) class; - parent_class = gtk_type_class (gtk_vbox_get_type ()); + parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_wdgt_media_select_finalize; @@ -185,7 +185,8 @@ gl_wdgt_media_select_new (void) static void gl_wdgt_media_select_construct (glWdgtMediaSelect * media_select) { - GtkWidget *whbox, *wvbox, *wcombo, *wvbox1, *whbox1; + GtkWidget *whbox, *wvbox, *wcombo, *wvbox1, *whbox1, *wlabel; + GtkSizeGroup *label_size_group; gchar *name; GList *template_names, *page_sizes = NULL; const gchar *page_size; @@ -195,10 +196,9 @@ gl_wdgt_media_select_construct (glWdgtMediaSelect * media_select) page_size = gl_prefs_get_page_size (); wvbox = GTK_WIDGET (media_select); - gtk_box_set_spacing (GTK_BOX(wvbox), GL_HIG_SPACING); - whbox = gtk_hbox_new (FALSE, GL_HIG_SPACING); - gtk_box_pack_start (GTK_BOX (wvbox), whbox, TRUE, TRUE, 0); + whbox = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox); /* Page size selection control */ gl_debug (DEBUG_MEDIA_SELECT, "Creating page size combo..."); @@ -213,7 +213,7 @@ gl_wdgt_media_select_construct (glWdgtMediaSelect * media_select) gtk_widget_set_size_request (media_select->page_size_entry, 100, -1); gtk_entry_set_text (GTK_ENTRY (media_select->page_size_entry), page_size); - gtk_box_pack_start (GTK_BOX (whbox), wcombo, FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wcombo); /* Actual selection control */ gl_debug (DEBUG_MEDIA_SELECT, "Creating template combo..."); @@ -230,80 +230,69 @@ gl_wdgt_media_select_construct (glWdgtMediaSelect * media_select) gtk_combo_set_value_in_list (GTK_COMBO(media_select->template_combo), TRUE, FALSE); gtk_widget_set_size_request (media_select->template_entry, 400, -1); - gtk_box_pack_start (GTK_BOX (whbox), media_select->template_combo, - FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), + media_select->template_combo); - whbox = gtk_hbox_new (FALSE, GL_HIG_SPACING); - gtk_box_pack_start (GTK_BOX (wvbox), whbox, TRUE, TRUE, 0); + whbox = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox); /* mini_preview canvas */ gl_debug (DEBUG_MEDIA_SELECT, "Creating mini preview..."); media_select->mini_preview = gl_wdgt_mini_preview_new ( WDGT_MINI_PREVIEW_HEIGHT, WDGT_MINI_PREVIEW_WIDTH); - gtk_box_pack_start (GTK_BOX (whbox), media_select->mini_preview, - FALSE, FALSE, 0); - - /* Label column */ - gl_debug (DEBUG_MEDIA_SELECT, "Creating label column..."); - wvbox1 = gtk_vbox_new (FALSE, GL_HIG_SPACING); - gtk_box_pack_start (GTK_BOX (whbox), wvbox1, FALSE, FALSE, 0); - - whbox1 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (whbox1), - gtk_label_new (""), - FALSE, FALSE, 0); - whbox1 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (whbox1), - gtk_label_new (_("Description:")), - FALSE, FALSE, 0); - whbox1 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (whbox1), - gtk_label_new (_("Page size:")), - FALSE, FALSE, 0); - whbox1 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (whbox1), - gtk_label_new (_("Label size:")), - FALSE, FALSE, 0); - whbox1 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (whbox1), - gtk_label_new (_("Layout:")), - FALSE, FALSE, 0); - - /* detail widgets column */ - gl_debug (DEBUG_MEDIA_SELECT, "Creating details column..."); - wvbox1 = gtk_vbox_new (FALSE, GL_HIG_SPACING); - gtk_box_pack_start (GTK_BOX (whbox), wvbox1, FALSE, FALSE, 0); - - whbox1 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (whbox1), - gtk_label_new (""), - FALSE, FALSE, 0); - whbox1 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), + media_select->mini_preview); + + /* ---- Information area ---- */ + wvbox1 = gl_hig_vbox_new (GL_HIG_VBOX_INNER); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wvbox1); + label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + + /* blank line */ + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox1), gtk_label_new ("")); + + /* Description line */ + whbox1 = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox1), whbox1); + wlabel = gtk_label_new (_("Description:")); + gtk_size_group_add_widget (label_size_group, wlabel); + gtk_misc_set_alignment (GTK_MISC(wlabel), 0.0, 0.0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), wlabel); media_select->desc_label = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (whbox1), media_select->desc_label, - FALSE, FALSE, 0); - whbox1 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), media_select->desc_label); + + /* Page size line */ + whbox1 = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox1), whbox1); + wlabel = gtk_label_new (_("Page size:")); + gtk_size_group_add_widget (label_size_group, wlabel); + gtk_misc_set_alignment (GTK_MISC(wlabel), 0.0, 0.0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), wlabel); media_select->sheet_size_label = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (whbox1), media_select->sheet_size_label, - FALSE, FALSE, 0); - whbox1 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), + media_select->sheet_size_label); + + /* Label size line */ + whbox1 = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox1), whbox1); + wlabel = gtk_label_new (_("Label size:")); + gtk_size_group_add_widget (label_size_group, wlabel); + gtk_misc_set_alignment (GTK_MISC(wlabel), 0.0, 0.0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), wlabel); media_select->label_size_label = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (whbox1), media_select->label_size_label, - FALSE, FALSE, 0); - whbox1 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (wvbox1), whbox1, FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), + media_select->label_size_label); + + /* Layout line */ + whbox1 = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox1), whbox1); + wlabel = gtk_label_new (_("Layout:")); + gtk_size_group_add_widget (label_size_group, wlabel); + gtk_misc_set_alignment (GTK_MISC(wlabel), 0.0, 0.0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), wlabel); media_select->number_label = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (whbox1), media_select->number_label, - FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), + media_select->number_label); /* Update mini_preview and details from default template */ diff --git a/glabels2/src/wdgt-media-select.h b/glabels2/src/wdgt-media-select.h index 8d628f43..ffba0005 100644 --- a/glabels2/src/wdgt-media-select.h +++ b/glabels2/src/wdgt-media-select.h @@ -24,6 +24,7 @@ #define __WDGT_MEDIA_SELECT_H__ #include +#include "hig.h" #define GL_TYPE_WDGT_MEDIA_SELECT (gl_wdgt_media_select_get_type ()) #define GL_WDGT_MEDIA_SELECT(obj) \ @@ -39,7 +40,7 @@ typedef struct _glWdgtMediaSelect glWdgtMediaSelect; typedef struct _glWdgtMediaSelectClass glWdgtMediaSelectClass; struct _glWdgtMediaSelect { - GtkVBox parent_widget; + glHigVBox parent_widget; GtkWidget *page_size_entry; GtkWidget *template_combo; @@ -54,7 +55,7 @@ struct _glWdgtMediaSelect { }; struct _glWdgtMediaSelectClass { - GtkVBoxClass parent_class; + glHigVBoxClass parent_class; void (*changed) (glWdgtMediaSelect * media_select, gpointer user_data); }; diff --git a/glabels2/src/wdgt-print-copies.c b/glabels2/src/wdgt-print-copies.c index 3029e70d..0f8fe09b 100644 --- a/glabels2/src/wdgt-print-copies.c +++ b/glabels2/src/wdgt-print-copies.c @@ -82,7 +82,7 @@ gl_wdgt_print_copies_get_type (void) }; wdgt_print_copies_type = - g_type_register_static (gtk_hbox_get_type (), + g_type_register_static (gl_hig_hbox_get_type (), "glWdgtPrintCopies", &wdgt_print_copies_info, 0); } @@ -97,7 +97,7 @@ gl_wdgt_print_copies_class_init (glWdgtPrintCopiesClass * class) object_class = (GObjectClass *) class; - parent_class = gtk_type_class (gtk_hbox_get_type ()); + parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_wdgt_print_copies_finalize; } @@ -147,8 +147,8 @@ gl_wdgt_print_copies_new (glLabel * label) /* Construct composite widget. */ /*--------------------------------------------------------------------------*/ static void -gl_wdgt_print_copies_construct (glWdgtPrintCopies * copies, - glLabel * label) +gl_wdgt_print_copies_construct (glWdgtPrintCopies *copies, + glLabel *label) { GtkWidget *whbox, *wvbox, *whbox1; GSList *radio_group = NULL; @@ -165,53 +165,50 @@ gl_wdgt_print_copies_construct (glWdgtPrintCopies * copies, WDGT_MINI_PREVIEW_WIDTH); gl_wdgt_mini_preview_set_label (GL_WDGT_MINI_PREVIEW(copies->mini_preview), template->name->data); - gtk_box_pack_start (GTK_BOX (whbox), copies->mini_preview, - TRUE, TRUE, GNOME_PAD); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), copies->mini_preview); - wvbox = gtk_vbox_new (FALSE, GNOME_PAD); - gtk_box_pack_start (GTK_BOX (whbox), wvbox, TRUE, TRUE, GNOME_PAD); + wvbox = gl_hig_vbox_new (GL_HIG_VBOX_INNER); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wvbox); /* Sheet controls */ - whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); - gtk_box_pack_start (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); + whbox1 = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox1); copies->sheets_radio = gtk_radio_button_new_with_label (radio_group, _("Sheets:")); - gtk_box_pack_start (GTK_BOX (whbox1), copies->sheets_radio, - FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), copies->sheets_radio); adjust = gtk_adjustment_new (1, 1.0, 10.0, 1.0, 10.0, 10.0); copies->sheets_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0); - gtk_box_pack_start (GTK_BOX (whbox1), copies->sheets_spin, - FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), copies->sheets_spin); gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(copies->mini_preview), - 1, copies->labels_per_sheet); + 1, copies->labels_per_sheet); + + /* Blank line */ + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), gtk_label_new ("")); /* Label controls */ - whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); - gtk_box_pack_start (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); + whbox1 = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox1); radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (copies->sheets_radio)); copies->labels_radio = gtk_radio_button_new_with_label (radio_group, _("Labels")); - gtk_box_pack_start (GTK_BOX (whbox1), copies->labels_radio, - FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (whbox1), gtk_label_new (_("from:")), - FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), copies->labels_radio); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), + gtk_label_new (_("from:"))); adjust = gtk_adjustment_new (1, 1.0, copies->labels_per_sheet, 1.0, 10.0, 10.0); copies->first_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0); - gtk_box_pack_start (GTK_BOX (whbox1), copies->first_spin, - FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (whbox1), gtk_label_new (_("to:")), - FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), copies->first_spin); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), + gtk_label_new (_("to:"))); adjust = gtk_adjustment_new (copies->labels_per_sheet, 1.0, copies->labels_per_sheet, 1.0, 10.0, 10.0); copies->last_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0); - gtk_box_pack_start (GTK_BOX (whbox1), copies->last_spin, - FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), copies->last_spin); gtk_widget_set_sensitive (copies->first_spin, FALSE); gtk_widget_set_sensitive (copies->last_spin, FALSE); diff --git a/glabels2/src/wdgt-print-copies.h b/glabels2/src/wdgt-print-copies.h index 09d0b67a..c0a85daa 100644 --- a/glabels2/src/wdgt-print-copies.h +++ b/glabels2/src/wdgt-print-copies.h @@ -25,6 +25,7 @@ #include #include "label.h" +#include "hig.h" #define GL_TYPE_WDGT_PRINT_COPIES (gl_wdgt_print_copies_get_type ()) #define GL_WDGT_PRINT_COPIES(obj) \ @@ -40,7 +41,7 @@ typedef struct _glWdgtPrintCopies glWdgtPrintCopies; typedef struct _glWdgtPrintCopiesClass glWdgtPrintCopiesClass; struct _glWdgtPrintCopies { - GtkHBox parent_widget; + glHigHBox parent_widget; gint labels_per_sheet; @@ -55,7 +56,7 @@ struct _glWdgtPrintCopies { }; struct _glWdgtPrintCopiesClass { - GtkHBoxClass parent_class; + glHigHBoxClass parent_class; }; extern guint gl_wdgt_print_copies_get_type (void); diff --git a/glabels2/src/wdgt-print-merge.c b/glabels2/src/wdgt-print-merge.c index ea7acadc..e082ecc9 100644 --- a/glabels2/src/wdgt-print-merge.c +++ b/glabels2/src/wdgt-print-merge.c @@ -83,7 +83,7 @@ gl_wdgt_print_merge_get_type (void) }; wdgt_print_merge_type = - g_type_register_static (gtk_hbox_get_type (), + g_type_register_static (gl_hig_hbox_get_type (), "glWdgtPrintMerge", &wdgt_print_merge_info, 0); } @@ -98,7 +98,7 @@ gl_wdgt_print_merge_class_init (glWdgtPrintMergeClass * class) object_class = (GObjectClass *) class; - parent_class = gtk_type_class (gtk_hbox_get_type ()); + parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_wdgt_print_merge_finalize; } @@ -162,52 +162,48 @@ gl_wdgt_print_merge_construct (glWdgtPrintMerge * merge, WDGT_MINI_PREVIEW_WIDTH); gl_wdgt_mini_preview_set_label( GL_WDGT_MINI_PREVIEW (merge->mini_preview), template->name->data ); - gtk_box_pack_start (GTK_BOX (whbox), merge->mini_preview, - TRUE, TRUE, GNOME_PAD); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), merge->mini_preview); gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(merge->mini_preview), 1, 1); - wvbox = gtk_vbox_new (FALSE, GNOME_PAD); - gtk_box_pack_start (GTK_BOX (whbox), wvbox, TRUE, TRUE, GNOME_PAD); + wvbox = gl_hig_vbox_new (GL_HIG_VBOX_INNER); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wvbox); /* First Label controls */ - whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); - gtk_box_pack_start (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); - gtk_box_pack_start (GTK_BOX (whbox1), - gtk_label_new (_("Start on label")), FALSE, FALSE, - 0); + whbox1 = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox1); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), + gtk_label_new (_("Start on label"))); adjust = gtk_adjustment_new (1, 1.0, merge->labels_per_sheet, 1.0, 10.0, 10.0); merge->first_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0); - gtk_box_pack_start (GTK_BOX (whbox1), merge->first_spin, FALSE, FALSE, - 0); - gtk_box_pack_start (GTK_BOX (whbox1), gtk_label_new (_("on 1st sheet")), - FALSE, FALSE, 0); - - /* Collate controls */ - whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); - gtk_box_pack_end (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); - pixbuf = gdk_pixbuf_new_from_xpm_data ( (const char **)nocollate_xpm); - merge->collate_image = gtk_image_new_from_pixbuf(pixbuf); - - gtk_box_pack_start (GTK_BOX (whbox1), merge->collate_image, - FALSE, FALSE, 0); - merge->collate_check = gtk_check_button_new_with_label (_("Collate")); - gtk_box_pack_start (GTK_BOX (whbox1), merge->collate_check, - FALSE, FALSE, 0); - - /* Copy controls */ - whbox1 = gtk_hbox_new (FALSE, GNOME_PAD); - gtk_box_pack_end (GTK_BOX (wvbox), whbox1, FALSE, FALSE, GNOME_PAD); - gtk_box_pack_start (GTK_BOX (whbox1), gtk_label_new (_("Copies:")), - FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), merge->first_spin); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), + gtk_label_new (_("on 1st sheet"))); + + /* Blank line */ + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), gtk_label_new ("")); + + /* Copy & collate controls*/ + whbox1 = gl_hig_hbox_new (); + gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox1); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), + gtk_label_new (_("Copies:"))); adjust = gtk_adjustment_new (1, 1.0, 10.0, 1.0, 10.0, 10.0); merge->copies_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0); - gtk_box_pack_start (GTK_BOX (whbox1), merge->copies_spin, - FALSE, FALSE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), merge->copies_spin); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), gtk_label_new (" ")); + merge->collate_check = gtk_check_button_new_with_label (_("Collate")); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), merge->collate_check); + pixbuf = gdk_pixbuf_new_from_xpm_data ( (const char **)nocollate_xpm); + merge->collate_image = gtk_image_new_from_pixbuf(pixbuf); + gtk_widget_set_sensitive (merge->collate_check, FALSE); + gtk_widget_set_sensitive (merge->collate_image, FALSE); + + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), merge->collate_image); /* Connect signals to controls */ g_signal_connect (G_OBJECT (merge->mini_preview), "clicked", @@ -265,6 +261,9 @@ spin_cb (GtkSpinButton * spinbutton, last = first + (n_copies * merge->n_records) - 1; gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(merge->mini_preview), first, last ); + + gtk_widget_set_sensitive (merge->collate_check, (n_copies > 1)); + gtk_widget_set_sensitive (merge->collate_image, (n_copies > 1)); } /*--------------------------------------------------------------------------*/ diff --git a/glabels2/src/wdgt-print-merge.h b/glabels2/src/wdgt-print-merge.h index 186a339a..dbe8cba9 100644 --- a/glabels2/src/wdgt-print-merge.h +++ b/glabels2/src/wdgt-print-merge.h @@ -25,6 +25,7 @@ #include #include "label.h" +#include "hig.h" #define GL_TYPE_WDGT_PRINT_MERGE (gl_wdgt_print_merge_get_type ()) #define GL_WDGT_PRINT_MERGE(obj) \ @@ -40,7 +41,7 @@ typedef struct _glWdgtPrintMerge glWdgtPrintMerge; typedef struct _glWdgtPrintMergeClass glWdgtPrintMergeClass; struct _glWdgtPrintMerge { - GtkHBox parent_widget; + glHigHBox parent_widget; gint labels_per_sheet; GtkWidget *mini_preview; @@ -54,7 +55,7 @@ struct _glWdgtPrintMerge { }; struct _glWdgtPrintMergeClass { - GtkHBoxClass parent_class; + glHigHBoxClass parent_class; }; extern guint gl_wdgt_print_merge_get_type (void); diff --git a/glabels2/src/wdgt-rotate-label.c b/glabels2/src/wdgt-rotate-label.c index 5e22ff44..d1a04d60 100644 --- a/glabels2/src/wdgt-rotate-label.c +++ b/glabels2/src/wdgt-rotate-label.c @@ -26,11 +26,20 @@ #include "hig.h" #include "template.h" #include "marshal.h" +#include "color.h" #include "debug.h" +/*========================================================*/ +/* Private macros and constants. */ +/*========================================================*/ #define MINI_PREVIEW_MAX_PIXELS 48 +#define LINE_COLOR GL_COLOR(0,0,0) +#define FILL_COLOR GL_COLOR(255,255,255) +#define UNSENSITIVE_LINE_COLOR GL_COLOR(0x66,0x66,0x66) +#define UNSENSITIVE_FILL_COLOR GL_COLOR(0xCC,0xCC,0xCC) + /*===========================================*/ /* Private types */ /*===========================================*/ @@ -92,7 +101,7 @@ gl_wdgt_rotate_label_get_type (void) }; wdgt_rotate_label_type = - g_type_register_static (gtk_hbox_get_type (), + g_type_register_static (gl_hig_hbox_get_type (), "glWdgtRotateLabel", &wdgt_rotate_label_info, 0); } @@ -107,7 +116,7 @@ gl_wdgt_rotate_label_class_init (glWdgtRotateLabelClass * class) object_class = (GObjectClass *) class; - parent_class = gtk_type_class (gtk_hbox_get_type ()); + parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_wdgt_rotate_label_finalize; @@ -167,18 +176,16 @@ gl_wdgt_rotate_label_construct (glWdgtRotateLabel * rotate_select) GtkWidget *whbox; whbox = GTK_WIDGET (rotate_select); - gtk_box_set_spacing (GTK_BOX(whbox), GL_HIG_SPACING); /* Actual selection control */ rotate_select->rotate_check = gtk_check_button_new_with_label (_("Rotate")); - gtk_box_pack_start (GTK_BOX (whbox), rotate_select->rotate_check, TRUE, - TRUE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), + rotate_select->rotate_check); /* mini_preview canvas */ rotate_select->canvas = mini_preview_canvas_new (); - gtk_box_pack_start (GTK_BOX (whbox), rotate_select->canvas, - TRUE, TRUE, 0); + gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), rotate_select->canvas); /* Connect signals to controls */ g_signal_connect (G_OBJECT (rotate_select->rotate_check), "toggled", @@ -243,6 +250,7 @@ mini_preview_canvas_update (GnomeCanvas * canvas, GnomeCanvasGroup *group = NULL; GnomeCanvasItem *label_item = NULL; gdouble m, raw_w, raw_h, w, h; + guint line_color, fill_color; /* Fetch our data from canvas */ label_item = g_object_get_data (G_OBJECT (canvas), "label_item"); @@ -268,6 +276,15 @@ mini_preview_canvas_update (GnomeCanvas * canvas, gtk_object_destroy (GTK_OBJECT (label_item)); } + /* Adjust sensitivity (should the canvas be grayed?) */ + if (raw_w != raw_h) { + line_color = LINE_COLOR; + fill_color = FILL_COLOR; + } else { + line_color = UNSENSITIVE_LINE_COLOR; + fill_color = UNSENSITIVE_FILL_COLOR; + } + /* draw mini label outline */ if (!rotate_flag) { w = raw_w; @@ -285,8 +302,8 @@ mini_preview_canvas_update (GnomeCanvas * canvas, "x2", +w / 2.0, "y2", +h / 2.0, "width_pixels", 1, - "outline_color", "black", - "fill_color", "white", + "outline_color_rgba", line_color, + "fill_color_rgba", fill_color, NULL); break; case GL_TEMPLATE_STYLE_ROUND: @@ -298,8 +315,8 @@ mini_preview_canvas_update (GnomeCanvas * canvas, "x2", +w / 2.0, "y2", +h / 2.0, "width_pixels", 2, - "outline_color", "black", - "fill_color", "white", + "outline_color_rgba", line_color, + "fill_color_rgba", fill_color, NULL); break; default: @@ -347,11 +364,8 @@ gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel * rotate_select, rotate_select->template = template; gl_template_get_label_size (template, &raw_w, &raw_h); - if (raw_w != raw_h) { - gtk_widget_set_sensitive (rotate_select->rotate_check, TRUE); - } else { - gtk_widget_set_sensitive (rotate_select->rotate_check, FALSE); - } + gtk_widget_set_sensitive (rotate_select->rotate_check, + (raw_w != raw_h)); mini_preview_canvas_update (GNOME_CANVAS (rotate_select->canvas), template, FALSE); diff --git a/glabels2/src/wdgt-rotate-label.h b/glabels2/src/wdgt-rotate-label.h index e971276c..eb318f21 100644 --- a/glabels2/src/wdgt-rotate-label.h +++ b/glabels2/src/wdgt-rotate-label.h @@ -24,6 +24,7 @@ #define __WDGT_ROTATE_LABEL_H__ #include +#include "hig.h" #include "template.h" #define GL_TYPE_WDGT_ROTATE_LABEL (gl_wdgt_rotate_label_get_type ()) @@ -40,7 +41,7 @@ typedef struct _glWdgtRotateLabel glWdgtRotateLabel; typedef struct _glWdgtRotateLabelClass glWdgtRotateLabelClass; struct _glWdgtRotateLabel { - GtkHBox parent_widget; + glHigHBox parent_widget; GtkWidget *rotate_check; @@ -50,7 +51,7 @@ struct _glWdgtRotateLabel { }; struct _glWdgtRotateLabelClass { - GtkHBoxClass parent_class; + glHigHBoxClass parent_class; void (*changed) (glWdgtRotateLabel * wdgt_rotate_label, gpointer user_data); -- 2.39.5