Re: [evolution-patches] Show popup menu in mail's folder list and header list
- From: Not Zed <notzed ximian com>
- To: Harry Lu <Harry Lu Sun COM>
- Cc: evolution-patches <evolution-patches ximian com>
- Subject: Re: [evolution-patches] Show popup menu in mail's folder list and header list
- Date: Mon, 20 Sep 2004 16:21:06 +0800
Ok i can't really test this right now since head isn't building, but i have some nit-picking comments in-line below. Just on style and consistency of function names in the file. Visual inspection looks ok otherwise.
Thanks,
Michael
On Mon, 2004-09-20 at 16:02 +0800, Harry Lu wrote:
Revised patch for HEAD. Please review it.
Thanks!
Harry
Harry Lu wrote:
> 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.
>
>
>
text/plain attachment (mailPopup2.diff)
|
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3457
diff -u -r1.3457 ChangeLog
--- ChangeLog 20 Sep 2004 05:59:54 -0000 1.3457
+++ ChangeLog 20 Sep 2004 07:08:05 -0000
@@ -1,3 +1,11 @@
+2004-09-20 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 shown with Shift+F10 on folder tree.
+ * em-folder-view.c: (emfv_popup), (emfv_list_key_press):
+ same as above.
+
2004-09-09 Jeffrey Stedfast <fejj novell com>
* em-message-browser.c (emmb_set_message): Ignore the
Index: em-folder-tree.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-tree.c,v
retrieving revision 1.128
diff -u -r1.128 em-folder-tree.c
--- em-folder-tree.c 20 Sep 2004 05:59:54 -0000 1.128
+++ em-folder-tree.c 20 Sep 2004 07:08:06 -0000
@@ -163,6 +163,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 em_folder_tree_popup_menu (GtkWidget *widget);
struct _emft_selection_data {
GtkTreeModel *model;
@@ -201,11 +202,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 = em_folder_tree_popup_menu;
signals[FOLDER_SELECTED] =
g_signal_new ("folder-selected",
@@ -2739,12 +2743,12 @@
}
static gboolean
-emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTree *emft)
+real_popup_menu (EMFolderTree *emft, GdkEvent *event)
please call this emft_real_popup_menu for consistency, or emft_popup if it isn't taken would be better.
{
+ GtkTreeView *treeview;
GtkTreeSelection *selection;
CamelStore *local, *store;
EMPopupTargetFolder *target;
- GtkTreePath *tree_path;
GtkTreeModel *model;
GtkTreeIter iter;
GSList *menus = NULL;
@@ -2756,25 +2760,7 @@
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);
@@ -2824,15 +2810,49 @@
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);
+ gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button.button, event->button.time);
}
g_free (full_name);
g_free (uri);
-
+
return TRUE;
+}
+
+static gboolean
+em_folder_tree_popup_menu (GtkWidget *widget)
+{
pleae call this emft_popup_menu for consistency.
+ 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, (GdkEvent *)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.86
diff -u -r1.86 em-folder-view.c
--- em-folder-view.c 20 Sep 2004 05:59:54 -0000 1.86
+++ em-folder-view.c 20 Sep 2004 07:08:08 -0000
@@ -121,6 +121,8 @@
static void emfv_on_url_cb(GObject *emitter, const char *url, EMFolderView *emfv);
static void emfv_on_url(EMFolderView *emfv, const char *uri, const char *nice_uri);
+static gboolean em_folder_view_popup_menu (GtkWidget *widget);
+
static const EMFolderViewEnable emfv_enable_map[];
struct _EMFolderViewPrivate {
@@ -266,6 +268,8 @@
((GtkObjectClass *) klass)->destroy = emfv_destroy;
+ ((GtkWidgetClass *) klass)->popup_menu = em_folder_view_popup_menu;
+
((EMFolderViewClass *) klass)->update_message_style = TRUE;
((EMFolderViewClass *)klass)->set_folder = emfv_set_folder;
@@ -1052,7 +1056,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);
}
@@ -2074,10 +2078,6 @@
case GDK_ISO_Enter:
em_folder_view_open_selected(emfv);
break;
- case GDK_Menu:
- /* FIXME: location of popup */
- emfv_popup(emfv, NULL);
- break;
case '!':
uids = message_list_get_selected(emfv->list);
@@ -2097,6 +2097,16 @@
return FALSE;
}
+ return TRUE;
+}
+
+static gboolean
+em_folder_view_popup_menu (GtkWidget *widget)
please call this emfv_popup_menu for consistency.
+{
+ EMFolderView *emfv = (EMFolderView *)widget;
+
+ emfv_popup(emfv, NULL);
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]