[Commits] [SCM] claws branch, master, updated. 3.17.0-191-g17267f3

ticho at claws-mail.org ticho at claws-mail.org
Sat Dec 1 10:38:50 CET 2018


The branch, master has been updated
       via  17267f3a517aa106f46a79357bf846ede378ade4 (commit)
       via  81dd6fb647dd1489fcbca9703bb6d5f68ff1cffb (commit)
       via  7057701fdbcfaa9b549d4233e0309ac9e25249df (commit)
      from  dea729cc5ad6875c4f5186c663fd1e5bb5b90b24 (commit)

Summary of changes:
 src/folderview.c  |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/folderview.h  |    3 ++-
 src/mainwindow.c  |    6 +++++-
 src/summaryview.c |    1 -
 4 files changed, 66 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit 17267f3a517aa106f46a79357bf846ede378ade4
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sat Dec 1 10:38:29 2018 +0100

    Added header popup menu to folderview.

diff --git a/src/folderview.c b/src/folderview.c
index 485ce03..063c521 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -237,6 +237,11 @@ static gboolean folderview_update_item_claws	 (gpointer 	    source,
 static void folderview_processing_cb(GtkAction *action, gpointer data);
 static void folderview_set_sens_and_popup_menu(FolderView *folderview, gint row, 
 				GdkEventButton *event);
+static void folderview_header_set_displayed_columns_cb(GtkAction *gaction,
+		gpointer data);
+static gboolean folderview_header_button_pressed(GtkWidget *widget,
+		GdkEvent *_event,
+		gpointer user_data);
 
 GHashTable *folderview_popups;
 
@@ -257,6 +262,12 @@ static GtkActionEntry folderview_common_popup_entries[] =
 	
 };
 
+static GtkActionEntry folderview_header_popup_entries[] =
+{
+	{"FolderViewHeaderPopup",                     NULL, "FolderViewHeaderPopup", NULL, NULL, NULL },
+	{"FolderViewHeaderPopup/SetDisplayedColumns", NULL, N_("Set Displayed columns"), NULL, NULL, G_CALLBACK(folderview_header_set_displayed_columns_cb) }
+};
+
 GtkTargetEntry folderview_drag_types[] =
 {
 	{"claws-mail/internal", GTK_TARGET_SAME_APP, TARGET_DUMMY},
@@ -477,6 +488,11 @@ static GtkWidget *folderview_ctree_create(FolderView *folderview)
 				   prefs_common.folder_col_size[i]);
 		gtk_cmclist_set_column_visibility
 			(GTK_CMCLIST(ctree), i, col_state[i].visible);
+
+		g_signal_connect(G_OBJECT(GTK_CMCLIST(ctree)->column[i].button),
+					"button-press-event",
+					G_CALLBACK(folderview_header_button_pressed),
+					folderview);
 	}
 
 	g_signal_connect(G_OBJECT(ctree), "key_press_event",
@@ -611,6 +627,18 @@ FolderView *folderview_create(MainWindow *mainwin)
 	folderview->popups = g_hash_table_new(g_str_hash, g_str_equal);
 	g_hash_table_foreach(folderview_popups, create_action_groups, folderview);
 
+	gtk_action_group_add_actions(mainwin->action_group,
+			folderview_header_popup_entries,
+			G_N_ELEMENTS(folderview_header_popup_entries),
+			(gpointer)folderview);
+
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus", "FolderViewHeaderPopup", "FolderViewHeaderPopup", GTK_UI_MANAGER_MENU)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/FolderViewHeaderPopup", "SetDisplayedColumns", "FolderViewHeaderPopup/SetDisplayedColumns", GTK_UI_MANAGER_MENUITEM)
+
+	folderview->headerpopupmenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
+				gtk_ui_manager_get_widget(mainwin->ui_manager,
+					"/Menus/FolderViewHeaderPopup") ));
+
 	folderview->ctree        = ctree;
 
 	folderview->folder_update_callback_id =
@@ -3330,3 +3358,33 @@ void folderview_grab_focus(FolderView *folderview)
 	 if (folderview)
 		 gtk_widget_grab_focus(folderview->ctree);
 }
+
+static void folderview_header_set_displayed_columns_cb(GtkAction *gaction,
+		gpointer data)
+{
+	prefs_folder_column_open();
+}
+
+static gboolean folderview_header_button_pressed(GtkWidget *widget,
+		GdkEvent *_event,
+		gpointer user_data)
+{
+	GdkEventButton *event = (GdkEventButton *)_event;
+	FolderView *folderview = (FolderView *)user_data;
+
+	cm_return_val_if_fail(folderview != NULL, FALSE);
+
+	/* Only handle single button presses. */
+	if (event->type == GDK_2BUTTON_PRESS ||
+			event->type == GDK_3BUTTON_PRESS)
+		return FALSE;
+
+	/* Handle right-click for context menu */
+	if (event->button == 3) {
+		gtk_menu_popup(GTK_MENU(folderview->headerpopupmenu),
+				NULL, NULL, NULL, NULL, 3, event->time);
+		return TRUE;
+	}
+
+	return FALSE;
+}
diff --git a/src/folderview.h b/src/folderview.h
index f97e2d0..24f7e75 100644
--- a/src/folderview.h
+++ b/src/folderview.h
@@ -51,6 +51,7 @@ struct _FolderView
 {
 	GtkWidget *scrolledwin;
 	GtkWidget *ctree;
+	GtkWidget *headerpopupmenu;
 
 	GHashTable *popups;
 

commit 81dd6fb647dd1489fcbca9703bb6d5f68ff1cffb
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sat Dec 1 10:32:00 2018 +0100

    Create "/Menus" in mainwindow's UI manager in mainwindow.c, not in summaryview.c.

diff --git a/src/mainwindow.c b/src/mainwindow.c
index e12732e..53e81f1 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -1884,6 +1884,10 @@ MainWindow *main_window_create()
 		gtk_widget_hide(menubar);
 	gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(mainwin->ui_manager));
 
+	/* Create a menu container for the different popup menus we
+	 * will be adding from other UI elements. */
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/", "Menus", "Menus", GTK_UI_MANAGER_MENUBAR)
+
 	gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
 
 	if (prefs_common.toolbar_detachable) {
diff --git a/src/summaryview.c b/src/summaryview.c
index 38c1c1e..93d85f1 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -695,7 +695,6 @@ SummaryView *summary_create(MainWindow *mainwin)
 	summaryview->action_group = cm_menu_create_action_group_full(summaryview->ui_manager,"Menu", summary_popup_entries,
 			G_N_ELEMENTS(summary_popup_entries), (gpointer)summaryview);
 
-	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/", "Menus", "Menus", GTK_UI_MANAGER_MENUBAR)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus", "SummaryViewPopup", "SummaryViewPopup", GTK_UI_MANAGER_MENU)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menus/SummaryViewPopup", "Reply", "SummaryViewPopup/Reply", GTK_UI_MANAGER_MENUITEM)
 #ifndef GENERIC_UMPC

commit 7057701fdbcfaa9b549d4233e0309ac9e25249df
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sat Dec 1 10:06:51 2018 +0100

    Added MainWin* parameter to folderview_create().

diff --git a/src/folderview.c b/src/folderview.c
index 1f8ee97..485ce03 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -586,7 +586,7 @@ void folderview_set_column_order(FolderView *folderview)
 	folderview_select(folderview,item);
 }
 
-FolderView *folderview_create(void)
+FolderView *folderview_create(MainWindow *mainwin)
 {
 	FolderView *folderview;
 	GtkWidget *scrolledwin;
diff --git a/src/folderview.h b/src/folderview.h
index 68bb2e8..f97e2d0 100644
--- a/src/folderview.h
+++ b/src/folderview.h
@@ -104,7 +104,7 @@ struct _FolderViewPopup
 };
 
 void folderview_initialize		(void);
-FolderView *folderview_create		(void);
+FolderView *folderview_create		(MainWindow *mainwin);
 void folderview_init			(FolderView	*folderview);
 
 void folderview_set			(FolderView	*folderview);
diff --git a/src/mainwindow.c b/src/mainwindow.c
index fe568ba..e12732e 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -1994,7 +1994,7 @@ MainWindow *main_window_create()
 	g_signal_connect (G_OBJECT(offline_switch), "clicked", G_CALLBACK(online_switch_clicked), mainwin);
 #endif
 	/* create views */
-	mainwin->folderview  = folderview  = folderview_create();
+	mainwin->folderview  = folderview  = folderview_create(mainwin);
 	mainwin->summaryview = summaryview = summary_create(mainwin);
 	mainwin->messageview = messageview = messageview_create(mainwin);
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list