* all:
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Thu, 1 Feb 2007 23:13:17 +0000 (23:13 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Thu, 1 Feb 2007 23:13:17 +0000 (23:13 +0000)
- remove modest-icon-factory
- added funky modest-icon to gtk frontend

pmo-trunk-r780

src/Makefile.am
src/gtk/modest-edit-msg-window.c
src/gtk/modest-icon-names.h
src/gtk/modest-main-window.c
src/gtk/pixmaps/modest-icon.png [new file with mode: 0644]
src/modest-icon-factory.c [deleted file]
src/modest-icon-factory.h [deleted file]
src/modest-main.c
src/widgets/modest-folder-view.c
src/widgets/modest-header-view-render.c
src/widgets/modest-header-view.c

index aa07f53..6372c3c 100644 (file)
@@ -44,8 +44,6 @@ modest_SOURCES=\
        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 \
index 518b54a..1261ab4 100644 (file)
@@ -37,7 +37,6 @@
 #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);
@@ -267,8 +266,7 @@ modest_edit_msg_window_new (ModestEditType type)
        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);
index dfe88c1..0ec18d8 100644 (file)
 #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"
index aed39e4..4c0e806 100644 (file)
@@ -34,7 +34,6 @@
 #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"
@@ -370,8 +369,7 @@ modest_main_window_new (void)
        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",
diff --git a/src/gtk/pixmaps/modest-icon.png b/src/gtk/pixmaps/modest-icon.png
new file mode 100644 (file)
index 0000000..5d18b49
Binary files /dev/null and b/src/gtk/pixmaps/modest-icon.png differ
diff --git a/src/modest-icon-factory.c b/src/modest-icon-factory.c
deleted file mode 100644 (file)
index 764da6c..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/* 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;
-}
-
-
diff --git a/src/modest-icon-factory.h b/src/modest-icon-factory.h
deleted file mode 100644 (file)
index d1d7308..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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__ */
index 05ebd48..bb9d856 100644 (file)
@@ -42,7 +42,6 @@
 #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>
@@ -206,8 +205,8 @@ send_mail (const gchar* account_name,
        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);
index 1fa5510..0e7204f 100644 (file)
 #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 */
@@ -191,6 +190,35 @@ text_cell_data  (GtkTreeViewColumn *column,  GtkCellRenderer *renderer,
 }
 
 
+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,
@@ -216,38 +244,38 @@ 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);
index ede4458..f4292a5 100644 (file)
 #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
@@ -51,19 +81,19 @@ get_pixbuf_for_flag (TnyHeaderFlags flag)
        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;
        }
 }
index ee25180..35b9def 100644 (file)
@@ -38,7 +38,6 @@
 #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);