X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmaemo%2Fmodest-maemo-utils.c;h=5ac6bb5ea503ce0e20157cd8cf854beaaea84e00;hb=8102dae163b20cc022c109d99a8c98be39a51fc4;hp=be36a17083e7c0779901ea842964cbe47e5bc082;hpb=47b04b1e03f3599c7c77b5040baf7ad58aa3802b;p=modest diff --git a/src/maemo/modest-maemo-utils.c b/src/maemo/modest-maemo-utils.c index be36a17..5ac6bb5 100644 --- a/src/maemo/modest-maemo-utils.c +++ b/src/maemo/modest-maemo-utils.c @@ -45,6 +45,7 @@ #include "modest-hildon-includes.h" #include "modest-maemo-utils.h" +#include "modest-platform.h" /* * For getting and tracking the Bluetooth name @@ -203,6 +204,11 @@ modest_maemo_utils_get_device_name (void) gboolean modest_maemo_utils_folder_writable (const gchar *filename) { + g_return_val_if_fail (filename, FALSE); + + if (!filename) + return FALSE; + if (g_strncasecmp (filename, "obex", 4) != 0) { GnomeVFSFileInfo folder_info; gchar *folder; @@ -324,7 +330,14 @@ on_camel_account_get_supported_secure_authentication ( GList *result = NULL; TnyIterator* iter = tny_list_create_iterator(auth_types); while (!tny_iterator_is_done(iter)) { - const gchar *auth_name = tny_pair_get_name(TNY_PAIR(tny_iterator_get_current(iter))); + TnyPair *pair = TNY_PAIR(tny_iterator_get_current(iter)); + const gchar *auth_name = NULL; + if (pair) { + auth_name = tny_pair_get_name(pair); + g_object_unref (pair); + pair = NULL; + } + printf("DEBUG: %s: auth_name=%s\n", __FUNCTION__, auth_name); ModestPair *matching = modest_pair_list_find_by_first_as_string (pairs, auth_name); @@ -368,6 +381,10 @@ GList* modest_maemo_utils_get_supported_secure_authentication_methods (ModestTra { g_return_val_if_fail (proto != MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN, NULL); + /* We need a connection to get the capabilities; */ + if (!modest_platform_connect_and_wait (GTK_WINDOW (parent_window), NULL)) + return NULL; + /* result = g_list_append (result, GINT_TO_POINTER (MODEST_PROTOCOL_AUTH_CRAMMD5)); */ @@ -390,7 +407,6 @@ GList* modest_maemo_utils_get_supported_secure_authentication_methods (ModestTra tny_account = NULL; } - /* TODO: Handle connection requests. */ if (!tny_account) { g_printerr ("%s could not create tny account.", __FUNCTION__); @@ -534,6 +550,35 @@ on_hide (GtkDialog *dialog, gpointer user_data) } #endif +/* user_data for the idle callback: */ +typedef struct +{ + GtkWindow *parent_window; + gchar *message; +} ModestIdleNoteInfo; + +static gboolean +on_idle_show_information(gpointer user_data) +{ + ModestIdleNoteInfo *info = (ModestIdleNoteInfo*)user_data; + + modest_maemo_show_information_note_and_forget (info->parent_window, info->message); + + g_free (info->message); + g_slice_free (ModestIdleNoteInfo, info); + + return FALSE; /* Don't call this again. */ +} + +void modest_maemo_show_information_note_in_main_context_and_forget (GtkWindow *parent_window, const gchar* message) +{ + ModestIdleNoteInfo *info = g_slice_new (ModestIdleNoteInfo); + info->parent_window = parent_window; + info->message = g_strdup (message); + + g_idle_add (on_idle_show_information, info); +} + void modest_maemo_show_dialog_and_forget (GtkWindow *parent_window, GtkDialog *dialog) { gtk_window_set_transient_for (GTK_WINDOW (dialog), parent_window); @@ -543,6 +588,8 @@ void modest_maemo_show_dialog_and_forget (GtkWindow *parent_window, GtkDialog *d gtk_widget_show (GTK_WIDGET (dialog)); } + + void modest_maemo_set_thumbable_scrollbar (GtkScrolledWindow *win, gboolean thumbable) { @@ -552,3 +599,25 @@ modest_maemo_set_thumbable_scrollbar (GtkScrolledWindow *win, gboolean thumbable #endif /* MODEST_HAVE_HILDON1_WIDGETS */ } +void +modest_maemo_toggle_action_set_active_block_notify (GtkToggleAction *action, gboolean value) +{ + GSList *proxies = NULL; + + g_return_if_fail (GTK_IS_TOGGLE_ACTION (action)); + + for (proxies = gtk_action_get_proxies (GTK_ACTION (action)); + proxies != NULL; proxies = g_slist_next (proxies)) { + GtkWidget *widget = (GtkWidget *) proxies->data; + gtk_action_block_activate_from (GTK_ACTION (action), widget); + } + + gtk_toggle_action_set_active (action, value); + + for (proxies = gtk_action_get_proxies (GTK_ACTION (action)); + proxies != NULL; proxies = g_slist_next (proxies)) { + GtkWidget *widget = (GtkWidget *) proxies->data; + gtk_action_unblock_activate_from (GTK_ACTION (action), widget); + } + +}