From 84cdcd49ef0d9738155c6cc810283780f5fb2d90 Mon Sep 17 00:00:00 2001 From: Andy Hertzfeld Date: Mon, 10 Jul 2000 18:14:47 +0000 Subject: made the property browser update when the theme changes; fixed bug in made the property browser update when the theme changes; fixed bug in making theme selectors, and added emblems that I forgot to add on Friday. --- ChangeLog | 19 +++++++++++++++++++ data/emblems/Makefile.am | 1 + data/emblems/personal.png | Bin 0 -> 1086 bytes icons/Makefile.am | 1 + icons/emblem-personal.svg | 12 ++++++++++++ libnautilus-extensions/nautilus-theme.c | 12 ++++++++---- libnautilus-private/nautilus-theme.c | 12 ++++++++---- src/nautilus-property-browser.c | 23 ++++++++++++++++++++--- 8 files changed, 69 insertions(+), 11 deletions(-) create mode 100644 data/emblems/personal.png create mode 100644 icons/emblem-personal.svg diff --git a/ChangeLog b/ChangeLog index cc1c4cca2..ceeac151a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2000-07-10 Andy Hertzfeld + + + * src/nautilus-property-browser.c: + (nautilus_property_browser_initialize), + (nautilus_property_browser_destroy), + (nautilus_property_browser_theme_changed), + (theme_clicked_callback): + made the property browser update itself when the theme changes + * libnautilus-extensions/nautilus-theme.c: + (nautilus_theme_make_selector): + fixed bug where we were calling g_file_exists with NULL + by testing for NULL instead of calling it at all. + * data/emblems/Makefile.am: + * data/emblems/personal.png: + * icons/Makefile.am: + * icons/emblem-personal.svg: + added the emblems that I tried to on Friday but forgot to cvsadd + 2000-07-10 Ramiro Estrugo * diff --git a/data/emblems/Makefile.am b/data/emblems/Makefile.am index cec2978b8..fb8f14739 100644 --- a/data/emblems/Makefile.am +++ b/data/emblems/Makefile.am @@ -11,6 +11,7 @@ emblems_DATA = \ favorite.png \ important.gif \ new.gif \ + personal.png \ remote.gif \ $(NULL) diff --git a/data/emblems/personal.png b/data/emblems/personal.png new file mode 100644 index 000000000..74d23c53f Binary files /dev/null and b/data/emblems/personal.png differ diff --git a/icons/Makefile.am b/icons/Makefile.am index 3e25978f1..3304d11de 100644 --- a/icons/Makefile.am +++ b/icons/Makefile.am @@ -24,6 +24,7 @@ icon_DATA =\ emblem-new.gif \ emblem-noread.png \ emblem-nowrite.png \ + emblem-personal.svg \ emblem-remote.gif \ emblem-symbolic-link.png \ emblems.png \ diff --git a/icons/emblem-personal.svg b/icons/emblem-personal.svg new file mode 100644 index 000000000..8d1601740 --- /dev/null +++ b/icons/emblem-personal.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/libnautilus-extensions/nautilus-theme.c b/libnautilus-extensions/nautilus-theme.c index 2857a7c8e..9e6af656e 100644 --- a/libnautilus-extensions/nautilus-theme.c +++ b/libnautilus-extensions/nautilus-theme.c @@ -182,17 +182,21 @@ nautilus_theme_make_selector (const char *theme_name) pixbuf_file = nautilus_pixmap_file(temp_str); g_free (temp_str); - if (!g_file_exists (pixbuf_file)) { - g_free (pixbuf_file); + if (pixbuf_file == NULL) { temp_str = g_strdup_printf ("%s/%s", theme_name, "i-directory.svg"); pixbuf_file = nautilus_pixmap_file(temp_str); g_free (temp_str); - if (!g_file_exists (pixbuf_file)) { - g_free (pixbuf_file); + if (pixbuf_file == NULL) { pixbuf_file = nautilus_pixmap_file ("i-directory.png"); } } + /* if we can't find anything, return NULL */ + if (pixbuf_file == NULL) { + return NULL; + } + + /* load the icon that we found and return it */ if (nautilus_str_has_suffix(pixbuf_file, ".svg")) { FILE *f = fopen (pixbuf_file, "rb"); if (f != NULL) { diff --git a/libnautilus-private/nautilus-theme.c b/libnautilus-private/nautilus-theme.c index 2857a7c8e..9e6af656e 100644 --- a/libnautilus-private/nautilus-theme.c +++ b/libnautilus-private/nautilus-theme.c @@ -182,17 +182,21 @@ nautilus_theme_make_selector (const char *theme_name) pixbuf_file = nautilus_pixmap_file(temp_str); g_free (temp_str); - if (!g_file_exists (pixbuf_file)) { - g_free (pixbuf_file); + if (pixbuf_file == NULL) { temp_str = g_strdup_printf ("%s/%s", theme_name, "i-directory.svg"); pixbuf_file = nautilus_pixmap_file(temp_str); g_free (temp_str); - if (!g_file_exists (pixbuf_file)) { - g_free (pixbuf_file); + if (pixbuf_file == NULL) { pixbuf_file = nautilus_pixmap_file ("i-directory.png"); } } + /* if we can't find anything, return NULL */ + if (pixbuf_file == NULL) { + return NULL; + } + + /* load the icon that we found and return it */ if (nautilus_str_has_suffix(pixbuf_file, ".svg")) { FILE *f = fopen (pixbuf_file, "rb"); if (f != NULL) { diff --git a/src/nautilus-property-browser.c b/src/nautilus-property-browser.c index a260bb485..e8f13ffa6 100644 --- a/src/nautilus-property-browser.c +++ b/src/nautilus-property-browser.c @@ -112,6 +112,7 @@ static void nautilus_property_browser_drag_data_get (GtkWidget GtkSelectionData *selection_data, guint info, guint32 time); +static void nautilus_property_browser_theme_changed (gpointer user_data); /* misc utilities */ static char *strip_extension (const char *string_to_strip); @@ -278,6 +279,11 @@ nautilus_property_browser_initialize (GtkObject *object) (NautilusPreferencesCallback) nautilus_property_browser_preferences_changed, property_browser); + /* add a callback for when the theme changes */ + nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_THEME, + nautilus_property_browser_theme_changed, + property_browser); + /* initially, display the top level */ nautilus_property_browser_set_path(property_browser, BROWSER_CATEGORIES_FILE_NAME); } @@ -299,6 +305,9 @@ nautilus_property_browser_destroy (GtkObject *object) nautilus_preferences_remove_callback(NAUTILUS_PREFERENCES_CAN_ADD_CONTENT, (NautilusPreferencesCallback) nautilus_property_browser_preferences_changed, NULL); + nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, + nautilus_property_browser_theme_changed, + property_browser); NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object)); } @@ -1433,14 +1442,22 @@ make_properties_from_xml_node (NautilusPropertyBrowser *property_browser, xmlNod } } +/* handle theme changes by updating the browser contents */ + +static void +nautilus_property_browser_theme_changed (gpointer user_data) +{ + NautilusPropertyBrowser *property_browser; + + property_browser = NAUTILUS_PROPERTY_BROWSER(user_data); + nautilus_property_browser_update_contents (property_browser); +} + /* handle clicks on the theme selector by setting the theme */ static void theme_clicked_callback(GtkWidget *widget, char *theme_name) { - NautilusPropertyBrowser *property_browser = NAUTILUS_PROPERTY_BROWSER(gtk_object_get_user_data(GTK_OBJECT(widget))); - nautilus_theme_set_theme (theme_name); - nautilus_property_browser_update_contents (property_browser); } static gboolean -- cgit v1.2.1