[evolution-patches] New patch for composer, remove attatchments with "Delete" key



Hi, all

I find there is a bug in the patch provided previously by
*Paolo Borelli * pborelli katamail com <mailto:pborelli%40katamail.com>,
which deals with removing selected attachments by pressing "Delete" key.

see http://lists.ximian.com/archives/public/evolution-patches/2004-January/004190.html

That is after removing one of the attachments, the focus will disappear. And then
if you press left, up, or down arrow key the program will crash.
This bug can simply be fixed by adding one statement to set focus to the first icon,
as I propose, while keeping all the modification by Paolo.


Please review , thanks!
:-)
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.604
diff -u -r1.604 ChangeLog
--- ChangeLog	6 Feb 2004 18:07:13 -0000	1.604
+++ ChangeLog	26 Feb 2004 11:46:01 -0000
@@ -1,3 +1,12 @@
+2004-02-26  Bruce Tao <bruce tao sun com>
+
+	* e-msg-composer-attachment-bar.c: add a key-press 
+	event handler, with which a little modification to 
+	Paolo Borelli's patch.  <pborelli katamail com>
+	When one attachment is deleted, the first icon of the
+	attachment-list will be focused.
+
+
 2004-02-06  Rodney Dawes  <dobey ximian com>
 
 	* e-msg-composer-attachment-bar.c: add accel and icon for
Index: e-msg-composer-attachment-bar.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer-attachment-bar.c,v
retrieving revision 1.81
diff -u -r1.81 e-msg-composer-attachment-bar.c
--- e-msg-composer-attachment-bar.c	6 Feb 2004 18:07:14 -0000	1.81
+++ e-msg-composer-attachment-bar.c	26 Feb 2004 11:46:03 -0000
@@ -31,6 +31,7 @@
 #include <glade/glade.h>
 #include <gconf/gconf.h>
 #include <gconf/gconf-client.h>
+#include <gdk/gdkkeysyms.h>
 #include <libgnome/gnome-util.h>
 #include <libgnomeui/gnome-app.h>
 #include <libgnomeui/gnome-app-helper.h>
@@ -597,6 +598,25 @@
 	return TRUE;
 }
 
+static gint
+key_press_event (GtkWidget *widget, GdkEventKey *event)
+{
+        EMsgComposerAttachmentBar *bar;
+        GnomeIconList *icon_list;
+                                                                                
+        bar = E_MSG_COMPOSER_ATTACHMENT_BAR (widget);
+        icon_list = GNOME_ICON_LIST (bar);                                                                                 
+                                                                                
+        if (event->keyval == GDK_Delete) {
+                remove_selected (bar);
+                if (gnome_icon_list_get_num_icons (icon_list) > 0)
+                        gnome_icon_list_focus_icon (icon_list, 0);
+                return TRUE;
+        }
+                                                                                
+        return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
+}
+
 
 /* Initialization.  */
 
@@ -617,6 +637,7 @@
 	
 	widget_class->button_press_event = button_press_event;
 	widget_class->popup_menu = popup_menu_event;
+	widget_class->key_press_event = key_press_event;
 
 	
 	/* Setup signals.  */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]