[goffice] Moved go-pixbuf.* to utils.
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Moved go-pixbuf.* to utils.
- Date: Tue, 25 Oct 2011 09:06:30 +0000 (UTC)
commit 651ca4b9b78d84b66662e9589d7b36bead4d56a1
Author: Jean Brefort <jean brefort normalesup org>
Date: Tue Oct 25 11:05:52 2011 +0200
Moved go-pixbuf.* to utils.
ChangeLog | 10 ++++++++++
goffice/graph/gog-child-button.c | 4 ++--
goffice/graph/gog-error-bar.c | 17 ++---------------
goffice/graph/gog-guru.c | 4 ++--
goffice/gtk/Makefile.am | 4 ----
goffice/gtk/goffice-gtk.c | 8 +++++++-
goffice/gtk/goffice-gtk.h | 1 -
goffice/utils/Makefile.am | 2 ++
goffice/{gtk => utils}/go-pixbuf.c | 18 +++++++++---------
goffice/{gtk => utils}/go-pixbuf.h | 12 ++++++------
goffice/utils/go-style.c | 2 +-
goffice/utils/goffice-utils.h | 1 +
12 files changed, 42 insertions(+), 41 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 357f1d4..4c57e73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-10-25 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/gtk/go-pixbuf.c: moved to utils.
+ * goffice/gtk/go-pixbuf.h: ditto.
+ * goffice/utils/go-pixbuf.c (go_gdk_pixbuf_intelligent_scale),
+ (go_gdk_pixbuf_new_from_file), (go_gdk_pixbuf_get_from_cache),
+ (go_gdk_pixbuf_tile):rename the functions to prepare for GOPixbuf (GOImage
+ split).
+ * goffice/utils/go-pixbuf.h: ditto.
+
2011-10-24 Andreas J. Guelzow <aguelzow pyrshep ca>
* goffice/utils/go-format.c (go_format_execute): fix sense of
diff --git a/goffice/graph/gog-child-button.c b/goffice/graph/gog-child-button.c
index f32cda0..fe82f77 100644
--- a/goffice/graph/gog-child-button.c
+++ b/goffice/graph/gog-child-button.c
@@ -372,7 +372,7 @@ cb_plot_family_menu_create (char const *id,
menu = gtk_image_menu_item_new_with_label (_(family->name));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu),
gtk_image_new_from_pixbuf (
- go_pixbuf_get_from_cache (family->sample_image_file)));
+ go_gdk_pixbuf_get_from_cache (family->sample_image_file)));
gtk_menu_shell_append (GTK_MENU_SHELL (closure->menu), menu);
closure->non_blank = TRUE;
@@ -387,7 +387,7 @@ cb_plot_family_menu_create (char const *id,
w = gtk_image_menu_item_new_with_label (_(type->name));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (w),
gtk_image_new_from_pixbuf (
- go_pixbuf_get_from_cache (type->sample_image_file)));
+ go_gdk_pixbuf_get_from_cache (type->sample_image_file)));
g_object_set_data (G_OBJECT (w), ADDITION_KEY, closure->addition);
g_object_set_data (G_OBJECT (w), PLOT_TYPE_KEY, type);
g_signal_connect (G_OBJECT (w), "activate",
diff --git a/goffice/graph/gog-error-bar.c b/goffice/graph/gog-error-bar.c
index 9e9b132..3b34923 100644
--- a/goffice/graph/gog-error-bar.c
+++ b/goffice/graph/gog-error-bar.c
@@ -20,19 +20,7 @@
*/
#include <goffice/goffice-config.h>
-#include "gog-error-bar.h"
-#include "gog-series-impl.h"
-#include "gog-plot-impl.h"
-#include "gog-object-xml.h"
-#include "gog-data-allocator.h"
-#include "gog-renderer.h"
-#include <goffice/data/go-data-impl.h>
-#include <goffice/data/go-data.h>
-#include <goffice/math/go-math.h>
-#include <goffice/utils/go-path.h>
-#include <goffice/utils/go-persist.h>
-#include <goffice/utils/go-style.h>
-#include <goffice/utils/go-libxml-extras.h>
+#include <goffice/goffice.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n-lib.h>
@@ -53,7 +41,6 @@ static GObjectClass *error_bar_parent_klass;
#ifdef GOFFICE_WITH_GTK
#include <goffice/gtk/goffice-gtk.h>
-#include <goffice/gtk/go-pixbuf.h>
#include <goffice/gtk/go-color-selector.h>
typedef struct {
@@ -283,7 +270,7 @@ gog_error_bar_prefs (GogSeries *series,
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, "text", 1, NULL);
for (i = 0; i < G_N_ELEMENTS (display_combo_desc); i++) {
- pixbuf = go_pixbuf_new_from_file (direction == GOG_ERROR_BAR_DIRECTION_HORIZONTAL ?
+ pixbuf = go_gdk_pixbuf_new_from_file (direction == GOG_ERROR_BAR_DIRECTION_HORIZONTAL ?
display_combo_desc[i].h_pixbuf :
display_combo_desc[i].v_pixbuf);
gtk_list_store_append (list, &iter);
diff --git a/goffice/graph/gog-guru.c b/goffice/graph/gog-guru.c
index 237669f..b3171be 100644
--- a/goffice/graph/gog-guru.c
+++ b/goffice/graph/gog-guru.c
@@ -384,7 +384,7 @@ cb_plot_types_init (char const *id, GogPlotType *type,
double x1, y1, w, h;
GocItem *item;
int col, row;
- GdkPixbuf *image = go_pixbuf_get_from_cache (type->sample_image_file);
+ GdkPixbuf *image = go_gdk_pixbuf_get_from_cache (type->sample_image_file);
g_return_if_fail (image != NULL);
@@ -440,7 +440,7 @@ cb_plot_families_init (char const *id, GogPlotFamily *family,
gtk_list_store_append (typesel->model, &iter);
gtk_list_store_set (typesel->model, &iter,
- PLOT_FAMILY_TYPE_IMAGE, go_pixbuf_get_from_cache (family->sample_image_file),
+ PLOT_FAMILY_TYPE_IMAGE, go_gdk_pixbuf_get_from_cache (family->sample_image_file),
PLOT_FAMILY_TYPE_NAME, _(family->name),
PLOT_FAMILY_TYPE_CANVAS_GROUP, group,
-1);
diff --git a/goffice/gtk/Makefile.am b/goffice/gtk/Makefile.am
index 3f7169d..14d0872 100644
--- a/goffice/gtk/Makefile.am
+++ b/goffice/gtk/Makefile.am
@@ -32,8 +32,6 @@ libgoffice_gtk_la_SOURCES = \
go-marker-selector.c \
go-pattern-selector.c \
\
- go-pixbuf.c \
- \
go-graph-widget.c \
go-image-sel.c
@@ -70,8 +68,6 @@ libgoffice_gtk_la_HEADERS = \
go-marker-selector.h \
go-pattern-selector.h \
\
- go-pixbuf.h \
- \
go-graph-widget.h \
go-image-sel.h
diff --git a/goffice/gtk/goffice-gtk.c b/goffice/gtk/goffice-gtk.c
index d457a72..a7b2167 100644
--- a/goffice/gtk/goffice-gtk.c
+++ b/goffice/gtk/goffice-gtk.c
@@ -169,8 +169,14 @@ go_gtk_builder_new (char const *uifile,
GsfInput *src = gsf_input_memory_new (data, strlen (data), FALSE);
ok = apply_ui_from_file (gui, src, &error);
} else {
+ /* we need to set the current directory so that the builder can find pixbufs */
+ char *curdir = g_get_current_dir (), *uidir = g_path_get_dirname (uifile);
GsfInput *src = gsf_input_stdio_new (uifile, &error);
+ g_chdir (uidir);
+ g_free (uidir);
ok = apply_ui_from_file (gui, src, &error);
+ g_chdir (curdir);
+ g_free (curdir);
}
if (!ok) {
@@ -642,7 +648,7 @@ update_preview_cb (GtkFileChooser *chooser)
}
if (buf) {
- GdkPixbuf *pixbuf = go_pixbuf_intelligent_scale (buf, PREVIEW_HSIZE, PREVIEW_VSIZE);
+ GdkPixbuf *pixbuf = go_gdk_pixbuf_intelligent_scale (buf, PREVIEW_HSIZE, PREVIEW_VSIZE);
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
g_object_unref (pixbuf);
gtk_widget_show (image);
diff --git a/goffice/gtk/goffice-gtk.h b/goffice/gtk/goffice-gtk.h
index 5d6312b..e9a91ae 100644
--- a/goffice/gtk/goffice-gtk.h
+++ b/goffice/gtk/goffice-gtk.h
@@ -49,7 +49,6 @@
#include <goffice/gtk/go-marker-selector.h>
#include <goffice/gtk/go-optionmenu.h>
#include <goffice/gtk/go-pattern-selector.h>
-#include <goffice/gtk/go-pixbuf.h>
#include <goffice/gtk/go-rotation-sel.h>
diff --git a/goffice/utils/Makefile.am b/goffice/utils/Makefile.am
index 1876d02..c193e6a 100644
--- a/goffice/utils/Makefile.am
+++ b/goffice/utils/Makefile.am
@@ -12,6 +12,7 @@ libgoffice_utils_la_SOURCES = \
go-cairo.c \
go-gradient.c \
go-image.c \
+ go-pixbuf.c \
go-line.c \
go-locale.c \
go-marker.c \
@@ -44,6 +45,7 @@ libgoffice_utils_la_HEADERS = \
go-font.h \
go-gradient.h \
go-image.h \
+ go-pixbuf.h \
go-line.h \
go-locale.h \
go-marker.h \
diff --git a/goffice/gtk/go-pixbuf.c b/goffice/utils/go-pixbuf.c
similarity index 91%
rename from goffice/gtk/go-pixbuf.c
rename to goffice/utils/go-pixbuf.c
index a35bc96..44c228a 100644
--- a/goffice/gtk/go-pixbuf.c
+++ b/goffice/utils/go-pixbuf.c
@@ -25,7 +25,7 @@
#include <goffice/goffice-priv.h>
/**
- * go_pixbuf_intelligent_scale:
+ * go_gdk_pixbuf_intelligent_scale:
* @buf: a #GdkPixbuf
* @width: new width
* @height: new height
@@ -36,7 +36,7 @@
**/
GdkPixbuf *
-go_pixbuf_intelligent_scale (GdkPixbuf *buf, guint width, guint height)
+go_gdk_pixbuf_intelligent_scale (GdkPixbuf *buf, guint width, guint height)
{
GdkPixbuf *scaled;
int w, h;
@@ -60,7 +60,7 @@ go_pixbuf_intelligent_scale (GdkPixbuf *buf, guint width, guint height)
}
/**
- * go_pixbuf_new_from_file:
+ * go_gdk_pixbuf_new_from_file:
* @filename : pixbuf filename
*
* Utility routine to create pixbufs from file @name in the goffice_icon_dir.
@@ -69,7 +69,7 @@ go_pixbuf_intelligent_scale (GdkPixbuf *buf, guint width, guint height)
**/
GdkPixbuf *
-go_pixbuf_new_from_file (char const *filename)
+go_gdk_pixbuf_new_from_file (char const *filename)
{
char *path;
GdkPixbuf *pixbuf;
@@ -89,7 +89,7 @@ go_pixbuf_new_from_file (char const *filename)
}
/**
- * go_pixbuf_get_from_cache:
+ * go_gdk_pixbuf_get_from_cache:
* @filename: pixbuf filename
*
* Retrieves a pixbuf from the image cache, loading it from the file
@@ -99,7 +99,7 @@ go_pixbuf_new_from_file (char const *filename)
**/
GdkPixbuf *
-go_pixbuf_get_from_cache (char const *filename)
+go_gdk_pixbuf_get_from_cache (char const *filename)
{
static GHashTable *cache = NULL;
GdkPixbuf *pixbuf;
@@ -114,7 +114,7 @@ go_pixbuf_get_from_cache (char const *filename)
cache = g_hash_table_new_full (g_str_hash, g_str_equal,
NULL, g_object_unref);
- pixbuf = go_pixbuf_new_from_file (filename);
+ pixbuf = go_gdk_pixbuf_new_from_file (filename);
if (pixbuf != NULL)
g_hash_table_insert (cache, (gpointer) filename, pixbuf);
@@ -123,7 +123,7 @@ go_pixbuf_get_from_cache (char const *filename)
/**
- * go_pixbuf_tile:
+ * go_gdk_pixbuf_tile:
* @src: source pixbuf
* @w: desired width
* @h: desired height
@@ -134,7 +134,7 @@ go_pixbuf_get_from_cache (char const *filename)
* The fractional tiles are spead evenly left-right and top-bottom.
*/
GdkPixbuf *
-go_pixbuf_tile (GdkPixbuf const *src, guint w, guint h)
+go_gdk_pixbuf_tile (GdkPixbuf const *src, guint w, guint h)
{
int src_w, src_h;
int tile_x, tile_y;
diff --git a/goffice/gtk/go-pixbuf.h b/goffice/utils/go-pixbuf.h
similarity index 74%
rename from goffice/gtk/go-pixbuf.h
rename to goffice/utils/go-pixbuf.h
index 7416076..3f8452f 100644
--- a/goffice/gtk/go-pixbuf.h
+++ b/goffice/utils/go-pixbuf.h
@@ -20,15 +20,15 @@
#ifndef GO_PIXBUF_H
#define GO_PIXBUF_H
-#include <gdk/gdk.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
-GdkPixbuf *go_pixbuf_intelligent_scale (GdkPixbuf *buf,
- guint width, guint height);
-GdkPixbuf *go_pixbuf_new_from_file (char const *filename);
-GdkPixbuf *go_pixbuf_get_from_cache (char const *filename);
-GdkPixbuf *go_pixbuf_tile (GdkPixbuf const *src,
+GdkPixbuf *go_gdk_pixbuf_intelligent_scale (GdkPixbuf *buf,
+ guint width, guint height);
+GdkPixbuf *go_gdk_pixbuf_new_from_file (char const *filename);
+GdkPixbuf *go_gdk_pixbuf_get_from_cache (char const *filename);
+GdkPixbuf *go_gdk_pixbuf_tile (GdkPixbuf const *src,
guint w, guint h);
G_END_DECLS
diff --git a/goffice/utils/go-style.c b/goffice/utils/go-style.c
index 0dc3d3f..6551a21 100644
--- a/goffice/utils/go-style.c
+++ b/goffice/utils/go-style.c
@@ -142,7 +142,7 @@ go_style_set_image_preview (GOImage *pix, StylePrefState *state)
w = go_gtk_builder_get_widget (state->gui, "fill_image_sample");
- scaled = go_pixbuf_intelligent_scale (go_image_get_pixbuf (pix), HSCALE, VSCALE);
+ scaled = go_gdk_pixbuf_intelligent_scale (go_image_get_pixbuf (pix), HSCALE, VSCALE);
gtk_image_set_from_pixbuf (GTK_IMAGE (w), scaled);
g_object_unref (scaled);
diff --git a/goffice/utils/goffice-utils.h b/goffice/utils/goffice-utils.h
index 9d21ad2..bbd819c 100644
--- a/goffice/utils/goffice-utils.h
+++ b/goffice/utils/goffice-utils.h
@@ -113,6 +113,7 @@ G_END_DECLS
#include <goffice/utils/go-glib-extras.h>
#include <goffice/utils/go-gradient.h>
#include <goffice/utils/go-image.h>
+#include <goffice/utils/go-pixbuf.h>
#include <goffice/utils/go-libxml-extras.h>
#include <goffice/utils/go-line.h>
#include <goffice/utils/go-locale.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]