2004-01-12 05:10:40 +00:00
|
|
|
/*
|
|
|
|
* Authors: Rodney Dawes <dobey@ximian.com>
|
|
|
|
*
|
2005-02-26 19:15:58 +00:00
|
|
|
* Copyright 2003-2005 Novell, Inc. (www.novell.com)
|
2004-01-12 05:10:40 +00:00
|
|
|
*
|
|
|
|
* 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-capplet.h"
|
|
|
|
|
|
|
|
enum {
|
|
|
|
TARGET_URI_LIST,
|
|
|
|
TARGET_URL,
|
|
|
|
TARGET_COLOR,
|
|
|
|
TARGET_BGIMAGE,
|
|
|
|
TARGET_BACKGROUND_RESET
|
|
|
|
};
|
|
|
|
|
|
|
|
static GtkTargetEntry drop_types[] = {
|
|
|
|
{"text/uri-list", 0, TARGET_URI_LIST},
|
|
|
|
/* { "application/x-color", 0, TARGET_COLOR }, */
|
|
|
|
{ "property/bgimage", 0, TARGET_BGIMAGE },
|
|
|
|
/* { "x-special/gnome-reset-background", 0, TARGET_BACKGROUND_RESET }*/
|
|
|
|
};
|
|
|
|
|
|
|
|
static void wp_props_load_wallpaper (gchar * key,
|
|
|
|
GnomeWPItem * item,
|
|
|
|
GnomeWPCapplet * capplet);
|
|
|
|
|
2005-08-16 21:14:14 +00:00
|
|
|
static void gnome_wp_set_sensitivities (GnomeWPCapplet* capplet);
|
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
static void wp_properties_error_dialog (GtkWindow * parent, char const * msg,
|
|
|
|
GError * err) {
|
|
|
|
if (err != NULL) {
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
|
|
|
dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
|
|
|
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
|
|
|
GTK_MESSAGE_ERROR,
|
|
|
|
GTK_BUTTONS_CLOSE,
|
|
|
|
msg, err->message);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (dialog),
|
|
|
|
"response",
|
|
|
|
G_CALLBACK (gtk_widget_destroy), NULL);
|
|
|
|
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
|
|
|
gtk_widget_show (dialog);
|
|
|
|
g_error_free (err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void wp_properties_help (GtkWindow * parent, char const * helpfile,
|
|
|
|
char const * section) {
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
g_return_if_fail (helpfile != NULL);
|
|
|
|
g_return_if_fail (section != NULL);
|
|
|
|
|
|
|
|
gnome_help_display_desktop (NULL, "user-guide", helpfile, section, &error);
|
|
|
|
if (error != NULL) {
|
|
|
|
wp_properties_error_dialog (parent,
|
|
|
|
_("There was an error displaying help: %s"),
|
|
|
|
error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-28 18:51:21 +00:00
|
|
|
static void gnome_wp_capplet_scroll_to_item (GnomeWPCapplet * capplet,
|
|
|
|
GnomeWPItem * item) {
|
2004-03-05 04:27:57 +00:00
|
|
|
GtkTreePath * path;
|
2004-06-28 18:51:21 +00:00
|
|
|
|
|
|
|
g_return_if_fail (capplet != NULL);
|
|
|
|
g_return_if_fail (item != NULL);
|
|
|
|
|
|
|
|
path = gtk_tree_row_reference_get_path (item->rowref);
|
|
|
|
gtk_tree_view_set_cursor (GTK_TREE_VIEW (capplet->treeview), path,
|
|
|
|
NULL, FALSE);
|
|
|
|
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (capplet->treeview),
|
|
|
|
path, NULL, TRUE, 0.5, 0.0);
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GnomeWPItem * gnome_wp_add_image (GnomeWPCapplet * capplet,
|
|
|
|
const gchar * filename) {
|
|
|
|
GnomeWPItem * item;
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2005-02-26 19:00:19 +00:00
|
|
|
if (!g_utf8_validate (filename, -1, NULL))
|
|
|
|
return NULL;
|
|
|
|
|
2004-03-01 04:09:06 +00:00
|
|
|
item = g_hash_table_lookup (capplet->wphash, filename);
|
|
|
|
if (item != NULL) {
|
|
|
|
if (item->deleted) {
|
|
|
|
item->deleted = FALSE;
|
|
|
|
wp_props_load_wallpaper (item->filename, item, capplet);
|
|
|
|
}
|
|
|
|
} else {
|
2004-06-28 18:51:21 +00:00
|
|
|
item = gnome_wp_item_new (filename, capplet->wphash, capplet->thumbs);
|
|
|
|
if (item != NULL) {
|
|
|
|
wp_props_load_wallpaper (item->filename, item, capplet);
|
|
|
|
}
|
2004-03-01 04:09:06 +00:00
|
|
|
}
|
2004-06-28 18:51:21 +00:00
|
|
|
|
|
|
|
return item;
|
2004-03-01 04:09:06 +00:00
|
|
|
}
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2004-03-01 04:09:06 +00:00
|
|
|
static void gnome_wp_add_images (GnomeWPCapplet * capplet,
|
2004-06-28 18:51:21 +00:00
|
|
|
GSList * images) {
|
2004-03-01 04:09:06 +00:00
|
|
|
GdkCursor * cursor;
|
2004-06-28 18:51:21 +00:00
|
|
|
GnomeWPItem * item;
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2004-06-28 18:51:21 +00:00
|
|
|
item = NULL;
|
2004-03-01 04:09:06 +00:00
|
|
|
cursor = gdk_cursor_new_for_display (gdk_display_get_default (),
|
|
|
|
GDK_WATCH);
|
|
|
|
gdk_window_set_cursor (capplet->window->window, cursor);
|
|
|
|
gdk_cursor_unref (cursor);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2004-03-01 04:09:06 +00:00
|
|
|
if (images != NULL) {
|
|
|
|
for (; images != NULL; images = images->next) {
|
2004-06-28 18:51:21 +00:00
|
|
|
item = gnome_wp_add_image (capplet, images->data);
|
2004-03-01 04:09:06 +00:00
|
|
|
}
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gdk_window_set_cursor (capplet->window->window, NULL);
|
2004-06-28 18:51:21 +00:00
|
|
|
|
|
|
|
if (item != NULL) {
|
|
|
|
gnome_wp_capplet_scroll_to_item (capplet, item);
|
|
|
|
}
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_file_open_dialog (GtkWidget * widget,
|
|
|
|
GnomeWPCapplet * capplet) {
|
2004-03-01 04:09:06 +00:00
|
|
|
GSList * files;
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2004-03-01 04:09:06 +00:00
|
|
|
switch (gtk_dialog_run (GTK_DIALOG (capplet->filesel))) {
|
|
|
|
case GTK_RESPONSE_OK:
|
|
|
|
files = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (capplet->filesel));
|
2004-06-28 18:51:21 +00:00
|
|
|
gnome_wp_add_images (capplet, files);
|
|
|
|
g_slist_free (files);
|
2004-03-01 04:09:06 +00:00
|
|
|
case GTK_RESPONSE_CANCEL:
|
|
|
|
default:
|
|
|
|
gtk_widget_hide (capplet->filesel);
|
|
|
|
break;
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void bg_properties_dragged_image (GtkWidget * widget,
|
|
|
|
GdkDragContext * context,
|
|
|
|
gint x, gint y,
|
|
|
|
GtkSelectionData * selection_data,
|
|
|
|
guint info, guint time,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
|
|
|
|
if (info == TARGET_URI_LIST || info == TARGET_BGIMAGE) {
|
|
|
|
GList * uris;
|
2004-06-28 18:51:21 +00:00
|
|
|
GSList * realuris = NULL;
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
uris = gnome_vfs_uri_list_parse ((gchar *) selection_data->data);
|
|
|
|
|
|
|
|
if (uris != NULL && uris->data != NULL) {
|
2004-06-28 18:51:21 +00:00
|
|
|
GdkCursor * cursor;
|
|
|
|
|
|
|
|
cursor = gdk_cursor_new_for_display (gdk_display_get_default (),
|
|
|
|
GDK_WATCH);
|
|
|
|
gdk_window_set_cursor (capplet->window->window, cursor);
|
|
|
|
gdk_cursor_unref (cursor);
|
|
|
|
|
|
|
|
for (; uris != NULL; uris = uris->next) {
|
|
|
|
realuris = g_slist_append (realuris,
|
|
|
|
g_strdup (gnome_vfs_uri_get_path (uris->data)));
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
2004-06-28 18:51:21 +00:00
|
|
|
gnome_wp_add_images (capplet, realuris);
|
|
|
|
gdk_window_set_cursor (capplet->window->window, NULL);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
gnome_vfs_uri_list_free (uris);
|
2004-06-28 18:51:21 +00:00
|
|
|
g_slist_free (realuris);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void wp_props_load_wallpaper (gchar * key,
|
|
|
|
GnomeWPItem * item,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreePath * path;
|
|
|
|
GdkPixbuf * pixbuf;
|
|
|
|
|
|
|
|
if (item->deleted == TRUE) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_list_store_append (GTK_LIST_STORE (capplet->model), &iter);
|
|
|
|
|
|
|
|
pixbuf = gnome_wp_item_get_thumbnail (item, capplet->thumbs);
|
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
|
|
|
gnome_wp_item_update_description (item);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
if (pixbuf != NULL) {
|
|
|
|
gtk_list_store_set (GTK_LIST_STORE (capplet->model), &iter,
|
|
|
|
0, pixbuf,
|
|
|
|
1, item->description,
|
|
|
|
2, item->filename,
|
|
|
|
-1);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
} else {
|
|
|
|
gtk_list_store_set (GTK_LIST_STORE (capplet->model), &iter,
|
|
|
|
1, item->description,
|
|
|
|
2, item->filename,
|
|
|
|
-1);
|
|
|
|
}
|
|
|
|
path = gtk_tree_model_get_path (capplet->model, &iter);
|
|
|
|
item->rowref = gtk_tree_row_reference_new (capplet->model, path);
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint gnome_wp_option_menu_get (GtkOptionMenu * menu) {
|
|
|
|
GtkWidget * widget;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_OPTION_MENU (menu), -1);
|
|
|
|
|
|
|
|
widget = gtk_menu_get_active (GTK_MENU (menu->menu));
|
|
|
|
|
|
|
|
if (widget != NULL) {
|
|
|
|
return g_list_index (GTK_MENU_SHELL (menu->menu)->children, widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_option_menu_set (GnomeWPCapplet * capplet,
|
|
|
|
const gchar * value,
|
|
|
|
gboolean shade_type) {
|
|
|
|
if (shade_type) {
|
|
|
|
if (!strcmp (value, "horizontal-gradient")) {
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (capplet->color_opt),
|
|
|
|
GNOME_WP_SHADE_TYPE_HORIZ);
|
|
|
|
gtk_widget_show (capplet->sc_picker);
|
|
|
|
} else if (!strcmp (value, "vertical-gradient")) {
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (capplet->color_opt),
|
|
|
|
GNOME_WP_SHADE_TYPE_VERT);
|
|
|
|
gtk_widget_show (capplet->sc_picker);
|
|
|
|
} else {
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (capplet->color_opt),
|
|
|
|
GNOME_WP_SHADE_TYPE_SOLID);
|
|
|
|
gtk_widget_hide (capplet->sc_picker);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!strcmp (value, "centered")) {
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (capplet->wp_opts),
|
|
|
|
GNOME_WP_SCALE_TYPE_CENTERED);
|
|
|
|
} else if (!strcmp (value, "stretched")) {
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (capplet->wp_opts),
|
|
|
|
GNOME_WP_SCALE_TYPE_STRETCHED);
|
|
|
|
} else if (!strcmp (value, "scaled")) {
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (capplet->wp_opts),
|
|
|
|
GNOME_WP_SCALE_TYPE_SCALED);
|
|
|
|
} else {
|
|
|
|
gtk_option_menu_set_history (GTK_OPTION_MENU (capplet->wp_opts),
|
|
|
|
GNOME_WP_SCALE_TYPE_TILED);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean gnome_wp_props_wp_set (GnomeWPCapplet * capplet) {
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeModel * model;
|
|
|
|
GtkTreeSelection * selection;
|
|
|
|
GnomeWPItem * item;
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
GConfChangeSet * cs;
|
2004-01-12 05:10:40 +00:00
|
|
|
gchar * wpfile;
|
|
|
|
GdkPixbuf * pixbuf;
|
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (capplet->treeview));
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
|
|
|
|
gtk_tree_model_get (model, &iter, 2, &wpfile, -1);
|
|
|
|
|
|
|
|
item = g_hash_table_lookup (capplet->wphash, wpfile);
|
|
|
|
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
cs = gconf_change_set_new ();
|
|
|
|
|
2005-08-16 21:14:14 +00:00
|
|
|
gnome_wp_set_sensitivities (capplet);
|
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
if (!strcmp (item->filename, "(none)")) {
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
gconf_change_set_set_string (cs, WP_OPTIONS_KEY, "none");
|
2004-01-12 05:10:40 +00:00
|
|
|
} else {
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
gconf_change_set_set_string (cs, WP_FILE_KEY, item->filename);
|
|
|
|
gconf_change_set_set_string (cs, WP_OPTIONS_KEY, item->options);
|
2004-01-12 05:10:40 +00:00
|
|
|
gnome_wp_option_menu_set (capplet, item->options, FALSE);
|
|
|
|
}
|
|
|
|
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
gconf_change_set_set_string (cs, WP_SHADING_KEY, item->shade_type);
|
2004-01-12 05:10:40 +00:00
|
|
|
gnome_wp_option_menu_set (capplet, item->shade_type, TRUE);
|
|
|
|
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
gconf_change_set_set_string (cs, WP_PCOLOR_KEY, item->pri_color);
|
|
|
|
gconf_change_set_set_string (cs, WP_SCOLOR_KEY, item->sec_color);
|
|
|
|
|
|
|
|
gconf_client_commit_change_set (capplet->client, cs, TRUE, NULL);
|
|
|
|
|
|
|
|
gconf_change_set_unref (cs);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2005-07-25 20:51:16 +00:00
|
|
|
gtk_color_button_set_color (GTK_COLOR_BUTTON (capplet->pc_picker), item->pcolor);
|
|
|
|
gtk_color_button_set_color (GTK_COLOR_BUTTON (capplet->sc_picker), item->scolor);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
g_free (wpfile);
|
|
|
|
|
|
|
|
pixbuf = gnome_wp_pixbuf_new_solid (item->pcolor, 14, 12);
|
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (capplet->smenuitem), pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
|
|
|
|
pixbuf = gnome_wp_pixbuf_new_gradient (GTK_ORIENTATION_HORIZONTAL,
|
|
|
|
item->pcolor, item->scolor, 14, 12);
|
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (capplet->hmenuitem), pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
|
|
|
|
pixbuf = gnome_wp_pixbuf_new_gradient (GTK_ORIENTATION_VERTICAL,
|
|
|
|
item->pcolor, item->scolor, 14, 12);
|
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (capplet->vmenuitem), pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
} else {
|
|
|
|
gtk_widget_set_sensitive (capplet->rm_button, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_props_wp_selected (GtkTreeSelection * selection,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
if (capplet->idleid > 0) {
|
|
|
|
g_source_remove (capplet->idleid);
|
|
|
|
}
|
|
|
|
capplet->idleid = g_timeout_add (capplet->delay + 100,
|
|
|
|
(GSourceFunc) gnome_wp_props_wp_set,
|
|
|
|
capplet);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_remove_wp (gchar * key, GnomeWPItem * item,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
GtkTreePath * path;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
if (item->rowref != NULL && item->deleted == FALSE) {
|
|
|
|
path = gtk_tree_row_reference_get_path (item->rowref);
|
2005-01-09 03:53:35 +00:00
|
|
|
if (path != NULL) {
|
|
|
|
gtk_tree_model_get_iter (capplet->model, &iter, path);
|
|
|
|
gtk_tree_path_free (path);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2005-01-09 03:53:35 +00:00
|
|
|
gtk_list_store_remove (GTK_LIST_STORE (capplet->model), &iter);
|
|
|
|
}
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void gnome_wp_main_quit (GnomeWPCapplet * capplet) {
|
|
|
|
g_hash_table_foreach (capplet->wphash, (GHFunc) gnome_wp_remove_wp,
|
|
|
|
capplet);
|
|
|
|
|
|
|
|
gnome_wp_xml_save_list (capplet);
|
|
|
|
|
|
|
|
g_object_unref (capplet->thumbs);
|
|
|
|
|
|
|
|
g_hash_table_destroy (capplet->wphash);
|
|
|
|
|
|
|
|
gtk_main_quit ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void wallpaper_properties_clicked (GtkWidget * dialog,
|
|
|
|
gint response_id,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
switch (response_id) {
|
|
|
|
case GTK_RESPONSE_HELP:
|
|
|
|
wp_properties_help (GTK_WINDOW (dialog),
|
2004-02-12 14:23:03 +00:00
|
|
|
"user-guide.xml", "goscustdesk-7");
|
2004-01-12 05:10:40 +00:00
|
|
|
break;
|
2004-08-17 01:15:02 +00:00
|
|
|
case GTK_RESPONSE_DELETE_EVENT:
|
2004-01-12 05:10:40 +00:00
|
|
|
case GTK_RESPONSE_CLOSE: {
|
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
gnome_wp_main_quit (capplet);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-26 03:15:35 +00:00
|
|
|
static void gnome_wp_scale_type_changed (GtkOptionMenu * option_menu,
|
2004-01-12 05:10:40 +00:00
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
GnomeWPItem * item = NULL;
|
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
|
|
|
GdkPixbuf * pixbuf;
|
2004-01-12 05:10:40 +00:00
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeModel * model;
|
|
|
|
GtkTreeSelection * selection;
|
|
|
|
gchar * wpfile;
|
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (capplet->treeview));
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
|
|
|
|
gtk_tree_model_get (model, &iter, 2, &wpfile, -1);
|
|
|
|
|
|
|
|
item = g_hash_table_lookup (capplet->wphash, wpfile);
|
|
|
|
|
|
|
|
g_free (wpfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
switch (gnome_wp_option_menu_get (GTK_OPTION_MENU (capplet->wp_opts))) {
|
|
|
|
case GNOME_WP_SCALE_TYPE_CENTERED:
|
|
|
|
item->options = g_strdup ("centered");
|
|
|
|
break;
|
|
|
|
case GNOME_WP_SCALE_TYPE_STRETCHED:
|
|
|
|
item->options = g_strdup ("stretched");
|
|
|
|
break;
|
|
|
|
case GNOME_WP_SCALE_TYPE_SCALED:
|
|
|
|
item->options = g_strdup ("scaled");
|
|
|
|
break;
|
|
|
|
case GNOME_WP_SCALE_TYPE_TILED:
|
|
|
|
item->options = g_strdup ("wallpaper");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
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
|
|
|
pixbuf = gnome_wp_item_get_thumbnail (item, capplet->thumbs);
|
|
|
|
gtk_list_store_set (GTK_LIST_STORE (capplet->model), &iter,
|
|
|
|
0, pixbuf,
|
|
|
|
-1);
|
|
|
|
g_object_unref (pixbuf);
|
2004-01-12 05:10:40 +00:00
|
|
|
gconf_client_set_string (capplet->client, WP_OPTIONS_KEY,
|
|
|
|
item->options, NULL);
|
|
|
|
}
|
|
|
|
|
2005-07-26 03:15:35 +00:00
|
|
|
static void gnome_wp_shade_type_changed (GtkOptionMenu * option_menu,
|
2004-01-12 05:10:40 +00:00
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
GnomeWPItem * item = NULL;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeModel * model;
|
|
|
|
GtkTreeSelection * selection;
|
|
|
|
gchar * wpfile;
|
|
|
|
GdkPixbuf * pixbuf;
|
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (capplet->treeview));
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
|
|
|
|
gtk_tree_model_get (model, &iter, 2, &wpfile, -1);
|
|
|
|
|
|
|
|
item = g_hash_table_lookup (capplet->wphash, wpfile);
|
|
|
|
|
|
|
|
g_free (wpfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (gnome_wp_option_menu_get (GTK_OPTION_MENU (capplet->color_opt))) {
|
|
|
|
case GNOME_WP_SHADE_TYPE_HORIZ:
|
|
|
|
item->shade_type = g_strdup ("horizontal-gradient");
|
|
|
|
gtk_widget_show (capplet->sc_picker);
|
|
|
|
break;
|
|
|
|
case GNOME_WP_SHADE_TYPE_VERT:
|
|
|
|
item->shade_type = g_strdup ("vertical-gradient");
|
|
|
|
gtk_widget_show (capplet->sc_picker);
|
|
|
|
break;
|
|
|
|
case GNOME_WP_SHADE_TYPE_SOLID:
|
|
|
|
item->shade_type = g_strdup ("solid");
|
|
|
|
gtk_widget_hide (capplet->sc_picker);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
pixbuf = gnome_wp_item_get_thumbnail (item, capplet->thumbs);
|
|
|
|
gtk_list_store_set (GTK_LIST_STORE (capplet->model), &iter,
|
|
|
|
0, pixbuf,
|
|
|
|
-1);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
gconf_client_set_string (capplet->client, WP_SHADING_KEY,
|
|
|
|
item->shade_type, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_color_changed (GnomeWPCapplet * capplet,
|
2005-02-06 22:41:19 +00:00
|
|
|
gboolean update) {
|
2004-01-12 05:10:40 +00:00
|
|
|
GnomeWPItem * item = NULL;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeModel * model;
|
|
|
|
GtkTreeSelection * selection;
|
|
|
|
gchar * wpfile;
|
|
|
|
GdkPixbuf * pixbuf;
|
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (capplet->treeview));
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
|
|
|
|
gtk_tree_model_get (model, &iter, 2, &wpfile, -1);
|
|
|
|
|
|
|
|
item = g_hash_table_lookup (capplet->wphash, wpfile);
|
|
|
|
|
|
|
|
g_free (wpfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item == NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-02-06 22:41:19 +00:00
|
|
|
g_free (item->pri_color);
|
2005-07-25 20:51:16 +00:00
|
|
|
|
|
|
|
gtk_color_button_get_color (GTK_COLOR_BUTTON (capplet->pc_picker), item->pcolor);
|
|
|
|
|
2005-02-06 22:41:19 +00:00
|
|
|
item->pri_color = g_strdup_printf ("#%02X%02X%02X",
|
|
|
|
item->pcolor->red >> 8,
|
|
|
|
item->pcolor->green >> 8,
|
|
|
|
item->pcolor->blue >> 8);
|
|
|
|
|
|
|
|
g_free (item->sec_color);
|
2005-07-25 20:51:16 +00:00
|
|
|
|
|
|
|
gtk_color_button_get_color (GTK_COLOR_BUTTON (capplet->sc_picker), item->scolor);
|
|
|
|
|
2005-02-06 22:41:19 +00:00
|
|
|
item->sec_color = g_strdup_printf ("#%02X%02X%02X",
|
|
|
|
item->scolor->red >> 8,
|
|
|
|
item->scolor->green >> 8,
|
|
|
|
item->scolor->blue >> 8);
|
|
|
|
|
|
|
|
if (update) {
|
2004-01-12 05:10:40 +00:00
|
|
|
gconf_client_set_string (capplet->client, WP_PCOLOR_KEY,
|
|
|
|
item->pri_color, NULL);
|
|
|
|
gconf_client_set_string (capplet->client, WP_SCOLOR_KEY,
|
|
|
|
item->sec_color, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
gnome_wp_shade_type_changed (NULL, capplet);
|
|
|
|
|
|
|
|
pixbuf = gnome_wp_pixbuf_new_solid (item->pcolor, 14, 12);
|
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (capplet->smenuitem), pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
|
|
|
|
pixbuf = gnome_wp_pixbuf_new_gradient (GTK_ORIENTATION_HORIZONTAL,
|
|
|
|
item->pcolor, item->scolor, 14, 12);
|
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (capplet->hmenuitem), pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
|
|
|
|
pixbuf = gnome_wp_pixbuf_new_gradient (GTK_ORIENTATION_VERTICAL,
|
|
|
|
item->pcolor, item->scolor, 14, 12);
|
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (capplet->vmenuitem), pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_scolor_changed (GtkWidget * widget,
|
|
|
|
GnomeWPCapplet * capplet) {
|
2005-02-06 22:41:19 +00:00
|
|
|
gnome_wp_color_changed (capplet, TRUE);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_remove_wallpaper (GtkWidget * widget,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeModel * model;
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
GtkTreePath * first;
|
2004-01-12 05:10:40 +00:00
|
|
|
GtkTreeSelection * selection;
|
|
|
|
gchar * wpfile;
|
|
|
|
|
|
|
|
if (capplet->idleid > 0) {
|
|
|
|
g_source_remove (capplet->idleid);
|
|
|
|
}
|
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (capplet->treeview));
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
|
|
|
|
GnomeWPItem * item;
|
|
|
|
|
|
|
|
gtk_tree_model_get (model, &iter, 2, &wpfile, -1);
|
|
|
|
|
|
|
|
item = g_hash_table_lookup (capplet->wphash, wpfile);
|
|
|
|
item->deleted = TRUE;
|
|
|
|
|
|
|
|
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
|
2004-07-19 21:16:50 +00:00
|
|
|
|
|
|
|
g_free (wpfile);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
first = gtk_tree_path_new_first ();
|
|
|
|
gtk_tree_view_set_cursor (GTK_TREE_VIEW (capplet->treeview),
|
|
|
|
first, NULL, FALSE);
|
|
|
|
gtk_tree_path_free (first);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean gnome_wp_load_stuffs (void * data) {
|
|
|
|
GnomeWPCapplet * capplet = (GnomeWPCapplet *) data;
|
2004-02-04 22:04:14 +00:00
|
|
|
gchar * imagepath, * style;
|
2004-01-12 05:10:40 +00:00
|
|
|
GnomeWPItem * item;
|
|
|
|
|
2004-02-04 22:04:14 +00:00
|
|
|
style = gconf_client_get_string (capplet->client,
|
|
|
|
WP_OPTIONS_KEY,
|
|
|
|
NULL);
|
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
gnome_wp_xml_load_list (capplet);
|
|
|
|
g_hash_table_foreach (capplet->wphash, (GHFunc) wp_props_load_wallpaper,
|
|
|
|
capplet);
|
|
|
|
|
|
|
|
gdk_window_set_cursor (capplet->window->window, NULL);
|
|
|
|
|
|
|
|
imagepath = gconf_client_get_string (capplet->client,
|
|
|
|
WP_FILE_KEY,
|
|
|
|
NULL);
|
2004-02-04 22:04:14 +00:00
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
item = g_hash_table_lookup (capplet->wphash, imagepath);
|
2004-02-04 22:04:14 +00:00
|
|
|
if (item != NULL && strcmp (style, "none") != 0) {
|
2004-01-12 05:10:40 +00:00
|
|
|
if (item->deleted == TRUE) {
|
|
|
|
item->deleted = FALSE;
|
|
|
|
wp_props_load_wallpaper (item->filename, item, capplet);
|
|
|
|
}
|
|
|
|
|
2004-06-28 18:51:21 +00:00
|
|
|
gnome_wp_capplet_scroll_to_item (capplet, item);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
gnome_wp_option_menu_set (capplet, item->options, FALSE);
|
|
|
|
gnome_wp_option_menu_set (capplet, item->shade_type, TRUE);
|
|
|
|
|
2005-07-25 20:51:16 +00:00
|
|
|
gtk_color_button_set_color (GTK_COLOR_BUTTON (capplet->pc_picker), item->pcolor);
|
|
|
|
gtk_color_button_set_color (GTK_COLOR_BUTTON (capplet->sc_picker), item->pcolor);
|
|
|
|
|
2004-02-04 22:04:14 +00:00
|
|
|
} else if (strcmp (style, "none") != 0) {
|
2005-01-09 03:53:35 +00:00
|
|
|
item = gnome_wp_add_image (capplet, imagepath);
|
|
|
|
gnome_wp_capplet_scroll_to_item (capplet, item);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
item = g_hash_table_lookup (capplet->wphash, "(none)");
|
|
|
|
if (item == NULL) {
|
2004-06-28 18:51:21 +00:00
|
|
|
item = gnome_wp_item_new ("(none)", capplet->wphash, capplet->thumbs);
|
|
|
|
if (item != NULL) {
|
|
|
|
wp_props_load_wallpaper (item->filename, item, capplet);
|
|
|
|
}
|
2004-01-12 05:10:40 +00:00
|
|
|
} else {
|
|
|
|
if (item->deleted == TRUE) {
|
|
|
|
item->deleted = FALSE;
|
|
|
|
wp_props_load_wallpaper (item->filename, item, capplet);
|
|
|
|
}
|
2004-02-04 22:04:14 +00:00
|
|
|
|
|
|
|
if (!strcmp (style, "none")) {
|
2004-06-28 18:51:21 +00:00
|
|
|
gnome_wp_capplet_scroll_to_item (capplet, item);
|
2004-02-04 22:04:14 +00:00
|
|
|
}
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
2004-02-04 22:04:14 +00:00
|
|
|
g_free (imagepath);
|
|
|
|
g_free (style);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2005-01-09 03:53:35 +00:00
|
|
|
if (capplet->uri_list) {
|
|
|
|
gnome_wp_add_images (capplet, capplet->uri_list);
|
|
|
|
g_slist_free (capplet->uri_list);
|
|
|
|
}
|
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint gnome_wp_list_sort (GtkTreeModel * model,
|
|
|
|
GtkTreeIter * a, GtkTreeIter * b,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
gchar * foo, * bar;
|
|
|
|
gchar * desca, * descb;
|
2004-07-19 21:16:50 +00:00
|
|
|
gint retval;
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
gtk_tree_model_get (model, a, 1, &desca, 2, &foo, -1);
|
|
|
|
gtk_tree_model_get (model, b, 1, &descb, 2, &bar, -1);
|
|
|
|
|
|
|
|
if (!strcmp (foo, "(none)")) {
|
2004-07-19 21:16:50 +00:00
|
|
|
retval = -1;
|
2004-01-12 05:10:40 +00:00
|
|
|
} else if (!strcmp (bar, "(none)")) {
|
2004-07-19 21:16:50 +00:00
|
|
|
retval = 1;
|
2004-01-12 05:10:40 +00:00
|
|
|
} else {
|
2004-07-19 21:16:50 +00:00
|
|
|
retval = g_utf8_collate (desca, descb);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
2004-07-19 21:16:50 +00:00
|
|
|
|
|
|
|
g_free (desca);
|
|
|
|
g_free (descb);
|
|
|
|
g_free (foo);
|
|
|
|
g_free (bar);
|
|
|
|
|
|
|
|
return retval;
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_file_changed (GConfClient * client, guint id,
|
|
|
|
GConfEntry * entry,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
GtkTreeSelection * selection;
|
|
|
|
GtkTreeModel * model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GnomeWPItem * item;
|
|
|
|
gchar * wpfile, * selected;
|
|
|
|
|
|
|
|
wpfile = g_strdup (gconf_value_get_string (entry->value));
|
|
|
|
item = g_hash_table_lookup (capplet->wphash, wpfile);
|
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (capplet->treeview));
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
|
|
|
|
gtk_tree_model_get (model, &iter, 2, &selected, -1);
|
|
|
|
if (strcmp (selected, wpfile) != 0) {
|
|
|
|
if (item != NULL) {
|
2004-06-28 18:51:21 +00:00
|
|
|
gnome_wp_capplet_scroll_to_item (capplet, item);
|
2004-01-12 05:10:40 +00:00
|
|
|
} else {
|
2005-01-09 03:53:35 +00:00
|
|
|
item = gnome_wp_add_image (capplet, wpfile);
|
|
|
|
gnome_wp_capplet_scroll_to_item (capplet, item);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
g_free (wpfile);
|
|
|
|
g_free (selected);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_options_changed (GConfClient * client, guint id,
|
|
|
|
GConfEntry * entry,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
GtkTreeSelection * selection;
|
|
|
|
GtkTreeModel * model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GnomeWPItem * item;
|
|
|
|
gchar * wpfile;
|
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (capplet->treeview));
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
|
|
|
|
gtk_tree_model_get (model, &iter, 2, &wpfile, -1);
|
|
|
|
|
|
|
|
item = g_hash_table_lookup (capplet->wphash, wpfile);
|
|
|
|
|
|
|
|
if (item != NULL) {
|
|
|
|
item->options = g_strdup (gconf_value_get_string (entry->value));
|
|
|
|
gnome_wp_option_menu_set (capplet, item->options, FALSE);
|
|
|
|
}
|
|
|
|
g_free (wpfile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_shading_changed (GConfClient * client, guint id,
|
|
|
|
GConfEntry * entry,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
GtkTreeSelection * selection;
|
|
|
|
GtkTreeModel * model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GnomeWPItem * item;
|
|
|
|
gchar * wpfile;
|
|
|
|
|
2005-08-16 21:14:14 +00:00
|
|
|
gnome_wp_set_sensitivities (capplet);
|
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (capplet->treeview));
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
|
|
|
|
gtk_tree_model_get (model, &iter, 2, &wpfile, -1);
|
|
|
|
|
|
|
|
item = g_hash_table_lookup (capplet->wphash, wpfile);
|
|
|
|
|
|
|
|
if (item != NULL) {
|
|
|
|
item->shade_type = g_strdup (gconf_value_get_string (entry->value));
|
|
|
|
gnome_wp_option_menu_set (capplet, item->shade_type, TRUE);
|
|
|
|
}
|
|
|
|
g_free (wpfile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_color1_changed (GConfClient * client, guint id,
|
|
|
|
GConfEntry * entry,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
GdkColor color;
|
|
|
|
const gchar * colorhex;
|
|
|
|
|
|
|
|
colorhex = gconf_value_get_string (entry->value);
|
|
|
|
|
|
|
|
gdk_color_parse (colorhex, &color);
|
|
|
|
|
2005-07-25 20:51:16 +00:00
|
|
|
gtk_color_button_set_color (GTK_COLOR_BUTTON (capplet->pc_picker), &color);
|
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2005-02-06 22:41:19 +00:00
|
|
|
gnome_wp_color_changed (capplet, FALSE);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_color2_changed (GConfClient * client, guint id,
|
|
|
|
GConfEntry * entry,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
GdkColor color;
|
|
|
|
const gchar * colorhex;
|
|
|
|
|
2005-08-16 21:14:14 +00:00
|
|
|
gnome_wp_set_sensitivities (capplet);
|
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
colorhex = gconf_value_get_string (entry->value);
|
|
|
|
|
|
|
|
gdk_color_parse (colorhex, &color);
|
|
|
|
|
2005-07-25 20:51:16 +00:00
|
|
|
gtk_color_button_set_color (GTK_COLOR_BUTTON (capplet->sc_picker), &color);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
gnome_wp_color_changed (capplet, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gnome_wp_delay_changed (GConfClient * client, guint id,
|
|
|
|
GConfEntry * entry,
|
|
|
|
GnomeWPCapplet * capplet) {
|
|
|
|
capplet->delay = gconf_value_get_int (entry->value);
|
|
|
|
}
|
|
|
|
|
2005-07-10 20:45:00 +00:00
|
|
|
static void gnome_wp_icon_theme_changed (GtkIconTheme * theme,
|
2004-01-12 05:10:40 +00:00
|
|
|
GnomeWPCapplet * capplet) {
|
2004-02-05 00:31:48 +00:00
|
|
|
GdkPixbuf * pixbuf;
|
2005-07-10 20:45:00 +00:00
|
|
|
GtkIconInfo * icon_info = NULL;
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2005-07-10 20:45:00 +00:00
|
|
|
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
|
2004-08-20 16:50:57 +00:00
|
|
|
"gnome-settings-background",
|
2005-07-10 20:45:00 +00:00
|
|
|
48, 0);
|
|
|
|
if (icon_info != NULL) {
|
|
|
|
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
|
|
|
|
gtk_icon_info_free (icon_info);
|
2004-02-05 00:31:48 +00:00
|
|
|
gtk_window_set_icon (GTK_WINDOW (capplet->window), NULL);
|
2005-07-10 20:45:00 +00:00
|
|
|
gtk_window_set_default_icon (pixbuf);
|
2004-02-05 00:31:48 +00:00
|
|
|
g_object_unref (pixbuf);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
|
2005-07-10 20:45:00 +00:00
|
|
|
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
|
2004-01-12 05:10:40 +00:00
|
|
|
"stock_wallpaper-center",
|
2005-07-10 20:45:00 +00:00
|
|
|
16, 0);
|
|
|
|
if (icon_info != NULL) {
|
|
|
|
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
|
|
|
|
gtk_icon_info_free (icon_info);
|
2004-01-12 05:10:40 +00:00
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (capplet->citem), pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
}
|
|
|
|
|
2005-07-10 20:45:00 +00:00
|
|
|
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
|
2004-01-12 05:10:40 +00:00
|
|
|
"stock_wallpaper-fill",
|
2005-07-10 20:45:00 +00:00
|
|
|
16, 0);
|
|
|
|
if (icon_info != NULL) {
|
|
|
|
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
|
|
|
|
gtk_icon_info_free (icon_info);
|
2004-01-12 05:10:40 +00:00
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (capplet->fitem), pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
}
|
|
|
|
|
2005-07-10 20:45:00 +00:00
|
|
|
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
|
2004-01-12 05:10:40 +00:00
|
|
|
"stock_wallpaper-scale",
|
2005-07-10 20:45:00 +00:00
|
|
|
16, 0);
|
|
|
|
if (icon_info != NULL) {
|
|
|
|
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
|
|
|
|
gtk_icon_info_free (icon_info);
|
2004-01-12 05:10:40 +00:00
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (capplet->sitem), pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
}
|
|
|
|
|
2005-07-10 20:45:00 +00:00
|
|
|
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
|
2004-01-12 05:10:40 +00:00
|
|
|
"stock_wallpaper-tile",
|
2005-07-10 20:45:00 +00:00
|
|
|
16, 0);
|
|
|
|
if (icon_info != NULL) {
|
|
|
|
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
|
|
|
|
gtk_icon_info_free (icon_info);
|
2004-01-12 05:10:40 +00:00
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (capplet->witem), pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-05 00:31:48 +00:00
|
|
|
static GladeXML * gnome_wp_create_dialog (void) {
|
|
|
|
GladeXML * new;
|
|
|
|
gchar * gladefile;
|
|
|
|
|
|
|
|
gladefile = g_build_filename (GNOMECC_DATA_DIR,
|
|
|
|
"interfaces",
|
|
|
|
"gnome-background-properties.glade",
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (!g_file_test (gladefile, G_FILE_TEST_EXISTS)) {
|
|
|
|
gladefile = g_build_filename (g_get_current_dir (),
|
|
|
|
"gnome-background-properties.glade",
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
new = glade_xml_new (gladefile, NULL, NULL);
|
|
|
|
g_free (gladefile);
|
|
|
|
|
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
2004-05-18 16:29:29 +00:00
|
|
|
static void set_accessible_name (GtkWidget *widget, const gchar *name) {
|
|
|
|
AtkObject *obj;
|
|
|
|
|
|
|
|
obj = gtk_widget_get_accessible (widget);
|
|
|
|
if (!GTK_IS_ACCESSIBLE (obj))
|
|
|
|
return;
|
|
|
|
if (name)
|
|
|
|
atk_object_set_name (obj, name);
|
|
|
|
}
|
2005-01-09 23:57:36 +00:00
|
|
|
|
|
|
|
static void gnome_wp_update_preview (GtkFileChooser *chooser,
|
|
|
|
GnomeWPCapplet *capplet) {
|
|
|
|
gchar *uri;
|
|
|
|
|
|
|
|
uri = gtk_file_chooser_get_preview_uri (chooser);
|
|
|
|
|
|
|
|
if (uri) {
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
gchar *mime_type;
|
|
|
|
|
|
|
|
mime_type = gnome_vfs_get_mime_type (uri);
|
|
|
|
pixbuf = gnome_thumbnail_factory_generate_thumbnail (capplet->thumbs,
|
|
|
|
uri,
|
|
|
|
mime_type);
|
|
|
|
|
|
|
|
if(pixbuf != NULL) {
|
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (capplet->image), pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
} else {
|
|
|
|
gtk_image_set_from_stock (GTK_IMAGE (capplet->image),
|
|
|
|
"gtk-dialog-question",
|
|
|
|
GTK_ICON_SIZE_DIALOG);
|
|
|
|
}
|
|
|
|
g_free (mime_type);
|
|
|
|
}
|
|
|
|
gtk_file_chooser_set_preview_widget_active (chooser, TRUE);
|
|
|
|
}
|
2004-05-18 16:29:29 +00:00
|
|
|
|
2005-01-09 03:53:35 +00:00
|
|
|
static void wallpaper_properties_init (poptContext ctx) {
|
2004-01-12 05:10:40 +00:00
|
|
|
GnomeWPCapplet * capplet;
|
2004-02-05 00:31:48 +00:00
|
|
|
GladeXML * dialog;
|
|
|
|
GtkWidget * menu, * label;
|
2004-01-12 05:10:40 +00:00
|
|
|
GtkWidget * mbox, * mitem;
|
2004-02-05 00:31:48 +00:00
|
|
|
GtkWidget * add_button;
|
2004-01-12 05:10:40 +00:00
|
|
|
GtkCellRenderer * renderer;
|
|
|
|
GtkTreeViewColumn * column;
|
|
|
|
GtkTreeSelection * selection;
|
2004-02-05 00:31:48 +00:00
|
|
|
GdkPixbuf * pixbuf;
|
2004-01-12 05:10:40 +00:00
|
|
|
GdkCursor * cursor;
|
2005-01-09 03:53:35 +00:00
|
|
|
const gchar ** args;
|
2005-07-10 20:45:00 +00:00
|
|
|
GtkIconInfo * icon_info = NULL;
|
2004-01-12 05:10:40 +00:00
|
|
|
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
gtk_rc_parse_string ("style \"wp-tree-defaults\" {\n"
|
|
|
|
" GtkTreeView::horizontal-separator = 6\n"
|
|
|
|
"} widget_class \"*TreeView*\""
|
2005-08-17 11:58:43 +00:00
|
|
|
" style \"wp-tree-defaults\"");
|
Switch the binary name to gnome-background-properties, Based on patch from
2004-02-01 Rodney Dawes <dobey@ximian.com>
* Makefile.am: Switch the binary name to gnome-background-properties,
Based on patch from Seth Nickell
* background.desktop.in: Use gnome-background-properties here also,
based on patch from Seth Nickell
* gnome-wp-capplet.c: Fix a bug where you can't re-add a wallpaper
after you remove it
Use the new gnome_wp_item_update_description () call
Use a GConfChangeSet to change the gconf keys, based on a patch
from Seth Nickell
Select the first item in the list ("No Wallpaper") when the wallpaper
is removed, based on a patch from Seth Nickell
Do the rc string parsing before creating the window, and change some
defaults so we can fix the spacing between widgets and the border
Fix spacing between widgets and window border
* gnome-wp-item.[ch]: Add update_description function to clean up
code, based on patch from Seth Nickell
Fix a crash when trying to thumbnail very wide images that are very
short, while trying to maintain aspect ratio
* gnome-wp-xml.c: Use backgrounds.xml instead of wp-list.xml, and
migrate the old wp-list.xml over if backgrounds.xml doesn't exist
yet, based on patch from Seth Nickell
2004-02-01 20:57:47 +00:00
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
capplet = g_new0 (GnomeWPCapplet, 1);
|
|
|
|
|
|
|
|
if (capplet->client == NULL) {
|
|
|
|
capplet->client = gconf_client_get_default ();
|
|
|
|
}
|
|
|
|
|
|
|
|
capplet->delay = gconf_client_get_int (capplet->client,
|
|
|
|
WP_DELAY_KEY,
|
|
|
|
NULL);
|
|
|
|
gconf_client_add_dir (capplet->client, WP_KEYBOARD_PATH,
|
2005-01-09 04:15:56 +00:00
|
|
|
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
2004-01-12 05:10:40 +00:00
|
|
|
gconf_client_add_dir (capplet->client, WP_PATH_KEY,
|
2005-01-09 04:15:56 +00:00
|
|
|
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
gconf_client_notify_add (capplet->client,
|
|
|
|
WP_DELAY_KEY,
|
|
|
|
(GConfClientNotifyFunc) gnome_wp_delay_changed,
|
|
|
|
capplet, NULL, NULL);
|
|
|
|
gconf_client_notify_add (capplet->client,
|
|
|
|
WP_FILE_KEY,
|
|
|
|
(GConfClientNotifyFunc) gnome_wp_file_changed,
|
|
|
|
capplet, NULL, NULL);
|
|
|
|
gconf_client_notify_add (capplet->client,
|
|
|
|
WP_OPTIONS_KEY,
|
|
|
|
(GConfClientNotifyFunc) gnome_wp_options_changed,
|
|
|
|
capplet, NULL, NULL);
|
|
|
|
gconf_client_notify_add (capplet->client,
|
|
|
|
WP_SHADING_KEY,
|
|
|
|
(GConfClientNotifyFunc) gnome_wp_shading_changed,
|
|
|
|
capplet, NULL, NULL);
|
|
|
|
gconf_client_notify_add (capplet->client,
|
|
|
|
WP_PCOLOR_KEY,
|
|
|
|
(GConfClientNotifyFunc) gnome_wp_color1_changed,
|
|
|
|
capplet, NULL, NULL);
|
|
|
|
gconf_client_notify_add (capplet->client,
|
|
|
|
WP_SCOLOR_KEY,
|
|
|
|
(GConfClientNotifyFunc) gnome_wp_color2_changed,
|
|
|
|
capplet, NULL, NULL);
|
|
|
|
|
|
|
|
capplet->wphash = g_hash_table_new_full (g_str_hash, g_str_equal,
|
|
|
|
g_free,
|
|
|
|
(GDestroyNotify)
|
|
|
|
gnome_wp_item_free);
|
|
|
|
|
|
|
|
capplet->thumbs = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL);
|
2005-07-10 20:45:00 +00:00
|
|
|
capplet->theme = gtk_icon_theme_get_default ();
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (capplet->theme), "changed",
|
|
|
|
G_CALLBACK (gnome_wp_icon_theme_changed), capplet);
|
|
|
|
|
2004-02-05 00:31:48 +00:00
|
|
|
dialog = gnome_wp_create_dialog ();
|
|
|
|
capplet->window = glade_xml_get_widget (dialog,"gnome_wp_properties");
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2005-07-10 20:45:00 +00:00
|
|
|
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
|
2004-08-20 16:50:57 +00:00
|
|
|
"gnome-settings-background",
|
2005-07-10 20:45:00 +00:00
|
|
|
48, 0);
|
|
|
|
if (icon_info != NULL) {
|
|
|
|
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
|
|
|
|
gtk_icon_info_free (icon_info);
|
|
|
|
gtk_window_set_default_icon (pixbuf);
|
2004-02-05 00:31:48 +00:00
|
|
|
gtk_window_set_icon (GTK_WINDOW (capplet->window), pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_realize (capplet->window);
|
|
|
|
|
2005-08-17 11:58:43 +00:00
|
|
|
gtk_widget_ensure_style (capplet->window);
|
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (capplet->window)->vbox), 0);
|
2004-02-05 00:31:48 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (capplet->window)->action_area), 12);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
/* Drag and Drop Support */
|
|
|
|
gtk_drag_dest_unset (capplet->window);
|
|
|
|
gtk_drag_dest_set (capplet->window, GTK_DEST_DEFAULT_ALL, drop_types,
|
|
|
|
sizeof (drop_types) / sizeof (drop_types[0]),
|
|
|
|
GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
|
|
|
g_signal_connect (G_OBJECT (capplet->window), "drag_data_received",
|
|
|
|
G_CALLBACK (bg_properties_dragged_image), capplet);
|
|
|
|
|
2004-02-05 00:31:48 +00:00
|
|
|
capplet->treeview = glade_xml_get_widget (dialog,"wp_tree");
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
capplet->model = GTK_TREE_MODEL (gtk_list_store_new (3, GDK_TYPE_PIXBUF,
|
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_STRING));
|
|
|
|
|
|
|
|
gtk_tree_view_set_model (GTK_TREE_VIEW (capplet->treeview), capplet->model);
|
|
|
|
|
|
|
|
column = gtk_tree_view_column_new ();
|
|
|
|
renderer = gtk_cell_renderer_pixbuf_new ();
|
|
|
|
gtk_tree_view_column_pack_start (column, renderer, FALSE);
|
|
|
|
gtk_tree_view_column_set_attributes (column, renderer,
|
|
|
|
"pixbuf", 0,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
renderer = gtk_cell_renderer_text_new ();
|
|
|
|
gtk_tree_view_column_pack_start (column, renderer, FALSE);
|
|
|
|
gtk_tree_view_column_set_attributes (column, renderer,
|
|
|
|
"markup", 1,
|
|
|
|
NULL);
|
|
|
|
gtk_tree_view_column_set_spacing (column, 6);
|
|
|
|
|
|
|
|
gtk_tree_view_append_column (GTK_TREE_VIEW (capplet->treeview), column);
|
|
|
|
|
|
|
|
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (capplet->model), 2,
|
|
|
|
(GtkTreeIterCompareFunc) gnome_wp_list_sort,
|
|
|
|
capplet, NULL);
|
|
|
|
|
|
|
|
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (capplet->model),
|
|
|
|
2, GTK_SORT_ASCENDING);
|
|
|
|
|
2004-02-05 00:31:48 +00:00
|
|
|
capplet->wp_opts = glade_xml_get_widget (dialog,"style_menu");
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
2005-07-10 20:45:00 +00:00
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
mitem = gtk_menu_item_new ();
|
2004-05-18 16:29:29 +00:00
|
|
|
set_accessible_name (mitem, _("Centered"));
|
2005-07-10 20:45:00 +00:00
|
|
|
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
|
2004-01-12 05:10:40 +00:00
|
|
|
"stock_wallpaper-center",
|
2005-07-10 20:45:00 +00:00
|
|
|
16, 0);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
mbox = gtk_hbox_new (FALSE, 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (mitem), mbox);
|
|
|
|
gtk_widget_show (mbox);
|
|
|
|
|
2005-07-10 20:45:00 +00:00
|
|
|
if (icon_info != NULL) {
|
|
|
|
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
|
|
|
|
gtk_icon_info_free (icon_info);
|
|
|
|
capplet->citem = gtk_image_new_from_pixbuf (pixbuf);
|
2004-01-12 05:10:40 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), capplet->citem, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (capplet->citem);
|
2005-07-10 20:45:00 +00:00
|
|
|
g_object_unref (pixbuf);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Centered"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), label, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_menu_append (GTK_MENU (menu), mitem);
|
|
|
|
gtk_widget_show (mitem);
|
|
|
|
|
|
|
|
mitem = gtk_menu_item_new ();
|
2004-05-18 16:29:29 +00:00
|
|
|
set_accessible_name (mitem, _("Fill Screen"));
|
2005-07-10 20:45:00 +00:00
|
|
|
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
|
2004-01-12 05:10:40 +00:00
|
|
|
"stock_wallpaper-fill",
|
2005-07-10 20:45:00 +00:00
|
|
|
16, 0);
|
2004-01-12 05:10:40 +00:00
|
|
|
mbox = gtk_hbox_new (FALSE, 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (mitem), mbox);
|
|
|
|
gtk_widget_show (mbox);
|
|
|
|
|
2005-07-10 20:45:00 +00:00
|
|
|
if (icon_info != NULL) {
|
|
|
|
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
|
|
|
|
gtk_icon_info_free (icon_info);
|
|
|
|
capplet->fitem = gtk_image_new_from_pixbuf (pixbuf);
|
2004-01-12 05:10:40 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), capplet->fitem, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (capplet->fitem);
|
2005-07-10 20:45:00 +00:00
|
|
|
g_object_unref (pixbuf);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Fill Screen"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), label, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_menu_append (GTK_MENU (menu), mitem);
|
|
|
|
gtk_widget_show (mitem);
|
|
|
|
|
|
|
|
mitem = gtk_menu_item_new ();
|
2004-05-18 16:29:29 +00:00
|
|
|
set_accessible_name (mitem, _("Scaled"));
|
2005-07-10 20:45:00 +00:00
|
|
|
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
|
2004-01-12 05:10:40 +00:00
|
|
|
"stock_wallpaper-scale",
|
2005-07-10 20:45:00 +00:00
|
|
|
16, 0);
|
2004-01-12 05:10:40 +00:00
|
|
|
mbox = gtk_hbox_new (FALSE, 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (mitem), mbox);
|
|
|
|
gtk_widget_show (mbox);
|
|
|
|
|
2005-07-10 20:45:00 +00:00
|
|
|
if (icon_info != NULL) {
|
|
|
|
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
|
|
|
|
gtk_icon_info_free (icon_info);
|
|
|
|
capplet->sitem = gtk_image_new_from_pixbuf (pixbuf);
|
2004-01-12 05:10:40 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), capplet->sitem, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (capplet->sitem);
|
2005-07-10 20:45:00 +00:00
|
|
|
g_object_unref (pixbuf);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
2005-01-08 20:47:52 +00:00
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
label = gtk_label_new (_("Scaled"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), label, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_menu_append (GTK_MENU (menu), mitem);
|
|
|
|
gtk_widget_show (mitem);
|
|
|
|
|
|
|
|
mitem = gtk_menu_item_new ();
|
2004-05-18 16:29:29 +00:00
|
|
|
set_accessible_name (mitem, _("Tiled"));
|
2005-07-10 20:45:00 +00:00
|
|
|
icon_info = gtk_icon_theme_lookup_icon (capplet->theme,
|
2004-01-12 05:10:40 +00:00
|
|
|
"stock_wallpaper-tile",
|
2005-07-10 20:45:00 +00:00
|
|
|
16, 0);
|
2004-01-12 05:10:40 +00:00
|
|
|
mbox = gtk_hbox_new (FALSE, 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (mitem), mbox);
|
|
|
|
gtk_widget_show (mbox);
|
|
|
|
|
2005-07-10 20:45:00 +00:00
|
|
|
if (icon_info != NULL) {
|
|
|
|
pixbuf = gtk_icon_info_load_icon (icon_info, NULL);
|
|
|
|
gtk_icon_info_free (icon_info);
|
|
|
|
capplet->witem = gtk_image_new_from_pixbuf (pixbuf);
|
2004-01-12 05:10:40 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), capplet->witem, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (capplet->witem);
|
2005-07-10 20:45:00 +00:00
|
|
|
g_object_unref (pixbuf);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
2005-01-08 20:47:52 +00:00
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
label = gtk_label_new (_("Tiled"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), label, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_menu_append (GTK_MENU (menu), mitem);
|
|
|
|
gtk_widget_show (mitem);
|
|
|
|
|
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (capplet->wp_opts), menu);
|
|
|
|
|
2005-07-26 03:15:35 +00:00
|
|
|
g_signal_connect (G_OBJECT (capplet->wp_opts), "changed",
|
2004-01-12 05:10:40 +00:00
|
|
|
G_CALLBACK (gnome_wp_scale_type_changed), capplet);
|
|
|
|
|
2004-02-05 00:31:48 +00:00
|
|
|
add_button = glade_xml_get_widget (dialog,"add_button");
|
|
|
|
capplet->rm_button = glade_xml_get_widget (dialog,"rem_button");
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2004-02-05 00:31:48 +00:00
|
|
|
g_signal_connect (G_OBJECT (add_button), "clicked",
|
|
|
|
G_CALLBACK (gnome_wp_file_open_dialog), capplet);
|
2004-01-12 05:10:40 +00:00
|
|
|
g_signal_connect (G_OBJECT (capplet->rm_button), "clicked",
|
|
|
|
G_CALLBACK (gnome_wp_remove_wallpaper), capplet);
|
|
|
|
|
2004-02-05 00:31:48 +00:00
|
|
|
capplet->color_opt = glade_xml_get_widget (dialog,"color_menu");
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
menu = gtk_menu_new ();
|
|
|
|
mitem = gtk_menu_item_new ();
|
2004-05-18 16:29:29 +00:00
|
|
|
set_accessible_name (mitem, _("Solid Color"));
|
2004-01-12 05:10:40 +00:00
|
|
|
mbox = gtk_hbox_new (FALSE, 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (mitem), mbox);
|
|
|
|
gtk_widget_show (mbox);
|
|
|
|
|
|
|
|
capplet->smenuitem = gtk_image_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), capplet->smenuitem, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (capplet->smenuitem);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Solid Color"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), label, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_widget_show (mitem);
|
|
|
|
gtk_menu_append (GTK_MENU (menu), mitem);
|
|
|
|
|
|
|
|
mitem = gtk_menu_item_new ();
|
2004-05-18 16:29:29 +00:00
|
|
|
set_accessible_name (mitem, _("Horizontal Gradient"));
|
2004-01-12 05:10:40 +00:00
|
|
|
mbox = gtk_hbox_new (FALSE, 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (mitem), mbox);
|
|
|
|
gtk_widget_show (mbox);
|
|
|
|
|
|
|
|
capplet->hmenuitem = gtk_image_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), capplet->hmenuitem, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (capplet->hmenuitem);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Horizontal Gradient"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), label, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_widget_show (mitem);
|
|
|
|
gtk_menu_append (GTK_MENU (menu), mitem);
|
|
|
|
|
|
|
|
mitem = gtk_menu_item_new ();
|
2004-05-18 16:29:29 +00:00
|
|
|
set_accessible_name (mitem, _("Vertical Gradient"));
|
2004-01-12 05:10:40 +00:00
|
|
|
mbox = gtk_hbox_new (FALSE, 6);
|
|
|
|
gtk_container_add (GTK_CONTAINER (mitem), mbox);
|
|
|
|
gtk_widget_show (mbox);
|
|
|
|
|
|
|
|
capplet->vmenuitem = gtk_image_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), capplet->vmenuitem, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (capplet->vmenuitem);
|
|
|
|
|
|
|
|
label = gtk_label_new (_("Vertical Gradient"));
|
|
|
|
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
|
|
|
gtk_box_pack_start (GTK_BOX (mbox), label, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
gtk_widget_show (mitem);
|
|
|
|
gtk_menu_append (GTK_MENU (menu), mitem);
|
|
|
|
|
|
|
|
gtk_option_menu_set_menu (GTK_OPTION_MENU (capplet->color_opt), menu);
|
2005-07-26 03:15:35 +00:00
|
|
|
g_signal_connect (G_OBJECT (capplet->color_opt), "changed",
|
2004-01-12 05:10:40 +00:00
|
|
|
G_CALLBACK (gnome_wp_shade_type_changed), capplet);
|
|
|
|
|
2004-02-05 00:31:48 +00:00
|
|
|
capplet->pc_picker = glade_xml_get_widget (dialog,"pcpicker");
|
2005-07-25 20:51:16 +00:00
|
|
|
g_signal_connect (G_OBJECT (capplet->pc_picker), "color-set",
|
2005-02-06 22:41:19 +00:00
|
|
|
G_CALLBACK (gnome_wp_scolor_changed), capplet);
|
2004-01-12 05:10:40 +00:00
|
|
|
|
2004-02-05 00:31:48 +00:00
|
|
|
capplet->sc_picker = glade_xml_get_widget (dialog,"scpicker");
|
2005-07-25 20:51:16 +00:00
|
|
|
g_signal_connect (G_OBJECT (capplet->sc_picker), "color-set",
|
2004-01-12 05:10:40 +00:00
|
|
|
G_CALLBACK (gnome_wp_scolor_changed), capplet);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (capplet->window), "response",
|
|
|
|
G_CALLBACK (wallpaper_properties_clicked), capplet);
|
|
|
|
|
|
|
|
gtk_widget_show (capplet->window);
|
|
|
|
|
|
|
|
cursor = gdk_cursor_new_for_display (gdk_display_get_default (),
|
|
|
|
GDK_WATCH);
|
|
|
|
gdk_window_set_cursor (capplet->window->window, cursor);
|
|
|
|
gdk_cursor_unref (cursor);
|
|
|
|
|
2005-01-09 03:53:35 +00:00
|
|
|
args = poptGetArgs (ctx);
|
|
|
|
if (args != NULL) {
|
|
|
|
const gchar ** p;
|
|
|
|
|
|
|
|
for (p = args; *p != NULL; p++) {
|
|
|
|
capplet->uri_list = g_slist_append (capplet->uri_list, (gchar *) *p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
poptFreeContext (ctx);
|
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
g_idle_add (gnome_wp_load_stuffs, capplet);
|
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (capplet->treeview));
|
|
|
|
g_signal_connect (G_OBJECT (selection), "changed",
|
|
|
|
G_CALLBACK (gnome_wp_props_wp_selected), capplet);
|
2004-03-01 04:09:06 +00:00
|
|
|
|
2005-08-16 21:14:14 +00:00
|
|
|
gnome_wp_set_sensitivities (capplet);
|
|
|
|
|
2004-03-01 04:09:06 +00:00
|
|
|
/* Create the file chooser dialog stuff here */
|
2005-02-06 23:02:14 +00:00
|
|
|
capplet->filesel = gtk_file_chooser_dialog_new_with_backend (_("Add Wallpaper"),
|
|
|
|
GTK_WINDOW (capplet->window),
|
|
|
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
|
|
|
"gtk+",
|
|
|
|
GTK_STOCK_CANCEL,
|
|
|
|
GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_OPEN,
|
|
|
|
GTK_RESPONSE_OK,
|
|
|
|
NULL);
|
2004-03-01 04:09:06 +00:00
|
|
|
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (capplet->filesel),
|
|
|
|
TRUE);
|
2005-01-09 23:57:36 +00:00
|
|
|
|
|
|
|
gtk_file_chooser_set_use_preview_label (GTK_FILE_CHOOSER (capplet->filesel),
|
|
|
|
FALSE);
|
|
|
|
|
|
|
|
capplet->image = gtk_image_new ();
|
|
|
|
gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (capplet->filesel),
|
|
|
|
capplet->image);
|
|
|
|
gtk_widget_set_size_request (capplet->image, 128, -1);
|
|
|
|
|
|
|
|
gtk_widget_show (capplet->image);
|
|
|
|
|
|
|
|
g_signal_connect (capplet->filesel, "update-preview",
|
|
|
|
G_CALLBACK (gnome_wp_update_preview), capplet);
|
2004-01-12 05:10:40 +00:00
|
|
|
}
|
|
|
|
|
2005-08-16 21:14:14 +00:00
|
|
|
static void gnome_wp_set_sensitivities (GnomeWPCapplet* capplet) {
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeModel * model;
|
|
|
|
GtkTreeSelection * selection;
|
|
|
|
GnomeWPItem * item;
|
|
|
|
gchar * wpfile;
|
|
|
|
gchar * filename = NULL;
|
|
|
|
|
|
|
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (capplet->treeview));
|
|
|
|
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
|
|
|
|
gtk_tree_model_get (model, &iter, 2, &wpfile, -1);
|
|
|
|
|
|
|
|
item = g_hash_table_lookup (capplet->wphash, wpfile);
|
|
|
|
filename = item->filename;
|
|
|
|
g_free (wpfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!gconf_client_key_is_writable (capplet->client, WP_OPTIONS_KEY, NULL)
|
|
|
|
|| (filename && !strcmp (filename, "(none)")))
|
|
|
|
gtk_widget_set_sensitive (capplet->wp_opts, FALSE);
|
|
|
|
else
|
|
|
|
gtk_widget_set_sensitive (capplet->wp_opts, TRUE);
|
|
|
|
|
|
|
|
if (!gconf_client_key_is_writable (capplet->client, WP_SHADING_KEY, NULL))
|
|
|
|
gtk_widget_set_sensitive (capplet->color_opt, FALSE);
|
|
|
|
else
|
|
|
|
gtk_widget_set_sensitive (capplet->color_opt, TRUE);
|
|
|
|
|
|
|
|
if (!gconf_client_key_is_writable (capplet->client, WP_PCOLOR_KEY, NULL))
|
|
|
|
gtk_widget_set_sensitive (capplet->pc_picker, FALSE);
|
|
|
|
else
|
|
|
|
gtk_widget_set_sensitive (capplet->pc_picker, TRUE);
|
|
|
|
|
|
|
|
if (!gconf_client_key_is_writable (capplet->client, WP_SCOLOR_KEY, NULL))
|
|
|
|
gtk_widget_set_sensitive (capplet->sc_picker, FALSE);
|
|
|
|
else
|
|
|
|
gtk_widget_set_sensitive (capplet->sc_picker, TRUE);
|
|
|
|
|
|
|
|
if (!filename || !strcmp (filename, "(none)"))
|
|
|
|
gtk_widget_set_sensitive (capplet->rm_button, FALSE);
|
|
|
|
else
|
|
|
|
gtk_widget_set_sensitive (capplet->rm_button, TRUE);
|
|
|
|
}
|
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
gint main (gint argc, gchar *argv[]) {
|
2005-01-09 03:53:35 +00:00
|
|
|
GnomeProgram * program;
|
|
|
|
GValue context = { 0 };
|
|
|
|
poptContext ctx;
|
2004-01-12 05:10:40 +00:00
|
|
|
|
|
|
|
#ifdef ENABLE_NLS
|
|
|
|
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
|
|
|
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
|
|
|
textdomain (GETTEXT_PACKAGE);
|
|
|
|
#endif
|
|
|
|
|
2005-01-09 03:53:35 +00:00
|
|
|
program = gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
|
2004-01-12 05:10:40 +00:00
|
|
|
argc, argv, GNOME_PARAM_POPT_TABLE,
|
|
|
|
NULL, NULL);
|
|
|
|
|
2005-01-09 03:53:35 +00:00
|
|
|
g_object_get_property (G_OBJECT (program), GNOME_PARAM_POPT_CONTEXT,
|
|
|
|
g_value_init (&context, G_TYPE_POINTER));
|
|
|
|
ctx = g_value_get_pointer (&context);
|
|
|
|
|
|
|
|
wallpaper_properties_init (ctx);
|
|
|
|
|
2004-01-12 05:10:40 +00:00
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|