X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmaemo%2Fmodest-platform.c;h=43245599130037830382a66cdf2dddf95d8d0dc3;hb=2be048f015649fda1a62eb609eee223fa0ef7b0d;hp=44271d5a95cd48f13df19f99e57703608c0a9cbf;hpb=f82ebf3c3924cf7030e44436f0ab16bf042ed938;p=modest diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index 44271d5..4324559 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 @@ -837,6 +837,9 @@ modest_platform_run_folder_name_dialog (GtkWindow *parent_window, gtk_entry_set_text (GTK_ENTRY (entry), suggested_name); else gtk_entry_set_text (GTK_ENTRY (entry), _("mcen_ia_default_folder_name")); + gtk_entry_set_width_chars (GTK_ENTRY (entry), + 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 @@ -859,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))); @@ -886,7 +893,7 @@ modest_platform_run_new_folder_dialog (GtkWindow *parent_window, gchar *suggested_name, gchar **folder_name) { - gchar *real_suggested_name = NULL; + gchar *real_suggested_name = NULL, *tmp = NULL; gint result; if(suggested_name == NULL) @@ -922,12 +929,15 @@ modest_platform_run_new_folder_dialog (GtkWindow *parent_window, real_suggested_name = suggested_name; } + tmp = g_strconcat (_("mcen_fi_new_folder_name"), ":", NULL); result = modest_platform_run_folder_name_dialog (parent_window, parent_folder, _("mcen_ti_new_folder"), - _("mcen_fi_new_folder_name"), + tmp, real_suggested_name, folder_name); + g_free (tmp); + if (suggested_name == NULL) g_free(real_suggested_name); @@ -1297,8 +1307,9 @@ modest_platform_set_update_interval (guint minutes) * Also use ALARM_EVENT_ACTIVATION so that modest is started (without UI) to get emails * This is why we want to use the Alarm API instead of just g_timeout_add(). * (The old maemo email-client did this, though it isn't specified in the UI spec.) + * ALARM_EVENT_CONNECTED will prevent the alarm from being called in case that the device is offline */ - event->flags = ALARM_EVENT_NO_DIALOG | ALARM_EVENT_ACTIVATION; + event->flags = ALARM_EVENT_NO_DIALOG | ALARM_EVENT_ACTIVATION | ALARM_EVENT_CONNECTED; alarm_cookie = alarm_event_add (event); @@ -1786,7 +1797,7 @@ static void on_cert_dialog_response (GtkDialog *dialog, gint response_id, const gchar* cert) { /* GTK_RESPONSE_HELP means we need to show the certificate */ - if (response_id == GTK_RESPONSE_HELP) { + if (response_id == GTK_RESPONSE_APPLY) { GtkWidget *note; gchar *msg; @@ -1823,11 +1834,15 @@ modest_platform_run_certificate_confirmation_dialog (const gchar* server_name, gchar *question = g_strdup_printf (_("mcen_nc_unknown_certificate"), server_name); + /* We use GTK_RESPONSE_APPLY because we want the button in the + middle of OK and CANCEL the same as the browser does for + example. With GTK_RESPONSE_HELP the view button is aligned + to the left while the other two to the right */ note = hildon_note_new_confirmation_add_buttons ( GTK_WINDOW(main_win), question, _("mcen_bd_dialog_ok"), GTK_RESPONSE_OK, - _("mcen_bd_view"), GTK_RESPONSE_HELP, /* abusing this... */ + _("mcen_bd_view"), GTK_RESPONSE_APPLY, /* abusing this... */ _("mcen_bd_dialog_cancel"), GTK_RESPONSE_CANCEL, NULL, NULL); @@ -2198,3 +2213,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; +}