* show the specific icons for the edit-window and the viewer-window.
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Fri, 7 Dec 2007 11:51:44 +0000 (11:51 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Fri, 7 Dec 2007 11:51:44 +0000 (11:51 +0000)
  problem was that hildon expect 64x54 icons (undocumented); so
  now we're scaling the icons a bit. unfortunately, the scaled icons
  look a bit blurry (GDK_INTERP_BILINEAR), so filing a bug against
  graphics to get better icons.

Fixes: NB#78366, NB#78367

pmo-trunk-r3883

src/maemo/modest-hildon-includes.h
src/maemo/modest-main-window.c
src/maemo/modest-msg-edit-window.c
src/maemo/modest-msg-view-window.c

index d92ec05..fb69e86 100644 (file)
@@ -58,7 +58,6 @@ k * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 #include <hildon/hildon-notification.h>
 #endif /*MODEST_HILDON_NOTIFY*/
 
-
 #ifdef MODEST_HAVE_HILDON0_WIDGETS
 #include <hildon-widgets/hildon-color-selector.h>
 #include <hildon-widgets/hildon-color-button.h>
@@ -70,6 +69,7 @@ k * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 #include <hildon-widgets/hildon-font-selection-dialog.h>
 #include <hildon-widgets/hildon-find-toolbar.h>
 #include <hildon-widgets/hildon-sort-dialog.h>
+#include <hildon-widgets/hildon-program.h>
 
 #else
 
@@ -86,6 +86,7 @@ k * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 #include <hildon/hildon-find-toolbar.h>
 #include <hildon/hildon-sort-dialog.h>
 #include <hildon/hildon-number-editor.h>
+#include <hildon/hildon-program.h>
 
 #endif /*__MODEST_HAVE_HILDON1_WIDGETS*/
 #endif /*__MODEST_HAVE_HILDON0_WIDGETS_*/
@@ -152,7 +153,4 @@ typedef enum
 } HildonGtkInputMode;
 #endif /* !MODEST_HAVE_HILDON_GTK */
 
-
-
-
 #endif /*__MODEST_HILDON_INCLUDES__*/
index f3c9967..e11601c 100644 (file)
 #include "modest-text-utils.h"
 #include "modest-signal-mgr.h"
 
-#ifdef MODEST_HAVE_HILDON0_WIDGETS
-#include <hildon-widgets/hildon-program.h>
-#else
-#include <hildon/hildon-program.h>
-#endif /*MODEST_HAVE_HILDON0_WIDGETS*/
-
 #define MODEST_MAIN_WINDOW_ACTION_GROUP_ADDITIONS "ModestMainWindowActionAdditions"
 
 #define XALIGN 0.5
@@ -373,10 +367,9 @@ modest_main_window_finalize (GObject *obj)
 
        /* Sanity check: shouldn't be needed, the window mgr should
           call this function before */
-       modest_main_window_disconnect_signals (MODEST_WINDOW (obj));
-
+       modest_main_window_disconnect_signals (MODEST_WINDOW (obj));    
        modest_main_window_cleanup_queue_error_signals ((ModestMainWindow *) obj);
-
+       
        g_slist_free (priv->progress_widgets);
 
        g_byte_array_free (priv->merge_ids, TRUE);
@@ -400,7 +393,7 @@ modest_main_window_finalize (GObject *obj)
                g_source_remove (priv->restore_paned_timeout);
                priv->restore_paned_timeout = 0;
        }
-
+       
        G_OBJECT_CLASS(parent_class)->finalize (obj);
 }
 
@@ -1099,6 +1092,7 @@ modest_main_window_new (void)
        ModestDimmingRulesGroup *toolbar_rules_group = NULL;
        GtkActionGroup *action_group = NULL;
        GError *error = NULL;
+       HildonProgram *app;
        ModestConf *conf = NULL;
        GtkAction *action = NULL;
        GdkPixbuf *window_icon;
@@ -1234,7 +1228,7 @@ modest_main_window_new (void)
        
        gtk_container_add (GTK_CONTAINER(self), priv->main_vbox);
        
-       HildonProgram *app = hildon_program_get_instance ();
+       app = hildon_program_get_instance ();
        hildon_program_add_window (app, HILDON_WINDOW (self));
        
        g_signal_connect (G_OBJECT(app), "notify::is-topmost",
index 4097c25..cb56ae5 100644 (file)
@@ -168,8 +168,8 @@ static void DEBUG_BUFFER (WPTextBuffer *buffer)
 {
 #ifdef DEBUG
        GtkTextIter iter;
-
        g_message ("BEGIN BUFFER OF SIZE %d", gtk_text_buffer_get_char_count (GTK_TEXT_BUFFER (buffer)));
+
        gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &iter);
        while (!gtk_text_iter_is_end (&iter)) {
                GString *output = g_string_new ("");
@@ -423,6 +423,9 @@ modest_msg_edit_window_init (ModestMsgEditWindow *obj)
        }
 
        init_window (obj);
+       
+       hildon_program_add_window (hildon_program_get_instance(),
+                                  HILDON_WINDOW(obj));
 }
 
 
@@ -740,12 +743,22 @@ init_window (ModestMsgEditWindow *obj)
        gtk_container_add (GTK_CONTAINER (frame), priv->scroll_area);
 
        /* Set window icon */
-       window_icon = modest_platform_get_icon (MODEST_APP_MSG_EDIT_ICON);
+       window_icon = modest_platform_get_icon (MODEST_APP_MSG_EDIT_ICON); 
        if (window_icon) {
-               gtk_window_set_icon (GTK_WINDOW (obj), window_icon);
+               /* scale the icon, because it won't be shown unless it's
+                * 64 x 54 -- hildon quirk. this looks a bit ugly now,
+                * so waiting for correctly sized icons, then this scaling
+                * code can disappear -- djcb
+                */
+               GdkPixbuf *scaled =
+                       gdk_pixbuf_scale_simple (window_icon, 64, 54, GDK_INTERP_BILINEAR);
+               if (scaled) {
+                       g_warning ("setting scaled icon");
+                       gtk_window_set_icon (GTK_WINDOW (obj), scaled);
+                       g_object_unref (scaled);
+               }
                g_object_unref (window_icon);
-       }
-
+       }       
 }
        
 static void
@@ -775,7 +788,7 @@ static void
 modest_msg_edit_window_finalize (GObject *obj)
 {
        ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (obj);
-
+       
        /* Sanity check: shouldn't be needed, the window mgr should
           call this function before */
        modest_msg_edit_window_disconnect_signals (MODEST_WINDOW (obj));
index 758b0ad..2da9495 100644 (file)
@@ -422,13 +422,27 @@ modest_msg_view_window_init (ModestMsgViewWindow *obj)
        
        /* Init window */
        init_window (MODEST_MSG_VIEW_WINDOW(obj));
+       
        /* Set window icon */
        window_icon = modest_platform_get_icon (MODEST_APP_MSG_VIEW_ICON); 
        if (window_icon) {
-               gtk_window_set_icon (GTK_WINDOW (obj), window_icon);
+               /* scale the icon, because it won't be shown unless it's
+                * 64 x 54 -- hildon quirk. this looks a bit ugly now,
+                * so waiting for correctly sized icons, then this scaling
+                * code can disappear -- djcb
+                */
+               GdkPixbuf *scaled =
+                       gdk_pixbuf_scale_simple (window_icon, 64, 54, GDK_INTERP_BILINEAR);
+               if (scaled) {
+                       g_warning ("setting scaled icon");
+                       gtk_window_set_icon (GTK_WINDOW (obj), scaled);
+                       g_object_unref (scaled);
+               }
                g_object_unref (window_icon);
-       }
-
+       }       
+       
+       hildon_program_add_window (hildon_program_get_instance(),
+                                  HILDON_WINDOW(obj));
 
        modest_window_mgr_register_help_id (modest_runtime_get_window_mgr(),
                                            GTK_WINDOW(obj),"applications_email_viewer");