modest-error.h \
modest-formatter.c \
modest-formatter.h \
- modest-icon-factory.c\
- modest-icon-factory.h\
modest-local-folder-info.c \
modest-local-folder-info.h \
modest-mail-operation-queue.c \
#include <modest-edit-msg-window.h>
#include <modest-widget-memory.h>
#include <widgets/modest-edit-msg-window-ui.h>
-#include <modest-icon-factory.h>
#include <modest-account-mgr-helpers.h>
static void modest_edit_msg_window_class_init (ModestEditMsgWindowClass *klass);
restore_settings (MODEST_EDIT_MSG_WINDOW(obj));
gtk_window_set_title (GTK_WINDOW(obj), "Modest");
- gtk_window_set_icon (GTK_WINDOW(obj),
- modest_icon_factory_get_icon (MODEST_APP_ICON));
+ gtk_window_set_icon_from_file (GTK_WINDOW(obj), MODEST_APP_ICON, NULL);
g_signal_connect (G_OBJECT(obj), "delete-event",
G_CALLBACK(on_delete_event), obj);
#ifndef __MODEST_ICON_NAMES_H__
#define __MODEST_ICON_NAMES_H__
+
/* icons */
-#define MODEST_APP_ICON PIXMAP_PREFIX "modest.png"
+#define MODEST_APP_ICON PIXMAP_PREFIX "modest-icon.png"
#define MODEST_HEADER_ICON_READ PIXMAP_PREFIX "qgn_list_messagin_mail.png"
#define MODEST_HEADER_ICON_UNREAD PIXMAP_PREFIX "qgn_list_messagin_mail_unread.png"
#include "modest-main-window.h"
#include "modest-window-priv.h"
#include "modest-widget-memory.h"
-#include "modest-icon-factory.h"
#include "modest-ui.h"
#include "modest-main-window-ui.h"
#include "modest-account-view-window.h"
restore_sizes (MODEST_MAIN_WINDOW(obj));
gtk_window_set_title (GTK_WINDOW(obj), _("Modest"));
- gtk_window_set_icon (GTK_WINDOW(obj),
- modest_icon_factory_get_icon (MODEST_APP_ICON));
+ gtk_window_set_icon_from_file (GTK_WINDOW(obj), MODEST_APP_ICON, NULL);
gtk_widget_show_all (main_vbox);
g_signal_connect (G_OBJECT(obj), "delete-event",
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-/* modest-icon-factory.c */
-
-#include <modest-icon-factory.h>
-#include <modest-runtime.h>
-
-GdkPixbuf*
-modest_icon_factory_get_icon (const gchar *name)
-{
- GError *err = NULL;
- GdkPixbuf *pixbuf;
- gpointer orig_key;
- static GHashTable *icon_cache = NULL;
-
- g_return_val_if_fail (name, NULL);
-
- if (G_UNLIKELY(!icon_cache))
- icon_cache = modest_cache_mgr_get_cache (modest_runtime_get_cache_mgr(),
- MODEST_CACHE_MGR_CACHE_TYPE_PIXBUF);
-
- if (!icon_cache || !g_hash_table_lookup_extended (icon_cache, name, &orig_key,(gpointer*)&pixbuf)) {
- pixbuf = gdk_pixbuf_new_from_file (name, &err);
- if (!pixbuf) {
- g_printerr ("modest: error in icon factory while loading '%s': %s\n",
- name, err->message);
- g_error_free (err);
- }
- /* if we cannot find it, we still insert (if we have a cache), so we get the error
- * only once */
- if (icon_cache)
- g_hash_table_insert (icon_cache, g_strdup(name),(gpointer)pixbuf);
- }
- return pixbuf;
-}
-
-
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-/* modest-icon-factory.h */
-
-#ifndef __MODEST_ICON_FACTORY_H__
-#define __MODEST_ICON_FACTORY_H__
-
-#include <gdk/gdkpixbuf.h>
-
-/**
- * modest_icon_factory_get_icon:
- * @name: the filename of a certain icon
- *
- * Returns: a GdkPixBuf for this icon, or NULL in case of error
- * You should NOT unref or modify the pixbuf in any way
- */
-GdkPixbuf* modest_icon_factory_get_icon (const gchar *name);
-
-#endif /*__MODEST_ICON_FACTORY_H__ */
#include <modest-runtime.h>
#include <modest-defs.h>
#include <modest-ui.h>
-#include <modest-icon-factory.h>
#include <modest-tny-account-store.h>
#include <modest-tny-platform-factory.h>
#include <modest-mail-operation.h>
g_return_val_if_fail (account_name, MODEST_ERR_SEND);
account_mgr = modest_runtime_get_account_mgr ();
- account = modest_account_mgr_get_tny_account (account_mgr, account_name,
- TNY_ACCOUNT_TYPE_TRANSPORT);
+ account = TNY_TRANSPORT_ACCOUNT(modest_account_mgr_get_tny_account (account_mgr, account_name,
+ TNY_ACCOUNT_TYPE_TRANSPORT));
if (!account) {
g_printerr ("modest: no transport defined account for %s\n",
account_name);
#include <modest-tny-folder.h>
#include <modest-marshal.h>
#include <modest-icon-names.h>
-#include <modest-icon-factory.h>
#include <modest-tny-account-store.h>
#include <modest-text-utils.h>
-
+#include <modest-runtime.h>
#include "modest-folder-view.h"
/* 'private'/'protected' functions */
}
+static GdkPixbuf*
+get_cached_icon (const gchar *name)
+{
+ GError *err = NULL;
+ GdkPixbuf *pixbuf;
+ gpointer orig_key;
+ static GHashTable *icon_cache = NULL;
+
+ g_return_val_if_fail (name, NULL);
+
+ if (G_UNLIKELY(!icon_cache))
+ icon_cache = modest_cache_mgr_get_cache (modest_runtime_get_cache_mgr(),
+ MODEST_CACHE_MGR_CACHE_TYPE_PIXBUF);
+
+ if (!icon_cache || !g_hash_table_lookup_extended (icon_cache, name, &orig_key,(gpointer*)&pixbuf)) {
+ pixbuf = gdk_pixbuf_new_from_file (name, &err);
+ if (!pixbuf) {
+ g_printerr ("modest: error in icon factory while loading '%s': %s\n",
+ name, err->message);
+ g_error_free (err);
+ }
+ /* if we cannot find it, we still insert (if we have a cache), so we get the error
+ * only once */
+ if (icon_cache)
+ g_hash_table_insert (icon_cache, g_strdup(name),(gpointer)pixbuf);
+ }
+ return pixbuf;
+}
+
static void
icon_cell_data (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
switch (type) {
case TNY_FOLDER_TYPE_ROOT:
- pixbuf = modest_icon_factory_get_icon (MODEST_FOLDER_ICON_ACCOUNT);
+ pixbuf = get_cached_icon (MODEST_FOLDER_ICON_ACCOUNT);
break;
case TNY_FOLDER_TYPE_INBOX:
- pixbuf = modest_icon_factory_get_icon (MODEST_FOLDER_ICON_INBOX);
+ pixbuf = get_cached_icon (MODEST_FOLDER_ICON_INBOX);
break;
case TNY_FOLDER_TYPE_OUTBOX:
- pixbuf = modest_icon_factory_get_icon (MODEST_FOLDER_ICON_OUTBOX);
+ pixbuf = get_cached_icon (MODEST_FOLDER_ICON_OUTBOX);
break;
case TNY_FOLDER_TYPE_JUNK:
- pixbuf = modest_icon_factory_get_icon (MODEST_FOLDER_ICON_JUNK);
+ pixbuf = get_cached_icon (MODEST_FOLDER_ICON_JUNK);
break;
case TNY_FOLDER_TYPE_SENT:
- pixbuf = modest_icon_factory_get_icon (MODEST_FOLDER_ICON_SENT);
+ pixbuf = get_cached_icon (MODEST_FOLDER_ICON_SENT);
break;
case TNY_FOLDER_TYPE_TRASH:
- pixbuf = modest_icon_factory_get_icon (MODEST_FOLDER_ICON_TRASH);
+ pixbuf = get_cached_icon (MODEST_FOLDER_ICON_TRASH);
break;
case TNY_FOLDER_TYPE_DRAFTS:
- pixbuf = modest_icon_factory_get_icon (MODEST_FOLDER_ICON_DRAFTS);
+ pixbuf = get_cached_icon (MODEST_FOLDER_ICON_DRAFTS);
break;
case TNY_FOLDER_TYPE_NOTES:
- pixbuf = modest_icon_factory_get_icon (MODEST_FOLDER_ICON_NOTES);
+ pixbuf = get_cached_icon (MODEST_FOLDER_ICON_NOTES);
break;
case TNY_FOLDER_TYPE_CALENDAR:
- pixbuf = modest_icon_factory_get_icon (MODEST_FOLDER_ICON_CALENDAR);
+ pixbuf = get_cached_icon (MODEST_FOLDER_ICON_CALENDAR);
break;
case TNY_FOLDER_TYPE_CONTACTS:
- pixbuf = modest_icon_factory_get_icon (MODEST_FOLDER_ICON_CONTACTS);
+ pixbuf = get_cached_icon (MODEST_FOLDER_ICON_CONTACTS);
break;
case TNY_FOLDER_TYPE_NORMAL:
default:
- pixbuf = modest_icon_factory_get_icon (MODEST_FOLDER_ICON_NORMAL);
+ pixbuf = get_cached_icon (MODEST_FOLDER_ICON_NORMAL);
break;
}
g_object_set (rendobj, "pixbuf", pixbuf, NULL);
#include <modest-header-view.h>
#include <modest-header-view-priv.h>
#include <modest-icon-names.h>
-#include <modest-icon-factory.h>
#include <modest-text-utils.h>
+#include <modest-runtime.h>
#include <glib/gi18n.h>
+static GdkPixbuf*
+get_cached_icon (const gchar *name)
+{
+ GError *err = NULL;
+ GdkPixbuf *pixbuf;
+ gpointer orig_key;
+ static GHashTable *icon_cache = NULL;
+
+ g_return_val_if_fail (name, NULL);
+
+ if (G_UNLIKELY(!icon_cache))
+ icon_cache = modest_cache_mgr_get_cache (modest_runtime_get_cache_mgr(),
+ MODEST_CACHE_MGR_CACHE_TYPE_PIXBUF);
+
+ if (!icon_cache || !g_hash_table_lookup_extended (icon_cache, name, &orig_key,(gpointer*)&pixbuf)) {
+ pixbuf = gdk_pixbuf_new_from_file (name, &err);
+ if (!pixbuf) {
+ g_printerr ("modest: error in icon factory while loading '%s': %s\n",
+ name, err->message);
+ g_error_free (err);
+ }
+ /* if we cannot find it, we still insert (if we have a cache), so we get the error
+ * only once */
+ if (icon_cache)
+ g_hash_table_insert (icon_cache, g_strdup(name),(gpointer)pixbuf);
+ }
+ return pixbuf;
+}
+
+
/*
* optimization
switch (flag) {
case TNY_HEADER_FLAG_DELETED:
if (G_UNLIKELY(!deleted_pixbuf))
- deleted_pixbuf = modest_icon_factory_get_icon (MODEST_HEADER_ICON_DELETED);
+ deleted_pixbuf = get_cached_icon (MODEST_HEADER_ICON_DELETED);
return deleted_pixbuf;
case TNY_HEADER_FLAG_SEEN:
if (G_UNLIKELY(!seen_pixbuf))
- seen_pixbuf = modest_icon_factory_get_icon (MODEST_HEADER_ICON_READ);
+ seen_pixbuf = get_cached_icon (MODEST_HEADER_ICON_READ);
return seen_pixbuf;
case TNY_HEADER_FLAG_ATTACHMENTS:
if (G_UNLIKELY(!attachments_pixbuf))
- attachments_pixbuf = modest_icon_factory_get_icon (MODEST_HEADER_ICON_ATTACH);
+ attachments_pixbuf = get_cached_icon (MODEST_HEADER_ICON_ATTACH);
return attachments_pixbuf;
default:
if (G_UNLIKELY(!unread_pixbuf))
- unread_pixbuf = modest_icon_factory_get_icon (MODEST_HEADER_ICON_UNREAD);
+ unread_pixbuf = get_cached_icon (MODEST_HEADER_ICON_UNREAD);
return unread_pixbuf;
}
}
#include <modest-marshal.h>
#include <modest-text-utils.h>
#include <modest-icon-names.h>
-#include <modest-icon-factory.h>
static void modest_header_view_class_init (ModestHeaderViewClass *klass);
static void modest_header_view_init (ModestHeaderView *obj);