From 0dc8ff1f3ef7c7659bc25f59d9a3e364d9214746 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Sat, 18 Oct 2008 15:02:40 +0000 Subject: [PATCH] 2008-10-18 Jim Evins Migrated all use of libglade to GtkBuilder. * data/glade/Makefile.am: * data/glade/merge-properties-dialog.glade: * data/glade/new-label-dialog.glade: * data/glade/object-editor.glade: * data/glade/prefs-dialog.glade: * data/glade/print-custom-widget.glade: * data/glade/property-bar.glade: * data/glade/template-designer.glade: * data/glade/wdgt-media-select.glade: Removed data/glade directory. * data/builder/Makefile.am: * data/builder/merge-properties-dialog.glade: * data/builder/new-label-dialog.glade: * data/builder/object-editor.glade: * data/builder/prefs-dialog.glade: * data/builder/print-custom-widget.glade: * data/builder/property-bar.glade: * data/builder/template-designer.glade: * data/builder/wdgt-media-select.glade: Added data/builder directory. * configure.in: * data/Makefile.am: * src/Makefile.am: Change glade to builder. * src/merge-properties-dialog.c: (gl_merge_properties_dialog_finalize), (gl_merge_properties_dialog_construct): * src/new-label-dialog.c: (gl_new_label_dialog_finalize), (gl_new_label_dialog_construct): * src/object-editor-bc-page.c: (gl_object_editor_prepare_bc_page): * src/object-editor-data-page.c: (gl_object_editor_prepare_data_page): * src/object-editor-edit-page.c: (gl_object_editor_prepare_edit_page): * src/object-editor-fill-page.c: (gl_object_editor_prepare_fill_page): * src/object-editor-image-page.c: (gl_object_editor_prepare_image_page): * src/object-editor-line-page.c: (gl_object_editor_prepare_line_page): * src/object-editor-lsize-page.c: (gl_object_editor_prepare_lsize_page): * src/object-editor-position-page.c: (gl_object_editor_prepare_position_page): * src/object-editor-private.h: * src/object-editor-shadow-page.c: (gl_object_editor_prepare_shadow_page): * src/object-editor-size-page.c: (gl_object_editor_prepare_size_page): * src/object-editor-text-page.c: (gl_object_editor_prepare_text_page): * src/object-editor.c: (gl_object_editor_init): * src/prefs-dialog.c: (gl_prefs_dialog_init), (gl_prefs_dialog_construct), (construct_locale_page), (construct_object_page): * src/print-op.c: (gl_print_op_finalize), (create_custom_widget_cb): * src/template-designer.c: (gl_template_designer_class_init), (gl_template_designer_finalize), (gl_template_designer_construct), (construct_start_page), (construct_name_page), (construct_pg_size_page), (construct_shape_page), (construct_rect_size_page), (construct_round_size_page), (construct_cd_size_page), (construct_nlayouts_page), (construct_layout_page), (construct_finish_page): * src/template-designer.h: * src/ui-property-bar.c: (gl_ui_property_bar_init), (gl_ui_property_bar_finalize), (gl_ui_property_bar_new), (gl_ui_property_bar_construct), (reset_to_default_properties), (gl_ui_property_bar_set_view), (gl_ui_property_bar_set_tooltips), (update_text_properties), (update_fill_color), (update_line_color), (update_line_width), (selection_changed_cb), (font_family_changed_cb), (font_size_changed_cb), (text_color_changed_cb), (fill_color_changed_cb), (line_color_changed_cb), (line_width_changed_cb), (font_bold_toggled_cb), (font_italic_toggled_cb), (text_align_toggled_cb), (set_doc_items_sensitive), (set_text_items_sensitive), (set_fill_items_sensitive), (set_line_color_items_sensitive), (set_line_width_items_sensitive): * src/ui-property-bar.h: * src/util.c: (gl_util_get_builder_widgets): * src/util.h: * src/wdgt-media-select.c: (gl_wdgt_media_select_finalize), (gl_wdgt_media_select_construct): Migration of glade to builder. * src/color.h: New macros for color combo initialization. * TODO: Added idea for internal merge database. * docs/libglabels/libglabels-undocumented.txt: * docs/libglabels/tmpl/paper.sgml: * gtk-doc.make: Automagic. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@785 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/ChangeLog | 97 +++ glabels2/TODO | 3 +- glabels2/configure.in | 8 +- glabels2/data/Makefile.am | 2 +- glabels2/data/builder/Makefile.am | 79 +++ .../merge-properties-dialog.glade | 0 .../{glade => builder}/new-label-dialog.glade | 0 .../{glade => builder}/object-editor.glade | 92 +-- .../{glade => builder}/prefs-dialog.glade | 46 +- .../print-custom-widget.glade | 0 .../{glade => builder}/property-bar.glade | 34 +- .../template-designer.glade | 12 +- .../wdgt-media-select.glade | 0 glabels2/data/glade/Makefile.am | 17 - .../libglabels/libglabels-undocumented.txt | 3 +- glabels2/docs/libglabels/tmpl/paper.sgml | 2 + glabels2/gtk-doc.make | 40 +- glabels2/src/Makefile.am | 2 +- glabels2/src/color.h | 6 + glabels2/src/merge-properties-dialog.c | 42 +- glabels2/src/new-label-dialog.c | 48 +- glabels2/src/object-editor-bc-page.c | 45 +- glabels2/src/object-editor-data-page.c | 17 +- glabels2/src/object-editor-edit-page.c | 11 +- glabels2/src/object-editor-fill-page.c | 25 +- glabels2/src/object-editor-image-page.c | 17 +- glabels2/src/object-editor-line-page.c | 27 +- glabels2/src/object-editor-lsize-page.c | 14 +- glabels2/src/object-editor-position-page.c | 17 +- glabels2/src/object-editor-private.h | 10 +- glabels2/src/object-editor-shadow-page.c | 45 +- glabels2/src/object-editor-size-page.c | 31 +- glabels2/src/object-editor-text-page.c | 53 +- glabels2/src/object-editor.c | 95 +-- glabels2/src/prefs-dialog.c | 105 +-- glabels2/src/print-op.c | 46 +- glabels2/src/template-designer.c | 505 ++++++++------ glabels2/src/template-designer.h | 7 - glabels2/src/ui-property-bar.c | 627 +++++++++--------- glabels2/src/ui-property-bar.h | 6 +- glabels2/src/util.c | 32 + glabels2/src/util.h | 7 +- glabels2/src/wdgt-media-select.c | 64 +- 43 files changed, 1279 insertions(+), 1060 deletions(-) create mode 100644 glabels2/data/builder/Makefile.am rename glabels2/data/{glade => builder}/merge-properties-dialog.glade (100%) rename glabels2/data/{glade => builder}/new-label-dialog.glade (100%) rename glabels2/data/{glade => builder}/object-editor.glade (97%) rename glabels2/data/{glade => builder}/prefs-dialog.glade (96%) rename glabels2/data/{glade => builder}/print-custom-widget.glade (100%) rename glabels2/data/{glade => builder}/property-bar.glade (89%) rename glabels2/data/{glade => builder}/template-designer.glade (99%) rename glabels2/data/{glade => builder}/wdgt-media-select.glade (100%) delete mode 100644 glabels2/data/glade/Makefile.am diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index c4749fd1..35f2e72a 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,100 @@ +2008-10-18 Jim Evins + + Migrated all use of libglade to GtkBuilder. + + * data/glade/Makefile.am: + * data/glade/merge-properties-dialog.glade: + * data/glade/new-label-dialog.glade: + * data/glade/object-editor.glade: + * data/glade/prefs-dialog.glade: + * data/glade/print-custom-widget.glade: + * data/glade/property-bar.glade: + * data/glade/template-designer.glade: + * data/glade/wdgt-media-select.glade: + Removed data/glade directory. + * data/builder/Makefile.am: + * data/builder/merge-properties-dialog.glade: + * data/builder/new-label-dialog.glade: + * data/builder/object-editor.glade: + * data/builder/prefs-dialog.glade: + * data/builder/print-custom-widget.glade: + * data/builder/property-bar.glade: + * data/builder/template-designer.glade: + * data/builder/wdgt-media-select.glade: + Added data/builder directory. + * configure.in: + * data/Makefile.am: + * src/Makefile.am: + Change glade to builder. + * src/merge-properties-dialog.c: + (gl_merge_properties_dialog_finalize), + (gl_merge_properties_dialog_construct): + * src/new-label-dialog.c: (gl_new_label_dialog_finalize), + (gl_new_label_dialog_construct): + * src/object-editor-bc-page.c: (gl_object_editor_prepare_bc_page): + * src/object-editor-data-page.c: + (gl_object_editor_prepare_data_page): + * src/object-editor-edit-page.c: + (gl_object_editor_prepare_edit_page): + * src/object-editor-fill-page.c: + (gl_object_editor_prepare_fill_page): + * src/object-editor-image-page.c: + (gl_object_editor_prepare_image_page): + * src/object-editor-line-page.c: + (gl_object_editor_prepare_line_page): + * src/object-editor-lsize-page.c: + (gl_object_editor_prepare_lsize_page): + * src/object-editor-position-page.c: + (gl_object_editor_prepare_position_page): + * src/object-editor-private.h: + * src/object-editor-shadow-page.c: + (gl_object_editor_prepare_shadow_page): + * src/object-editor-size-page.c: + (gl_object_editor_prepare_size_page): + * src/object-editor-text-page.c: + (gl_object_editor_prepare_text_page): + * src/object-editor.c: (gl_object_editor_init): + * src/prefs-dialog.c: (gl_prefs_dialog_init), + (gl_prefs_dialog_construct), (construct_locale_page), + (construct_object_page): + * src/print-op.c: (gl_print_op_finalize), + (create_custom_widget_cb): + * src/template-designer.c: (gl_template_designer_class_init), + (gl_template_designer_finalize), (gl_template_designer_construct), + (construct_start_page), (construct_name_page), + (construct_pg_size_page), (construct_shape_page), + (construct_rect_size_page), (construct_round_size_page), + (construct_cd_size_page), (construct_nlayouts_page), + (construct_layout_page), (construct_finish_page): + * src/template-designer.h: + * src/ui-property-bar.c: (gl_ui_property_bar_init), + (gl_ui_property_bar_finalize), (gl_ui_property_bar_new), + (gl_ui_property_bar_construct), (reset_to_default_properties), + (gl_ui_property_bar_set_view), (gl_ui_property_bar_set_tooltips), + (update_text_properties), (update_fill_color), (update_line_color), + (update_line_width), (selection_changed_cb), + (font_family_changed_cb), (font_size_changed_cb), + (text_color_changed_cb), (fill_color_changed_cb), + (line_color_changed_cb), (line_width_changed_cb), + (font_bold_toggled_cb), (font_italic_toggled_cb), + (text_align_toggled_cb), (set_doc_items_sensitive), + (set_text_items_sensitive), (set_fill_items_sensitive), + (set_line_color_items_sensitive), (set_line_width_items_sensitive): + * src/ui-property-bar.h: + * src/util.c: (gl_util_get_builder_widgets): + * src/util.h: + * src/wdgt-media-select.c: (gl_wdgt_media_select_finalize), + (gl_wdgt_media_select_construct): + Migration of glade to builder. + * src/color.h: + New macros for color combo initialization. + * TODO: + Added idea for internal merge database. + * docs/libglabels/libglabels-undocumented.txt: + * docs/libglabels/tmpl/paper.sgml: + * gtk-doc.make: + Automagic. + 2008-10-12 Jim Evins * src/mygal/Makefile.am: diff --git a/glabels2/TODO b/glabels2/TODO index ed3140cc..e5d4bfeb 100644 --- a/glabels2/TODO +++ b/glabels2/TODO @@ -24,9 +24,10 @@ Possible Goals for 2.3.x (current development branch): - Ability to select/unselect individual records during a merge-print. - Add additional "merge" backends. Candidates include: + gnome-db + internal database stored in glabels file generic XML freedb (CDDB) for CD labels - gnome-db ADIF for generating QSL-cards - Printer calibration tool: a facility for tweaking output origin and diff --git a/glabels2/configure.in b/glabels2/configure.in index 24efed30..8659fb05 100644 --- a/glabels2/configure.in +++ b/glabels2/configure.in @@ -21,6 +21,7 @@ AC_HEADER_STDC GNOME_COMPILE_WARNINGS AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) +AC_PATH_PROG(GTK_BUILDER_CONVERT, gtk-builder-convert) GTK_DOC_CHECK(1.0) @@ -55,7 +56,6 @@ GTK_REQUIRED=2.10.0 LIBGNOME_REQUIRED=2.16.0 LIBGNOMEUI_REQUIRED=2.16.0 LIBXML_REQUIRED=2.6.0 -LIBGLADE_REQUIRED=2.6.0 LIBEBOOK_REQUIRED=1.8.0 dnl Make above strings available for packaging files (e.g. rpm spec files) @@ -64,7 +64,6 @@ AC_SUBST(GTK_REQUIRED) AC_SUBST(LIBGNOME_REQUIRED) AC_SUBST(LIBGNOMEUI_REQUIRED) AC_SUBST(LIBXML_REQUIRED) -AC_SUBST(LIBGLADE_REQUIRED) AC_SUBST(LIBEBOOK_REQUIRED) @@ -95,7 +94,6 @@ gtk+-2.0 >= $GTK_REQUIRED \ libgnome-2.0 >= $LIBGNOME_REQUIRED \ libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED \ libxml-2.0 >= $LIBXML_REQUIRED \ -libglade-2.0 >= $LIBGLADE_REQUIRED \ $OPTIONAL_MODULES \ ) @@ -130,7 +128,7 @@ if test "x$enable_deprecations" = "xyes"; then -DGTK_DISABLE_DEPRECATED \ -DGDK_PIXBUF_DISABLE_DEPRECATED \ -DGNOME_DISABLE_DEPRECATED \ --DLIBGLADE_DISABLE_DEPRECATED" +" AC_SUBST(DISABLE_DEPRECATED_CFLAGS) fi @@ -183,7 +181,7 @@ data/Makefile data/templates/Makefile data/pixmaps/Makefile data/mime/Makefile -data/glade/Makefile +data/builder/Makefile data/desktop/Makefile data/dtd/Makefile data/man/Makefile diff --git a/glabels2/data/Makefile.am b/glabels2/data/Makefile.am index 6b00c464..73fe9505 100644 --- a/glabels2/data/Makefile.am +++ b/glabels2/data/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = desktop dtd glade man mime pixmaps templates +SUBDIRS = desktop dtd builder man mime pixmaps templates diff --git a/glabels2/data/builder/Makefile.am b/glabels2/data/builder/Makefile.am new file mode 100644 index 00000000..011b77e4 --- /dev/null +++ b/glabels2/data/builder/Makefile.am @@ -0,0 +1,79 @@ +## Process this file with automake to produce Makefile.in + +builderdir = $(datadir)/glabels/builder/ + +builder_DATA = \ + property-bar.builder \ + print-custom-widget.builder \ + wdgt-media-select.builder \ + merge-properties-dialog.builder \ + new-label-dialog.builder \ + template-designer-start-page.builder \ + template-designer-name-page.builder \ + template-designer-pg-size-page.builder \ + template-designer-shape-page.builder \ + template-designer-rect-size-page.builder \ + template-designer-round-size-page.builder \ + template-designer-cd-size-page.builder \ + template-designer-nlayouts-page.builder \ + template-designer-layout-page.builder \ + template-designer-finish-page.builder \ + prefs-dialog.builder \ + object-editor.builder + + +EXTRA_DIST = \ + object-editor.glade \ + prefs-dialog.glade \ + template-designer.glade \ + merge-properties-dialog.glade \ + property-bar.glade \ + print-custom-widget.glade \ + wdgt-media-select.glade \ + new-label-dialog.glade + +CLEANFILES = $(builder_DATA) + + +property-bar.builder: property-bar.glade + $(GTK_BUILDER_CONVERT) --root property_toolbar $< $@ + +print-custom-widget.builder: print-custom-widget.glade + $(GTK_BUILDER_CONVERT) --root print_custom_widget_vbox $< $@ + +wdgt-media-select.builder: wdgt-media-select.glade + $(GTK_BUILDER_CONVERT) --root wdgt_media_select_hbox $< $@ + +merge-properties-dialog.builder: merge-properties-dialog.glade + $(GTK_BUILDER_CONVERT) --root merge_properties_vbox $< $@ + +new-label-dialog.builder: new-label-dialog.glade + $(GTK_BUILDER_CONVERT) --root new_label_dialog_vbox $< $@ + +prefs-dialog.builder: prefs-dialog.glade + $(GTK_BUILDER_CONVERT) --root prefs_notebook $< $@ + +object-editor.builder: object-editor.glade + $(GTK_BUILDER_CONVERT) --root editor_vbox $< $@ + +template-designer-start-page.builder: template-designer.glade + $(GTK_BUILDER_CONVERT) --root start_page $< $@ +template-designer-name-page.builder: template-designer.glade + $(GTK_BUILDER_CONVERT) --root name_page $< $@ +template-designer-pg-size-page.builder: template-designer.glade + $(GTK_BUILDER_CONVERT) --root pg_size_page $< $@ +template-designer-shape-page.builder: template-designer.glade + $(GTK_BUILDER_CONVERT) --root shape_page $< $@ +template-designer-rect-size-page.builder: template-designer.glade + $(GTK_BUILDER_CONVERT) --root rect_size_page $< $@ +template-designer-round-size-page.builder: template-designer.glade + $(GTK_BUILDER_CONVERT) --root round_size_page $< $@ +template-designer-cd-size-page.builder: template-designer.glade + $(GTK_BUILDER_CONVERT) --root cd_size_page $< $@ +template-designer-nlayouts-page.builder: template-designer.glade + $(GTK_BUILDER_CONVERT) --root nlayouts_page $< $@ +template-designer-layout-page.builder: template-designer.glade + $(GTK_BUILDER_CONVERT) --root layout_page $< $@ +template-designer-finish-page.builder: template-designer.glade + $(GTK_BUILDER_CONVERT) --root finish_page $< $@ + diff --git a/glabels2/data/glade/merge-properties-dialog.glade b/glabels2/data/builder/merge-properties-dialog.glade similarity index 100% rename from glabels2/data/glade/merge-properties-dialog.glade rename to glabels2/data/builder/merge-properties-dialog.glade diff --git a/glabels2/data/glade/new-label-dialog.glade b/glabels2/data/builder/new-label-dialog.glade similarity index 100% rename from glabels2/data/glade/new-label-dialog.glade rename to glabels2/data/builder/new-label-dialog.glade diff --git a/glabels2/data/glade/object-editor.glade b/glabels2/data/builder/object-editor.glade similarity index 97% rename from glabels2/data/glade/object-editor.glade rename to glabels2/data/builder/object-editor.glade index 66b20010..a0b0bc19 100644 --- a/glabels2/data/glade/object-editor.glade +++ b/glabels2/data/builder/object-editor.glade @@ -537,24 +537,13 @@ - + True False 12 - - True - gl_object_editor_construct_color_combo - 2 - 0 - Sun, 16 Nov 2003 06:52:23 GMT - - - 0 - False - False - + @@ -1062,24 +1051,13 @@ - + True False 12 - - True - gl_object_editor_construct_color_combo - 1 - 0 - Sun, 16 Nov 2003 06:52:23 GMT - - - 0 - False - False - + @@ -1268,24 +1246,13 @@ - + True False 12 - - True - gl_object_editor_construct_color_combo - 0 - 0 - Sun, 16 Nov 2003 06:52:23 GMT - - - 0 - False - False - + @@ -2001,24 +1968,13 @@ - + True False 12 - - True - gl_object_editor_construct_color_combo - 1 - 0 - Sun, 16 Nov 2003 06:52:23 GMT - - - 0 - False - False - + @@ -2362,19 +2318,20 @@ - + True - gl_object_editor_construct_chain_button - 0 - 0 - Sat, 07 Feb 2004 02:56:47 GMT + False + 0 + + + + 2 3 0 2 - fill @@ -3136,30 +3093,19 @@ - + True False 12 - - True - gl_object_editor_construct_color_combo - 3 - 0 - Sun, 16 Nov 2003 06:52:23 GMT - - - 0 - False - False - + 0 - True - True + False + False diff --git a/glabels2/data/glade/prefs-dialog.glade b/glabels2/data/builder/prefs-dialog.glade similarity index 96% rename from glabels2/data/glade/prefs-dialog.glade rename to glabels2/data/builder/prefs-dialog.glade index 24562d8a..886febf1 100644 --- a/glabels2/data/glade/prefs-dialog.glade +++ b/glabels2/data/builder/prefs-dialog.glade @@ -17,6 +17,7 @@ GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST True + False True @@ -684,24 +685,13 @@ - + True False 12 - - True - gl_object_editor_construct_color_combo - 2 - 0 - Sun, 23 Nov 2003 15:42:02 GMT - - - 0 - False - False - + @@ -1052,24 +1042,13 @@ - + True False 12 - - True - gl_object_editor_construct_color_combo - 1 - 0 - Sun, 23 Nov 2003 15:42:41 GMT - - - 0 - False - False - + @@ -1198,24 +1177,13 @@ - + True False 12 - - True - gl_object_editor_construct_color_combo - 0 - 0 - Sun, 23 Nov 2003 15:43:12 GMT - - - 0 - False - False - + diff --git a/glabels2/data/glade/print-custom-widget.glade b/glabels2/data/builder/print-custom-widget.glade similarity index 100% rename from glabels2/data/glade/print-custom-widget.glade rename to glabels2/data/builder/print-custom-widget.glade diff --git a/glabels2/data/glade/property-bar.glade b/glabels2/data/builder/property-bar.glade similarity index 89% rename from glabels2/data/glade/property-bar.glade rename to glabels2/data/builder/property-bar.glade index 6ba9b341..356ade7b 100644 --- a/glabels2/data/glade/property-bar.glade +++ b/glabels2/data/builder/property-bar.glade @@ -17,6 +17,7 @@ GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST True + False @@ -237,21 +238,14 @@ False - + True Text Color True False - - True - Text color - gl_ui_property_bar_construct_color_combo - 0 - 0 - Sun, 01 May 2005 15:21:11 GMT - + @@ -270,21 +264,14 @@ False - + True Fill color True False - - True - Fill color - gl_ui_property_bar_construct_color_combo - 1 - 0 - Sun, 01 May 2005 15:21:18 GMT - + @@ -303,21 +290,14 @@ False - + True Line color True False - - True - Line color - gl_ui_property_bar_construct_color_combo - 2 - 0 - Sun, 01 May 2005 15:21:24 GMT - + diff --git a/glabels2/data/glade/template-designer.glade b/glabels2/data/builder/template-designer.glade similarity index 99% rename from glabels2/data/glade/template-designer.glade rename to glabels2/data/builder/template-designer.glade index d21d3898..9b944d65 100644 --- a/glabels2/data/glade/template-designer.glade +++ b/glabels2/data/builder/template-designer.glade @@ -3305,12 +3305,14 @@ two layouts. 6 - + True - gl_template_designer_construct_mini_preview - 175 - 200 - Mon, 29 Dec 2003 21:27:10 GMT + False + 0 + + + + 0 diff --git a/glabels2/data/glade/wdgt-media-select.glade b/glabels2/data/builder/wdgt-media-select.glade similarity index 100% rename from glabels2/data/glade/wdgt-media-select.glade rename to glabels2/data/builder/wdgt-media-select.glade diff --git a/glabels2/data/glade/Makefile.am b/glabels2/data/glade/Makefile.am deleted file mode 100644 index fdccb1cb..00000000 --- a/glabels2/data/glade/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -## Process this file with automake to produce Makefile.in - -gladedir = $(datadir)/glabels/glade/ - -glade_DATA = \ - object-editor.glade \ - prefs-dialog.glade \ - template-designer.glade \ - merge-properties-dialog.glade \ - property-bar.glade \ - print-custom-widget.glade \ - wdgt-media-select.glade \ - new-label-dialog.glade - -EXTRA_DIST = $(glade_DATA) - - diff --git a/glabels2/docs/libglabels/libglabels-undocumented.txt b/glabels2/docs/libglabels/libglabels-undocumented.txt index d4b8b2f7..0c4f3ab3 100644 --- a/glabels2/docs/libglabels/libglabels-undocumented.txt +++ b/glabels2/docs/libglabels/libglabels-undocumented.txt @@ -1,9 +1,10 @@ 99% symbol docs coverage. 141 symbols documented. -0 symbols incomplete. +1 symbols incomplete. 1 not documented. LGL_XML_NAME_SPACE +lglPaper (pwg_size) diff --git a/glabels2/docs/libglabels/tmpl/paper.sgml b/glabels2/docs/libglabels/tmpl/paper.sgml index d08f8729..fab9ee67 100644 --- a/glabels2/docs/libglabels/tmpl/paper.sgml +++ b/glabels2/docs/libglabels/tmpl/paper.sgml @@ -27,6 +27,7 @@ This structure defines a paper (page) size. @name: Localized paper size name. @width: Width of paper in points. @height: Height of paper in points. +@pwg_size: @@ -37,6 +38,7 @@ This structure defines a paper (page) size. @name: @width: @height: +@pwg_size: @Returns: diff --git a/glabels2/gtk-doc.make b/glabels2/gtk-doc.make index eeb23b49..6a30ea1d 100644 --- a/glabels2/gtk-doc.make +++ b/glabels2/gtk-doc.make @@ -38,7 +38,12 @@ SCANOBJ_FILES = \ $(DOC_MODULE).prerequisites \ $(DOC_MODULE).signals -CLEANFILES = $(SCANOBJ_FILES) $(DOC_MODULE)-unused.txt $(DOC_STAMPS) +REPORT_FILES = \ + $(DOC_MODULE)-undocumented.txt \ + $(DOC_MODULE)-undeclared.txt \ + $(DOC_MODULE)-unused.txt + +CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) if ENABLE_GTK_DOC all-local: html-build.stamp @@ -53,6 +58,8 @@ docs: html-build.stamp scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) @echo 'gtk-doc: Scanning header files' @-chmod -R u+w $(srcdir) + cd $(srcdir) && \ + gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES) if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ else \ @@ -61,11 +68,9 @@ scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) test -f $$i || touch $$i ; \ done \ fi - cd $(srcdir) && \ - gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES) touch scan-build.stamp -$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp +$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp @true #### templates #### @@ -79,6 +84,10 @@ tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections tmpl.stamp: tmpl-build.stamp @true +tmpl/*.sgml: + @true + + #### xml #### sgml-build.stamp: tmpl.stamp $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) @@ -96,11 +105,11 @@ sgml.stamp: sgml-build.stamp html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) @echo 'gtk-doc: Building HTML' @-chmod -R u+w $(srcdir) - rm -rf $(srcdir)/html + rm -rf $(srcdir)/html mkdir $(srcdir)/html cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) - @echo 'gtk-doc: Fixing cross-references' + @echo 'gtk-doc: Fixing cross-references' cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) touch html-build.stamp @@ -110,8 +119,13 @@ clean-local: rm -f *~ *.bak rm -rf .libs +distclean-local: + cd $(srcdir) && \ + rm -rf xml $(REPORT_FILES) \ + $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt + maintainer-clean-local: clean - cd $(srcdir) && rm -rf xml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt + cd $(srcdir) && rm -rf xml html install-data-local: installfiles=`echo $(srcdir)/html/*`; \ @@ -125,7 +139,10 @@ install-data-local: done; \ echo '-- Installing $(srcdir)/html/index.sgml' ; \ $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR) || :; \ + (which gtkdoc-rebase >& /dev/null && \ + gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR)) || : ; \ fi + uninstall-local: rm -f $(DESTDIR)$(TARGET_DIR)/* @@ -147,9 +164,10 @@ dist-hook: dist-check-gtkdoc dist-hook-local mkdir $(distdir)/html -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl -cp $(srcdir)/xml/*.xml $(distdir)/xml - -cp $(srcdir)/html/* $(distdir)/html - if test -f $(srcdir)/$(DOC_MODULE).types; then \ - cp $(srcdir)/$(DOC_MODULE).types $(distdir)/$(DOC_MODULE).types; \ - fi + cp $(srcdir)/html/* $(distdir)/html + cp $(srcdir)/$(DOC_MODULE).types $(distdir)/ + cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/ + cd $(distdir) && rm -f $(DISTCLEANFILES) + -gtkdoc-rebase --online --relative --html-dir=$(distdir)/html .PHONY : dist-hook-local docs diff --git a/glabels2/src/Makefile.am b/glabels2/src/Makefile.am index e866d5f6..82db2baf 100644 --- a/glabels2/src/Makefile.am +++ b/glabels2/src/Makefile.am @@ -17,7 +17,7 @@ INCLUDES = \ -DDATADIR=\""$(datadir)"\" \ -DLIBDIR=\""$(libdir)"\" \ -DGLABELS_LOCALEDIR=\""$(datadir)/locale"\" \ - -DGLABELS_GLADE_DIR=\""$(datadir)/glabels/glade/"\" \ + -DGLABELS_BUILDER_DIR=\""$(datadir)/glabels/builder/"\" \ -DGLABELS_ICON_DIR=\""$(datadir)/pixmaps/"\" \ -DGLABELS_PIXMAP_DIR=\""$(datadir)/pixmaps/glabels/"\" \ -DG_LOG_DOMAIN=\""glabels\"" diff --git a/glabels2/src/color.h b/glabels2/src/color.h index c4403ad5..ac774dc4 100644 --- a/glabels2/src/color.h +++ b/glabels2/src/color.h @@ -45,6 +45,12 @@ G_BEGIN_DECLS #define GL_COLOR_NONE GL_COLOR_A(0,0,0,0) +#define GL_COLOR_BLACK GL_COLOR_A(0,0,0,255) + +#define GL_COLOR_TEXT_DEFAULT GL_COLOR_BLACK +#define GL_COLOR_BC_DEFAULT GL_COLOR_BLACK +#define GL_COLOR_NO_LINE GL_COLOR_NONE +#define GL_COLOR_NO_FILL GL_COLOR_NONE #define GL_COLOR_FILL_MERGE_DEFAULT GL_COLOR_A(255,255,255,128) #define GL_COLOR_MERGE_DEFAULT GL_COLOR_A(0,0,0,128) #define GL_COLOR_SHADOW_DEFAULT GL_COLOR(0,0,0) diff --git a/glabels2/src/merge-properties-dialog.c b/glabels2/src/merge-properties-dialog.c index d5f3508d..1bbd901d 100644 --- a/glabels2/src/merge-properties-dialog.c +++ b/glabels2/src/merge-properties-dialog.c @@ -26,7 +26,7 @@ #include "merge-properties-dialog.h" #include -#include +#include #include #include #include @@ -53,6 +53,8 @@ struct _glMergePropertiesDialogPrivate { glLabel *label; glMerge *merge; + GtkBuilder *gui; + GtkWidget *type_combo; GtkWidget *location_vbox; GtkWidget *src_entry; @@ -173,6 +175,9 @@ gl_merge_properties_dialog_finalize (GObject *object) if (dialog->priv->merge != NULL) { g_object_unref (G_OBJECT (dialog->priv->merge)); } + if (dialog->priv->gui != NULL) { + g_object_unref (G_OBJECT (dialog->priv->gui)); + } g_free (dialog->priv); G_OBJECT_CLASS (gl_merge_properties_dialog_parent_class)->finalize (object); @@ -208,7 +213,8 @@ gl_merge_properties_dialog_construct (glMergePropertiesDialog *dialog, glLabel *label, GtkWindow *window) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; gchar *description; glMergeSrcType src_type; gchar *src; @@ -229,25 +235,27 @@ gl_merge_properties_dialog_construct (glMergePropertiesDialog *dialog, gtk_window_set_destroy_with_parent (GTK_WINDOW(dialog), TRUE); } - gui = glade_xml_new (GLABELS_GLADE_DIR "merge-properties-dialog.glade", - "merge_properties_vbox", NULL); - - if (!gui) { - g_critical ("Could not open merge-properties-dialog.glade. gLabels may not be installed correctly!"); + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "merge-properties-dialog.builder", + &error); + if (error) { + g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); + g_error_free (error); return; } - vbox = glade_xml_get_widget (gui, "merge_properties_vbox"); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox); + gl_util_get_builder_widgets (gui, + "merge_properties_vbox", &vbox, + "type_combo", &dialog->priv->type_combo, + "location_vbox", &dialog->priv->location_vbox, + "treeview", &dialog->priv->treeview, + "select_all_button", &dialog->priv->select_all_button, + "unselect_all_button", &dialog->priv->unselect_all_button, + NULL); - dialog->priv->type_combo = glade_xml_get_widget (gui, "type_combo"); - dialog->priv->location_vbox = glade_xml_get_widget (gui, "location_vbox"); - dialog->priv->treeview = glade_xml_get_widget (gui, "treeview"); - - dialog->priv->select_all_button = glade_xml_get_widget (gui, "select_all_button"); - dialog->priv->unselect_all_button = glade_xml_get_widget (gui, "unselect_all_button"); - - g_object_unref (gui); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox); + dialog->priv->gui = gui; gl_util_combo_box_add_text_model (GTK_COMBO_BOX (dialog->priv->type_combo)); diff --git a/glabels2/src/new-label-dialog.c b/glabels2/src/new-label-dialog.c index 038ed43b..4b887956 100644 --- a/glabels2/src/new-label-dialog.c +++ b/glabels2/src/new-label-dialog.c @@ -26,7 +26,7 @@ #include "new-label-dialog.h" #include -#include +#include #include #include @@ -42,8 +42,10 @@ struct _glNewLabelDialogPrivate { - GtkWidget *media_select; - GtkWidget *rotate_label; + GtkBuilder *gui; + + GtkWidget *media_select; + GtkWidget *rotate_label; }; @@ -116,6 +118,10 @@ 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->gui) + { + g_object_unref (dialog->priv->gui); + } g_free (dialog->priv); G_OBJECT_CLASS (gl_new_label_dialog_parent_class)->finalize (object); @@ -148,29 +154,33 @@ static void gl_new_label_dialog_construct (glNewLabelDialog *dialog, GtkWindow *win) { - GladeXML *gui; - GtkWidget *vbox, *media_select_vbox, *rotate_label_vbox; - gchar *name; + GtkBuilder *gui; + 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); - gui = glade_xml_new (GLABELS_GLADE_DIR "new-label-dialog.glade", - "new_label_dialog_vbox", NULL); - - if (!gui) { - g_critical ("Could not open new-label-dialog.glade. gLabels may not be installed correctly!"); - return; - } + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "new-label-dialog.builder", + &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 (gui, + "new_label_dialog_vbox", &vbox, + "media_select_vbox", &media_select_vbox, + "rotate_label_vbox", &rotate_label_vbox, + NULL); - vbox = glade_xml_get_widget (gui, "new_label_dialog_vbox"); gtk_box_pack_start (GTK_BOX( GTK_DIALOG (dialog)->vbox), vbox, FALSE, FALSE, 0); - - media_select_vbox = glade_xml_get_widget (gui, "media_select_vbox"); - rotate_label_vbox = glade_xml_get_widget (gui, "rotate_label_vbox"); - - g_object_unref (gui); + dialog->priv->gui = gui; dialog->priv->media_select = gl_wdgt_media_select_new (); gtk_box_pack_start (GTK_BOX (media_select_vbox), diff --git a/glabels2/src/object-editor-bc-page.c b/glabels2/src/object-editor-bc-page.c index 38c6a197..be603ecd 100644 --- a/glabels2/src/object-editor-bc-page.c +++ b/glabels2/src/object-editor-bc-page.c @@ -72,33 +72,30 @@ gl_object_editor_prepare_bc_page (glObjectEditor *editor) gl_debug (DEBUG_EDITOR, "START"); /* Extract widgets from XML tree. */ - editor->priv->bc_page_vbox = - glade_xml_get_widget (editor->priv->gui, "bc_page_vbox"); - editor->priv->bc_style_combo = - glade_xml_get_widget (editor->priv->gui, "bc_style_combo"); - editor->priv->bc_text_check = - glade_xml_get_widget (editor->priv->gui, "bc_text_check"); - editor->priv->bc_cs_check = - glade_xml_get_widget (editor->priv->gui, "bc_cs_check"); - editor->priv->bc_color_combo = - glade_xml_get_widget (editor->priv->gui, "bc_color_combo"); - editor->priv->bc_key_combo = - glade_xml_get_widget (editor->priv->gui, "bc_key_combo"); - editor->priv->bc_key_radio = - glade_xml_get_widget (editor->priv->gui, "bc_key_radio"); - editor->priv->bc_color_radio = - glade_xml_get_widget (editor->priv->gui, "bc_color_radio"); - editor->priv->data_format_label = - glade_xml_get_widget (editor->priv->gui, "data_format_label"); - editor->priv->data_ex_label = - glade_xml_get_widget (editor->priv->gui, "data_ex_label"); - editor->priv->data_digits_label = - glade_xml_get_widget (editor->priv->gui, "data_digits_label"); - editor->priv->data_digits_spin = - glade_xml_get_widget (editor->priv->gui, "data_digits_spin"); + gl_util_get_builder_widgets (editor->priv->gui, + "bc_page_vbox", &editor->priv->bc_page_vbox, + "bc_style_combo", &editor->priv->bc_style_combo, + "bc_text_check", &editor->priv->bc_text_check, + "bc_cs_check", &editor->priv->bc_cs_check, + "bc_color_hbox", &editor->priv->bc_color_hbox, + "bc_key_combo", &editor->priv->bc_key_combo, + "bc_key_radio", &editor->priv->bc_key_radio, + "bc_color_radio", &editor->priv->bc_color_radio, + "data_format_label", &editor->priv->data_format_label, + "data_ex_label", &editor->priv->data_ex_label, + "data_digits_label", &editor->priv->data_digits_label, + "data_digits_spin", &editor->priv->data_digits_spin, + NULL); editor->priv->data_format_fixed_flag = FALSE; + editor->priv->bc_color_combo = gl_color_combo_new (NULL, + _("Default"), + GL_COLOR_BC_DEFAULT, + gl_prefs->default_line_color); + gtk_container_add (GTK_CONTAINER (editor->priv->bc_color_hbox), + editor->priv->bc_color_combo); + gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->bc_style_combo)); gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->bc_key_combo)); diff --git a/glabels2/src/object-editor-data-page.c b/glabels2/src/object-editor-data-page.c index 449d3e28..3959ea7b 100644 --- a/glabels2/src/object-editor-data-page.c +++ b/glabels2/src/object-editor-data-page.c @@ -68,16 +68,13 @@ gl_object_editor_prepare_data_page (glObjectEditor *editor) gl_debug (DEBUG_EDITOR, "START"); /* Extract widgets from XML tree. */ - editor->priv->data_page_vbox = glade_xml_get_widget (editor->priv->gui, - "data_page_vbox"); - editor->priv->data_literal_radio = glade_xml_get_widget (editor->priv->gui, - "data_literal_radio"); - editor->priv->data_key_radio = glade_xml_get_widget (editor->priv->gui, - "data_key_radio"); - editor->priv->data_text_entry = glade_xml_get_widget (editor->priv->gui, - "data_text_entry"); - editor->priv->data_key_combo = glade_xml_get_widget (editor->priv->gui, - "data_key_combo"); + gl_util_get_builder_widgets (editor->priv->gui, + "data_page_vbox", &editor->priv->data_page_vbox, + "data_literal_radio", &editor->priv->data_literal_radio, + "data_key_radio", &editor->priv->data_key_radio, + "data_text_entry", &editor->priv->data_text_entry, + "data_key_combo", &editor->priv->data_key_combo, + NULL); gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->data_key_combo)); diff --git a/glabels2/src/object-editor-edit-page.c b/glabels2/src/object-editor-edit-page.c index f7d3bf0d..e5f4568e 100644 --- a/glabels2/src/object-editor-edit-page.c +++ b/glabels2/src/object-editor-edit-page.c @@ -69,12 +69,11 @@ gl_object_editor_prepare_edit_page (glObjectEditor *editor) gl_debug (DEBUG_EDITOR, "START"); /* Extract widgets from XML tree. */ - editor->priv->edit_page_vbox = - glade_xml_get_widget (editor->priv->gui, "edit_page_vbox"); - editor->priv->edit_text_view = - glade_xml_get_widget (editor->priv->gui, "edit_text_view"); - editor->priv->edit_insert_field_button = - glade_xml_get_widget (editor->priv->gui, "edit_insert_field_button"); + gl_util_get_builder_widgets (editor->priv->gui, + "edit_page_vbox", &editor->priv->edit_page_vbox, + "edit_text_view", &editor->priv->edit_text_view, + "edit_insert_field_button", &editor->priv->edit_insert_field_button, + NULL); editor->priv->edit_insert_field_menu = gl_wdgt_merge_menu_new (); diff --git a/glabels2/src/object-editor-fill-page.c b/glabels2/src/object-editor-fill-page.c index 8ff5b4a2..6270c9d3 100644 --- a/glabels2/src/object-editor-fill-page.c +++ b/glabels2/src/object-editor-fill-page.c @@ -67,18 +67,21 @@ gl_object_editor_prepare_fill_page (glObjectEditor *editor) gl_debug (DEBUG_EDITOR, "START"); /* Extract widgets from XML tree. */ - editor->priv->fill_page_vbox = glade_xml_get_widget (editor->priv->gui, - "fill_page_vbox"); - editor->priv->fill_color_combo = glade_xml_get_widget (editor->priv->gui, - "fill_color_combo"); - editor->priv->fill_key_combo = glade_xml_get_widget (editor->priv->gui, - "fill_key_combo"); - editor->priv->fill_key_radio = glade_xml_get_widget (editor->priv->gui, - "fill_key_radio"); - editor->priv->fill_color_radio = glade_xml_get_widget (editor->priv->gui, - "fill_color_radio"); - + gl_util_get_builder_widgets (editor->priv->gui, + "fill_page_vbox", &editor->priv->fill_page_vbox, + "fill_color_hbox", &editor->priv->fill_color_hbox, + "fill_key_combo", &editor->priv->fill_key_combo, + "fill_key_radio", &editor->priv->fill_key_radio, + "fill_color_radio", &editor->priv->fill_color_radio, + NULL); + editor->priv->fill_color_combo = gl_color_combo_new (NULL, + _("No Fill"), + GL_COLOR_NO_FILL, + gl_prefs->default_fill_color); + gtk_container_add (GTK_CONTAINER (editor->priv->fill_color_hbox), + editor->priv->fill_color_combo); + gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->fill_key_combo)); /* Modify widgets based on configuration */ diff --git a/glabels2/src/object-editor-image-page.c b/glabels2/src/object-editor-image-page.c index a975ab29..1c756072 100644 --- a/glabels2/src/object-editor-image-page.c +++ b/glabels2/src/object-editor-image-page.c @@ -76,16 +76,13 @@ gl_object_editor_prepare_image_page (glObjectEditor *editor) gl_debug (DEBUG_EDITOR, "START"); /* Extract widgets from XML tree. */ - editor->priv->img_page_vbox = glade_xml_get_widget (editor->priv->gui, - "img_page_vbox"); - editor->priv->img_file_radio = glade_xml_get_widget (editor->priv->gui, - "img_file_radio"); - editor->priv->img_key_radio = glade_xml_get_widget (editor->priv->gui, - "img_key_radio"); - editor->priv->img_file_button = glade_xml_get_widget (editor->priv->gui, - "img_file_button"); - editor->priv->img_key_combo = glade_xml_get_widget (editor->priv->gui, - "img_key_combo"); + gl_util_get_builder_widgets (editor->priv->gui, + "img_page_vbox", &editor->priv->img_page_vbox, + "img_file_radio", &editor->priv->img_file_radio, + "img_key_radio", &editor->priv->img_key_radio, + "img_file_button", &editor->priv->img_file_button, + "img_key_combo", &editor->priv->img_key_combo, + NULL); gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->img_key_combo)); diff --git a/glabels2/src/object-editor-line-page.c b/glabels2/src/object-editor-line-page.c index 40f96bb0..5b48bde3 100644 --- a/glabels2/src/object-editor-line-page.c +++ b/glabels2/src/object-editor-line-page.c @@ -68,18 +68,21 @@ gl_object_editor_prepare_line_page (glObjectEditor *editor) gl_debug (DEBUG_EDITOR, "START"); /* Extract widgets from XML tree. */ - editor->priv->line_page_vbox = glade_xml_get_widget (editor->priv->gui, - "line_page_vbox"); - editor->priv->line_width_spin = glade_xml_get_widget (editor->priv->gui, - "line_width_spin"); - editor->priv->line_color_combo = glade_xml_get_widget (editor->priv->gui, - "line_color_combo"); - editor->priv->line_key_combo = glade_xml_get_widget (editor->priv->gui, - "line_key_combo"); - editor->priv->line_key_radio = glade_xml_get_widget (editor->priv->gui, - "line_key_radio"); - editor->priv->line_color_radio = glade_xml_get_widget (editor->priv->gui, - "line_color_radio"); + gl_util_get_builder_widgets (editor->priv->gui, + "line_page_vbox", &editor->priv->line_page_vbox, + "line_width_spin", &editor->priv->line_width_spin, + "line_color_hbox", &editor->priv->line_color_hbox, + "line_key_combo", &editor->priv->line_key_combo, + "line_key_radio", &editor->priv->line_key_radio, + "line_color_radio", &editor->priv->line_color_radio, + NULL); + + editor->priv->line_color_combo = gl_color_combo_new (NULL, + _("No Line"), + GL_COLOR_NO_LINE, + gl_prefs->default_line_color); + gtk_container_add (GTK_CONTAINER (editor->priv->line_color_hbox), + editor->priv->line_color_combo); gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->line_key_combo)); diff --git a/glabels2/src/object-editor-lsize-page.c b/glabels2/src/object-editor-lsize-page.c index d87c2470..2fb29ac1 100644 --- a/glabels2/src/object-editor-lsize-page.c +++ b/glabels2/src/object-editor-lsize-page.c @@ -73,14 +73,12 @@ gl_object_editor_prepare_lsize_page (glObjectEditor *editor) gl_debug (DEBUG_EDITOR, "START"); /* Extract widgets from XML tree. */ - editor->priv->lsize_page_vbox = - glade_xml_get_widget (editor->priv->gui, "lsize_page_vbox"); - editor->priv->lsize_r_spin = - glade_xml_get_widget (editor->priv->gui, "lsize_r_spin"); - editor->priv->lsize_theta_spin = - glade_xml_get_widget (editor->priv->gui, "lsize_theta_spin"); - editor->priv->lsize_r_units_label = - glade_xml_get_widget (editor->priv->gui, "lsize_r_units_label"); + gl_util_get_builder_widgets (editor->priv->gui, + "lsize_page_vbox", &editor->priv->lsize_page_vbox, + "lsize_r_spin", &editor->priv->lsize_r_spin, + "lsize_theta_spin", &editor->priv->lsize_theta_spin, + "lsize_r_units_label", &editor->priv->lsize_r_units_label, + NULL); /* Get configuration information */ units_string = gl_prefs_get_units_string (); diff --git a/glabels2/src/object-editor-position-page.c b/glabels2/src/object-editor-position-page.c index e72036e0..511c894b 100644 --- a/glabels2/src/object-editor-position-page.c +++ b/glabels2/src/object-editor-position-page.c @@ -66,16 +66,13 @@ gl_object_editor_prepare_position_page (glObjectEditor *editor) gl_debug (DEBUG_EDITOR, "START"); /* Extract widgets from XML tree. */ - editor->priv->pos_page_vbox = glade_xml_get_widget (editor->priv->gui, - "pos_page_vbox"); - editor->priv->pos_x_spin = glade_xml_get_widget (editor->priv->gui, - "pos_x_spin"); - editor->priv->pos_y_spin = glade_xml_get_widget (editor->priv->gui, - "pos_y_spin"); - editor->priv->pos_x_units_label = glade_xml_get_widget (editor->priv->gui, - "pos_x_units_label"); - editor->priv->pos_y_units_label = glade_xml_get_widget (editor->priv->gui, - "pos_y_units_label"); + gl_util_get_builder_widgets (editor->priv->gui, + "pos_page_vbox", &editor->priv->pos_page_vbox, + "pos_x_spin", &editor->priv->pos_x_spin, + "pos_y_spin", &editor->priv->pos_y_spin, + "pos_x_units_label", &editor->priv->pos_x_units_label, + "pos_y_units_label", &editor->priv->pos_y_units_label, + NULL); /* Get configuration information */ units_string = gl_prefs_get_units_string (); diff --git a/glabels2/src/object-editor-private.h b/glabels2/src/object-editor-private.h index 48eb9cf5..31fc5edf 100644 --- a/glabels2/src/object-editor-private.h +++ b/glabels2/src/object-editor-private.h @@ -25,13 +25,13 @@ #define __OBJECT_EDITOR_PRIVATE_H__ #include -#include +#include G_BEGIN_DECLS struct _glObjectEditorPrivate { - GladeXML *gui; + GtkBuilder *gui; GtkWidget *editor_vbox; glLabel *label; @@ -57,6 +57,7 @@ struct _glObjectEditorPrivate { GtkWidget *size_h_spin; GtkWidget *size_w_units_label; GtkWidget *size_h_units_label; + GtkWidget *size_aspect_vbox; GtkWidget *size_aspect_checkbutton; GtkWidget *size_reset_image_button; gdouble size_aspect_ratio; @@ -77,6 +78,7 @@ struct _glObjectEditorPrivate { gdouble dy_max; GtkWidget *fill_page_vbox; + GtkWidget *fill_color_hbox; GtkWidget *fill_color_combo; GtkWidget *fill_key_combo; GtkWidget *fill_key_radio; @@ -85,6 +87,7 @@ struct _glObjectEditorPrivate { GtkWidget *line_page_vbox; GtkWidget *line_width_spin; GtkWidget *line_color_radio; + GtkWidget *line_color_hbox; GtkWidget *line_color_combo; GtkWidget *line_key_radio; GtkWidget *line_key_combo; @@ -101,6 +104,7 @@ struct _glObjectEditorPrivate { GtkWidget *text_bold_toggle; GtkWidget *text_italic_toggle; GtkWidget *text_color_radio; + GtkWidget *text_color_hbox; GtkWidget *text_color_combo; GtkWidget *text_color_key_radio; GtkWidget *text_color_key_combo; @@ -120,6 +124,7 @@ struct _glObjectEditorPrivate { GtkWidget *bc_text_check; GtkWidget *bc_cs_check; GtkWidget *bc_color_radio; + GtkWidget *bc_color_hbox; GtkWidget *bc_color_combo; GtkWidget *bc_key_radio; GtkWidget *bc_key_combo; @@ -144,6 +149,7 @@ struct _glObjectEditorPrivate { GtkWidget *shadow_y_units_label; GtkWidget *shadow_color_radio; GtkWidget *shadow_key_radio; + GtkWidget *shadow_color_hbox; GtkWidget *shadow_color_combo; GtkWidget *shadow_key_combo; GtkWidget *shadow_opacity_spin; diff --git a/glabels2/src/object-editor-shadow-page.c b/glabels2/src/object-editor-shadow-page.c index c2e73571..454c2bc7 100644 --- a/glabels2/src/object-editor-shadow-page.c +++ b/glabels2/src/object-editor-shadow-page.c @@ -74,30 +74,27 @@ gl_object_editor_prepare_shadow_page (glObjectEditor *editor) gl_debug (DEBUG_EDITOR, "START"); /* Extract widgets from XML tree. */ - editor->priv->shadow_page_vbox - = glade_xml_get_widget (editor->priv->gui, "shadow_page_vbox"); - editor->priv->shadow_enable_check - = glade_xml_get_widget (editor->priv->gui, "shadow_enable_check"); - editor->priv->shadow_controls_table - = glade_xml_get_widget (editor->priv->gui, "shadow_controls_table"); - editor->priv->shadow_x_spin - = glade_xml_get_widget (editor->priv->gui, "shadow_x_spin"); - editor->priv->shadow_y_spin - = glade_xml_get_widget (editor->priv->gui, "shadow_y_spin"); - editor->priv->shadow_x_units_label - = glade_xml_get_widget (editor->priv->gui, "shadow_x_units_label"); - editor->priv->shadow_y_units_label - = glade_xml_get_widget (editor->priv->gui, "shadow_y_units_label"); - editor->priv->shadow_color_radio - = glade_xml_get_widget (editor->priv->gui, "shadow_color_radio"); - editor->priv->shadow_key_radio - = glade_xml_get_widget (editor->priv->gui, "shadow_key_radio"); - editor->priv->shadow_color_combo - = glade_xml_get_widget (editor->priv->gui, "shadow_color_combo"); - editor->priv->shadow_key_combo - = glade_xml_get_widget (editor->priv->gui, "shadow_key_combo"); - editor->priv->shadow_opacity_spin - = glade_xml_get_widget (editor->priv->gui, "shadow_opacity_spin"); + gl_util_get_builder_widgets (editor->priv->gui, + "shadow_page_vbox", &editor->priv->shadow_page_vbox, + "shadow_enable_check", &editor->priv->shadow_enable_check, + "shadow_controls_table", &editor->priv->shadow_controls_table, + "shadow_x_spin", &editor->priv->shadow_x_spin, + "shadow_y_spin", &editor->priv->shadow_y_spin, + "shadow_x_units_label", &editor->priv->shadow_x_units_label, + "shadow_y_units_label", &editor->priv->shadow_y_units_label, + "shadow_color_radio", &editor->priv->shadow_color_radio, + "shadow_key_radio", &editor->priv->shadow_key_radio, + "shadow_color_hbox", &editor->priv->shadow_color_hbox, + "shadow_key_combo", &editor->priv->shadow_key_combo, + "shadow_opacity_spin", &editor->priv->shadow_opacity_spin, + NULL); + + editor->priv->shadow_color_combo = gl_color_combo_new (NULL, + _("Default"), + GL_COLOR_SHADOW_DEFAULT, + GL_COLOR_SHADOW_DEFAULT); + gtk_container_add (GTK_CONTAINER (editor->priv->shadow_color_hbox), + editor->priv->shadow_color_combo); gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->shadow_key_combo)); diff --git a/glabels2/src/object-editor-size-page.c b/glabels2/src/object-editor-size-page.c index 58cec074..5e3ab9d3 100644 --- a/glabels2/src/object-editor-size-page.c +++ b/glabels2/src/object-editor-size-page.c @@ -73,20 +73,23 @@ gl_object_editor_prepare_size_page (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); /* Extract widgets from XML tree. */ - editor->priv->size_page_vbox = - glade_xml_get_widget (editor->priv->gui, "size_page_vbox"); - editor->priv->size_w_spin = - glade_xml_get_widget (editor->priv->gui, "size_w_spin"); - editor->priv->size_h_spin = - glade_xml_get_widget (editor->priv->gui, "size_h_spin"); - editor->priv->size_w_units_label = - glade_xml_get_widget (editor->priv->gui, "size_w_units_label"); - editor->priv->size_h_units_label = - glade_xml_get_widget (editor->priv->gui, "size_h_units_label"); - editor->priv->size_aspect_checkbutton = - glade_xml_get_widget (editor->priv->gui, "size_aspect_checkbutton"); - editor->priv->size_reset_image_button = - glade_xml_get_widget (editor->priv->gui, "size_reset_image_button"); + gl_util_get_builder_widgets (editor->priv->gui, + "size_page_vbox", &editor->priv->size_page_vbox, + "size_w_spin", &editor->priv->size_w_spin, + "size_h_spin", &editor->priv->size_h_spin, + "size_w_units_label", &editor->priv->size_w_units_label, + "size_h_units_label", &editor->priv->size_h_units_label, + "size_aspect_vbox", &editor->priv->size_aspect_vbox, + "size_reset_image_button", &editor->priv->size_reset_image_button, + NULL); + + editor->priv->size_aspect_checkbutton = gl_wdgt_chain_button_new (GL_WDGT_CHAIN_RIGHT); + gl_wdgt_chain_button_set_active (GL_WDGT_CHAIN_BUTTON(editor->priv->size_aspect_checkbutton), + TRUE); + gtk_box_pack_start (GTK_BOX (editor->priv->size_aspect_vbox), + editor->priv->size_aspect_checkbutton, + FALSE, FALSE, 0); + /* Get configuration information */ units_string = gl_prefs_get_units_string (); diff --git a/glabels2/src/object-editor-text-page.c b/glabels2/src/object-editor-text-page.c index a242661c..79f13051 100644 --- a/glabels2/src/object-editor-text-page.c +++ b/glabels2/src/object-editor-text-page.c @@ -72,34 +72,29 @@ gl_object_editor_prepare_text_page (glObjectEditor *editor) gl_debug (DEBUG_EDITOR, "START"); /* Extract widgets from XML tree. */ - editor->priv->text_page_vbox = - glade_xml_get_widget (editor->priv->gui, "text_page_vbox"); - editor->priv->text_family_combo = - glade_xml_get_widget (editor->priv->gui, "text_family_combo"); - editor->priv->text_size_spin = - glade_xml_get_widget (editor->priv->gui, "text_size_spin"); - editor->priv->text_bold_toggle = - glade_xml_get_widget (editor->priv->gui, "text_bold_toggle"); - editor->priv->text_italic_toggle = - glade_xml_get_widget (editor->priv->gui, "text_italic_toggle"); - editor->priv->text_color_combo = - glade_xml_get_widget (editor->priv->gui, "text_color_combo"); - editor->priv->text_color_radio = - glade_xml_get_widget (editor->priv->gui, "text_color_radio"); - editor->priv->text_color_key_radio = - glade_xml_get_widget (editor->priv->gui, "text_color_key_radio"); - editor->priv->text_color_key_combo = - glade_xml_get_widget (editor->priv->gui, "text_color_key_combo"); - editor->priv->text_left_toggle = - glade_xml_get_widget (editor->priv->gui, "text_left_toggle"); - editor->priv->text_center_toggle = - glade_xml_get_widget (editor->priv->gui, "text_center_toggle"); - editor->priv->text_right_toggle = - glade_xml_get_widget (editor->priv->gui, "text_right_toggle"); - editor->priv->text_line_spacing_spin = - glade_xml_get_widget (editor->priv->gui, "text_line_spacing_spin"); - editor->priv->text_auto_shrink_check = - glade_xml_get_widget (editor->priv->gui, "text_auto_shrink_check"); + gl_util_get_builder_widgets (editor->priv->gui, + "text_page_vbox", &editor->priv->text_page_vbox, + "text_family_combo", &editor->priv->text_family_combo, + "text_size_spin", &editor->priv->text_size_spin, + "text_bold_toggle", &editor->priv->text_bold_toggle, + "text_italic_toggle", &editor->priv->text_italic_toggle, + "text_color_hbox", &editor->priv->text_color_hbox, + "text_color_radio", &editor->priv->text_color_radio, + "text_color_key_radio", &editor->priv->text_color_key_radio, + "text_color_key_combo", &editor->priv->text_color_key_combo, + "text_left_toggle", &editor->priv->text_left_toggle, + "text_center_toggle", &editor->priv->text_center_toggle, + "text_right_toggle", &editor->priv->text_right_toggle, + "text_line_spacing_spin", &editor->priv->text_line_spacing_spin, + "text_auto_shrink_check", &editor->priv->text_auto_shrink_check, + NULL); + + editor->priv->text_color_combo = gl_color_combo_new (NULL, + _("Default"), + GL_COLOR_TEXT_DEFAULT, + gl_prefs->default_text_color); + gtk_container_add (GTK_CONTAINER (editor->priv->text_color_hbox), + editor->priv->text_color_combo); gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->text_family_combo)); gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->text_color_key_combo)); @@ -113,7 +108,7 @@ gl_object_editor_prepare_text_page (glObjectEditor *editor) /* Modify widgets */ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_radio), TRUE); gtk_widget_set_sensitive (editor->priv->text_color_combo, TRUE); - gtk_widget_set_sensitive (editor->priv->text_color_key_combo, FALSE); + gtk_widget_set_sensitive (editor->priv->text_color_key_combo, FALSE); /* Un-hide */ gtk_widget_show_all (editor->priv->text_page_vbox); diff --git a/glabels2/src/object-editor.c b/glabels2/src/object-editor.c index ddaf6f90..f237e642 100644 --- a/glabels2/src/object-editor.c +++ b/glabels2/src/object-editor.c @@ -26,7 +26,7 @@ #include "object-editor.h" #include -#include +#include #include #include #include @@ -119,32 +119,34 @@ gl_object_editor_class_init (glObjectEditorClass *class) static void gl_object_editor_init (glObjectEditor *editor) { + GError *error = NULL; + gl_debug (DEBUG_EDITOR, "START"); editor->priv = g_new0 (glObjectEditorPrivate, 1); - editor->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "object-editor.glade", - "editor_vbox", - NULL); + editor->priv->gui = gtk_builder_new (); - if (!editor->priv->gui) { - g_critical ("Could not open object-editor.glade. gLabels may not be installed correctly!"); + gtk_builder_add_from_file (editor->priv->gui, + GLABELS_BUILDER_DIR "object-editor.builder", + &error); + if (error) { + g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); + g_error_free (error); return; } - editor->priv->editor_vbox = glade_xml_get_widget (editor->priv->gui, - "editor_vbox"); + gl_util_get_builder_widgets (editor->priv->gui, + "editor_vbox", &editor->priv->editor_vbox, + "title_image", &editor->priv->title_image, + "title_label", &editor->priv->title_label, + "notebook", &editor->priv->notebook, + NULL); + gtk_box_pack_start (GTK_BOX(editor), editor->priv->editor_vbox, FALSE, FALSE, 0); - editor->priv->title_image = glade_xml_get_widget (editor->priv->gui, - "title_image"); - editor->priv->title_label = glade_xml_get_widget (editor->priv->gui, - "title_label"); - editor->priv->notebook = glade_xml_get_widget (editor->priv->gui, - "notebook"); - gtk_widget_show_all (GTK_WIDGET(editor)); /* Hide all notebook pages to start with. */ @@ -557,69 +559,6 @@ gl_object_editor_set_key_names (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "END"); } -/*****************************************************************************/ -/* Construct color combo "Custom widget". */ -/*****************************************************************************/ -GtkWidget * -gl_object_editor_construct_color_combo (gchar *name, - gchar *string1, - gchar *string2, - gint int1, - gint int2) -{ - GtkWidget *color_combo; - guint color; - gchar *no_color; - - switch (int1) { - - case 3: - color = GL_COLOR_SHADOW_DEFAULT; - no_color = _("Default"); - break; - - case 2: - color = gl_prefs->default_text_color; - no_color = _("Default"); - break; - - case 1: - color = gl_prefs->default_line_color; - no_color = _("No line"); - break; - - case 0: - default: - color = gl_prefs->default_fill_color; - no_color = _("No fill"); - break; - - } - - color_combo = gl_color_combo_new (NULL, no_color, color, color); - - gl_color_combo_set_relief (GL_COLOR_COMBO(color_combo), GTK_RELIEF_NORMAL); - - return color_combo; -} - -/*****************************************************************************/ -/* Construct chain button "Custom widget". */ -/*****************************************************************************/ -GtkWidget * -gl_object_editor_construct_chain_button (gchar *name, - gchar *string1, - gchar *string2, - gint int1, - gint int2) -{ - GtkWidget *chain_button; - - chain_button = gl_wdgt_chain_button_new (GL_WDGT_CHAIN_RIGHT); - gl_wdgt_chain_button_set_active (GL_WDGT_CHAIN_BUTTON(chain_button), TRUE); - - return chain_button; -} /*--------------------------------------------------------------------------*/ /* PRIVATE. Prefs changed callback. Update units related items. */ diff --git a/glabels2/src/prefs-dialog.c b/glabels2/src/prefs-dialog.c index 3c15ac71..a578e9ff 100644 --- a/glabels2/src/prefs-dialog.c +++ b/glabels2/src/prefs-dialog.c @@ -26,7 +26,7 @@ #include "prefs-dialog.h" #include -#include +#include #include #include #include @@ -53,7 +53,7 @@ struct _glPrefsDialogPrivate { - GladeXML *gui; + GtkBuilder *gui; /* Units properties */ GtkWidget *units_points_radio; @@ -69,6 +69,7 @@ struct _glPrefsDialogPrivate GtkWidget *text_size_spin; GtkWidget *text_bold_toggle; GtkWidget *text_italic_toggle; + GtkWidget *text_color_hbox; GtkWidget *text_color_combo; GtkWidget *text_left_toggle; GtkWidget *text_center_toggle; @@ -77,9 +78,11 @@ struct _glPrefsDialogPrivate /* Default line properties */ GtkWidget *line_width_spin; + GtkWidget *line_color_hbox; GtkWidget *line_color_combo; /* Default fill properties */ + GtkWidget *fill_color_hbox; GtkWidget *fill_color_combo; /* Prevent recursion */ @@ -135,17 +138,19 @@ gl_prefs_dialog_class_init (glPrefsDialogClass *class) static void gl_prefs_dialog_init (glPrefsDialog *dialog) { + GError *error = NULL; + gl_debug (DEBUG_PREFS, "START"); dialog->priv = g_new0 (glPrefsDialogPrivate, 1); - dialog->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "prefs-dialog.glade", - "prefs_notebook", - NULL); - - if (!dialog->priv->gui) - { - g_critical ("Could not open prefs-dialog.glade. gLabels may not be installed correctly!"); + dialog->priv->gui = gtk_builder_new (); + gtk_builder_add_from_file (dialog->priv->gui, + GLABELS_BUILDER_DIR "prefs-dialog.builder", + &error); + if (error) { + g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); + g_error_free (error); return; } @@ -222,7 +227,9 @@ gl_prefs_dialog_construct (glPrefsDialog *dialog) g_return_if_fail (GL_IS_PREFS_DIALOG (dialog)); g_return_if_fail (dialog->priv != NULL); - notebook = glade_xml_get_widget (dialog->priv->gui, "prefs_notebook"); + gl_util_get_builder_widgets (dialog->priv->gui, + "prefs_notebook", ¬ebook, + NULL); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, FALSE, FALSE, 0); construct_locale_page (dialog); @@ -268,20 +275,13 @@ static void construct_locale_page (glPrefsDialog *dialog) { - dialog->priv->units_points_radio = - glade_xml_get_widget (dialog->priv->gui, "units_points_radio"); - - dialog->priv->units_inches_radio = - glade_xml_get_widget (dialog->priv->gui, "units_inches_radio"); - - dialog->priv->units_mm_radio = - glade_xml_get_widget (dialog->priv->gui, "units_mm_radio"); - - dialog->priv->page_size_us_letter_radio = - glade_xml_get_widget (dialog->priv->gui, "page_size_us_letter_radio"); - - dialog->priv->page_size_a4_radio = - glade_xml_get_widget (dialog->priv->gui, "page_size_a4_radio"); + gl_util_get_builder_widgets (dialog->priv->gui, + "units_points_radio", &dialog->priv->units_points_radio, + "units_inches_radio", &dialog->priv->units_inches_radio, + "units_mm_radio", &dialog->priv->units_mm_radio, + "page_size_us_letter_radio", &dialog->priv->page_size_us_letter_radio, + "page_size_a4_radio", &dialog->priv->page_size_a4_radio, + NULL); g_signal_connect_swapped ( G_OBJECT(dialog->priv->units_points_radio), @@ -308,35 +308,40 @@ construct_object_page (glPrefsDialog *dialog) { GList *family_names; - dialog->priv->text_family_combo = - glade_xml_get_widget (dialog->priv->gui, "text_family_combo"); - dialog->priv->text_size_spin = - glade_xml_get_widget (dialog->priv->gui, "text_size_spin"); - dialog->priv->text_bold_toggle = - glade_xml_get_widget (dialog->priv->gui, "text_bold_toggle"); - dialog->priv->text_italic_toggle = - glade_xml_get_widget (dialog->priv->gui, "text_italic_toggle"); - dialog->priv->text_color_combo = - glade_xml_get_widget (dialog->priv->gui, "text_color_combo"); - dialog->priv->text_left_toggle = - glade_xml_get_widget (dialog->priv->gui, "text_left_toggle"); - dialog->priv->text_center_toggle = - glade_xml_get_widget (dialog->priv->gui, "text_center_toggle"); - dialog->priv->text_right_toggle = - glade_xml_get_widget (dialog->priv->gui, "text_right_toggle"); - dialog->priv->text_line_spacing_spin = - glade_xml_get_widget (dialog->priv->gui, "text_line_spacing_spin"); - - dialog->priv->line_width_spin = - glade_xml_get_widget (dialog->priv->gui, "line_width_spin"); - dialog->priv->line_color_combo = - glade_xml_get_widget (dialog->priv->gui, "line_color_combo"); - - dialog->priv->fill_color_combo = - glade_xml_get_widget (dialog->priv->gui, "fill_color_combo"); + gl_util_get_builder_widgets (dialog->priv->gui, + "text_family_combo", &dialog->priv->text_family_combo, + "text_size_spin", &dialog->priv->text_size_spin, + "text_bold_toggle", &dialog->priv->text_bold_toggle, + "text_italic_toggle", &dialog->priv->text_italic_toggle, + "text_color_hbox", &dialog->priv->text_color_hbox, + "text_left_toggle", &dialog->priv->text_left_toggle, + "text_center_toggle", &dialog->priv->text_center_toggle, + "text_right_toggle", &dialog->priv->text_right_toggle, + "text_line_spacing_spin", &dialog->priv->text_line_spacing_spin, + "line_width_spin", &dialog->priv->line_width_spin, + "line_color_hbox", &dialog->priv->line_color_hbox, + "fill_color_hbox", &dialog->priv->fill_color_hbox, + NULL); gl_util_combo_box_add_text_model (GTK_COMBO_BOX (dialog->priv->text_family_combo)); + dialog->priv->text_color_combo = gl_color_combo_new (NULL, _("Default"), + GL_COLOR_TEXT_DEFAULT, + gl_prefs->default_text_color); + dialog->priv->line_color_combo = gl_color_combo_new (NULL, _("No Line"), + GL_COLOR_NO_LINE, + gl_prefs->default_line_color); + dialog->priv->fill_color_combo = gl_color_combo_new (NULL, _("No Fill"), + GL_COLOR_NO_FILL, + gl_prefs->default_fill_color); + + gtk_container_add (GTK_CONTAINER (dialog->priv->text_color_hbox), + dialog->priv->text_color_combo); + gtk_container_add (GTK_CONTAINER (dialog->priv->line_color_hbox), + dialog->priv->line_color_combo); + gtk_container_add (GTK_CONTAINER (dialog->priv->fill_color_hbox), + dialog->priv->fill_color_combo); + /* Load family names */ family_names = gl_util_get_font_family_list (); gl_util_combo_box_set_strings (GTK_COMBO_BOX (dialog->priv->text_family_combo), diff --git a/glabels2/src/print-op.c b/glabels2/src/print-op.c index 2b2cd4a7..8414d872 100644 --- a/glabels2/src/print-op.c +++ b/glabels2/src/print-op.c @@ -26,7 +26,7 @@ #include "print-op.h" #include -#include +#include #include #include #include @@ -49,6 +49,8 @@ struct _glPrintOpPrivate { glLabel *label; + GtkBuilder *gui; + GtkWidget *simple_frame; GtkWidget *copies_vbox; GtkWidget *copies; @@ -187,6 +189,9 @@ gl_print_op_finalize (GObject *object) if (op->priv->label) { g_object_unref (G_OBJECT(op->priv->label)); } + if (op->priv->gui) { + g_object_unref (G_OBJECT(op->priv->gui)); + } g_free (op->priv->filename); g_free (op->priv); @@ -476,43 +481,48 @@ static GObject * create_custom_widget_cb (GtkPrintOperation *operation, gpointer user_data) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; glPrintOp *op = GL_PRINT_OP (operation); glLabel *label = GL_LABEL (user_data); GtkWidget *vbox; glMerge *merge = NULL; - gui = glade_xml_new (GLABELS_GLADE_DIR "print-custom-widget.glade", - "print_custom_widget_vbox", NULL); - - if (!gui) { - g_warning ("Could not open print-op.glade, reinstall glabels!"); - return NULL; + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "print-custom-widget.builder", + &error); + if (error) { + g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); + g_error_free (error); + return; } - vbox = glade_xml_get_widget (gui, "print_custom_widget_vbox"); + gl_util_get_builder_widgets (gui, + "print_custom_widget_vbox", &vbox, + "simple_frame", &op->priv->simple_frame, + "copies_vbox", &op->priv->copies_vbox, + "merge_frame", &op->priv->merge_frame, + "prmerge_vbox", &op->priv->prmerge_vbox, + "outline_check", &op->priv->outline_check, + "reverse_check", &op->priv->reverse_check, + "crop_marks_check", &op->priv->crop_marks_check, + NULL); /* ----- Simple print control ----- */ - op->priv->simple_frame = glade_xml_get_widget (gui, "simple_frame"); - op->priv->copies_vbox = glade_xml_get_widget (gui, "copies_vbox"); op->priv->copies = gl_wdgt_print_copies_new (label); gtk_box_pack_start (GTK_BOX(op->priv->copies_vbox), op->priv->copies, FALSE, FALSE, 0); /* ----- Merge print control ----- */ - op->priv->merge_frame = glade_xml_get_widget (gui, "merge_frame"); - op->priv->prmerge_vbox = glade_xml_get_widget (gui, "prmerge_vbox"); op->priv->prmerge = gl_wdgt_print_merge_new (label); gtk_box_pack_start (GTK_BOX(op->priv->prmerge_vbox), op->priv->prmerge, FALSE, FALSE, 0); - /* ----- Options ----------------- */ - op->priv->outline_check = glade_xml_get_widget (gui, "outline_check"); - op->priv->reverse_check = glade_xml_get_widget (gui, "reverse_check"); - op->priv->crop_marks_check = glade_xml_get_widget (gui, "crop_marks_check"); - g_object_unref (gui); + op->priv->gui = gui; + /* ---- Activate either simple or merge print control widgets. ---- */ merge = gl_label_get_merge (op->priv->label); if (merge == NULL) { diff --git a/glabels2/src/template-designer.c b/glabels2/src/template-designer.c index 60ffe576..a580db3c 100644 --- a/glabels2/src/template-designer.c +++ b/glabels2/src/template-designer.c @@ -26,7 +26,7 @@ #include "template-designer.h" #include -#include +#include #include #include #include @@ -77,6 +77,18 @@ struct _glTemplateDesignerPrivate { + + GtkBuilder *start_page_gui; + GtkBuilder *name_page_gui; + GtkBuilder *pg_size_page_gui; + GtkBuilder *shape_page_gui; + GtkBuilder *rect_size_page_gui; + GtkBuilder *round_size_page_gui; + GtkBuilder *cd_size_page_gui; + GtkBuilder *nlayouts_page_gui; + GtkBuilder *layout_page_gui; + GtkBuilder *finish_page_gui; + /* Assistant pages */ GtkWidget *start_page; GtkWidget *name_page; @@ -171,6 +183,7 @@ struct _glTemplateDesignerPrivate GtkWidget *layout_y0_units_label; GtkWidget *layout_dx_units_label; GtkWidget *layout_dy_units_label; + GtkWidget *mini_preview_vbox; GtkWidget *layout_mini_preview; GtkWidget *layout_test_button; @@ -278,8 +291,6 @@ gl_template_designer_class_init (glTemplateDesignerClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - gl_debug (DEBUG_TEMPLATE, ""); - gl_template_designer_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_template_designer_finalize; @@ -308,6 +319,46 @@ gl_template_designer_finalize (GObject *object) g_return_if_fail (GL_IS_TEMPLATE_DESIGNER (dialog)); g_return_if_fail (dialog->priv != NULL); + if (dialog->priv->start_page_gui) + { + g_object_unref (dialog->priv->start_page_gui); + } + if (dialog->priv->name_page_gui) + { + g_object_unref (dialog->priv->name_page_gui); + } + if (dialog->priv->pg_size_page_gui) + { + g_object_unref (dialog->priv->pg_size_page_gui); + } + if (dialog->priv->shape_page_gui) + { + g_object_unref (dialog->priv->shape_page_gui); + } + if (dialog->priv->rect_size_page_gui) + { + g_object_unref (dialog->priv->rect_size_page_gui); + } + if (dialog->priv->round_size_page_gui) + { + g_object_unref (dialog->priv->round_size_page_gui); + } + if (dialog->priv->cd_size_page_gui) + { + g_object_unref (dialog->priv->cd_size_page_gui); + } + if (dialog->priv->nlayouts_page_gui) + { + g_object_unref (dialog->priv->nlayouts_page_gui); + } + if (dialog->priv->layout_page_gui) + { + g_object_unref (dialog->priv->layout_page_gui); + } + if (dialog->priv->finish_page_gui) + { + g_object_unref (dialog->priv->finish_page_gui); + } g_free (dialog->priv); G_OBJECT_CLASS (gl_template_designer_parent_class)->finalize (object); @@ -346,6 +397,8 @@ gl_template_designer_construct (glTemplateDesigner *dialog) { GdkPixbuf *logo; + gl_debug (DEBUG_TEMPLATE, "START"); + g_return_if_fail (dialog && GL_IS_TEMPLATE_DESIGNER (dialog)); g_return_if_fail (dialog->priv != NULL); @@ -387,6 +440,8 @@ gl_template_designer_construct (glTemplateDesigner *dialog) G_CALLBACK(prepare_cb), NULL); gtk_widget_show_all (GTK_WIDGET(dialog)); + + gl_debug (DEBUG_TEMPLATE, "END"); } /*--------------------------------------------------------------------------*/ @@ -396,19 +451,26 @@ static void construct_start_page (glTemplateDesigner *dialog, GdkPixbuf *logo) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; - gui = glade_xml_new (GLABELS_GLADE_DIR "template-designer.glade", - "start_page", NULL); - if (!gui) - { - g_critical ("Could not open template-designer.glade. gLabels may not be installed correctly!"); - return; - } + gl_debug (DEBUG_TEMPLATE, "START"); - dialog->priv->start_page = glade_xml_get_widget (gui, "start_page"); + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "template-designer-start-page.builder", + &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 (gui, + "start_page", &dialog->priv->start_page, + NULL); - g_object_unref (gui); + dialog->priv->start_page_gui = gui; gtk_assistant_append_page (GTK_ASSISTANT (dialog), @@ -426,6 +488,8 @@ construct_start_page (glTemplateDesigner *dialog, gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog), dialog->priv->start_page, TRUE); + + gl_debug (DEBUG_TEMPLATE, "END"); } /*--------------------------------------------------------------------------*/ @@ -435,24 +499,31 @@ static void construct_name_page (glTemplateDesigner *dialog, GdkPixbuf *logo) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; - gui = glade_xml_new (GLABELS_GLADE_DIR "template-designer.glade", - "name_page", NULL); - if (!gui) - { - g_critical ("Could not open template-designer.glade. gLabels may not be installed correctly!"); - return; - } + gl_debug (DEBUG_TEMPLATE, "START"); + + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "template-designer-name-page.builder", + &error); + if (error) { + g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); + g_error_free (error); + return; + } - dialog->priv->name_page = glade_xml_get_widget (gui, "name_page"); - dialog->priv->brand_entry = glade_xml_get_widget (gui, "brand_entry"); - dialog->priv->part_num_entry = glade_xml_get_widget (gui, "part_num_entry"); - dialog->priv->name_warning_image = glade_xml_get_widget (gui, "name_warning_image"); - dialog->priv->name_warning_label = glade_xml_get_widget (gui, "name_warning_label"); - dialog->priv->description_entry = glade_xml_get_widget (gui, "description_entry"); + gl_util_get_builder_widgets (gui, + "name_page", &dialog->priv->name_page, + "brand_entry", &dialog->priv->brand_entry, + "part_num_entry", &dialog->priv->part_num_entry, + "name_warning_image", &dialog->priv->name_warning_image, + "name_warning_label", &dialog->priv->name_warning_label, + "description_entry", &dialog->priv->description_entry, + NULL); - g_object_unref (gui); + dialog->priv->name_page_gui = gui; gtk_assistant_append_page (GTK_ASSISTANT (dialog), @@ -474,6 +545,7 @@ construct_name_page (glTemplateDesigner *dialog, g_signal_connect_swapped (G_OBJECT(dialog->priv->description_entry), "changed", G_CALLBACK(name_page_changed_cb), dialog); + gl_debug (DEBUG_TEMPLATE, "END"); } /*--------------------------------------------------------------------------*/ @@ -483,27 +555,34 @@ static void construct_pg_size_page (glTemplateDesigner *dialog, GdkPixbuf *logo) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; GList *page_sizes; const gchar *default_page_size_id; gchar *default_page_size_name; - gui = glade_xml_new (GLABELS_GLADE_DIR "template-designer.glade", - "pg_size_page", NULL); - if (!gui) - { - g_critical ("Could not open template-designer.glade. gLabels may not be installed correctly!"); - return; - } + gl_debug (DEBUG_TEMPLATE, "START"); + + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "template-designer-pg-size-page.builder", + &error); + if (error) { + g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); + g_error_free (error); + return; + } - dialog->priv->pg_size_page = glade_xml_get_widget (gui, "pg_size_page"); - dialog->priv->pg_size_combo = glade_xml_get_widget (gui, "pg_size_combo"); - dialog->priv->pg_w_spin = glade_xml_get_widget (gui, "pg_w_spin"); - dialog->priv->pg_h_spin = glade_xml_get_widget (gui, "pg_h_spin"); - dialog->priv->pg_w_units_label = glade_xml_get_widget (gui, "pg_w_units_label"); - dialog->priv->pg_h_units_label = glade_xml_get_widget (gui, "pg_h_units_label"); + gl_util_get_builder_widgets (gui, + "pg_size_page", &dialog->priv->pg_size_page, + "pg_size_combo", &dialog->priv->pg_size_combo, + "pg_w_spin", &dialog->priv->pg_w_spin, + "pg_h_spin", &dialog->priv->pg_h_spin, + "pg_w_units_label", &dialog->priv->pg_w_units_label, + "pg_h_units_label", &dialog->priv->pg_h_units_label, + NULL); - g_object_unref (gui); + dialog->priv->pg_size_page_gui = gui; gl_util_combo_box_add_text_model (GTK_COMBO_BOX (dialog->priv->pg_size_combo)); @@ -552,6 +631,8 @@ construct_pg_size_page (glTemplateDesigner *dialog, /* This controls sensitivity of related widgets. */ g_signal_connect_swapped (G_OBJECT(dialog->priv->pg_size_combo), "changed", G_CALLBACK(pg_size_page_changed_cb), dialog); + + gl_debug (DEBUG_TEMPLATE, "END"); } /*--------------------------------------------------------------------------*/ @@ -561,22 +642,29 @@ static void construct_shape_page (glTemplateDesigner *dialog, GdkPixbuf *logo) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; - gui = glade_xml_new (GLABELS_GLADE_DIR "template-designer.glade", - "shape_page", NULL); - if (!gui) - { - g_critical ("Could not open template-designer.glade. gLabels may not be installed correctly!"); - return; - } + gl_debug (DEBUG_TEMPLATE, "START"); + + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "template-designer-shape-page.builder", + &error); + if (error) { + g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); + g_error_free (error); + return; + } - dialog->priv->shape_page = glade_xml_get_widget (gui, "shape_page"); - dialog->priv->shape_rect_radio = glade_xml_get_widget (gui, "shape_rect_radio"); - dialog->priv->shape_round_radio = glade_xml_get_widget (gui, "shape_round_radio"); - dialog->priv->shape_cd_radio = glade_xml_get_widget (gui, "shape_cd_radio"); + gl_util_get_builder_widgets (gui, + "shape_page", &dialog->priv->shape_page, + "shape_rect_radio", &dialog->priv->shape_rect_radio, + "shape_round_radio", &dialog->priv->shape_round_radio, + "shape_cd_radio", &dialog->priv->shape_cd_radio, + NULL); - g_object_unref (gui); + dialog->priv->shape_page_gui = gui; gtk_assistant_append_page (GTK_ASSISTANT (dialog), @@ -591,6 +679,8 @@ construct_shape_page (glTemplateDesigner *dialog, gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog), dialog->priv->shape_page, TRUE); + + gl_debug (DEBUG_TEMPLATE, "END"); } /*--------------------------------------------------------------------------*/ @@ -600,33 +690,41 @@ static void construct_rect_size_page (glTemplateDesigner *dialog, GdkPixbuf *logo) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; GdkPixbuf *pixbuf; - gui = glade_xml_new (GLABELS_GLADE_DIR "template-designer.glade", - "rect_size_page", NULL); - if (!gui) - { - g_critical ("Could not open template-designer.glade. gLabels may not be installed correctly!"); - return; - } + gl_debug (DEBUG_TEMPLATE, "START"); + + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "template-designer-rect-size-page.builder", + &error); + if (error) { + g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); + g_error_free (error); + return; + } + - dialog->priv->rect_size_page = glade_xml_get_widget (gui, "rect_size_page"); - dialog->priv->rect_image = glade_xml_get_widget (gui, "rect_image"); - dialog->priv->rect_w_spin = glade_xml_get_widget (gui, "rect_w_spin"); - dialog->priv->rect_h_spin = glade_xml_get_widget (gui, "rect_h_spin"); - dialog->priv->rect_r_spin = glade_xml_get_widget (gui, "rect_r_spin"); - dialog->priv->rect_x_waste_spin = glade_xml_get_widget (gui, "rect_x_waste_spin"); - dialog->priv->rect_y_waste_spin = glade_xml_get_widget (gui, "rect_y_waste_spin"); - dialog->priv->rect_margin_spin = glade_xml_get_widget (gui, "rect_margin_spin"); - dialog->priv->rect_w_units_label = glade_xml_get_widget (gui, "rect_w_units_label"); - dialog->priv->rect_h_units_label = glade_xml_get_widget (gui, "rect_h_units_label"); - dialog->priv->rect_r_units_label = glade_xml_get_widget (gui, "rect_r_units_label"); - dialog->priv->rect_x_waste_units_label = glade_xml_get_widget (gui, "rect_x_waste_units_label"); - dialog->priv->rect_y_waste_units_label = glade_xml_get_widget (gui, "rect_y_waste_units_label"); - dialog->priv->rect_margin_units_label = glade_xml_get_widget (gui, "rect_margin_units_label"); + gl_util_get_builder_widgets (gui, + "rect_size_page", &dialog->priv->rect_size_page, + "rect_image", &dialog->priv->rect_image, + "rect_w_spin", &dialog->priv->rect_w_spin, + "rect_h_spin", &dialog->priv->rect_h_spin, + "rect_r_spin", &dialog->priv->rect_r_spin, + "rect_x_waste_spin", &dialog->priv->rect_x_waste_spin, + "rect_y_waste_spin", &dialog->priv->rect_y_waste_spin, + "rect_margin_spin", &dialog->priv->rect_margin_spin, + "rect_w_units_label", &dialog->priv->rect_w_units_label, + "rect_h_units_label", &dialog->priv->rect_h_units_label, + "rect_r_units_label", &dialog->priv->rect_r_units_label, + "rect_x_waste_units_label", &dialog->priv->rect_x_waste_units_label, + "rect_y_waste_units_label", &dialog->priv->rect_y_waste_units_label, + "rect_margin_units_label", &dialog->priv->rect_margin_units_label, + NULL); - g_object_unref (gui); + dialog->priv->rect_size_page_gui = gui; gtk_assistant_append_page (GTK_ASSISTANT (dialog), @@ -697,6 +795,8 @@ construct_rect_size_page (glTemplateDesigner *dialog, DEFAULT_RECT_WASTE * dialog->priv->units_per_point); gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->rect_margin_spin), DEFAULT_MARGIN * dialog->priv->units_per_point); + + gl_debug (DEBUG_TEMPLATE, "END"); } /*--------------------------------------------------------------------------*/ @@ -706,27 +806,34 @@ static void construct_round_size_page (glTemplateDesigner *dialog, GdkPixbuf *logo) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; GdkPixbuf *pixbuf; - gui = glade_xml_new (GLABELS_GLADE_DIR "template-designer.glade", - "round_size_page", NULL); - if (!gui) - { - g_critical ("Could not open template-designer.glade. gLabels may not be installed correctly!"); - return; - } + gl_debug (DEBUG_TEMPLATE, "START"); + + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "template-designer-round-size-page.builder", + &error); + if (error) { + g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); + g_error_free (error); + return; + } - dialog->priv->round_size_page = glade_xml_get_widget (gui, "round_size_page"); - dialog->priv->round_image = glade_xml_get_widget (gui, "round_image"); - dialog->priv->round_r_spin = glade_xml_get_widget (gui, "round_r_spin"); - dialog->priv->round_waste_spin = glade_xml_get_widget (gui, "round_waste_spin"); - dialog->priv->round_margin_spin = glade_xml_get_widget (gui, "round_margin_spin"); - dialog->priv->round_r_units_label = glade_xml_get_widget (gui, "round_r_units_label"); - dialog->priv->round_waste_units_label = glade_xml_get_widget (gui, "round_waste_units_label"); - dialog->priv->round_margin_units_label = glade_xml_get_widget (gui, "round_margin_units_label"); + gl_util_get_builder_widgets (gui, + "round_size_page", &dialog->priv->round_size_page, + "round_image", &dialog->priv->round_image, + "round_r_spin", &dialog->priv->round_r_spin, + "round_waste_spin", &dialog->priv->round_waste_spin, + "round_margin_spin", &dialog->priv->round_margin_spin, + "round_r_units_label", &dialog->priv->round_r_units_label, + "round_waste_units_label", &dialog->priv->round_waste_units_label, + "round_margin_units_label", &dialog->priv->round_margin_units_label, + NULL); - g_object_unref (gui); + dialog->priv->round_size_page_gui = gui; gtk_assistant_append_page (GTK_ASSISTANT (dialog), @@ -774,6 +881,7 @@ construct_round_size_page (glTemplateDesigner *dialog, gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->round_margin_spin), DEFAULT_MARGIN * dialog->priv->units_per_point); + gl_debug (DEBUG_TEMPLATE, "END"); } /*--------------------------------------------------------------------------*/ @@ -783,33 +891,40 @@ static void construct_cd_size_page (glTemplateDesigner *dialog, GdkPixbuf *logo) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; GdkPixbuf *pixbuf; - gui = glade_xml_new (GLABELS_GLADE_DIR "template-designer.glade", - "cd_size_page", NULL); - if (!gui) - { - g_critical ("Could not open template-designer.glade. gLabels may not be installed correctly!"); - return; - } + gl_debug (DEBUG_TEMPLATE, "START"); - dialog->priv->cd_size_page = glade_xml_get_widget (gui, "cd_size_page"); - dialog->priv->cd_image = glade_xml_get_widget (gui, "cd_image"); - dialog->priv->cd_radius_spin = glade_xml_get_widget (gui, "cd_radius_spin"); - dialog->priv->cd_hole_spin = glade_xml_get_widget (gui, "cd_hole_spin"); - dialog->priv->cd_w_spin = glade_xml_get_widget (gui, "cd_w_spin"); - dialog->priv->cd_h_spin = glade_xml_get_widget (gui, "cd_h_spin"); - dialog->priv->cd_waste_spin = glade_xml_get_widget (gui, "cd_waste_spin"); - dialog->priv->cd_margin_spin = glade_xml_get_widget (gui, "cd_margin_spin"); - dialog->priv->cd_radius_units_label = glade_xml_get_widget (gui, "cd_radius_units_label"); - dialog->priv->cd_hole_units_label = glade_xml_get_widget (gui, "cd_hole_units_label"); - dialog->priv->cd_w_units_label = glade_xml_get_widget (gui, "cd_w_units_label"); - dialog->priv->cd_h_units_label = glade_xml_get_widget (gui, "cd_h_units_label"); - dialog->priv->cd_waste_units_label = glade_xml_get_widget (gui, "cd_waste_units_label"); - dialog->priv->cd_margin_units_label = glade_xml_get_widget (gui, "cd_margin_units_label"); + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "template-designer-cd-size-page.builder", + &error); + if (error) { + g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); + g_error_free (error); + return; + } - g_object_unref (gui); + gl_util_get_builder_widgets (gui, + "cd_size_page", &dialog->priv->cd_size_page, + "cd_image", &dialog->priv->cd_image, + "cd_radius_spin", &dialog->priv->cd_radius_spin, + "cd_hole_spin", &dialog->priv->cd_hole_spin, + "cd_w_spin", &dialog->priv->cd_w_spin, + "cd_h_spin", &dialog->priv->cd_h_spin, + "cd_waste_spin", &dialog->priv->cd_waste_spin, + "cd_margin_spin", &dialog->priv->cd_margin_spin, + "cd_radius_units_label", &dialog->priv->cd_radius_units_label, + "cd_hole_units_label", &dialog->priv->cd_hole_units_label, + "cd_w_units_label", &dialog->priv->cd_w_units_label, + "cd_h_units_label", &dialog->priv->cd_h_units_label, + "cd_waste_units_label", &dialog->priv->cd_waste_units_label, + "cd_margin_units_label", &dialog->priv->cd_margin_units_label, + NULL); + + dialog->priv->cd_size_page_gui = gui; gtk_assistant_append_page (GTK_ASSISTANT (dialog), @@ -877,6 +992,7 @@ construct_cd_size_page (glTemplateDesigner *dialog, gtk_spin_button_set_value (GTK_SPIN_BUTTON(dialog->priv->cd_margin_spin), DEFAULT_MARGIN * dialog->priv->units_per_point); + gl_debug (DEBUG_TEMPLATE, "END"); } /*--------------------------------------------------------------------------*/ @@ -886,23 +1002,30 @@ static void construct_nlayouts_page (glTemplateDesigner *dialog, GdkPixbuf *logo) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; GdkPixbuf *pixbuf; - gui = glade_xml_new (GLABELS_GLADE_DIR "template-designer.glade", - "nlayouts_page", NULL); - if (!gui) - { - g_critical ("Could not open template-designer.glade. gLabels may not be installed correctly!"); - return; - } + gl_debug (DEBUG_TEMPLATE, "START"); + + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "template-designer-nlayouts-page.builder", + &error); + if (error) { + g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); + g_error_free (error); + return; + } - dialog->priv->nlayouts_page = glade_xml_get_widget (gui, "nlayouts_page"); - dialog->priv->nlayouts_image1 = glade_xml_get_widget (gui, "nlayouts_image1"); - dialog->priv->nlayouts_image2 = glade_xml_get_widget (gui, "nlayouts_image2"); - dialog->priv->nlayouts_spin = glade_xml_get_widget (gui, "nlayouts_spin"); + gl_util_get_builder_widgets (gui, + "nlayouts_page", &dialog->priv->nlayouts_page, + "nlayouts_image1", &dialog->priv->nlayouts_image1, + "nlayouts_image2", &dialog->priv->nlayouts_image2, + "nlayouts_spin", &dialog->priv->nlayouts_spin, + NULL); - g_object_unref (gui); + dialog->priv->nlayouts_page_gui = gui; gtk_assistant_append_page (GTK_ASSISTANT (dialog), @@ -924,6 +1047,7 @@ construct_nlayouts_page (glTemplateDesigner *dialog, pixbuf = gdk_pixbuf_new_from_file (EX_NLAYOUTS_IMAGE2, NULL); gtk_image_set_from_pixbuf (GTK_IMAGE(dialog->priv->nlayouts_image2), pixbuf); + gl_debug (DEBUG_TEMPLATE, "END"); } /*--------------------------------------------------------------------------*/ @@ -933,40 +1057,50 @@ static void construct_layout_page (glTemplateDesigner *dialog, GdkPixbuf *logo) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; - gui = glade_xml_new (GLABELS_GLADE_DIR "template-designer.glade", - "layout_page", NULL); - if (!gui) - { - g_critical ("Could not open template-designer.glade. gLabels may not be installed correctly!"); - return; - } + gl_debug (DEBUG_TEMPLATE, "START"); - dialog->priv->layout_page = glade_xml_get_widget (gui, "layout_page"); - dialog->priv->layout1_head_label = glade_xml_get_widget (gui, "layout1_head_label"); - dialog->priv->layout1_nx_spin = glade_xml_get_widget (gui, "layout1_nx_spin"); - dialog->priv->layout1_ny_spin = glade_xml_get_widget (gui, "layout1_ny_spin"); - dialog->priv->layout1_x0_spin = glade_xml_get_widget (gui, "layout1_x0_spin"); - dialog->priv->layout1_y0_spin = glade_xml_get_widget (gui, "layout1_y0_spin"); - dialog->priv->layout1_dx_spin = glade_xml_get_widget (gui, "layout1_dx_spin"); - dialog->priv->layout1_dy_spin = glade_xml_get_widget (gui, "layout1_dy_spin"); - dialog->priv->layout2_head_label = glade_xml_get_widget (gui, "layout2_head_label"); - dialog->priv->layout2_nx_spin = glade_xml_get_widget (gui, "layout2_nx_spin"); - dialog->priv->layout2_ny_spin = glade_xml_get_widget (gui, "layout2_ny_spin"); - dialog->priv->layout2_x0_spin = glade_xml_get_widget (gui, "layout2_x0_spin"); - dialog->priv->layout2_y0_spin = glade_xml_get_widget (gui, "layout2_y0_spin"); - dialog->priv->layout2_dx_spin = glade_xml_get_widget (gui, "layout2_dx_spin"); - dialog->priv->layout2_dy_spin = glade_xml_get_widget (gui, "layout2_dy_spin"); - dialog->priv->layout_x0_units_label = glade_xml_get_widget (gui, "layout_x0_units_label"); - dialog->priv->layout_y0_units_label = glade_xml_get_widget (gui, "layout_y0_units_label"); - dialog->priv->layout_dx_units_label = glade_xml_get_widget (gui, "layout_dx_units_label"); - dialog->priv->layout_dy_units_label = glade_xml_get_widget (gui, "layout_dy_units_label"); - dialog->priv->layout_mini_preview = glade_xml_get_widget (gui, "layout_mini_preview"); - dialog->priv->layout_test_button = glade_xml_get_widget (gui, "layout_test_button"); - - g_object_unref (gui); + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "template-designer-layout-page.builder", + &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 (gui, + "layout_page", &dialog->priv->layout_page, + "layout1_head_label", &dialog->priv->layout1_head_label, + "layout1_nx_spin", &dialog->priv->layout1_nx_spin, + "layout1_ny_spin", &dialog->priv->layout1_ny_spin, + "layout1_x0_spin", &dialog->priv->layout1_x0_spin, + "layout1_y0_spin", &dialog->priv->layout1_y0_spin, + "layout1_dx_spin", &dialog->priv->layout1_dx_spin, + "layout1_dy_spin", &dialog->priv->layout1_dy_spin, + "layout2_head_label", &dialog->priv->layout2_head_label, + "layout2_nx_spin", &dialog->priv->layout2_nx_spin, + "layout2_ny_spin", &dialog->priv->layout2_ny_spin, + "layout2_x0_spin", &dialog->priv->layout2_x0_spin, + "layout2_y0_spin", &dialog->priv->layout2_y0_spin, + "layout2_dx_spin", &dialog->priv->layout2_dx_spin, + "layout2_dy_spin", &dialog->priv->layout2_dy_spin, + "layout_x0_units_label", &dialog->priv->layout_x0_units_label, + "layout_y0_units_label", &dialog->priv->layout_y0_units_label, + "layout_dx_units_label", &dialog->priv->layout_dx_units_label, + "layout_dy_units_label", &dialog->priv->layout_dy_units_label, + "mini_preview_vbox", &dialog->priv->mini_preview_vbox, + "layout_test_button", &dialog->priv->layout_test_button, + NULL); + + dialog->priv->layout_page_gui = gui; + + dialog->priv->layout_mini_preview = gl_wdgt_mini_preview_new (175, 200); + gtk_container_add (GTK_CONTAINER (dialog->priv->mini_preview_vbox), + dialog->priv->layout_mini_preview); gtk_assistant_append_page (GTK_ASSISTANT (dialog), dialog->priv->layout_page); @@ -1055,6 +1189,7 @@ construct_layout_page (glTemplateDesigner *dialog, g_signal_connect_swapped (G_OBJECT(dialog->priv->layout_test_button), "clicked", G_CALLBACK(print_test_cb), dialog); + gl_debug (DEBUG_TEMPLATE, "END"); } /*--------------------------------------------------------------------------*/ @@ -1064,19 +1199,26 @@ static void construct_finish_page (glTemplateDesigner *dialog, GdkPixbuf *logo) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; - gui = glade_xml_new (GLABELS_GLADE_DIR "template-designer.glade", - "finish_page", NULL); - if (!gui) - { - g_critical ("Could not open template-designer.glade. gLabels may not be installed correctly!"); - return; - } + gl_debug (DEBUG_TEMPLATE, "START"); - dialog->priv->finish_page = glade_xml_get_widget (gui, "finish_page"); + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "template-designer-finish-page.builder", + &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 (gui, + "finish_page", &dialog->priv->finish_page, + NULL); - g_object_unref (gui); + dialog->priv->finish_page_gui = gui; gtk_assistant_append_page (GTK_ASSISTANT (dialog), @@ -1095,6 +1237,7 @@ construct_finish_page (glTemplateDesigner *dialog, dialog->priv->finish_page, TRUE); + gl_debug (DEBUG_TEMPLATE, "END"); } /*--------------------------------------------------------------------------*/ @@ -1740,19 +1883,3 @@ build_template (glTemplateDesigner *dialog) return template; } -/*****************************************************************************/ -/* Construct mini preview widget. */ -/*****************************************************************************/ -GtkWidget * -gl_template_designer_construct_mini_preview (gchar *name, - gchar *string1, - gchar *string2, - gint int1, - gint int2) -{ - gint width = int1; - gint height = int2; - - return gl_wdgt_mini_preview_new (height, width); -} - diff --git a/glabels2/src/template-designer.h b/glabels2/src/template-designer.h index bf5086ae..889b52a7 100644 --- a/glabels2/src/template-designer.h +++ b/glabels2/src/template-designer.h @@ -60,13 +60,6 @@ GType gl_template_designer_get_type (void) G_GNUC_CONST; GtkWidget *gl_template_designer_new (GtkWindow *parent); -/* Semi-public, for use by libglade: */ -GtkWidget *gl_template_designer_construct_mini_preview (gchar *name, - gchar *string1, - gchar *string2, - gint int1, - gint int2); - G_END_DECLS diff --git a/glabels2/src/ui-property-bar.c b/glabels2/src/ui-property-bar.c index 891aeacb..98d23305 100644 --- a/glabels2/src/ui-property-bar.c +++ b/glabels2/src/ui-property-bar.c @@ -5,7 +5,7 @@ * * property-bar.c: gLabels property bar * - * Copyright (C) 2003 Jim Evins . + * Copyright (C) 2003-2008 Jim Evins . * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ #include "ui-property-bar.h" #include -#include +#include #include #include #include @@ -43,10 +43,12 @@ #include "debug.h" + /*===========================================================================*/ /* Private macros and constants. */ /*===========================================================================*/ + /*===========================================================================*/ /* Private data types */ /*===========================================================================*/ @@ -55,7 +57,7 @@ struct _glUIPropertyBarPrivate { glView *view; - GladeXML *gui; + GtkBuilder *gui; GtkWidget *tool_bar; @@ -71,9 +73,12 @@ struct _glUIPropertyBarPrivate { GtkWidget *text_align_right_radio; /* Color combos */ + GtkWidget *text_color_eventbox; GtkWidget *text_color_combo; GtkWidget *fill_color_combo; + GtkWidget *fill_color_eventbox; GtkWidget *line_color_combo; + GtkWidget *line_color_eventbox; /* Line width */ GtkWidget *line_width_spin; @@ -87,70 +92,73 @@ struct _glUIPropertyBarPrivate { /* Private globals */ /*===========================================================================*/ + /*===========================================================================*/ /* Local function prototypes */ /*===========================================================================*/ static void gl_ui_property_bar_finalize (GObject *object); -static void gl_ui_property_bar_construct (glUIPropertyBar *property_bar); +static void gl_ui_property_bar_construct (glUIPropertyBar *this); -static void selection_changed_cb (glUIPropertyBar *property_bar); +static void selection_changed_cb (glUIPropertyBar *this); static void font_family_changed_cb (GtkComboBox *combo, - glUIPropertyBar *property_bar); + glUIPropertyBar *this); static void font_size_changed_cb (GtkSpinButton *spin, - glUIPropertyBar *property_bar); + glUIPropertyBar *this); static void text_color_changed_cb (glColorCombo *cc, guint color, gboolean is_default, - glUIPropertyBar *property_bar); + glUIPropertyBar *this); static void fill_color_changed_cb (glColorCombo *cc, guint color, gboolean is_default, - glUIPropertyBar *property_bar); + glUIPropertyBar *this); static void line_color_changed_cb (glColorCombo *cc, guint color, gboolean is_default, - glUIPropertyBar *property_bar); + glUIPropertyBar *this); static void line_width_changed_cb (GtkSpinButton *spin, - glUIPropertyBar *property_bar); + glUIPropertyBar *this); static void font_bold_toggled_cb (GtkToggleToolButton *toggle, - glUIPropertyBar *property_bar); + glUIPropertyBar *this); static void font_italic_toggled_cb (GtkToggleToolButton *toggle, - glUIPropertyBar *property_bar); + glUIPropertyBar *this); static void text_align_toggled_cb (GtkToggleToolButton *toggle, - glUIPropertyBar *property_bar); + glUIPropertyBar *this); -static void set_doc_items_sensitive (glUIPropertyBar *property_bar, +static void set_doc_items_sensitive (glUIPropertyBar *this, gboolean state); -static void set_text_items_sensitive (glUIPropertyBar *property_bar, +static void set_text_items_sensitive (glUIPropertyBar *this, gboolean state); -static void set_fill_items_sensitive (glUIPropertyBar *property_bar, +static void set_fill_items_sensitive (glUIPropertyBar *this, gboolean state); -static void set_line_color_items_sensitive (glUIPropertyBar *property_bar, +static void set_line_color_items_sensitive (glUIPropertyBar *this, gboolean state); -static void set_line_width_items_sensitive (glUIPropertyBar *property_bar, +static void set_line_width_items_sensitive (glUIPropertyBar *this, gboolean state); - + + /****************************************************************************/ /* Boilerplate Object stuff. */ /****************************************************************************/ G_DEFINE_TYPE (glUIPropertyBar, gl_ui_property_bar, GTK_TYPE_HBOX); + static void gl_ui_property_bar_class_init (glUIPropertyBarClass *class) { @@ -165,120 +173,154 @@ gl_ui_property_bar_class_init (glUIPropertyBarClass *class) gl_debug (DEBUG_PROPERTY_BAR, "END"); } + static void -gl_ui_property_bar_init (glUIPropertyBar *property_bar) +gl_ui_property_bar_init (glUIPropertyBar *this) { gl_debug (DEBUG_PROPERTY_BAR, "START"); - property_bar->priv = g_new0 (glUIPropertyBarPrivate, 1); + this->priv = g_new0 (glUIPropertyBarPrivate, 1); gl_debug (DEBUG_PROPERTY_BAR, "END"); } + static void gl_ui_property_bar_finalize (GObject *object) { - glUIPropertyBar *property_bar = GL_UI_PROPERTY_BAR (object); + glUIPropertyBar *this = GL_UI_PROPERTY_BAR (object); gl_debug (DEBUG_PROPERTY_BAR, "START"); g_return_if_fail (object != NULL); g_return_if_fail (GL_IS_UI_PROPERTY_BAR (object)); - if (property_bar->priv->view) + if (this->priv->view) { - g_object_unref (G_OBJECT(property_bar->priv->view)); + g_object_unref (G_OBJECT(this->priv->view)); } - if (property_bar->priv->gui) + if (this->priv->gui) { - g_object_unref (G_OBJECT(property_bar->priv->gui)); + g_object_unref (G_OBJECT(this->priv->gui)); } - g_free (property_bar->priv); + g_free (this->priv); G_OBJECT_CLASS (gl_ui_property_bar_parent_class)->finalize (object); gl_debug (DEBUG_PROPERTY_BAR, "END"); } + /****************************************************************************/ /* Create a NEW property_bar. */ /****************************************************************************/ GtkWidget * gl_ui_property_bar_new (void) { - glUIPropertyBar *property_bar; + glUIPropertyBar *this; gl_debug (DEBUG_PROPERTY_BAR, "START"); - property_bar = g_object_new (GL_TYPE_UI_PROPERTY_BAR, NULL); + this = g_object_new (GL_TYPE_UI_PROPERTY_BAR, NULL); - gl_ui_property_bar_construct (property_bar); + gl_ui_property_bar_construct (this); gl_debug (DEBUG_PROPERTY_BAR, "END"); - return GTK_WIDGET (property_bar); + return GTK_WIDGET (this); } + /******************************************************************************/ /* Initialize property toolbar. */ /******************************************************************************/ static void -gl_ui_property_bar_construct (glUIPropertyBar *property_bar) +gl_ui_property_bar_construct (glUIPropertyBar *this) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; GList *family_names = NULL; GList *family_node; + GdkPixbuf *pixbuf = NULL; gl_debug (DEBUG_PROPERTY_BAR, "START"); - property_bar->priv->stop_signals = TRUE; - - gui = glade_xml_new (GLABELS_GLADE_DIR "property-bar.glade", - "property_toolbar", NULL); + this->priv->stop_signals = TRUE; - if (!gui) - { - g_critical ("Could not open property-bar.glade. gLabels may not be installed correctly!"); + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "property-bar.builder", + &error); + if (error) { + g_critical ("%s\n\ngLabels may not be installed correctly!", error->message); + g_error_free (error); return; } - property_bar->priv->tool_bar = glade_xml_get_widget (gui, "property_toolbar"); - gtk_container_add (GTK_CONTAINER (property_bar), property_bar->priv->tool_bar); - - property_bar->priv->font_family_combo = - glade_xml_get_widget (gui, "font_family_combo"); - property_bar->priv->font_size_spin = - glade_xml_get_widget (gui, "font_size_spin"); - property_bar->priv->font_bold_toggle = - glade_xml_get_widget (gui, "font_bold_toggle"); - property_bar->priv->font_italic_toggle = - glade_xml_get_widget (gui, "font_italic_toggle"); - property_bar->priv->text_align_left_radio = - glade_xml_get_widget (gui, "text_align_left_radio"); - property_bar->priv->text_align_center_radio = - glade_xml_get_widget (gui, "text_align_center_radio"); - property_bar->priv->text_align_right_radio = - glade_xml_get_widget (gui, "text_align_right_radio"); - property_bar->priv->text_color_combo = - glade_xml_get_widget (gui, "text_color_combo"); - property_bar->priv->fill_color_combo = - glade_xml_get_widget (gui, "fill_color_combo"); - property_bar->priv->line_color_combo = - glade_xml_get_widget (gui, "line_color_combo"); - property_bar->priv->line_width_spin = - glade_xml_get_widget (gui, "line_width_spin"); + gl_util_get_builder_widgets (gui, + "property_toolbar", &this->priv->tool_bar, + "font_family_combo", &this->priv->font_family_combo, + "font_size_spin", &this->priv->font_size_spin, + "font_bold_toggle", &this->priv->font_bold_toggle, + "font_italic_toggle", &this->priv->font_italic_toggle, + "text_align_left_radio", &this->priv->text_align_left_radio, + "text_align_center_radio", &this->priv->text_align_center_radio, + "text_align_right_radio", &this->priv->text_align_right_radio, + "text_color_eventbox", &this->priv->text_color_eventbox, + "fill_color_eventbox", &this->priv->fill_color_eventbox, + "line_color_eventbox", &this->priv->line_color_eventbox, + "line_width_spin", &this->priv->line_width_spin, + NULL); + + gtk_container_add (GTK_CONTAINER (this), this->priv->tool_bar); + + pixbuf = gdk_pixbuf_new_from_inline (-1, stock_text_24, FALSE, NULL); + this->priv->text_color_combo = + gl_color_combo_new (pixbuf, + _("Default"), + GL_COLOR_TEXT_DEFAULT, + gl_prefs->default_text_color); + gl_color_combo_set_relief (GL_COLOR_COMBO(this->priv->text_color_combo), + GTK_RELIEF_NONE); + g_object_unref (G_OBJECT (pixbuf)); + gtk_container_add (GTK_CONTAINER (this->priv->text_color_eventbox), + this->priv->text_color_combo); + + pixbuf = gdk_pixbuf_new_from_inline (-1, stock_bucket_fill_24, FALSE, NULL); + this->priv->fill_color_combo = + gl_color_combo_new (pixbuf, + _("No Fill"), + GL_COLOR_NO_FILL, + gl_prefs->default_fill_color); + gl_color_combo_set_relief (GL_COLOR_COMBO(this->priv->fill_color_combo), + GTK_RELIEF_NONE); + g_object_unref (G_OBJECT (pixbuf)); + gtk_container_add (GTK_CONTAINER (this->priv->fill_color_eventbox), + this->priv->fill_color_combo); + + pixbuf = gdk_pixbuf_new_from_inline (-1, stock_pencil_24, FALSE, NULL); + this->priv->line_color_combo = + gl_color_combo_new (pixbuf, + _("No Line"), + GL_COLOR_NO_LINE, + gl_prefs->default_line_color); + gl_color_combo_set_relief (GL_COLOR_COMBO(this->priv->line_color_combo), + GTK_RELIEF_NONE); + g_object_unref (G_OBJECT (pixbuf)); + gtk_container_add (GTK_CONTAINER (this->priv->line_color_eventbox), + this->priv->line_color_combo); /* Save reference to gui tree so we don't lose tooltips */ - property_bar->priv->gui = gui; + this->priv->gui = gui; - set_doc_items_sensitive (property_bar, FALSE); + set_doc_items_sensitive (this, FALSE); /* Font family entry widget */ - gl_util_combo_box_add_text_model (GTK_COMBO_BOX (property_bar->priv->font_family_combo)); + gl_util_combo_box_add_text_model (GTK_COMBO_BOX (this->priv->font_family_combo)); family_names = gl_util_get_font_family_list (); - gl_util_combo_box_set_strings (GTK_COMBO_BOX (property_bar->priv->font_family_combo), + gl_util_combo_box_set_strings (GTK_COMBO_BOX (this->priv->font_family_combo), family_names); - gtk_widget_set_size_request (property_bar->priv->font_family_combo, 200, -1); + gtk_widget_set_size_request (this->priv->font_family_combo, 200, -1); /* Make sure we have a valid font. if not provide a good default. */ family_node = g_list_find_custom (family_names, @@ -286,86 +328,87 @@ gl_ui_property_bar_construct (glUIPropertyBar *property_bar) (GCompareFunc)g_utf8_collate); if (family_node) { - gtk_combo_box_set_active (GTK_COMBO_BOX (property_bar->priv->font_family_combo), + gtk_combo_box_set_active (GTK_COMBO_BOX (this->priv->font_family_combo), g_list_position (family_names, family_node)); } else { - gtk_combo_box_set_active (GTK_COMBO_BOX (property_bar->priv->font_family_combo), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (this->priv->font_family_combo), 0); } gl_util_font_family_list_free (family_names); - g_signal_connect (G_OBJECT (property_bar->priv->font_family_combo), - "changed", G_CALLBACK (font_family_changed_cb), property_bar); + g_signal_connect (G_OBJECT (this->priv->font_family_combo), + "changed", G_CALLBACK (font_family_changed_cb), this); /* Font size entry widget */ - gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->priv->font_size_spin), + gtk_spin_button_set_value (GTK_SPIN_BUTTON(this->priv->font_size_spin), gl_prefs->default_font_size); - g_signal_connect (G_OBJECT (property_bar->priv->font_size_spin), - "changed", G_CALLBACK (font_size_changed_cb), property_bar); + g_signal_connect (G_OBJECT (this->priv->font_size_spin), + "changed", G_CALLBACK (font_size_changed_cb), this); /* Bold and Italic toggles */ - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle), + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->font_bold_toggle), (gl_prefs->default_font_weight == PANGO_WEIGHT_BOLD)); - g_signal_connect (G_OBJECT (property_bar->priv->font_bold_toggle), - "toggled", G_CALLBACK (font_bold_toggled_cb), property_bar); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_italic_toggle), + g_signal_connect (G_OBJECT (this->priv->font_bold_toggle), + "toggled", G_CALLBACK (font_bold_toggled_cb), this); + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->font_italic_toggle), gl_prefs->default_font_italic_flag); - g_signal_connect (G_OBJECT (property_bar->priv->font_italic_toggle), - "toggled", G_CALLBACK (font_italic_toggled_cb), property_bar); + g_signal_connect (G_OBJECT (this->priv->font_italic_toggle), + "toggled", G_CALLBACK (font_italic_toggled_cb), this); /* Text alignment radio group */ - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio), + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->text_align_left_radio), (gl_prefs->default_text_alignment == PANGO_ALIGN_LEFT)); - g_signal_connect (G_OBJECT (property_bar->priv->text_align_left_radio), - "toggled", G_CALLBACK (text_align_toggled_cb), property_bar); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio), + g_signal_connect (G_OBJECT (this->priv->text_align_left_radio), + "toggled", G_CALLBACK (text_align_toggled_cb), this); + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->text_align_center_radio), (gl_prefs->default_text_alignment == PANGO_ALIGN_CENTER)); - g_signal_connect (G_OBJECT (property_bar->priv->text_align_center_radio), - "toggled", G_CALLBACK (text_align_toggled_cb), property_bar); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio), + g_signal_connect (G_OBJECT (this->priv->text_align_center_radio), + "toggled", G_CALLBACK (text_align_toggled_cb), this); + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->text_align_right_radio), (gl_prefs->default_text_alignment == PANGO_ALIGN_RIGHT)); - g_signal_connect (G_OBJECT (property_bar->priv->text_align_right_radio), - "toggled", G_CALLBACK (text_align_toggled_cb), property_bar); + g_signal_connect (G_OBJECT (this->priv->text_align_right_radio), + "toggled", G_CALLBACK (text_align_toggled_cb), this); /* Text color widget */ - gl_color_combo_set_color (GL_COLOR_COMBO (property_bar->priv->text_color_combo), gl_prefs->default_text_color); - g_signal_connect (G_OBJECT (property_bar->priv->text_color_combo), + gl_color_combo_set_color (GL_COLOR_COMBO (this->priv->text_color_combo), gl_prefs->default_text_color); + g_signal_connect (G_OBJECT (this->priv->text_color_combo), "color_changed", - G_CALLBACK (text_color_changed_cb), property_bar); + G_CALLBACK (text_color_changed_cb), this); /* Fill color widget */ - gl_color_combo_set_color (GL_COLOR_COMBO (property_bar->priv->fill_color_combo), gl_prefs->default_fill_color); - g_signal_connect (G_OBJECT (property_bar->priv->fill_color_combo), + gl_color_combo_set_color (GL_COLOR_COMBO (this->priv->fill_color_combo), gl_prefs->default_fill_color); + g_signal_connect (G_OBJECT (this->priv->fill_color_combo), "color_changed", - G_CALLBACK (fill_color_changed_cb), property_bar); + G_CALLBACK (fill_color_changed_cb), this); /* Line color widget */ - gl_color_combo_set_color (GL_COLOR_COMBO (property_bar->priv->line_color_combo), gl_prefs->default_line_color); - g_signal_connect (G_OBJECT (property_bar->priv->line_color_combo), + gl_color_combo_set_color (GL_COLOR_COMBO (this->priv->line_color_combo), gl_prefs->default_line_color); + g_signal_connect (G_OBJECT (this->priv->line_color_combo), "color_changed", - G_CALLBACK (line_color_changed_cb), property_bar); + G_CALLBACK (line_color_changed_cb), this); /* Line width entry widget */ - g_signal_connect (G_OBJECT (property_bar->priv->line_width_spin), + g_signal_connect (G_OBJECT (this->priv->line_width_spin), "changed", - G_CALLBACK (line_width_changed_cb), property_bar); + G_CALLBACK (line_width_changed_cb), this); - property_bar->priv->stop_signals = FALSE; + this->priv->stop_signals = FALSE; gl_debug (DEBUG_PROPERTY_BAR, "END"); } + /****************************************************************************/ /* Fill widgets with default values. */ /****************************************************************************/ static void reset_to_default_properties (glView *view, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { GList *family_names; gchar *good_font_family; @@ -389,41 +432,42 @@ reset_to_default_properties (glView *view, good_font_family = NULL; } } - gl_util_combo_box_set_active_text (GTK_COMBO_BOX (property_bar->priv->font_family_combo), + gl_util_combo_box_set_active_text (GTK_COMBO_BOX (this->priv->font_family_combo), good_font_family); g_free (good_font_family); gl_util_font_family_list_free (family_names); - gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->priv->font_size_spin), + gtk_spin_button_set_value (GTK_SPIN_BUTTON(this->priv->font_size_spin), view->default_font_size); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle), + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->font_bold_toggle), (view->default_font_weight == PANGO_WEIGHT_BOLD)); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_italic_toggle), + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->font_italic_toggle), view->default_font_italic_flag); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio), + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->text_align_left_radio), (view->default_text_alignment == PANGO_ALIGN_LEFT)); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio), + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->text_align_center_radio), (view->default_text_alignment == PANGO_ALIGN_CENTER)); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio), + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->text_align_right_radio), (view->default_text_alignment == PANGO_ALIGN_RIGHT)); - gl_color_combo_set_color (GL_COLOR_COMBO(property_bar->priv->text_color_combo), view->default_text_color); + gl_color_combo_set_color (GL_COLOR_COMBO(this->priv->text_color_combo), view->default_text_color); - gl_color_combo_set_color (GL_COLOR_COMBO(property_bar->priv->fill_color_combo), view->default_fill_color); + gl_color_combo_set_color (GL_COLOR_COMBO(this->priv->fill_color_combo), view->default_fill_color); - gl_color_combo_set_color (GL_COLOR_COMBO(property_bar->priv->line_color_combo), view->default_line_color); + gl_color_combo_set_color (GL_COLOR_COMBO(this->priv->line_color_combo), view->default_line_color); - gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->priv->line_width_spin), + gtk_spin_button_set_value (GTK_SPIN_BUTTON(this->priv->line_width_spin), view->default_line_width); } + /****************************************************************************/ /* Set view associated with property_bar. */ /****************************************************************************/ void -gl_ui_property_bar_set_view (glUIPropertyBar *property_bar, +gl_ui_property_bar_set_view (glUIPropertyBar *this, glView *view) { glLabel *label; @@ -434,36 +478,37 @@ gl_ui_property_bar_set_view (glUIPropertyBar *property_bar, label = view->label; g_return_if_fail (label && GL_IS_LABEL (label)); - set_doc_items_sensitive (property_bar, TRUE); + set_doc_items_sensitive (this, TRUE); - property_bar->priv->view = GL_VIEW (g_object_ref (G_OBJECT (view))); + this->priv->view = GL_VIEW (g_object_ref (G_OBJECT (view))); - reset_to_default_properties (view, property_bar); + reset_to_default_properties (view, this); g_signal_connect_swapped (G_OBJECT(view), "selection_changed", - G_CALLBACK(selection_changed_cb), property_bar); + G_CALLBACK(selection_changed_cb), this); g_signal_connect_swapped (G_OBJECT(view->label), "changed", - G_CALLBACK(selection_changed_cb), property_bar); + G_CALLBACK(selection_changed_cb), this); gl_debug (DEBUG_PROPERTY_BAR, "END"); } + /****************************************************************************/ /** Set visiblity of property bar's tooltips. */ /****************************************************************************/ void -gl_ui_property_bar_set_tooltips (glUIPropertyBar *property_bar, +gl_ui_property_bar_set_tooltips (glUIPropertyBar *this, gboolean state) { GtkTooltipsData *data; gl_debug (DEBUG_PROPERTY_BAR, "START"); - g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR(property_bar)); + g_return_if_fail (this && GL_IS_UI_PROPERTY_BAR(this)); - /* HACK: peek into one of our widgets to get the tooltips group created by libglade. */ - data = gtk_tooltips_data_get (property_bar->priv->font_size_spin); + /* HACK: peek into one of our widgets to get the tooltips group created by builder. */ + data = gtk_tooltips_data_get (this->priv->font_size_spin); g_return_if_fail (data); if (state) @@ -478,12 +523,13 @@ gl_ui_property_bar_set_tooltips (glUIPropertyBar *property_bar, gl_debug (DEBUG_PROPERTY_BAR, "END"); } + /*---------------------------------------------------------------------------*/ /* PRIVATE. View "selection state changed" callback. */ /*---------------------------------------------------------------------------*/ static void update_text_properties (glView *view, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { gboolean can_text, is_first_object; gboolean is_same_font_family, is_same_font_size; @@ -500,7 +546,7 @@ update_text_properties (glView *view, PangoAlignment selection_align, align; can_text = gl_view_can_selection_text (view); - set_text_items_sensitive (property_bar, can_text); + set_text_items_sensitive (this, can_text); if (!can_text) return; @@ -590,7 +636,7 @@ update_text_properties (glView *view, if (is_same_font_family && (selection_font_family != NULL)) gl_debug (DEBUG_PROPERTY_BAR, "same font family = %s", selection_font_family); - gl_util_combo_box_set_active_text (GTK_COMBO_BOX (property_bar->priv->font_family_combo), + gl_util_combo_box_set_active_text (GTK_COMBO_BOX (this->priv->font_family_combo), is_same_font_family?selection_font_family:""); g_free (selection_font_family); @@ -598,18 +644,18 @@ update_text_properties (glView *view, { gl_debug (DEBUG_PROPERTY_BAR, "same font size = %g", selection_font_size); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (property_bar->priv->font_size_spin), + gtk_spin_button_set_value (GTK_SPIN_BUTTON (this->priv->font_size_spin), selection_font_size); } else { - gtk_entry_set_text (GTK_ENTRY (property_bar->priv->font_size_spin), ""); + gtk_entry_set_text (GTK_ENTRY (this->priv->font_size_spin), ""); } if (is_same_text_color) { gl_debug (DEBUG_PROPERTY_BAR, "same text color = %08x", selection_text_color); - gl_color_combo_set_color (GL_COLOR_COMBO (property_bar->priv->text_color_combo), + gl_color_combo_set_color (GL_COLOR_COMBO (this->priv->text_color_combo), selection_text_color); } @@ -618,7 +664,7 @@ update_text_properties (glView *view, gl_debug (DEBUG_PROPERTY_BAR, "same italic flag = %d", selection_is_italic); } - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_italic_toggle), + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->font_italic_toggle), selection_is_italic && is_same_is_italic); if (is_same_is_bold) @@ -626,25 +672,26 @@ update_text_properties (glView *view, gl_debug (DEBUG_PROPERTY_BAR, "same bold flag = %d", selection_is_bold); } - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle), + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->font_bold_toggle), selection_is_bold && is_same_is_bold); if (is_same_align) gl_debug (DEBUG_PROPERTY_BAR, "same align"); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio), + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->text_align_left_radio), (selection_align == PANGO_ALIGN_LEFT) && is_same_align); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio), + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->text_align_center_radio), (selection_align == PANGO_ALIGN_CENTER) && is_same_align); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio), + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->text_align_right_radio), (selection_align == PANGO_ALIGN_RIGHT) && is_same_align); } + static void update_fill_color (glView *view, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { gboolean can, is_first_object; gboolean is_same_fill_color; @@ -654,7 +701,7 @@ update_fill_color (glView *view, glColorNode *fill_color_node; can = gl_view_can_selection_fill (view); - set_fill_items_sensitive (property_bar, can); + set_fill_items_sensitive (this, can); if (!can) return; @@ -700,14 +747,15 @@ update_fill_color (glView *view, if (is_same_fill_color) { gl_debug (DEBUG_PROPERTY_BAR, "same fill color = %08x", selection_fill_color); - gl_color_combo_set_color (GL_COLOR_COMBO (property_bar->priv->fill_color_combo), + gl_color_combo_set_color (GL_COLOR_COMBO (this->priv->fill_color_combo), selection_fill_color); } } + static void update_line_color (glView *view, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { gboolean can, is_first_object; gboolean is_same_line_color; @@ -717,7 +765,7 @@ update_line_color (glView *view, glColorNode *line_color_node; can = gl_view_can_selection_line_color (view); - set_line_color_items_sensitive (property_bar, can); + set_line_color_items_sensitive (this, can); if (!can) return; @@ -763,14 +811,15 @@ update_line_color (glView *view, if (is_same_line_color) { gl_debug (DEBUG_PROPERTY_BAR, "same line color = %08x", selection_line_color); - gl_color_combo_set_color (GL_COLOR_COMBO (property_bar->priv->line_color_combo), + gl_color_combo_set_color (GL_COLOR_COMBO (this->priv->line_color_combo), selection_line_color); } } + static void update_line_width (glView *view, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { gboolean can, is_first_object; gboolean is_same_line_width; @@ -779,7 +828,7 @@ update_line_width (glView *view, gdouble selection_line_width, line_width; can = gl_view_can_selection_line_width (view); - set_line_width_items_sensitive (property_bar, can); + set_line_width_items_sensitive (this, can); if (!can) return; @@ -814,102 +863,106 @@ update_line_width (glView *view, if (is_same_line_width) { gl_debug (DEBUG_PROPERTY_BAR, "same line width = %g", selection_line_width); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (property_bar->priv->line_width_spin), + gtk_spin_button_set_value (GTK_SPIN_BUTTON (this->priv->line_width_spin), selection_line_width); } else { - gtk_entry_set_text (GTK_ENTRY (property_bar->priv->line_width_spin), ""); + gtk_entry_set_text (GTK_ENTRY (this->priv->line_width_spin), ""); } } + static void -selection_changed_cb (glUIPropertyBar *property_bar) +selection_changed_cb (glUIPropertyBar *this) { - glView *view = property_bar->priv->view; + glView *view = this->priv->view; g_return_if_fail (view && GL_IS_VIEW (view)); - g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar)); + g_return_if_fail (this && GL_IS_UI_PROPERTY_BAR (this)); - if (property_bar->priv->stop_signals) return; - property_bar->priv->stop_signals = TRUE; + if (this->priv->stop_signals) return; + this->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); if (gl_view_is_selection_empty (view)) { /* No selection: make all controls active. */ - reset_to_default_properties (view, property_bar); - set_doc_items_sensitive (property_bar, TRUE); + reset_to_default_properties (view, this); + set_doc_items_sensitive (this, TRUE); } else { - update_text_properties (view, property_bar); - update_fill_color (view, property_bar); - update_line_color (view, property_bar); - update_line_width (view, property_bar); + update_text_properties (view, this); + update_fill_color (view, this); + update_line_color (view, this); + update_line_width (view, this); } gl_debug (DEBUG_PROPERTY_BAR, "END"); - property_bar->priv->stop_signals = FALSE; + this->priv->stop_signals = FALSE; } + /*--------------------------------------------------------------------------*/ /* PRIVATE. Font family entry changed. */ /*--------------------------------------------------------------------------*/ static void font_family_changed_cb (GtkComboBox *combo, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { gchar *font_family; - if (property_bar->priv->stop_signals) return; - property_bar->priv->stop_signals = TRUE; + if (this->priv->stop_signals) return; + this->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); font_family = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo)); if ( strlen(font_family) ) { - gl_view_set_selection_font_family (property_bar->priv->view, + gl_view_set_selection_font_family (this->priv->view, font_family); - gl_view_set_default_font_family (property_bar->priv->view, + gl_view_set_default_font_family (this->priv->view, font_family); } g_free (font_family); gl_debug (DEBUG_PROPERTY_BAR, "END"); - property_bar->priv->stop_signals = FALSE; + this->priv->stop_signals = FALSE; } + /*--------------------------------------------------------------------------*/ /* PRIVATE. Font size spin button changed. */ /*--------------------------------------------------------------------------*/ static void font_size_changed_cb (GtkSpinButton *spin, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { gdouble font_size; - if (property_bar->priv->stop_signals) return; - property_bar->priv->stop_signals = TRUE; + if (this->priv->stop_signals) return; + this->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); font_size = gtk_spin_button_get_value (spin); - gl_view_set_selection_font_size (property_bar->priv->view, + gl_view_set_selection_font_size (this->priv->view, font_size); - gl_view_set_default_font_size (property_bar->priv->view, + gl_view_set_default_font_size (this->priv->view, font_size); gl_debug (DEBUG_PROPERTY_BAR, "END"); - property_bar->priv->stop_signals = FALSE; + this->priv->stop_signals = FALSE; } + /*--------------------------------------------------------------------------*/ /* PRIVATE. Text color combo changed. */ /*--------------------------------------------------------------------------*/ @@ -917,14 +970,14 @@ static void text_color_changed_cb (glColorCombo *cc, guint color, gboolean is_default, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { glColorNode *text_color_node; - g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar)); + g_return_if_fail (this && GL_IS_UI_PROPERTY_BAR (this)); - if (property_bar->priv->stop_signals) return; - property_bar->priv->stop_signals = TRUE; + if (this->priv->stop_signals) return; + this->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); @@ -937,16 +990,16 @@ text_color_changed_cb (glColorCombo *cc, if (is_default) { text_color_node->color = gl_prefs->default_text_color; - gl_view_set_selection_text_color (property_bar->priv->view, + gl_view_set_selection_text_color (this->priv->view, text_color_node); - gl_view_set_default_text_color (property_bar->priv->view, + gl_view_set_default_text_color (this->priv->view, gl_prefs->default_text_color); } else { - gl_view_set_selection_text_color (property_bar->priv->view, + gl_view_set_selection_text_color (this->priv->view, text_color_node); - gl_view_set_default_text_color (property_bar->priv->view, + gl_view_set_default_text_color (this->priv->view, text_color_node->color); } @@ -954,9 +1007,10 @@ text_color_changed_cb (glColorCombo *cc, gl_debug (DEBUG_PROPERTY_BAR, "END"); - property_bar->priv->stop_signals = FALSE; + this->priv->stop_signals = FALSE; } + /*--------------------------------------------------------------------------*/ /* PRIVATE. Fill color combo changed. */ /*--------------------------------------------------------------------------*/ @@ -964,14 +1018,14 @@ static void fill_color_changed_cb (glColorCombo *cc, guint color, gboolean is_default, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { glColorNode *fill_color_node; - g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar)); + g_return_if_fail (this && GL_IS_UI_PROPERTY_BAR (this)); - if (property_bar->priv->stop_signals) return; - property_bar->priv->stop_signals = TRUE; + if (this->priv->stop_signals) return; + this->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); @@ -986,25 +1040,26 @@ fill_color_changed_cb (glColorCombo *cc, { fill_color_node->color = GL_COLOR_NONE; - gl_view_set_selection_fill_color (property_bar->priv->view, + gl_view_set_selection_fill_color (this->priv->view, fill_color_node); - gl_view_set_default_fill_color (property_bar->priv->view, + gl_view_set_default_fill_color (this->priv->view, fill_color_node->color); } else { - gl_view_set_selection_fill_color (property_bar->priv->view, + gl_view_set_selection_fill_color (this->priv->view, fill_color_node); - gl_view_set_default_fill_color (property_bar->priv->view, + gl_view_set_default_fill_color (this->priv->view, fill_color_node->color); } gl_color_node_free (&fill_color_node); gl_debug (DEBUG_PROPERTY_BAR, "END"); - property_bar->priv->stop_signals = FALSE; + this->priv->stop_signals = FALSE; } + /*--------------------------------------------------------------------------*/ /* PRIVATE. Line color combo changed. */ /*--------------------------------------------------------------------------*/ @@ -1012,14 +1067,14 @@ static void line_color_changed_cb (glColorCombo *cc, guint color, gboolean is_default, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { glColorNode *line_color_node; - g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar)); + g_return_if_fail (this && GL_IS_UI_PROPERTY_BAR (this)); - if (property_bar->priv->stop_signals) return; - property_bar->priv->stop_signals = TRUE; + if (this->priv->stop_signals) return; + this->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); @@ -1032,67 +1087,69 @@ line_color_changed_cb (glColorCombo *cc, if (is_default) { line_color_node->color = GL_COLOR_NONE; - gl_view_set_selection_line_color (property_bar->priv->view, + gl_view_set_selection_line_color (this->priv->view, line_color_node); - gl_view_set_default_line_color (property_bar->priv->view, + gl_view_set_default_line_color (this->priv->view, line_color_node->color); } else { - gl_view_set_selection_line_color (property_bar->priv->view, + gl_view_set_selection_line_color (this->priv->view, line_color_node); - gl_view_set_default_line_color (property_bar->priv->view, + gl_view_set_default_line_color (this->priv->view, line_color_node->color); } gl_color_node_free (&line_color_node); gl_debug (DEBUG_PROPERTY_BAR, "END"); - property_bar->priv->stop_signals = FALSE; + this->priv->stop_signals = FALSE; } + /*--------------------------------------------------------------------------*/ /* PRIVATE. Line width spin button changed. */ /*--------------------------------------------------------------------------*/ static void line_width_changed_cb (GtkSpinButton *spin, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { gdouble line_width; - if (property_bar->priv->stop_signals) return; - property_bar->priv->stop_signals = TRUE; + if (this->priv->stop_signals) return; + this->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); - if (property_bar->priv->view) + if (this->priv->view) { line_width = gtk_spin_button_get_value (spin); - gl_view_set_selection_line_width (property_bar->priv->view, + gl_view_set_selection_line_width (this->priv->view, line_width); - gl_view_set_default_line_width (property_bar->priv->view, + gl_view_set_default_line_width (this->priv->view, line_width); } gl_debug (DEBUG_PROPERTY_BAR, "END"); - property_bar->priv->stop_signals = FALSE; + this->priv->stop_signals = FALSE; } + /*---------------------------------------------------------------------------*/ /* PRIVATE. Font bold toggled callback. */ /*---------------------------------------------------------------------------*/ static void font_bold_toggled_cb (GtkToggleToolButton *toggle, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { gboolean state; PangoWeight weight; - if (property_bar->priv->stop_signals) return; - property_bar->priv->stop_signals = TRUE; + if (this->priv->stop_signals) return; + this->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); @@ -1100,193 +1157,151 @@ font_bold_toggled_cb (GtkToggleToolButton *toggle, weight = state ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL; - gl_view_set_selection_font_weight (property_bar->priv->view, weight); - gl_view_set_default_font_weight (property_bar->priv->view, weight); + gl_view_set_selection_font_weight (this->priv->view, weight); + gl_view_set_default_font_weight (this->priv->view, weight); gl_debug (DEBUG_PROPERTY_BAR, "END"); - property_bar->priv->stop_signals = FALSE; + this->priv->stop_signals = FALSE; } + /*---------------------------------------------------------------------------*/ /* PRIVATE. Font italic toggled callback. */ /*---------------------------------------------------------------------------*/ static void font_italic_toggled_cb (GtkToggleToolButton *toggle, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { gboolean state; - if (property_bar->priv->stop_signals) return; - property_bar->priv->stop_signals = TRUE; + if (this->priv->stop_signals) return; + this->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); state = gtk_toggle_tool_button_get_active (toggle); - gl_view_set_selection_font_italic_flag (property_bar->priv->view, state); - gl_view_set_default_font_italic_flag (property_bar->priv->view, state); + gl_view_set_selection_font_italic_flag (this->priv->view, state); + gl_view_set_default_font_italic_flag (this->priv->view, state); gl_debug (DEBUG_PROPERTY_BAR, "END"); - property_bar->priv->stop_signals = FALSE; + this->priv->stop_signals = FALSE; } + /*---------------------------------------------------------------------------*/ /* PRIVATE. Text align toggled callback. */ /*---------------------------------------------------------------------------*/ static void text_align_toggled_cb (GtkToggleToolButton *toggle, - glUIPropertyBar *property_bar) + glUIPropertyBar *this) { - if (property_bar->priv->stop_signals) return; - property_bar->priv->stop_signals = TRUE; + if (this->priv->stop_signals) return; + this->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); - if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio))) + if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->text_align_left_radio))) { - gl_view_set_selection_text_alignment (property_bar->priv->view, + gl_view_set_selection_text_alignment (this->priv->view, PANGO_ALIGN_LEFT); - gl_view_set_default_text_alignment (property_bar->priv->view, + gl_view_set_default_text_alignment (this->priv->view, PANGO_ALIGN_LEFT); } - if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio))) + if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->text_align_center_radio))) { - gl_view_set_selection_text_alignment (property_bar->priv->view, + gl_view_set_selection_text_alignment (this->priv->view, PANGO_ALIGN_CENTER); - gl_view_set_default_text_alignment (property_bar->priv->view, + gl_view_set_default_text_alignment (this->priv->view, PANGO_ALIGN_CENTER); } - if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio))) + if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (this->priv->text_align_right_radio))) { - gl_view_set_selection_text_alignment (property_bar->priv->view, + gl_view_set_selection_text_alignment (this->priv->view, PANGO_ALIGN_RIGHT); - gl_view_set_default_text_alignment (property_bar->priv->view, + gl_view_set_default_text_alignment (this->priv->view, PANGO_ALIGN_RIGHT); } gl_debug (DEBUG_PROPERTY_BAR, "END"); - property_bar->priv->stop_signals = FALSE; + this->priv->stop_signals = FALSE; } -/*****************************************************************************/ -/* Construct color combo "Custom widget". */ -/*****************************************************************************/ -GtkWidget * -gl_ui_property_bar_construct_color_combo (gchar *name, - gchar *string1, - gchar *string2, - gint int1, - gint int2) -{ - GtkWidget *color_combo; - guint color; - gchar *no_color; - GdkPixbuf *pixbuf = NULL; - - switch (int1) { - - case 0: - color = gl_prefs->default_text_color; - no_color = _("Default"); - pixbuf = gdk_pixbuf_new_from_inline (-1, stock_text_24, FALSE, NULL); - break; - - case 2: - color = gl_prefs->default_line_color; - no_color = _("No line"); - pixbuf = gdk_pixbuf_new_from_inline (-1, stock_pencil_24, FALSE, NULL); - break; - - case 1: - default: - color = gl_prefs->default_fill_color; - no_color = _("No fill"); - pixbuf = gdk_pixbuf_new_from_inline (-1, stock_bucket_fill_24, FALSE, NULL); - break; - - } - - color_combo = gl_color_combo_new (pixbuf, no_color, color, color); - - gl_color_combo_set_relief (GL_COLOR_COMBO(color_combo), - GTK_RELIEF_NONE); - - g_object_unref (G_OBJECT (pixbuf)); - - return color_combo; -} - /*---------------------------------------------------------------------------*/ /* PRIVATE. Set sensitivity of doc controls. */ /*---------------------------------------------------------------------------*/ static void -set_doc_items_sensitive (glUIPropertyBar *property_bar, +set_doc_items_sensitive (glUIPropertyBar *this, gboolean state) { - gtk_widget_set_sensitive (property_bar->priv->font_family_combo, state); - gtk_widget_set_sensitive (property_bar->priv->font_size_spin, state); - gtk_widget_set_sensitive (property_bar->priv->font_bold_toggle, state); - gtk_widget_set_sensitive (property_bar->priv->font_italic_toggle, state); - gtk_widget_set_sensitive (property_bar->priv->text_align_left_radio, state); - gtk_widget_set_sensitive (property_bar->priv->text_align_center_radio, state); - gtk_widget_set_sensitive (property_bar->priv->text_align_right_radio, state); - gtk_widget_set_sensitive (property_bar->priv->text_color_combo, state); - gtk_widget_set_sensitive (property_bar->priv->fill_color_combo, state); - gtk_widget_set_sensitive (property_bar->priv->line_color_combo, state); - gtk_widget_set_sensitive (property_bar->priv->line_width_spin, state); + gtk_widget_set_sensitive (this->priv->font_family_combo, state); + gtk_widget_set_sensitive (this->priv->font_size_spin, state); + gtk_widget_set_sensitive (this->priv->font_bold_toggle, state); + gtk_widget_set_sensitive (this->priv->font_italic_toggle, state); + gtk_widget_set_sensitive (this->priv->text_align_left_radio, state); + gtk_widget_set_sensitive (this->priv->text_align_center_radio, state); + gtk_widget_set_sensitive (this->priv->text_align_right_radio, state); + gtk_widget_set_sensitive (this->priv->text_color_combo, state); + gtk_widget_set_sensitive (this->priv->fill_color_combo, state); + gtk_widget_set_sensitive (this->priv->line_color_combo, state); + gtk_widget_set_sensitive (this->priv->line_width_spin, state); } + /*---------------------------------------------------------------------------*/ /* PRIVATE. Set sensitivity of text related controls. */ /*---------------------------------------------------------------------------*/ static void -set_text_items_sensitive (glUIPropertyBar *property_bar, +set_text_items_sensitive (glUIPropertyBar *this, gboolean state) { - gtk_widget_set_sensitive (property_bar->priv->font_family_combo, state); - gtk_widget_set_sensitive (property_bar->priv->font_size_spin, state); - gtk_widget_set_sensitive (property_bar->priv->font_bold_toggle, state); - gtk_widget_set_sensitive (property_bar->priv->font_italic_toggle, state); - gtk_widget_set_sensitive (property_bar->priv->text_align_left_radio, state); - gtk_widget_set_sensitive (property_bar->priv->text_align_center_radio, state); - gtk_widget_set_sensitive (property_bar->priv->text_align_right_radio, state); - gtk_widget_set_sensitive (property_bar->priv->text_color_combo, state); + gtk_widget_set_sensitive (this->priv->font_family_combo, state); + gtk_widget_set_sensitive (this->priv->font_size_spin, state); + gtk_widget_set_sensitive (this->priv->font_bold_toggle, state); + gtk_widget_set_sensitive (this->priv->font_italic_toggle, state); + gtk_widget_set_sensitive (this->priv->text_align_left_radio, state); + gtk_widget_set_sensitive (this->priv->text_align_center_radio, state); + gtk_widget_set_sensitive (this->priv->text_align_right_radio, state); + gtk_widget_set_sensitive (this->priv->text_color_combo, state); } + /*---------------------------------------------------------------------------*/ /* PRIVATE. Set sensitivity of fill related controls. */ /*---------------------------------------------------------------------------*/ static void -set_fill_items_sensitive (glUIPropertyBar *property_bar, +set_fill_items_sensitive (glUIPropertyBar *this, gboolean state) { - gtk_widget_set_sensitive (property_bar->priv->fill_color_combo, state); + gtk_widget_set_sensitive (this->priv->fill_color_combo, state); } + /*---------------------------------------------------------------------------*/ /* PRIVATE. Set sensitivity of line color related controls. */ /*---------------------------------------------------------------------------*/ static void -set_line_color_items_sensitive (glUIPropertyBar *property_bar, +set_line_color_items_sensitive (glUIPropertyBar *this, gboolean state) { - gtk_widget_set_sensitive (property_bar->priv->line_color_combo, state); + gtk_widget_set_sensitive (this->priv->line_color_combo, state); } + /*---------------------------------------------------------------------------*/ /* PRIVATE. Set sensitivity of line width related controls. */ /*---------------------------------------------------------------------------*/ static void -set_line_width_items_sensitive (glUIPropertyBar *property_bar, +set_line_width_items_sensitive (glUIPropertyBar *this, gboolean state) { - gtk_widget_set_sensitive (property_bar->priv->line_width_spin, state); + gtk_widget_set_sensitive (this->priv->line_width_spin, state); } diff --git a/glabels2/src/ui-property-bar.h b/glabels2/src/ui-property-bar.h index e2af1912..add154f7 100644 --- a/glabels2/src/ui-property-bar.h +++ b/glabels2/src/ui-property-bar.h @@ -5,7 +5,7 @@ * * ui-property-bar.h: Property toolbar header file * - * Copyright (C) 2003 Jim Evins . + * Copyright (C) 2003-2008 Jim Evins . * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -61,10 +61,10 @@ GType gl_ui_property_bar_get_type (void) G_GNUC_CONST; GtkWidget *gl_ui_property_bar_new (void); -void gl_ui_property_bar_set_view (glUIPropertyBar *property_bar, +void gl_ui_property_bar_set_view (glUIPropertyBar *this, glView *view); -void gl_ui_property_bar_set_tooltips (glUIPropertyBar *property_bar, +void gl_ui_property_bar_set_tooltips (glUIPropertyBar *this, gboolean state); diff --git a/glabels2/src/util.c b/glabels2/src/util.c index c0e1ac0f..161f2bfc 100644 --- a/glabels2/src/util.c +++ b/glabels2/src/util.c @@ -424,3 +424,35 @@ gl_util_cairo_convert_to_pixbuf (cairo_surface_t *surface) return pixbuf; } + + +/****************************************************************************/ +/* Get widgets from GtkBuilder "en masse." */ +/****************************************************************************/ +void gl_util_get_builder_widgets (GtkBuilder *builder, + gchar *first_name, + ...) +{ + va_list args; + gchar *name; + GtkWidget **p_widget; + + va_start (args, first_name); + + for ( name = first_name; name; name = va_arg (args, gchar *) ) + { + p_widget = va_arg (args, GtkWidget **); + + *p_widget = GTK_WIDGET (gtk_builder_get_object (builder, name)); + + if (!*p_widget) + { + g_critical ("Could not load widget \"%s\".\n\ngLabels may not be installed correctly!", + name); + break; + } + } + + va_end (args); +} + diff --git a/glabels2/src/util.h b/glabels2/src/util.h index 71ac2111..267b0ef2 100644 --- a/glabels2/src/util.h +++ b/glabels2/src/util.h @@ -5,7 +5,7 @@ * * util.h: various small utility functions * - * Copyright (C) 2001-2003 Jim Evins . + * Copyright (C) 2001-2008 Jim Evins . * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ #include #include #include +#include G_BEGIN_DECLS @@ -55,6 +56,10 @@ void gl_util_font_family_list_free (GList *list); GdkPixbuf *gl_util_cairo_convert_to_pixbuf (cairo_surface_t *surface); +void gl_util_get_builder_widgets (GtkBuilder *builder, + gchar *first_name, + ...); + G_END_DECLS #endif /* __UTIL_H__ */ diff --git a/glabels2/src/wdgt-media-select.c b/glabels2/src/wdgt-media-select.c index edb469aa..ab83e799 100644 --- a/glabels2/src/wdgt-media-select.c +++ b/glabels2/src/wdgt-media-select.c @@ -27,7 +27,7 @@ #include "wdgt-media-select.h" #include -#include +#include #include #include #include @@ -62,6 +62,8 @@ enum { struct _glWdgtMediaSelectPrivate { + GtkBuilder *gui; + GtkWidget *notebook; guint current_page_num; @@ -170,6 +172,10 @@ gl_wdgt_media_select_finalize (GObject *object) g_return_if_fail (object != NULL); g_return_if_fail (GL_IS_WDGT_MEDIA_SELECT (object)); + if (media_select->priv->gui) + { + g_object_unref (media_select->priv->gui); + } g_object_unref (media_select->priv->recent_store); g_object_unref (media_select->priv->search_all_store); g_free (media_select->priv); @@ -201,7 +207,8 @@ gl_wdgt_media_select_new (void) static void gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select) { - GladeXML *gui; + GtkBuilder *gui; + GError *error = NULL; GtkWidget *hbox; GList *brands = NULL; GList *page_sizes = NULL; @@ -219,37 +226,32 @@ gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select) g_return_if_fail (GL_IS_WDGT_MEDIA_SELECT (media_select)); g_return_if_fail (media_select->priv != NULL); - gui = glade_xml_new (GLABELS_GLADE_DIR "wdgt-media-select.glade", - "wdgt_media_select_hbox", NULL); + gui = gtk_builder_new (); + gtk_builder_add_from_file (gui, + GLABELS_BUILDER_DIR "wdgt-media-select.builder", + &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 (gui, + "wdgt_media_select_hbox", &hbox, + "notebook", &media_select->priv->notebook, + + "recent_tab_vbox", &media_select->priv->recent_tab_vbox, + + "recent_treeview", &media_select->priv->recent_treeview, + "search_all_tab_vbox", &media_select->priv->search_all_tab_vbox, + "brand_combo", &media_select->priv->brand_combo, + "page_size_combo", &media_select->priv->page_size_combo, + "category_combo", &media_select->priv->category_combo, + "search_all_treeview", &media_select->priv->search_all_treeview, + NULL); - if (!gui) { - g_critical ("Could not open wdgt-media-select.glade. gLabels may not be installed correctly!"); - return; - } - - hbox = glade_xml_get_widget (gui, "wdgt_media_select_hbox"); gtk_container_add (GTK_CONTAINER (media_select), hbox); - - media_select->priv->notebook = - glade_xml_get_widget (gui, "notebook"); - - media_select->priv->recent_tab_vbox = - glade_xml_get_widget (gui, "recent_tab_vbox"); - media_select->priv->recent_treeview = - glade_xml_get_widget (gui, "recent_treeview"); - - media_select->priv->search_all_tab_vbox = - glade_xml_get_widget (gui, "search_all_tab_vbox"); - media_select->priv->brand_combo = - glade_xml_get_widget (gui, "brand_combo"); - media_select->priv->page_size_combo = - glade_xml_get_widget (gui, "page_size_combo"); - media_select->priv->category_combo = - glade_xml_get_widget (gui, "category_combo"); - media_select->priv->search_all_treeview = - glade_xml_get_widget (gui, "search_all_treeview"); - - g_object_unref (gui); + media_select->priv->gui = gui; media_select->priv->recent_page_num = gtk_notebook_page_num (GTK_NOTEBOOK (media_select->priv->notebook), -- 2.39.5