Commit fe8d6ede authored by Andy Hertzfeld's avatar Andy Hertzfeld

added a new theme for vector based icons, and a generalized theme selector


          added a new theme for vector based icons, and a generalized
	  theme selector to the preferences dialog
parent 58b235f0
2000-06-02 Andy Hertzfeld <andy@eazel.com>
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 <darin@eazel.com>
* libnautilus-extensions/nautilus-directory.c: (uri_get_basename):
......
......@@ -316,6 +316,7 @@ nautilus.spec
Makefile
icons/Makefile
icons/eazel/Makefile
icons/vector/Makefile
data/Makefile
data/top/Makefile
data/backgrounds/Makefile
......
NULL=
SUBDIRS = eazel
SUBDIRS = eazel vector
icondir = $(datadir)/pixmaps/nautilus
......
Makefile
Makefile.in
vectordir = $(datadir)/pixmaps/nautilus/vector
vector_DATA = \
i-directory.svg \
i-directory-accept.svg \
i-regular.svg \
i-regular.xml
EXTRA_DIST = $(vector_DATA)
<svg width="153" height="127">
<!-- Aopenfolder.eps converted by ill2svg.pl -->
<defs>
<linearGradient id="folder__1"
x1="74.945" y1="40.525" x2="45.881" y2="90.867"
>
<stop offset="0%" style="stop-color:#f2cc0c"/>
<stop offset="100%" style="stop-color:#ffffff"/>
</linearGradient>
<linearGradient id="folder__2"
x1="90.531" y1="101.184" x2="90.531" y2="1.22"
>
<stop offset="0%" style="stop-color:#f2cc0c"/>
<stop offset="100%" style="stop-color:#ffffff"/>
</linearGradient>
<linearGradient id="paper2__1"
x1="-12845.013" y1="-11736.48" x2="-12845.013" y2="-11736.48"
>
<stop offset="0%" style="stop-color:#ffffff"/>
<stop offset="53%" style="stop-color:#c6c6c6"/>
<stop offset="100%" style="stop-color:#ffffff"/>
</linearGradient>
</defs>
<g> <!-- Layer: Layer 1 -->
<g style="fill: #000000; stroke: #000000; stroke-width: 2; stroke-miterlimit: 4">
<path d="M1.341 8.28C1.341 8.28 21.118 29.151 24.576 53.3C28.091 77.85 26.076 79.69 26.076 80.05C26.076 80.41 111.992 123.467 114.38 124.74C114.38 124.74 115.111 102.501 117.62 90.18C121.58 70.74 126.324 64.82 131.326 58.8C135.555 53.709 147.527 48.617 151.1 47.7C152.659 47.3 118.056 29.68 115.701 28.633C114.081 27.913 120.753 22.82 123.159 20.8C124.538 19.643 95.179 6.16 92.659 5.8C91.695 5.662 82.326 12.55 81.981 13.14C81.326 14.261 60.381 1.98 58.941 1.62C57.501 1.26 41.326 4.967 34.326 22.967C34.731 21.925 1.341 8.28 1.341 8.28"/>
<!-- 0 1 0 0 -1 -4014 4716 Bc -->
<!-- 0.53 0 0 -1 -4014 4716 Bm -->
<!-- 0.47 0 0 -1 -4013.47 4716 Bm -->
<!-- 1 0 0 -1 -4014 4716 Bc -->
</g>
<g style="fill: url(#paper2__1)">
<path d="M8.001 13.5"/>
<!-- 0 -12063.8165 -20895.5197 -129.5781 74.8106 12379.965 21286.9274 Bc -->
<!-- -29.064 -50.3412 -129.5781 74.8106 316.1485 391.4076 Bm -->
<!-- -12063.8165 -20895.5197 -129.5781 74.8106 287.0845 341.0665 Bc -->
</g>
<g style="fill: url(#folder__1); stroke: #000000; stroke-width: 2; stroke-miterlimit: 4">
<path d="M8.001 13.5C8.001 13.5 30.668 30.167 30.334 77.167C30.324 78.607 110.334 119.5 110.334 119.5C110.334 119.5 109.438 80.038 101.084 64.167C97.751 57.833 88.099 53.031 84.769 51.207C72.834 44.667 8.001 13.5 8.001 13.5"/>
<!-- 2 0 24127.9999 112.1479 0 211.4924 -23760.1835 Bc -->
<!-- 0 99.9634 112.1479 0 211.4924 367.8163 Bm -->
<!-- 0 24127.9999 112.1479 0 211.4924 467.7797 Bc -->
</g>
<g style="fill: url(#folder__2)">
<path d="M41.992 25.133C41.992 25.133 87.136 47.22 88.576 48.3C90.016 49.38 96.654 52.892 98.492 54.3C110.576 63.55 109.576 72.55 113.659 90.8C114.762 95.731 112.58 78.84 121.76 64.08C128.774 52.802 133.552 50.553 141.38 46.08C142.64 45.36 58.941 5.94 58.581 5.22C58.581 5.22 44.252 8.013 38.492 23.133"/>
</g>
<g style="fill: #0072ba">
<path d="M86.034 13.633C87.034 14.3 112.034 25.8 112.534 26.133C113.034 26.466 117.839 20.82 118.326 20.467C118.784 20.133 94.659 8.633 93.659 8.467C92.659 8.3 86.034 13.633 86.034 13.633z"/>
</g>
<g style="fill:none; stroke: #5ed8ff; stroke-width: 2; stroke-linecap: round; stroke-miterlimit: 4">
<path d="M88.492 13.133C88.492 13.133 92.492 9.967 93.659 10.133C94.826 10.3 114.43 19.545 115.659 20.467"/>
</g>
</g>
</svg>
<svg width="113" height="132">
<!-- Aclosedfolder.eps converted by ill2svg.pl -->
<defs>
<linearGradient id="folder__1"
x1="69.721" y1="35.66" x2="32.351" y2="100.388"
>
<stop offset="0%" style="stop-color:#f2cc0c"/>
<stop offset="100%" style="stop-color:#ffffff"/>
</linearGradient>
<linearGradient id="folder__2"
x1="62.569" y1="84.528" x2="62.569" y2="5.088"
>
<stop offset="0%" style="stop-color:#f2cc0c"/>
<stop offset="100%" style="stop-color:#ffffff"/>
</linearGradient>
</defs>
<g> <!-- Layer: Layer 1 -->
<g style="fill: #000000">
<path d="M0.636 5.127C1.604 8.517 7.657 34.907 7.657 47.497C7.657 60.087 7.657 85.266 7.415 86.235C7.173 87.203 97.965 131.51 100.144 131.51C100.91 131.51 97.85 81.164 112.135 43.636C112.52 42.624 69.208 23.491 65.334 21.796C64.42 21.396 20.976 -0.181 20.007 0.303C19.039 0.787 16.373 13.117 16.131 12.39C15.889 11.664 0.636 5.127 0.636 5.127z"/>
<!-- 0 -12546.481 -21731.4346 -124.4484 71.8493 12876.4454 22131.8347 Bc -->
<!-- -37.3698 -64.7272 -124.4484 71.8493 329.9644 400.4001 Bm -->
<!-- -12546.481 -21731.4346 -124.4484 71.8493 292.5946 335.6729 Bc -->
</g>
<g style="fill: url(#folder__1); stroke: #000000; stroke-width: 3.12; stroke-miterlimit: 4">
<path d="M5.72 11.18C5.72 11.18 11.773 36.602 11.047 50.402C10.487 61.043 11.531 83.572 11.531 83.572C11.531 83.572 95.786 125.941 95.786 125.215C95.786 124.489 99.418 76.308 86.344 51.371C85.365 49.504 5.72 11.18 5.72 11.18"/>
<!-- 2 0 25093.143 93.1983 0 214.8871 -24705.6788 Bc -->
<!-- 0 79.4403 93.1983 0 214.8871 387.4642 Bm -->
<!-- 0 25093.143 93.1983 0 214.8871 466.9044 Bc -->
</g>
<g style="fill: url(#folder__2)">
<path d="M98.449 80.424C98.449 80.424 100.852 60.929 105.548 46.843C105.925 45.712 22.694 7.236 22.694 7.236C22.694 7.236 21.048 11.223 21.048 14.083C21.048 14.688 85.951 45.417 89.31 47.8C93.93 51.076 98.449 77.491 98.449 80.424z"/>
</g>
<g style="fill: #000000">
<path d="M55.838 36.844"/>
<path d="M51.589 15.879C51.589 14.184 56.461 4.965 57.188 4.723C57.914 4.481 86.397 18.037 87.608 18.763C88.818 19.489 84.228 23.703 83.064 30.89"/>
</g>
<g style="fill: #0072ba">
<path d="M55.499 16.345C56.952 17.314 79.226 27.483 79.953 27.967C79.689 27.791 83.045 20.067 83.188 20.496C82.912 19.668 60.72 9.645 59.268 9.403C57.815 9.161 55.499 16.345 55.499 16.345z"/>
</g>
</g>
</svg>
<svg width="110" height="122">
<!-- Adocument4.eps converted by ill2svg.pl -->
<defs>
<linearGradient id="Paper__1"
x1="36.263" y1="-1.979" x2="72.476" y2="124.31"
>
<stop offset="0%" style="stop-color:#ffffff"/>
<stop offset="100%" style="stop-color:#a8a8a8"/>
</linearGradient>
</defs>
<g> <!-- Layer: Layer 1 -->
<g style="fill: #000000; stroke: #000000; stroke-width: 1.6679; stroke-miterlimit: 4">
<path d="M1.626 120.976L93.918 120.976C93.918 120.976 101.021 96.011 100.59 67.324C100.314 48.942 101.285 38.413 101.285 38.413C101.285 38.413 103.092 17.147 108.374 1.024L15.665 1.024C15.665 1.024 9.132 21.317 8.993 41.054C8.854 60.792 7.881 81.779 7.881 81.779C7.881 81.779 4.128 114.582 1.626 120.976"/>
<!-- 0 5386.9761 -18786.4912 -123.1628 -35.3166 -5089.5731 19273.3152 Bc -->
<!-- 36.2128 -126.2882 -123.1628 -35.3166 297.403 486.824 Bm -->
<!-- 5386.9761 -18786.4912 -123.1628 -35.3166 333.6158 360.5358 Bc -->
</g>
<g style="fill: url(#Paper__1)">
<path d="M19.661 6.156L102.483 6.156C102.483 6.156 96.003 23.436 96.003 59.211C96.003 83.377 95.463 82.565 95.463 82.565C95.463 82.565 94.518 101.6 89.32 116.112L7.444 116.045C7.444 116.045 12.574 101.06 13.249 64.206C13.249 64.206 12.709 27.081 19.661 6.156z"/>
</g>
</g>
</svg>
<?xml version="1.0"?>
<ICON_SET>
<ICON SIZE="36" EMBEDDED_TEXT_RECTANGLE="7,3,25,26"/>
<ICON SIZE="48" EMBEDDED_TEXT_RECTANGLE="8,4,38,56"/>
<ICON SIZE="72" EMBEDDED_TEXT_RECTANGLE="9,6,51,58"/>
<ICON SIZE="96" EMBEDDED_TEXT_RECTANGLE="11,8,76,84"/>
</ICON_SET>
......@@ -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,
......
......@@ -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;
......
......@@ -26,6 +26,7 @@
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libgnomevfs/gnome-vfs.h>
#include <gtk/gtkcheckbutton.h>
......@@ -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;
......
......@@ -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);
......
......@@ -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,
......
......@@ -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;
......
......@@ -26,6 +26,7 @@
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libgnomevfs/gnome-vfs.h>
#include <gtk/gtkcheckbutton.h>
......@@ -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;
......
......@@ -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);
......
......@@ -26,6 +26,7 @@
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libgnomevfs/gnome-vfs.h>
#include <gtk/gtkcheckbutton.h>
......@@ -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;