handle several messageviews correctly
authorOliver Haertel <o.h.a@gmx.net>
Fri, 29 Nov 2002 18:59:03 +0000 (18:59 +0000)
committerOliver Haertel <o.h.a@gmx.net>
Fri, 29 Nov 2002 18:59:03 +0000 (18:59 +0000)
ChangeLog.claws
configure.in
src/messageview.c
src/toolbar.c

index 6f36979dcd75e16f8109fdd41a9b8fd180c87eb2..fd5f94996b32275a8d19195eff7bf2a642d33929 100644 (file)
@@ -1,3 +1,13 @@
+2002-11-29 [oliver]    0.8.6claws39
+       
+       * src/messageview.c
+               o update summaryview when switching between different
+                 messageviews          
+       * src/toolbar.c  
+               o check if messageview holds already removed msg
+                 from summaryview
+               
+
 2002-11-29 [oliver]    0.8.6claws38
 
        * src/toolbar.c 
index aa2c16c480d814d4497aa0a7ff7d81206b244d51..97c6a4a18159edeb1efdea3fb2a863972fbd00c6 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws38
+EXTRA_VERSION=claws39
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 00b84076f5582953af07ac7c49dddda31225591a..78f83cc7c6199cf19c04986acd37b6a5586618ee 100644 (file)
@@ -62,6 +62,9 @@ static void messageview_size_allocate_cb(GtkWidget    *widget,
 static void key_pressed                        (GtkWidget      *widget,
                                         GdkEventKey    *event,
                                         MessageView    *messageview);
+static void focus_in                   (GtkWidget      *widget, 
+                                        GdkEventFocus  *event,
+                                        gpointer        data);
 static void messageview_toolbar_create (MessageView    *messageview,
                                         GtkWidget      *container);
 static void toolbar_messageview_buttons_cb  (GtkWidget      *widget, 
@@ -201,6 +204,8 @@ MessageView *messageview_create_with_new_window(MainWindow *mainwin)
                           GTK_SIGNAL_FUNC(messageview_destroy_cb), msgview);
        gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
                           GTK_SIGNAL_FUNC(key_pressed), msgview);
+       gtk_signal_connect(GTK_OBJECT(window), "focus_in_event",
+                          GTK_SIGNAL_FUNC(focus_in), msgview);
 
        n_menu_entries = sizeof(messageview_entries) / sizeof(messageview_entries[0]);
        menubar = menubar_create(window, messageview_entries,
@@ -702,6 +707,15 @@ static void key_pressed(GtkWidget *widget, GdkEventKey *event,
                gtk_widget_destroy(messageview->window);
 }
 
+static void focus_in(GtkWidget *widget, GdkEventFocus *event,
+                    gpointer data)
+{
+       MessageView *msgview = (MessageView*)data;
+
+       summary_select_by_msgnum(msgview->mainwin->summaryview, 
+                                msgview->msginfo->msgnum);
+}
+
 void messageview_toggle_view_real(MessageView *messageview)
 {
        MainWindow *mainwin = messageview->mainwin;
index be2a3a602b2a6eafd537cfd91f664b167f7ab3ba..b49d7cbc0c4a2b83b3f1399776e1bc9f7de56d62 100644 (file)
@@ -665,15 +665,28 @@ void common_toolbar_delete_cb(GtkWidget     *widget,
        switch (parent->type) {
        case TOOLBAR_MSGVIEW:
                msgview = (MessageView*)parent->data;
+               
+               /* make sure the selected msg in summaryview is 
+                  the one we are asked to delete
+               */
+               if (msgview->mainwin->summaryview->selected) {
+                       SummaryView *summaryview = msgview->mainwin->summaryview;
+                       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+                       MsgInfo *msginfo = gtk_ctree_node_get_row_data(ctree, 
+                                                                      summaryview->selected);  
+                       if (msginfo->msgnum != msgview->msginfo->msgnum) {
+                               alertpanel_error(_("Message already removed from folder."));
+                               return;
+                       }
+               }
+               
                summary_delete(msgview->mainwin->summaryview);  
-               /* do we really want to close the widget ? 
-                  I`d rather have it staying open and moving to next msg 
-                  in summaryview ... - oha */
-               /* following code is already used somewhere else, perhaps wrap it in a function ? */
+
                if (msgview->mainwin->summaryview->selected) {
-                       GtkCTree *ctree = GTK_CTREE(msgview->mainwin->summaryview->ctree);
-                       MsgInfo * msginfo = gtk_ctree_node_get_row_data(ctree, 
-                                                                       msgview->mainwin->summaryview->selected);
+                       SummaryView *summaryview = msgview->mainwin->summaryview;
+                       GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+                       MsgInfo *msginfo = gtk_ctree_node_get_row_data(ctree, 
+                                                                      summaryview->selected);
                        messageview_show(msgview, msginfo, 
                                         msgview->all_headers);
                } else {