eliminated the toolbar icon theme and associated widgetry in preferences.

eliminated the toolbar icon theme and associated widgetry in
	preferences.  Instead, we use the general theming machinery
	to select toolbar icons.
This commit is contained in:
Andy Hertzfeld 2000-06-30 21:32:34 +00:00
parent 3f4115d6e9
commit 146d22d5ce
13 changed files with 47 additions and 150 deletions

View file

@ -1,3 +1,28 @@
2000-06-30 Andy Hertzfeld <andy@eazel.com>
eliminated the separate toolbar icon theme; instead they are
incorporated into the general theming mechanism
* libnautilus-extensions/nautilus-global-preferences.h:
got rid of NAUTILUS_PREFERENCES_TOOLBAR_ICON_THEME
* libnautilus-extensions/nautilus-global-preferences.c:
(global_preferences_create_dialog),
(global_preferences_register_for_ui):
got rid of the toolbar_icon preference and the associated widgetry
* libnautilus-extensions/nautilus-preferences-item.c,h:
(preferences_item_construct), (preferences_item_create_theme):
got rid of the preference item for the toolbar icon theme
* src/nautilus-window-toolbars.c: (setup_button),
(setup_toolbar_images), (nautilus_window_initialize_toolbars),
(nautilus_window_toolbar_remove_theme_callback):
use the general theming framework to determine the toolbar icons
to use
* icons/vector/vector.xml:
made the vector theme use Susan's toolbar icons
* libnautilus-extensions/nautilus-background.c:
(nautilus_background_draw):
a little bit of clean-up
2000-06-30 Gene Z. Ragan <gzr@eazel.com>
* libnautilus-extensions/bonobo-stream-vfs.c:

View file

@ -2,4 +2,5 @@
<theme name="vector">
<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"/>
</theme>

View file

@ -179,7 +179,7 @@ nautilus_background_new (void)
}
/* this routine is for gdk style rendering, which doesn't naturally support transparency, so we
draw into a pixbuf offscreen if necessary (coming soon */
draw into a pixbuf offscreen if necessary */
void
nautilus_background_draw (NautilusBackground *background,
@ -225,6 +225,9 @@ nautilus_background_draw (NautilusBackground *background,
return;
}
/* handle the normal, uncombined mode by prefering a tile if we have one but
otherwise using the background color */
if (background->details->tile_image != NULL) {
nautilus_gdk_pixbuf_render_to_drawable_tiled (background->details->tile_image,
drawable,

View file

@ -192,12 +192,7 @@ global_preferences_create_dialog (void)
NAUTILUS_PREFERENCES_ANTI_ALIASED_CANVAS,
NAUTILUS_PREFERENCE_ITEM_BOOLEAN);
nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (appearance_pane), "Icon Themes");
nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (appearance_pane),
1,
NAUTILUS_PREFERENCES_TOOLBAR_ICON_THEME,
NAUTILUS_PREFERENCE_ITEM_TOOLBAR_ICON_THEME);
nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (appearance_pane), "Themes");
nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (appearance_pane),
1,
NAUTILUS_PREFERENCES_THEME,
@ -544,7 +539,7 @@ global_preferences_register_for_ui (void)
FALSE);
global_preferences_register_string_with_defaults (NAUTILUS_PREFERENCES_THEME,
"theme for file icons: ",
"current theme",
"default",
"default",
"default");
@ -554,14 +549,6 @@ global_preferences_register_for_ui (void)
"helvetica",
"helvetica",
"helvetica");
/* toolbar icons */
global_preferences_register_string_with_defaults (NAUTILUS_PREFERENCES_TOOLBAR_ICON_THEME,
"theme for toolbar icons:",
"standard",
"standard",
"standard");
/* search tradeoffs */
global_preferences_register_boolean_with_defaults (NAUTILUS_PREFERENCES_SEARCH_METHOD,
"Always do slow, complete search",

View file

@ -63,7 +63,6 @@ BEGIN_GNOME_DECLS
#define NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY "directory-view/font_family"
/* themes */
#define NAUTILUS_PREFERENCES_TOOLBAR_ICON_THEME "preferences/toolbar_icon_theme"
#define NAUTILUS_PREFERENCES_THEME "preferences/theme"
/* File Indexing */

View file

@ -90,8 +90,6 @@ static void preferences_item_create_font_family (NautilusPreferenc
const NautilusPreference *prefrence);
static void preferences_item_create_theme (NautilusPreferencesItem *item,
const NautilusPreference *preference);
static void preferences_item_create_toolbar_icon_theme (NautilusPreferencesItem *item,
const NautilusPreference *preference);
static void enum_radio_group_changed_callback (GtkWidget *button_group,
GtkWidget *button,
gpointer user_data);
@ -284,11 +282,7 @@ preferences_item_construct (NautilusPreferencesItem *item,
break;
case NAUTILUS_PREFERENCE_ITEM_EDITABLE_STRING:
preferences_item_create_editable_string (item, preference);
break;
case NAUTILUS_PREFERENCE_ITEM_TOOLBAR_ICON_THEME:
preferences_item_create_toolbar_icon_theme (item, preference);
break;
break;
}
gtk_object_unref (GTK_OBJECT (preference));
@ -576,53 +570,6 @@ preferences_item_create_theme (NautilusPreferencesItem *item,
(gpointer) item);
}
static void
preferences_item_create_toolbar_icon_theme (NautilusPreferencesItem *item,
const NautilusPreference *preference)
{
char *description;
char *current_value;
NautilusStringList *theme_list;
g_assert (item != NULL);
g_assert (preference != NULL);
g_assert (item->details->preference_name != NULL);
description = nautilus_preference_get_description (preference);
g_assert (description != NULL);
item->details->child = nautilus_string_picker_new ();
nautilus_caption_set_title_label (NAUTILUS_CAPTION (item->details->child), description);
g_free (description);
theme_list = nautilus_string_list_new ();
nautilus_string_list_insert (theme_list, "standard");
add_icon_themes(theme_list, "Up");
nautilus_string_picker_set_string_list (NAUTILUS_STRING_PICKER (item->details->child), theme_list);
current_value = nautilus_preferences_get (item->details->preference_name, "standard");
g_assert (current_value != NULL);
g_assert (nautilus_string_list_contains (theme_list, current_value));
nautilus_string_picker_set_text (NAUTILUS_STRING_PICKER (item->details->child), current_value);
g_free (current_value);
nautilus_string_list_free (theme_list);
gtk_signal_connect (GTK_OBJECT (item->details->child),
"changed",
GTK_SIGNAL_FUNC (text_item_changed_callback),
(gpointer) item);
}
/* NautilusPreferencesItem public methods */
GtkWidget *
nautilus_preferences_item_new (const gchar *preference_name,

View file

@ -69,7 +69,6 @@ typedef enum
NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY,
NAUTILUS_PREFERENCE_ITEM_THEME,
NAUTILUS_PREFERENCE_ITEM_EDITABLE_STRING,
NAUTILUS_PREFERENCE_ITEM_TOOLBAR_ICON_THEME
} NautilusPreferencesItemType;
GtkType nautilus_preferences_item_get_type (void);

View file

@ -179,7 +179,7 @@ nautilus_background_new (void)
}
/* this routine is for gdk style rendering, which doesn't naturally support transparency, so we
draw into a pixbuf offscreen if necessary (coming soon */
draw into a pixbuf offscreen if necessary */
void
nautilus_background_draw (NautilusBackground *background,
@ -225,6 +225,9 @@ nautilus_background_draw (NautilusBackground *background,
return;
}
/* handle the normal, uncombined mode by prefering a tile if we have one but
otherwise using the background color */
if (background->details->tile_image != NULL) {
nautilus_gdk_pixbuf_render_to_drawable_tiled (background->details->tile_image,
drawable,

View file

@ -192,12 +192,7 @@ global_preferences_create_dialog (void)
NAUTILUS_PREFERENCES_ANTI_ALIASED_CANVAS,
NAUTILUS_PREFERENCE_ITEM_BOOLEAN);
nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (appearance_pane), "Icon Themes");
nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (appearance_pane),
1,
NAUTILUS_PREFERENCES_TOOLBAR_ICON_THEME,
NAUTILUS_PREFERENCE_ITEM_TOOLBAR_ICON_THEME);
nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (appearance_pane), "Themes");
nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (appearance_pane),
1,
NAUTILUS_PREFERENCES_THEME,
@ -544,7 +539,7 @@ global_preferences_register_for_ui (void)
FALSE);
global_preferences_register_string_with_defaults (NAUTILUS_PREFERENCES_THEME,
"theme for file icons: ",
"current theme",
"default",
"default",
"default");
@ -554,14 +549,6 @@ global_preferences_register_for_ui (void)
"helvetica",
"helvetica",
"helvetica");
/* toolbar icons */
global_preferences_register_string_with_defaults (NAUTILUS_PREFERENCES_TOOLBAR_ICON_THEME,
"theme for toolbar icons:",
"standard",
"standard",
"standard");
/* search tradeoffs */
global_preferences_register_boolean_with_defaults (NAUTILUS_PREFERENCES_SEARCH_METHOD,
"Always do slow, complete search",

View file

@ -63,7 +63,6 @@ BEGIN_GNOME_DECLS
#define NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY "directory-view/font_family"
/* themes */
#define NAUTILUS_PREFERENCES_TOOLBAR_ICON_THEME "preferences/toolbar_icon_theme"
#define NAUTILUS_PREFERENCES_THEME "preferences/theme"
/* File Indexing */

View file

@ -90,8 +90,6 @@ static void preferences_item_create_font_family (NautilusPreferenc
const NautilusPreference *prefrence);
static void preferences_item_create_theme (NautilusPreferencesItem *item,
const NautilusPreference *preference);
static void preferences_item_create_toolbar_icon_theme (NautilusPreferencesItem *item,
const NautilusPreference *preference);
static void enum_radio_group_changed_callback (GtkWidget *button_group,
GtkWidget *button,
gpointer user_data);
@ -284,11 +282,7 @@ preferences_item_construct (NautilusPreferencesItem *item,
break;
case NAUTILUS_PREFERENCE_ITEM_EDITABLE_STRING:
preferences_item_create_editable_string (item, preference);
break;
case NAUTILUS_PREFERENCE_ITEM_TOOLBAR_ICON_THEME:
preferences_item_create_toolbar_icon_theme (item, preference);
break;
break;
}
gtk_object_unref (GTK_OBJECT (preference));
@ -576,53 +570,6 @@ preferences_item_create_theme (NautilusPreferencesItem *item,
(gpointer) item);
}
static void
preferences_item_create_toolbar_icon_theme (NautilusPreferencesItem *item,
const NautilusPreference *preference)
{
char *description;
char *current_value;
NautilusStringList *theme_list;
g_assert (item != NULL);
g_assert (preference != NULL);
g_assert (item->details->preference_name != NULL);
description = nautilus_preference_get_description (preference);
g_assert (description != NULL);
item->details->child = nautilus_string_picker_new ();
nautilus_caption_set_title_label (NAUTILUS_CAPTION (item->details->child), description);
g_free (description);
theme_list = nautilus_string_list_new ();
nautilus_string_list_insert (theme_list, "standard");
add_icon_themes(theme_list, "Up");
nautilus_string_picker_set_string_list (NAUTILUS_STRING_PICKER (item->details->child), theme_list);
current_value = nautilus_preferences_get (item->details->preference_name, "standard");
g_assert (current_value != NULL);
g_assert (nautilus_string_list_contains (theme_list, current_value));
nautilus_string_picker_set_text (NAUTILUS_STRING_PICKER (item->details->child), current_value);
g_free (current_value);
nautilus_string_list_free (theme_list);
gtk_signal_connect (GTK_OBJECT (item->details->child),
"changed",
GTK_SIGNAL_FUNC (text_item_changed_callback),
(gpointer) item);
}
/* NautilusPreferencesItem public methods */
GtkWidget *
nautilus_preferences_item_new (const gchar *preference_name,

View file

@ -69,7 +69,6 @@ typedef enum
NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY,
NAUTILUS_PREFERENCE_ITEM_THEME,
NAUTILUS_PREFERENCE_ITEM_EDITABLE_STRING,
NAUTILUS_PREFERENCE_ITEM_TOOLBAR_ICON_THEME
} NautilusPreferencesItemType;
GtkType nautilus_preferences_item_get_type (void);

View file

@ -32,6 +32,7 @@
#include <libnautilus-extensions/nautilus-bookmark.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-theme.h>
/* forward declarations */
static void toolbar_reload_callback (GtkWidget *widget, NautilusWindow *window);
@ -258,7 +259,7 @@ setup_button(GtkWidget* button, const char *theme_name, const char *icon_name)
GtkWidget *widget;
char *full_name;
if (strcmp(theme_name, "standard") == 0) {
if ((theme_name == NULL) || (strcmp(theme_name, "default") == 0)) {
full_name = g_strdup (icon_name);
} else {
full_name = g_strdup_printf ("nautilus/%s/%s.png", theme_name, icon_name);
@ -267,7 +268,7 @@ setup_button(GtkWidget* button, const char *theme_name, const char *icon_name)
widget = get_stock_widget (GTK_CONTAINER (GTK_BIN (button)->child));
gnome_stock_set_icon (GNOME_STOCK (widget), full_name);
g_free (full_name);
gtk_widget_queue_resize (button);
gtk_widget_queue_resize (button);
}
@ -276,8 +277,8 @@ setup_toolbar_images(NautilusWindow *window)
{
char *theme_name;
theme_name = nautilus_preferences_get (NAUTILUS_PREFERENCES_TOOLBAR_ICON_THEME, "standard");
theme_name = nautilus_theme_get_theme_data ("toolbar", "ICON_THEME");
setup_button (window->back_button, theme_name, GNOME_STOCK_PIXMAP_BACK);
setup_button (window->forward_button, theme_name, GNOME_STOCK_PIXMAP_FORWARD);
setup_button (window->up_button, theme_name, GNOME_STOCK_PIXMAP_UP);
@ -318,7 +319,7 @@ nautilus_window_initialize_toolbars (NautilusWindow *window)
window);
/* add callback for preference changes */
nautilus_preferences_add_callback(NAUTILUS_PREFERENCES_TOOLBAR_ICON_THEME,
nautilus_preferences_add_callback(NAUTILUS_PREFERENCES_THEME,
(NautilusPreferencesCallback) setup_toolbar_images,
window);
}
@ -327,7 +328,7 @@ void
nautilus_window_toolbar_remove_theme_callback (void)
{
nautilus_preferences_remove_callback
(NAUTILUS_PREFERENCES_TOOLBAR_ICON_THEME,
(NAUTILUS_PREFERENCES_THEME,
(NautilusPreferencesCallback) setup_toolbar_images, NULL);
}