aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxx Cao <maxx.cao@sun.com>2003-07-15 12:23:19 +0800
committerYuedong Du <york@src.gnome.org>2003-07-15 12:23:19 +0800
commit6ed89aec8563c3675d77d0d1b0832db9cc3bbe30 (patch)
treee53d54ddf065eb4393af1897256e492c73dc4fa4
parentea8b624e51eb2e1122d96e4eec0521e7fa719413 (diff)
downloadgsoc2013-evolution-6ed89aec8563c3675d77d0d1b0832db9cc3bbe30.tar.gz
gsoc2013-evolution-6ed89aec8563c3675d77d0d1b0832db9cc3bbe30.tar.zst
gsoc2013-evolution-6ed89aec8563c3675d77d0d1b0832db9cc3bbe30.zip
** For bug #45826
2002-07-14 Maxx Cao <maxx.cao@sun.com> ** For bug #45826 * e-msg-composer-attachment-bar.c (class_init): connect the "popup_menu" signal, so that S-F10 keybinding will work. (popup_menu_event): funcion added to handle "popup_menu" (S-F10 key). (popup_menu_placement_callback): function added to place the popup menu to the center of attachment icon, in case it is activated by keyboard. svn path=/trunk/; revision=21812
-rw-r--r--composer/ChangeLog11
-rw-r--r--composer/e-msg-composer-attachment-bar.c50
2 files changed, 61 insertions, 0 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index b054034a91..529a2b800e 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,14 @@
+2002-07-14 Maxx Cao <maxx.cao@sun.com>
+
+ ** For bug #45826
+
+ * e-msg-composer-attachment-bar.c (class_init): connect the
+ "popup_menu" signal, so that S-F10 keybinding will work.
+ (popup_menu_event): funcion added to handle "popup_menu" (S-F10 key).
+ (popup_menu_placement_callback): function added to place the popup
+ menu to the center of attachment icon, in case it is activated by
+ keyboard.
+
2003-07-07 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer.c (e_msg_composer_new_with_message): Updated to
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
index 857265fdfe..e359ffd042 100644
--- a/composer/e-msg-composer-attachment-bar.c
+++ b/composer/e-msg-composer-attachment-bar.c
@@ -527,6 +527,54 @@ destroy (GtkObject *object)
/* GtkWidget methods. */
+
+static void
+popup_menu_placement_callback(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data)
+{
+ EMsgComposerAttachmentBar *bar;
+ GnomeIconList *icon_list;
+ GList *selection;
+ GnomeCanvasPixbuf *image;
+
+ bar = E_MSG_COMPOSER_ATTACHMENT_BAR (user_data);
+ icon_list = GNOME_ICON_LIST (user_data);
+
+ gdk_window_get_origin (((GtkWidget*) bar)->window, x, y);
+
+ selection = gnome_icon_list_get_selection (icon_list);
+ if (selection == NULL)
+ return;
+
+ image = gnome_icon_list_get_icon_pixbuf_item (icon_list, (gint)selection->data);
+ if (image == NULL)
+ return;
+
+ /* Put menu to the center of icon. */
+ *x += (gint)(image->item.x1 + image->item.x2)/2;
+ *y += (gint)(image->item.y1 + image->item.y2)/2;
+
+}
+
+static gboolean
+popup_menu_event (GtkWidget *widget)
+{
+ EMsgComposerAttachmentBar *bar = E_MSG_COMPOSER_ATTACHMENT_BAR (widget);
+ GnomeIconList *icon_list = GNOME_ICON_LIST (widget);
+ GList *selection = gnome_icon_list_get_selection (icon_list);
+ GtkMenu *menu;
+
+ if (selection==NULL)
+ menu = get_context_menu (bar);
+ else
+ menu = get_icon_context_menu (bar);
+
+ gnome_popup_menu_do_popup (menu, popup_menu_placement_callback,
+ (gpointer)widget, NULL, (gpointer)widget, NULL);
+
+ return TRUE;
+}
+
+
static gint
button_press_event (GtkWidget *widget,
GdkEventButton *event)
@@ -572,6 +620,8 @@ class_init (EMsgComposerAttachmentBarClass *klass)
object_class->destroy = destroy;
widget_class->button_press_event = button_press_event;
+ widget_class->popup_menu = popup_menu_event;
+
/* Setup signals. */