Delete this function.
2008-01-25 Soren Sandmann <sandmann@redhat.com> * gnome-wp-item.c (collect_save_options): Delete this function. * gnome-wp-xml.c: Don't include gnome-wp-utils.h * appearance-desktop.c: Don't include gnome-wp-utils.h * gnome-wp-item.c: Don't include gnome-wp-utils.h * gnome-wp-item.h: Move gconf key macros here from gnome-wp-utils.h * Makefile.am: Delete gnome-wp-utils.[ch] * gnome-wp-utils.[ch]: Delete these files. svn path=/trunk/; revision=8417
This commit is contained in:
parent
830047edb4
commit
a2ccffefbc
8 changed files with 22 additions and 313 deletions
|
@ -1,3 +1,16 @@
|
|||
2008-01-25 Soren Sandmann <sandmann@redhat.com>
|
||||
|
||||
* gnome-wp-item.c (collect_save_options): Delete this function.
|
||||
|
||||
* gnome-wp-xml.c: Don't include gnome-wp-utils.h
|
||||
* appearance-desktop.c: Don't include gnome-wp-utils.h
|
||||
* gnome-wp-item.c: Don't include gnome-wp-utils.h
|
||||
* gnome-wp-item.h: Move gconf key macros here from gnome-wp-utils.h
|
||||
|
||||
* Makefile.am: Delete gnome-wp-utils.[ch]
|
||||
|
||||
* gnome-wp-utils.[ch]: Delete these files.
|
||||
|
||||
2008-01-25 Soren Sandmann <sandmann@redhat.com>
|
||||
|
||||
* gnome-wp-item.h (GNOME_DESKTOP_USE_UNSTABLE_API):
|
||||
|
|
|
@ -24,8 +24,6 @@ gnome_appearance_properties_SOURCES = \
|
|||
gnome-wp-info.h \
|
||||
gnome-wp-item.c \
|
||||
gnome-wp-item.h \
|
||||
gnome-wp-utils.c \
|
||||
gnome-wp-utils.h \
|
||||
gnome-wp-xml.c \
|
||||
gnome-wp-xml.h \
|
||||
theme-installer.c \
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "appearance.h"
|
||||
#include "gnome-wp-info.h"
|
||||
#include "gnome-wp-item.h"
|
||||
#include "gnome-wp-utils.h"
|
||||
#include "gnome-wp-xml.h"
|
||||
#include "wp-cellrenderer.h"
|
||||
#include <glib/gi18n.h>
|
||||
|
|
|
@ -27,9 +27,7 @@
|
|||
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
|
||||
#define GNOME_DESKTOP_USE_UNSTABLE_API
|
||||
#include <libgnomeui/gnome-bg.h>
|
||||
|
||||
#include "gnome-wp-item.h"
|
||||
#include "gnome-wp-utils.h"
|
||||
|
||||
static void set_bg_properties (GnomeWPItem *item)
|
||||
{
|
||||
|
@ -171,55 +169,6 @@ void gnome_wp_item_free (GnomeWPItem * item) {
|
|||
g_free (item);
|
||||
}
|
||||
|
||||
static void collect_save_options (GdkPixbuf * pixbuf,
|
||||
gchar *** keys,
|
||||
gchar *** vals,
|
||||
gint width,
|
||||
gint height) {
|
||||
gchar ** options;
|
||||
gint n, count;
|
||||
|
||||
count = 0;
|
||||
|
||||
options = g_object_get_qdata (G_OBJECT (pixbuf),
|
||||
g_quark_from_static_string ("gdk_pixbuf_options"));
|
||||
if (options) {
|
||||
for (n = 0; options[2 * n]; n++) {
|
||||
++count;
|
||||
|
||||
*keys = g_realloc (*keys, sizeof (gchar *) * (count + 1));
|
||||
*vals = g_realloc (*vals, sizeof (gchar *) * (count + 1));
|
||||
|
||||
(*keys)[count - 1] = g_strdup (options[2 * n]);
|
||||
(*vals)[count - 1] = g_strdup (options[2 * n + 1]);
|
||||
|
||||
(*keys)[count] = NULL;
|
||||
(*vals)[count] = NULL;
|
||||
}
|
||||
}
|
||||
++count;
|
||||
|
||||
*keys = g_realloc (*keys, sizeof (gchar *) * (count + 1));
|
||||
*vals = g_realloc (*vals, sizeof (gchar *) * (count + 1));
|
||||
|
||||
(*keys)[count - 1] = g_strdup ("tEXt::Thumb::Image::Width");
|
||||
(*vals)[count - 1] = g_strdup_printf ("%d", width);
|
||||
|
||||
(*keys)[count] = NULL;
|
||||
(*vals)[count] = NULL;
|
||||
|
||||
++count;
|
||||
|
||||
*keys = g_realloc (*keys, sizeof (gchar *) * (count + 1));
|
||||
*vals = g_realloc (*vals, sizeof (gchar *) * (count + 1));
|
||||
|
||||
(*keys)[count - 1] = g_strdup ("tEXt::Thumb::Image::Height");
|
||||
(*vals)[count - 1] = g_strdup_printf ("%d", height);
|
||||
|
||||
(*keys)[count] = NULL;
|
||||
(*vals)[count] = NULL;
|
||||
}
|
||||
|
||||
#define LIST_IMAGE_WIDTH 108
|
||||
|
||||
GdkPixbuf * gnome_wp_item_get_thumbnail (GnomeWPItem * item,
|
||||
|
|
|
@ -30,6 +30,15 @@
|
|||
#ifndef _GNOME_WP_ITEM_H_
|
||||
#define _GNOME_WP_ITEM_H_
|
||||
|
||||
#define WP_PATH_KEY "/desktop/gnome/background"
|
||||
#define WP_FILE_KEY WP_PATH_KEY "/picture_filename"
|
||||
#define WP_OPTIONS_KEY WP_PATH_KEY "/picture_options"
|
||||
#define WP_SHADING_KEY WP_PATH_KEY "/color_shading_type"
|
||||
#define WP_PCOLOR_KEY WP_PATH_KEY "/primary_color"
|
||||
#define WP_SCOLOR_KEY WP_PATH_KEY "/secondary_color"
|
||||
#define WP_KEYBOARD_PATH "/desktop/gnome/peripherals/keyboard"
|
||||
#define WP_DELAY_KEY WP_KEYBOARD_PATH "/delay"
|
||||
|
||||
typedef struct _GnomeWPItem GnomeWPItem;
|
||||
|
||||
struct _GnomeWPItem {
|
||||
|
|
|
@ -1,200 +0,0 @@
|
|||
/*
|
||||
* Authors: Rodney Dawes <dobey@ximian.com>
|
||||
*
|
||||
* Copyright 2003-2006 Novell, Inc. (www.novell.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "gnome-wp-utils.h"
|
||||
#include <string.h>
|
||||
|
||||
GdkPixbuf * gnome_wp_pixbuf_new_gradient (GtkOrientation orientation,
|
||||
GdkColor * c1,
|
||||
GdkColor * c2,
|
||||
gint width, gint height) {
|
||||
GdkPixbuf * pixbuf;
|
||||
gint i, j;
|
||||
gint dr, dg, db;
|
||||
gint gs1;
|
||||
gint vc = ((orientation == GTK_ORIENTATION_HORIZONTAL) || (c1 == c2));
|
||||
guchar * b, * row, * d;
|
||||
int rowstride;
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
|
||||
d = gdk_pixbuf_get_pixels (pixbuf);
|
||||
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
|
||||
dr = c2->red - c1->red;
|
||||
dg = c2->green - c1->green;
|
||||
db = c2->blue - c1->blue;
|
||||
|
||||
gs1 = (orientation == GTK_ORIENTATION_VERTICAL) ? height - 1 : width - 1;
|
||||
|
||||
row = g_new (unsigned char, rowstride);
|
||||
|
||||
if (vc) {
|
||||
b = row;
|
||||
for (j = 0; j < width; j++) {
|
||||
*b++ = (c1->red + (j * dr) / gs1) >> 8;
|
||||
*b++ = (c1->green + (j * dg) / gs1) >> 8;
|
||||
*b++ = (c1->blue + (j * db) / gs1) >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < height; i++) {
|
||||
if (!vc) {
|
||||
unsigned char cr, cg, cb;
|
||||
cr = (c1->red + (i * dr) / gs1) >> 8;
|
||||
cg = (c1->green + (i * dg) / gs1) >> 8;
|
||||
cb = (c1->blue + (i * db) / gs1) >> 8;
|
||||
b = row;
|
||||
for (j = 0; j < width; j++) {
|
||||
*b++ = cr;
|
||||
*b++ = cg;
|
||||
*b++ = cb;
|
||||
}
|
||||
}
|
||||
memcpy (d, row, width * 3);
|
||||
d += rowstride;
|
||||
}
|
||||
g_free (row);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf * gnome_wp_pixbuf_new_solid (GdkColor * color,
|
||||
gint width, gint height) {
|
||||
GdkPixbuf * pixbuf;
|
||||
gint j, rowstride;
|
||||
guchar * b, * d, * row;
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
|
||||
d = gdk_pixbuf_get_pixels (pixbuf);
|
||||
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
|
||||
row = g_new (unsigned char, rowstride);
|
||||
|
||||
b = row;
|
||||
for (j = 0; j < width; j++) {
|
||||
*b++ = color->red >> 8;
|
||||
*b++ = color->green >> 8;
|
||||
*b++ = color->blue >> 8;
|
||||
}
|
||||
|
||||
for (j = 0; j < height; j++) {
|
||||
memcpy (d, row, width * 3);
|
||||
d += rowstride;
|
||||
}
|
||||
|
||||
g_free (row);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
GdkPixbuf * gnome_wp_pixbuf_tile (GdkPixbuf * src_pixbuf,
|
||||
GdkPixbuf * dest_pixbuf,
|
||||
gint scaled_width,
|
||||
gint scaled_height) {
|
||||
GdkPixbuf * tmpbuf;
|
||||
gdouble cx, cy;
|
||||
gint dwidth, dheight;
|
||||
gint swidth, sheight;
|
||||
const guint alpha = 255;
|
||||
|
||||
if (dest_pixbuf == NULL) {
|
||||
return gdk_pixbuf_copy (src_pixbuf);
|
||||
}
|
||||
|
||||
tmpbuf = gdk_pixbuf_scale_simple (src_pixbuf, scaled_width, scaled_height,
|
||||
GDK_INTERP_BILINEAR);
|
||||
if (!tmpbuf)
|
||||
return NULL;
|
||||
|
||||
swidth = gdk_pixbuf_get_width (tmpbuf);
|
||||
sheight = gdk_pixbuf_get_height (tmpbuf);
|
||||
|
||||
dwidth = gdk_pixbuf_get_width (dest_pixbuf);
|
||||
dheight = gdk_pixbuf_get_height (dest_pixbuf);
|
||||
|
||||
for (cy = 0; cy < dheight; cy += sheight) {
|
||||
for (cx = 0; cx < dwidth; cx += swidth) {
|
||||
gdk_pixbuf_composite (tmpbuf, dest_pixbuf, cx, cy,
|
||||
MIN (swidth, dwidth - cx),
|
||||
MIN (sheight, dheight - cy),
|
||||
cx, cy, 1.0, 1.0,
|
||||
GDK_INTERP_BILINEAR, alpha);
|
||||
}
|
||||
}
|
||||
g_object_unref (tmpbuf);
|
||||
|
||||
return gdk_pixbuf_copy (dest_pixbuf);
|
||||
}
|
||||
|
||||
GdkPixbuf * gnome_wp_pixbuf_center (GdkPixbuf * src_pixbuf,
|
||||
GdkPixbuf * dest_pixbuf,
|
||||
gint scaled_width,
|
||||
gint scaled_height) {
|
||||
GdkPixbuf * tmpbuf;
|
||||
gint ox, oy, cx, cy;
|
||||
gint dwidth, dheight;
|
||||
gint swidth, sheight;
|
||||
gint cwidth, cheight;
|
||||
guint alpha = 255;
|
||||
|
||||
if (dest_pixbuf == NULL) {
|
||||
return gdk_pixbuf_copy (src_pixbuf);
|
||||
}
|
||||
|
||||
ox = cx = oy = cy = 0;
|
||||
|
||||
tmpbuf = gdk_pixbuf_scale_simple (src_pixbuf, scaled_width, scaled_height,
|
||||
GDK_INTERP_BILINEAR);
|
||||
|
||||
swidth = gdk_pixbuf_get_width (tmpbuf);
|
||||
sheight = gdk_pixbuf_get_height (tmpbuf);
|
||||
|
||||
dwidth = gdk_pixbuf_get_width (dest_pixbuf);
|
||||
dheight = gdk_pixbuf_get_height (dest_pixbuf);
|
||||
|
||||
if (dwidth > swidth) {
|
||||
ox = (dwidth - swidth) / 2;
|
||||
cx = 0;
|
||||
cwidth = swidth;
|
||||
} else {
|
||||
cx = (swidth - dwidth) / 2;
|
||||
oy = 0;
|
||||
cwidth = dwidth;
|
||||
}
|
||||
|
||||
if (dheight > sheight) {
|
||||
oy = ((dheight - sheight) / 2);
|
||||
cy = 0;
|
||||
cheight = sheight;
|
||||
} else {
|
||||
cy = (sheight - dheight) / 2;
|
||||
oy = 0;
|
||||
cheight = dheight;
|
||||
}
|
||||
|
||||
gdk_pixbuf_composite (tmpbuf, dest_pixbuf, ox, oy,
|
||||
cwidth, cheight,
|
||||
ox - cx, oy - cy, 1.0, 1.0,
|
||||
GDK_INTERP_BILINEAR, alpha);
|
||||
|
||||
g_object_unref (tmpbuf);
|
||||
return gdk_pixbuf_copy (dest_pixbuf);
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* Authors: Rodney Dawes <dobey@ximian.com>
|
||||
*
|
||||
* Copyright 2003-2006 Novell, Inc. (www.novell.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GNOME_WP_UTILS_H_
|
||||
#define _GNOME_WP_UTILS_H_
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define WP_PATH_KEY "/desktop/gnome/background"
|
||||
#define WP_FILE_KEY WP_PATH_KEY "/picture_filename"
|
||||
#define WP_OPTIONS_KEY WP_PATH_KEY "/picture_options"
|
||||
#define WP_SHADING_KEY WP_PATH_KEY "/color_shading_type"
|
||||
#define WP_PCOLOR_KEY WP_PATH_KEY "/primary_color"
|
||||
#define WP_SCOLOR_KEY WP_PATH_KEY "/secondary_color"
|
||||
#define WP_KEYBOARD_PATH "/desktop/gnome/peripherals/keyboard"
|
||||
#define WP_DELAY_KEY WP_KEYBOARD_PATH "/delay"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GdkPixbuf * gnome_wp_pixbuf_new_gradient (GtkOrientation orientation,
|
||||
GdkColor * c1,
|
||||
GdkColor * c2,
|
||||
gint width, gint height);
|
||||
|
||||
GdkPixbuf * gnome_wp_pixbuf_new_solid (GdkColor * color,
|
||||
gint width, gint height);
|
||||
|
||||
GdkPixbuf * gnome_wp_pixbuf_tile (GdkPixbuf * src_pixbuf,
|
||||
GdkPixbuf * dest_pixbuf,
|
||||
gint scaled_width,
|
||||
gint scaled_height);
|
||||
|
||||
GdkPixbuf * gnome_wp_pixbuf_center (GdkPixbuf * src_pixbuf,
|
||||
GdkPixbuf * dest_pixbuf,
|
||||
gint scaled_width,
|
||||
gint scaled_height);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include "appearance.h"
|
||||
#include "gnome-wp-item.h"
|
||||
#include "gnome-wp-utils.h"
|
||||
#include <string.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue