* make the header icon hack somewhat work for maemo too
[modest] / src / maemo / modest-platform.c
index e70eb05..0542ff8 100644 (file)
@@ -30,6 +30,7 @@
 #include <config.h>
 #include <glib/gi18n.h>
 #include <modest-platform.h>
+#include <dbus_api/modest-dbus-callbacks.h>
 #include <libosso.h>
 
 #ifdef MODEST_HILDON_VERSION_0
@@ -57,6 +58,29 @@ modest_platform_init (void)
                g_printerr ("modest: failed to acquire osso context\n");
                return FALSE;
        }
+
+       /* Register our D-Bus callbacks, via the osso API: */
+       osso_return_t result = osso_rpc_set_cb_f(osso_context, 
+                               MODEST_DBUS_EXAMPLE_SERVICE, 
+                               MODEST_DBUS_EXAMPLE_OBJECT, 
+                               MODEST_DBUS_EXAMPLE_IFACE,
+                               modest_dbus_req_handler, NULL /* user_data */);
+       if (result != OSSO_OK) {
+                       g_print("Error setting D-BUS callback (%d)\n", result);
+                       return OSSO_ERROR;
+       }
+
+       /* Add handler for Exit D-BUS messages.
+        * Not used because osso_application_set_exit_cb() is deprecated and obsolete:
+       result = osso_application_set_exit_cb(osso_context,
+                                          modest_dbus_exit_event_handler,
+                                          (gpointer) NULL);
+       if (result != OSSO_OK) {
+               g_print("Error setting exit callback (%d)\n", result);
+               return OSSO_ERROR;
+       }
+       */
+
        return TRUE;
 }
 
@@ -276,15 +300,31 @@ modest_platform_get_icon (const gchar *name)
 
        g_return_val_if_fail (name, NULL);
 
+       if (g_str_has_suffix (name, ".png")) { /*FIXME: hack*/
+               pixbuf = gdk_pixbuf_new_from_file (name, &err);
+               if (!pixbuf) {
+                       g_printerr ("modest: error loading icon '%s': %s\n",
+                                   name, err->message);
+                       g_error_free (err);
+                       return NULL;
+               }
+               return pixbuf;
+       }
+
        current_theme = gtk_icon_theme_get_default ();
        pixbuf = gtk_icon_theme_load_icon (current_theme, name, 26,
                                           GTK_ICON_LOOKUP_NO_SVG,
                                           &err);
        if (!pixbuf) {
-               g_printerr ("modest: error while loading icon '%s': %s\n",
+               g_printerr ("modest: error loading theme icon '%s': %s\n",
                            name, err->message);
                g_error_free (err);
-       }
-       
+       } 
        return pixbuf;
 }
+
+const gchar*
+modest_platform_get_app_name (void)
+{
+       return _("mcen_ap_name");
+}