[Commits] [SCM] claws branch, gtk3tree, updated. 3.99.0-68-g4d4c402fd

thorsten at claws-mail.org thorsten at claws-mail.org
Sat Mar 27 18:53:43 CET 2021


The branch, gtk3tree has been updated
       via  4d4c402fdd12b3e559dd7057d5c8aa423127a1e3 (commit)
       via  6c4b56e72c7896746c007e36249a100b5e3d07cd (commit)
      from  f388c744a00d172450c281a6d39b52cdfd928101 (commit)

Summary of changes:
 src/folderview.c | 549 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 src/folderview.h |   9 +
 2 files changed, 530 insertions(+), 28 deletions(-)


- Log -----------------------------------------------------------------
commit 4d4c402fdd12b3e559dd7057d5c8aa423127a1e3
Author: Thorsten Maerz <info at netztorte.de>
Date:   Sat Mar 27 18:45:52 2021 +0100

    Drag&drop (WIP): Enable; scrolling; autoexpand
    
    Enable drag&drop (no action performed yet).
    Reimplement scrolling + autoexpand/collapse.

diff --git a/src/folderview.c b/src/folderview.c
index 88014b72a..ac6045df7 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -141,6 +141,39 @@ static gboolean folderview_header_button_pressed	(GtkWidget *widget,
 							 GdkEvent *orgevent,
 							 gpointer user_data);
 
+#ifndef GENERIC_UMPC
+static void folderview_drag_begin	 (GtkWidget *widget,
+					  GdkDragContext *context,
+					  FolderView *folderview);
+#endif
+static void folderview_drag_data_get     (GtkWidget        *widget,
+					  GdkDragContext   *drag_context,
+					  GtkSelectionData *selection_data,
+					  guint             info,
+					  guint             time,
+					  FolderView       *folderview);
+static gboolean folderview_drag_motion_cb(GtkWidget      *widget,
+					  GdkDragContext *context,
+					  gint            x,
+					  gint            y,
+					  guint           time,
+					  FolderView     *folderview);
+static void folderview_drag_leave_cb     (GtkWidget        *widget,
+					  GdkDragContext   *context,
+					  guint             time,
+					  FolderView       *folderview);
+static void folderview_drag_received_cb  (GtkWidget        *widget,
+					  GdkDragContext   *drag_context,
+					  gint              x,
+					  gint              y,
+					  GtkSelectionData *data,
+					  guint             info,
+					  guint             time,
+					  FolderView       *folderview);
+static void folderview_drag_end_cb	 (GtkWidget	   *widget,
+					  GdkDragContext   *drag_context,
+					  FolderView	   *folderview);
+
 GHashTable *folderview_popups;
 
 static void create_action_groups		(gpointer key,
@@ -169,6 +202,12 @@ static GtkActionEntry folderview_header_popup_entries[] =
 	{"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},
+	{"text/uri-list", 0, TARGET_MAIL_URI_LIST}
+};
+
 static void folderview_update_row_iter(FolderView *folderview,
 				       GtkTreeIter *iter, FolderItem *item);
 
@@ -633,6 +672,37 @@ FolderView *folderview_create(MainWindow *mainwin)
 	g_signal_connect(G_OBJECT(folderview->treeview), "focus-in-event",
 			G_CALLBACK(focus_in_cb), folderview);
 
+        /* drag and drop callbacks */
+#ifndef GENERIC_UMPC
+	/* drag-n-dropping folders on maemo is impractical as this
+	 * opens the folder almost everytime */
+	g_signal_connect(G_OBJECT(folderview->treeview), "drag_begin",
+			 G_CALLBACK(folderview_drag_begin), folderview);
+#endif
+	g_signal_connect(G_OBJECT(folderview->treeview), "drag_data_get",
+			 G_CALLBACK(folderview_drag_data_get),
+			 folderview);
+	g_signal_connect(G_OBJECT(folderview->treeview), "drag_motion",
+			 G_CALLBACK(folderview_drag_motion_cb),
+			 folderview);
+	g_signal_connect(G_OBJECT(folderview->treeview), "drag_leave",
+			 G_CALLBACK(folderview_drag_leave_cb),
+			 folderview);
+	g_signal_connect(G_OBJECT(folderview->treeview), "drag_data_received",
+			 G_CALLBACK(folderview_drag_received_cb),
+			 folderview);
+	g_signal_connect(G_OBJECT(folderview->treeview), "drag_end",
+			 G_CALLBACK(folderview_drag_end_cb),
+			 folderview);
+	gtk_drag_source_set(folderview->treeview,
+			    GDK_BUTTON1_MASK,
+			    folderview_drag_types, 2,
+			    GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_DEFAULT);
+	gtk_drag_dest_set(folderview->treeview,
+			  GTK_DEST_DEFAULT_ALL & ~GTK_DEST_DEFAULT_HIGHLIGHT,
+			  folderview_drag_types, 2,
+			  GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_DEFAULT);
+
 	gtk_container_add(GTK_CONTAINER(scrolledwin), folderview->treeview);
 	gtk_widget_show_all(scrolledwin);
 
@@ -1766,20 +1836,440 @@ void folderview_unregister_popup(FolderViewPopup *fpopup)
 	g_hash_table_remove(folderview_popups, fpopup->klass);
 }
 
-void folderview_update_search_icon(FolderItem *item, gboolean matches)
+static void folderview_recollapse_paths(FolderView *folderview,
+					GtkTreePath *path)
 {
-	debug_print("========STUB======== folderview_update_search_icon\n");
+	GSList *list = NULL;
+	GSList *done = NULL;
+
+	for (list = folderview->paths_to_recollapse; list != NULL; list = g_slist_next(list)) {
+		GtkTreePath *listpath = list->data;
+		if (!gtk_tree_path_is_ancestor(listpath, path)
+		&&  listpath != path) {
+			gtk_tree_view_collapse_row(GTK_TREE_VIEW(folderview->treeview),
+						   listpath);
+			done = g_slist_append(done, listpath);
+		}
+	}
+	for (list = done; list != NULL; list = g_slist_next(list)) {
+		folderview->paths_to_recollapse = g_slist_remove(folderview->paths_to_recollapse,
+								 list->data);
+	}
+	g_slist_free(done);
 }
 
-void folderview_set_column_order(FolderView *folderview)
+static void drag_state_stop(FolderView *folderview)
 {
-	debug_print("========STUB======== folderview_set_column_order\n");
+	if (folderview->drag_timer_id)
+		g_source_remove(folderview->drag_timer_id);
+	folderview->drag_timer_id = 0;
+	folderview->drag_path = NULL;
+}
+
+static gboolean folderview_defer_expand(FolderView *folderview)
+{
+	if (folderview->drag_path) {
+		folderview_recollapse_paths(folderview, folderview->drag_path);
+		if (folderview->drag_item->collapsed) {
+			gtk_tree_view_expand_row(GTK_TREE_VIEW(folderview->treeview),
+						 folderview->drag_path, FALSE);
+			/* reverse order: child doesn't get closed, if parent is already closed. */
+			folderview->paths_to_recollapse = g_slist_insert
+				(folderview->paths_to_recollapse,
+				 folderview->drag_path, 0);
+		}
+	}
+	folderview->drag_item  = NULL;
+	folderview->drag_timer_id = 0;
+	return FALSE;
+}
+
+static void drag_state_start(FolderView *folderview, GtkTreePath *path, FolderItem *item)
+{
+	/* the idea is that we call drag_state_start() whenever we want expansion to
+	 * start after 'prefs_common.hover_time' msecs. if we want to cancel expansion,
+	 * we need to call drag_state_stop() */
+	drag_state_stop(folderview);
+	/* request expansion */
+	if (0 != (folderview->drag_timer_id = g_timeout_add
+			(prefs_common.hover_timeout,
+			 (GSourceFunc)folderview_defer_expand,
+			 folderview))) {
+		folderview->drag_path = path;
+		folderview->drag_item = item;
+	}
+}
+
+#ifndef GENERIC_UMPC
+static void folderview_drag_begin(GtkWidget *widget, GdkDragContext *context,
+			          FolderView *folderview)
+{
+//TM:	debug_print("========STUB======== folderview_drag_begin\n");
+	if (folderview->paths_to_recollapse)
+		g_slist_free(folderview->paths_to_recollapse);
+	folderview->paths_to_recollapse = NULL;
+	gtk_drag_set_icon_default(context);
+}
+#endif
+static void folderview_drag_data_get(GtkWidget        *widget,
+				     GdkDragContext   *drag_context,
+				     GtkSelectionData *selection_data,
+				     guint             info,
+				     guint             time,
+				     FolderView       *folderview)
+{
+	debug_print("========STUB======== folderview_drag_data_get\n");
+#if 0
+	FolderItem *item;
+	GList *sel;
+	gchar *source = NULL;
+	if (info == TARGET_DUMMY) {
+		sel = GTK_CMCLIST(folderview->ctree)->selection;
+		if (!sel)
+			return;
+
+		item = gtk_cmctree_node_get_row_data
+			(GTK_CMCTREE(folderview->ctree),
+			 GTK_CMCTREE_NODE(sel->data));
+		if (item) {
+			source = g_strdup_printf ("FROM_OTHER_FOLDER%s", folder_item_get_identifier(item));
+			gtk_selection_data_set(selection_data,
+					       gtk_selection_data_get_target(selection_data), 8,
+					       source, strlen(source));
+		}
+	} else {
+		g_warning("unknown info %d", info);
+	}
+#endif
+}
+
+static gboolean folderview_dnd_scroll_cb(gpointer data)
+{
+	FolderView *folderview = (FolderView *)data;
+	GtkAdjustment *pos = gtk_scrolled_window_get_vadjustment(
+				GTK_SCROLLED_WINDOW(folderview->scrolledwin));
+	gint new_val = (int)gtk_adjustment_get_value(pos) + folderview->scroll_value;
+	gint max = (int)gtk_adjustment_get_upper(pos) -
+               (int)gtk_adjustment_get_page_size(pos);
+
+	if (folderview->scroll_value == 0) {
+		folderview->scroll_timeout_id = 0;
+		return FALSE;
+	}
+
+	if (folderview->scroll_value > 0 && new_val > max) {
+		new_val = max;
+	} else if (folderview->scroll_value < 0 && new_val < 0) {
+		new_val = 0;
+	}
+	gtk_adjustment_set_value(pos, new_val);
+
+	return TRUE;
+}
+
+static gboolean folderview_drag_motion_cb(GtkWidget      *widget,
+					  GdkDragContext *context,
+					  gint            x,
+					  gint            y,
+					  guint           time,
+					  FolderView     *folderview)
+{
+//TM:	debug_print("========STUB======== folderview_drag_motion_cb\n");
+	GtkTreePath *path;
+	GtkTreeViewDropPosition drop_pos;
+	GtkTreeIter iter;
+	GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(folderview->treeview));
+	FolderItem *item = NULL, *src_item = NULL;
+	gboolean acceptable = FALSE;
+	GtkAdjustment *pos = gtk_scrolled_window_get_vadjustment(
+				GTK_SCROLLED_WINDOW(folderview->scrolledwin));
+	int height = (int)gtk_adjustment_get_page_size(pos);
+	int total_height = (int)gtk_adjustment_get_upper(pos);
+	int vpos = (int)gtk_adjustment_get_value(pos);
+	int offset = prefs_common.show_col_headers ? 24:0;
+	int dist;
+
+	gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(folderview->treeview),
+					  x, y, &path, &drop_pos);
+	if (path) {
+		GtkWidget *srcwidget;
+
+		if (y > height - (48 - offset) && height + vpos < total_height) {
+			dist = -(height - (48 - offset) - y);
+			folderview->scroll_value = 1.41f * (1+(dist / 6));
+		} else if (y < 72 - (24 - offset) && y >= 0) {
+			dist = 72 - (24 - offset) - y;
+			folderview->scroll_value = -1.41f * (1+(dist / 6));
+		} else {
+			folderview->scroll_value = 0;
+		}
+		if (folderview->scroll_value != 0 && folderview->scroll_timeout_id == 0) {
+			folderview->scroll_timeout_id =
+				g_timeout_add(30, folderview_dnd_scroll_cb,
+					      folderview);
+		}
+
+		gtk_tree_model_get_iter(model, &iter, path);
+		gtk_tree_model_get(model, &iter, F_COL_FOLDERITEM, &item, -1);
+		src_item = folderview->summaryview->folder_item;
+
+		srcwidget = gtk_drag_get_source_widget(context);
+		if (srcwidget == summary_get_main_widget(folderview->summaryview)) {
+			/* comes from summaryview */
+			/* we are copying messages, so only accept folder items that are not
+			   the source item, are no root items and can copy messages */
+			if (item && item->folder && folder_item_parent(item) != NULL && src_item &&
+			    src_item != item && FOLDER_CLASS(item->folder)->copy_msg != NULL &&
+			    FOLDER_TYPE(item->folder) != F_UNKNOWN)
+				acceptable = TRUE;
+		} else if (srcwidget == folderview->treeview) {
+			/* comes from folderview */
+			/* we are moving folder items, only accept folders that are not
+                           the source items and can copy messages and create folder items */
+			if (item && item->folder && src_item && src_item != item &&
+			    FOLDER_CLASS(item->folder)->copy_msg != NULL &&
+			    FOLDER_CLASS(item->folder)->create_folder != NULL &&
+			    ((FOLDER_TYPE(item->folder) != F_UNKNOWN &&  FOLDER_TYPE(src_item->folder) != F_UNKNOWN)
+			     || item->folder == src_item->folder))
+				acceptable = TRUE;
+		} else {
+			/* comes from another app */
+			/* we are adding messages, so only accept folder items that are
+			   no root items and can copy messages */
+			if (item && item->folder && folder_item_parent(item) != NULL
+			    && FOLDER_CLASS(item->folder)->add_msg != NULL &&
+			    FOLDER_TYPE(item->folder) != F_UNKNOWN)
+				acceptable = TRUE;
+		}
+	}
+
+	if (acceptable || (src_item && src_item == item))
+		drag_state_start(folderview, path, item);
+
+	if (acceptable) {
+//TM:		g_signal_handlers_block_by_func
+//			(G_OBJECT(widget),
+//			 G_CALLBACK(folderview_selected), folderview);
+//		gtk_cmctree_select(GTK_CMCTREE(widget), node);
+		gtk_tree_view_set_cursor(GTK_TREE_VIEW(folderview->treeview),
+					 path, NULL, FALSE);
+//		g_signal_handlers_unblock_by_func
+//			(G_OBJECT(widget),
+//			 G_CALLBACK(folderview_selected), folderview);
+		gdk_drag_status(context,
+					(gdk_drag_context_get_actions(context) == GDK_ACTION_COPY ?
+					GDK_ACTION_COPY : GDK_ACTION_MOVE) , time);
+	} else {
+//TM:		if (folderview->opened)
+//			gtk_cmctree_select(GTK_CMCTREE(widget), folderview->opened);
+		gdk_drag_status(context, 0, time);
+	}
+
+	return acceptable;
+}
+
+static void folderview_drag_leave_cb(GtkWidget      *widget,
+				     GdkDragContext *context,
+				     guint           time,
+				     FolderView     *folderview)
+{
+	debug_print("========STUB======== folderview_drag_leave_cb\n");
+#if 0
+	drag_state_stop(folderview);
+	folderview->scroll_value = 0;
+	gtk_cmctree_select(GTK_CMCTREE(widget), folderview->opened);
+#endif
+}
+
+static void free_info (gpointer stuff, gpointer data)
+{
+	debug_print("========STUB======== free_info\n");
+#if 0
+	g_free(stuff);
+#endif
 }
 
 void folderview_finish_dnd(const gchar *data, GdkDragContext *drag_context,
-			   guint  time, FolderItem *item)
+			   guint time, FolderItem *item)
 {
 	debug_print("========STUB======== folderview_finish_dnd\n");
+#if 0
+	GList *list, *tmp;
+	GSList *msglist = NULL;
+	list = uri_list_extract_filenames(data);
+	if (!(item && item->folder && folder_item_parent(item) != NULL
+		    && FOLDER_CLASS(item->folder)->add_msg != NULL))
+	{
+		gtk_drag_finish(drag_context, FALSE, FALSE, time);
+		debug_print("item doesn't fit\n");
+		return;
+	}
+	if (!list) {
+		gtk_drag_finish(drag_context, FALSE, FALSE, time);
+		debug_print("list is empty\n");
+		return;
+	}
+	for (tmp = list; tmp != NULL; tmp = tmp->next) {
+		MsgFileInfo *info = NULL;
+
+		if (file_is_email((gchar *)tmp->data)) {
+			info = g_new0(MsgFileInfo, 1);
+			info->msginfo = NULL;
+			info->file = (gchar *)tmp->data;
+			msglist = g_slist_prepend(msglist, info);
+			debug_print("file is a mail\n");
+		} else {
+			debug_print("file isn't a mail\n");
+		}
+	}
+	if (msglist) {
+		msglist = g_slist_reverse(msglist);
+		folder_item_add_msgs(item, msglist, FALSE);
+		g_slist_foreach(msglist, free_info, NULL);
+		g_slist_free(msglist);
+		gtk_drag_finish(drag_context, TRUE, FALSE, time);
+	} else {
+		gtk_drag_finish(drag_context, FALSE, FALSE, time);
+	}
+	list_free_strings_full(list);
+#endif
+}
+
+static void folderview_drag_received_cb(GtkWidget        *widget,
+					GdkDragContext   *drag_context,
+					gint              x,
+					gint              y,
+					GtkSelectionData *data,
+					guint             info,
+					guint             time,
+					FolderView       *folderview)
+{
+	debug_print("========STUB======== folderview_drag_received_cb\n");
+#if 0
+	gint row, column;
+	FolderItem *item = NULL, *src_item;
+	GtkCMCTreeNode *node;
+	int offset = prefs_common.show_col_headers ? 24:0;
+
+	folderview->scroll_value = 0;
+
+	if (info == TARGET_DUMMY) {
+		drag_state_stop(folderview);
+		const gchar *ddata = (const gchar *)gtk_selection_data_get_data(data);
+		if ((gchar *)strstr(ddata, "FROM_OTHER_FOLDER") != ddata) {
+			/* comes from summaryview */
+			if (gtk_cmclist_get_selection_info
+				(GTK_CMCLIST(widget), x - offset, y - offset, &row, &column) == 0)
+				return;
+
+			node = gtk_cmctree_node_nth(GTK_CMCTREE(widget), row);
+			item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(widget), node);
+			src_item = folderview->summaryview->folder_item;
+
+			if (item->no_select) {
+				alertpanel_error(_("The destination folder can only be used to "
+						   "store subfolders."));
+				return;
+			}
+			/* re-check (due to acceptable possibly set for folder moves */
+			if (!(item && item->folder && item->path && !item->no_select &&
+			      src_item && src_item != item && FOLDER_CLASS(item->folder)->copy_msg != NULL)) {
+				return;
+			}
+
+			switch (gdk_drag_context_get_selected_action(drag_context)) {
+			case GDK_ACTION_COPY:
+				summary_copy_selected_to(folderview->summaryview, item);
+				gtk_drag_finish(drag_context, TRUE, FALSE, time);
+				break;
+			case GDK_ACTION_MOVE:
+			case GDK_ACTION_DEFAULT:
+			default:
+				if (FOLDER_CLASS(src_item->folder)->remove_msg == NULL)
+					summary_copy_selected_to(folderview->summaryview, item);
+				else
+					summary_move_selected_to(folderview->summaryview, item);
+				gtk_drag_finish(drag_context, TRUE, TRUE, time);
+			}
+		} else {
+			/* comes from folderview */
+			char *source;
+			gboolean folder_is_normal = TRUE;
+			gboolean copy = (GDK_ACTION_COPY ==
+				gdk_drag_context_get_selected_action(drag_context));
+
+			source = (char *)gtk_selection_data_get_data(data) + 17;
+			if (gtk_cmclist_get_selection_info
+			    (GTK_CMCLIST(widget), x - offset, y - offset, &row, &column) == 0
+			    || *source == 0) {
+				gtk_drag_finish(drag_context, FALSE, FALSE, time);
+				return;
+			}
+			node = gtk_cmctree_node_nth(GTK_CMCTREE(widget), row);
+			item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(widget), node);
+			src_item = folder_find_item_from_identifier(source);
+
+			folder_is_normal =
+				src_item != NULL &&
+				src_item->stype == F_NORMAL &&
+				!folder_has_parent_of_type(src_item, F_OUTBOX) &&
+				!folder_has_parent_of_type(src_item, F_DRAFT) &&
+				!folder_has_parent_of_type(src_item, F_QUEUE) &&
+				!folder_has_parent_of_type(src_item, F_TRASH);
+			if (!item || !src_item || !folder_is_normal) {
+				gtk_drag_finish(drag_context, FALSE, FALSE, time);
+				return;
+			}
+
+			folderview_move_folder(folderview, src_item, item, copy);
+			gtk_drag_finish(drag_context, TRUE, TRUE, time);
+		}
+		folderview->nodes_to_recollapse = NULL;
+	} else if (info == TARGET_MAIL_URI_LIST) {
+		if (gtk_cmclist_get_selection_info
+			(GTK_CMCLIST(widget), x - offset, y - offset, &row, &column) == 0)
+			return;
+
+		node = gtk_cmctree_node_nth(GTK_CMCTREE(widget), row);
+		if (!node) {
+			gtk_drag_finish(drag_context, FALSE, FALSE, time);
+			debug_print("no node\n");
+			return;
+		}
+		item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(widget), node);
+		if (!item) {
+			gtk_drag_finish(drag_context, FALSE, FALSE, time);
+			debug_print("no item\n");
+			return;
+		}
+		folderview_finish_dnd(gtk_selection_data_get_data(data),
+			drag_context, time, item);
+	}
+#endif
+}
+
+static void folderview_drag_end_cb(GtkWidget	    *widget,
+				   GdkDragContext   *drag_context,
+                                   FolderView	    *folderview)
+{
+	debug_print("========STUB======== folderview_drag_end_cb\n");
+#if 0
+	drag_state_stop(folderview);
+	folderview->scroll_value = 0;
+	g_slist_free(folderview->nodes_to_recollapse);
+	folderview->nodes_to_recollapse = NULL;
+#endif
+}
+
+
+void folderview_update_search_icon(FolderItem *item, gboolean matches)
+{
+	debug_print("========STUB======== folderview_update_search_icon\n");
+}
+
+void folderview_set_column_order(FolderView *folderview)
+{
+	debug_print("========STUB======== folderview_set_column_order\n");
 }
 
 void folderview_close_opened(FolderView *folderview, gboolean dirty)
diff --git a/src/folderview.h b/src/folderview.h
index 8c006c90f..52c7d3295 100644
--- a/src/folderview.h
+++ b/src/folderview.h
@@ -61,6 +61,15 @@ struct _FolderView
 	FolderItem *menu_item; /* Pointer to item the popup menu is open for */
 
 	GHashTable *popups;
+
+	/* DND states */
+	GSList *paths_to_recollapse;
+	guint   drag_timer_id;		/* timer id */
+	FolderItem *drag_item;		/* dragged item */
+	GtkTreePath *drag_path;		/* drag node */
+
+	gint scroll_value;
+	guint scroll_timeout_id;
 };
 
 typedef struct _FolderViewPopup FolderViewPopup;

commit 6c4b56e72c7896746c007e36249a100b5e3d07cd
Author: Thorsten Maerz <info at netztorte.de>
Date:   Sat Mar 27 11:33:16 2021 +0100

    Avoid symbol names starting with an underscore

diff --git a/src/folderview.c b/src/folderview.c
index 10818e25f..88014b72a 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -138,7 +138,7 @@ static void folderview_send_queue_cb		(GtkAction *action,
 static void folderview_header_set_displayed_columns_cb	(GtkAction *gaction,
 							 gpointer data);
 static gboolean folderview_header_button_pressed	(GtkWidget *widget,
-							 GdkEvent *_event,
+							 GdkEvent *orgevent,
 							 gpointer user_data);
 
 GHashTable *folderview_popups;
@@ -455,7 +455,7 @@ static gboolean hook_folder_update(gpointer source,
 
 /* Helper function for folderview_create()
  * Sets up the treeview widget, minus connecting the signal handlers. */
-static GtkWidget *_treeview_create()
+static GtkWidget *treeview_create_unconnected()
 {
 	GtkTreeViewColumn *column;
 	GtkCellRenderer *renderer, *text_renderer;
@@ -464,7 +464,7 @@ static GtkWidget *_treeview_create()
 	GdkPixbuf *unread_pixbuf = NULL;
 	GdkPixbuf *total_pixbuf = NULL;
 
-	debug_print("_treeview_create\n");
+	debug_print("treeview_create_unconnected\n");
 
 	stock_pixbuf_gdk(STOCK_PIXMAP_NEW, &new_pixbuf);
 	stock_pixbuf_gdk(STOCK_PIXMAP_UNREAD, &unread_pixbuf);
@@ -610,7 +610,7 @@ FolderView *folderview_create(MainWindow *mainwin)
 		 prefs_common.folderview_vscrollbar_policy);
 	
 	folderview->scrolledwin = scrolledwin;
-	folderview->treeview = _treeview_create();
+	folderview->treeview = treeview_create_unconnected();
 
 	/* Set up signal callbacks for the treeview */
 	g_signal_connect(G_OBJECT(folderview->treeview), "button-press-event",
@@ -773,8 +773,9 @@ void folderview_init(FolderView *folderview)
  * Adds folder at 'node' to the tree, then calls itself for
  * all children of that folder. If 'expand_parent' is TRUE,
  * expand the parent row after adding ourself. */
-void _add_folder(FolderView *folderview, GtkTreeStore *store,
-		 GNode *node, GtkTreeIter *parent, gboolean expand_parent)
+void folderview_add_folder(FolderView *folderview, GtkTreeStore *store,
+			   GNode *node, GtkTreeIter *parent,
+			   gboolean expand_parent)
 {
 	GtkTreeIter iter;
 	GtkTreePath *path = NULL;
@@ -819,7 +820,7 @@ void _add_folder(FolderView *folderview, GtkTreeStore *store,
 
 	/* Add all children recursively */
 	for (n = node->children; n != NULL; n = n->next)
-		_add_folder(folderview, store, n, &iter, expand_me);
+		folderview_add_folder(folderview, store, n, &iter, expand_me);
 }
 
 /* This will effectively reset contents of the folderview, repopulating
@@ -838,7 +839,8 @@ void folderview_set(FolderView *folderview)
 	GList *list = folder_get_list();
 	for (; list != NULL; list = list->next) {
 		Folder *folder = FOLDER(list->data);
-		_add_folder(folderview, GTK_TREE_STORE(store), folder->node, NULL, FALSE);
+		folderview_add_folder(folderview, GTK_TREE_STORE(store),
+				      folder->node, NULL, FALSE);
 	}
 }
 
@@ -917,10 +919,10 @@ struct finditer_ctx {
  * gtk_tree_model_foreach(), and user_data has to point
  * to a struct finditer_ctx with a valid item member.
  * The iter member has to be freed by the caller afterwards. */
-static gboolean _find_iter_foreach_func(GtkTreeModel *model,
-					GtkTreePath *path,
-					GtkTreeIter *iter,
-					gpointer user_data)
+static gboolean folderview_find_iter_foreach_func(GtkTreeModel *model,
+						  GtkTreePath *path,
+						  GtkTreeIter *iter,
+						  gpointer user_data)
 {
 	struct finditer_ctx *ctx = (struct finditer_ctx *)user_data;
 	FolderItem *item;
@@ -931,7 +933,7 @@ static gboolean _find_iter_foreach_func(GtkTreeModel *model,
 			F_COL_FOLDERITEM, &item, -1);
 
 	if (ctx->item == item) {
-		debug_print("_find_iter_foreach_func: found the row for '%s'\n",
+		debug_print("folderview_find_iter_foreach_func: found the row for '%s'\n",
 				ctx->item->name);
 		/* We need to make our own copy of the iterator, since the
 		 * original is no longer valid after this function returns. */
@@ -951,7 +953,7 @@ static void folderview_add_folderitem(FolderView *folderview, FolderItem *item)
 	GtkTreeModel *model =
 		gtk_tree_view_get_model(GTK_TREE_VIEW(folderview->treeview));
 
-	gtk_tree_model_foreach(model, _find_iter_foreach_func, ctx);
+	gtk_tree_model_foreach(model, folderview_find_iter_foreach_func, ctx);
 
 	if (ctx->iter == NULL) {
 		g_free(ctx);
@@ -961,7 +963,8 @@ static void folderview_add_folderitem(FolderView *folderview, FolderItem *item)
 	GtkTreeIter *parent_iter = ctx->iter;
 
 	/* Add the folder */
-	_add_folder(folderview, GTK_TREE_STORE(model), item->node, parent_iter, TRUE);
+	folderview_add_folder(folderview, GTK_TREE_STORE(model), item->node,
+			      parent_iter, TRUE);
 
 	gtk_tree_iter_free(ctx->iter);
 	g_free(ctx);
@@ -984,7 +987,7 @@ static void folderview_remove_folderitem(FolderView *folderview,
 	GtkTreeModel *model =
 		gtk_tree_view_get_model(GTK_TREE_VIEW(folderview->treeview));
 
-	gtk_tree_model_foreach(model, _find_iter_foreach_func, ctx);
+	gtk_tree_model_foreach(model, folderview_find_iter_foreach_func, ctx);
 
 	if (ctx->iter == NULL) {
 		g_free(ctx);
@@ -1021,7 +1024,7 @@ void folderview_select(FolderView *folderview, FolderItem *item)
 	GtkTreeModel *model =
 		gtk_tree_view_get_model(GTK_TREE_VIEW(folderview->treeview));
 
-	gtk_tree_model_foreach(model, _find_iter_foreach_func, ctx);
+	gtk_tree_model_foreach(model, folderview_find_iter_foreach_func, ctx);
 
 	/* Place cursor on our row */
 	if (ctx->iter != NULL) {
@@ -1203,7 +1206,7 @@ static void get_row_pixbufs(FolderView *folderview, GtkTreeIter *iter,
 }
 
 static void folderview_update_row_iter(FolderView *folderview,
-				       GtkTreeIter *iter, FolderItem *_item)
+				       GtkTreeIter *iter, FolderItem *orgitem)
 {
 	gboolean expanded;
 	gboolean use_bold, use_color;
@@ -1217,7 +1220,7 @@ static void folderview_update_row_iter(FolderView *folderview,
 
 	GtkTreeModel *model =
 		gtk_tree_view_get_model(GTK_TREE_VIEW(folderview->treeview));
-	FolderItem *item = _item;
+	FolderItem *item = orgitem;
 
 	if (item == NULL) {
 		/* Get the FolderItem belonging to this row */
@@ -1316,7 +1319,7 @@ void folderview_update_row(FolderView *folderview,
 
 	debug_print("folderview_update_row for '%s'\n", item->name);
 
-	gtk_tree_model_foreach(model, _find_iter_foreach_func, ctx);
+	gtk_tree_model_foreach(model, folderview_find_iter_foreach_func, ctx);
 
 	if (ctx->iter != NULL)
 		folderview_update_row_iter(folderview, ctx->iter, item);
@@ -2401,10 +2404,10 @@ static void folderview_header_set_displayed_columns_cb(GtkAction *gaction,
 }
 
 static gboolean folderview_header_button_pressed(GtkWidget *widget,
-		GdkEvent *_event,
-		gpointer user_data)
+						 GdkEvent *orgevent,
+						 gpointer user_data)
 {
-	GdkEventButton *event = (GdkEventButton *)_event;
+	GdkEventButton *event = (GdkEventButton *)orgevent;
 	FolderView *folderview = (FolderView *)user_data;
 
 	cm_return_val_if_fail(folderview != NULL, FALSE);

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list