if (prev_row_reference != NULL)
gtk_tree_row_reference_free (prev_row_reference);
if (prev_path != NULL)
- gtk_tree_path_free (prev_path);
+ gtk_tree_path_free (prev_path);
}
/* Update toolbar dimming state */
ModestMainWindow *main_window)
{
TnyList *headers;
+ GtkWidget *open_widget;
g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
if (modest_platform_check_memory_low (MODEST_WINDOW(main_window)))
return;
+ modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (main_window));
+ open_widget = modest_window_get_action_widget (MODEST_WINDOW (main_window), "/MenuBar/EmailMenu/EmailOpenMenu");
+ if (!GTK_WIDGET_IS_SENSITIVE (open_widget))
+ return;
/* headers = tny_simple_list_new (); */
/* tny_list_prepend (headers, G_OBJECT (header)); */
}
+typedef struct _PasswordDialogFields {
+ GtkWidget *username;
+ GtkWidget *password;
+ GtkWidget *dialog;
+} PasswordDialogFields;
+
+static void
+password_dialog_check_field (GtkEditable *editable,
+ PasswordDialogFields *fields)
+{
+ const gchar *value;
+ gboolean any_value_empty = FALSE;
+
+ value = gtk_entry_get_text (GTK_ENTRY (fields->username));
+ if ((value == NULL) || value[0] == '\0') {
+ any_value_empty = TRUE;
+ }
+ value = gtk_entry_get_text (GTK_ENTRY (fields->password));
+ if ((value == NULL) || value[0] == '\0') {
+ any_value_empty = TRUE;
+ }
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (fields->dialog), GTK_RESPONSE_ACCEPT, !any_value_empty);
+}
+
void
modest_ui_actions_on_password_requested (TnyAccountStore *account_store,
const gchar* server_account_name,
{
g_return_if_fail(server_account_name);
gboolean completed = FALSE;
+ PasswordDialogFields *fields = NULL;
/* Initalize output parameters: */
if (cancel)
gtk_entry_set_text (GTK_ENTRY (entry_username), initial_username);
/* Dim this if a connection has ever succeeded with this username,
* as per the UI spec: */
- const gboolean username_known =
- modest_account_mgr_get_server_account_username_has_succeeded(
- modest_runtime_get_account_mgr(), server_account_name);
- gtk_widget_set_sensitive (entry_username, !username_known);
-
+ /* const gboolean username_known = */
+ /* modest_account_mgr_get_server_account_username_has_succeeded( */
+ /* modest_runtime_get_account_mgr(), server_account_name); */
+ /* gtk_widget_set_sensitive (entry_username, !username_known); */
+
+ /* We drop the username sensitive code and disallow changing it here
+ * as tinymail does not support really changing the username in the callback
+ */
+ gtk_widget_set_sensitive (entry_username, FALSE);
+
#ifdef MODEST_PLATFORM_MAEMO
/* Auto-capitalization is the default, so let's turn it off: */
hildon_gtk_entry_set_input_mode (GTK_ENTRY (entry_username), HILDON_GTK_INPUT_MODE_FULL);
TRUE, FALSE, 0);
*/
+ fields = g_slice_new0 (PasswordDialogFields);
+ fields->username = entry_username;
+ fields->password = entry_password;
+ fields->dialog = dialog;
+
+ g_signal_connect (entry_username, "changed", G_CALLBACK (password_dialog_check_field), fields);
+ g_signal_connect (entry_password, "changed", G_CALLBACK (password_dialog_check_field), fields);
+ password_dialog_check_field (NULL, fields);
+
gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
while (!completed) {
*/
gtk_widget_destroy (dialog);
+ g_slice_free (PasswordDialogFields, fields);
/* printf ("DEBUG: %s: cancel=%d\n", __FUNCTION__, *cancel); */
}