Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
Files
Commits
0437a094
Commit
0437a094
authored
Mar 16, 2000
by
John Sullivan
Browse files
Make icon theme changes persist by using preferences mechanism.
parent
ee495dba
Changes
22
Hide whitespace changes
Inline
Side-by-side
ChangeLog-20000414
View file @
0437a094
2000-03-16 John Sullivan <sullivan@eazel.com>
Made icon theme changes persist across sessions by
using preferences mechanism. When preferences mechanism
switches to using GConf this should (theoretically) make
icon theme changes work across multiple processes too.
* libnautilus/nautilus-global-preferences.h:
added #define for NAUTILUS_PREFERENCES_ICON_THEME
* libnautilus/nautilus-global-preferences.c:
(global_preferences_static_info[]): new entry for
NAUTILUS_PREFERENCES_ICON_THEME with initial value.
* libnautilus/nautilus-icon-factory.c:
(nautilus_get_current_icon_factory): get theme from preferences
and register callback to be notified of changes in preference.
(nautilus_icon_factory_destroy): unregister preferences callback.
(nautilus_icon_factory_get_theme): Removed this function.
(icon_theme_changed_callback): call set_theme when preference changes.
* libnautilus/nautilus-icon-factory.h:
(nautilus_icon_factory_get_theme),
(nautilus_icon_factory_set_theme): Removed public API. The
rare client that cares about the name of the theme should
get/set it from preferences.
* src/nautilus-window-menus.c:
(use_eazel_theme_icons_cb): get and set theme from
preferences rather than with icon factory calls.
(nautilus_bonobo_ui_handler_menu_set_toggle_appearance):
New function, sets the state of the checkbox in a bonobo
menu item without invoking the callback. Perhaps this belongs
in bonobo or in libnautilus, but I'm waiting to hear what the
bonobo folks have to say about the current behavior, which
seems broken to me.
(update_eazel_theme_menu_item): Rewritten to change the
state of the menu item without invoking the callback. This
was broken in the case where the initial state of the menu
item was backwards, which was never the case before since
it always started with Eazel theme icons off.
* libnautilus/nautilus-icon-factory.c:
(nautilus_icon_factory_initialize_class),
(nautilus_icon_factory_set_theme),
* components/history/ntl-history-view.c: (make_obj),
* src/nautilus-bookmarks-window.c:
(create_bookmarks_window),
* src/nautilus-window-menus.c:
(nautilus_window_initialize_menus),
(nautilus_window_initialize_bookmarks_menu),
(nautilus_window_initialize_go_menu),
* libnautilus/gnome-icon-container.c:
(gnome_icon_container_initialize),
* src/file-manager/fm-directory-view-list.c:
(fm_directory_view_list_initialize): Changed name of signal
emitted by icon factory from "theme_changed" to "icons_changed"
since it may be used in the future for other kinds of changes
in the available set of icons.
2000-03-15 Darin Adler <darin@eazel.com>
* HACKING: Tell people about the gnome-xml branch.
...
...
components/history/nautilus-history-view.c
View file @
0437a094
...
...
@@ -234,7 +234,7 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
gtk_signal_connect
(
GTK_OBJECT
(
clist
),
"select_row"
,
hyperbola_navigation_history_select_row
,
hview
);
gtk_signal_connect_object_while_alive
(
nautilus_icon_factory_get
(),
"
theme
_changed"
,
"
icons
_changed"
,
history_view_update_icons
,
GTK_OBJECT
(
hview
->
clist
));
...
...
components/history/ntl-history-view.c
View file @
0437a094
...
...
@@ -234,7 +234,7 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
gtk_signal_connect
(
GTK_OBJECT
(
clist
),
"select_row"
,
hyperbola_navigation_history_select_row
,
hview
);
gtk_signal_connect_object_while_alive
(
nautilus_icon_factory_get
(),
"
theme
_changed"
,
"
icons
_changed"
,
history_view_update_icons
,
GTK_OBJECT
(
hview
->
clist
));
...
...
libnautilus-extensions/gnome-icon-container.c
View file @
0437a094
...
...
@@ -1956,7 +1956,7 @@ gnome_icon_container_initialize (GnomeIconContainer *container)
/* Make sure that we find out if the theme changes. */
gtk_signal_connect_object_while_alive
(
nautilus_icon_factory_get
(),
"
theme
_changed"
,
"
icons
_changed"
,
gnome_icon_container_request_update_all
,
GTK_OBJECT
(
container
));
}
...
...
libnautilus-extensions/nautilus-global-preferences.c
View file @
0437a094
...
...
@@ -123,6 +123,13 @@ static NautilusPreferencesInfo global_preferences_static_info[] =
NAUTILUS_PREFERENCE_STRING
,
"name|size|date_modified|type"
,
NULL
},
{
NAUTILUS_PREFERENCES_ICON_THEME
,
""
,
/* No caption since not currently displayed in preferences dialog */
NAUTILUS_PREFERENCE_STRING
,
"default"
,
NULL
}
};
...
...
libnautilus-extensions/nautilus-global-preferences.h
View file @
0437a094
...
...
@@ -48,6 +48,7 @@ BEGIN_GNOME_DECLS
/* Preferences not (currently?) displayed in dialog */
#define NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ATTRIBUTE_NAMES "/nautilus/icon_view/text_attribute_names"
#define NAUTILUS_PREFERENCES_ICON_THEME "/nautilus/preferences/icon_theme"
enum
{
...
...
libnautilus-extensions/nautilus-icon-factory.c
View file @
0437a094
...
...
@@ -46,6 +46,7 @@
#include
"nautilus-metadata.h"
#include
"nautilus-lib-self-check-functions.h"
#include
"nautilus-glib-extensions.h"
#include
"nautilus-global-preferences.h"
#include
"nautilus-gtk-macros.h"
#include
"nautilus-xml-extensions.h"
...
...
@@ -146,7 +147,7 @@ typedef struct {
}
NautilusIconFactoryClass
;
enum
{
THEME
_CHANGED
,
ICONS
_CHANGED
,
LAST_SIGNAL
};
static
guint
signals
[
LAST_SIGNAL
];
...
...
@@ -179,12 +180,18 @@ typedef struct {
/* forward declarations */
static
void
icon_theme_changed_callback
(
const
GtkObject
*
prefs
,
const
gchar
*
pref_name
,
GtkFundamentalType
pref_type
,
gconstpointer
pref_value
,
gpointer
user_data
);
static
GtkType
nautilus_icon_factory_get_type
(
void
);
static
void
nautilus_icon_factory_initialize_class
(
NautilusIconFactoryClass
*
class
);
static
void
nautilus_icon_factory_initialize
(
NautilusIconFactory
*
factory
);
static
NautilusIconFactory
*
nautilus_get_current_icon_factory
(
void
);
static
char
*
nautilus_icon_factory_get_thumbnail_uri
(
NautilusFile
*
file
);
static
NautilusIconFactory
*
nautilus_icon_factory_new
(
const
char
*
theme_name
);
void
nautilus_icon_factory_set_theme
(
const
char
*
theme_name
);
static
NautilusScalableIcon
*
nautilus_scalable_icon_get
(
const
char
*
uri
,
const
char
*
name
);
static
guint
nautilus_scalable_icon_hash
(
gconstpointer
p
);
...
...
@@ -211,8 +218,21 @@ static NautilusIconFactory *
nautilus_get_current_icon_factory
(
void
)
{
static
NautilusIconFactory
*
global_icon_factory
=
NULL
;
if
(
global_icon_factory
==
NULL
)
global_icon_factory
=
nautilus_icon_factory_new
(
NULL
);
if
(
global_icon_factory
==
NULL
)
{
char
*
theme_preference
;
theme_preference
=
nautilus_preferences_get_string
(
nautilus_preferences_get_global_preferences
(),
NAUTILUS_PREFERENCES_ICON_THEME
);
global_icon_factory
=
nautilus_icon_factory_new
(
theme_preference
);
g_free
(
theme_preference
);
nautilus_preferences_add_callback
(
nautilus_preferences_get_global_preferences
(),
NAUTILUS_PREFERENCES_ICON_THEME
,
icon_theme_changed_callback
,
(
gpointer
)
global_icon_factory
);
}
return
global_icon_factory
;
}
...
...
@@ -255,8 +275,8 @@ nautilus_icon_factory_initialize_class (NautilusIconFactoryClass *class)
object_class
=
GTK_OBJECT_CLASS
(
class
);
signals
[
THEME
_CHANGED
]
=
gtk_signal_new
(
"
theme
_changed"
,
signals
[
ICONS
_CHANGED
]
=
gtk_signal_new
(
"
icons
_changed"
,
GTK_RUN_LAST
,
object_class
->
type
,
0
,
...
...
@@ -298,6 +318,11 @@ nautilus_icon_factory_clear (void)
static void
nautilus_icon_factory_destroy (NautilusIconFactory *factory)
{
nautilus_preferences_remove_callback (nautilus_preferences_get_global_preferences (),
NAUTILUS_PREFERENCES_ICON_THEME,
icon_theme_changed_callback,
(gpointer) factory);
nautilus_icon_factory_clear ();
g_hash_table_destroy (factory->icon_cache);
...
...
@@ -367,13 +392,6 @@ nautilus_icon_factory_schedule_sweep (void)
factory
);
}
/* Get the name of the current theme. */
char
*
nautilus_icon_factory_get_theme
(
void
)
{
return
g_strdup
(
nautilus_get_current_icon_factory
()
->
theme_name
);
}
/* Change the theme. */
void
nautilus_icon_factory_set_theme
(
const
char
*
theme_name
)
...
...
@@ -388,7 +406,7 @@ nautilus_icon_factory_set_theme (const char *theme_name)
factory
->
theme_name
=
g_strdup
(
theme_name
);
gtk_signal_emit
(
GTK_OBJECT
(
factory
),
signals
[
THEME
_CHANGED
]);
signals
[
ICONS
_CHANGED
]);
}
/* Use the MIME type to get the icon name. */
...
...
@@ -560,6 +578,24 @@ get_icon_file_path (const char *name, guint size_in_pixels, ArtIRect *text_rect)
text_rect
);
}
static
void
icon_theme_changed_callback
(
const
GtkObject
*
prefs
,
const
gchar
*
pref_name
,
GtkFundamentalType
pref_type
,
gconstpointer
pref_value
,
gpointer
user_data
)
{
NautilusIconFactory
*
icon_factory
;
g_assert
(
user_data
!=
NULL
);
g_assert
(
prefs
!=
NULL
);
g_assert
(
pref_name
!=
NULL
);
icon_factory
=
(
NautilusIconFactory
*
)
user_data
;
nautilus_icon_factory_set_theme
((
char
*
)
pref_value
);
}
/* Get or create a scalable icon. */
static
NautilusScalableIcon
*
nautilus_scalable_icon_get
(
const
char
*
uri
,
...
...
libnautilus-extensions/nautilus-icon-factory.h
View file @
0437a094
...
...
@@ -74,7 +74,7 @@ typedef struct NautilusScalableIcon NautilusScalableIcon;
/* Instead of a class declaration here, I will just document
* the signals.
*
* "
theme
_changed", no parameters
* "
icons
_changed", no parameters
*/
/* There's a single NautilusIconFactory object.
...
...
@@ -85,10 +85,6 @@ GtkObject * nautilus_icon_factory_get (void);
/* Relationship between zoom levels and icons sizes. */
guint
nautilus_get_icon_size_for_zoom_level
(
NautilusZoomLevel
zoom_level
);
/* Switch themes. */
char
*
nautilus_icon_factory_get_theme
(
void
);
void
nautilus_icon_factory_set_theme
(
const
char
*
theme_name
);
/* Choose the appropriate icon, but don't render it yet. */
NautilusScalableIcon
*
nautilus_icon_factory_get_icon_for_file
(
NautilusFile
*
file
);
...
...
libnautilus-private/gnome-icon-container.c
View file @
0437a094
...
...
@@ -1956,7 +1956,7 @@ gnome_icon_container_initialize (GnomeIconContainer *container)
/* Make sure that we find out if the theme changes. */
gtk_signal_connect_object_while_alive
(
nautilus_icon_factory_get
(),
"
theme
_changed"
,
"
icons
_changed"
,
gnome_icon_container_request_update_all
,
GTK_OBJECT
(
container
));
}
...
...
libnautilus-private/nautilus-global-preferences.c
View file @
0437a094
...
...
@@ -123,6 +123,13 @@ static NautilusPreferencesInfo global_preferences_static_info[] =
NAUTILUS_PREFERENCE_STRING
,
"name|size|date_modified|type"
,
NULL
},
{
NAUTILUS_PREFERENCES_ICON_THEME
,
""
,
/* No caption since not currently displayed in preferences dialog */
NAUTILUS_PREFERENCE_STRING
,
"default"
,
NULL
}
};
...
...
libnautilus-private/nautilus-global-preferences.h
View file @
0437a094
...
...
@@ -48,6 +48,7 @@ BEGIN_GNOME_DECLS
/* Preferences not (currently?) displayed in dialog */
#define NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ATTRIBUTE_NAMES "/nautilus/icon_view/text_attribute_names"
#define NAUTILUS_PREFERENCES_ICON_THEME "/nautilus/preferences/icon_theme"
enum
{
...
...
libnautilus-private/nautilus-icon-factory.c
View file @
0437a094
...
...
@@ -46,6 +46,7 @@
#include
"nautilus-metadata.h"
#include
"nautilus-lib-self-check-functions.h"
#include
"nautilus-glib-extensions.h"
#include
"nautilus-global-preferences.h"
#include
"nautilus-gtk-macros.h"
#include
"nautilus-xml-extensions.h"
...
...
@@ -146,7 +147,7 @@ typedef struct {
}
NautilusIconFactoryClass
;
enum
{
THEME
_CHANGED
,
ICONS
_CHANGED
,
LAST_SIGNAL
};
static
guint
signals
[
LAST_SIGNAL
];
...
...
@@ -179,12 +180,18 @@ typedef struct {
/* forward declarations */
static
void
icon_theme_changed_callback
(
const
GtkObject
*
prefs
,
const
gchar
*
pref_name
,
GtkFundamentalType
pref_type
,
gconstpointer
pref_value
,
gpointer
user_data
);
static
GtkType
nautilus_icon_factory_get_type
(
void
);
static
void
nautilus_icon_factory_initialize_class
(
NautilusIconFactoryClass
*
class
);
static
void
nautilus_icon_factory_initialize
(
NautilusIconFactory
*
factory
);
static
NautilusIconFactory
*
nautilus_get_current_icon_factory
(
void
);
static
char
*
nautilus_icon_factory_get_thumbnail_uri
(
NautilusFile
*
file
);
static
NautilusIconFactory
*
nautilus_icon_factory_new
(
const
char
*
theme_name
);
void
nautilus_icon_factory_set_theme
(
const
char
*
theme_name
);
static
NautilusScalableIcon
*
nautilus_scalable_icon_get
(
const
char
*
uri
,
const
char
*
name
);
static
guint
nautilus_scalable_icon_hash
(
gconstpointer
p
);
...
...
@@ -211,8 +218,21 @@ static NautilusIconFactory *
nautilus_get_current_icon_factory
(
void
)
{
static
NautilusIconFactory
*
global_icon_factory
=
NULL
;
if
(
global_icon_factory
==
NULL
)
global_icon_factory
=
nautilus_icon_factory_new
(
NULL
);
if
(
global_icon_factory
==
NULL
)
{
char
*
theme_preference
;
theme_preference
=
nautilus_preferences_get_string
(
nautilus_preferences_get_global_preferences
(),
NAUTILUS_PREFERENCES_ICON_THEME
);
global_icon_factory
=
nautilus_icon_factory_new
(
theme_preference
);
g_free
(
theme_preference
);
nautilus_preferences_add_callback
(
nautilus_preferences_get_global_preferences
(),
NAUTILUS_PREFERENCES_ICON_THEME
,
icon_theme_changed_callback
,
(
gpointer
)
global_icon_factory
);
}
return
global_icon_factory
;
}
...
...
@@ -255,8 +275,8 @@ nautilus_icon_factory_initialize_class (NautilusIconFactoryClass *class)
object_class
=
GTK_OBJECT_CLASS
(
class
);
signals
[
THEME
_CHANGED
]
=
gtk_signal_new
(
"
theme
_changed"
,
signals
[
ICONS
_CHANGED
]
=
gtk_signal_new
(
"
icons
_changed"
,
GTK_RUN_LAST
,
object_class
->
type
,
0
,
...
...
@@ -298,6 +318,11 @@ nautilus_icon_factory_clear (void)
static void
nautilus_icon_factory_destroy (NautilusIconFactory *factory)
{
nautilus_preferences_remove_callback (nautilus_preferences_get_global_preferences (),
NAUTILUS_PREFERENCES_ICON_THEME,
icon_theme_changed_callback,
(gpointer) factory);
nautilus_icon_factory_clear ();
g_hash_table_destroy (factory->icon_cache);
...
...
@@ -367,13 +392,6 @@ nautilus_icon_factory_schedule_sweep (void)
factory
);
}
/* Get the name of the current theme. */
char
*
nautilus_icon_factory_get_theme
(
void
)
{
return
g_strdup
(
nautilus_get_current_icon_factory
()
->
theme_name
);
}
/* Change the theme. */
void
nautilus_icon_factory_set_theme
(
const
char
*
theme_name
)
...
...
@@ -388,7 +406,7 @@ nautilus_icon_factory_set_theme (const char *theme_name)
factory
->
theme_name
=
g_strdup
(
theme_name
);
gtk_signal_emit
(
GTK_OBJECT
(
factory
),
signals
[
THEME
_CHANGED
]);
signals
[
ICONS
_CHANGED
]);
}
/* Use the MIME type to get the icon name. */
...
...
@@ -560,6 +578,24 @@ get_icon_file_path (const char *name, guint size_in_pixels, ArtIRect *text_rect)
text_rect
);
}
static
void
icon_theme_changed_callback
(
const
GtkObject
*
prefs
,
const
gchar
*
pref_name
,
GtkFundamentalType
pref_type
,
gconstpointer
pref_value
,
gpointer
user_data
)
{
NautilusIconFactory
*
icon_factory
;
g_assert
(
user_data
!=
NULL
);
g_assert
(
prefs
!=
NULL
);
g_assert
(
pref_name
!=
NULL
);
icon_factory
=
(
NautilusIconFactory
*
)
user_data
;
nautilus_icon_factory_set_theme
((
char
*
)
pref_value
);
}
/* Get or create a scalable icon. */
static
NautilusScalableIcon
*
nautilus_scalable_icon_get
(
const
char
*
uri
,
...
...
libnautilus-private/nautilus-icon-factory.h
View file @
0437a094
...
...
@@ -74,7 +74,7 @@ typedef struct NautilusScalableIcon NautilusScalableIcon;
/* Instead of a class declaration here, I will just document
* the signals.
*
* "
theme
_changed", no parameters
* "
icons
_changed", no parameters
*/
/* There's a single NautilusIconFactory object.
...
...
@@ -85,10 +85,6 @@ GtkObject * nautilus_icon_factory_get (void);
/* Relationship between zoom levels and icons sizes. */
guint
nautilus_get_icon_size_for_zoom_level
(
NautilusZoomLevel
zoom_level
);
/* Switch themes. */
char
*
nautilus_icon_factory_get_theme
(
void
);
void
nautilus_icon_factory_set_theme
(
const
char
*
theme_name
);
/* Choose the appropriate icon, but don't render it yet. */
NautilusScalableIcon
*
nautilus_icon_factory_get_icon_for_file
(
NautilusFile
*
file
);
...
...
libnautilus/gnome-icon-container.c
View file @
0437a094
...
...
@@ -1956,7 +1956,7 @@ gnome_icon_container_initialize (GnomeIconContainer *container)
/* Make sure that we find out if the theme changes. */
gtk_signal_connect_object_while_alive
(
nautilus_icon_factory_get
(),
"
theme
_changed"
,
"
icons
_changed"
,
gnome_icon_container_request_update_all
,
GTK_OBJECT
(
container
));
}
...
...
libnautilus/nautilus-global-preferences.c
View file @
0437a094
...
...
@@ -123,6 +123,13 @@ static NautilusPreferencesInfo global_preferences_static_info[] =
NAUTILUS_PREFERENCE_STRING
,
"name|size|date_modified|type"
,
NULL
},
{
NAUTILUS_PREFERENCES_ICON_THEME
,
""
,
/* No caption since not currently displayed in preferences dialog */
NAUTILUS_PREFERENCE_STRING
,
"default"
,
NULL
}
};
...
...
libnautilus/nautilus-global-preferences.h
View file @
0437a094
...
...
@@ -48,6 +48,7 @@ BEGIN_GNOME_DECLS
/* Preferences not (currently?) displayed in dialog */
#define NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ATTRIBUTE_NAMES "/nautilus/icon_view/text_attribute_names"
#define NAUTILUS_PREFERENCES_ICON_THEME "/nautilus/preferences/icon_theme"
enum
{
...
...
libnautilus/nautilus-icon-factory.c
View file @
0437a094
...
...
@@ -46,6 +46,7 @@
#include
"nautilus-metadata.h"
#include
"nautilus-lib-self-check-functions.h"
#include
"nautilus-glib-extensions.h"
#include
"nautilus-global-preferences.h"
#include
"nautilus-gtk-macros.h"
#include
"nautilus-xml-extensions.h"
...
...
@@ -146,7 +147,7 @@ typedef struct {
}
NautilusIconFactoryClass
;
enum
{
THEME
_CHANGED
,
ICONS
_CHANGED
,
LAST_SIGNAL
};
static
guint
signals
[
LAST_SIGNAL
];
...
...
@@ -179,12 +180,18 @@ typedef struct {
/* forward declarations */
static
void
icon_theme_changed_callback
(
const
GtkObject
*
prefs
,
const
gchar
*
pref_name
,
GtkFundamentalType
pref_type
,
gconstpointer
pref_value
,
gpointer
user_data
);
static
GtkType
nautilus_icon_factory_get_type
(
void
);
static
void
nautilus_icon_factory_initialize_class
(
NautilusIconFactoryClass
*
class
);
static
void
nautilus_icon_factory_initialize
(
NautilusIconFactory
*
factory
);
static
NautilusIconFactory
*
nautilus_get_current_icon_factory
(
void
);
static
char
*
nautilus_icon_factory_get_thumbnail_uri
(
NautilusFile
*
file
);
static
NautilusIconFactory
*
nautilus_icon_factory_new
(
const
char
*
theme_name
);
void
nautilus_icon_factory_set_theme
(
const
char
*
theme_name
);
static
NautilusScalableIcon
*
nautilus_scalable_icon_get
(
const
char
*
uri
,
const
char
*
name
);
static
guint
nautilus_scalable_icon_hash
(
gconstpointer
p
);
...
...
@@ -211,8 +218,21 @@ static NautilusIconFactory *
nautilus_get_current_icon_factory
(
void
)
{
static
NautilusIconFactory
*
global_icon_factory
=
NULL
;
if
(
global_icon_factory
==
NULL
)
global_icon_factory
=
nautilus_icon_factory_new
(
NULL
);
if
(
global_icon_factory
==
NULL
)
{
char
*
theme_preference
;
theme_preference
=
nautilus_preferences_get_string
(
nautilus_preferences_get_global_preferences
(),
NAUTILUS_PREFERENCES_ICON_THEME
);
global_icon_factory
=
nautilus_icon_factory_new
(
theme_preference
);
g_free
(
theme_preference
);
nautilus_preferences_add_callback
(
nautilus_preferences_get_global_preferences
(),
NAUTILUS_PREFERENCES_ICON_THEME
,
icon_theme_changed_callback
,
(
gpointer
)
global_icon_factory
);
}
return
global_icon_factory
;
}
...
...
@@ -255,8 +275,8 @@ nautilus_icon_factory_initialize_class (NautilusIconFactoryClass *class)
object_class
=
GTK_OBJECT_CLASS
(
class
);
signals
[
THEME
_CHANGED
]
=
gtk_signal_new
(
"
theme
_changed"
,
signals
[
ICONS
_CHANGED
]
=
gtk_signal_new
(
"
icons
_changed"
,
GTK_RUN_LAST
,
object_class
->
type
,
0
,
...
...
@@ -298,6 +318,11 @@ nautilus_icon_factory_clear (void)
static void
nautilus_icon_factory_destroy (NautilusIconFactory *factory)
{
nautilus_preferences_remove_callback (nautilus_preferences_get_global_preferences (),
NAUTILUS_PREFERENCES_ICON_THEME,
icon_theme_changed_callback,
(gpointer) factory);
nautilus_icon_factory_clear ();
g_hash_table_destroy (factory->icon_cache);
...
...
@@ -367,13 +392,6 @@ nautilus_icon_factory_schedule_sweep (void)
factory
);
}
/* Get the name of the current theme. */
char
*
nautilus_icon_factory_get_theme
(
void
)
{
return
g_strdup
(
nautilus_get_current_icon_factory
()
->
theme_name
);
}
/* Change the theme. */
void
nautilus_icon_factory_set_theme
(
const
char
*
theme_name
)
...
...
@@ -388,7 +406,7 @@ nautilus_icon_factory_set_theme (const char *theme_name)
factory
->
theme_name
=
g_strdup
(
theme_name
);
gtk_signal_emit
(
GTK_OBJECT
(
factory
),
signals
[
THEME
_CHANGED
]);
signals
[
ICONS
_CHANGED
]);
}
/* Use the MIME type to get the icon name. */
...
...
@@ -560,6 +578,24 @@ get_icon_file_path (const char *name, guint size_in_pixels, ArtIRect *text_rect)
text_rect
);
}
static
void
icon_theme_changed_callback
(
const
GtkObject
*
prefs
,
const
gchar
*
pref_name
,
GtkFundamentalType
pref_type
,
gconstpointer
pref_value
,
gpointer
user_data
)
{
NautilusIconFactory
*
icon_factory
;
g_assert
(
user_data
!=
NULL
);
g_assert
(
prefs
!=
NULL
);
g_assert
(
pref_name
!=
NULL
);
icon_factory
=
(
NautilusIconFactory
*
)
user_data
;
nautilus_icon_factory_set_theme
((
char
*
)
pref_value
);
}
/* Get or create a scalable icon. */
static
NautilusScalableIcon
*
nautilus_scalable_icon_get
(
const
char
*
uri
,
...
...
libnautilus/nautilus-icon-factory.h
View file @
0437a094
...
...
@@ -74,7 +74,7 @@ typedef struct NautilusScalableIcon NautilusScalableIcon;
/* Instead of a class declaration here, I will just document
* the signals.
*
* "
theme
_changed", no parameters
* "
icons
_changed", no parameters
*/
/* There's a single NautilusIconFactory object.
...
...
@@ -85,10 +85,6 @@ GtkObject * nautilus_icon_factory_get (void);
/* Relationship between zoom levels and icons sizes. */
guint
nautilus_get_icon_size_for_zoom_level
(
NautilusZoomLevel
zoom_level
);
/* Switch themes. */
char
*
nautilus_icon_factory_get_theme
(
void
);