2007-04-05 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Thu, 5 Apr 2007 09:58:33 +0000 (09:58 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Thu, 5 Apr 2007 09:58:33 +0000 (09:58 +0000)
* src/Makefile.am: Change sequence of sub-libraries, which fixed an undefined symbol
        error for me.

        * src/maemo/Makefile.am:
        * src/maemo/modest-connection-specific-smtp-window.c:
        * src/maemo/modest-connection-specific-smtp-window.h:
        New window for showing the list of connections, for connection-specific
        SMTP servers. Not fully implemented, because it needs an enhancement to TnyMaemoDevice.
        * src/maemo/easysetup/modest-easysetup-wizard.c:
        (create_page_custom_outgoing): Show the new window when the button is clicked.

pmo-trunk-r1510

ChangeLog2
src/Makefile.am
src/maemo/Makefile.am
src/maemo/easysetup/modest-easysetup-wizard.c
src/maemo/modest-connection-specific-smtp-window.c [new file with mode: 0644]
src/maemo/modest-connection-specific-smtp-window.h [new file with mode: 0644]

index df58198..564c372 100644 (file)
@@ -1,3 +1,16 @@
+2007-04-05  Murray Cumming  <murrayc@murrayc.com>
+
+       * src/Makefile.am: Change sequence of sub-libraries, which fixed an undefined symbol 
+       error for me.
+       
+       * src/maemo/Makefile.am:
+       * src/maemo/modest-connection-specific-smtp-window.c:
+       * src/maemo/modest-connection-specific-smtp-window.h:
+       New window for showing the list of connections, for connection-specific 
+       SMTP servers. Not fully implemented, because it needs an enhancement to TnyMaemoDevice.
+       * src/maemo/easysetup/modest-easysetup-wizard.c:
+       (create_page_custom_outgoing): Show the new window when the button is clicked.
+
 2007-04-04  Murray Cumming  <murrayc@murrayc.com>
 
        * src/maemo/easysetup/modest-easysetup-wizard.c: (create_account):
index 44cb025..9c45d4c 100644 (file)
@@ -89,8 +89,8 @@ modest_LDADD =                                                \
        $(MODEST_GSTUFF_LIBS)                           \
        $(MODEST_LIBTINYMAIL_GNOME_DESKTOP_LIBS)        \
        $(MODEST_LIBTINYMAIL_MAEMO_LIBS)                \
-       $(MODEST_PLATFORM)/libmodest-ui.la              \
        $(MODEST_PLATFORM)/easysetup/libmodest-easysetup.la             \
+       $(MODEST_PLATFORM)/libmodest-ui.la              \
        widgets/libmodest-widgets.la                    
 
 EXTRA_DIST=modest-marshal.list
index 269191f..13376d7 100644 (file)
@@ -59,7 +59,8 @@ libmodest_ui_la_SOURCES=              \
        modest-account-assistant.c    \
        modest-account-assistant.h    \
        modest-maemo-utils.c          \
-       modest-maemo-utils.h
+       modest-connection-specific-smtp-window.h          \
+       modest-connection-specific-smtp-window.c
 
 LDADD = \
        $(MODEST_GSTUFF_LIBS) \
index e2f523b..c168b55 100644 (file)
 #include <gtk/gtkcheckbutton.h>
 #include <gtk/gtkmessagedialog.h>
 #include <hildon-widgets/hildon-caption.h>
-#include "modest-easysetup-country-combo-box.h"
-#include "modest-easysetup-provider-combo-box.h"
-#include "modest-easysetup-servertype-combo-box.h"
-#include "modest-easysetup-serversecurity-combo-box.h"
-#include "modest-easysetup-secureauth-combo-box.h"
-#include "modest-validating-entry.h"
+#include "maemo/easysetup/modest-easysetup-country-combo-box.h"
+#include "maemo/easysetup/modest-easysetup-provider-combo-box.h"
+#include "maemo/easysetup/modest-easysetup-servertype-combo-box.h"
+#include "maemo/easysetup/modest-easysetup-serversecurity-combo-box.h"
+#include "maemo/easysetup/modest-easysetup-secureauth-combo-box.h"
+#include "maemo/easysetup/modest-validating-entry.h"
 #include "modest-text-utils.h"
 #include "modest-account-mgr.h"
 #include "modest-runtime.h" /* For modest_runtime_get_account_mgr(). */
+#include "maemo/modest-connection-specific-smtp-window.h"
 #include <gconf/gconf-client.h>
 #include <string.h> /* For strlen(). */
 
@@ -575,6 +576,29 @@ enable_widget_for_togglebutton (GtkWidget *widget, GtkToggleButton* button)
        on_toggle_button_changed (button, widget);
 }
        
+static void
+on_smtp_servers_window_hide (GtkWindow *window, gpointer user_data)
+{
+       /* Destroy the window when it is closed: */
+       gtk_widget_destroy (GTK_WIDGET (window));
+}
+
+static void
+on_button_outgoing_smtp_servers (GtkButton *button, gpointer user_data)
+{
+
+       ModestEasysetupWizardDialog * self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data);
+       
+       /* Show the window: */
+       /* TODO: Retrieve the chosen settings,
+        * so we can supply them when creating the connection somehow.
+        */
+       GtkWidget *window = GTK_WIDGET (modest_connection_specific_smtp_window_new ());
+       g_signal_connect (G_OBJECT (window), "hide",
+               G_CALLBACK (on_smtp_servers_window_hide), self);
+    gtk_widget_show (window);
+}
+
 static GtkWidget* create_page_custom_outgoing (ModestEasysetupWizardDialog *self)
 {
        GtkWidget *box = gtk_vbox_new (FALSE, 2);
@@ -637,6 +661,9 @@ static GtkWidget* create_page_custom_outgoing (ModestEasysetupWizardDialog *self
        /* Only enable the button when the checkbox is checked: */
        enable_widget_for_togglebutton (self->button_outgoing_smtp_servers, 
                GTK_TOGGLE_BUTTON (self->checkbox_outgoing_smtp_specific));
+               
+       g_signal_connect (G_OBJECT (self->button_outgoing_smtp_servers), "clicked",
+               G_CALLBACK (on_button_outgoing_smtp_servers), self);
        
        
        gtk_widget_show (GTK_WIDGET (box));
diff --git a/src/maemo/modest-connection-specific-smtp-window.c b/src/maemo/modest-connection-specific-smtp-window.c
new file mode 100644 (file)
index 0000000..71f597e
--- /dev/null
@@ -0,0 +1,174 @@
+/* connection-specific-smtp-window.c */
+
+#include "modest-connection-specific-smtp-window.h"
+#include <gtk/gtktreeview.h>
+#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtkliststore.h>
+#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtkbutton.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtkstock.h>
+
+#include <glib/gi18n.h>
+
+G_DEFINE_TYPE (ModestConnectionSpecificSmtpWindow, modest_connection_specific_smtp_window, GTK_TYPE_WINDOW);
+
+#define CONNECTION_SPECIFIC_SMTP_WINDOW_GET_PRIVATE(o) \
+       (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_WINDOW, ModestConnectionSpecificSmtpWindowPrivate))
+
+typedef struct _ModestConnectionSpecificSmtpWindowPrivate ModestConnectionSpecificSmtpWindowPrivate;
+
+struct _ModestConnectionSpecificSmtpWindowPrivate
+{
+       GtkTreeView *treeview;
+       GtkTreeModel *model;
+};
+
+static void
+modest_connection_specific_smtp_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_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_window_dispose (GObject *object)
+{
+       if (G_OBJECT_CLASS (modest_connection_specific_smtp_window_parent_class)->dispose)
+               G_OBJECT_CLASS (modest_connection_specific_smtp_window_parent_class)->dispose (object);
+}
+
+static void
+modest_connection_specific_smtp_window_finalize (GObject *object)
+{
+       G_OBJECT_CLASS (modest_connection_specific_smtp_window_parent_class)->finalize (object);
+}
+
+static void
+modest_connection_specific_smtp_window_class_init (ModestConnectionSpecificSmtpWindowClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       g_type_class_add_private (klass, sizeof (ModestConnectionSpecificSmtpWindowPrivate));
+
+       object_class->get_property = modest_connection_specific_smtp_window_get_property;
+       object_class->set_property = modest_connection_specific_smtp_window_set_property;
+       object_class->dispose = modest_connection_specific_smtp_window_dispose;
+       object_class->finalize = modest_connection_specific_smtp_window_finalize;
+}
+
+enum MODEL_COLS {
+       MODEL_COL_NAME = 0,
+       MODEL_COL_SERVER_NAME = 1,
+       MODEL_COL_ID = 2
+};
+
+static void
+fill_with_connections (ModestConnectionSpecificSmtpWindow *self)
+{
+       /* TODO: 
+       * When TnyMaemoDevice provides enough of the libconic API to implement this. */
+}
+
+static void
+on_button_edit (GtkButton *button, gpointer user_data)
+{
+       
+}
+
+static void
+on_button_cancel (GtkButton *button, gpointer user_data)
+{
+       ModestConnectionSpecificSmtpWindow *self = MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (user_data);
+
+       /* Hide the window.
+        * The code that showed it will respond to the hide signal. */  
+       gtk_widget_hide (GTK_WIDGET (self));
+}
+
+static void
+modest_connection_specific_smtp_window_init (ModestConnectionSpecificSmtpWindow *self)
+{
+       ModestConnectionSpecificSmtpWindowPrivate *priv = CONNECTION_SPECIFIC_SMTP_WINDOW_GET_PRIVATE (self);
+
+       /* Create a tree model for the tree view:
+        * with a string for the name, a string for the server name, and an int for the ID.
+        * This must match our MODEL_COLS enum constants.
+        */
+       priv->model = GTK_TREE_MODEL (gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT));
+
+       /* Setup the tree view: */
+       priv->treeview = GTK_TREE_VIEW (gtk_tree_view_new_with_model (priv->model));
+
+       /* name column:
+        * The ID model column in not shown in the view. */
+       GtkTreeViewColumn *view_column = gtk_tree_view_column_new ();
+       GtkCellRenderer *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, 
+       "text", MODEL_COL_NAME, NULL);
+       gtk_tree_view_column_set_title (view_column, _("mcen_ia_optionalsmtp_connection_name"));
+       gtk_tree_view_append_column (priv->treeview, view_column);
+
+       
+       /* server name column: */
+       view_column = gtk_tree_view_column_new ();
+       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, 
+       "text", MODEL_COL_SERVER_NAME, NULL);
+       gtk_tree_view_column_set_title (view_column, _("mcen_ia_optionalsmtp_servername"));
+       gtk_tree_view_append_column (priv->treeview, view_column);
+       
+       /* Fill the model with rows: */
+       fill_with_connections (self);
+       
+       GtkWidget *vbox = gtk_vbox_new (FALSE, 2);
+       
+       /* Put the treeview in a scrolled window and add it to the box: */
+       GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+       gtk_widget_show (scrolled_window);
+       gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (priv->treeview));
+       gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (scrolled_window), TRUE, TRUE, 2);
+       gtk_widget_show (GTK_WIDGET (priv->treeview));
+       
+       /* Add the buttons: */
+       GtkWidget *hbox = gtk_hbox_new (FALSE, 2);
+       gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 2);
+       gtk_widget_show (hbox);
+       
+       GtkWidget *button_edit = gtk_button_new_from_stock (GTK_STOCK_EDIT);
+       gtk_box_pack_start (GTK_BOX (hbox), button_edit, TRUE, FALSE, 2);
+       gtk_widget_show (button_edit);
+       g_signal_connect (G_OBJECT (button_edit), "clicked",
+               G_CALLBACK (on_button_edit), self);
+       
+       GtkWidget *button_cancel = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+       gtk_box_pack_start (GTK_BOX (hbox), button_cancel, TRUE, FALSE, 2);
+       gtk_widget_show (button_cancel);
+       g_signal_connect (G_OBJECT (button_edit), "clicked",
+               G_CALLBACK (on_button_cancel), self);
+       
+       gtk_widget_show (vbox);
+}
+
+ModestConnectionSpecificSmtpWindow*
+modest_connection_specific_smtp_window_new (void)
+{
+       return g_object_new (MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_WINDOW, NULL);
+}
+
diff --git a/src/maemo/modest-connection-specific-smtp-window.h b/src/maemo/modest-connection-specific-smtp-window.h
new file mode 100644 (file)
index 0000000..8ad34ca
--- /dev/null
@@ -0,0 +1,75 @@
+/* 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_WINDOW
+#define __MODEST_MAEMO_CONNECTION_SPECIFIC_SMTP_WINDOW
+
+#include <gtk/gtkwindow.h>
+#include <gtk/gtktreeview.h>
+
+G_BEGIN_DECLS
+
+#define MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_WINDOW modest_connection_specific_smtp_window_get_type()
+
+#define MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+       MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_WINDOW, ModestConnectionSpecificSmtpWindow))
+
+#define MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW_CLASS(klass) \
+       (G_TYPE_CHECK_CLASS_CAST ((klass), \
+       MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_WINDOW, ModestConnectionSpecificSmtpWindowClass))
+
+#define MODEST_IS_CONNECTION_SPECIFIC_SMTP_WINDOW(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+       MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_WINDOW))
+
+#define MODEST_IS_CONNECTION_SPECIFIC_SMTP_WINDOW_CLASS(klass) \
+       (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+       MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_WINDOW))
+
+#define MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW_GET_CLASS(obj) \
+       (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+       MODEST_TYPE_CONNECTION_SPECIFIC_SMTP_WINDOW, ModestConnectionSpecificSmtpWindowClass))
+
+typedef struct {
+       GtkWindow parent;
+       
+} ModestConnectionSpecificSmtpWindow;
+
+typedef struct {
+       GtkWindowClass parent_class;
+} ModestConnectionSpecificSmtpWindowClass;
+
+GType modest_connection_specific_smtp_window_get_type (void);
+
+ModestConnectionSpecificSmtpWindow* modest_connection_specific_smtp_window_new (void);
+
+G_END_DECLS
+
+#endif /* __MODEST_MAEMO_CONNECTION_SPECIFIC_SMTP_WINDOW */