[evolution-patches] Show popup menu in mail's folder list and header list



Hi,
   Attached is the patch for HEAD. Please review it.
   Thanks!
      Harry

BTW, for my last patch about popup mene of e-source-selector, I will wait after NotZed's eplugin.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3455
diff -u -r1.3455 ChangeLog
--- ChangeLog	15 Sep 2004 19:18:33 -0000	1.3455
+++ ChangeLog	17 Sep 2004 05:36:42 -0000
@@ -1,3 +1,11 @@
+2004-09-17  Harry Lu  <harry lu sun com>
+
+	* em-folder-tree.c: (em_folder_tree_class_init), (real_popup_menu),
+	(emft_popup_menu), (emft_tree_button_press): implement popup_menu
+	so that popup menu can be shwon with Shift+F10 on folder tree.
+	* em-folder-view.c: (emfv_popup), (emfv_list_key_press):
+	hanlde Shift+F10 to show popup menu in mail list.
+
 2004-09-09  Jeffrey Stedfast  <fejj novell com>
 
 	* mail-account-gui.c (mail_account_gui_new): If built with
Index: em-folder-tree.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-tree.c,v
retrieving revision 1.127
diff -u -r1.127 em-folder-tree.c
--- em-folder-tree.c	31 Aug 2004 15:45:48 -0000	1.127
+++ em-folder-tree.c	17 Sep 2004 05:36:44 -0000
@@ -162,6 +162,7 @@
 static gboolean emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTree *emft);
 static void emft_tree_selection_changed (GtkTreeSelection *selection, EMFolderTree *emft);
 static gboolean emft_tree_user_event (GtkTreeView *treeview, GdkEvent *e, EMFolderTree *emft);
+static gboolean emft_popup_menu (GtkWidget *widget);
 
 struct _emft_selection_data {
 	GtkTreeModel *model;
@@ -200,11 +201,14 @@
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 	GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
+	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
 	
 	parent_class = g_type_class_ref (GTK_TYPE_VBOX);
 	
 	object_class->finalize = em_folder_tree_finalize;
 	gtk_object_class->destroy = em_folder_tree_destroy;
+
+	widget_class->popup_menu = emft_popup_menu;
 	
 	signals[FOLDER_SELECTED] =
 		g_signal_new ("folder-selected",
@@ -2714,13 +2718,13 @@
 	{ EM_POPUP_ITEM, "80.emc.00", N_("_Properties"), G_CALLBACK (emft_popup_properties), NULL, "stock_folder-properties", EM_POPUP_FOLDER_FOLDER|EM_POPUP_FOLDER_SELECT }
 };
 
-static gboolean
-emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTree *emft)
+static gboolean 
+real_popup_menu (EMFolderTree *emft, GdkEventButton *event)
 {
+	GtkTreeView *treeview;
 	GtkTreeSelection *selection;
 	CamelStore *local, *store;
 	EMPopupTarget *target;
-	GtkTreePath *tree_path;
 	GtkTreeModel *model;
 	GtkTreeIter iter;
 	GSList *menus = NULL;
@@ -2732,26 +2736,8 @@
 	EMPopup *emp;
 	int i;
 
-	/* this centralises working out when the user's done something */
-	emft_tree_user_event(treeview, (GdkEvent *)event, emft);
-	
-	if (event->button != 3 && !(event->button == 1 && event->type == GDK_2BUTTON_PRESS))
-		return FALSE;
-	
-	if (!gtk_tree_view_get_path_at_pos (treeview, (int) event->x, (int) event->y, &tree_path, NULL, NULL, NULL))
-		return FALSE;
-	
-	/* select/focus the row that was right-clicked or double-clicked */
-	gtk_tree_view_set_cursor (treeview, tree_path, NULL, FALSE);
-	
-	if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
-		emft_tree_row_activated (treeview, tree_path, NULL, emft);
-		gtk_tree_path_free (tree_path);
-		return TRUE;
-	}
-	
-	gtk_tree_path_free (tree_path);
-	
+	treeview = emft->priv->treeview;
+
 	/* FIXME: we really need the folderinfo to build a proper menu */
 	selection = gtk_tree_view_get_selection (treeview);
 	if (!emft_selection_get_selected (selection, &model, &iter))
@@ -2804,7 +2790,7 @@
 	
 	if (event == NULL || event->type == GDK_KEY_PRESS) {
 		/* FIXME: menu pos function */
-		gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 0, event->time);
+		gtk_menu_popup (menu, NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME);
 	} else {
 		gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, event->time);
 	}
@@ -2813,6 +2799,42 @@
 	g_free (uri);
 	
 	return TRUE;
+}
+
+
+static gboolean 
+emft_popup_menu (GtkWidget *widget)
+{
+	return real_popup_menu (EM_FOLDER_TREE( widget), NULL);
+}
+
+static gboolean
+emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTree *emft)
+{
+	GtkTreePath *tree_path;
+
+	/* this centralises working out when the user's done something */
+	emft_tree_user_event(treeview, (GdkEvent *)event, emft);
+	
+	if (event->button != 3 && !(event->button == 1 && event->type == GDK_2BUTTON_PRESS))
+		return FALSE;
+	
+	if (!gtk_tree_view_get_path_at_pos (treeview, (int) event->x, (int) event->y, &tree_path, NULL, NULL, NULL))
+		return FALSE;
+	
+	/* select/focus the row that was right-clicked or double-clicked */
+	gtk_tree_view_set_cursor (treeview, tree_path, NULL, FALSE);
+	
+	if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
+		emft_tree_row_activated (treeview, tree_path, NULL, emft);
+		gtk_tree_path_free (tree_path);
+		return TRUE;
+	}
+	
+	gtk_tree_path_free (tree_path);
+
+	return real_popup_menu (emft, event);
+	
 }
 
 /* This is called for keyboard and mouse events, it seems the only way
Index: em-folder-view.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.c,v
retrieving revision 1.85
diff -u -r1.85 em-folder-view.c
--- em-folder-view.c	28 Jul 2004 14:38:50 -0000	1.85
+++ em-folder-view.c	17 Sep 2004 05:36:47 -0000
@@ -1032,7 +1032,7 @@
 
 	if (event == NULL || event->type == GDK_KEY_PRESS) {
 		/* FIXME: menu pos function */
-		gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, event ? event->key.time : time (NULL));
+		gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, event ? event->key.time : GDK_CURRENT_TIME);
 	} else {
 		gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button.button, event->button.time);
 	}
@@ -2039,6 +2039,12 @@
 		/* FIXME: location of popup */
 		emfv_popup(emfv, NULL);
 		break;
+	case GDK_F10:
+		if ((ev->key.state & GDK_SHIFT_MASK) != 0) {
+			emfv_popup(emfv, NULL);
+			break;
+		} else
+			return FALSE;
 	case '!':
 		uids = message_list_get_selected(emfv->list);
 


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