#include "modest-hildon-includes.h"
#include "modest-maemo-utils.h"
+#include "modest-platform.h"
/*
* For getting and tracking the Bluetooth name
ModestGetSupportedAuthInfo *info = (ModestGetSupportedAuthInfo*)user_data;
/* Operation has finished, close the dialog. Control continues after
* gtk_dialog_run in modest_maemo_utils_get_supported_secure_authentication_methods() */
- gdk_threads_enter();
+
+ /* This is a GDK lock because we are an idle callback and
+ * the code below is or does Gtk+ code */
+
+ gdk_threads_enter(); /* CHECKED */
gtk_dialog_response (GTK_DIALOG (info->dialog), GTK_RESPONSE_ACCEPT);
- gdk_threads_leave();
+ gdk_threads_leave(); /* CHECKED */
+
return FALSE;
}
ModestGetSupportedAuthInfo *info = (ModestGetSupportedAuthInfo*)user_data;
g_return_if_fail (info);
- gdk_threads_enter();
-
/* Free everything if the actual action was canceled */
if (info->cancel)
{
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);
}
tny_iterator_next(iter);
}
-
- g_object_unref(auth_types);
+ g_object_unref (iter);
modest_pair_list_free (pairs);
/* Close the dialog in a main thread */
g_idle_add(on_idle_secure_auth_finished, info);
}
-
- gdk_threads_leave();
}
static void on_secure_auth_cancel(GtkWidget* dialog, int response, gpointer user_data)
{
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));
*/
tny_account = NULL;
}
- /* TODO: Handle connection requests. */
if (!tny_account) {
g_printerr ("%s could not create tny account.", __FUNCTION__);
info->cancel = FALSE;
info->error = NULL;
info->progress = gtk_progress_bar_new();
+ /* TODO: Need logical_ID for the title: */
info->dialog = gtk_dialog_new_with_buttons(_("Authentication"),
parent_window, GTK_DIALOG_MODAL,
- GTK_STOCK_CANCEL,
+ _("mcen_bd_dialog_cancel"),
GTK_RESPONSE_REJECT,
NULL);
//gtk_window_set_default_size(GTK_WINDOW(info->dialog), 300, 100);
}
#endif
+#if 0 /* Not used now. */
+/* 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);
+}
+#endif
+
void modest_maemo_show_dialog_and_forget (GtkWindow *parent_window, GtkDialog *dialog)
{
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent_window);
gtk_widget_show (GTK_WIDGET (dialog));
}
+
+
void
modest_maemo_set_thumbable_scrollbar (GtkScrolledWindow *win, gboolean thumbable)
{