[gnumeric] Printer setup: load right-down images from glib resources.



commit f5b496b2b534f5b3620f733df621a021e3ae1144
Author: Morten Welinder <terra gnome org>
Date:   Mon Jan 19 19:26:39 2015 -0500

    Printer setup: load right-down images from glib resources.
    
    This lets us remove a could of utility functions.

 ChangeLog                          |    3 ++
 src/Makefile.am                    |    2 -
 src/dialogs/ChangeLog              |    5 ++++
 src/dialogs/dialog-printer-setup.c |    4 +-
 src/gnm.gresource.xml              |    2 +
 src/gui-util.c                     |   43 ------------------------------------
 src/gui-util.h                     |    3 --
 7 files changed, 12 insertions(+), 50 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a6d3916..9658db7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-01-19  Morten Welinder  <terra gnome org>
 
+       * src/gui-util.c (gnumeric_load_image, gnumeric_load_pixbuf):
+       Delete.
+
        * src/gnm.gresource.xml: pre-process xpm files.  gdkpixbuf will
        otherwise dump them in temporary files in order to load them.
 
diff --git a/src/Makefile.am b/src/Makefile.am
index cd04a70..cabe6e8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -437,9 +437,7 @@ gnumeric_app_libs =                         \
 
 embedded_imgs =                                                \
        gnumeric.css                                    \
-       pixmaps/down-right.png                          \
        pixmaps/gnumeric_splash_1.4.png                 \
-       pixmaps/right-down.png                          \
        pixmaps/sheet_move_marker.xpm                   \
        pixmaps/unknown_image.png
 
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 6016148..0371360 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-19  Morten Welinder  <terra gnome org>
+
+       * dialog-printer-setup.c (do_setup_page_info): Load right-down
+       images from glib resources.
+
 2015-01-06  Morten Welinder  <terra gnome org>
 
        * dialog-recent.c (cb_destroy): Plug leak.
diff --git a/src/dialogs/dialog-printer-setup.c b/src/dialogs/dialog-printer-setup.c
index 086c2d5..1a2dd49 100644
--- a/src/dialogs/dialog-printer-setup.c
+++ b/src/dialogs/dialog-printer-setup.c
@@ -2313,8 +2313,8 @@ do_setup_page_info (PrinterSetupState *state)
                                                         (GTK_COMBO_BOX (state->comment_display.combo)));
        do_setup_comment_display (state);
 
-       state->icon_rd = gnumeric_load_image ("res:gnm:pixmaps/right-down.png");
-       state->icon_dr = gnumeric_load_image ("res:gnm:pixmaps/down-right.png");
+       state->icon_rd = gtk_image_new_from_resource ("/org/gnumeric/gnumeric/images/right-down.png");
+       state->icon_dr = gtk_image_new_from_resource ("/org/gnumeric/gnumeric/images/down-right.png");
 
        gtk_widget_hide (state->icon_dr);
        gtk_widget_hide (state->icon_rd);
diff --git a/src/gnm.gresource.xml b/src/gnm.gresource.xml
index c5d6605..4250e40 100644
--- a/src/gnm.gresource.xml
+++ b/src/gnm.gresource.xml
@@ -175,5 +175,7 @@
     <file preprocess='to-pixdata' 
alias="images/line_pattern_slant.xpm">src/pixmaps/line_pattern_slant.xpm</file>
     <file preprocess='to-pixdata' 
alias="images/line_pattern_thick.xpm">src/pixmaps/line_pattern_thick.xpm</file>
     <file preprocess='to-pixdata' 
alias="images/line_pattern_thin.xpm">src/pixmaps/line_pattern_thin.xpm</file>
+    <file alias="images/right-down.png">src/pixmaps/right-down.png</file>
+    <file alias="images/down-right.png">src/pixmaps/down-right.png</file>
   </gresource>
 </gresources>
diff --git a/src/gui-util.c b/src/gui-util.c
index 3e2d6ba..13fcd45 100644
--- a/src/gui-util.c
+++ b/src/gui-util.c
@@ -951,49 +951,6 @@ int_to_entry (GtkEntry *entry, gint the_int)
        }
 }
 
-/**
- * gnumeric_load_image:
- * @name: the file name.
- *
- * utility routine to create image widgets from file named @name.
- * looking in the gnumeric icondir.
- * Returns: (transfer full): the newly allocated #GtkImage.
- **/
-GtkWidget *
-gnumeric_load_image (char const *filename)
-{
-       GdkPixbuf *pixbuf = gnumeric_load_pixbuf (filename);
-       if (pixbuf) {
-               GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
-               g_object_unref (pixbuf);
-               return image;
-       }
-       return NULL;
-}
-
-/**
- * gnumeric_load_pixbuf:
- * @name: the file name.
- *
- * utility routine to create pixbufs from file named @name.
- * looking in the gnumeric icondir.
- * Returns: (transfer full): the newly allocated pixbuf.
- **/
-GdkPixbuf *
-gnumeric_load_pixbuf (char const *filename)
-{
-       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;
-       }
-}
-
-
 static void
 cb_focus_to_entry (GtkWidget *button, GtkWidget *entry)
 {
diff --git a/src/gui-util.h b/src/gui-util.h
index 98fae17..64abce2 100644
--- a/src/gui-util.h
+++ b/src/gui-util.h
@@ -99,9 +99,6 @@ gboolean entry_to_int (GtkEntry *entry, gint *the_int, gboolean update);
 void    float_to_entry (GtkEntry *entry, gnm_float the_float);
 void    int_to_entry   (GtkEntry *entry, gint the_int);
 
-GtkWidget *gnumeric_load_image  (char const *name);
-GdkPixbuf *gnumeric_load_pixbuf (char const *name);
-
 void gnm_link_button_and_entry (GtkWidget *button, GtkWidget *entry);
 
 void gnm_widget_set_cursor_type (GtkWidget *w, GdkCursorType ct);


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