* Added the error stuff
authorSergio Villar Senin <svillar@igalia.com>
Wed, 20 Dec 2006 16:51:54 +0000 (16:51 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Wed, 20 Dec 2006 16:51:54 +0000 (16:51 +0000)
* Modified the appearance of the button box of the account view window

pmo-trunk-r571

src/Makefile.am
src/gtk/modest-account-view-window.c
src/modest-mail-operation.c

index 8b7c895..4e58386 100644 (file)
@@ -66,7 +66,8 @@ modest_SOURCES=\
        modest-tny-platform-factory.c \
        modest-tny-platform-factory.h \
        modest-formatter.c \
-       modest-formatter.h
+       modest-formatter.h \
+       modest-error.h
 
 modest_LDADD =                                                 \
        $(MODEST_GSTUFF_LIBS)                           \
index d66187f..ec778e2 100644 (file)
@@ -246,6 +246,9 @@ button_box_new (ModestAccountViewWindow *self)
        priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
        
        button_box   = gtk_vbutton_box_new ();
+       gtk_button_box_set_spacing (GTK_BUTTON_BOX (button_box), 6);
+       gtk_button_box_set_layout (GTK_BUTTON_BOX (button_box), 
+                                  GTK_BUTTONBOX_START);
 
        add_button    = gtk_button_new_from_stock(GTK_STOCK_ADD);
        remove_button = gtk_button_new_from_stock(GTK_STOCK_REMOVE);
index bd6bc9c..a0ce714 100644 (file)
 #include "modest-tny-platform-factory.h"
 #include "modest-marshal.h"
 #include "modest-formatter.h"
+#include "modest-error.h"
 
 /* 'private'/'protected' functions */
 static void modest_mail_operation_class_init (ModestMailOperationClass *klass);
 static void modest_mail_operation_init       (ModestMailOperation *obj);
 static void modest_mail_operation_finalize   (GObject *obj);
 
-#define MODEST_ERROR modest_error_quark ()
-
-typedef enum _ModestMailOperationErrorCode ModestMailOperationErrorCode;
-enum _ModestMailOperationErrorCode {
-        MODEST_MAIL_OPERATION_ERROR_BAD_ACCOUNT,
-        MODEST_MAIL_OPERATION_ERROR_MISSING_PARAMETER,
-       MODEST_MAIL_OPERATION_ERROR_OPERATION_CANCELED,
-
-       MODEST_MAIL_OPERATION_NUM_ERROR_CODES
-};
-
-static void     set_error            (ModestMailOperation *mail_operation, 
-                                     ModestMailOperationErrorCode error_code,
-                                     const gchar *fmt, ...);
 static void     status_update_cb     (TnyFolder *folder, 
                                      const gchar *what, 
                                      gint status, 
@@ -247,15 +234,18 @@ modest_mail_operation_send_new_mail (ModestMailOperation *mail_op,
        TnyMsg *new_msg;
        TnyHeader *header;
        gchar *content_type;
+       ModestMailOperationPrivate *priv = NULL;
 
        g_return_if_fail (MODEST_IS_MAIL_OPERATION (mail_op));
        g_return_if_fail (TNY_IS_TRANSPORT_ACCOUNT (transport_account));
 
+       priv = MODEST_MAIL_OPERATION_GET_PRIVATE(mail_op);
+
        /* Check parametters */
        if (to == NULL) {
-               set_error (mail_op,
-                          MODEST_MAIL_OPERATION_ERROR_MISSING_PARAMETER,
-                          _("Error trying to send a mail. You need to set almost one a recipient"));
+               g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
+                            MODEST_MAIL_OPERATION_ERROR_MISSING_PARAMETER,
+                            _("Error trying to send a mail. You need to set almost one a recipient"));
                return;
        }
 
@@ -491,9 +481,9 @@ folder_refresh_cb (TnyFolder *folder, gboolean canceled, GError **err, gpointer
                helper->failed++;
        } else if (canceled) {
                helper->canceled++;
-               set_error (mail_op,
-                          MODEST_MAIL_OPERATION_ERROR_OPERATION_CANCELED,
-                          _("Error trying to refresh folder %s. Operation canceled"),
+               g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
+                            MODEST_MAIL_OPERATION_ERROR_OPERATION_CANCELED,
+                            _("Error trying to refresh folder %s. Operation canceled"),
                           tny_folder_get_name (folder));
        } else {
                priv->done++;
@@ -970,32 +960,6 @@ modest_error_quark (void)
        return err_q;
 }
 
-
-static void 
-set_error (ModestMailOperation *mail_op, 
-          ModestMailOperationErrorCode error_code,
-          const gchar *fmt, ...)
-{
-       ModestMailOperationPrivate *priv;
-       GError* error;
-       va_list args;
-       gchar* orig;
-
-       priv = MODEST_MAIL_OPERATION_GET_PRIVATE(mail_op);
-
-       va_start (args, fmt);
-
-       orig = g_strdup_vprintf(fmt, args);
-       error = g_error_new (MODEST_ERROR, error_code, orig);
-
-       va_end (args);
-
-       if (priv->error)
-               g_object_unref (priv->error);
-
-       priv->error = error;
-}
-
 static void
 add_attachments (TnyMsg *msg, GList *attachments_list)
 {