X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fhildon2%2Fmodest-connection-specific-smtp-window.c;h=e310913154a466e2cc847f4020bcb64523149409;hb=e3bd2be354e0c60dbe9a33f19ffc710f82221a9f;hp=21722157a981b80d3198d757fb2169e696f02589;hpb=448d8d5a3f665e689ceeed19ade2f33a0091a289;p=modest diff --git a/src/hildon2/modest-connection-specific-smtp-window.c b/src/hildon2/modest-connection-specific-smtp-window.c index 2172215..e310913 100644 --- a/src/hildon2/modest-connection-specific-smtp-window.c +++ b/src/hildon2/modest-connection-specific-smtp-window.c @@ -266,11 +266,7 @@ edit_account (ModestConnectionSpecificSmtpWindow *self, GtkTreePath *path) MODEL_COL_SERVER_ACCOUNT_NAME, &server_account_name, MODEL_COL_SERVER_ACCOUNT_SETTINGS, &server_settings, -1); - - /* printf("DEBUG: %s: BEFORE: connection-specific server_account_name=%s\n", __FUNCTION__, server_account_name); */ - /* TODO: Is 0 an allowed libconic IAP ID? - * If not then we should check for it. */ - + /* Get existing server account data if a server account is already specified: */ gboolean settings_were_retrieved = FALSE; if (server_account_name && !server_settings) { @@ -278,19 +274,19 @@ edit_account (ModestConnectionSpecificSmtpWindow *self, GtkTreePath *path) if (server_settings) settings_were_retrieved = TRUE; } - + GtkWidget * window = GTK_WIDGET (modest_connection_specific_smtp_edit_window_new ()); modest_connection_specific_smtp_edit_window_set_connection ( MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW (window), id, connection_name, server_settings); - + /* Delete data, unless it was data from the rowmodel: */ if (settings_were_retrieved) { g_object_unref (server_settings); server_settings = NULL; } - + modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (window), GTK_WINDOW (self)); - + gint response = gtk_dialog_run (GTK_DIALOG (window)); if (response == GTK_RESPONSE_OK) { @@ -299,14 +295,14 @@ edit_account (ModestConnectionSpecificSmtpWindow *self, GtkTreePath *path) g_object_unref (server_settings); server_settings = NULL; } - + /* Get the new account data and save it in the row for later: * We free this in finalize(), * and save it to our configuration in * modest_connection_specific_smtp_window_save_server_accounts(). */ server_settings = modest_connection_specific_smtp_edit_window_get_settings ( MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW (window)); - + if (server_settings) { gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter, MODEL_COL_SERVER_ACCOUNT_SETTINGS, server_settings, @@ -339,9 +335,10 @@ static void modest_connection_specific_smtp_window_init (ModestConnectionSpecificSmtpWindow *self) { ModestWindowMgr *mgr; + GtkWidget *align; /* Specify a default size */ - gtk_window_set_default_size (GTK_WINDOW (self), -1, 320); + gtk_window_set_default_size (GTK_WINDOW (self), -1, MODEST_DIALOG_WINDOW_MAX_HEIGHT); /* This seems to be necessary to make the window show at the front with decoration. * If we use property type=GTK_WINDOW_TOPLEVEL instead of the default GTK_WINDOW_POPUP+decoration, @@ -370,7 +367,9 @@ modest_connection_specific_smtp_window_init (ModestConnectionSpecificSmtpWindow /* name column: * The ID model column in not shown in the view. */ GtkTreeViewColumn *view_column = gtk_tree_view_column_new (); + gtk_tree_view_column_set_expand (view_column, TRUE); GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); + g_object_set (G_OBJECT (renderer), "xpad", MODEST_MARGIN_DOUBLE, NULL); gtk_tree_view_column_pack_start(view_column, renderer, TRUE); gtk_tree_view_column_set_attributes (view_column, renderer, "text", MODEL_COL_NAME, NULL); @@ -378,6 +377,7 @@ modest_connection_specific_smtp_window_init (ModestConnectionSpecificSmtpWindow /* server name column: */ view_column = gtk_tree_view_column_new (); + gtk_tree_view_column_set_expand (view_column, TRUE); renderer = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_start(view_column, renderer, TRUE); gtk_tree_view_column_set_attributes (view_column, renderer, @@ -387,28 +387,25 @@ modest_connection_specific_smtp_window_init (ModestConnectionSpecificSmtpWindow /* The application must call modest_connection_specific_smtp_window_fill_with_connections(). */ GtkWidget *vbox = GTK_DIALOG(self)->vbox; - //gtk_vbox_new (FALSE, MODEST_MARGIN_DEFAULT); /* Introductory note: */ - /* TODO: For some reason this label does not wrap. It is truncated. */ GtkWidget *label = gtk_label_new(_("mcen_ia_optionalsmtp_note")); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - /* So that it is shown without being truncated: */ - /* gtk_label_set_max_width_chars (GTK_LABEL (label), 20); */ - /* The documentation for gtk_label_set_line_wrap() says that we must - * call gtk_widget_set_size_request() with a hard-coded width, - * though I wonder why gtk_label_set_max_width_chars() isn't enough. */ - /* gtk_widget_set_size_request (label, 400, -1); */ + gtk_misc_set_padding (GTK_MISC (label), MODEST_MARGIN_DOUBLE + MODEST_MARGIN_DOUBLE, MODEST_MARGIN_DOUBLE); + gtk_widget_set_size_request (label, 600, -1); gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, MODEST_MARGIN_HALF); + gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); /* Put the treeview in a pannable and add it to the box: */ priv->pannable = hildon_pannable_area_new (); + align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); + gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, MODEST_MARGIN_DOUBLE, 0); g_object_set (G_OBJECT (priv->pannable), "initial-hint", TRUE, NULL); - gtk_container_set_border_width (GTK_CONTAINER (priv->pannable), MODEST_MARGIN_DEFAULT); gtk_widget_show (priv->pannable); - gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (priv->pannable), TRUE, TRUE, MODEST_MARGIN_HALF); + gtk_widget_show (align); + gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (priv->pannable)); + gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (align), TRUE, TRUE, 0); gtk_widget_show (vbox); g_signal_connect (G_OBJECT (priv->treeview), "row-activated", G_CALLBACK (on_row_activated), self); @@ -439,8 +436,8 @@ modest_connection_specific_smtp_window_save_server_accounts (ModestConnectionSpe ModestAccountMgr *mgr = modest_runtime_get_account_mgr (); ModestConnectionSpecificSmtpWindowPrivate *priv = CONNECTION_SPECIFIC_SMTP_WINDOW_GET_PRIVATE (self); - - + + /* Get the first iter in the list */ GtkTreeIter iter; gboolean valid = gtk_tree_model_get_iter_first (priv->model, &iter); @@ -452,7 +449,7 @@ modest_connection_specific_smtp_window_save_server_accounts (ModestConnectionSpe gchar *server_account_name = NULL; gchar *server_name = NULL; ModestServerAccountSettings *server_settings = NULL; - + gtk_tree_model_get (priv->model, &iter, MODEL_COL_ID, &id, MODEL_COL_NAME, &connection_name, @@ -460,8 +457,8 @@ modest_connection_specific_smtp_window_save_server_accounts (ModestConnectionSpe MODEL_COL_SERVER_ACCOUNT_NAME, &server_account_name, MODEL_COL_SERVER_ACCOUNT_SETTINGS, &server_settings, -1); - - gboolean success = TRUE; + + gboolean success = TRUE; if (id && server_settings) { /* The presence of data suggests that there is something to save. */ if (!server_account_name) { /* Add a new server account, building a (non-human-visible) name: */ @@ -490,6 +487,7 @@ modest_connection_specific_smtp_window_save_server_accounts (ModestConnectionSpe MODEL_COL_SERVER_ACCOUNT_NAME, server_account_name, -1); } else { + /* If the account already exists then update it and notify */ modest_account_mgr_save_server_settings (mgr, server_settings); } } else if (id && server_name &&