Re: [evolution-patches] New patch for composer, remove attatchments with "Delete" key
- From: Bruce Tao <bruce tao sun com>
- To: Jeffrey Stedfast <fejj ximian com>, evolution-patches lists ximian com, Paolo Borelli <pborelli katamail com>
- Subject: Re: [evolution-patches] New patch for composer, remove attatchments with "Delete" key
- Date: Sun, 29 Feb 2004 15:15:17 -0500
Jeffrey Stedfast wrote:
it would be nice if instead of selecting the first attachment, it would
select the attachment that is now in the same position as the previously
deleted attachment...
Jeff
Bruce Tao wrote:
Now I've made some improvement of the patch.
Paolo said the program will crash even if he delete the attachments
by context menu and then press some arrow key
(However, it is fine in my environment).
So I think it's better to move the focus action into function
'remove_selected'.
Furthermore, the icon right after the last icon included in the
deleted list will be focused. If there is no such icon, the
last one in current icon_list will be chosen.
What do you think about it ?
Best wishes
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 29 Feb 2004 06:52:33 -0000
@@ -1,3 +1,11 @@
+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 icon right after
+ the last deleted one 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 29 Feb 2004 06:52:33 -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>
@@ -331,7 +332,7 @@
GnomeIconList *icon_list;
EMsgComposerAttachment *attachment;
GList *attachment_list, *p;
- int num;
+ int num, left, dlen;
icon_list = GNOME_ICON_LIST (bar);
@@ -341,6 +342,7 @@
attachment_list = NULL;
p = gnome_icon_list_get_selection (icon_list);
+ dlen = g_list_length (p);
for ( ; p != NULL; p = p->next) {
num = GPOINTER_TO_INT (p->data);
attachment = E_MSG_COMPOSER_ATTACHMENT (g_list_nth_data (bar->priv->attachments, num));
@@ -360,6 +362,11 @@
g_list_free (attachment_list);
update (bar);
+
+ left = gnome_icon_list_get_num_icons (icon_list);
+ num = num - dlen + 1;
+ if (left > 0)
+ gnome_icon_list_focus_icon (icon_list, left > num ? num : left - 1);
}
static void
@@ -597,6 +604,23 @@
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);
+ return TRUE;
+ }
+
+ return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
+}
+
/* Initialization. */
@@ -617,6 +641,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]