modest-maemo-utils.c \
modest-number-editor.c \
modest-number-editor.h \
- modest-connection-specific-smtp-edit-window.h \
- modest-connection-specific-smtp-edit-window.c \
modest-secureauth-picker.h modest-secureauth-picker.c \
modest-selector-picker.h modest-selector-picker.c \
modest-hildon2-window-mgr.h modest-hildon2-window-mgr.c
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "modest-connection-specific-smtp-edit-window.h"
-#include "widgets/modest-ui-constants.h"
-#include "modest-hildon-includes.h"
-#include "modest-runtime.h"
-
-#include "widgets/modest-validating-entry.h"
-#include <modest-scrollable.h>
-#include <hildon/hildon-entry.h>
-#include <modest-ui-constants.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkstock.h>
-#include "modest-text-utils.h"
-#include "modest-maemo-utils.h"
-#include <modest-toolkit-factory.h>
-#include <modest-toolkit-utils.h>
-
-#include <glib/gi18n.h>
-
-#define PORT_RANGE_MIN 1
-#define PORT_RANGE_MAX 65535
-
-G_DEFINE_TYPE (ModestConnectionSpecificSmtpEditWindow, modest_connection_specific_smtp_edit_window, GTK_TYPE_DIALOG);
-
-#define CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW, ModestConnectionSpecificSmtpEditWindowPrivate))
-
-static void on_response (GtkDialog *dialog,
- gint arg1,
- gpointer user_data);
-
-typedef struct _ModestConnectionSpecificSmtpEditWindowPrivate ModestConnectionSpecificSmtpEditWindowPrivate;
-
-struct _ModestConnectionSpecificSmtpEditWindowPrivate
-{
- GtkWidget *entry_outgoingserver;
- GtkWidget *outgoing_auth_selector;
- GtkWidget *entry_user_username;
- GtkWidget *entry_user_password;
- GtkWidget *outgoing_security_selector;
- GtkWidget *entry_port;
-
- GtkWidget *button_ok;
- GtkWidget *button_cancel;
-
- gchar *account_name;
-
- gboolean is_dirty;
- gboolean range_error_occured;
-};
-
-static void
-modest_connection_specific_smtp_edit_window_get_property (GObject *object, guint property_id,
- GValue *value, GParamSpec *pspec)
-{
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-modest_connection_specific_smtp_edit_window_set_property (GObject *object, guint property_id,
- const GValue *value, GParamSpec *pspec)
-{
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-modest_connection_specific_smtp_edit_window_dispose (GObject *object)
-{
-
-
- if (G_OBJECT_CLASS (modest_connection_specific_smtp_edit_window_parent_class)->dispose)
- G_OBJECT_CLASS (modest_connection_specific_smtp_edit_window_parent_class)->dispose (object);
-}
-
-static void
-modest_connection_specific_smtp_edit_window_finalize (GObject *object)
-{
- ModestConnectionSpecificSmtpEditWindow *self = (ModestConnectionSpecificSmtpEditWindow *) object;
- ModestConnectionSpecificSmtpEditWindowPrivate *priv =
- CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
-
- if (priv->account_name) {
- g_free (priv->account_name);
- priv->account_name = NULL;
- }
- G_OBJECT_CLASS (modest_connection_specific_smtp_edit_window_parent_class)->finalize (object);
-}
-
-static void
-modest_connection_specific_smtp_edit_window_class_init (ModestConnectionSpecificSmtpEditWindowClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (ModestConnectionSpecificSmtpEditWindowPrivate));
-
- object_class->get_property = modest_connection_specific_smtp_edit_window_get_property;
- object_class->set_property = modest_connection_specific_smtp_edit_window_set_property;
- object_class->dispose = modest_connection_specific_smtp_edit_window_dispose;
- object_class->finalize = modest_connection_specific_smtp_edit_window_finalize;
-}
-
-enum MODEL_COLS {
- MODEL_COL_NAME = 0,
- MODEL_COL_SERVER_NAME = 1,
- MODEL_COL_ID = 2
-};
-
-static void
-on_change(GtkWidget* widget, ModestConnectionSpecificSmtpEditWindow *self)
-{
- ModestConnectionSpecificSmtpEditWindowPrivate *priv =
- CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
- priv->is_dirty = TRUE;
-}
-
-static void
-on_mandatory_entry_changed (GtkWidget* widget, ModestConnectionSpecificSmtpEditWindow *self)
-{
- const gchar *text;
- gboolean sensitive = TRUE;
- ModestConnectionSpecificSmtpEditWindowPrivate *priv;
- ModestProtocolType auth_proto;
-
- priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
-
- /* Check all mandatory entries */
- on_change (widget, self);
-
- auth_proto = modest_secureauth_selector_get_active_secureauth (priv->outgoing_auth_selector);
- if (modest_protocol_registry_protocol_type_is_secure (modest_runtime_get_protocol_registry (),
- auth_proto)) {
- text = modest_entry_get_text (priv->entry_user_username);
- if (!text || (strlen(text) == 0))
- sensitive = FALSE;
- }
-
- text = modest_entry_get_text (priv->entry_outgoingserver);
- if (!text || (strlen(text) == 0))
- sensitive = FALSE;
-
- gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, sensitive);
-}
-
-
-static void
-on_value_changed(GtkWidget* widget, GValue* value, ModestConnectionSpecificSmtpEditWindow *self)
-{
- ModestConnectionSpecificSmtpEditWindowPrivate *priv =
- CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
-
- priv->range_error_occured = FALSE;
- on_change(widget, self);
-}
-
-static gboolean
-on_range_error (GtkWidget *widget, ModestNumberEditorErrorType type, gpointer user_data)
-{
- gchar *msg;
- ModestConnectionSpecificSmtpEditWindow *self = user_data;
- ModestConnectionSpecificSmtpEditWindowPrivate *priv =
- CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
-
- /* We want to prevent the closure of the dialog when a range error occured. The problem is that
- * the hildon number editor already resets the value to the default value, so we have to
- * remember that such an error occured. */
- priv->range_error_occured = TRUE;
-
- if (type == MODEST_NUMBER_EDITOR_ERROR_MAXIMUM_VALUE_EXCEED) {
- msg = g_strdup_printf (dgettext ("hildon-libs", "ckct_ib_maximum_value"), 65535);
- } else if (type == MODEST_NUMBER_EDITOR_ERROR_MINIMUM_VALUE_EXCEED) {
- msg = g_strdup_printf (dgettext ("hildon-libs", "ckct_ib_minimum_value"), 1);
- } else {
- msg = g_strdup_printf (_HL("ckct_ib_set_a_value_within_range"), PORT_RANGE_MIN, PORT_RANGE_MAX);
- }
- modest_platform_information_banner (widget, NULL, msg);
- g_free (msg);
-
- /* Show error message by not returning TRUE */
- return TRUE;
-}
-
-static gboolean
-on_delete_event (GtkWidget *widget,
- GdkEvent *event,
- gpointer user_data)
-{
- ModestConnectionSpecificSmtpEditWindow *self = user_data;
- ModestConnectionSpecificSmtpEditWindowPrivate *priv =
- CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
-
- /* If it's dirty, them the response method already asked the
- user, because it's always executed before (see GtkDialog
- code). If it's not then simply close */
- return priv->is_dirty;
-}
-
-static void
-on_response (GtkDialog *dialog, int response_id, gpointer user_data)
-{
- const gchar *hostname;
- ModestConnectionSpecificSmtpEditWindow *self = user_data;
- ModestConnectionSpecificSmtpEditWindowPrivate *priv =
- CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
-
- hostname = modest_entry_get_text (priv->entry_outgoingserver);
-
- /* Don't close the dialog if a range error occured */
- if(response_id == GTK_RESPONSE_OK && priv->range_error_occured)
- {
- priv->range_error_occured = FALSE;
- g_signal_stop_emission_by_name (dialog, "response");
- gtk_widget_grab_focus (priv->entry_port);
- return;
- }
-
- /* Don't close the dialog if a range error occured */
- if (response_id == GTK_RESPONSE_OK) {
- if (hostname && (hostname[0] != '\0') &&
- (!modest_text_utils_validate_domain_name (hostname))) {
- g_signal_stop_emission_by_name (dialog, "response");
- modest_platform_system_banner (NULL, NULL, _("mcen_ib_invalid_servername"));
- gtk_widget_grab_focus (priv->entry_outgoingserver);
- gtk_editable_select_region (GTK_EDITABLE (priv->entry_outgoingserver), 0, -1);
- return;
- }
- } else {
- /* Ask user if they want to discard changes */
- if (priv->is_dirty) {
- gint response;
- response = modest_platform_run_confirmation_dialog (GTK_WINDOW (user_data),
- _("imum_nc_wizard_confirm_lose_changes"));
-
- if (response != GTK_RESPONSE_OK)
- g_signal_stop_emission_by_name (dialog, "response");
- }
- }
-}
-
-static void
-on_set_focus_child (GtkContainer *container, GtkWidget *widget, gpointer user_data)
-{
- ModestConnectionSpecificSmtpEditWindow *self = user_data;
- ModestConnectionSpecificSmtpEditWindowPrivate *priv =
- CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
-
- /* Another child gained focus. Since the number editor already reset a
- * possible range error to the default value, we allow closure of the
- * dialog */
- priv->range_error_occured = FALSE;
-}
-
-static void
-security_selector_set_port (ModestConnectionSpecificSmtpEditWindowPrivate *priv)
-{
- const gint port_number =
- modest_serversecurity_selector_get_active_serversecurity_port (priv->outgoing_security_selector);
-
- if(port_number != 0) {
- modest_number_entry_set_value (
- priv->entry_port, port_number);
- }
-}
-
-static void
-on_security_selector_changed (GtkWidget *widget, gpointer user_data)
-{
- ModestConnectionSpecificSmtpEditWindow *self =
- MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW (user_data);
- ModestConnectionSpecificSmtpEditWindowPrivate *priv =
- CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
-
- on_change(GTK_WIDGET(widget), self);
-
- /* Enable/disable username and password fields */
- security_selector_set_port (priv);
-}
-
-static void
-auth_selector_set_sensitive (ModestConnectionSpecificSmtpEditWindowPrivate *priv)
-{
- ModestProtocolType auth_proto;
-
- auth_proto =
- modest_secureauth_selector_get_active_secureauth (priv->outgoing_auth_selector);
-
- if (auth_proto == modest_protocol_registry_get_none_auth_type_id ()) {
- gtk_widget_set_sensitive (priv->entry_user_username, FALSE);
- gtk_widget_set_sensitive (priv->entry_user_password, FALSE);
- } else {
- gtk_widget_set_sensitive (priv->entry_user_username, TRUE);
- gtk_widget_set_sensitive (priv->entry_user_password, TRUE);
- }
-
-}
-
-static void
-on_auth_selector_changed (GtkWidget *widget, gpointer user_data)
-{
- ModestConnectionSpecificSmtpEditWindow *self;
- ModestConnectionSpecificSmtpEditWindowPrivate *priv;
-
- self = MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW (user_data);
- priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
-
- on_change (GTK_WIDGET(widget), self);
-
- /* Enable/disable username and password fields */
- auth_selector_set_sensitive (priv);
-
- /* Check missing mandatory data */
- on_mandatory_entry_changed (priv->entry_user_username, self);
-}
-
-static void
-modest_connection_specific_smtp_edit_window_init (ModestConnectionSpecificSmtpEditWindow *self)
-{
- ModestConnectionSpecificSmtpEditWindowPrivate *priv;
- GtkWidget *dialog_box;
- GtkWidget *scrollable, *vbox, *align;
- gchar *server_label;
-
- /* The title of this dialog is quite long, so make the window wide enough */
- gtk_widget_set_size_request (GTK_WIDGET (self), 600, 320);
-
- priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
- dialog_box = GTK_DIALOG(self)->vbox; /* gtk_vbox_new (FALSE, MODEST_MARGIN_HALF); */
- gtk_box_set_spacing (GTK_BOX (dialog_box), MODEST_MARGIN_NONE);
-
- vbox = gtk_vbox_new (FALSE, 0);
- 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);
-
- /* Create a size group to be used by all captions.
- * Note that HildonCaption does not create a default size group if we do not specify one.
- * We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
- GtkSizeGroup *title_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
- GtkSizeGroup *value_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
-
- /* The outgoing server widgets: */
- if (!priv->entry_outgoingserver)
- priv->entry_outgoingserver = modest_toolkit_factory_create_entry (modest_runtime_get_toolkit_factory ());
- /* Auto-capitalization is the default, so let's turn it off: */
- hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_outgoingserver), HILDON_GTK_INPUT_MODE_FULL);
- g_signal_connect(G_OBJECT(priv->entry_outgoingserver), "changed", G_CALLBACK(on_mandatory_entry_changed), self);
-
- server_label = g_strconcat (_("mcen_li_emailsetup_smtp"), "\n<small>(SMTP)</small>", NULL);
-
- GtkWidget *captioned =
- modest_toolkit_utils_create_captioned (title_sizegroup, value_sizegroup,
- server_label, TRUE,
- priv->entry_outgoingserver);
- g_free (server_label);
- gtk_widget_show (priv->entry_outgoingserver);
- gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, 0);
- gtk_widget_show (captioned);
-
- /* The secure authentication widgets: */
- if (!priv->outgoing_auth_selector) {
- priv->outgoing_auth_selector =
- modest_toolkit_factory_create_secureauth_selector (modest_runtime_get_toolkit_factory ());
- }
- if (GTK_IS_COMBO_BOX (priv->outgoing_auth_selector)) {
- GtkWidget *captioned;
- captioned = modest_toolkit_utils_create_captioned (title_sizegroup, value_sizegroup,
- _("mcen_li_emailsetup_secure_authentication"), FALSE,
- priv->outgoing_auth_selector);
- gtk_widget_show (captioned);
- gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, 0);
- } else {
- modest_toolkit_utils_set_hbutton_layout (title_sizegroup, value_sizegroup,
- _("mcen_li_emailsetup_secure_authentication"),
- priv->outgoing_auth_selector);
- gtk_box_pack_start (GTK_BOX (vbox), priv->outgoing_auth_selector, FALSE, FALSE, 0);
- }
- gtk_widget_show (priv->outgoing_auth_selector);
-
- /* The username widgets: */
- priv->entry_user_username = GTK_WIDGET (modest_validating_entry_new ());
- /* Auto-capitalization is the default, so let's turn it off: */
- hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_user_username), HILDON_GTK_INPUT_MODE_FULL);
- captioned = modest_toolkit_utils_create_captioned (title_sizegroup, value_sizegroup,
- _("mail_fi_username"), FALSE,
- priv->entry_user_username);
- g_signal_connect(G_OBJECT(priv->entry_user_username), "changed", G_CALLBACK(on_mandatory_entry_changed), self);
- gtk_widget_show (priv->entry_user_username);
- gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, 0);
- gtk_widget_show (captioned);
-
- /* Prevent the use of some characters in the username,
- * as required by our UI specification: */
- modest_validating_entry_set_unallowed_characters_whitespace (
- MODEST_VALIDATING_ENTRY (priv->entry_user_username));
-
- /* Set max length as in the UI spec:
- * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
- gtk_entry_set_max_length (GTK_ENTRY (priv->entry_user_username), 64);
-
- /* The password widgets: */
- priv->entry_user_password = modest_toolkit_factory_create_entry (modest_runtime_get_toolkit_factory ());
- /* Auto-capitalization is the default, so let's turn it off: */
- hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_user_password),
- HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE);
- gtk_entry_set_visibility (GTK_ENTRY (priv->entry_user_password), FALSE);
- /* gtk_entry_set_invisible_char (GTK_ENTRY (priv->entry_user_password), '*'); */
- captioned = modest_toolkit_utils_create_captioned (title_sizegroup, value_sizegroup,
- _("mail_fi_password"), FALSE, priv->entry_user_password);
- g_signal_connect(G_OBJECT(priv->entry_user_password), "changed", G_CALLBACK(on_change), self);
- gtk_widget_show (priv->entry_user_password);
- gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, 0);
- gtk_widget_show (captioned);
-
- /* The secure connection widgets: */
- if (!priv->outgoing_security_selector)
- priv->outgoing_security_selector =
- modest_toolkit_factory_create_serversecurity_selector (modest_runtime_get_toolkit_factory ());
- modest_serversecurity_selector_fill (priv->outgoing_security_selector, MODEST_PROTOCOLS_TRANSPORT_SMTP);
- modest_serversecurity_selector_set_active_serversecurity (priv->outgoing_security_selector, MODEST_PROTOCOLS_CONNECTION_NONE);
- if (GTK_IS_COMBO_BOX (priv->outgoing_security_selector)) {
- GtkWidget *captioned;
-
- captioned = modest_toolkit_utils_create_captioned (title_sizegroup, value_sizegroup,
- _("mcen_li_emailsetup_secure_connection"), FALSE,
- priv->outgoing_security_selector);
- gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (captioned);
- } else {
- modest_toolkit_utils_set_hbutton_layout (title_sizegroup, value_sizegroup,
- _("mcen_li_emailsetup_secure_connection"),
- priv->outgoing_security_selector);
- gtk_box_pack_start (GTK_BOX (vbox), priv->outgoing_security_selector, FALSE, FALSE, 0);
- }
- gtk_widget_show (priv->outgoing_security_selector);
-
- /* The port number widgets: */
- if (!priv->entry_port)
- priv->entry_port = modest_toolkit_factory_create_number_entry (modest_runtime_get_toolkit_factory (),
- PORT_RANGE_MIN, PORT_RANGE_MAX);
- captioned = modest_toolkit_utils_create_captioned (title_sizegroup, value_sizegroup,
- _("mcen_fi_emailsetup_port"), FALSE, priv->entry_port);
- gtk_widget_add_events(GTK_WIDGET(priv->entry_port), GDK_FOCUS_CHANGE_MASK);
- gtk_widget_show (priv->entry_port);
- gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, 0);
- gtk_widget_show (captioned);
-
- /* Add the button. Disabled by default */
- gtk_dialog_add_button (GTK_DIALOG (self), _HL("wdgt_bd_save"), GTK_RESPONSE_OK);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, FALSE);
-
- priv->is_dirty = FALSE;
- priv->range_error_occured = FALSE;
- g_signal_connect(G_OBJECT(self), "response", G_CALLBACK(on_response), self);
- g_signal_connect(G_OBJECT(self), "delete-event", G_CALLBACK(on_delete_event), self);
- g_signal_connect(G_OBJECT(vbox), "set-focus-child", G_CALLBACK(on_set_focus_child), self);
-
- priv->account_name = NULL;
-
- scrollable = modest_toolkit_factory_create_scrollable (modest_runtime_get_toolkit_factory ());
- gtk_container_add (GTK_CONTAINER (align), vbox);
- modest_scrollable_add_with_viewport (MODEST_SCROLLABLE (scrollable), align);
- gtk_box_pack_start (GTK_BOX (dialog_box), scrollable, TRUE, TRUE, 0);
-
- gtk_widget_show_all (dialog_box);
- gtk_window_set_default_size (GTK_WINDOW (self), -1, MODEST_DIALOG_WINDOW_MAX_HEIGHT);
-
- g_object_unref (title_sizegroup);
- g_object_unref (value_sizegroup);
-
- /* When this window is shown, hibernation should not be possible,
- * because there is no sensible way to save the state: */
- modest_window_mgr_prevent_hibernation_while_window_is_shown (
- modest_runtime_get_window_mgr (), GTK_WINDOW (self));
-
- /* Refresh view with current settings */
- auth_selector_set_sensitive (priv);
- security_selector_set_port (priv);
-
- /* Connect signals to track changes */
- if (GTK_IS_COMBO_BOX (priv->outgoing_security_selector)) {
- g_signal_connect (G_OBJECT (priv->outgoing_security_selector),
- "changed",
- (GCallback) on_security_selector_changed,
- self);
- } else {
- g_signal_connect (G_OBJECT (priv->outgoing_security_selector),
- "value-changed",
- (GCallback) on_security_selector_changed,
- self);
- }
- if (GTK_IS_COMBO_BOX (priv->outgoing_auth_selector)) {
- g_signal_connect (G_OBJECT (priv->outgoing_auth_selector),
- "changed",
- (GCallback) on_auth_selector_changed,
- self);
- } else {
- g_signal_connect (G_OBJECT (priv->outgoing_auth_selector),
- "value-changed",
- (GCallback) on_auth_selector_changed,
- self);
- }
- g_signal_connect(G_OBJECT(priv->entry_port),
- "range-error",
- G_CALLBACK(on_range_error),
- self);
- g_signal_connect(G_OBJECT(priv->entry_port),
- "notify::value",
- G_CALLBACK(on_value_changed),
- self);
-
-}
-
-ModestConnectionSpecificSmtpEditWindow*
-modest_connection_specific_smtp_edit_window_new (void)
-{
- return g_object_new (MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW, NULL);
-}
-
-void
-modest_connection_specific_smtp_edit_window_set_connection (
- ModestConnectionSpecificSmtpEditWindow *window, const gchar* iap_id, const gchar* iap_name,
- ModestServerAccountSettings *server_settings)
-{
- ModestConnectionSpecificSmtpEditWindowPrivate *priv =
- CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (window);
-
- /* This causes a warning because of the %s in the translation, but not in the original string: */
- gchar* title = g_strdup_printf (_("mcen_ti_connection_connection_name"), iap_name);
- gtk_window_set_title (GTK_WINDOW (window), title);
- g_free (title);
-
- if (server_settings)
- {
- /* Setting known values */
- if (priv->account_name)
- g_free (priv->account_name);
- priv->account_name = g_strdup (modest_server_account_settings_get_account_name (server_settings));
- modest_entry_set_text (priv->entry_outgoingserver,
- modest_server_account_settings_get_hostname (server_settings));
- modest_entry_set_text (priv->entry_user_username,
- modest_server_account_settings_get_username (server_settings));
- modest_entry_set_text (priv->entry_user_password,
- modest_server_account_settings_get_password (server_settings));
-
- modest_serversecurity_selector_set_active_serversecurity
- (priv->outgoing_security_selector,
- modest_server_account_settings_get_security_protocol (server_settings));
-
- modest_secureauth_selector_set_active_secureauth (priv->outgoing_auth_selector,
- modest_server_account_settings_get_auth_protocol (server_settings));
-
- /* port: */
- modest_number_entry_set_value (
- priv->entry_port,
- modest_server_account_settings_get_port (server_settings));
-
-
- /* This will cause changed signals so we set dirty back to FALSE */
- priv->is_dirty = FALSE;
- }
-}
-
-ModestServerAccountSettings*
-modest_connection_specific_smtp_edit_window_get_settings (ModestConnectionSpecificSmtpEditWindow *window)
-{
- ModestConnectionSpecificSmtpEditWindowPrivate *priv = NULL;
- ModestServerAccountSettings *server_settings = NULL;
- const gchar *outgoing_server = NULL;
-
- priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (window);
- outgoing_server = modest_entry_get_text (priv->entry_outgoingserver);
-
- /* If the outgoing server is NULL, we are removing the connection specific
- * settings */
- if ((outgoing_server == NULL) || (outgoing_server[0] == '\0')) {
- return NULL;
- }
-
- server_settings = modest_server_account_settings_new ();
-
- modest_server_account_settings_set_hostname (server_settings,
- modest_entry_get_text (priv->entry_outgoingserver));
- modest_server_account_settings_set_protocol (server_settings,
- MODEST_PROTOCOLS_TRANSPORT_SMTP);
- modest_server_account_settings_set_username (server_settings,
- modest_entry_get_text (priv->entry_user_username));
- modest_server_account_settings_set_password (server_settings,
- modest_entry_get_text (priv->entry_user_password));
-
- modest_server_account_settings_set_security_protocol (server_settings,
- modest_serversecurity_selector_get_active_serversecurity (
- priv->outgoing_security_selector));
- modest_server_account_settings_set_auth_protocol
- (server_settings,
- modest_secureauth_selector_get_active_secureauth (priv->outgoing_auth_selector));
- modest_server_account_settings_set_account_name (server_settings,
- priv->account_name);
-
- /* port: */
- modest_server_account_settings_set_port (server_settings,
- modest_number_entry_get_value (priv->entry_port));
-
- return server_settings;
-}
-
-gboolean
-modest_connection_specific_smtp_edit_window_is_dirty(ModestConnectionSpecificSmtpEditWindow *window)
-{
- ModestConnectionSpecificSmtpEditWindowPrivate *priv =
- CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (window);
-
- return priv->is_dirty;
-}
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __MODEST_MAEMO_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW
-#define __MODEST_MAEMO_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW
-
-#include <gtk/gtkdialog.h>
-#include <gtk/gtktreeview.h>
-#include <modest-server-account-settings.h>
-
-G_BEGIN_DECLS
-
-#define MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW modest_connection_specific_smtp_edit_window_get_type()
-
-#define MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW, ModestConnectionSpecificSmtpEditWindow))
-
-#define MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW, ModestConnectionSpecificSmtpEditWindowClass))
-
-#define MODEST_IS_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW))
-
-#define MODEST_IS_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW))
-
-#define MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW, ModestConnectionSpecificSmtpEditWindowClass))
-
-typedef struct {
- GtkDialog parent;
-
-} ModestConnectionSpecificSmtpEditWindow;
-
-typedef struct {
- GtkDialogClass parent_class;
-} ModestConnectionSpecificSmtpEditWindowClass;
-
-GType modest_connection_specific_smtp_edit_window_get_type (void);
-
-ModestConnectionSpecificSmtpEditWindow* modest_connection_specific_smtp_edit_window_new (void);
-
-void modest_connection_specific_smtp_edit_window_set_connection (
- ModestConnectionSpecificSmtpEditWindow *window, const gchar* iap_id, const gchar* iap_name,
- ModestServerAccountSettings *server_settings);
-
-ModestServerAccountSettings* modest_connection_specific_smtp_edit_window_get_settings (
- ModestConnectionSpecificSmtpEditWindow *window);
-
-gboolean modest_connection_specific_smtp_edit_window_is_dirty(
- ModestConnectionSpecificSmtpEditWindow *window);
-
-G_END_DECLS
-
-#endif /* __MODEST_MAEMO_CONNECTION_SPECIFIC_SMTP_WINDOW */
static TnyAccount *get_account_from_folder_store (TnyFolderStore *folder_store);
-#ifndef MODEST_TOOLKIT_HILDON2
-static void modest_ui_actions_on_main_window_move_to (GtkAction *action,
- GtkWidget *folder_view,
- TnyFolderStore *dst_folder,
- ModestMainWindow *win);
-
-#else
static void modest_ui_actions_on_folder_window_move_to (GtkWidget *folder_view,
TnyFolderStore *dst_folder,
TnyList *selection,
GtkWindow *win);
-#endif
static void modest_ui_actions_on_window_move_to (GtkAction *action,
TnyList *list_to_move,
wizard = GTK_WINDOW (modest_platform_get_account_settings_wizard ());
modest_window_mgr_set_modal (modest_runtime_get_window_mgr(), GTK_WINDOW (wizard), (GtkWindow *) win);
-#ifndef MODEST_TOOLKIT_HILDON2
- /* always present a main window in the background
- * we do it here, so we cannot end up with two wizards (as this
- * function might be called in modest_window_mgr_get_main_window as well */
- if (!win)
- win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr(),
- TRUE); /* create if not existent */
-#else
if (!win) {
GList *window_list;
ModestWindowMgr *mgr;
g_list_free (window_list);
}
}
-#endif
if (win)
gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (win));
in order to get the widgets properly drawn (MainWindow main
paned won't be in its right position and the dialog will be
missplaced */
-#ifndef MODEST_TOOLKIT_HILDON2
- gtk_widget_show_all (GTK_WIDGET (win));
- gtk_widget_show_all (GTK_WIDGET (wizard));
- gtk_window_present (GTK_WINDOW (win));
- gtk_window_present (GTK_WINDOW (wizard));
-#endif
dialog_response = gtk_dialog_run (GTK_DIALOG (wizard));
gtk_widget_destroy (GTK_WIDGET (wizard));
}
return list;
-#ifndef MODEST_TOOLKIT_HILDON2
- } else if (MODEST_IS_MAIN_WINDOW(win)) {
- GtkWidget *header_view;
-
- header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(win),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
- return modest_header_view_get_selected_headers (MODEST_HEADER_VIEW(header_view));
-#else
} else if (MODEST_IS_HEADER_WINDOW (win)) {
GtkWidget *header_view;
header_view = GTK_WIDGET (modest_header_window_get_header_view (MODEST_HEADER_WINDOW (win)));
return modest_header_view_get_selected_headers (MODEST_HEADER_VIEW(header_view));
-#endif
} else {
return NULL;
}
g_return_if_fail (MODEST_IS_WINDOW(win));
/* Check first if the header view has the focus */
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (win)) {
- GtkWidget *w;
- w = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
- if (gtk_widget_is_focus (w)) {
- modest_ui_actions_on_delete_folder (action, MODEST_WINDOW(win));
- return;
- }
- }
-#endif
modest_ui_actions_on_delete_message (action, win);
}
}
-#ifdef MODEST_TOOLKIT_HILDON2
if (win)
account_name = g_strdup (modest_window_get_active_account(win));
-#endif
if (!account_name) {
account_name = modest_account_mgr_get_default_account(mgr);
}
{
GtkWidget *header_view;
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (window)) {
- header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
-#else
if (MODEST_IS_HEADER_WINDOW (window)){
header_view = GTK_WIDGET (modest_header_window_get_header_view (MODEST_HEADER_WINDOW (window)));
-#endif
} else {
header_view = NULL;
}
if (status == MODEST_TNY_SEND_QUEUE_FAILED) {
*is_draft = TRUE;
}
-#ifdef MODEST_TOOLKIT_HILDON2
else {
/* In Fremantle we can not
open any message from
failed state */
*can_open = FALSE;
}
-#endif
}
g_object_unref(traccount);
} else {
gtk_widget_show_all (GTK_WIDGET(win));
}
-#ifndef MODEST_TOOLKIT_HILDON2
- /* Update toolbar dimming state */
- if (MODEST_IS_MAIN_WINDOW (parent_win)) {
- modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (parent_win));
- }
-#endif
cleanup:
/* Free */
error_msg = g_strdup (_("mail_ni_ui_folder_get_msg_folder_error"));
}
-#ifndef MODEST_TOOLKIT_HILDON2
- gboolean show_open_draft = FALSE;
- if (modest_protocol_registry_protocol_type_has_tag (protocol_registry,
- proto,
- MODEST_PROTOCOL_REGISTRY_LOCAL_STORE_PROTOCOLS)) {
- TnyFolder *folder;
- TnyFolderType folder_type;
-
- folder = tny_header_get_folder (helper->header);
- folder_type = modest_tny_folder_get_local_or_mmc_folder_type (folder);
- show_open_draft = (folder_type == TNY_FOLDER_TYPE_DRAFTS);
- g_object_unref (folder);
- }
-#endif
-
-#ifdef MODEST_TOOLKIT_HILDON2
gboolean is_draft;
gboolean can_open;
gchar *account_name = get_info_from_header (helper->header, &is_draft, &can_open);
goto clean;
}
g_free (account_name);
-#endif
/* Create the mail operation */
mail_op =
modest_mail_operation_new_with_error_handling ((GObject *) parent_window,
mail_op);
-#ifndef MODEST_TOOLKIT_HILDON2
- if (show_open_draft) {
- helper->banner_info = g_slice_new (OpenMsgBannerInfo);
- helper->banner_info->message = g_strdup (_("mail_ib_opening_draft_message"));
- helper->banner_info->banner = NULL;
- helper->banner_info->idle_handler = g_timeout_add (500, open_msg_banner_idle,
- helper->banner_info);
- }
-#endif
-
TnyList *headers;
headers = TNY_LIST (tny_simple_list_new ());
modest_ui_actions_on_next (GtkAction *action,
ModestWindow *window)
{
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (window)) {
- GtkWidget *header_view;
-
- header_view = modest_main_window_get_child_widget (
- MODEST_MAIN_WINDOW(window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
- if (!header_view)
- return;
-
- modest_header_view_select_next (
- MODEST_HEADER_VIEW(header_view));
-#else
if (MODEST_IS_MSG_VIEW_WINDOW (window)) {
modest_msg_view_window_select_next_message (
MODEST_MSG_VIEW_WINDOW (window));
-#endif
} else {
g_return_if_reached ();
}
{
g_return_if_fail (MODEST_IS_WINDOW(window));
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (window)) {
- GtkWidget *header_view;
- header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
- if (!header_view)
- return;
-
- modest_header_view_select_prev (MODEST_HEADER_VIEW(header_view));
-#else
if (MODEST_IS_MSG_VIEW_WINDOW (window)) {
modest_msg_view_window_select_previous_message (MODEST_MSG_VIEW_WINDOW (window));
-#endif
} else {
g_return_if_reached ();
}
g_return_if_fail (MODEST_IS_WINDOW(window));
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (window)) {
- header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
-#else
if (MODEST_IS_HEADER_WINDOW (window)) {
header_view = GTK_WIDGET (modest_header_window_get_header_view (MODEST_HEADER_WINDOW (window)));
-#endif
}
if (!header_view) {
return FALSE;
/* Refresh the current view */
-#ifdef MODEST_TOOLKIT_HILDON2
if (MODEST_IS_HEADER_WINDOW (source))
header_view = modest_header_window_get_header_view ((ModestHeaderWindow *) source);
-#else
- if (MODEST_IS_MAIN_WINDOW (source))
- header_view = MODEST_HEADER_VIEW (modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (source),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW));
-#endif
if (header_view) {
TnyFolder *folder = modest_header_view_get_folder (header_view);
if (folder) {
goto clean;
}
-#ifndef MODEST_TOOLKIT_HILDON2
- /* Set send/receive operation in progress */
- if (info->win && MODEST_IS_MAIN_WINDOW (info->win)) {
- modest_main_window_notify_send_receive_initied (MODEST_MAIN_WINDOW (info->win));
- }
-
- if (info->win && MODEST_IS_MAIN_WINDOW (info->win))
- g_signal_connect (G_OBJECT (info->mail_op), "operation-finished",
- G_CALLBACK (on_send_receive_finished),
- info->win);
-#endif
/* Send & receive. */
modest_mail_operation_update_account (info->mail_op, info->account_name,
modest_ui_actions_on_accounts (NULL, win);
/* Refresh the current folder. The if is always TRUE it's just an extra check */
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (win)) {
- GtkWidget *folder_view;
- TnyFolderStore *folder_store;
-
- folder_view =
- modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
- if (!folder_view)
- return;
-
- folder_store = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view));
-
- if (folder_store)
- g_object_unref (folder_store);
- /* Refresh the active account. Force the connection if needed
- and poke the status of all folders */
- modest_ui_actions_do_send_receive (NULL, TRUE, TRUE, TRUE, win);
-#else
if (MODEST_IS_ACCOUNTS_WINDOW (win)) {
modest_ui_actions_do_send_receive_all (win, TRUE, TRUE, TRUE);
-#endif
} else {
const gchar *active_account;
active_account = modest_window_get_active_account (MODEST_WINDOW (win));
}
-#ifndef MODEST_TOOLKIT_HILDON2
-void
-modest_ui_actions_toggle_header_list_view (GtkAction *action, ModestMainWindow *main_window)
-{
- ModestConf *conf;
- GtkWidget *header_view;
-
- g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
-
- header_view = modest_main_window_get_child_widget (main_window,
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
- if (!header_view)
- return;
-
- conf = modest_runtime_get_conf ();
-
- /* what is saved/restored is depending on the style; thus; we save with
- * old style, then update the style, and restore for this new style
- */
- modest_widget_memory_save (conf, G_OBJECT(header_view), MODEST_CONF_HEADER_VIEW_KEY);
-
- if (modest_header_view_get_style
- (MODEST_HEADER_VIEW(header_view)) == MODEST_HEADER_VIEW_STYLE_DETAILS)
- modest_header_view_set_style (MODEST_HEADER_VIEW(header_view),
- MODEST_HEADER_VIEW_STYLE_TWOLINES);
- else
- modest_header_view_set_style (MODEST_HEADER_VIEW(header_view),
- MODEST_HEADER_VIEW_STYLE_DETAILS);
-
- modest_widget_memory_restore (conf, G_OBJECT(header_view),
- MODEST_CONF_HEADER_VIEW_KEY);
-}
-
-void
-modest_ui_actions_on_header_selected (ModestHeaderView *header_view,
- TnyHeader *header,
- ModestMainWindow *main_window)
-{
- g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
- g_return_if_fail (MODEST_IS_HEADER_VIEW (header_view));
-
- /* in the case the folder is empty, show the empty folder message and focus
- * folder view */
- if (!header && gtk_widget_is_focus (GTK_WIDGET (header_view))) {
- if (modest_header_view_is_empty (header_view)) {
- TnyFolder *folder = modest_header_view_get_folder (header_view);
- GtkWidget *folder_view =
- modest_main_window_get_child_widget (main_window,
- MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
- if (folder != NULL) {
- modest_folder_view_select_folder (MODEST_FOLDER_VIEW (folder_view), folder, FALSE);
- g_object_unref (folder);
- }
- gtk_widget_grab_focus (GTK_WIDGET (folder_view));
- return;
- }
- }
- /* If no header has been selected then exit */
- if (!header)
- return;
-
- /* Update focus */
- if (!gtk_widget_is_focus (GTK_WIDGET(header_view)))
- gtk_widget_grab_focus (GTK_WIDGET(header_view));
-
- /* Update toolbar dimming state */
- modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (main_window));
- modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (main_window));
-}
-#endif
void
modest_ui_actions_on_header_activated (ModestHeaderView *header_view,
if (modest_platform_check_memory_low (MODEST_WINDOW(window), TRUE))
return;
-#ifndef MODEST_TOOLKIT_HILDON2
- GtkWidget *open_widget;
- if (MODEST_IS_MAIN_WINDOW (window)) {
- modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (window));
- open_widget = modest_window_get_action_widget (MODEST_WINDOW (window), "/MenuBar/EmailMenu/EmailOpenMenu");
- if (!GTK_WIDGET_IS_SENSITIVE (open_widget))
- return;
- }
-#endif
rowref = gtk_tree_row_reference_new (gtk_tree_view_get_model (GTK_TREE_VIEW (header_view)), path);
open_msg_from_header (header, rowref, MODEST_WINDOW (window));
gtk_tree_row_reference_free (rowref);
}
-#ifndef MODEST_TOOLKIT_HILDON2
-static void
-set_active_account_from_tny_account (TnyAccount *account,
- ModestWindow *window)
-{
- const gchar *server_acc_name = tny_account_get_id (account);
-
- /* We need the TnyAccount provided by the
- account store because that is the one that
- knows the name of the Modest account */
- TnyAccount *modest_server_account =
- modest_tny_account_store_get_tny_account_by (modest_runtime_get_account_store (),
- MODEST_TNY_ACCOUNT_STORE_QUERY_ID,
- server_acc_name);
- if (!modest_server_account) {
- g_warning ("%s: could not get tny account\n", __FUNCTION__);
- return;
- }
-
- /* Update active account, but only if it's not a pseudo-account */
- if ((!modest_tny_account_is_virtual_local_folders(modest_server_account)) &&
- (!modest_tny_account_is_memory_card_account(modest_server_account))) {
- const gchar *modest_acc_name =
- modest_tny_account_get_parent_modest_account_name_for_server_account (modest_server_account);
- if (modest_acc_name)
- modest_window_set_active_account (window, modest_acc_name);
- }
-
- g_object_unref (modest_server_account);
-}
-
-static void
-folder_refreshed_cb (ModestMailOperation *mail_op,
- TnyFolder *folder,
- gpointer user_data)
-{
- ModestMainWindow *win = NULL;
- GtkWidget *folder_view, *header_view;
- const GError *error;
-
- g_return_if_fail (TNY_IS_FOLDER (folder));
-
- win = MODEST_MAIN_WINDOW (user_data);
-
- /* Check if the operation failed due to memory low conditions */
- error = modest_mail_operation_get_error (mail_op);
- if (error && error->domain == MODEST_MAIL_OPERATION_ERROR &&
- error->code == MODEST_MAIL_OPERATION_ERROR_LOW_MEMORY) {
- modest_platform_run_information_dialog (GTK_WINDOW (win),
- _KR("memr_ib_operation_disabled"),
- TRUE);
- return;
- }
-
- folder_view =
- modest_main_window_get_child_widget(win, MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
- header_view =
- modest_main_window_get_child_widget(win, MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
-
- if (folder_view) {
- TnyFolderStore *current_folder;
-
- current_folder = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view));
- if (current_folder) {
- gboolean different = ((TnyFolderStore *) folder != current_folder);
- g_object_unref (current_folder);
- if (different)
- return;
- }
- }
-
- /* Check if folder is empty and set headers view contents style */
- if ((tny_folder_get_all_count (folder) == 0) ||
- modest_header_view_is_empty (MODEST_HEADER_VIEW (header_view)))
- modest_main_window_set_contents_style (win,
- MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY);
-}
-
-void
-modest_ui_actions_on_folder_selection_changed (ModestFolderView *folder_view,
- TnyFolderStore *folder_store,
- gboolean selected,
- ModestMainWindow *main_window)
-{
- GtkWidget *header_view;
-
- g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
-
- header_view = modest_main_window_get_child_widget(main_window,
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
- if (!header_view)
- return;
-
-
- if (TNY_IS_ACCOUNT (folder_store)) {
- if (selected) {
- set_active_account_from_tny_account (TNY_ACCOUNT (folder_store), MODEST_WINDOW (main_window));
-
- /* Show account details */
- modest_main_window_set_contents_style (main_window, MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS);
- }
- } else {
- if (TNY_IS_FOLDER (folder_store) && selected) {
- TnyAccount *account;
-
- /* Update the active account */
- account = modest_tny_folder_get_account (TNY_FOLDER (folder_store));
- if (account) {
- set_active_account_from_tny_account (account, MODEST_WINDOW (main_window));
- g_object_unref (account);
- account = NULL;
- }
-
- /* Set the header style by default, it could
- be changed later by the refresh callback to
- empty */
- modest_main_window_set_contents_style (main_window,
- MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
-
- /* Set folder on header view. This function
- will call tny_folder_refresh_async so we
- pass a callback that will be called when
- finished. We use that callback to set the
- empty view if there are no messages */
- modest_header_view_set_folder (MODEST_HEADER_VIEW(header_view),
- TNY_FOLDER (folder_store),
- TRUE,
- MODEST_WINDOW (main_window),
- folder_refreshed_cb,
- main_window);
-
- /* Restore configuration. We need to do this
- *after* the set_folder because the widget
- memory asks the header view about its
- folder */
- modest_widget_memory_restore (modest_runtime_get_conf (),
- G_OBJECT(header_view),
- MODEST_CONF_HEADER_VIEW_KEY);
- } else {
- /* No need to save the header view
- configuration for Maemo because it only
- saves the sorting stuff and that it's
- already being done by the sort
- dialog. Remove it when the GNOME version
- has the same behaviour */
-#ifdef MODEST_TOOLKIT_GTK
- if (modest_main_window_get_contents_style (main_window) ==
- MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS)
- modest_widget_memory_save (modest_runtime_get_conf (),
- G_OBJECT (header_view),
- MODEST_CONF_HEADER_VIEW_KEY);
-#endif
- modest_header_view_clear (MODEST_HEADER_VIEW(header_view));
- }
- }
-
- /* Update dimming state */
- modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (main_window));
- modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (main_window));
-}
-#endif
-
void
modest_ui_actions_on_item_not_found (ModestHeaderView *header_view,ModestItemType type,
ModestWindow *win)
ModestMsgEditWindow *edit_window;
/* TODO: in hildon 2 we have to dim and undim the header views while we're saving */
-#ifndef MODEST_TOOLKIT_HILDON2
- ModestMainWindow *win;
-
- /* FIXME. Make the header view sensitive again. This is a
- * temporary hack. See modest_ui_actions_on_save_to_drafts()
- * for details */
- win = MODEST_MAIN_WINDOW(modest_window_mgr_get_main_window(
- modest_runtime_get_window_mgr(), FALSE));
- if (win != NULL) {
- GtkWidget *hdrview = modest_main_window_get_child_widget(
- win, MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
- if (hdrview) gtk_widget_set_sensitive(hdrview, TRUE);
- }
-#endif
edit_window = MODEST_MSG_EDIT_WINDOW (user_data);
on_save_to_drafts_cb,
g_object_ref(edit_window));
-#ifdef MODEST_TOOLKIT_HILDON2
/* In hildon2 we always show the information banner on saving to drafts.
* It will be a system information banner in this case.
*/
gchar *text = g_strdup_printf (_("mail_va_saved_to_drafts"), _("mcen_me_folder_drafts"));
modest_platform_information_banner (NULL, NULL, text);
g_free (text);
-#else
- ModestMainWindow *win = NULL;
-
- /* Use the main window as the parent of the banner, if the
- main window does not exist it won't be shown, if the parent
- window exists then it's properly shown. We don't use the
- editor window because it could be closed (save to drafts
- could happen after closing the window */
- win = (ModestMainWindow *)
- modest_window_mgr_get_main_window( modest_runtime_get_window_mgr(), FALSE);
- if (win) {
- gchar *text = g_strdup_printf (_("mail_va_saved_to_drafts"), _("mcen_me_folder_drafts"));
- modest_platform_information_banner (GTK_WIDGET (win), NULL, text);
- g_free (text);
- }
-#endif
modest_msg_edit_window_set_modified (edit_window, FALSE);
/* Frees */
modest_msg_edit_window_free_msg_data (edit_window, data);
-#ifndef MODEST_TOOLKIT_HILDON2
- /* ** FIXME **
- * If the drafts folder is selected then make the header view
- * insensitive while the message is being saved to drafts
- * (it'll be sensitive again in on_save_to_drafts_cb()). This
- * is not very clean but it avoids letting the drafts folder
- * in an inconsistent state: the user could edit the message
- * being saved and undesirable things would happen.
- * In the average case the user won't notice anything at
- * all. In the worst case (the user is editing a really big
- * file from Drafts) the header view will be insensitive
- * during the saving process (10 or 20 seconds, depending on
- * the message). Anyway this is just a quick workaround: once
- * we find a better solution it should be removed
- * See NB#65125 (commend #18) for details.
- */
- if (!had_error && win != NULL) {
- ModestFolderView *view = MODEST_FOLDER_VIEW(modest_main_window_get_child_widget(
- win, MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW));
- if (view != NULL) {
- TnyFolder *folder = TNY_FOLDER(modest_folder_view_get_selected(view));
- if (folder) {
- if (modest_tny_folder_is_local_folder(folder)) {
- TnyFolderType folder_type;
- folder_type = modest_tny_folder_get_local_or_mmc_folder_type(folder);
- if (folder_type == TNY_FOLDER_TYPE_DRAFTS) {
- GtkWidget *hdrview = modest_main_window_get_child_widget(
- win, MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
- if (hdrview) gtk_widget_set_sensitive(hdrview, FALSE);
- }
- }
- }
- if (folder != NULL) g_object_unref(folder);
- }
- }
-#endif
return !had_error;
}
* FIXME: any other? */
GtkWidget *folder_view;
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW(source_win))
- folder_view =
- modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (source_win),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
- else
-#endif
folder_view = GTK_WIDGET(g_object_get_data (G_OBJECT (source_win),
MODEST_MOVE_TO_DIALOG_FOLDER_VIEW));
TnyFolderStore *parent_folder)
{
if (!parent_folder) {
-#ifdef MODEST_TOOLKIT_HILDON2
ModestTnyAccountStore *acc_store;
acc_store = modest_runtime_get_account_store ();
parent_folder = (TnyFolderStore *)
modest_tny_account_store_get_local_folders_account (acc_store);
-#else
- parent_folder = modest_folder_view_get_selected (MODEST_FOLDER_VIEW(folder_view));
-#endif
}
if (parent_folder) {
g_return_if_fail (MODEST_IS_WINDOW(window));
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (window)) {
- GtkWidget *folder_view;
-
- folder_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
- if (!folder_view)
- return;
-
- modest_ui_actions_create_folder (GTK_WIDGET (window), folder_view, NULL);
-#else
if (MODEST_IS_FOLDER_WINDOW (window)) {
GtkWidget *folder_view;
folder_view = GTK_WIDGET (modest_folder_window_get_folder_view (MODEST_FOLDER_WINDOW (window)));
modest_ui_actions_create_folder (GTK_WIDGET (window), folder_view, NULL);
-#endif
} else {
g_assert_not_reached ();
}
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW(parent_window)) {
-
- folder_view = modest_main_window_get_child_widget (
- MODEST_MAIN_WINDOW (parent_window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
- }
-#else
if (MODEST_IS_FOLDER_WINDOW (parent_window)) {
ModestFolderWindow *folder_window = (ModestFolderWindow *) parent_window;
folder_view = GTK_WIDGET (modest_folder_window_get_folder_view (folder_window));
}
-#endif
/* Clear the folders view */
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_view));
g_return_val_if_fail (MODEST_IS_WINDOW(window), FALSE);
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (window)) {
- folder_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
- if (!folder_view)
- return FALSE;
-#else
if (MODEST_IS_FOLDER_WINDOW (window)) {
folder_view = GTK_WIDGET (modest_folder_window_get_folder_view (MODEST_FOLDER_WINDOW (window)));
-#endif
} else {
return FALSE;
}
return;
}
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (parent_window)) {
- folder_view = modest_main_window_get_child_widget (
- MODEST_MAIN_WINDOW (parent_window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
-#else
if (MODEST_IS_FOLDER_WINDOW (parent_window)) {
folder_view = GTK_WIDGET (modest_folder_window_get_folder_view (MODEST_FOLDER_WINDOW (parent_window)));
-#endif
} else {
g_object_unref (G_OBJECT (info->folder));
g_free (info);
g_return_val_if_fail (MODEST_IS_WINDOW(window), FALSE);
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (window)) {
-
- folder_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
-#else
if (MODEST_IS_FOLDER_WINDOW (window)) {
folder_view = GTK_WIDGET (modest_folder_window_get_folder_view (MODEST_FOLDER_WINDOW (window)));
-#endif
} else {
return FALSE;
}
return delete_folder (window, FALSE);
}
-#ifndef MODEST_TOOLKIT_HILDON2
-void
-modest_ui_actions_on_move_folder_to_trash_folder (GtkAction *action, ModestMainWindow *main_window)
-{
- g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
-
- delete_folder (MODEST_WINDOW (main_window), TRUE);
-}
-#endif
typedef struct _PasswordDialogFields {
GtkWidget *username;
if (cancel)
*cancel = FALSE;
} else {
-#ifndef MODEST_TOOLKIT_HILDON2
- /* Set parent to NULL or the banner will disappear with its parent dialog */
- modest_platform_information_banner(NULL, NULL, _("mail_ib_login_cancelled"));
-#endif
completed = TRUE;
if (username)
*username = NULL;
case GTK_RESPONSE_OK:
dst_folder = modest_folder_view_get_selected (folder_view);
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (parent_win)) {
- /* Clean list to move used for filtering */
- modest_folder_view_set_list_to_move (folder_view, NULL);
-
- modest_ui_actions_on_main_window_move_to (NULL,
- GTK_WIDGET (folder_view),
- dst_folder,
- MODEST_MAIN_WINDOW (parent_win));
-#else
if (MODEST_IS_FOLDER_WINDOW (parent_win)) {
/* Clean list to move used for filtering */
modest_folder_view_set_list_to_move (folder_view, NULL);
dst_folder,
helper->list,
GTK_WINDOW (parent_win));
-#endif
} else {
/* if the user selected a root folder
(account) then do not perform any action */
dialog = modest_platform_create_move_to_dialog (win, &tree_view);
-#ifndef MODEST_TOOLKIT_HILDON2
- /* Track changes in the selection to
- * disable the OK button whenever "Move to" is not possible
- * disbale NEW button whenever New is not possible */
- g_signal_connect (tree_view,
- "folder_selection_changed",
- G_CALLBACK (on_move_to_dialog_folder_selection_changed),
- win);
-#endif
/* It could happen that we're trying to move a message from a
window (msg window for example) after the main window was
if (!top_window)
return;
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (top_window)) {
- header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (top_window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
- }
-#else
if (MODEST_IS_HEADER_WINDOW (top_window)) {
header_view = (GtkWidget *)
modest_header_window_get_header_view (MODEST_HEADER_WINDOW (top_window));
}
-#endif
/* Get selected folder */
if (header_view)
ModestProtocol *protocol;
TnyHeader *header = NULL;
-#ifndef MODEST_TOOLKIT_HILDON2
- if (MODEST_IS_MAIN_WINDOW (win)) {
- GtkWidget *header_view;
- TnyList* headers = NULL;
- TnyIterator *iter;
- header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(win),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
- headers = modest_header_view_get_selected_headers (MODEST_HEADER_VIEW (header_view));
- if (!headers || tny_list_get_length (headers) == 0) {
- if (headers)
- g_object_unref (headers);
- return NULL;
- }
- iter = tny_list_create_iterator (headers);
- header = TNY_HEADER (tny_iterator_get_current (iter));
- folder = TNY_FOLDER_STORE (tny_header_get_folder (header));
- g_object_unref (iter);
- g_object_unref (headers);
-#else
if (MODEST_IS_HEADER_WINDOW (win)) {
GtkWidget *header_view;
TnyList* headers = NULL;
}
g_object_unref (iter);
g_object_unref (headers);
-#endif
} else if (MODEST_IS_MSG_VIEW_WINDOW (win)) {
header = modest_msg_view_window_get_header (MODEST_MSG_VIEW_WINDOW (win));
if (header)
modest-compact-mail-header-view.h \
modest-connection-specific-smtp-window.h \
modest-connection-specific-smtp-window.c \
+ modest-connection-specific-smtp-edit-window.h \
+ modest-connection-specific-smtp-edit-window.c \
modest-country-combo-box.c \
modest-country-combo-box.h \
modest-default-account-settings-dialog.h \
--- /dev/null
+/* Copyright (c) 2006, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "modest-connection-specific-smtp-edit-window.h"
+#include "widgets/modest-ui-constants.h"
+#include "modest-runtime.h"
+
+#include "widgets/modest-validating-entry.h"
+#include <modest-scrollable.h>
+#include <modest-ui-constants.h>
+#include <gtk/gtkbutton.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtkstock.h>
+#include "modest-text-utils.h"
+#include <modest-toolkit-factory.h>
+#include <modest-toolkit-utils.h>
+
+#ifdef MODEST_TOOLKIT_HILDON2
+#include <hildon/hildon.h>
+#endif
+
+#include <glib/gi18n.h>
+
+#define PORT_RANGE_MIN 1
+#define PORT_RANGE_MAX 65535
+
+G_DEFINE_TYPE (ModestConnectionSpecificSmtpEditWindow, modest_connection_specific_smtp_edit_window, GTK_TYPE_DIALOG);
+
+#define CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW, ModestConnectionSpecificSmtpEditWindowPrivate))
+
+static void on_response (GtkDialog *dialog,
+ gint arg1,
+ gpointer user_data);
+
+typedef struct _ModestConnectionSpecificSmtpEditWindowPrivate ModestConnectionSpecificSmtpEditWindowPrivate;
+
+struct _ModestConnectionSpecificSmtpEditWindowPrivate
+{
+ GtkWidget *entry_outgoingserver;
+ GtkWidget *outgoing_auth_selector;
+ GtkWidget *entry_user_username;
+ GtkWidget *entry_user_password;
+ GtkWidget *outgoing_security_selector;
+ GtkWidget *entry_port;
+
+ GtkWidget *button_ok;
+ GtkWidget *button_cancel;
+
+ gchar *account_name;
+
+ gboolean is_dirty;
+ gboolean range_error_occured;
+};
+
+static void
+modest_connection_specific_smtp_edit_window_get_property (GObject *object, guint property_id,
+ GValue *value, GParamSpec *pspec)
+{
+ switch (property_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+modest_connection_specific_smtp_edit_window_set_property (GObject *object, guint property_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ switch (property_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+modest_connection_specific_smtp_edit_window_dispose (GObject *object)
+{
+
+
+ if (G_OBJECT_CLASS (modest_connection_specific_smtp_edit_window_parent_class)->dispose)
+ G_OBJECT_CLASS (modest_connection_specific_smtp_edit_window_parent_class)->dispose (object);
+}
+
+static void
+modest_connection_specific_smtp_edit_window_finalize (GObject *object)
+{
+ ModestConnectionSpecificSmtpEditWindow *self = (ModestConnectionSpecificSmtpEditWindow *) object;
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv =
+ CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
+
+ if (priv->account_name) {
+ g_free (priv->account_name);
+ priv->account_name = NULL;
+ }
+ G_OBJECT_CLASS (modest_connection_specific_smtp_edit_window_parent_class)->finalize (object);
+}
+
+static void
+modest_connection_specific_smtp_edit_window_class_init (ModestConnectionSpecificSmtpEditWindowClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (ModestConnectionSpecificSmtpEditWindowPrivate));
+
+ object_class->get_property = modest_connection_specific_smtp_edit_window_get_property;
+ object_class->set_property = modest_connection_specific_smtp_edit_window_set_property;
+ object_class->dispose = modest_connection_specific_smtp_edit_window_dispose;
+ object_class->finalize = modest_connection_specific_smtp_edit_window_finalize;
+}
+
+enum MODEL_COLS {
+ MODEL_COL_NAME = 0,
+ MODEL_COL_SERVER_NAME = 1,
+ MODEL_COL_ID = 2
+};
+
+static void
+on_change(GtkWidget* widget, ModestConnectionSpecificSmtpEditWindow *self)
+{
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv =
+ CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
+ priv->is_dirty = TRUE;
+}
+
+static void
+on_mandatory_entry_changed (GtkWidget* widget, ModestConnectionSpecificSmtpEditWindow *self)
+{
+ const gchar *text;
+ gboolean sensitive = TRUE;
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv;
+ ModestProtocolType auth_proto;
+
+ priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
+
+ /* Check all mandatory entries */
+ on_change (widget, self);
+
+ auth_proto = modest_secureauth_selector_get_active_secureauth (priv->outgoing_auth_selector);
+ if (modest_protocol_registry_protocol_type_is_secure (modest_runtime_get_protocol_registry (),
+ auth_proto)) {
+ text = modest_entry_get_text (priv->entry_user_username);
+ if (!text || (strlen(text) == 0))
+ sensitive = FALSE;
+ }
+
+ text = modest_entry_get_text (priv->entry_outgoingserver);
+ if (!text || (strlen(text) == 0))
+ sensitive = FALSE;
+
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, sensitive);
+}
+
+
+static void
+on_value_changed(GtkWidget* widget, GValue* value, ModestConnectionSpecificSmtpEditWindow *self)
+{
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv =
+ CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
+
+ priv->range_error_occured = FALSE;
+ on_change(widget, self);
+}
+
+#ifdef MODEST_TOOLKIT_HILDON2
+static gboolean
+on_range_error (GtkWidget *widget, ModestNumberEditorErrorType type, gpointer user_data)
+{
+ gchar *msg;
+ ModestConnectionSpecificSmtpEditWindow *self = user_data;
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv =
+ CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
+
+ /* We want to prevent the closure of the dialog when a range error occured. The problem is that
+ * the hildon number editor already resets the value to the default value, so we have to
+ * remember that such an error occured. */
+ priv->range_error_occured = TRUE;
+
+ if (type == MODEST_NUMBER_EDITOR_ERROR_MAXIMUM_VALUE_EXCEED) {
+ msg = g_strdup_printf (dgettext ("hildon-libs", "ckct_ib_maximum_value"), 65535);
+ } else if (type == MODEST_NUMBER_EDITOR_ERROR_MINIMUM_VALUE_EXCEED) {
+ msg = g_strdup_printf (dgettext ("hildon-libs", "ckct_ib_minimum_value"), 1);
+ } else {
+ msg = g_strdup_printf (_HL("ckct_ib_set_a_value_within_range"), PORT_RANGE_MIN, PORT_RANGE_MAX);
+ }
+ modest_platform_information_banner (widget, NULL, msg);
+ g_free (msg);
+
+ /* Show error message by not returning TRUE */
+ return TRUE;
+}
+#endif
+
+static gboolean
+on_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ ModestConnectionSpecificSmtpEditWindow *self = user_data;
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv =
+ CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
+
+ /* If it's dirty, them the response method already asked the
+ user, because it's always executed before (see GtkDialog
+ code). If it's not then simply close */
+ return priv->is_dirty;
+}
+
+static void
+on_response (GtkDialog *dialog, int response_id, gpointer user_data)
+{
+ const gchar *hostname;
+ ModestConnectionSpecificSmtpEditWindow *self = user_data;
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv =
+ CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
+
+ hostname = modest_entry_get_text (priv->entry_outgoingserver);
+
+ /* Don't close the dialog if a range error occured */
+ if(response_id == GTK_RESPONSE_OK && priv->range_error_occured)
+ {
+ priv->range_error_occured = FALSE;
+ g_signal_stop_emission_by_name (dialog, "response");
+ gtk_widget_grab_focus (priv->entry_port);
+ return;
+ }
+
+ /* Don't close the dialog if a range error occured */
+ if (response_id == GTK_RESPONSE_OK) {
+ if (hostname && (hostname[0] != '\0') &&
+ (!modest_text_utils_validate_domain_name (hostname))) {
+ g_signal_stop_emission_by_name (dialog, "response");
+ modest_platform_system_banner (NULL, NULL, _("mcen_ib_invalid_servername"));
+ gtk_widget_grab_focus (priv->entry_outgoingserver);
+ gtk_editable_select_region (GTK_EDITABLE (priv->entry_outgoingserver), 0, -1);
+ return;
+ }
+ } else {
+ /* Ask user if they want to discard changes */
+ if (priv->is_dirty) {
+ gint response;
+ response = modest_platform_run_confirmation_dialog (GTK_WINDOW (user_data),
+ _("imum_nc_wizard_confirm_lose_changes"));
+
+ if (response != GTK_RESPONSE_OK)
+ g_signal_stop_emission_by_name (dialog, "response");
+ }
+ }
+}
+
+static void
+on_set_focus_child (GtkContainer *container, GtkWidget *widget, gpointer user_data)
+{
+ ModestConnectionSpecificSmtpEditWindow *self = user_data;
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv =
+ CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
+
+ /* Another child gained focus. Since the number editor already reset a
+ * possible range error to the default value, we allow closure of the
+ * dialog */
+ priv->range_error_occured = FALSE;
+}
+
+static void
+security_selector_set_port (ModestConnectionSpecificSmtpEditWindowPrivate *priv)
+{
+ const gint port_number =
+ modest_serversecurity_selector_get_active_serversecurity_port (priv->outgoing_security_selector);
+
+ if(port_number != 0) {
+ modest_number_entry_set_value (
+ priv->entry_port, port_number);
+ }
+}
+
+static void
+on_security_selector_changed (GtkWidget *widget, gpointer user_data)
+{
+ ModestConnectionSpecificSmtpEditWindow *self =
+ MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW (user_data);
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv =
+ CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
+
+ on_change(GTK_WIDGET(widget), self);
+
+ /* Enable/disable username and password fields */
+ security_selector_set_port (priv);
+}
+
+static void
+auth_selector_set_sensitive (ModestConnectionSpecificSmtpEditWindowPrivate *priv)
+{
+ ModestProtocolType auth_proto;
+
+ auth_proto =
+ modest_secureauth_selector_get_active_secureauth (priv->outgoing_auth_selector);
+
+ if (auth_proto == modest_protocol_registry_get_none_auth_type_id ()) {
+ gtk_widget_set_sensitive (priv->entry_user_username, FALSE);
+ gtk_widget_set_sensitive (priv->entry_user_password, FALSE);
+ } else {
+ gtk_widget_set_sensitive (priv->entry_user_username, TRUE);
+ gtk_widget_set_sensitive (priv->entry_user_password, TRUE);
+ }
+
+}
+
+static void
+on_auth_selector_changed (GtkWidget *widget, gpointer user_data)
+{
+ ModestConnectionSpecificSmtpEditWindow *self;
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv;
+
+ self = MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW (user_data);
+ priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
+
+ on_change (GTK_WIDGET(widget), self);
+
+ /* Enable/disable username and password fields */
+ auth_selector_set_sensitive (priv);
+
+ /* Check missing mandatory data */
+ on_mandatory_entry_changed (priv->entry_user_username, self);
+}
+
+static void
+modest_connection_specific_smtp_edit_window_init (ModestConnectionSpecificSmtpEditWindow *self)
+{
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv;
+ GtkWidget *dialog_box;
+ GtkWidget *scrollable, *vbox, *align;
+ gchar *server_label;
+
+ /* The title of this dialog is quite long, so make the window wide enough */
+ gtk_widget_set_size_request (GTK_WIDGET (self), 600, 320);
+
+ priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (self);
+ dialog_box = GTK_DIALOG(self)->vbox; /* gtk_vbox_new (FALSE, MODEST_MARGIN_HALF); */
+ gtk_box_set_spacing (GTK_BOX (dialog_box), MODEST_MARGIN_NONE);
+
+ vbox = gtk_vbox_new (FALSE, 0);
+ 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);
+
+ /* Create a size group to be used by all captions.
+ * Note that HildonCaption does not create a default size group if we do not specify one.
+ * We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
+ GtkSizeGroup *title_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+ GtkSizeGroup *value_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+
+ /* The outgoing server widgets: */
+ if (!priv->entry_outgoingserver)
+ priv->entry_outgoingserver = modest_toolkit_factory_create_entry (modest_runtime_get_toolkit_factory ());
+ /* Auto-capitalization is the default, so let's turn it off: */
+#ifdef MAEMO_CHANGES
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_outgoingserver), HILDON_GTK_INPUT_MODE_FULL);
+#endif
+ g_signal_connect(G_OBJECT(priv->entry_outgoingserver), "changed", G_CALLBACK(on_mandatory_entry_changed), self);
+
+ server_label = g_strconcat (_("mcen_li_emailsetup_smtp"), "\n<small>(SMTP)</small>", NULL);
+
+ GtkWidget *captioned =
+ modest_toolkit_utils_create_captioned (title_sizegroup, value_sizegroup,
+ server_label, TRUE,
+ priv->entry_outgoingserver);
+ g_free (server_label);
+ gtk_widget_show (priv->entry_outgoingserver);
+ gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, 0);
+ gtk_widget_show (captioned);
+
+ /* The secure authentication widgets: */
+ if (!priv->outgoing_auth_selector) {
+ priv->outgoing_auth_selector =
+ modest_toolkit_factory_create_secureauth_selector (modest_runtime_get_toolkit_factory ());
+ }
+ if (GTK_IS_COMBO_BOX (priv->outgoing_auth_selector)) {
+ GtkWidget *captioned;
+ captioned = modest_toolkit_utils_create_captioned (title_sizegroup, value_sizegroup,
+ _("mcen_li_emailsetup_secure_authentication"), FALSE,
+ priv->outgoing_auth_selector);
+ gtk_widget_show (captioned);
+ gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, 0);
+ } else {
+ modest_toolkit_utils_set_hbutton_layout (title_sizegroup, value_sizegroup,
+ _("mcen_li_emailsetup_secure_authentication"),
+ priv->outgoing_auth_selector);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->outgoing_auth_selector, FALSE, FALSE, 0);
+ }
+ gtk_widget_show (priv->outgoing_auth_selector);
+
+ /* The username widgets: */
+ priv->entry_user_username = GTK_WIDGET (modest_validating_entry_new ());
+ /* Auto-capitalization is the default, so let's turn it off: */
+#ifdef MAEMO_CHANGES
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_user_username), HILDON_GTK_INPUT_MODE_FULL);
+#endif
+ captioned = modest_toolkit_utils_create_captioned (title_sizegroup, value_sizegroup,
+ _("mail_fi_username"), FALSE,
+ priv->entry_user_username);
+ g_signal_connect(G_OBJECT(priv->entry_user_username), "changed", G_CALLBACK(on_mandatory_entry_changed), self);
+ gtk_widget_show (priv->entry_user_username);
+ gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, 0);
+ gtk_widget_show (captioned);
+
+ /* Prevent the use of some characters in the username,
+ * as required by our UI specification: */
+ modest_validating_entry_set_unallowed_characters_whitespace (
+ MODEST_VALIDATING_ENTRY (priv->entry_user_username));
+
+ /* Set max length as in the UI spec:
+ * TODO: The UI spec seems to want us to show a dialog if we hit the maximum. */
+ gtk_entry_set_max_length (GTK_ENTRY (priv->entry_user_username), 64);
+
+ /* The password widgets: */
+ priv->entry_user_password = modest_toolkit_factory_create_entry (modest_runtime_get_toolkit_factory ());
+ /* Auto-capitalization is the default, so let's turn it off: */
+#ifdef MAEMO_CHANGES
+ hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_user_password),
+ HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE);
+#endif
+ gtk_entry_set_visibility (GTK_ENTRY (priv->entry_user_password), FALSE);
+ /* gtk_entry_set_invisible_char (GTK_ENTRY (priv->entry_user_password), '*'); */
+ captioned = modest_toolkit_utils_create_captioned (title_sizegroup, value_sizegroup,
+ _("mail_fi_password"), FALSE, priv->entry_user_password);
+ g_signal_connect(G_OBJECT(priv->entry_user_password), "changed", G_CALLBACK(on_change), self);
+ gtk_widget_show (priv->entry_user_password);
+ gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, 0);
+ gtk_widget_show (captioned);
+
+ /* The secure connection widgets: */
+ if (!priv->outgoing_security_selector)
+ priv->outgoing_security_selector =
+ modest_toolkit_factory_create_serversecurity_selector (modest_runtime_get_toolkit_factory ());
+ modest_serversecurity_selector_fill (priv->outgoing_security_selector, MODEST_PROTOCOLS_TRANSPORT_SMTP);
+ modest_serversecurity_selector_set_active_serversecurity (priv->outgoing_security_selector, MODEST_PROTOCOLS_CONNECTION_NONE);
+ if (GTK_IS_COMBO_BOX (priv->outgoing_security_selector)) {
+ GtkWidget *captioned;
+
+ captioned = modest_toolkit_utils_create_captioned (title_sizegroup, value_sizegroup,
+ _("mcen_li_emailsetup_secure_connection"), FALSE,
+ priv->outgoing_security_selector);
+ gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, MODEST_MARGIN_HALF);
+ gtk_widget_show (captioned);
+ } else {
+ modest_toolkit_utils_set_hbutton_layout (title_sizegroup, value_sizegroup,
+ _("mcen_li_emailsetup_secure_connection"),
+ priv->outgoing_security_selector);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->outgoing_security_selector, FALSE, FALSE, 0);
+ }
+ gtk_widget_show (priv->outgoing_security_selector);
+
+ /* The port number widgets: */
+ if (!priv->entry_port)
+ priv->entry_port = modest_toolkit_factory_create_number_entry (modest_runtime_get_toolkit_factory (),
+ PORT_RANGE_MIN, PORT_RANGE_MAX);
+ captioned = modest_toolkit_utils_create_captioned (title_sizegroup, value_sizegroup,
+ _("mcen_fi_emailsetup_port"), FALSE, priv->entry_port);
+ gtk_widget_add_events(GTK_WIDGET(priv->entry_port), GDK_FOCUS_CHANGE_MASK);
+ gtk_widget_show (priv->entry_port);
+ gtk_box_pack_start (GTK_BOX (vbox), captioned, FALSE, FALSE, 0);
+ gtk_widget_show (captioned);
+
+ /* Add the button. Disabled by default */
+ gtk_dialog_add_button (GTK_DIALOG (self), _HL("wdgt_bd_save"), GTK_RESPONSE_OK);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, FALSE);
+
+ priv->is_dirty = FALSE;
+ priv->range_error_occured = FALSE;
+ g_signal_connect(G_OBJECT(self), "response", G_CALLBACK(on_response), self);
+ g_signal_connect(G_OBJECT(self), "delete-event", G_CALLBACK(on_delete_event), self);
+ g_signal_connect(G_OBJECT(vbox), "set-focus-child", G_CALLBACK(on_set_focus_child), self);
+
+ priv->account_name = NULL;
+
+ scrollable = modest_toolkit_factory_create_scrollable (modest_runtime_get_toolkit_factory ());
+ gtk_container_add (GTK_CONTAINER (align), vbox);
+ modest_scrollable_add_with_viewport (MODEST_SCROLLABLE (scrollable), align);
+ gtk_box_pack_start (GTK_BOX (dialog_box), scrollable, TRUE, TRUE, 0);
+
+ gtk_widget_show_all (dialog_box);
+ gtk_window_set_default_size (GTK_WINDOW (self), -1, MODEST_DIALOG_WINDOW_MAX_HEIGHT);
+
+ g_object_unref (title_sizegroup);
+ g_object_unref (value_sizegroup);
+
+ /* When this window is shown, hibernation should not be possible,
+ * because there is no sensible way to save the state: */
+ modest_window_mgr_prevent_hibernation_while_window_is_shown (
+ modest_runtime_get_window_mgr (), GTK_WINDOW (self));
+
+ /* Refresh view with current settings */
+ auth_selector_set_sensitive (priv);
+ security_selector_set_port (priv);
+
+ /* Connect signals to track changes */
+ if (GTK_IS_COMBO_BOX (priv->outgoing_security_selector)) {
+ g_signal_connect (G_OBJECT (priv->outgoing_security_selector),
+ "changed",
+ (GCallback) on_security_selector_changed,
+ self);
+ } else {
+ g_signal_connect (G_OBJECT (priv->outgoing_security_selector),
+ "value-changed",
+ (GCallback) on_security_selector_changed,
+ self);
+ }
+ if (GTK_IS_COMBO_BOX (priv->outgoing_auth_selector)) {
+ g_signal_connect (G_OBJECT (priv->outgoing_auth_selector),
+ "changed",
+ (GCallback) on_auth_selector_changed,
+ self);
+ } else {
+ g_signal_connect (G_OBJECT (priv->outgoing_auth_selector),
+ "value-changed",
+ (GCallback) on_auth_selector_changed,
+ self);
+ }
+#ifdef MODEST_TOOLKIT_HILDON2
+ g_signal_connect(G_OBJECT(priv->entry_port),
+ "range-error",
+ G_CALLBACK(on_range_error),
+ self);
+#endif
+ g_signal_connect(G_OBJECT(priv->entry_port),
+ "notify::value",
+ G_CALLBACK(on_value_changed),
+ self);
+
+}
+
+ModestConnectionSpecificSmtpEditWindow*
+modest_connection_specific_smtp_edit_window_new (void)
+{
+ return g_object_new (MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW, NULL);
+}
+
+void
+modest_connection_specific_smtp_edit_window_set_connection (
+ ModestConnectionSpecificSmtpEditWindow *window, const gchar* iap_id, const gchar* iap_name,
+ ModestServerAccountSettings *server_settings)
+{
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv =
+ CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (window);
+
+ /* This causes a warning because of the %s in the translation, but not in the original string: */
+ gchar* title = g_strdup_printf (_("mcen_ti_connection_connection_name"), iap_name);
+ gtk_window_set_title (GTK_WINDOW (window), title);
+ g_free (title);
+
+ if (server_settings)
+ {
+ /* Setting known values */
+ if (priv->account_name)
+ g_free (priv->account_name);
+ priv->account_name = g_strdup (modest_server_account_settings_get_account_name (server_settings));
+ modest_entry_set_text (priv->entry_outgoingserver,
+ modest_server_account_settings_get_hostname (server_settings));
+ modest_entry_set_text (priv->entry_user_username,
+ modest_server_account_settings_get_username (server_settings));
+ modest_entry_set_text (priv->entry_user_password,
+ modest_server_account_settings_get_password (server_settings));
+
+ modest_serversecurity_selector_set_active_serversecurity
+ (priv->outgoing_security_selector,
+ modest_server_account_settings_get_security_protocol (server_settings));
+
+ modest_secureauth_selector_set_active_secureauth (priv->outgoing_auth_selector,
+ modest_server_account_settings_get_auth_protocol (server_settings));
+
+ /* port: */
+ modest_number_entry_set_value (
+ priv->entry_port,
+ modest_server_account_settings_get_port (server_settings));
+
+
+ /* This will cause changed signals so we set dirty back to FALSE */
+ priv->is_dirty = FALSE;
+ }
+}
+
+ModestServerAccountSettings*
+modest_connection_specific_smtp_edit_window_get_settings (ModestConnectionSpecificSmtpEditWindow *window)
+{
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv = NULL;
+ ModestServerAccountSettings *server_settings = NULL;
+ const gchar *outgoing_server = NULL;
+
+ priv = CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (window);
+ outgoing_server = modest_entry_get_text (priv->entry_outgoingserver);
+
+ /* If the outgoing server is NULL, we are removing the connection specific
+ * settings */
+ if ((outgoing_server == NULL) || (outgoing_server[0] == '\0')) {
+ return NULL;
+ }
+
+ server_settings = modest_server_account_settings_new ();
+
+ modest_server_account_settings_set_hostname (server_settings,
+ modest_entry_get_text (priv->entry_outgoingserver));
+ modest_server_account_settings_set_protocol (server_settings,
+ MODEST_PROTOCOLS_TRANSPORT_SMTP);
+ modest_server_account_settings_set_username (server_settings,
+ modest_entry_get_text (priv->entry_user_username));
+ modest_server_account_settings_set_password (server_settings,
+ modest_entry_get_text (priv->entry_user_password));
+
+ modest_server_account_settings_set_security_protocol (server_settings,
+ modest_serversecurity_selector_get_active_serversecurity (
+ priv->outgoing_security_selector));
+ modest_server_account_settings_set_auth_protocol
+ (server_settings,
+ modest_secureauth_selector_get_active_secureauth (priv->outgoing_auth_selector));
+ modest_server_account_settings_set_account_name (server_settings,
+ priv->account_name);
+
+ /* port: */
+ modest_server_account_settings_set_port (server_settings,
+ modest_number_entry_get_value (priv->entry_port));
+
+ return server_settings;
+}
+
+gboolean
+modest_connection_specific_smtp_edit_window_is_dirty(ModestConnectionSpecificSmtpEditWindow *window)
+{
+ ModestConnectionSpecificSmtpEditWindowPrivate *priv =
+ CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_PRIVATE (window);
+
+ return priv->is_dirty;
+}
--- /dev/null
+/* Copyright (c) 2006, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __MODEST_MAEMO_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW
+#define __MODEST_MAEMO_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW
+
+#include <gtk/gtkdialog.h>
+#include <gtk/gtktreeview.h>
+#include <modest-server-account-settings.h>
+
+G_BEGIN_DECLS
+
+#define MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW modest_connection_specific_smtp_edit_window_get_type()
+
+#define MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW, ModestConnectionSpecificSmtpEditWindow))
+
+#define MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW, ModestConnectionSpecificSmtpEditWindowClass))
+
+#define MODEST_IS_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW))
+
+#define MODEST_IS_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW))
+
+#define MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW, ModestConnectionSpecificSmtpEditWindowClass))
+
+typedef struct {
+ GtkDialog parent;
+
+} ModestConnectionSpecificSmtpEditWindow;
+
+typedef struct {
+ GtkDialogClass parent_class;
+} ModestConnectionSpecificSmtpEditWindowClass;
+
+GType modest_connection_specific_smtp_edit_window_get_type (void);
+
+ModestConnectionSpecificSmtpEditWindow* modest_connection_specific_smtp_edit_window_new (void);
+
+void modest_connection_specific_smtp_edit_window_set_connection (
+ ModestConnectionSpecificSmtpEditWindow *window, const gchar* iap_id, const gchar* iap_name,
+ ModestServerAccountSettings *server_settings);
+
+ModestServerAccountSettings* modest_connection_specific_smtp_edit_window_get_settings (
+ ModestConnectionSpecificSmtpEditWindow *window);
+
+gboolean modest_connection_specific_smtp_edit_window_is_dirty(
+ ModestConnectionSpecificSmtpEditWindow *window);
+
+G_END_DECLS
+
+#endif /* __MODEST_MAEMO_CONNECTION_SPECIFIC_SMTP_WINDOW */
#include <gtk/gtkliststore.h>
#include <modest-scrollable.h>
#include <modest-toolkit-factory.h>
-#include <hildon/hildon-gtk.h>
#include <gtk/gtkbutton.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkstock.h>
-#include "modest-hildon-includes.h"
#include "modest-platform.h"
-#include "modest-maemo-utils.h"
+
+#ifdef MODEST_TOOLKIT_HILDON2
+#include <hildon/hildon.h>
+#endif
#include <glib/gi18n.h>
#include <string.h>
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER));
/* Setup the tree view: */
+#ifdef MODEST_TOOLKIT_HILDON2
priv->treeview = GTK_TREE_VIEW (hildon_gtk_tree_view_new_with_model (HILDON_UI_MODE_NORMAL, priv->model));
+#else
+ priv->treeview = GTK_TREE_VIEW (gtk_tree_view_new_with_model (priv->model));
+#endif
g_object_ref_sink (G_OBJECT (priv->treeview));
/* No connections label */