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
This commit is contained in:
parent
fb35d020a6
commit
4d87d80f3e
11 changed files with 171 additions and 353 deletions
|
@ -1,3 +1,46 @@
|
|||
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-05-14 Muktha Narayan <muktha.narayan@wipro.com>
|
||||
|
||||
* gnome-wp-capplet.c (set_accessible_name): New
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Authors: Rodney Dawes <dobey@ximian.com>
|
||||
*
|
||||
* Copyright 2003 Novell, Inc. (www.novell.com)
|
||||
* 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
|
||||
|
@ -74,87 +74,47 @@ static void wp_properties_help (GtkWindow * parent, char const * helpfile,
|
|||
}
|
||||
}
|
||||
|
||||
static void gnome_wp_add_image (GnomeWPCapplet * capplet,
|
||||
const gchar * filename) {
|
||||
GnomeWPItem * item;
|
||||
static void gnome_wp_capplet_scroll_to_item (GnomeWPCapplet * capplet,
|
||||
GnomeWPItem * item) {
|
||||
GtkTreePath * path;
|
||||
GdkColor color1, color2;
|
||||
|
||||
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;
|
||||
|
||||
item = g_hash_table_lookup (capplet->wphash, filename);
|
||||
if (item != NULL) {
|
||||
GtkTreePath * path;
|
||||
|
||||
if (item->deleted) {
|
||||
item->deleted = FALSE;
|
||||
wp_props_load_wallpaper (item->filename, item, capplet);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
item = g_new0 (GnomeWPItem, 1);
|
||||
|
||||
item->filename = g_strdup (filename);
|
||||
|
||||
item->fileinfo = gnome_wp_info_new (item->filename, capplet->thumbs);
|
||||
|
||||
item->shade_type = gconf_client_get_string (capplet->client,
|
||||
WP_SHADING_KEY, NULL);
|
||||
item->pri_color = gconf_client_get_string (capplet->client,
|
||||
WP_PCOLOR_KEY, NULL);
|
||||
item->sec_color = gconf_client_get_string (capplet->client,
|
||||
WP_SCOLOR_KEY, NULL);
|
||||
|
||||
gdk_color_parse (item->pri_color, &color1);
|
||||
gdk_color_parse (item->sec_color, &color2);
|
||||
|
||||
item->pcolor = gdk_color_copy (&color1);
|
||||
item->scolor = gdk_color_copy (&color2);
|
||||
|
||||
if (!strncmp (item->fileinfo->mime_type, "image/", strlen ("image/"))) {
|
||||
if (item->name == NULL) {
|
||||
item->name = g_strdup (item->fileinfo->name);
|
||||
}
|
||||
item->options = gconf_client_get_string (capplet->client,
|
||||
WP_OPTIONS_KEY,
|
||||
NULL);
|
||||
if (!strcmp (item->options, "none")) {
|
||||
item->options = g_strdup ("wallpaper");
|
||||
}
|
||||
gnome_wp_item_update_description (item);
|
||||
|
||||
g_hash_table_insert (capplet->wphash, g_strdup (item->filename), item);
|
||||
wp_props_load_wallpaper (item->filename, item, capplet);
|
||||
|
||||
gconf_client_set_string (capplet->client, WP_FILE_KEY,
|
||||
item->filename, NULL);
|
||||
gconf_client_set_string (capplet->client, WP_OPTIONS_KEY,
|
||||
item->options, 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);
|
||||
} else {
|
||||
gnome_wp_item_free (item);
|
||||
item = gnome_wp_item_new (filename, capplet->wphash, capplet->thumbs);
|
||||
if (item != NULL) {
|
||||
wp_props_load_wallpaper (item->filename, item, capplet);
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
static void gnome_wp_add_images (GnomeWPCapplet * capplet,
|
||||
GSList * images,
|
||||
gchar ** files) {
|
||||
GSList * images) {
|
||||
GdkCursor * cursor;
|
||||
gint i;
|
||||
GnomeWPItem * item;
|
||||
|
||||
item = NULL;
|
||||
cursor = gdk_cursor_new_for_display (gdk_display_get_default (),
|
||||
GDK_WATCH);
|
||||
gdk_window_set_cursor (capplet->window->window, cursor);
|
||||
|
@ -162,15 +122,15 @@ static void gnome_wp_add_images (GnomeWPCapplet * capplet,
|
|||
|
||||
if (images != NULL) {
|
||||
for (; images != NULL; images = images->next) {
|
||||
gnome_wp_add_image (capplet, images->data);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; files && files[i]; i++) {
|
||||
gnome_wp_add_image (capplet, files[i]);
|
||||
item = gnome_wp_add_image (capplet, images->data);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_window_set_cursor (capplet->window->window, NULL);
|
||||
|
||||
if (item != NULL) {
|
||||
gnome_wp_capplet_scroll_to_item (capplet, item);
|
||||
}
|
||||
}
|
||||
|
||||
static void gnome_wp_file_open_dialog (GtkWidget * widget,
|
||||
|
@ -180,7 +140,8 @@ static void gnome_wp_file_open_dialog (GtkWidget * widget,
|
|||
switch (gtk_dialog_run (GTK_DIALOG (capplet->filesel))) {
|
||||
case GTK_RESPONSE_OK:
|
||||
files = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (capplet->filesel));
|
||||
gnome_wp_add_images (capplet, files, NULL);
|
||||
gnome_wp_add_images (capplet, files);
|
||||
g_slist_free (files);
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
default:
|
||||
gtk_widget_hide (capplet->filesel);
|
||||
|
@ -188,44 +149,6 @@ static void gnome_wp_file_open_dialog (GtkWidget * widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void bg_add_multiple_files (GnomeVFSURI * uri,
|
||||
GnomeWPCapplet * capplet) {
|
||||
GnomeWPItem * item;
|
||||
GdkColor color1, color2;
|
||||
|
||||
item = g_hash_table_lookup (capplet->wphash, gnome_vfs_uri_get_path (uri));
|
||||
if (item != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
item = g_new0 (GnomeWPItem, 1);
|
||||
|
||||
item->filename = gnome_vfs_unescape_string_for_display (gnome_vfs_uri_get_path (uri));
|
||||
item->fileinfo = gnome_wp_info_new (item->filename, capplet->thumbs);
|
||||
item->name = g_strdup (item->fileinfo->name);
|
||||
item->options = gconf_client_get_string (capplet->client,
|
||||
WP_OPTIONS_KEY,
|
||||
NULL);
|
||||
|
||||
item->shade_type = gconf_client_get_string (capplet->client,
|
||||
WP_SHADING_KEY, NULL);
|
||||
item->pri_color = gconf_client_get_string (capplet->client,
|
||||
WP_PCOLOR_KEY, NULL);
|
||||
item->sec_color = gconf_client_get_string (capplet->client,
|
||||
WP_SCOLOR_KEY, NULL);
|
||||
|
||||
gdk_color_parse (item->pri_color, &color1);
|
||||
gdk_color_parse (item->sec_color, &color2);
|
||||
|
||||
item->pcolor = gdk_color_copy (&color1);
|
||||
item->scolor = gdk_color_copy (&color2);
|
||||
|
||||
gnome_wp_item_update_description (item);
|
||||
|
||||
g_hash_table_insert (capplet->wphash, g_strdup (item->filename), item);
|
||||
wp_props_load_wallpaper (item->filename, item, capplet);
|
||||
}
|
||||
|
||||
static void bg_properties_dragged_image (GtkWidget * widget,
|
||||
GdkDragContext * context,
|
||||
gint x, gint y,
|
||||
|
@ -235,77 +158,27 @@ static void bg_properties_dragged_image (GtkWidget * widget,
|
|||
|
||||
if (info == TARGET_URI_LIST || info == TARGET_BGIMAGE) {
|
||||
GList * uris;
|
||||
GSList * realuris = NULL;
|
||||
|
||||
uris = gnome_vfs_uri_list_parse ((gchar *) selection_data->data);
|
||||
|
||||
if (uris != NULL && uris->data != NULL) {
|
||||
if (g_list_length (uris) == 1) {
|
||||
GnomeVFSURI * uri = (GnomeVFSURI *) uris->data;
|
||||
GnomeWPItem * item;
|
||||
GtkTreePath * path;
|
||||
GdkCursor * cursor;
|
||||
|
||||
item = g_hash_table_lookup (capplet->wphash,
|
||||
gnome_vfs_uri_get_path (uri));
|
||||
cursor = gdk_cursor_new_for_display (gdk_display_get_default (),
|
||||
GDK_WATCH);
|
||||
gdk_window_set_cursor (capplet->window->window, cursor);
|
||||
gdk_cursor_unref (cursor);
|
||||
|
||||
if (item == NULL) {
|
||||
GdkColor color1, color2;
|
||||
|
||||
item = g_new0 (GnomeWPItem, 1);
|
||||
|
||||
item->filename = gnome_vfs_unescape_string_for_display (gnome_vfs_uri_get_path (uri));
|
||||
item->fileinfo = gnome_wp_info_new (item->filename, capplet->thumbs);
|
||||
item->name = g_strdup (item->fileinfo->name);
|
||||
item->options = gconf_client_get_string (capplet->client,
|
||||
WP_OPTIONS_KEY,
|
||||
NULL);
|
||||
|
||||
item->shade_type = gconf_client_get_string (capplet->client,
|
||||
WP_SHADING_KEY, NULL);
|
||||
item->pri_color = gconf_client_get_string (capplet->client,
|
||||
WP_PCOLOR_KEY, NULL);
|
||||
item->sec_color = gconf_client_get_string (capplet->client,
|
||||
WP_SCOLOR_KEY, NULL);
|
||||
|
||||
gdk_color_parse (item->pri_color, &color1);
|
||||
gdk_color_parse (item->sec_color, &color2);
|
||||
|
||||
item->pcolor = gdk_color_copy (&color1);
|
||||
item->scolor = gdk_color_copy (&color2);
|
||||
|
||||
gnome_wp_item_update_description (item);
|
||||
|
||||
g_hash_table_insert (capplet->wphash, g_strdup (item->filename),
|
||||
item);
|
||||
wp_props_load_wallpaper (item->filename, item, capplet);
|
||||
} else if (item->deleted) {
|
||||
item->deleted = FALSE;
|
||||
wp_props_load_wallpaper (item->filename, item, capplet);
|
||||
}
|
||||
gconf_client_set_string (capplet->client, WP_FILE_KEY,
|
||||
item->filename, NULL);
|
||||
gconf_client_set_string (capplet->client, WP_OPTIONS_KEY,
|
||||
item->options, 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);
|
||||
} else if (g_list_length (uris) > 1) {
|
||||
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);
|
||||
|
||||
g_list_foreach (uris, (GFunc) bg_add_multiple_files, capplet);
|
||||
|
||||
gdk_window_set_cursor (capplet->window->window, NULL);
|
||||
for (; uris != NULL; uris = uris->next) {
|
||||
realuris = g_slist_append (realuris,
|
||||
g_strdup (gnome_vfs_uri_get_path (uris->data)));
|
||||
}
|
||||
gnome_wp_add_images (capplet, realuris);
|
||||
gdk_window_set_cursor (capplet->window->window, NULL);
|
||||
}
|
||||
gnome_vfs_uri_list_free (uris);
|
||||
g_slist_free (realuris);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -715,7 +588,6 @@ static gboolean gnome_wp_load_stuffs (void * data) {
|
|||
GnomeWPCapplet * capplet = (GnomeWPCapplet *) data;
|
||||
gchar * imagepath, * style;
|
||||
GnomeWPItem * item;
|
||||
GtkTreePath * path;
|
||||
|
||||
style = gconf_client_get_string (capplet->client,
|
||||
WP_OPTIONS_KEY,
|
||||
|
@ -738,12 +610,7 @@ static gboolean gnome_wp_load_stuffs (void * data) {
|
|||
wp_props_load_wallpaper (item->filename, item, capplet);
|
||||
}
|
||||
|
||||
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);
|
||||
gnome_wp_capplet_scroll_to_item (capplet, item);
|
||||
|
||||
gnome_wp_option_menu_set (capplet, item->options, FALSE);
|
||||
gnome_wp_option_menu_set (capplet, item->shade_type, TRUE);
|
||||
|
@ -757,44 +624,11 @@ static gboolean gnome_wp_load_stuffs (void * data) {
|
|||
item->scolor->green,
|
||||
item->scolor->blue, 65535);
|
||||
} else if (strcmp (style, "none") != 0) {
|
||||
GdkColor color1, color2;
|
||||
|
||||
item = g_new0 (GnomeWPItem, 1);
|
||||
|
||||
item->filename = g_strdup (imagepath);
|
||||
|
||||
item->shade_type = gconf_client_get_string (capplet->client,
|
||||
WP_SHADING_KEY, NULL);
|
||||
item->pri_color = gconf_client_get_string (capplet->client,
|
||||
WP_PCOLOR_KEY, NULL);
|
||||
item->sec_color = gconf_client_get_string (capplet->client,
|
||||
WP_SCOLOR_KEY, NULL);
|
||||
|
||||
gdk_color_parse (item->pri_color, &color1);
|
||||
gdk_color_parse (item->sec_color, &color2);
|
||||
|
||||
item->pcolor = gdk_color_copy (&color1);
|
||||
item->scolor = gdk_color_copy (&color2);
|
||||
|
||||
if (g_file_test (item->filename, G_FILE_TEST_EXISTS)) {
|
||||
item->fileinfo = gnome_wp_info_new (item->filename, capplet->thumbs);
|
||||
item->name = g_strdup (item->fileinfo->name);
|
||||
item->options = gconf_client_get_string (capplet->client,
|
||||
WP_OPTIONS_KEY,
|
||||
NULL);
|
||||
item->deleted = FALSE;
|
||||
|
||||
gnome_wp_item_update_description (item);
|
||||
|
||||
g_hash_table_insert (capplet->wphash, g_strdup (item->filename), item);
|
||||
item = gnome_wp_item_new (imagepath, capplet->wphash, capplet->thumbs);
|
||||
if (item != NULL) {
|
||||
wp_props_load_wallpaper (item->filename, item, capplet);
|
||||
|
||||
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);
|
||||
gnome_wp_capplet_scroll_to_item (capplet, item);
|
||||
|
||||
gnome_color_picker_set_i16 (GNOME_COLOR_PICKER (capplet->pc_picker),
|
||||
item->pcolor->red,
|
||||
|
@ -807,43 +641,15 @@ static gboolean gnome_wp_load_stuffs (void * data) {
|
|||
|
||||
gnome_wp_option_menu_set (capplet, item->options, FALSE);
|
||||
gnome_wp_option_menu_set (capplet, item->shade_type, TRUE);
|
||||
} else {
|
||||
gnome_wp_item_free (item);
|
||||
}
|
||||
}
|
||||
|
||||
item = g_hash_table_lookup (capplet->wphash, "(none)");
|
||||
if (item == NULL) {
|
||||
GdkColor color1, color2;
|
||||
|
||||
item = g_new0 (GnomeWPItem, 1);
|
||||
|
||||
item->deleted = FALSE;
|
||||
item->filename = g_strdup ("(none)");
|
||||
|
||||
item->shade_type = gconf_client_get_string (capplet->client,
|
||||
WP_SHADING_KEY, NULL);
|
||||
item->pri_color = gconf_client_get_string (capplet->client,
|
||||
WP_PCOLOR_KEY, NULL);
|
||||
item->sec_color = gconf_client_get_string (capplet->client,
|
||||
WP_SCOLOR_KEY, NULL);
|
||||
|
||||
gdk_color_parse (item->pri_color, &color1);
|
||||
gdk_color_parse (item->sec_color, &color2);
|
||||
|
||||
item->pcolor = gdk_color_copy (&color1);
|
||||
item->scolor = gdk_color_copy (&color2);
|
||||
|
||||
item->fileinfo = gnome_wp_info_new (item->filename, capplet->thumbs);
|
||||
item->name = g_strdup (item->fileinfo->name);
|
||||
item->options = gconf_client_get_string (capplet->client,
|
||||
WP_OPTIONS_KEY,
|
||||
NULL);
|
||||
|
||||
gnome_wp_item_update_description (item);
|
||||
|
||||
g_hash_table_insert (capplet->wphash, g_strdup (item->filename), item);
|
||||
wp_props_load_wallpaper (item->filename, item, capplet);
|
||||
item = gnome_wp_item_new ("(none)", capplet->wphash, capplet->thumbs);
|
||||
if (item != NULL) {
|
||||
wp_props_load_wallpaper (item->filename, item, capplet);
|
||||
}
|
||||
} else {
|
||||
if (item->deleted == TRUE) {
|
||||
item->deleted = FALSE;
|
||||
|
@ -851,12 +657,7 @@ static gboolean gnome_wp_load_stuffs (void * data) {
|
|||
}
|
||||
|
||||
if (!strcmp (style, "none")) {
|
||||
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);
|
||||
gnome_wp_capplet_scroll_to_item (capplet, item);
|
||||
}
|
||||
}
|
||||
g_free (imagepath);
|
||||
|
@ -889,7 +690,6 @@ static void gnome_wp_file_changed (GConfClient * client, guint id,
|
|||
GtkTreeSelection * selection;
|
||||
GtkTreeModel * model;
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath * path;
|
||||
GnomeWPItem * item;
|
||||
gchar * wpfile, * selected;
|
||||
|
||||
|
@ -901,52 +701,13 @@ static void gnome_wp_file_changed (GConfClient * client, guint id,
|
|||
gtk_tree_model_get (model, &iter, 2, &selected, -1);
|
||||
if (strcmp (selected, wpfile) != 0) {
|
||||
if (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);
|
||||
gnome_wp_capplet_scroll_to_item (capplet, item);
|
||||
} else {
|
||||
GdkColor color1, color2;
|
||||
|
||||
item = g_new0 (GnomeWPItem, 1);
|
||||
|
||||
item->filename = g_strdup (wpfile);
|
||||
|
||||
item->shade_type = gconf_client_get_string (capplet->client,
|
||||
WP_SHADING_KEY, NULL);
|
||||
item->pri_color = gconf_client_get_string (capplet->client,
|
||||
WP_PCOLOR_KEY, NULL);
|
||||
item->sec_color = gconf_client_get_string (capplet->client,
|
||||
WP_SCOLOR_KEY, NULL);
|
||||
|
||||
gdk_color_parse (item->pri_color, &color1);
|
||||
gdk_color_parse (item->sec_color, &color2);
|
||||
|
||||
item->pcolor = gdk_color_copy (&color1);
|
||||
item->scolor = gdk_color_copy (&color2);
|
||||
|
||||
if (g_file_test (item->filename, G_FILE_TEST_EXISTS)) {
|
||||
item->fileinfo = gnome_wp_info_new (item->filename, capplet->thumbs);
|
||||
item->name = g_strdup (item->fileinfo->name);
|
||||
item->options = gconf_client_get_string (capplet->client,
|
||||
WP_OPTIONS_KEY,
|
||||
NULL);
|
||||
|
||||
gnome_wp_item_update_description (item);
|
||||
g_hash_table_insert (capplet->wphash,
|
||||
g_strdup (item->filename), item);
|
||||
item = gnome_wp_item_new (wpfile, capplet->wphash, capplet->thumbs);
|
||||
if (item != NULL) {
|
||||
wp_props_load_wallpaper (item->filename, item, capplet);
|
||||
|
||||
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);
|
||||
} else {
|
||||
gnome_wp_item_free (item);
|
||||
gnome_wp_capplet_scroll_to_item (capplet, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Authors: Rodney Dawes <dobey@ximian.com>
|
||||
*
|
||||
* Copyright 2003 Novell, Inc. (www.novell.com)
|
||||
* 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
|
||||
|
@ -99,15 +99,6 @@ typedef enum {
|
|||
GNOME_WP_SCALE_TYPE_TILED
|
||||
} GnomeWPScaleType;
|
||||
|
||||
#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"
|
||||
|
||||
void gnome_wp_main_quit (GnomeWPCapplet * capplet);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Authors: Rodney Dawes <dobey@ximian.com>
|
||||
*
|
||||
* Copyright 2003 Novell, Inc. (www.novell.com)
|
||||
* 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Authors: Rodney Dawes <dobey@ximian.com>
|
||||
*
|
||||
* Copyright 2003 Novell, Inc. (www.novell.com)
|
||||
* 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Authors: Rodney Dawes <dobey@ximian.com>
|
||||
*
|
||||
* Copyright 2003 Novell, Inc. (www.novell.com)
|
||||
* 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
|
||||
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <config.h>
|
||||
|
||||
#include <gconf/gconf-client.h>
|
||||
#include <gnome.h>
|
||||
#include <string.h>
|
||||
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
|
||||
|
@ -27,6 +28,51 @@
|
|||
#include "gnome-wp-item.h"
|
||||
#include "gnome-wp-utils.h"
|
||||
|
||||
GnomeWPItem * gnome_wp_item_new (const gchar * filename,
|
||||
GHashTable * wallpapers,
|
||||
GnomeThumbnailFactory * thumbnails) {
|
||||
GnomeWPItem * item = NULL;
|
||||
GdkColor color1, color2;
|
||||
GConfClient * client;
|
||||
|
||||
client = gconf_client_get_default ();
|
||||
|
||||
item = g_new0 (GnomeWPItem, 1);
|
||||
|
||||
item->filename = g_strdup (filename);
|
||||
|
||||
item->fileinfo = gnome_wp_info_new (item->filename, thumbnails);
|
||||
|
||||
item->shade_type = gconf_client_get_string (client, WP_SHADING_KEY, NULL);
|
||||
item->pri_color = gconf_client_get_string (client, WP_PCOLOR_KEY, NULL);
|
||||
item->sec_color = gconf_client_get_string (client, WP_SCOLOR_KEY, NULL);
|
||||
|
||||
gdk_color_parse (item->pri_color, &color1);
|
||||
gdk_color_parse (item->sec_color, &color2);
|
||||
|
||||
item->pcolor = gdk_color_copy (&color1);
|
||||
item->scolor = gdk_color_copy (&color2);
|
||||
|
||||
if (!strncmp (item->fileinfo->mime_type, "image/", strlen ("image/"))) {
|
||||
if (item->name == NULL) {
|
||||
item->name = g_strdup (item->fileinfo->name);
|
||||
}
|
||||
item->options = gconf_client_get_string (client, WP_OPTIONS_KEY, NULL);
|
||||
|
||||
if (!strcmp (item->options, "none")) {
|
||||
item->options = g_strdup ("wallpaper");
|
||||
}
|
||||
gnome_wp_item_update_description (item);
|
||||
|
||||
g_hash_table_insert (wallpapers, g_strdup (item->filename), item);
|
||||
} else {
|
||||
gnome_wp_item_free (item);
|
||||
item = NULL;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
void gnome_wp_item_free (GnomeWPItem * item) {
|
||||
if (item == NULL) {
|
||||
return;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Authors: Rodney Dawes <dobey@ximian.com>
|
||||
*
|
||||
* Copyright 2003 Novell, Inc. (www.novell.com)
|
||||
* 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
|
||||
|
@ -58,6 +58,9 @@ struct _GnomeWPItem {
|
|||
gint height;
|
||||
};
|
||||
|
||||
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);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Authors: Rodney Dawes <dobey@ximian.com>
|
||||
*
|
||||
* Copyright 2003 Novell, Inc. (www.novell.com)
|
||||
* 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Authors: Rodney Dawes <dobey@ximian.com>
|
||||
*
|
||||
* Copyright 2003 Novell, Inc. (www.novell.com)
|
||||
* 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
|
||||
|
@ -24,6 +24,15 @@
|
|||
#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,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Authors: Rodney Dawes <dobey@ximian.com>
|
||||
*
|
||||
* Copyright 2003 Novell, Inc. (www.novell.com)
|
||||
* 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
|
||||
|
@ -56,7 +56,6 @@ static void gnome_wp_xml_set_bool (const xmlNode * parent,
|
|||
static void gnome_wp_load_legacy (GnomeWPCapplet * capplet) {
|
||||
FILE * fp;
|
||||
gchar * foo, * filename;
|
||||
GdkColor color1, color2;
|
||||
|
||||
filename = g_build_filename (g_get_home_dir (), ".gnome2",
|
||||
"wallpapers.list", NULL);
|
||||
|
@ -80,42 +79,8 @@ static void gnome_wp_load_legacy (GnomeWPCapplet * capplet) {
|
|||
continue;
|
||||
}
|
||||
|
||||
item = g_new0 (GnomeWPItem, 1);
|
||||
|
||||
item->filename = g_strdup (foo);
|
||||
|
||||
item->fileinfo = gnome_wp_info_new (item->filename, capplet->thumbs);
|
||||
|
||||
if (item->fileinfo == NULL) {
|
||||
gnome_wp_item_free (item);
|
||||
continue;
|
||||
}
|
||||
|
||||
item->shade_type = gconf_client_get_string (capplet->client,
|
||||
WP_SHADING_KEY, NULL);
|
||||
item->pri_color = gconf_client_get_string (capplet->client,
|
||||
WP_PCOLOR_KEY, NULL);
|
||||
item->sec_color = gconf_client_get_string (capplet->client,
|
||||
WP_SCOLOR_KEY, NULL);
|
||||
|
||||
gdk_color_parse (item->pri_color, &color1);
|
||||
gdk_color_parse (item->sec_color, &color2);
|
||||
|
||||
item->pcolor = gdk_color_copy (&color1);
|
||||
item->scolor = gdk_color_copy (&color2);
|
||||
|
||||
if (!strncmp (item->fileinfo->mime_type, "image/",
|
||||
strlen ("image/"))) {
|
||||
if (item->name == NULL) {
|
||||
item->name = g_strdup (item->fileinfo->name);
|
||||
}
|
||||
item->options = gconf_client_get_string (capplet->client,
|
||||
WP_OPTIONS_KEY,
|
||||
NULL);
|
||||
|
||||
gnome_wp_item_update_description (item);
|
||||
g_hash_table_insert (capplet->wphash, g_strdup (item->filename), item);
|
||||
} else {
|
||||
item = gnome_wp_item_new (foo, capplet->wphash, capplet->thumbs);
|
||||
if (item != NULL && item->fileinfo == NULL) {
|
||||
gnome_wp_item_free (item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Authors: Rodney Dawes <dobey@ximian.com>
|
||||
*
|
||||
* Copyright 2003 Novell, Inc. (www.novell.com)
|
||||
* 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue