X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmaemo%2Fmodest-platform.c;h=2881ffbce146c563ffe08326fade334e5c815948;hp=a566b5ecd5bfa81fedb59f86f7f60b33887977fe;hb=38d749525e49d48344543d54c7f60c044c347c3f;hpb=9e7a8200addbb69e0d34b8787e802bca2e01afcb diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index a566b5e..2881ffb 100644 --- a/src/maemo/modest-platform.c +++ b/src/maemo/modest-platform.c @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #ifdef MODEST_HAVE_MCE @@ -350,7 +350,7 @@ modest_platform_activate_file (const gchar *path, const gchar *mime_type) if (result != 1) result = hildon_mime_open_file (con, uri_path); if (result != 1) - modest_platform_run_information_dialog (NULL, _("mcen_ni_noregistered_viewer")); + modest_platform_run_information_dialog (NULL, _("mcen_ni_noregistered_viewer"), FALSE); return result != 1; } @@ -838,7 +838,8 @@ modest_platform_run_folder_name_dialog (GtkWindow *parent_window, else gtk_entry_set_text (GTK_ENTRY (entry), _("mcen_ia_default_folder_name")); gtk_entry_set_width_chars (GTK_ENTRY (entry), - g_utf8_strlen (gtk_entry_get_text (GTK_ENTRY (entry)), -1)); + MAX (g_utf8_strlen (gtk_entry_get_text (GTK_ENTRY (entry)), -1), + g_utf8_strlen (_("mcen_ia_default_folder_name"), -1))); gtk_entry_select_region (GTK_ENTRY (entry), 0, -1); /* Connect to the response method to avoid closing the dialog @@ -861,15 +862,19 @@ modest_platform_run_folder_name_dialog (GtkWindow *parent_window, /* Create the hbox */ hbox = gtk_hbox_new (FALSE, 12); gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0); /* Add hbox to dialog */ gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); - + gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox)); gtk_window_set_transient_for (GTK_WINDOW (dialog), parent_window); - + + /* Some locales like pt_BR need this to get the full window + title shown */ + gtk_widget_set_size_request (GTK_WIDGET (dialog), 300, -1); + result = gtk_dialog_run (GTK_DIALOG(dialog)); if (result == GTK_RESPONSE_ACCEPT) *folder_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry))); @@ -1038,7 +1043,8 @@ modest_platform_run_yes_no_dialog (GtkWindow *parent_window, void modest_platform_run_information_dialog (GtkWindow *parent_window, - const gchar *message) + const gchar *message, + gboolean block) { GtkWidget *note; @@ -1046,15 +1052,22 @@ modest_platform_run_information_dialog (GtkWindow *parent_window, modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (note)); - g_signal_connect_swapped (note, - "response", - G_CALLBACK (on_destroy_dialog), - note); - - gtk_widget_show_all (note); -} + if (block) { + gtk_dialog_run (GTK_DIALOG (note)); + + on_destroy_dialog (GTK_DIALOG (note)); + while (gtk_events_pending ()) + gtk_main_iteration (); + } else { + g_signal_connect_swapped (note, + "response", + G_CALLBACK (on_destroy_dialog), + note); + gtk_widget_show_all (note); + } +} typedef struct _ConnectAndWaitData { GMutex *mutex; @@ -1888,7 +1901,7 @@ modest_platform_run_alert_dialog (const gchar* prompt, } else { /* Just show the error text and use the default response: */ modest_platform_run_information_dialog (GTK_WINDOW (main_win), - prompt); + prompt, FALSE); } return retval; } @@ -2208,3 +2221,38 @@ modest_platform_get_account_settings_wizard () return GTK_WIDGET (dialog); } + +ModestConnectedVia +modest_platform_get_current_connection (void) +{ + TnyDevice *device = NULL; + ModestConnectedVia retval = MODEST_CONNECTED_VIA_ANY; + + device = modest_runtime_get_device (); + + if (!tny_device_is_online (device)) + return MODEST_CONNECTED_VIA_ANY; + +#ifdef MODEST_HAVE_CONIC + /* Get iap id */ + const gchar *iap_id = tny_maemo_conic_device_get_current_iap_id (TNY_MAEMO_CONIC_DEVICE (device)); + if (iap_id) { + ConIcIap *iap = tny_maemo_conic_device_get_iap ( + TNY_MAEMO_CONIC_DEVICE (device), iap_id); + const gchar *bearer_type = con_ic_iap_get_bearer_type (iap); + if (bearer_type) { + if (!strcmp (bearer_type, CON_IC_BEARER_WLAN_INFRA) || + !strcmp (bearer_type, CON_IC_BEARER_WLAN_ADHOC) || + !strcmp (bearer_type, "WIMAX")) { + retval = MODEST_CONNECTED_VIA_WLAN_OR_WIMAX; + } else { + retval = MODEST_CONNECTED_VIA_ANY; + } + } + g_object_unref (iap); + } +#else + retval = MODEST_CONNECTED_VIA_WLAN_OR_WIMAX; /* assume WLAN (fast) internet */ +#endif /* MODEST_HAVE_CONIC */ + return retval; +}