The dimming manager now runs dispose over the rules groups in dispose method to break...
[modest] / src / hildon2 / modest-maemo-utils.c
index 573c78f..51c25fc 100644 (file)
@@ -57,6 +57,9 @@
 /* Label child of a captioned */
 #define CAPTIONED_LABEL_CHILD "captioned-label"
 
+#ifdef MODEST_PLATFORM_MAEMO
+#define INTERNAL_MMC_USB_MODE  "/system/osso/af/internal-mmc-used-over-usb"
+#endif
 
 static osso_context_t *__osso_context = NULL; /* urgh global */
 
@@ -64,18 +67,12 @@ osso_context_t *
 modest_maemo_utils_get_osso_context (void)
 {
        if (!__osso_context) 
-               g_debug ("%s: __osso_context == NULL", __FUNCTION__);
+               __osso_context = osso_initialize(PACKAGE,PACKAGE_VERSION,
+                                                FALSE, NULL);
 
        return __osso_context;
 }
 
-void
-modest_maemo_utils_set_osso_context (osso_context_t *osso_context)
-{
-       g_return_if_fail (osso_context);
-       __osso_context = osso_context;
-}
-
 static void
 get_properties_cb (DBusMessage *message)
 {
@@ -199,7 +196,10 @@ modest_maemo_utils_get_device_name (void)
                get_default_adapter_cb (conn, msg);
                dbus_message_unref (msg);
        }
+
        dbus_message_unref (request);
+       if (dbus_error_is_set (&error))
+               dbus_error_free (&error);
 }
 
 void
@@ -570,3 +570,11 @@ modest_maemo_utils_select_attachments (GtkWindow *window, TnyList *att_list, gbo
 
        return result;
 }
+
+#ifdef MODEST_PLATFORM_MAEMO
+gboolean
+modest_maemo_utils_in_usb_mode ()
+{
+       return modest_conf_get_bool (modest_runtime_get_conf (), INTERNAL_MMC_USB_MODE, NULL);
+}
+#endif