gnome-control-center/capplets/background/gnome-wp-item.h

71 lines
1.9 KiB
C
Raw Normal View History

/*
* Authors: Rodney Dawes <dobey@ximian.com>
*
Update copyright info to have correct years (2003-2004) 2004-06-28 Rodney Dawes <dobey@novell.com> * *.[ch]: Update copyright info to have correct years (2003-2004) * gnome-wp-capplet.c (gnome_wp_capplet_scroll_to_item): Abstract this code out so that we don't have to duplicated it every time we want to scroll to a particular item in the list (gnome_wp_add_image): Update this to return the new item that we created, and don't scroll to or set as the wallpaper, every time we call this function Use the new gnome_wp_item_new () call to create items (gnome_wp_add_images): Change the API to not use the files argument any longer, as we don't need it without the GTK+ 2.2 compat code Add all the items to the list and select the last one when finished (gnome_wp_file_open_dialog): Update to not pass in the files argument to gnome_wp_add_images () and free the GSList of filenames (bg_add_multiple_files): merge this code into the normal callback for when images are dragged to the dialog (bg_properties_dragged_image): Don't check if the list is more than 1 or not here, and always call gnome_wp_add_images () with the full list that we are given Convert the GList of GnomeVFSURIs that we get from gnome-vfs to a GSList of char * uris to pass into gnome_wp_add_images () (gnome_wp_load_stuffs, gnome_wp_file_changed): Use the new gnome_wp_capplet_scroll_to_item () and gnome_wp_item_new () API calls instead of duplicating code * gnome-wp-capplet.h: Remove the GConf key path defines from here * gnome-wp-item.[ch]: Add the gnome_wp_item_new () call to create the GnomeWPItem structure for storing wallpapers in * gnome-wp-utils.h: Put the GConf key path defines in here * gnome-wp-xml.c (gnome_wp_load_legacy): Use the gnome_wp_item_new () call to create items from the old legacy (XD2 capplet) list file
2004-06-28 18:51:21 +00:00
* Copyright 2003-2004 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 <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtktreeview.h>
#include <libgnomeui/gnome-thumbnail.h>
#include <gnome-wp-info.h>
#include <libgnomevfs/gnome-vfs.h>
#ifndef _GNOME_WP_ITEM_H_
#define _GNOME_WP_ITEM_H_
typedef struct _GnomeWPItem GnomeWPItem;
struct _GnomeWPItem {
gchar * name;
gchar * filename;
gchar * description;
gchar * imguri;
gchar * options;
gchar * shade_type;
gchar * pri_color;
gchar * sec_color;
/* Where the Item is in the List */
GtkTreeRowReference * rowref;
/* Real colors */
GdkColor * pcolor;
GdkColor * scolor;
GnomeWPInfo * fileinfo;
GnomeWPInfo * uriinfo;
/* Did the user remove us? */
gboolean deleted;
Regenerate the thumbnail in the list when we change scaling type now 2004-04-05 Rodney Dawes <dobey@ximian.com> * gnome-wp-capplet.c (gnome_wp_scale_type_changed): Regenerate the thumbnail in the list when we change scaling type now (wallpaper_properties_init): Add GtkFileFilter support (needs love) TreeView is buggy, so we need to not set the vertical-separator style property for it * gnome-wp-item.c: Include <config.h> and <gnome.h> here (collect_save_options): Add a function to set all of the pixbuf options for the thumbnail pixbuf properly, so we can save them back out (gnome_wp_item_get_thumbnail): Fix up the code to generate the thumbnails for the list a bit, so that we have sexy thumbnails that look exactly like how the image would, on-screen Initialize all of the width/height variables to 0 Add a new pixbuf variable for loading the original image to get the dimensions of it, so we can do thumbnailing more properly Use a LIST_IMAGE_WIDTH define, for the width of the images in the list Just return the bgpixbuf if we are creating the "No Wallpaper" thumb Save the thumbnail back out with the dimensions for the original image If our image is smaller than the list thumbnail, then just use 1.0 as the ratio for scaling the image for tiling/etc... Use the new API to do scaling inside the center/tile functions Reload the thumbnail pixbuf after generating it with the thumbnail system, so that we get all of the pixbuf options set correctly * gnome-wp-item.h (GnomeWPItem): store the original image's width and height in the item, so we can avoid reopening the original image every time we generate the thumbnail, on systems where the thumbnail doesn't contain the appropriate information * gnome-wp-utils.c (gnome_wp_pixbuf_tile): (gnome_wp_pixbuf_center): Add API to do the scaling inside these calls Fixes #136691
2004-04-05 21:32:02 +00:00
/* Width and Height of the original image */
gint width;
gint height;
};
Update copyright info to have correct years (2003-2004) 2004-06-28 Rodney Dawes <dobey@novell.com> * *.[ch]: Update copyright info to have correct years (2003-2004) * gnome-wp-capplet.c (gnome_wp_capplet_scroll_to_item): Abstract this code out so that we don't have to duplicated it every time we want to scroll to a particular item in the list (gnome_wp_add_image): Update this to return the new item that we created, and don't scroll to or set as the wallpaper, every time we call this function Use the new gnome_wp_item_new () call to create items (gnome_wp_add_images): Change the API to not use the files argument any longer, as we don't need it without the GTK+ 2.2 compat code Add all the items to the list and select the last one when finished (gnome_wp_file_open_dialog): Update to not pass in the files argument to gnome_wp_add_images () and free the GSList of filenames (bg_add_multiple_files): merge this code into the normal callback for when images are dragged to the dialog (bg_properties_dragged_image): Don't check if the list is more than 1 or not here, and always call gnome_wp_add_images () with the full list that we are given Convert the GList of GnomeVFSURIs that we get from gnome-vfs to a GSList of char * uris to pass into gnome_wp_add_images () (gnome_wp_load_stuffs, gnome_wp_file_changed): Use the new gnome_wp_capplet_scroll_to_item () and gnome_wp_item_new () API calls instead of duplicating code * gnome-wp-capplet.h: Remove the GConf key path defines from here * gnome-wp-item.[ch]: Add the gnome_wp_item_new () call to create the GnomeWPItem structure for storing wallpapers in * gnome-wp-utils.h: Put the GConf key path defines in here * gnome-wp-xml.c (gnome_wp_load_legacy): Use the gnome_wp_item_new () call to create items from the old legacy (XD2 capplet) list file
2004-06-28 18:51:21 +00:00
GnomeWPItem * gnome_wp_item_new (const gchar * filename,
GHashTable * wallpapers,
GnomeThumbnailFactory * thumbnails);
void gnome_wp_item_free (GnomeWPItem * item);
GdkPixbuf * gnome_wp_item_get_thumbnail (GnomeWPItem * item,
GnomeThumbnailFactory * thumbs);
void gnome_wp_item_update_description (GnomeWPItem * item);
#endif