[gnumeric] Build: move more icons to embedded resources.



commit 49f206b22ff3fddb88697177176074d42ed66399
Author: Morten Welinder <terra gnome org>
Date:   Tue Mar 19 20:03:46 2013 -0400

    Build: move more icons to embedded resources.

 ChangeLog                        |   19 ++-
 configure.ac                     |    1 -
 src/Makefile.am                  |  139 ++++++++++-
 src/application.c                |  515 +++++++++++++++++++++++++++++++++++++-
 src/dialogs/dialog-cell-format.c |    3 +
 src/gui-util.c                   |   28 ++-
 src/pixmaps/.gitignore           |    3 -
 src/pixmaps/Makefile.am          |  250 ------------------
 src/wbc-gtk.c                    |  179 -------------
 9 files changed, 677 insertions(+), 460 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3978433..0413d80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,22 @@
+2013-03-19  Morten Welinder  <terra gnome org>
+
+       * src/application.c (install_icons): Install also the icon themed
+       icons.  No idea why we have both.
+
+       * src/wbc-gtk.c (wbc_gtk_setup_icons, add_icon): Remove.
+
+       * src/Makefile.am (SUBDIRS): No longer enter pixmaps.
+       (embedded_imgs): Add the rest from pixmaps.
+
+       * configure.ac: No longer create src/pixmaps/Makefile
+
+       * src/gui-util.c (gnumeric_load_image, gnumeric_load_pixbuf): Make
+       these work for resources and absolute paths.
+
 2013-03-19  Jean Brefort  <jean brefort normalesup org>
 
-       * src/sheet-control-gui.c (cb_collect_objects_to_commit): fixed not sizeable
-       objects bounds after dragging when zoom is not 100%.
+       * src/sheet-control-gui.c (cb_collect_objects_to_commit): fixed
+       not sizeable objects bounds after dragging when zoom is not 100%.
 
 2013-03-18  Morten Welinder  <terra gnome org>
 
diff --git a/configure.ac b/configure.ac
index 9ba14c8..fa55a76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1074,7 +1074,6 @@ icons/48x48/Makefile
 icons/scalable/Makefile
 src/Makefile
 src/dialogs/Makefile
-src/pixmaps/Makefile
 src/widgets/Makefile
 src/tools/Makefile
 src/cut-n-paste-code/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index a25de7e..e67de88 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,7 +25,7 @@ noinst_PROGRAMS = sstest
 noinst_HEADERS = dead-kittens.h compilation.h embedded-imgs.h gnm-i18n.h
 
 if WITH_GTK
-  SUBDIRS += pixmaps dialogs widgets
+  SUBDIRS += dialogs widgets
   bin_PROGRAMS += gnumeric
   check_PROGRAMS += test-pango
 endif
@@ -416,10 +416,57 @@ gnumeric_app_libs =                               \
        widgets/libwidgets.la
 
 embedded_imgs =                                                \
-       pixmaps/cursor_cross.xpm                        \
+       pixmaps/add_decimals.png                        \
+       pixmaps/auto-sum.xpm                            \
+       pixmaps/autofilter_16.png                       \
+       pixmaps/autofilter_24.png                       \
+       pixmaps/autofilter_delete_16.png                \
+       pixmaps/autofilter_delete_24.png                \
+       pixmaps/border_all.xpm                          \
+       pixmaps/border_bottom.xpm                       \
+       pixmaps/border_double_bottom.xpm                \
+       pixmaps/border_left.xpm                         \
+       pixmaps/border_none.xpm                         \
+       pixmaps/border_outside.xpm                      \
+       pixmaps/border_right.xpm                        \
+       pixmaps/border_thick_bottom.xpm                 \
+       pixmaps/border_thick_outside.xpm                \
+       pixmaps/border_top_n_bottom.xpm                 \
+       pixmaps/border_top_n_double_bottom.xpm          \
+       pixmaps/border_top_n_thick_bottom.xpm           \
+       pixmaps/bottom_border.xpm                       \
+       pixmaps/brush-16.png                            \
+       pixmaps/brush-22.png                            \
        pixmaps/bucket.xpm                              \
+       pixmaps/center_across_selection_16.xpm          \
+       pixmaps/center_across_selection_24.xpm          \
+       pixmaps/column_add_16.xpm                       \
+       pixmaps/column_add_24.xpm                       \
+       pixmaps/column_delete_16.xpm                    \
+       pixmaps/column_delete_24.xpm                    \
+       pixmaps/column_hide_16.xpm                      \
+       pixmaps/column_hide_24.xpm                      \
+       pixmaps/column_size_16.xpm                      \
+       pixmaps/column_size_24.xpm                      \
+       pixmaps/column_unhide_16.xpm                    \
+       pixmaps/column_unhide_24.xpm                    \
+       pixmaps/comment_add_16.xpm                      \
+       pixmaps/comment_delete_16.xpm                   \
+       pixmaps/comment_edit_16.xpm                     \
+       pixmaps/cursor_cross.xpm                        \
+       pixmaps/diag_border.xpm                         \
+       pixmaps/equal-sign.xpm                          \
+       pixmaps/expr_entry.png                          \
        pixmaps/font.xpm                                \
-       pixmaps/sheet_move_marker.xpm                   \
+       pixmaps/format_money_24.png                     \
+       pixmaps/format_percent_24.png                   \
+       pixmaps/formula_guru_16.png                     \
+       pixmaps/formula_guru_24.png                     \
+       pixmaps/gnm_subscript_16.png                    \
+       pixmaps/gnm_subscript_24.png                    \
+       pixmaps/gnm_superscript_16.png                  \
+       pixmaps/gnm_superscript_24.png                  \
+       pixmaps/gnumeric_splash_1.4.png                 \
        pixmaps/gp_125grey.xpm                          \
        pixmaps/gp_25grey.xpm                           \
        pixmaps/gp_50grey.xpm                           \
@@ -444,6 +491,30 @@ embedded_imgs =                                            \
        pixmaps/gp_thin_rev_diag.xpm                    \
        pixmaps/gp_thin_vert.xpm                        \
        pixmaps/gp_vert.xpm                             \
+       pixmaps/graph_guru_16.xpm                       \
+       pixmaps/graph_guru_24.xpm                       \
+       pixmaps/group_16.xpm                            \
+       pixmaps/group_24.xpm                            \
+       pixmaps/halign-fill_24.png                      \
+       pixmaps/halign-general_24.png                   \
+       pixmaps/hf_cell.png                             \
+       pixmaps/hf_date.png                             \
+       pixmaps/hf_page.png                             \
+       pixmaps/hf_pages.png                            \
+       pixmaps/hf_sheet.png                            \
+       pixmaps/hf_time.png                             \
+       pixmaps/hide_detail_16.xpm                      \
+       pixmaps/hide_detail_24.xpm                      \
+       pixmaps/insert_component_16.xpm                 \
+       pixmaps/insert_component_24.xpm                 \
+       pixmaps/insert_image_16.png                     \
+       pixmaps/insert_image_24.png                     \
+       pixmaps/insert_shaped_component_16.xpm          \
+       pixmaps/insert_shaped_component_24.xpm          \
+       pixmaps/inside_border.xpm                       \
+       pixmaps/inside_horiz_border.xpm                 \
+       pixmaps/inside_vert_border.xpm                  \
+       pixmaps/left_border.xpm                         \
        pixmaps/line_pattern_dash_dot.xpm               \
        pixmaps/line_pattern_dash_dot_dot.xpm           \
        pixmaps/line_pattern_dashed.xpm                 \
@@ -457,19 +528,65 @@ embedded_imgs =                                           \
        pixmaps/line_pattern_slant.xpm                  \
        pixmaps/line_pattern_thick.xpm                  \
        pixmaps/line_pattern_thin.xpm                   \
-       pixmaps/bottom_border.xpm                       \
-       pixmaps/diag_border.xpm                         \
-       pixmaps/inside_border.xpm                       \
-       pixmaps/inside_horiz_border.xpm                 \
-       pixmaps/inside_vert_border.xpm                  \
-       pixmaps/left_border.xpm                         \
+       pixmaps/link_add_16.png                         \
+       pixmaps/link_add_24.png                         \
+       pixmaps/link_delete_16.png                      \
+       pixmaps/link_edit_16.png                        \
+       pixmaps/link_email_16.png                       \
+       pixmaps/link_email_24.png                       \
+       pixmaps/link_external_16.png                    \
+       pixmaps/link_external_24.png                    \
+       pixmaps/link_internal_16.png                    \
+       pixmaps/link_internal_24.png                    \
+       pixmaps/link_url_16.png                         \
+       pixmaps/link_url_24.png                         \
+       pixmaps/merge_cells_16.xpm                      \
+       pixmaps/merge_cells_24.xpm                      \
        pixmaps/no_border.xpm                           \
+       pixmaps/object_arrow_24.png                     \
+       pixmaps/object_button_24.png                    \
+       pixmaps/object_checkbox_24.png                  \
+       pixmaps/object_combo_24.png                     \
+       pixmaps/object_ellipse_24.png                   \
+       pixmaps/object_frame_24.png                     \
+       pixmaps/object_label_24.png                     \
+       pixmaps/object_line_24.png                      \
+       pixmaps/object_list_24.png                      \
+       pixmaps/object_radiobutton_24.png               \
+       pixmaps/object_rectangle_24.png                 \
+       pixmaps/object_scrollbar_24.png                 \
+       pixmaps/object_slider_24.png                    \
+       pixmaps/object_spinbutton_24.png                \
        pixmaps/outline_border.xpm                      \
+       pixmaps/pivottable_16.png                       \
+       pixmaps/pivottable_24.png                       \
+       pixmaps/protection_no_24.png                    \
+       pixmaps/protection_yes_24.png                   \
+       pixmaps/protection_yes_48.png                   \
+       pixmaps/remove_decimals.png                     \
        pixmaps/rev_diag_border.xpm                     \
        pixmaps/right_border.xpm                        \
+       pixmaps/row_add_16.xpm                          \
+       pixmaps/row_add_24.xpm                          \
+       pixmaps/row_delete_16.xpm                       \
+       pixmaps/row_delete_24.xpm                       \
+       pixmaps/row_hide_16.xpm                         \
+       pixmaps/row_hide_24.xpm                         \
+       pixmaps/row_size_16.xpm                         \
+       pixmaps/row_size_24.xpm                         \
+       pixmaps/row_unhide_16.xpm                       \
+       pixmaps/row_unhide_24.xpm                       \
+       pixmaps/sheet_move_marker.xpm                   \
+       pixmaps/show_detail_16.xpm                      \
+       pixmaps/show_detail_24.xpm                      \
+       pixmaps/split_cells_16.xpm                      \
+       pixmaps/split_cells_24.xpm                      \
+       pixmaps/thousands.xpm                           \
        pixmaps/top_border.xpm                          \
-       pixmaps/gnumeric_splash_1.4.png                 \
-       pixmaps/unknown_image.png
+       pixmaps/ungroup_16.xpm                          \
+       pixmaps/ungroup_24.xpm                          \
+       pixmaps/unknown_image.png                       \
+       pixmaps/visible.png
 
 embedded-imgs.c: $(top_srcdir)/tools/embedder $(embedded_imgs) Makefile
        cd $(srcdir) && @PERL@ $(abs_top_srcdir)/tools/embedder \
diff --git a/src/application.c b/src/application.c
index cbeb726..8961820 100644
--- a/src/application.c
+++ b/src/application.c
@@ -719,7 +719,54 @@ gnumeric_application_get_property (GObject *obj, guint param_id,
 }
 
 static void
-install_icons (void)
+add_icon (GtkIconFactory *factory,
+         const char *scalable_filename,
+         const char *sized_filename,
+         const char *stock_id)
+{
+       GtkIconSet *set = gtk_icon_set_new ();
+       GtkIconSource *src = gtk_icon_source_new ();
+
+       if (scalable_filename) {
+               char *res = g_strconcat ("res:gnm:pixmaps/",
+                                        scalable_filename,
+                                        NULL);
+               GdkPixbuf *pix = go_gdk_pixbuf_load_from_file (res);
+               if (pix) {
+                       gtk_icon_source_set_size_wildcarded (src, TRUE);
+                       gtk_icon_source_set_pixbuf (src, pix);
+                       gtk_icon_set_add_source (set, src);
+                       g_object_unref (pix);
+               } else {
+                       g_warning ("Missing resource %s\n", res);
+               }
+               g_free (res);
+       }
+
+       /*
+        * For now, don't register a fixed-sized icon as doing so without
+        * catching style changes kills things like bug 302902.
+        */
+       if (sized_filename && !scalable_filename) {
+               char *res = g_strconcat ("res:gnm:pixmaps/",
+                                        sized_filename,
+                                        NULL);
+               GdkPixbuf *pix = go_gdk_pixbuf_load_from_file (res);
+               gtk_icon_source_set_size (src, GTK_ICON_SIZE_MENU);
+               gtk_icon_source_set_size_wildcarded (src, FALSE);
+               gtk_icon_source_set_pixbuf (src, pix);
+               gtk_icon_set_add_source (set, src);
+               g_object_unref (pix);
+       }
+
+       gtk_icon_factory_add (factory, stock_id, set);
+       gtk_icon_set_unref (set);
+       gtk_icon_source_free (src);
+}
+
+
+static void
+install_icons (GnmApp *app)
 {
        static const char *icons[] = {
                /* Cursors */
@@ -780,6 +827,459 @@ install_icons (void)
                "right_border.xpm",
                "top_border.xpm"
        };
+       static struct {
+               const char *scalable_filename;
+               const char *sized_filename;
+               const char *stock_id;
+       } const icons2[] = {
+               {
+                       "column_add_24.xpm",
+                       "column_add_16.xpm",
+                       "Gnumeric_ColumnAdd"
+               },
+               {
+                       "column_delete_24.xpm",
+                       "column_delete_16.xpm",
+                       "Gnumeric_ColumnDelete"
+               },
+               {
+                       "column_size_24.xpm",
+                       "column_size_16.xpm",
+                       "Gnumeric_ColumnSize"
+               },
+               {
+                       "column_hide_24.xpm",
+                       "column_hide_16.xpm",
+                       "Gnumeric_ColumnHide"
+               },
+               {
+                       "column_unhide_24.xpm",
+                       "column_unhide_16.xpm",
+                       "Gnumeric_ColumnUnhide"
+               },
+               {
+                       "row_add_24.xpm",
+                       "row_add_16.xpm",
+                       "Gnumeric_RowAdd"
+               },
+               {
+                       "row_delete_24.xpm",
+                       "row_delete_16.xpm",
+                       "Gnumeric_RowDelete"
+               },
+               {
+                       "row_size_24.xpm",
+                       "row_size_16.xpm",
+                       "Gnumeric_RowSize"
+               },
+               {
+                       "row_hide_24.xpm",
+                       "row_hide_16.xpm",
+                       "Gnumeric_RowHide"
+               },
+               {
+                       "row_unhide_24.xpm",
+                       "row_unhide_16.xpm",
+                       "Gnumeric_RowUnhide"
+               },
+
+               {
+                       "group_24.xpm",
+                       "group_16.xpm",
+                       "Gnumeric_Group"
+               },
+               {
+                       "ungroup_24.xpm",
+                       "ungroup_16.xpm",
+                       "Gnumeric_Ungroup"
+               },
+               {
+                       "show_detail_24.xpm",
+                       "show_detail_16.xpm",
+                       "Gnumeric_ShowDetail"
+               },
+               {
+                       "hide_detail_24.xpm",
+                       "hide_detail_16.xpm",
+                       "Gnumeric_HideDetail"
+               },
+
+               {
+                       "graph_guru_24.xpm",
+                       "graph_guru_16.xpm",
+                       "Gnumeric_GraphGuru"
+               },
+               {
+                       "insert_component_24.xpm",
+                       "insert_component_16.xpm",
+                       "Gnumeric_InsertComponent"
+               },
+               {
+                       "insert_shaped_component_24.xpm",
+                       "insert_shaped_component_16.xpm",
+                       "Gnumeric_InsertShapedComponent"
+               },
+
+               {
+                       "center_across_selection_24.xpm",
+                       "center_across_selection_16.xpm",
+                       "Gnumeric_CenterAcrossSelection"
+               },
+               {
+                       "merge_cells_24.xpm",
+                       "merge_cells_16.xpm",
+                       "Gnumeric_MergeCells"
+               },
+               {
+                       "split_cells_24.xpm",
+                       "split_cells_16.xpm",
+                       "Gnumeric_SplitCells"
+               },
+
+               {
+                       "halign-fill_24.png",
+                       NULL,
+                       "Gnumeric_HAlignFill"
+               },
+               {
+                       "halign-general_24.png",
+                       NULL,
+                       "Gnumeric_HAlignGeneral"
+               },
+
+               {
+                       NULL,
+                       "comment_add_16.xpm",
+                       "Gnumeric_CommentAdd"
+               },
+               {
+                       NULL,
+                       "comment_delete_16.xpm",
+                       "Gnumeric_CommentDelete"
+               },
+               {
+                       NULL,
+                       "comment_edit_16.xpm",
+                       "Gnumeric_CommentEdit"
+               },
+
+               {
+                       "add_decimals.png",
+                       NULL,
+                       "Gnumeric_FormatAddPrecision"
+               },
+               {
+                       "remove_decimals.png",
+                       NULL,
+                       "Gnumeric_FormatRemovePrecision"
+               },
+               {
+                       "format_money_24.png",
+                       NULL,
+                       "Gnumeric_FormatAsAccounting"
+               },
+               {
+                       "format_percent_24.png",
+                       NULL,
+                       "Gnumeric_FormatAsPercentage"
+               },
+               {
+                       "thousands.xpm",
+                       NULL,
+                       "Gnumeric_FormatThousandSeparator"
+               },
+               {
+                       "gnm_subscript_24.png",
+                       "gnm_subscript_16.png",
+                       "Gnumeric_Subscript"
+               },
+               {
+                       "gnm_superscript_24.png",
+                       "gnm_superscript_16.png",
+                       "Gnumeric_Superscript"
+               },
+
+               {
+                       "auto-sum.xpm",
+                       NULL,
+                       "Gnumeric_AutoSum"
+               },
+               {
+                       "equal-sign.xpm",
+                       NULL,
+                       "Gnumeric_Equal"
+               },
+               {
+                       "formula_guru_24.png",
+                       "formula_guru_16.png",
+                       "Gnumeric_FormulaGuru"
+               },
+               {
+                       "insert_image_24.png",
+                       "insert_image_16.png",
+                       "Gnumeric_InsertImage"
+               },
+               {
+                       "bucket.xpm",
+                       NULL,
+                       "Gnumeric_Bucket"
+               },
+               {
+                       "font.xpm",
+                       NULL,
+                       "Gnumeric_Font"
+               },
+               {
+                       "expr_entry.png",
+                       NULL,
+                       "Gnumeric_ExprEntry"
+               },
+               {
+                       "brush-22.png",
+                       "brush-16.png",
+                       "Gnumeric_Brush"
+               },
+
+               {
+                       "object_arrow_24.png",
+                       NULL,
+                       "Gnumeric_ObjectArrow"
+               },
+               {
+                       "object_ellipse_24.png",
+                       NULL,
+                       "Gnumeric_ObjectEllipse"
+               },
+               {
+                       "object_line_24.png",
+                       NULL,
+                       "Gnumeric_ObjectLine"
+               },
+
+               {
+                       "object_rectangle_24.png",
+                       NULL,
+                       "Gnumeric_ObjectRectangle"
+               },
+
+               {
+                       "object_frame_24.png",
+                       NULL,
+                       "Gnumeric_ObjectFrame"
+               },
+               {
+                       "object_label_24.png",
+                       NULL,
+                       "Gnumeric_ObjectLabel"
+               },
+               {
+                       "object_button_24.png",
+                       NULL,
+                       "Gnumeric_ObjectButton"
+               },
+               {
+                       "object_checkbox_24.png",
+                       NULL,
+                       "Gnumeric_ObjectCheckbox"
+               },
+               {
+                       "object_radiobutton_24.png",
+                       NULL,
+                       "Gnumeric_ObjectRadioButton"
+               },
+               {
+                       "object_scrollbar_24.png",
+                       NULL,
+                       "Gnumeric_ObjectScrollbar"
+               },
+               {
+                       "object_spinbutton_24.png",
+                       NULL,
+                       "Gnumeric_ObjectSpinButton"
+               },
+               {
+                       "object_slider_24.png",
+                       NULL,
+                       "Gnumeric_ObjectSlider"
+               },
+               {
+                       "object_combo_24.png",
+                       NULL,
+                       "Gnumeric_ObjectCombo"
+               },
+               {
+                       "object_list_24.png",
+                       NULL,
+                       "Gnumeric_ObjectList"
+               },
+
+               {
+                       "pivottable_24.png",
+                       "pivottable_16.png",
+                       "Gnumeric_PivotTable"
+               },
+               {
+                       "protection_yes_24.png",
+                       NULL,
+                       "Gnumeric_Protection_Yes"
+               },
+               {
+                       "protection_no_24.png",
+                       NULL,
+                       "Gnumeric_Protection_No"
+               },
+               {
+                       "protection_yes_48.png",
+                       NULL,
+                       "Gnumeric_Protection_Yes_Dialog"
+               },
+               {
+                       "visible.png",
+                       NULL,
+                       "Gnumeric_Visible"
+               },
+
+               {
+                       "link_add_24.png",
+                       "link_add_16.png",
+                       "Gnumeric_Link_Add"
+               },
+               {
+                       NULL,
+                       "link_delete_16.png",
+                       "Gnumeric_Link_Delete"
+               },
+               {
+                       NULL,
+                       "link_edit_16.png",
+                       "Gnumeric_Link_Edit"
+               },
+               {
+                       "link_external_24.png",
+                       "link_external_16.png",
+                       "Gnumeric_Link_External"
+               },
+               {
+                       "link_internal_24.png",
+                       "link_internal_16.png",
+                       "Gnumeric_Link_Internal"
+               },
+               {
+                       "link_email_24.png",
+                       "link_email_16.png",
+                       "Gnumeric_Link_EMail"
+               },
+               {
+                       "link_url_24.png",
+                       "link_url_16.png",
+                       "Gnumeric_Link_URL"
+               },
+
+               {
+                       "autofilter_24.png",
+                       "autofilter_16.png",
+                       "Gnumeric_AutoFilter"
+               },
+               {
+                       "autofilter_delete_24.png",
+                       "autofilter_delete_16.png",
+                       "Gnumeric_AutoFilterDelete"
+               },
+
+               {
+                       "border_left.xpm",
+                       NULL,
+                       "Gnumeric_BorderLeft"
+               },
+               {
+                       "border_none.xpm",
+                       NULL,
+                       "Gnumeric_BorderNone"
+               },
+               {
+                       "border_right.xpm",
+                       NULL,
+                       "Gnumeric_BorderRight"
+               },
+               {
+                       "border_all.xpm",
+                       NULL,
+                       "Gnumeric_BorderAll"
+               },
+               {
+                       "border_outside.xpm",
+                       NULL,
+                       "Gnumeric_BorderOutside"
+               },
+               {
+                       "border_thick_outside.xpm",
+                       NULL,
+                       "Gnumeric_BorderThickOutside"
+               },
+               {
+                       "border_bottom.xpm",
+                       NULL,
+                       "Gnumeric_BorderBottom"
+               },
+               {
+                       "border_double_bottom.xpm",
+                       NULL,
+                       "Gnumeric_BorderDoubleBottom"
+               },
+               {
+                       "border_thick_bottom.xpm",
+                       NULL,
+                       "Gnumeric_BorderThickBottom"
+               },
+               {
+                       "border_top_n_bottom.xpm",
+                       NULL,
+                       "Gnumeric_BorderTop_n_Bottom"
+               },
+               {
+                       "border_top_n_double_bottom.xpm",
+                       NULL,
+                       "Gnumeric_BorderTop_n_DoubleBottom"
+               },
+               {
+                       "border_top_n_thick_bottom.xpm",
+                       NULL,
+                       "Gnumeric_BorderTop_n_ThickBottom"
+               },
+
+               {
+                       "hf_page.png",
+                       NULL,
+                       "Gnumeric_Pagesetup_HF_Page"
+               },
+               {
+                       "hf_pages.png",
+                       NULL,
+                       "Gnumeric_Pagesetup_HF_Pages"
+               },
+               {
+                       "hf_time.png",
+                       NULL,
+                       "Gnumeric_Pagesetup_HF_Time"
+               },
+               {
+                       "hf_date.png",
+                       NULL,
+                       "Gnumeric_Pagesetup_HF_Date"
+               },
+               {
+                       "hf_sheet.png",
+                       NULL,
+                       "Gnumeric_Pagesetup_HF_Sheet"
+               },
+               {
+                       "hf_cell.png",
+                       NULL,
+                       "Gnumeric_Pagesetup_HF_Cell"
+               },
+       };
+
+       GtkIconFactory *factory = gtk_icon_factory_new ();
        unsigned int ui;
 
        for (ui = 0; ui < G_N_ELEMENTS (icons); ui++) {
@@ -799,6 +1299,17 @@ install_icons (void)
                g_free (iconname);
                g_free (res);
        }
+
+       for (ui = 0; ui < G_N_ELEMENTS (icons2) ; ui++)
+               add_icon (factory,
+                         icons2[ui].scalable_filename,
+                         icons2[ui].sized_filename,
+                         icons2[ui].stock_id);
+       gtk_icon_factory_add_default (factory);
+       g_object_set_data_full (G_OBJECT (app),
+                               "icon-factory", factory,
+                               (GDestroyNotify)gtk_icon_factory_remove_default);
+       g_object_unref (factory);
 }
 
 
@@ -881,7 +1392,7 @@ gnm_app_init (GObject *obj)
 
        if (!icons_installed) {
                icons_installed = TRUE;
-               install_icons ();
+               install_icons (gnm_app);
        }
 
        gnm_app->clipboard_copied_contents = NULL;
diff --git a/src/dialogs/dialog-cell-format.c b/src/dialogs/dialog-cell-format.c
index babd204..a83ff7b 100644
--- a/src/dialogs/dialog-cell-format.c
+++ b/src/dialogs/dialog-cell-format.c
@@ -931,6 +931,9 @@ fmt_dialog_init_font_page (FormatState *state)
 {
        GtkWidget *tmp = g_object_new (GO_TYPE_FONT_SEL,
                                       "show-style", TRUE,
+                                      "show-color", TRUE,
+                                      "show-script", TRUE,
+                                      "show-strikethrough", TRUE,
                                       NULL);
        GOFontSel *font_widget = GO_FONT_SEL (tmp);
        GtkWidget *uline = gtk_combo_box_text_new_with_entry ();
diff --git a/src/gui-util.c b/src/gui-util.c
index deed75a..1d3c93a 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -991,14 +991,13 @@ int_to_entry (GtkEntry *entry, gint the_int)
 GtkWidget *
 gnumeric_load_image (char const *filename)
 {
-       char *path = g_build_filename (gnm_icon_dir (), filename, NULL);
-       GtkWidget *image = gtk_image_new_from_file (path);
-       g_free (path);
-
-       if (image)
-               gtk_widget_show (image);
-
-       return image;
+       GdkPixbuf *pixbuf = gnumeric_load_pixbuf (filename);
+       if (pixbuf) {
+               GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
+               g_object_unref (pixbuf);
+               return image;
+       }
+       return NULL;
 }
 
 /**
@@ -1012,10 +1011,15 @@ gnumeric_load_image (char const *filename)
 GdkPixbuf *
 gnumeric_load_pixbuf (char const *filename)
 {
-       char *path = g_build_filename (gnm_icon_dir (), filename, NULL);
-       GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (path, NULL);
-       g_free (path);
-       return pixbuf;
+       if (strncmp (filename, "res:", 4) == 0 ||
+           g_path_is_absolute (filename))
+               return go_gdk_pixbuf_load_from_file (filename);
+       else {
+               char *path = g_build_filename (gnm_icon_dir (), filename, NULL);
+               GdkPixbuf *pixbuf = go_gdk_pixbuf_load_from_file (path);
+               g_free (path);
+               return pixbuf;
+       }
 }
 
 
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 602a009..2cadd76 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -51,7 +51,6 @@
 #include "dialogs/dialogs.h"
 #include "widgets/widget-editable-label.h"
 #include "widgets/gnm-fontbutton.h"
-#include "pixmaps/gnumeric-stock-pixbufs.h"
 #include "gui-clipboard.h"
 #include "libgnumeric.h"
 #include "gnm-pane-impl.h"
@@ -4372,182 +4371,6 @@ cb_wbcg_window_state_event (GtkWidget           *widget,
        }
 }
 
-
-static void
-add_icon (GtkIconFactory *factory,
-         guchar const   *scalable_data,
-         guchar const   *sized_data,
-         gchar const    *stock_id)
-{
-       GtkIconSet *set = gtk_icon_set_new ();
-       GtkIconSource *src = gtk_icon_source_new ();
-
-       if (scalable_data != NULL) {
-               GdkPixbuf *pix =
-                       gdk_pixbuf_new_from_inline (-1, scalable_data,
-                                                   FALSE, NULL);
-               gtk_icon_source_set_size_wildcarded (src, TRUE);
-               gtk_icon_source_set_pixbuf (src, pix);
-               gtk_icon_set_add_source (set, src);     /* copies the src */
-               g_object_unref (pix);
-       }
-
-       /*
-        * For now, don't register a fixed-sized icon as doing so without
-        * catching style changes kills things like bug 302902.
-        */
-       if (scalable_data == NULL && sized_data != NULL) {
-               GdkPixbuf *pix =
-                       gdk_pixbuf_new_from_inline (-1, sized_data,
-                                                   FALSE, NULL);
-               gtk_icon_source_set_size (src, GTK_ICON_SIZE_MENU);
-               gtk_icon_source_set_size_wildcarded (src, FALSE);
-               gtk_icon_source_set_pixbuf (src, pix);
-               gtk_icon_set_add_source (set, src);     /* copies the src */
-               g_object_unref (pix);
-       }
-
-       gtk_icon_factory_add (factory, stock_id, set);  /* keeps reference to set */
-       gtk_icon_set_unref (set);
-       gtk_icon_source_free (src);
-}
-
-static void
-wbc_gtk_setup_icons (void)
-{
-       static struct {
-               guchar const   *scalable_data;
-               guchar const   *sized_data;
-               gchar const    *stock_id;
-       } const entry [] = {
-               { gnm_column_add_24,                    gnm_column_add_16,              "Gnumeric_ColumnAdd" 
},
-               { gnm_column_delete_24,                 gnm_column_delete_16,           
"Gnumeric_ColumnDelete" },
-               { gnm_column_size_24,                   gnm_column_size_16,             "Gnumeric_ColumnSize" 
},
-               { gnm_column_hide_24,                   gnm_column_hide_16,             "Gnumeric_ColumnHide" 
},
-               { gnm_column_unhide_24,                 gnm_column_unhide_16,           
"Gnumeric_ColumnUnhide" },
-               { gnm_row_add_24,                       gnm_row_add_16,                 "Gnumeric_RowAdd" },
-               { gnm_row_delete_24,                    gnm_row_delete_16,              "Gnumeric_RowDelete" 
},
-               { gnm_row_size_24,                      gnm_row_size_16,                "Gnumeric_RowSize" },
-               { gnm_row_hide_24,                      gnm_row_hide_16,                "Gnumeric_RowHide" },
-               { gnm_row_unhide_24,                    gnm_row_unhide_16,              "Gnumeric_RowUnhide" 
},
-
-               { gnm_group_24,                         gnm_group_16,                   "Gnumeric_Group" },
-               { gnm_ungroup_24,                       gnm_ungroup_16,                 "Gnumeric_Ungroup" },
-               { gnm_show_detail_24,                   gnm_show_detail_16,             "Gnumeric_ShowDetail" 
},
-               { gnm_hide_detail_24,                   gnm_hide_detail_16,             "Gnumeric_HideDetail" 
},
-
-               { gnm_graph_guru_24,                    gnm_graph_guru_16,              "Gnumeric_GraphGuru" 
},
-               { gnm_insert_component_24,              gnm_insert_component_16,        
"Gnumeric_InsertComponent" },
-               { gnm_insert_shaped_component_24,       gnm_insert_shaped_component_16, 
"Gnumeric_InsertShapedComponent" },
-
-               { gnm_center_across_selection_24,       gnm_center_across_selection_16, 
"Gnumeric_CenterAcrossSelection" },
-               { gnm_merge_cells_24,                   gnm_merge_cells_16,             "Gnumeric_MergeCells" 
},
-               { gnm_split_cells_24,                   gnm_split_cells_16,             "Gnumeric_SplitCells" 
},
-
-               { gnm_halign_fill_24,                   NULL,                           "Gnumeric_HAlignFill" 
},
-               { gnm_halign_general_24,                NULL,                           
"Gnumeric_HAlignGeneral" },
-
-               { NULL,                                 gnm_comment_add_16,             "Gnumeric_CommentAdd" 
},
-               { NULL,                                 gnm_comment_delete_16,          
"Gnumeric_CommentDelete" },
-               { NULL,                                 gnm_comment_edit_16,            
"Gnumeric_CommentEdit" },
-
-               { gnm_add_decimals,                     NULL,                           
"Gnumeric_FormatAddPrecision" },
-               { gnm_remove_decimals,                  NULL,                           
"Gnumeric_FormatRemovePrecision" },
-               { gnm_money,                            NULL,                           
"Gnumeric_FormatAsAccounting" },
-               { gnm_percent,                          NULL,                           
"Gnumeric_FormatAsPercentage" },
-               { gnm_thousand,                         NULL,                           
"Gnumeric_FormatThousandSeparator" },
-               { gnm_subscript_24,                     gnm_subscript_16,               "Gnumeric_Subscript" 
},
-               { gnm_superscript_24,                   gnm_superscript_16,             
"Gnumeric_Superscript" },
-
-               { gnm_auto,                             NULL,                           "Gnumeric_AutoSum" },
-               { gnm_equal,                            NULL,                           "Gnumeric_Equal" },
-               { gnm_formula_guru_24,                  gnm_formula_guru_16,            
"Gnumeric_FormulaGuru" },
-               { gnm_insert_image_24,                  gnm_insert_image_16,            
"Gnumeric_InsertImage" },
-               { gnm_bucket,                           NULL,                           "Gnumeric_Bucket" },
-               { gnm_font,                             NULL,                           "Gnumeric_Font" },
-               { gnm_expr_entry,                       NULL,                           "Gnumeric_ExprEntry" 
},
-               { gnm_brush_22,                         gnm_brush_16,                   "Gnumeric_Brush" },
-
-               { gnm_object_arrow_24,                  NULL,                           
"Gnumeric_ObjectArrow" },
-               { gnm_object_ellipse_24,                NULL,                           
"Gnumeric_ObjectEllipse" },
-               { gnm_object_line_24,                   NULL,                           "Gnumeric_ObjectLine" 
},
-               { gnm_object_label_24,                  NULL,                           
"Gnumeric_ObjectRectangle" },
-
-               { gnm_object_frame_24,                  NULL,                           
"Gnumeric_ObjectFrame" },
-               { gnm_object_button_24,                 NULL,                           
"Gnumeric_ObjectButton" },
-               { gnm_object_checkbox_24,               NULL,                           
"Gnumeric_ObjectCheckbox" },
-               { gnm_object_radiobutton_24,            NULL,                           
"Gnumeric_ObjectRadioButton" },
-               { gnm_object_scrollbar_24,              NULL,                           
"Gnumeric_ObjectScrollbar" },
-               { gnm_object_spinbutton_24,             NULL,                           
"Gnumeric_ObjectSpinButton" },
-               { gnm_object_slider_24,                 NULL,                           
"Gnumeric_ObjectSlider" },
-               { gnm_object_combo_24,                  NULL,                           
"Gnumeric_ObjectCombo" },
-               { gnm_object_list_24,                   NULL,                           "Gnumeric_ObjectList" 
},
-
-               { gnm_pivottable_24,                    gnm_pivottable_16,              "Gnumeric_PivotTable" 
},
-               { gnm_protection_yes,                   NULL,                           
"Gnumeric_Protection_Yes" },
-               { gnm_protection_no,                    NULL,                           
"Gnumeric_Protection_No" },
-               { gnm_protection_yes_48,                NULL,                           
"Gnumeric_Protection_Yes_Dialog" },
-               { gnm_visible,                          NULL,                           "Gnumeric_Visible" },
-
-               { gnm_link_add_24,                      gnm_link_add_16,                "Gnumeric_Link_Add" },
-               { NULL,                                 gnm_link_delete_16,             
"Gnumeric_Link_Delete" },
-               { NULL,                                 gnm_link_edit_16,               "Gnumeric_Link_Edit" 
},
-               { gnm_link_external_24,                 gnm_link_external_16,           
"Gnumeric_Link_External" },
-               { gnm_link_internal_24,                 gnm_link_internal_16,           
"Gnumeric_Link_Internal" },
-               { gnm_link_email_24,                    gnm_link_email_16,              "Gnumeric_Link_EMail" 
},
-               { gnm_link_url_24,                      gnm_link_url_16,                "Gnumeric_Link_URL" },
-
-               { gnm_autofilter_24,                    gnm_autofilter_16,              "Gnumeric_AutoFilter" 
},
-               { gnm_autofilter_delete_24,             gnm_autofilter_delete_16,       
"Gnumeric_AutoFilterDelete" },
-
-               { gnm_border_left,                      NULL,                           "Gnumeric_BorderLeft" 
},
-               { gnm_border_none,                      NULL,                           "Gnumeric_BorderNone" 
},
-               { gnm_border_right,                     NULL,                           
"Gnumeric_BorderRight" },
-
-               { gnm_border_all,                       NULL,                           "Gnumeric_BorderAll" 
},
-               { gnm_border_outside,                   NULL,                           
"Gnumeric_BorderOutside" },
-               { gnm_border_thick_outside,             NULL,                           
"Gnumeric_BorderThickOutside" },
-
-               { gnm_border_bottom,                    NULL,                           
"Gnumeric_BorderBottom" },
-               { gnm_border_double_bottom,             NULL,                           
"Gnumeric_BorderDoubleBottom" },
-               { gnm_border_thick_bottom,              NULL,                           
"Gnumeric_BorderThickBottom" },
-
-               { gnm_border_top_n_bottom,              NULL,                           
"Gnumeric_BorderTop_n_Bottom" },
-               { gnm_border_top_n_double_bottom,       NULL,                           
"Gnumeric_BorderTop_n_DoubleBottom" },
-               { gnm_border_top_n_thick_bottom,        NULL,                           
"Gnumeric_BorderTop_n_ThickBottom" },
-
-               { gnm_printsetup_hf_page,               NULL,                           
"Gnumeric_Pagesetup_HF_Page"},
-               { gnm_printsetup_hf_pages,              NULL,                           
"Gnumeric_Pagesetup_HF_Pages"},
-               { gnm_printsetup_hf_time,               NULL,                           
"Gnumeric_Pagesetup_HF_Time"},
-               { gnm_printsetup_hf_date,               NULL,                           
"Gnumeric_Pagesetup_HF_Date"},
-               { gnm_printsetup_hf_sheet,              NULL,                           
"Gnumeric_Pagesetup_HF_Sheet"},
-               { gnm_printsetup_hf_cell,               NULL,                           
"Gnumeric_Pagesetup_HF_Cell"},
-       };
-       static gboolean done = FALSE;
-
-       if (!done) {
-               unsigned int ui = 0;
-               GtkIconFactory *factory = gtk_icon_factory_new ();
-               GObject *app = gnm_app_get_app ();
-               /* adding a test because this is called from  wbc_gtk_class_init()
-               during introspection with no proper initialization.*/
-               if (!app)
-                       return;
-               for (ui = 0; ui < G_N_ELEMENTS (entry) ; ui++)
-                       add_icon (factory,
-                                 entry[ui].scalable_data,
-                                 entry[ui].sized_data,
-                                 entry[ui].stock_id);
-               gtk_icon_factory_add_default (factory);
-               /* adding a test because this is called from  wbc_gtk_class_init()
-               during introspection with no proper initialization.*/
-               g_object_set_data_full (app, "icon-factory", factory,
-                                       (GDestroyNotify)gtk_icon_factory_remove_default);
-               g_object_unref (factory);
-               done = TRUE;
-       }
-}
-
 /****************************************************************************/
 
 static void
@@ -5606,8 +5429,6 @@ wbc_gtk_class_init (GObjectClass *gobject_class)
        wbc_class->init_state           = wbc_gtk_init_state;
        wbc_class->style_feedback       = wbc_gtk_style_feedback;
 
-       wbc_gtk_setup_icons ();
-
         g_object_class_install_property (gobject_class,
                 WBG_GTK_PROP_AUTOSAVE_PROMPT,
                 g_param_spec_boolean ("autosave-prompt",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]