From 9b8a6860948ad7cd5d1c6a24360e4b59fc120fb2 Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Mon, 19 Apr 2004 15:17:54 +0000 Subject: Change component icons to use the icon theme names for icons Remove 2004-04-19 Michael Terry * GNOME_Evolution_Test.server.in.in: Change component icons to use the icon theme names for icons * Makefile.am: Remove e-icon-factory.[ch] * e-component-registry.c: Use the icon theme for component icons * e-icon-factory.[ch]: Removed these files * e-shell-importer.c: * e-shell-settings-dialog.c: * e-shell-startup-wizard.c: * e-shell-window-commands.c: * e-user-creatable-items-handler.c: * evolution-shell-component-utils.[ch]: * main.c: * glade/evolution-startup-wizard.glade: * importer/import.glade: Use the icon theme via EIconFactory for all of the icons in the shell, and the window icons svn path=/trunk/; revision=25512 --- shell/ChangeLog | 18 ++++ shell/GNOME_Evolution_Test.server.in.in | 4 +- shell/Makefile.am | 2 - shell/e-component-registry.c | 5 +- shell/e-icon-factory.c | 162 ----------------------------- shell/e-icon-factory.h | 33 ------ shell/e-shell-importer.c | 10 ++ shell/e-shell-settings-dialog.c | 8 +- shell/e-shell-startup-wizard.c | 12 ++- shell/e-shell-window-commands.c | 14 +-- shell/e-user-creatable-items-handler.c | 6 +- shell/evolution-shell-component-utils.c | 23 ++-- shell/evolution-shell-component-utils.h | 7 +- shell/glade/evolution-startup-wizard.glade | 2 - shell/importer/import.glade | 4 - shell/main.c | 11 +- 16 files changed, 73 insertions(+), 248 deletions(-) delete mode 100644 shell/e-icon-factory.c delete mode 100644 shell/e-icon-factory.h (limited to 'shell') diff --git a/shell/ChangeLog b/shell/ChangeLog index a15b3dfcca..ac5e388a7a 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,21 @@ +2004-04-19 Michael Terry + + * GNOME_Evolution_Test.server.in.in: Change component icons to use the + icon theme names for icons + * Makefile.am: Remove e-icon-factory.[ch] + * e-component-registry.c: Use the icon theme for component icons + * e-icon-factory.[ch]: Removed these files + * e-shell-importer.c: + * e-shell-settings-dialog.c: + * e-shell-startup-wizard.c: + * e-shell-window-commands.c: + * e-user-creatable-items-handler.c: + * evolution-shell-component-utils.[ch]: + * main.c: + * glade/evolution-startup-wizard.glade: + * importer/import.glade: Use the icon theme via EIconFactory for all + of the icons in the shell, and the window icons + 2004-04-14 JP Rosevear * e-shell-importer.c (get_iid_for_filetype): differentiate between diff --git a/shell/GNOME_Evolution_Test.server.in.in b/shell/GNOME_Evolution_Test.server.in.in index f0ed1d086a..cbd5187f62 100644 --- a/shell/GNOME_Evolution_Test.server.in.in +++ b/shell/GNOME_Evolution_Test.server.in.in @@ -29,9 +29,9 @@ - + - + diff --git a/shell/Makefile.am b/shell/Makefile.am index 6ade83a734..e8a459b4d5 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -101,7 +101,6 @@ eshellincludedir = $(privincludedir)/shell eshellinclude_HEADERS = \ Evolution.h \ - e-icon-factory.h \ e-shell-corba-icon-utils.h \ e-shell-utils.h \ e-user-creatable-items-handler.h \ @@ -112,7 +111,6 @@ eshellinclude_HEADERS = \ libeshell_la_SOURCES = \ $(IDL_GENERATED) \ $(MARSHAL_GENERATED) \ - e-icon-factory.c \ e-shell-corba-icon-utils.c \ e-shell-utils.c \ e-user-creatable-items-handler.c \ diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c index 40568485b1..855ec1c350 100644 --- a/shell/e-component-registry.c +++ b/shell/e-component-registry.c @@ -27,7 +27,7 @@ #include "e-component-registry.h" #include "e-shell-utils.h" - +#include #include "e-util/e-lang-utils.h" #include @@ -173,8 +173,7 @@ query_components (EComponentRegistry *registry) if (icon_name == NULL) { icon = NULL; } else { - char *full_path = e_shell_get_icon_path (icon_name, TRUE); - icon = gdk_pixbuf_new_from_file (full_path, NULL); + icon = e_icon_factory_get_icon (icon_name, 24); } sort_order_string = bonobo_server_info_prop_lookup (& info_list->_buffer[i], diff --git a/shell/e-icon-factory.c b/shell/e-icon-factory.c deleted file mode 100644 index c0fceafc42..0000000000 --- a/shell/e-icon-factory.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-icon-factory.c - Icon factory for the Evolution shell. - * - * Copyright (C) 2002 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "e-icon-factory.h" - -#include "e-shell-constants.h" - - -/* One icon. Keep both a small (16x16) and a large (48x48) version around. */ -struct _Icon { - char *name; - GdkPixbuf *small_pixbuf; - GdkPixbuf *large_pixbuf; -}; -typedef struct _Icon Icon; - -/* Hash of all the icons. */ -static GHashTable *name_to_icon = NULL; - - -/* Creating and destroying icons. */ - -static Icon * -icon_new (const char *name, - GdkPixbuf *small_pixbuf, - GdkPixbuf *large_pixbuf) -{ - Icon *icon; - - icon = g_new (Icon, 1); - icon->name = g_strdup (name); - icon->small_pixbuf = small_pixbuf; - icon->large_pixbuf = large_pixbuf; - - if (small_pixbuf != NULL) - g_object_ref (small_pixbuf); - if (large_pixbuf != NULL) - g_object_ref (large_pixbuf); - - return icon; -} - -#if 0 - -/* (This is not currently used since we never prune icons out of the - cache.) */ -static void -icon_free (Icon *icon) -{ - g_free (icon->name); - - if (icon->large_pixbuf != NULL) - g_object_unref (icon->large_pixbuf); - if (icon->small_pixbuf != NULL) - g_object_unref (icon->small_pixbuf); - - g_free (icon); -} - -#endif - - -/* Loading icons. */ - -static Icon * -load_icon (const char *icon_name) -{ - GdkPixbuf *small_pixbuf; - GdkPixbuf *large_pixbuf; - Icon *icon; - char *path; - - path = g_strconcat (EVOLUTION_IMAGES, "/", icon_name, "-mini.png", NULL); - small_pixbuf = gdk_pixbuf_new_from_file (path, NULL); - g_free (path); - - path = g_strconcat (EVOLUTION_IMAGES, "/", icon_name, ".png", NULL); - large_pixbuf = gdk_pixbuf_new_from_file (path, NULL); - g_free (path); - - if (large_pixbuf == NULL || small_pixbuf == NULL) - return NULL; - - icon = icon_new (icon_name, small_pixbuf, large_pixbuf); - - g_object_unref (small_pixbuf); - g_object_unref (large_pixbuf); - - return icon; -} - - -/* Public API. */ - -void -e_icon_factory_init (void) -{ - if (name_to_icon != NULL) { - /* Already initialized. */ - return; - } - - name_to_icon = g_hash_table_new (g_str_hash, g_str_equal); -} - -GdkPixbuf * -e_icon_factory_get_icon (const char *icon_name, - gboolean mini) -{ - Icon *icon; - - g_return_val_if_fail (icon_name != NULL, NULL); - - icon = g_hash_table_lookup (name_to_icon, icon_name); - if (icon == NULL) { - icon = load_icon (icon_name); - if (icon == NULL) { - g_warning ("Icon not found -- %s", icon_name); - - /* Create an empty icon so that we don't keep spitting - out the same warning over and over, every time this - icon is requested. */ - - icon = icon_new (icon_name, NULL, NULL); - g_hash_table_insert (name_to_icon, icon->name, icon); - return NULL; - } - - g_hash_table_insert (name_to_icon, icon->name, icon); - } - - if (mini) { - g_object_ref (icon->small_pixbuf); - return icon->small_pixbuf; - } else { - g_object_ref (icon->large_pixbuf); - return icon->large_pixbuf; - } -} diff --git a/shell/e-icon-factory.h b/shell/e-icon-factory.h deleted file mode 100644 index 072cd4e222..0000000000 --- a/shell/e-icon-factory.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-icon-factory.h - Icon factory for the Evolution shell. - * - * Copyright (C) 2002 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_ICON_FACTORY_H_ -#define _E_ICON_FACTORY_H_ - -#include - -void e_icon_factory_init (void); - -GdkPixbuf *e_icon_factory_get_icon (const char *icon_name, - gboolean mini); - -#endif /* _E_ICON_FACTORY_H_ */ diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index 18268cc004..d167ad36e8 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -1141,10 +1141,13 @@ e_shell_importer_start_import (EShellWindow *shell_window) ImportData *data = g_new0 (ImportData, 1); GtkWidget *html; static gboolean dialog_open = FALSE; + GdkPixbuf *icon; if (dialog_open) { return; } + + icon = e_icon_factory_get_icon ("stock_import", 48); dialog_open = TRUE; data->window = shell_window; @@ -1166,9 +1169,11 @@ e_shell_importer_start_import (EShellWindow *shell_window) /* Start page */ data->start = GNOME_DRUID_PAGE_EDGE (glade_xml_get_widget (data->wizard, "page0")); + gnome_druid_page_edge_set_logo (data->start, icon); /* Intelligent or direct import page */ data->typedialog = glade_xml_get_widget (data->wizard, "page1"); + gnome_druid_page_standard_set_logo (data->typedialog, icon); g_signal_connect (data->typedialog, "next", G_CALLBACK (next_type_page), data); data->typepage = importer_type_page_new (data); @@ -1180,6 +1185,7 @@ e_shell_importer_start_import (EShellWindow *shell_window) /* Intelligent importer source page */ data->intelligent = glade_xml_get_widget (data->wizard, "page2-intelligent"); + gnome_druid_page_standard_set_logo (data->intelligent, icon); g_signal_connect (data->intelligent, "back", G_CALLBACK (back_intelligent_page), data); g_signal_connect_after (data->intelligent, "prepare", @@ -1195,10 +1201,12 @@ e_shell_importer_start_import (EShellWindow *shell_window) /* File selection and file type page */ data->filedialog = glade_xml_get_widget (data->wizard, "page2-file"); + gnome_druid_page_standard_set_logo (data->filedialog, icon); g_signal_connect_after (data->filedialog, "prepare", G_CALLBACK (prepare_file_page), data); g_signal_connect (data->filedialog, "next", G_CALLBACK (next_file_page), data); + gnome_druid_page_edge_set_logo (data->finish, icon); data->filepage = importer_file_page_new (data); html = create_help ("file_html"); @@ -1228,5 +1236,7 @@ e_shell_importer_start_import (EShellWindow *shell_window) g_object_weak_ref ((GObject *)data->dialog, import_druid_weak_notify, data); + g_object_unref (icon); + gtk_widget_show_all (data->dialog); } diff --git a/shell/e-shell-settings-dialog.c b/shell/e-shell-settings-dialog.c index c96049e10d..a34b7c4843 100644 --- a/shell/e-shell-settings-dialog.c +++ b/shell/e-shell-settings-dialog.c @@ -28,7 +28,7 @@ #include "e-shell-settings-dialog.h" #include "e-corba-config-page.h" - +#include #include "e-util/e-lang-utils.h" #include @@ -204,11 +204,7 @@ load_pages (EShellSettingsDialog *dialog) if (g_path_is_absolute (icon_path)) { icon = gdk_pixbuf_new_from_file (icon_path, NULL); } else { - char *real_icon_path; - - real_icon_path = g_build_filename (EVOLUTION_IMAGES, icon_path, NULL); - icon = gdk_pixbuf_new_from_file (real_icon_path, NULL); - g_free (real_icon_path); + icon = e_icon_factory_get_icon (icon_path, 48); } } diff --git a/shell/e-shell-startup-wizard.c b/shell/e-shell-startup-wizard.c index 0bd93acddb..984a83df40 100644 --- a/shell/e-shell-startup-wizard.c +++ b/shell/e-shell-startup-wizard.c @@ -31,7 +31,7 @@ #include "e-timezone-dialog/e-timezone-dialog.h" #include "e-util/e-gtk-utils.h" - +#include #include #include @@ -493,6 +493,7 @@ make_timezone_page (SWData *data) { TimezoneDialogPage *page; ETimezoneDialog *etd; + GdkPixbuf *pixbuf; g_return_val_if_fail (data != NULL, NULL); @@ -500,6 +501,10 @@ make_timezone_page (SWData *data) page->page = glade_xml_get_widget (data->wizard, "timezone-page"); g_return_val_if_fail (page->page != NULL, NULL); + pixbuf = e_icon_factory_get_icon ("stock_timezone", 48); + gnome_druid_page_standard_set_logo (GNOME_DRUID_PAGE_STANDARD (page->page), pixbuf); + g_object_unref (pixbuf); + g_signal_connect_after (page->page, "prepare", G_CALLBACK (prepare_timezone_page), data); page->vbox = GTK_WIDGET (GNOME_DRUID_PAGE_STANDARD (page->page)->vbox); @@ -723,6 +728,7 @@ make_importer_page (SWData *data) { ImportDialogPage *page; GtkWidget *label, *sep; + GdkPixbuf *pixbuf; g_return_val_if_fail (data != NULL, NULL); @@ -730,6 +736,10 @@ make_importer_page (SWData *data) page->page = glade_xml_get_widget (data->wizard, "import-page"); g_return_val_if_fail (page->page != NULL, NULL); + pixbuf = e_icon_factory_get_icon ("stock_mail-import", 48); + gnome_druid_page_standard_set_logo (GNOME_DRUID_PAGE_STANDARD (page->page), pixbuf); + g_object_unref (pixbuf); + g_signal_connect_after (page->page, "prepare", G_CALLBACK (prepare_importer_page), data); page->vbox = GNOME_DRUID_PAGE_STANDARD (page->page)->vbox; diff --git a/shell/e-shell-window-commands.c b/shell/e-shell-window-commands.c index 39f6390b68..6d9dc6c224 100644 --- a/shell/e-shell-window-commands.c +++ b/shell/e-shell-window-commands.c @@ -345,22 +345,22 @@ static BonoboUIVerb help_verbs [] = { }; static EPixmap pixmaps [] = { - E_PIXMAP ("/commands/SendReceive", "send-receive.xpm"), - E_PIXMAP ("/Toolbar/SendReceive", "buttons/send-24-receive.png"), - E_PIXMAP ("/menu/File/FileImporter", "import.xpm"), - E_PIXMAP ("/menu/File/ToggleOffline", "work_offline.xpm"), - E_PIXMAP ("/menu/Tools/Settings", "settings-16.png"), + E_PIXMAP ("/commands/SendReceive", "stock_mail-send-receive", 16), + E_PIXMAP ("/Toolbar/SendReceive", "stock_mail-send-receive", 24), + E_PIXMAP ("/menu/File/FileImporter", "stock_mail-import", 16), + E_PIXMAP ("/menu/File/ToggleOffline", "stock_disconnect", 16), + E_PIXMAP ("/menu/Tools/Settings", "gnome-settings", 16), E_PIXMAP_END }; static EPixmap offline_pixmaps [] = { - E_PIXMAP ("/menu/File/ToggleOffline", "work_offline.xpm"), + E_PIXMAP ("/menu/File/ToggleOffline", "stock_disconnect", 16), E_PIXMAP_END }; static EPixmap online_pixmaps [] = { - E_PIXMAP ("/menu/File/ToggleOffline", "work_online-16.png"), + E_PIXMAP ("/menu/File/ToggleOffline", "stock_connect", 16), E_PIXMAP_END }; diff --git a/shell/e-user-creatable-items-handler.c b/shell/e-user-creatable-items-handler.c index 2de8832ecd..f1e08d36b3 100644 --- a/shell/e-user-creatable-items-handler.c +++ b/shell/e-user-creatable-items-handler.c @@ -25,7 +25,7 @@ #endif #include "e-user-creatable-items-handler.h" - +#include #include "e-shell-utils.h" #include "Evolution.h" @@ -267,9 +267,7 @@ ensure_menu_items (EUserCreatableItemsHandler *handler) if (corba_item->iconName == "") { item->icon = NULL; } else { - char *icon_path = e_shell_get_icon_path (corba_item->iconName, TRUE); - item->icon = gdk_pixbuf_new_from_file (icon_path, NULL); - g_free (icon_path); + item->icon = e_icon_factory_get_icon (corba_item->iconName, 16); } if (corba_item->type == GNOME_Evolution_CREATABLE_OBJECT) diff --git a/shell/evolution-shell-component-utils.c b/shell/evolution-shell-component-utils.c index 935b0f9973..08db23731c 100644 --- a/shell/evolution-shell-component-utils.c +++ b/shell/evolution-shell-component-utils.c @@ -24,7 +24,7 @@ #endif #include "evolution-shell-component-utils.h" - +#include #include "e-util/e-dialog-utils.h" #include @@ -53,23 +53,14 @@ void e_pixmaps_update (BonoboUIComponent *uic, EPixmap *pixcache) for (i = 0; pixcache [i].path; i++) { if (!pixcache [i].pixbuf) { - char *path; GdkPixbuf *pixbuf; - path = g_build_filename (EVOLUTION_IMAGES, pixcache [i].fname, NULL); - - pixbuf = gdk_pixbuf_new_from_file (path, NULL); - if (pixbuf == NULL) { - g_warning ("Cannot load image -- %s", path); - } else { - pixcache [i].pixbuf = bonobo_ui_util_pixbuf_to_xml (pixbuf); - g_object_unref (pixbuf); - bonobo_ui_component_set_prop (uic, - pixcache [i].path, "pixname", - pixcache [i].pixbuf, NULL); - } - - g_free (path); + pixbuf = e_icon_factory_get_icon (pixcache [i].name, pixcache [i].size); + pixcache [i].pixbuf = bonobo_ui_util_pixbuf_to_xml (pixbuf); + g_object_unref (pixbuf); + bonobo_ui_component_set_prop (uic, + pixcache [i].path, "pixname", + pixcache [i].pixbuf, NULL); } else { bonobo_ui_component_set_prop (uic, pixcache [i].path, "pixname", diff --git a/shell/evolution-shell-component-utils.h b/shell/evolution-shell-component-utils.h index 5aceab64c7..a1890fe4ef 100644 --- a/shell/evolution-shell-component-utils.h +++ b/shell/evolution-shell-component-utils.h @@ -31,12 +31,13 @@ extern "C" { typedef struct _EPixmap { const char *path; - const char *fname; + const char *name; + gint size; char *pixbuf; } EPixmap; -#define E_PIXMAP(path,fname) { (path), (fname), NULL } -#define E_PIXMAP_END { NULL, NULL, NULL } +#define E_PIXMAP(path,name,size) { (path), (name), (size), NULL } +#define E_PIXMAP_END { NULL, NULL, 0, NULL } /* Takes an array of pixmaps, terminated by E_PIXMAP_END, and loads into uic */ void e_pixmaps_update (BonoboUIComponent *uic, EPixmap *pixcache); diff --git a/shell/glade/evolution-startup-wizard.glade b/shell/glade/evolution-startup-wizard.glade index 7314c5ce33..7b5ff163c9 100644 --- a/shell/glade/evolution-startup-wizard.glade +++ b/shell/glade/evolution-startup-wizard.glade @@ -36,7 +36,6 @@ Please click the "Forward" button to continue. True Timezone - timezone-48.png @@ -57,7 +56,6 @@ Please click the "Forward" button to continue. True Importing Files - import.png diff --git a/shell/importer/import.glade b/shell/importer/import.glade index eee31bccdb..8af6884822 100644 --- a/shell/importer/import.glade +++ b/shell/importer/import.glade @@ -33,7 +33,6 @@ importing external files into Evolution. True Importer Type - import.png @@ -54,7 +53,6 @@ importing external files into Evolution. True Select a File - import.png @@ -75,7 +73,6 @@ importing external files into Evolution. True Import Location - import.png @@ -96,7 +93,6 @@ importing external files into Evolution. True Select Importers - import.png diff --git a/shell/main.c b/shell/main.c index 4b8c535b80..ccc3040d05 100644 --- a/shell/main.c +++ b/shell/main.c @@ -28,7 +28,7 @@ #include "e-util/e-gtk-utils.h" #include "e-util/e-bconf-map.h" -#include "e-icon-factory.h" +#include #include "e-shell-constants.h" #include "e-shell.h" @@ -55,7 +55,6 @@ #include #include #include -#include #include #include @@ -521,6 +520,7 @@ main (int argc, char **argv) poptContext popt_context; const char **args; char *evolution_directory; + GList *icon_list; /* Make ElectricFence work. */ free (malloc (10)); @@ -571,7 +571,12 @@ main (int argc, char **argv) e_cursors_init (); e_icon_factory_init (); - gnome_window_icon_set_default_from_file (EVOLUTION_IMAGES "/evolution-inbox.png"); + icon_list = e_icon_factory_get_icon_list ("stock_mail"); + if (icon_list) { + gtk_window_set_default_icon_list (icon_list); + g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); + g_list_free (icon_list); + } /* FIXME We shouldn't be using the old directory at all I think */ evolution_directory = g_build_filename (g_get_home_dir (), "evolution", NULL); -- cgit v1.2.3