diff --git a/ChangeLog b/ChangeLog index 0a785e8b1..7ec03bdd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,43 @@ +2000-06-02 Andy Hertzfeld + + added a new theme composed of vector icons, and a generalized theme + selector in the preferences dialog + + * configure.in: + * icons/Makefile.am: + * icons/vector/.cvsignore: + * icons/vector/Makefile.am: + * icons/vector/i-directory-accept.svg: + * icons/vector/i-directory.svg: + * icons/vector/i-regular.svg: + * icons/vector/i-regular.xml: + added a new directory for a vector + + * libnautilus-extensions/nautilus-global-preferences.c: + (global_preferences_create_dialog), + (global_preferences_register_for_ui): + changed the type of the icon theme selector to a custom one + + * nautilus-widgets/nautilus-preferences-item.c: + (preferences_item_construct), + (preferences_item_create_font_family), (add_icon_themes), + (preferences_item_create_icon_theme), (text_item_changed_callback): + implemented a custom type for icon theme selecting; added a routine + to iterate through the icons directory to find available themes + + * nautilus-widgets/nautilus-preferences-item.h: + defined a custom type for icon theme selection + + * src/nautilus-window-menus.c: (nautilus_window_initialize_menus), + (refresh_bookmarks_in_go_menu): + removed the old code that maintained a menu item for icon + theme selection now that we have it in preferences + + * libnautilus-extensions/nautilus-icon-factory.c: + (load_specific_image_svg): + changed the default scaling for vector icons to match the + size that Susan's been drawing them at + 2000-06-02 Darin Adler * libnautilus-extensions/nautilus-directory.c: (uri_get_basename): diff --git a/configure.in b/configure.in index 58527797e..8df82f55e 100644 --- a/configure.in +++ b/configure.in @@ -316,6 +316,7 @@ nautilus.spec Makefile icons/Makefile icons/eazel/Makefile +icons/vector/Makefile data/Makefile data/top/Makefile data/backgrounds/Makefile diff --git a/icons/Makefile.am b/icons/Makefile.am index abedbf7d3..4ef30922c 100644 --- a/icons/Makefile.am +++ b/icons/Makefile.am @@ -1,6 +1,6 @@ NULL= -SUBDIRS = eazel +SUBDIRS = eazel vector icondir = $(datadir)/pixmaps/nautilus diff --git a/icons/vector/.cvsignore b/icons/vector/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/icons/vector/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/icons/vector/Makefile.am b/icons/vector/Makefile.am new file mode 100644 index 000000000..7b9dafdb6 --- /dev/null +++ b/icons/vector/Makefile.am @@ -0,0 +1,9 @@ +vectordir = $(datadir)/pixmaps/nautilus/vector + +vector_DATA = \ + i-directory.svg \ + i-directory-accept.svg \ + i-regular.svg \ + i-regular.xml + +EXTRA_DIST = $(vector_DATA) diff --git a/icons/vector/i-directory-accept.svg b/icons/vector/i-directory-accept.svg new file mode 100644 index 000000000..11c233f40 --- /dev/null +++ b/icons/vector/i-directory-accept.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/icons/vector/i-directory.svg b/icons/vector/i-directory.svg new file mode 100644 index 000000000..6003a65b1 --- /dev/null +++ b/icons/vector/i-directory.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/icons/vector/i-regular.svg b/icons/vector/i-regular.svg new file mode 100644 index 000000000..7ff8b6d71 --- /dev/null +++ b/icons/vector/i-regular.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/icons/vector/i-regular.xml b/icons/vector/i-regular.xml new file mode 100644 index 000000000..b4d629e35 --- /dev/null +++ b/icons/vector/i-regular.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/libnautilus-extensions/nautilus-global-preferences.c b/libnautilus-extensions/nautilus-global-preferences.c index 1aeb12786..0575e9f62 100644 --- a/libnautilus-extensions/nautilus-global-preferences.c +++ b/libnautilus-extensions/nautilus-global-preferences.c @@ -197,7 +197,12 @@ global_preferences_create_dialog (void) 2, NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY, NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY); - + + nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (appearance_pane), "Icons"); + nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (appearance_pane), + 3, + NAUTILUS_PREFERENCES_ICON_THEME, + NAUTILUS_PREFERENCE_ITEM_ICON_THEME); /* all done */ return prefs_dialog; @@ -480,10 +485,15 @@ global_preferences_register_for_ui (void) FALSE, FALSE, FALSE); + + global_preferences_register_string_with_defaults (NAUTILUS_PREFERENCES_ICON_THEME, + "Select theme for icons", + "default", + "default", + "default"); - /* Directory View */ global_preferences_register_string_with_defaults (NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY, - "Font familiy used to display file names", + "Font family used to display file names", "helvetica", "helvetica", "helvetica"); @@ -500,12 +510,6 @@ global_preferences_register_for_ui (void) * They do need to have appropiate defaults nontheless. */ - global_preferences_register_string_with_defaults (NAUTILUS_PREFERENCES_ICON_THEME, - "Show entire filename", - "default", - "default", - "default"); - global_preferences_register_boolean_with_defaults (NAUTILUS_PREFERENCES_SHOW_REAL_FILE_NAME, "Show entire filename", FALSE, diff --git a/libnautilus-extensions/nautilus-icon-factory.c b/libnautilus-extensions/nautilus-icon-factory.c index 74f756cc3..18127e7cb 100644 --- a/libnautilus-extensions/nautilus-icon-factory.c +++ b/libnautilus-extensions/nautilus-icon-factory.c @@ -1195,8 +1195,9 @@ load_specific_image_svg (const char *path, guint size_in_pixels) if (f == NULL) { return NULL; } + /* nominal vector icon is twice the size of nominal bitmap, so scale it down here */ result = rsvg_render_file (f, size_in_pixels * - (1.0 / NAUTILUS_ICON_SIZE_STANDARD)); + (1.0 / (NAUTILUS_ICON_SIZE_STANDARD << 1))); fclose (f); return result; diff --git a/libnautilus-extensions/nautilus-preferences-item.c b/libnautilus-extensions/nautilus-preferences-item.c index 3e2723c25..1f6175f25 100644 --- a/libnautilus-extensions/nautilus-preferences-item.c +++ b/libnautilus-extensions/nautilus-preferences-item.c @@ -26,6 +26,7 @@ #include "nautilus-preferences-item.h" #include "nautilus-preferences.h" #include +#include #include @@ -82,12 +83,14 @@ static void preferences_item_create_boolean (NautilusPreferencesItem const NautilusPreference *prefrence); static void preferences_item_create_font_family (NautilusPreferencesItem *item, const NautilusPreference *prefrence); +static void preferences_item_create_icon_theme (NautilusPreferencesItem *item, + const NautilusPreference *preference); static void enum_radio_group_changed_callback (GtkWidget *button_group, GtkWidget *button, gpointer user_data); static void boolean_button_toggled_callback (GtkWidget *button_group, gpointer user_data); -static void font_family_changed_callback (GtkWidget *string_picker, +static void text_item_changed_callback (GtkWidget *string_picker, gpointer user_data); NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesItem, nautilus_preferences_item, GTK_TYPE_VBOX) @@ -266,6 +269,11 @@ preferences_item_construct (NautilusPreferencesItem *item, case NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY: preferences_item_create_font_family (item, preference); break; + + case NAUTILUS_PREFERENCE_ITEM_ICON_THEME: + preferences_item_create_icon_theme (item, preference); + break; + } gtk_object_unref (GTK_OBJECT (preference)); @@ -396,10 +404,89 @@ preferences_item_create_font_family (NautilusPreferencesItem *item, gtk_signal_connect (GTK_OBJECT (item->details->child), "changed", - GTK_SIGNAL_FUNC (font_family_changed_callback), + GTK_SIGNAL_FUNC (text_item_changed_callback), (gpointer) item); } +/* add available icon themes to the theme list by iterating through the + nautilus icons directory, looking for sub-directories */ +static void +add_icon_themes(NautilusStringList *theme_list) +{ + char *directory_uri; + GnomeVFSResult result; + GnomeVFSFileInfo *current_file_info; + GnomeVFSDirectoryList *list; + + /* get the uri for the images directory */ + directory_uri = gnome_pixmap_file("nautilus"); + + result = gnome_vfs_directory_list_load (&list, directory_uri, + GNOME_VFS_FILE_INFO_DEFAULT, NULL, NULL); + if (result != GNOME_VFS_OK) { + g_free(directory_uri); + return; + } + + /* interate through the directory for each file */ + current_file_info = gnome_vfs_directory_list_first(list); + while (current_file_info != NULL) { + if ((current_file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) && + (current_file_info->name[0] != '.')) + nautilus_string_list_insert (theme_list, current_file_info->name); + current_file_info = gnome_vfs_directory_list_next(list); + } + + g_free(directory_uri); + gnome_vfs_directory_list_destroy(list); +} + +static void +preferences_item_create_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_string_picker_set_title_label (NAUTILUS_STRING_PICKER (item->details->child), description); + + g_free (description); + + theme_list = nautilus_string_list_new (); + nautilus_string_list_insert (theme_list, "default"); + add_icon_themes(theme_list); + + nautilus_string_picker_set_string_list (NAUTILUS_STRING_PICKER (item->details->child), theme_list); + + current_value = nautilus_preferences_get (item->details->preference_name, "default"); + + 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, @@ -457,7 +544,7 @@ boolean_button_toggled_callback (GtkWidget *button, gpointer user_data) } static void -font_family_changed_callback (GtkWidget *button, gpointer user_data) +text_item_changed_callback (GtkWidget *button, gpointer user_data) { NautilusPreferencesItem *item; char *text; diff --git a/libnautilus-extensions/nautilus-preferences-item.h b/libnautilus-extensions/nautilus-preferences-item.h index a4c85a11f..32e9703c4 100644 --- a/libnautilus-extensions/nautilus-preferences-item.h +++ b/libnautilus-extensions/nautilus-preferences-item.h @@ -66,7 +66,8 @@ typedef enum { NAUTILUS_PREFERENCE_ITEM_BOOLEAN, NAUTILUS_PREFERENCE_ITEM_ENUM, - NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY + NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY, + NAUTILUS_PREFERENCE_ITEM_ICON_THEME } NautilusPreferencesItemType; GtkType nautilus_preferences_item_get_type (void); diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c index 1aeb12786..0575e9f62 100644 --- a/libnautilus-private/nautilus-global-preferences.c +++ b/libnautilus-private/nautilus-global-preferences.c @@ -197,7 +197,12 @@ global_preferences_create_dialog (void) 2, NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY, NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY); - + + nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (appearance_pane), "Icons"); + nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (appearance_pane), + 3, + NAUTILUS_PREFERENCES_ICON_THEME, + NAUTILUS_PREFERENCE_ITEM_ICON_THEME); /* all done */ return prefs_dialog; @@ -480,10 +485,15 @@ global_preferences_register_for_ui (void) FALSE, FALSE, FALSE); + + global_preferences_register_string_with_defaults (NAUTILUS_PREFERENCES_ICON_THEME, + "Select theme for icons", + "default", + "default", + "default"); - /* Directory View */ global_preferences_register_string_with_defaults (NAUTILUS_PREFERENCES_DIRECTORY_VIEW_FONT_FAMILY, - "Font familiy used to display file names", + "Font family used to display file names", "helvetica", "helvetica", "helvetica"); @@ -500,12 +510,6 @@ global_preferences_register_for_ui (void) * They do need to have appropiate defaults nontheless. */ - global_preferences_register_string_with_defaults (NAUTILUS_PREFERENCES_ICON_THEME, - "Show entire filename", - "default", - "default", - "default"); - global_preferences_register_boolean_with_defaults (NAUTILUS_PREFERENCES_SHOW_REAL_FILE_NAME, "Show entire filename", FALSE, diff --git a/libnautilus-private/nautilus-icon-factory.c b/libnautilus-private/nautilus-icon-factory.c index 74f756cc3..18127e7cb 100644 --- a/libnautilus-private/nautilus-icon-factory.c +++ b/libnautilus-private/nautilus-icon-factory.c @@ -1195,8 +1195,9 @@ load_specific_image_svg (const char *path, guint size_in_pixels) if (f == NULL) { return NULL; } + /* nominal vector icon is twice the size of nominal bitmap, so scale it down here */ result = rsvg_render_file (f, size_in_pixels * - (1.0 / NAUTILUS_ICON_SIZE_STANDARD)); + (1.0 / (NAUTILUS_ICON_SIZE_STANDARD << 1))); fclose (f); return result; diff --git a/libnautilus-private/nautilus-preferences-item.c b/libnautilus-private/nautilus-preferences-item.c index 3e2723c25..1f6175f25 100644 --- a/libnautilus-private/nautilus-preferences-item.c +++ b/libnautilus-private/nautilus-preferences-item.c @@ -26,6 +26,7 @@ #include "nautilus-preferences-item.h" #include "nautilus-preferences.h" #include +#include #include @@ -82,12 +83,14 @@ static void preferences_item_create_boolean (NautilusPreferencesItem const NautilusPreference *prefrence); static void preferences_item_create_font_family (NautilusPreferencesItem *item, const NautilusPreference *prefrence); +static void preferences_item_create_icon_theme (NautilusPreferencesItem *item, + const NautilusPreference *preference); static void enum_radio_group_changed_callback (GtkWidget *button_group, GtkWidget *button, gpointer user_data); static void boolean_button_toggled_callback (GtkWidget *button_group, gpointer user_data); -static void font_family_changed_callback (GtkWidget *string_picker, +static void text_item_changed_callback (GtkWidget *string_picker, gpointer user_data); NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesItem, nautilus_preferences_item, GTK_TYPE_VBOX) @@ -266,6 +269,11 @@ preferences_item_construct (NautilusPreferencesItem *item, case NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY: preferences_item_create_font_family (item, preference); break; + + case NAUTILUS_PREFERENCE_ITEM_ICON_THEME: + preferences_item_create_icon_theme (item, preference); + break; + } gtk_object_unref (GTK_OBJECT (preference)); @@ -396,10 +404,89 @@ preferences_item_create_font_family (NautilusPreferencesItem *item, gtk_signal_connect (GTK_OBJECT (item->details->child), "changed", - GTK_SIGNAL_FUNC (font_family_changed_callback), + GTK_SIGNAL_FUNC (text_item_changed_callback), (gpointer) item); } +/* add available icon themes to the theme list by iterating through the + nautilus icons directory, looking for sub-directories */ +static void +add_icon_themes(NautilusStringList *theme_list) +{ + char *directory_uri; + GnomeVFSResult result; + GnomeVFSFileInfo *current_file_info; + GnomeVFSDirectoryList *list; + + /* get the uri for the images directory */ + directory_uri = gnome_pixmap_file("nautilus"); + + result = gnome_vfs_directory_list_load (&list, directory_uri, + GNOME_VFS_FILE_INFO_DEFAULT, NULL, NULL); + if (result != GNOME_VFS_OK) { + g_free(directory_uri); + return; + } + + /* interate through the directory for each file */ + current_file_info = gnome_vfs_directory_list_first(list); + while (current_file_info != NULL) { + if ((current_file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) && + (current_file_info->name[0] != '.')) + nautilus_string_list_insert (theme_list, current_file_info->name); + current_file_info = gnome_vfs_directory_list_next(list); + } + + g_free(directory_uri); + gnome_vfs_directory_list_destroy(list); +} + +static void +preferences_item_create_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_string_picker_set_title_label (NAUTILUS_STRING_PICKER (item->details->child), description); + + g_free (description); + + theme_list = nautilus_string_list_new (); + nautilus_string_list_insert (theme_list, "default"); + add_icon_themes(theme_list); + + nautilus_string_picker_set_string_list (NAUTILUS_STRING_PICKER (item->details->child), theme_list); + + current_value = nautilus_preferences_get (item->details->preference_name, "default"); + + 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, @@ -457,7 +544,7 @@ boolean_button_toggled_callback (GtkWidget *button, gpointer user_data) } static void -font_family_changed_callback (GtkWidget *button, gpointer user_data) +text_item_changed_callback (GtkWidget *button, gpointer user_data) { NautilusPreferencesItem *item; char *text; diff --git a/libnautilus-private/nautilus-preferences-item.h b/libnautilus-private/nautilus-preferences-item.h index a4c85a11f..32e9703c4 100644 --- a/libnautilus-private/nautilus-preferences-item.h +++ b/libnautilus-private/nautilus-preferences-item.h @@ -66,7 +66,8 @@ typedef enum { NAUTILUS_PREFERENCE_ITEM_BOOLEAN, NAUTILUS_PREFERENCE_ITEM_ENUM, - NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY + NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY, + NAUTILUS_PREFERENCE_ITEM_ICON_THEME } NautilusPreferencesItemType; GtkType nautilus_preferences_item_get_type (void); diff --git a/nautilus-widgets/nautilus-preferences-item.c b/nautilus-widgets/nautilus-preferences-item.c index 3e2723c25..1f6175f25 100644 --- a/nautilus-widgets/nautilus-preferences-item.c +++ b/nautilus-widgets/nautilus-preferences-item.c @@ -26,6 +26,7 @@ #include "nautilus-preferences-item.h" #include "nautilus-preferences.h" #include +#include #include @@ -82,12 +83,14 @@ static void preferences_item_create_boolean (NautilusPreferencesItem const NautilusPreference *prefrence); static void preferences_item_create_font_family (NautilusPreferencesItem *item, const NautilusPreference *prefrence); +static void preferences_item_create_icon_theme (NautilusPreferencesItem *item, + const NautilusPreference *preference); static void enum_radio_group_changed_callback (GtkWidget *button_group, GtkWidget *button, gpointer user_data); static void boolean_button_toggled_callback (GtkWidget *button_group, gpointer user_data); -static void font_family_changed_callback (GtkWidget *string_picker, +static void text_item_changed_callback (GtkWidget *string_picker, gpointer user_data); NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesItem, nautilus_preferences_item, GTK_TYPE_VBOX) @@ -266,6 +269,11 @@ preferences_item_construct (NautilusPreferencesItem *item, case NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY: preferences_item_create_font_family (item, preference); break; + + case NAUTILUS_PREFERENCE_ITEM_ICON_THEME: + preferences_item_create_icon_theme (item, preference); + break; + } gtk_object_unref (GTK_OBJECT (preference)); @@ -396,10 +404,89 @@ preferences_item_create_font_family (NautilusPreferencesItem *item, gtk_signal_connect (GTK_OBJECT (item->details->child), "changed", - GTK_SIGNAL_FUNC (font_family_changed_callback), + GTK_SIGNAL_FUNC (text_item_changed_callback), (gpointer) item); } +/* add available icon themes to the theme list by iterating through the + nautilus icons directory, looking for sub-directories */ +static void +add_icon_themes(NautilusStringList *theme_list) +{ + char *directory_uri; + GnomeVFSResult result; + GnomeVFSFileInfo *current_file_info; + GnomeVFSDirectoryList *list; + + /* get the uri for the images directory */ + directory_uri = gnome_pixmap_file("nautilus"); + + result = gnome_vfs_directory_list_load (&list, directory_uri, + GNOME_VFS_FILE_INFO_DEFAULT, NULL, NULL); + if (result != GNOME_VFS_OK) { + g_free(directory_uri); + return; + } + + /* interate through the directory for each file */ + current_file_info = gnome_vfs_directory_list_first(list); + while (current_file_info != NULL) { + if ((current_file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) && + (current_file_info->name[0] != '.')) + nautilus_string_list_insert (theme_list, current_file_info->name); + current_file_info = gnome_vfs_directory_list_next(list); + } + + g_free(directory_uri); + gnome_vfs_directory_list_destroy(list); +} + +static void +preferences_item_create_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_string_picker_set_title_label (NAUTILUS_STRING_PICKER (item->details->child), description); + + g_free (description); + + theme_list = nautilus_string_list_new (); + nautilus_string_list_insert (theme_list, "default"); + add_icon_themes(theme_list); + + nautilus_string_picker_set_string_list (NAUTILUS_STRING_PICKER (item->details->child), theme_list); + + current_value = nautilus_preferences_get (item->details->preference_name, "default"); + + 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, @@ -457,7 +544,7 @@ boolean_button_toggled_callback (GtkWidget *button, gpointer user_data) } static void -font_family_changed_callback (GtkWidget *button, gpointer user_data) +text_item_changed_callback (GtkWidget *button, gpointer user_data) { NautilusPreferencesItem *item; char *text; diff --git a/nautilus-widgets/nautilus-preferences-item.h b/nautilus-widgets/nautilus-preferences-item.h index a4c85a11f..32e9703c4 100644 --- a/nautilus-widgets/nautilus-preferences-item.h +++ b/nautilus-widgets/nautilus-preferences-item.h @@ -66,7 +66,8 @@ typedef enum { NAUTILUS_PREFERENCE_ITEM_BOOLEAN, NAUTILUS_PREFERENCE_ITEM_ENUM, - NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY + NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY, + NAUTILUS_PREFERENCE_ITEM_ICON_THEME } NautilusPreferencesItemType; GtkType nautilus_preferences_item_get_type (void); diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c index 31a2f3bb9..24a42abcb 100644 --- a/src/nautilus-navigation-window-menus.c +++ b/src/nautilus-navigation-window-menus.c @@ -56,7 +56,6 @@ static void clear_appended_bookmark_items (Nau static NautilusBookmarkList *get_bookmark_list (void); static void refresh_bookmarks_in_go_menu (NautilusWindow *window); static void refresh_bookmarks_in_bookmarks_menu (NautilusWindow *window); -static void update_eazel_theme_menu_item (NautilusWindow *window); static void update_undo_menu_item (NautilusWindow *window); static void edit_bookmarks (NautilusWindow *window); @@ -92,7 +91,6 @@ typedef struct { #define NAUTILUS_MENU_PATH_AFTER_USER_LEVEL_SEPARATOR "/Settings/After User Level Separator" #define NAUTILUS_MENU_PATH_CUSTOMIZE_ITEM "/Settings/Customize" -#define NAUTILUS_MENU_PATH_USE_EAZEL_THEME_ICONS_ITEM "/Settings/Use Eazel Theme Icons" static void file_menu_new_window_callback (BonoboUIHandler *ui_handler, @@ -319,26 +317,6 @@ settings_menu_customize_callback (BonoboUIHandler *ui_handler, nautilus_property_browser_new (); } -static void -settings_menu_use_eazel_theme_icons_callback (BonoboUIHandler *ui_handler, - gpointer user_data, - const char *path) -{ - char *current_theme; - char *new_theme; - - current_theme = nautilus_preferences_get (NAUTILUS_PREFERENCES_ICON_THEME, "default"); - if (nautilus_strcmp (current_theme, "eazel") == 0) { - new_theme = "default"; - } else { - new_theme = "eazel"; - } - - nautilus_preferences_set (NAUTILUS_PREFERENCES_ICON_THEME, new_theme); - - g_free (current_theme); -} - static void help_menu_about_nautilus_callback (BonoboUIHandler *ui_handler, gpointer user_data, @@ -912,22 +890,6 @@ nautilus_window_initialize_menus (NautilusWindow *window) settings_menu_customize_callback, NULL); - /* It's called SEPARATOR_AFTER_USER_LEVELS because "General Settings" is - * going to expand into the user level choices plus the choice that brings - * up the user-level-details customizing dialog. - */ - append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_AFTER_USER_LEVELS); - - bonobo_ui_handler_menu_new_toggleitem (ui_handler, - NAUTILUS_MENU_PATH_USE_EAZEL_THEME_ICONS_ITEM, - _("Use _Eazel Theme Icons"), - _("Select whether to use standard or Eazel icons"), - -1, - 0, - 0, - settings_menu_use_eazel_theme_icons_callback, - NULL); - /* Help */ new_top_level_menu (window, NAUTILUS_MENU_PATH_HELP_MENU, _("_Help")); @@ -951,18 +913,9 @@ nautilus_window_initialize_menus (NautilusWindow *window) NAUTILUS_MENU_PATH_SELECT_ALL_ITEM, FALSE); - /* Set initial toggle state of Eazel theme menu item */ - update_eazel_theme_menu_item (window); - /* Set inital state of undo menu */ update_undo_menu_item (window); - /* Sign up to be notified of icon theme changes so Use Eazel Theme Icons - * menu item will show correct toggle state. */ - gtk_signal_connect_object_while_alive - (nautilus_icon_factory_get (), "icons_changed", - update_eazel_theme_menu_item, GTK_OBJECT (window)); - /* Connect to UndoManager so that we are notified when an undo transcation has occurred */ undo_manager = NAUTILUS_UNDO_MANAGER (NAUTILUS_APP (window->app)->undo_manager); gtk_signal_connect_object_while_alive @@ -1049,20 +1002,6 @@ refresh_bookmarks_in_go_menu (NautilusWindow *window) } } -static void -update_eazel_theme_menu_item (NautilusWindow *window) -{ - g_assert (NAUTILUS_IS_WINDOW (window)); - - /* Change the state of the menu item without invoking our callback function. */ - nautilus_bonobo_ui_handler_menu_set_toggle_appearance ( - window->uih, - NAUTILUS_MENU_PATH_USE_EAZEL_THEME_ICONS_ITEM, - nautilus_eat_strcmp (nautilus_preferences_get (NAUTILUS_PREFERENCES_ICON_THEME, - "default"), - "eazel") == 0); -} - /* Toggle sensitivity based on undo manager state */ static void update_undo_menu_item (NautilusWindow *window) diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c index 31a2f3bb9..24a42abcb 100644 --- a/src/nautilus-window-menus.c +++ b/src/nautilus-window-menus.c @@ -56,7 +56,6 @@ static void clear_appended_bookmark_items (Nau static NautilusBookmarkList *get_bookmark_list (void); static void refresh_bookmarks_in_go_menu (NautilusWindow *window); static void refresh_bookmarks_in_bookmarks_menu (NautilusWindow *window); -static void update_eazel_theme_menu_item (NautilusWindow *window); static void update_undo_menu_item (NautilusWindow *window); static void edit_bookmarks (NautilusWindow *window); @@ -92,7 +91,6 @@ typedef struct { #define NAUTILUS_MENU_PATH_AFTER_USER_LEVEL_SEPARATOR "/Settings/After User Level Separator" #define NAUTILUS_MENU_PATH_CUSTOMIZE_ITEM "/Settings/Customize" -#define NAUTILUS_MENU_PATH_USE_EAZEL_THEME_ICONS_ITEM "/Settings/Use Eazel Theme Icons" static void file_menu_new_window_callback (BonoboUIHandler *ui_handler, @@ -319,26 +317,6 @@ settings_menu_customize_callback (BonoboUIHandler *ui_handler, nautilus_property_browser_new (); } -static void -settings_menu_use_eazel_theme_icons_callback (BonoboUIHandler *ui_handler, - gpointer user_data, - const char *path) -{ - char *current_theme; - char *new_theme; - - current_theme = nautilus_preferences_get (NAUTILUS_PREFERENCES_ICON_THEME, "default"); - if (nautilus_strcmp (current_theme, "eazel") == 0) { - new_theme = "default"; - } else { - new_theme = "eazel"; - } - - nautilus_preferences_set (NAUTILUS_PREFERENCES_ICON_THEME, new_theme); - - g_free (current_theme); -} - static void help_menu_about_nautilus_callback (BonoboUIHandler *ui_handler, gpointer user_data, @@ -912,22 +890,6 @@ nautilus_window_initialize_menus (NautilusWindow *window) settings_menu_customize_callback, NULL); - /* It's called SEPARATOR_AFTER_USER_LEVELS because "General Settings" is - * going to expand into the user level choices plus the choice that brings - * up the user-level-details customizing dialog. - */ - append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_AFTER_USER_LEVELS); - - bonobo_ui_handler_menu_new_toggleitem (ui_handler, - NAUTILUS_MENU_PATH_USE_EAZEL_THEME_ICONS_ITEM, - _("Use _Eazel Theme Icons"), - _("Select whether to use standard or Eazel icons"), - -1, - 0, - 0, - settings_menu_use_eazel_theme_icons_callback, - NULL); - /* Help */ new_top_level_menu (window, NAUTILUS_MENU_PATH_HELP_MENU, _("_Help")); @@ -951,18 +913,9 @@ nautilus_window_initialize_menus (NautilusWindow *window) NAUTILUS_MENU_PATH_SELECT_ALL_ITEM, FALSE); - /* Set initial toggle state of Eazel theme menu item */ - update_eazel_theme_menu_item (window); - /* Set inital state of undo menu */ update_undo_menu_item (window); - /* Sign up to be notified of icon theme changes so Use Eazel Theme Icons - * menu item will show correct toggle state. */ - gtk_signal_connect_object_while_alive - (nautilus_icon_factory_get (), "icons_changed", - update_eazel_theme_menu_item, GTK_OBJECT (window)); - /* Connect to UndoManager so that we are notified when an undo transcation has occurred */ undo_manager = NAUTILUS_UNDO_MANAGER (NAUTILUS_APP (window->app)->undo_manager); gtk_signal_connect_object_while_alive @@ -1049,20 +1002,6 @@ refresh_bookmarks_in_go_menu (NautilusWindow *window) } } -static void -update_eazel_theme_menu_item (NautilusWindow *window) -{ - g_assert (NAUTILUS_IS_WINDOW (window)); - - /* Change the state of the menu item without invoking our callback function. */ - nautilus_bonobo_ui_handler_menu_set_toggle_appearance ( - window->uih, - NAUTILUS_MENU_PATH_USE_EAZEL_THEME_ICONS_ITEM, - nautilus_eat_strcmp (nautilus_preferences_get (NAUTILUS_PREFERENCES_ICON_THEME, - "default"), - "eazel") == 0); -} - /* Toggle sensitivity based on undo manager state */ static void update_undo_menu_item (NautilusWindow *window)