* src/mainwindow.c
authorColin Leroy <colin@colino.net>
Sat, 11 Jan 2003 10:50:29 +0000 (10:50 +0000)
committerColin Leroy <colin@colino.net>
Sat, 11 Jan 2003 10:50:29 +0000 (10:50 +0000)
  src/mainwindow.h
Add mainwindow_get_mainwindow()
* src/alertpanel.c
  src/alertpanel.h
Add alertpanel_error_log()
  src/compose.c
  src/inc.c
  src/messageview.c
  src/toolbar.c
  src/main.c
  src/procmsg.c
Network errors get a View Log button

12 files changed:
ChangeLog.claws
configure.in
src/alertpanel.c
src/alertpanel.h
src/compose.c
src/inc.c
src/main.c
src/mainwindow.c
src/mainwindow.h
src/messageview.c
src/procmsg.c
src/toolbar.c

index 9d36561..395774c 100644 (file)
@@ -1,3 +1,19 @@
+2003-01-11 [colin]     0.8.8claws81
+
+       * src/mainwindow.c
+         src/mainwindow.h
+               Add mainwindow_get_mainwindow()
+       * src/alertpanel.c
+         src/alertpanel.h
+               Add alertpanel_error_log() 
+       * src/compose.c
+         src/inc.c
+         src/messageview.c
+         src/toolbar.c
+         src/main.c
+         src/procmsg.c
+               Network errors get a View Log button
+
 2003-01-10 [alfons]    0.8.8claws80
 
        * src/prefs_toolbar.c
index 30ae89b..002347d 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws80
+EXTRA_VERSION=claws81
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 47c4600..811b401 100644 (file)
 #include <gdk/gdkkeysyms.h>
 
 #include "intl.h"
+#include "mainwindow.h"
 #include "alertpanel.h"
 #include "manage_window.h"
 #include "utils.h"
 #include "gtkutils.h"
 #include "inc.h"
+#include "log.h"
+#include "logwindow.h"
 
 #define TITLE_FONT     "-*-helvetica-medium-r-normal--17-*-*-*-*-*-*-*," \
                        "-*-*-medium-r-normal--16-*-*-*-*-*-*-*,*"
@@ -165,6 +168,32 @@ void alertpanel_error(const gchar *format, ...)
        alertpanel_message(_("Error"), buf);
 }
 
+/*!
+ *\brief       display an error with a View Log button
+ *
+ */
+void alertpanel_error_log(const gchar *format, ...)
+{
+       va_list args;
+       int val;
+       MainWindow *mainwin;
+       gchar buf[256];
+
+       va_start(args, format);
+       g_vsnprintf(buf, sizeof(buf), format, args);
+       va_end(args);
+       strretchomp(buf);
+
+       mainwin = mainwindow_get_mainwindow();
+       
+       if (mainwin && mainwin->logwin) {
+               val = alertpanel(_("Error"), buf, _("OK"), _("View log"), NULL);
+               if (val == G_ALERTALTERNATE)
+                       log_window_show(mainwin->logwin);
+       } else
+               alertpanel_error(buf);
+}
+
 static void alertpanel_show(void)
 {
        gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
index 01fbcc5..55b9879 100644 (file)
@@ -60,5 +60,7 @@ void alertpanel_warning       (const gchar    *format,
                         ...) G_GNUC_PRINTF(1, 2);
 void alertpanel_error  (const gchar    *format,
                         ...) G_GNUC_PRINTF(1, 2);
+void alertpanel_error_log(const gchar  *format,
+                         ...) G_GNUC_PRINTF(1, 2);
 
 #endif /* __ALERTPANEL_H__ */
index 4e963eb..7e51e08 100644 (file)
@@ -2912,7 +2912,7 @@ gint compose_send(Compose *compose)
                                        alertpanel_error(_("Can't queue the message."));
                        }
                } else
-                       alertpanel_error(_("Error occurred while sending the message."));
+                       alertpanel_error_log(_("Error occurred while sending the message."));
        } else {
                if (compose->mode == COMPOSE_REEDIT) {
                        compose_remove_reedit_target(compose);
index fbfb936..3d6b074 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -650,7 +650,7 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                if (inc_dialog->show_dialog)
                        manage_window_focus_in(inc_dialog->dialog->window,
                                               NULL, NULL);
-               alertpanel_error(_("Some errors occurred while getting mail."));
+               alertpanel_error_log(_("Some errors occurred while getting mail."));
                if (inc_dialog->show_dialog)
                        manage_window_focus_out(inc_dialog->dialog->window,
                                                NULL, NULL);
index 97575d3..4a96469 100644 (file)
@@ -783,7 +783,7 @@ static void send_queue(void)
                if (folder->queue) {
                        if (procmsg_send_queue
                                (folder->queue, prefs_common.savemsg) < 0)
-                               alertpanel_error(_("Some errors occurred while sending queued messages."));
+                               alertpanel_error_log(_("Some errors occurred while sending queued messages."));
                        folder_item_scan(folder->queue);
                        if (prefs_common.savemsg && folder->outbox) {
                                if (folder->outbox == def_outbox)
index c6aa29b..212a09b 100644 (file)
@@ -2713,6 +2713,19 @@ static void addr_harvest_msg_cb( MainWindow *mainwin,
        summary_harvest_address( mainwin->summaryview );
 }
 
+/*!
+ *\brief       get a MainWindow
+ *
+ *\return      MainWindow * The first mainwindow in the mainwin_list
+ */
+MainWindow *mainwindow_get_mainwindow(void)
+{
+       if (mainwin_list && mainwin_list->data)
+               return (MainWindow *)(mainwin_list->data);
+       else
+               return NULL;
+}
+
 /*
 * End of Source.
 */
index 5b1f501..1dd928e 100644 (file)
@@ -177,4 +177,5 @@ void main_window_toggle_work_offline          (MainWindow        *mainwin,
 void mainwindow_key_pressed                  (GtkWidget         *widget, 
                                               GdkEventKey       *event,
                                               gpointer           data);
+MainWindow *mainwindow_get_mainwindow        (void);
 #endif /* __MAINWINDOW_H__ */
index 2c3f960..4ccf3a0 100644 (file)
@@ -489,7 +489,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
                                        alertpanel_error(_("Can't queue the notification."));
                        }
                } else
-                       alertpanel_error(_("Error occurred while sending the notification."));
+                       alertpanel_error_log(_("Error occurred while sending the notification."));
        }
 
        if (unlink(tmp) < 0) FILE_OP_ERROR(tmp, "unlink");
index ba12921..dbdd876 100644 (file)
@@ -1323,11 +1323,11 @@ gint procmsg_send_message_queue(const gchar *file)
                }
                if (mailval < 0) {
                        if (!local)
-                               alertpanel_error(
+                               alertpanel_error_log(
                                        _("Error occurred while sending the message to `%s'."),
                                        mailac ? mailac->smtp_server : smtpserver);
                        else
-                               alertpanel_error(
+                               alertpanel_error_log(
                                        _("Error occurred while sending the message with command `%s'."),
                                        (mailac && mailac->use_mail_command && 
                                         mailac->mail_command && (*mailac->mail_command)) ? 
index 86b925d..ec01fca 100644 (file)
@@ -2100,7 +2100,7 @@ void send_queue_cb(gpointer data, guint action, GtkWidget *widget)
                if (folder->queue) {
                        if (procmsg_send_queue
                                (folder->queue, prefs_common.savemsg) < 0)
-                               alertpanel_error(_("Some errors occurred while sending queued messages."));
+                               alertpanel_error_log(_("Some errors occurred while sending queued messages."));
                        folder_item_scan(folder->queue);
                }
        }