[anjal] Middle click opens a folder in new tab. Double click too. But it opens



commit e3f99668e79be2251af64526f654b72b798e682c
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Fri Mar 20 14:42:17 2009 +0530

    Middle click opens a folder in new tab. Double click too. But it opens
    in current tab too.
---
 evo-anjal.patch |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/mail-view.c |   25 ++++++++++++++++++++++-
 2 files changed, 83 insertions(+), 1 deletions(-)

diff --git a/evo-anjal.patch b/evo-anjal.patch
index 1cd2b8f..1eccf5f 100755
--- a/evo-anjal.patch
+++ b/evo-anjal.patch
@@ -314,6 +314,65 @@ index e286a47..70bbc19 100644
  
  server_in_files = GNOME_Evolution_Mail.server.in.in
  server_DATA = $(server_in_files:.server.in.in=.server)
+diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
+index 54173a5..c871578 100644
+--- a/mail/em-folder-tree.c
++++ b/mail/em-folder-tree.c
+@@ -110,6 +110,7 @@ struct _EMFolderTreePrivate {
+ 	guint loaded_row_id;
+ 
+ 	GtkTreeRowReference *drag_row;
++	gboolean skip_double_click;
+ };
+ 
+ enum {
+@@ -437,6 +438,7 @@ em_folder_tree_init (EMFolderTree *emft)
+ 	priv->treeview = NULL;
+ 	priv->model = NULL;
+ 	priv->drag_row = NULL;
++	priv->skip_double_click = FALSE;
+ 
+ 	emft->priv = priv;
+ }
+@@ -2292,6 +2294,9 @@ emft_tree_button_press (GtkTreeView *treeview, GdkEventButton *event, EMFolderTr
+ 	gtk_tree_view_set_cursor (treeview, tree_path, NULL, FALSE);
+ 
+ 	if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
++		if (emft->priv->skip_double_click) {
++			return FALSE;
++		}
+ 		emft_tree_row_activated (treeview, tree_path, NULL, emft);
+ 		gtk_tree_path_free (tree_path);
+ 		return TRUE;
+@@ -2643,3 +2648,15 @@ emft_queue_save_state (EMFolderTree *emft)
+ 
+ 	priv->save_state_id = g_timeout_add (1000, (GSourceFunc) emft_save_state, emft);
+ }
++
++GtkWidget *
++em_folder_tree_get_tree_view (EMFolderTree *emft)
++{
++	return emft->priv->treeview;
++}
++
++void
++em_folder_tree_set_skip_double_click (EMFolderTree *emft, gboolean skip)
++{
++	emft->priv->skip_double_click = skip;
++}
+diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h
+index e89be47..b02a4d8 100644
+--- a/mail/em-folder-tree.h
++++ b/mail/em-folder-tree.h
+@@ -94,6 +94,8 @@ EMFolderTreeModel *em_folder_tree_get_model (EMFolderTree *emft);
+ EMFolderTreeModelStoreInfo *em_folder_tree_get_model_storeinfo (EMFolderTree *emft, CamelStore *store);
+ 
+ gboolean em_folder_tree_create_folder (EMFolderTree *emft, const char *full_name, const char *uri);
++GtkWidget * em_folder_tree_get_tree_view (EMFolderTree *emft);
++void em_folder_tree_set_skip_double_click (EMFolderTree *emft, gboolean skip);
+ 
+ #ifdef __cplusplus
+ }
 diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
 index 95acd8b..2d92b1e 100644
 --- a/widgets/misc/Makefile.am
diff --git a/src/mail-view.c b/src/mail-view.c
index c944bb1..c80b5bf 100644
--- a/src/mail-view.c
+++ b/src/mail-view.c
@@ -285,7 +285,6 @@ mail_view_set_folder_uri (MailView *mv, const char *uri)
 	mail_folder_view_set_folder_uri (mv->priv->current_view, uri);
 }
 
-
 void
 mail_view_show_sort_popup (MailView *mv, GtkWidget *button)
 {
@@ -319,10 +318,34 @@ mail_view_set_folder_tree_widget (MailView *mv, GtkWidget *tree)
 	mv->folder_tree = tree;
 }
 
+static gboolean
+mv_tree_click_cb (GtkWidget *w, GdkEventButton *event, MailView *mv)
+{
+	 if ((event->button == 1 && event->type == GDK_2BUTTON_PRESS) || event->button == 2) {
+		  GtkTreeSelection *selection;
+		  GtkTreePath *tree_path;
+		  
+		  if (!gtk_tree_view_get_path_at_pos (w, (int) event->x, (int) event->y, &tree_path, NULL, NULL, NULL))
+			   return FALSE;
+		  mail_view_add_page (mv, MAIL_VIEW_FOLDER);
+		  gtk_notebook_set_current_page (mv, g_list_length (mv->priv->children)-1);
+		  selection = gtk_tree_view_get_selection (w);
+		  gtk_tree_selection_unselect_path (selection, tree_path);
+		  gtk_tree_selection_select_path(selection, tree_path);
+		  gtk_tree_view_set_cursor (w, tree_path, NULL, FALSE);
+
+
+		  return TRUE;
+	 }
+	 return FALSE;
+}
+
 void
 mail_view_set_folder_tree (MailView *mv, GtkWidget *tree)
 {
 	mv->tree = tree;
+	em_folder_tree_set_skip_double_click (tree, TRUE);
+	g_signal_connect (em_folder_tree_get_tree_view(tree), "button-press-event", G_CALLBACK(mv_tree_click_cb), mv);
 }
 
 void



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