aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog12
-rw-r--r--shell/Makefile.am2
-rw-r--r--shell/e-shell-view-menu.c2
-rw-r--r--shell/evolution-shell-component-utils.c87
-rw-r--r--shell/evolution-shell-component-utils.h48
5 files changed, 150 insertions, 1 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 313b49fb04..ff745719d2 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,15 @@
+2001-05-27 Dan Winship <danw@ximian.com>
+
+ * evolution-shell-component-utils.c: New file.
+ (e_pixmaps_update): Moved here from e-util to break e-util bonobo
+ dependency.
+
+ * e-shell-view-menu.c: #include
+ "evolution-shell-component-utils.h" instead of "e-gui-utils.h"
+
+ * Makefile.am (libeshell_la_SOURCES, eshellinclude_HEADERS): Add
+ evolution-shell-component-utils.[ch]
+
2001-05-26 Dan Winship <danw@ximian.com>
* e-storage-set-view.c (destroy): Don't free the hash keys in
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 2b9ba7a20e..2dcbcb2496 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -61,6 +61,7 @@ eshellinclude_HEADERS = \
evolution-shell-component-client.h \
evolution-shell-component.h \
evolution-shell-component-dnd.h \
+ evolution-shell-component-utils.h \
evolution-shell-view.h \
evolution-storage-listener.h \
evolution-storage-set-view-listener.h \
@@ -75,6 +76,7 @@ libeshell_la_SOURCES = \
evolution-shell-component-client.c \
evolution-shell-component.c \
evolution-shell-component-dnd.c \
+ evolution-shell-component-utils.c \
evolution-shell-view.c \
evolution-storage-listener.c \
evolution-storage-set-view-listener.c \
diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c
index eb9059330b..de0dfbca1a 100644
--- a/shell/e-shell-view-menu.c
+++ b/shell/e-shell-view-menu.c
@@ -51,7 +51,7 @@
#include "e-shell-folder-commands.h"
-#include "e-util/e-gui-utils.h"
+#include "evolution-shell-component-utils.h"
const char *authors[] = {
diff --git a/shell/evolution-shell-component-utils.c b/shell/evolution-shell-component-utils.c
new file mode 100644
index 0000000000..5e3504352f
--- /dev/null
+++ b/shell/evolution-shell-component-utils.c
@@ -0,0 +1,87 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* evolution-shell-component-utils.c
+ *
+ * Copyright (C) 2000, 2001 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "evolution-shell-component-utils.h"
+
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-util.h>
+#include <bonobo/bonobo-ui-util.h>
+
+static void free_pixmaps (void);
+static GSList *inited_arrays = NULL;
+
+void e_pixmaps_update (BonoboUIComponent *uic, EPixmap *pixcache)
+{
+ static int done_init = 0;
+ int i;
+
+ if (!done_init) {
+ g_atexit (free_pixmaps);
+ done_init = 1;
+ }
+
+ if (g_slist_find (inited_arrays, pixcache) == NULL)
+ inited_arrays = g_slist_prepend (inited_arrays, pixcache);
+
+ for (i = 0; pixcache [i].path; i++) {
+ if (!pixcache [i].pixbuf) {
+ char *path;
+ GdkPixbuf *pixbuf;
+
+ path = g_concat_dir_and_file (EVOLUTION_IMAGES,
+ pixcache [i].fname);
+
+ pixbuf = gdk_pixbuf_new_from_file (path);
+ if (pixbuf == NULL) {
+ g_warning ("Cannot load image -- %s", path);
+ } else {
+ pixcache [i].pixbuf = bonobo_ui_util_pixbuf_to_xml (pixbuf);
+ gdk_pixbuf_unref (pixbuf);
+ }
+
+ g_free (path);
+ }
+ bonobo_ui_component_set_prop (uic, pixcache [i].path,
+ "pixname", pixcache [i].pixbuf,
+ NULL);
+ }
+}
+
+static void
+free_pixmaps (void)
+{
+ int i;
+ GSList *li;
+
+ for (li = inited_arrays; li != NULL; li = li->next) {
+ EPixmap *pixcache = li->data;
+ for (i = 0; pixcache [i].path; i++)
+ g_free (pixcache [i].pixbuf);
+ }
+
+ g_slist_free (inited_arrays);
+}
+
diff --git a/shell/evolution-shell-component-utils.h b/shell/evolution-shell-component-utils.h
new file mode 100644
index 0000000000..4cf021ca64
--- /dev/null
+++ b/shell/evolution-shell-component-utils.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* evolution-shell-component-utils.h
+ *
+ * Copyright (C) 2000, 2001 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * 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.
+ */
+
+#ifndef __EVOLUTION_SHELL_COMPONENT_UTILS_H__
+#define __EVOLUTION_SHELL_COMPONENT_UTILS_H__
+
+#include <bonobo/bonobo-ui-component.h>
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+typedef struct _EPixmap {
+ const char *path;
+ const char *fname;
+ char *pixbuf;
+} EPixmap;
+
+#define E_PIXMAP(path,fname) { (path), (fname), NULL }
+#define E_PIXMAP_END { NULL, NULL, NULL }
+
+/* Takes an array of pixmaps, terminated by E_PIXMAP_END, and loads into uic */
+void e_pixmaps_update (BonoboUIComponent *uic, EPixmap *pixcache);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __EVOLUTION_SHELL_COMPONENT_UTILS_H__ */