completed task 1774, desktop needs separate background from theme

completed task 1774, desktop needs separate background from theme
This commit is contained in:
Andy Hertzfeld 2000-07-26 07:37:32 +00:00
parent 6d3aa50d46
commit b8e2220e3e
8 changed files with 85 additions and 20 deletions

View file

@ -1,3 +1,19 @@
2000-07-26 Andy Hertzfeld <andy@eazel.com>
completed task 1774, desktop needs separate background in theme
* libnautilus-extensions/nautilus-directory-background.c:
(directory_changed_callback), (background_reset_callback):
check for desktop tag when fetching from the theme
* src/file-manager/fm-icon-view.c: (fm_icon_view_begin_loading):
tag the desktop background so we can treat it specially
* icons/arlo/arlo.xml:
* icons/default.xml:
* icons/eazel/eazel.xml:
* icons/vector/vector.xml:
added separate desktop backgrounds to the themes, which I'm sure Arlo and Susan
will both want to change as soon as I show it to them
2000-07-26 Mathieu Lacage <mathieu@eazel.com>
* src/file-manager/fm-desktop-icon-view.c:

View file

@ -4,6 +4,7 @@
<sidebar SIDEBAR_BACKGROUND_COLOR="rgb:6666/9999/9999-rgb:0000/3333/3333|90-rgb:0000/0000/0000:h" SIDEBAR_BACKGROUND_TILE_IMAGE="backgrounds/.striated.png" TAB_PIECE_IMAGE="sidebar_tab_pieces.png" COMBINE="TRUE"
PIECE_OFFSETS="1,1,20,4:1,13,20,13:1,47,20,61:1,123,20,139:1,212,20,220:1,5,20,8:1,14,20,14:1,62,20,76:1,16,20,30:1,221,20,229:1,9,20,12:1,15,24,15:1,93,24,107:1,157,20,173:1,194,20,194"
LEFT_OFFSET="0" LABEL_COLOR="rgb:FFFF/FFFF/FFFF" TAB_FONT="-*-helvetica-medium-i-normal-*-12-*-*-*-*-*-*-*" />
<desktop BACKGROUND_TILE_IMAGE="backgrounds/ice.png"/>
<zoom_control NUMBER_V_OFFSET="-4"/>
</theme>

View file

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<theme name="default">
<sidebar SIDEBAR_BACKGROUND_COLOR="rgb:DDDD/DDDD/FFFF"/>
<desktop BACKGROUND_TILE_IMAGE="backgrounds/gnome.jpg"/>
<directory BACKGROUND_COLOR="rgb:FFFF/FFFF/FFFF"/>
</theme>

View file

@ -2,4 +2,5 @@
<theme name="eazel">
<sidebar SIDEBAR_BACKGROUND_TILE_IMAGE="backgrounds/cork.png" SIDEBAR_BACKGROUND_COLOR="rgb:FFFF/FFFF/FFFF"/>
<directory BACKGROUND_TILE_IMAGE="backgrounds/blue_gray_rough.png" BACKGROUND_COLOR="rgb:FFFF/FFFF/FFFF"/>
<desktop BACKGROUND_TILE_IMAGE="backgrounds/fleur_de_lis.png" BACKGROUND_COLOR="rgb:FFFF/FFFF/FFFF"/>
</theme>

View file

@ -3,5 +3,6 @@
<sidebar SIDEBAR_BACKGROUND_TILE_IMAGE="backgrounds/blue_sky.png"/>
<directory BACKGROUND_COLOR="rgb:FFFF/FFFF/3333-rgb:FFFF/9999/3333:h"/>
<toolbar ICON_THEME="eazel"/>
<zoom_control NUMBER_V_OFFSET="-4" NUMBER_H_OFFSET="4"/>
<desktop BACKGROUND_TILE_IMAGE="backgrounds/clouds.png"/>
<zoom_control NUMBER_V_OFFSET="-4" NUMBER_H_OFFSET="4"/>
</theme>

View file

@ -106,7 +106,8 @@ directory_changed_callback (NautilusDirectory *directory,
NautilusBackground *background)
{
char *color, *image, *combine;
char *theme_source;
g_assert (NAUTILUS_IS_DIRECTORY (directory));
g_assert (NAUTILUS_IS_BACKGROUND (background));
g_assert (gtk_object_get_data (GTK_OBJECT (background), "nautilus_background_directory")
@ -119,6 +120,15 @@ directory_changed_callback (NautilusDirectory *directory,
background_changed_callback,
directory);
/* set up the theme source by checking if the background is attached to the desktop */
if (gtk_object_get_data (GTK_OBJECT (background), "desktop")) {
theme_source = "desktop";
} else {
theme_source = "directory";
}
g_message ("theme source is %s", theme_source);
/* Update color and tile image based on metadata. */
color = nautilus_directory_get_metadata (directory,
NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR,
@ -130,9 +140,9 @@ directory_changed_callback (NautilusDirectory *directory,
/* if there's none, read the default from the theme */
if (color == NULL && image == NULL) {
color = nautilus_theme_get_theme_data ("directory", NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR);
image = nautilus_theme_get_theme_data ("directory", NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_IMAGE);
combine = nautilus_theme_get_theme_data ("directory", "COMBINE");
color = nautilus_theme_get_theme_data (theme_source, NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR);
image = nautilus_theme_get_theme_data (theme_source, NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_IMAGE);
combine = nautilus_theme_get_theme_data (theme_source, "COMBINE");
image = local_data_file_to_uri(image);
}
@ -172,10 +182,18 @@ background_reset_callback (NautilusBackground *background,
NautilusDirectory *directory)
{
char *color, *image, *combine;
char *theme_source;
color = nautilus_theme_get_theme_data ("directory", NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR);
image = nautilus_theme_get_theme_data ("directory", NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_IMAGE);
combine = nautilus_theme_get_theme_data ("directory", "COMBINE");
/* set up the theme source by checking if the background is attached to the desktop */
if (gtk_object_get_data (GTK_OBJECT (background), "desktop")) {
theme_source = "desktop";
} else {
theme_source = "directory";
}
color = nautilus_theme_get_theme_data (theme_source, NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR);
image = nautilus_theme_get_theme_data (theme_source, NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_IMAGE);
combine = nautilus_theme_get_theme_data (theme_source, "COMBINE");
image = local_data_file_to_uri(image);
/* block the handler so we don't write metadata */

View file

@ -106,7 +106,8 @@ directory_changed_callback (NautilusDirectory *directory,
NautilusBackground *background)
{
char *color, *image, *combine;
char *theme_source;
g_assert (NAUTILUS_IS_DIRECTORY (directory));
g_assert (NAUTILUS_IS_BACKGROUND (background));
g_assert (gtk_object_get_data (GTK_OBJECT (background), "nautilus_background_directory")
@ -119,6 +120,15 @@ directory_changed_callback (NautilusDirectory *directory,
background_changed_callback,
directory);
/* set up the theme source by checking if the background is attached to the desktop */
if (gtk_object_get_data (GTK_OBJECT (background), "desktop")) {
theme_source = "desktop";
} else {
theme_source = "directory";
}
g_message ("theme source is %s", theme_source);
/* Update color and tile image based on metadata. */
color = nautilus_directory_get_metadata (directory,
NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR,
@ -130,9 +140,9 @@ directory_changed_callback (NautilusDirectory *directory,
/* if there's none, read the default from the theme */
if (color == NULL && image == NULL) {
color = nautilus_theme_get_theme_data ("directory", NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR);
image = nautilus_theme_get_theme_data ("directory", NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_IMAGE);
combine = nautilus_theme_get_theme_data ("directory", "COMBINE");
color = nautilus_theme_get_theme_data (theme_source, NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR);
image = nautilus_theme_get_theme_data (theme_source, NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_IMAGE);
combine = nautilus_theme_get_theme_data (theme_source, "COMBINE");
image = local_data_file_to_uri(image);
}
@ -172,10 +182,18 @@ background_reset_callback (NautilusBackground *background,
NautilusDirectory *directory)
{
char *color, *image, *combine;
char *theme_source;
color = nautilus_theme_get_theme_data ("directory", NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR);
image = nautilus_theme_get_theme_data ("directory", NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_IMAGE);
combine = nautilus_theme_get_theme_data ("directory", "COMBINE");
/* set up the theme source by checking if the background is attached to the desktop */
if (gtk_object_get_data (GTK_OBJECT (background), "desktop")) {
theme_source = "desktop";
} else {
theme_source = "directory";
}
color = nautilus_theme_get_theme_data (theme_source, NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_COLOR);
image = nautilus_theme_get_theme_data (theme_source, NAUTILUS_METADATA_KEY_DIRECTORY_BACKGROUND_IMAGE);
combine = nautilus_theme_get_theme_data (theme_source, "COMBINE");
image = local_data_file_to_uri(image);
/* block the handler so we don't write metadata */

View file

@ -24,6 +24,7 @@
#include <config.h>
#include "fm-icon-view.h"
#include "fm-desktop-icon-view.h"
#include "fm-error-reporting.h"
#include "fm-icon-text-window.h"
@ -39,6 +40,7 @@
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-xfer.h>
#include <libnautilus-extensions/nautilus-background.h>
#include <libnautilus-extensions/nautilus-directory-background.h>
#include <libnautilus-extensions/nautilus-directory.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
@ -710,19 +712,26 @@ static void
fm_icon_view_begin_loading (FMDirectoryView *view)
{
FMIconView *icon_view;
GtkWidget *icon_container;
NautilusDirectory *directory;
int level;
char *sort_name;
NautilusBackground *background;
g_return_if_fail (FM_IS_ICON_VIEW (view));
icon_view = FM_ICON_VIEW (view);
directory = fm_directory_view_get_model (view);
icon_container = GTK_WIDGET (get_icon_container (icon_view));
nautilus_connect_background_to_directory_metadata
(GTK_WIDGET (get_icon_container (icon_view)),
directory);
/* hackish way to tag the desktop so it can use a different background. */
if (FM_IS_DESKSTOP_ICON_VIEW (view)) {
background = nautilus_get_widget_background (icon_container);
gtk_object_set_data (GTK_OBJECT (background), "desktop", view);
}
nautilus_connect_background_to_directory_metadata (icon_container, directory);
/* Set up the zoom level from the metadata. */
level = nautilus_directory_get_integer_metadata
(directory,