aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog7
-rw-r--r--shell/e-shell-view.c69
-rw-r--r--shell/main.c4
3 files changed, 80 insertions, 0 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index b4925467c7..bd72de6e43 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,10 @@
+2000-05-10 Christopher James Lahey <clahey@helixcode.com>
+
+ * e-shell-view.c: Set the icons when changing between components.
+
+ * main.c: Set the default icon. (The change in e-shell-view.c
+ doesn't work unless we do this.)
+
2000-05-09 Matt Loper <matt@helixcode.com>
* e-shell-view-menu.c (command_run_bugbuddy): New function; allows
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 922d5c301c..b5d77ed5c4 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -30,6 +30,7 @@
#include <gnome.h>
#include <bonobo.h>
+#include <libgnomeui/gnome-window-icon.h>
#include "e-shell.h"
#include "e-shortcuts-view.h"
@@ -397,6 +398,72 @@ get_control_for_uri (EShellView *shell_view,
return control;
}
+static const char *
+get_storage_set_path_from_uri (const char *uri)
+{
+ const char *colon;
+
+ if (g_path_is_absolute (uri))
+ return NULL;
+
+ colon = strchr (uri, ':');
+ if (colon == NULL || colon == uri || colon[1] == '\0')
+ return NULL;
+
+ if (! g_path_is_absolute (colon + 1))
+ return NULL;
+
+ if (g_strncasecmp (uri, "evolution", colon - uri) != 0)
+ return NULL;
+
+ return colon + 1;
+}
+
+static void
+set_icon (EShellView *shell_view,
+ const char *uri)
+{
+ EShellViewPrivate *priv;
+ EStorageSet *storage_set;
+ EFolderTypeRepository *folder_type_repository;
+ EFolder *folder;
+ const char *type;
+ const char *icon_name;
+ char *icon_path;
+
+ priv = shell_view->priv;
+
+ storage_set = e_shell_get_storage_set (priv->shell);
+ folder_type_repository = e_shell_get_folder_type_repository (priv->shell);
+
+ folder = e_storage_set_get_folder (storage_set,
+ get_storage_set_path_from_uri (uri));
+
+ if (folder == NULL)
+ return;
+
+ type = e_folder_get_type_string (folder);
+ if (type == NULL)
+ return;
+
+ icon_name = e_folder_type_repository_get_icon_for_type (folder_type_repository, type);
+ if (icon_name == NULL)
+ return;
+
+ if (g_path_is_absolute (icon_name))
+ icon_path = g_strdup (icon_name);
+ else {
+ icon_path = gnome_pixmap_file (icon_name);
+ if (icon_path == NULL)
+ icon_path = g_concat_dir_and_file (EVOLUTION_IMAGES, icon_name);
+ }
+
+ if (icon_path == NULL)
+ return;
+
+ gnome_window_icon_set_from_file (GTK_WINDOW(shell_view), icon_path);
+}
+
static gboolean
show_existing_view (EShellView *shell_view,
const char *uri,
@@ -436,6 +503,7 @@ show_existing_view (EShellView *shell_view,
}
set_current_notebook_page (shell_view, notebook_page);
+ set_icon(shell_view, uri);
return TRUE;
}
@@ -463,6 +531,7 @@ create_new_view_for_uri (EShellView *shell_view,
page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->notebook), control);
g_assert (page_num != -1);
set_current_notebook_page (shell_view, page_num);
+ set_icon(shell_view, uri);
g_hash_table_insert (priv->uri_to_control, g_strdup (uri), control);
diff --git a/shell/main.c b/shell/main.c
index 1cb31909c5..27c1fc8400 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -23,6 +23,7 @@
#include <gnome.h>
#include <bonobo.h>
+#include <libgnomeui/gnome-window-icon.h>
#include "e-util/e-gui-utils.h"
#include "e-setup.h"
@@ -102,6 +103,9 @@ main (int argc, char **argv)
init_corba (&argc, argv);
+ gnome_window_icon_set_default_from_file (EVOLUTION_IMAGES "/evolution-inbox.png");
+
+
if (! bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) {
e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Cannot initialize the Bonobo component system."));