changeset 637:8a1202efa51e

Add some wrapper functions for not yet common code.
author zas_
date Mon, 12 May 2008 00:22:38 +0000
parents 2ea7af1fbfe0
children 8cc9f349c670
files src/view_file.c src/view_file.h src/view_file_icon.c src/view_file_icon.h src/view_file_list.c src/view_file_list.h
diffstat 6 files changed, 70 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/view_file.c	Sun May 11 23:56:40 2008 +0000
+++ b/src/view_file.c	Mon May 12 00:22:38 2008 +0000
@@ -318,6 +318,17 @@
 	info_window_new(NULL, vf_pop_menu_file_list(vf), NULL);
 }
 
+void vf_pop_menu_view_cb(GtkWidget *widget, gpointer data)
+{
+	ViewFile *vf = data;
+
+	switch(vf->type)
+	{
+	case FILEVIEW_LIST: vflist_pop_menu_view_cb(widget, data); break;
+	case FILEVIEW_ICON: vficon_pop_menu_view_cb(widget, data); break;
+	}
+}
+
 void vf_pop_menu_copy_cb(GtkWidget *widget, gpointer data)
 {
 	ViewFile *vf = data;
@@ -332,6 +343,17 @@
 	file_util_move(NULL, vf_pop_menu_file_list(vf), NULL, vf->listview);
 }
 
+void vf_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
+{
+	ViewFile *vf = data;
+
+	switch(vf->type)
+	{
+	case FILEVIEW_LIST: vflist_pop_menu_rename_cb(widget, data); break;
+	case FILEVIEW_ICON: vficon_pop_menu_rename_cb(widget, data); break;
+	}
+}
+
 void vf_pop_menu_delete_cb(GtkWidget *widget, gpointer data)
 {
 	ViewFile *vf = data;
@@ -441,6 +463,27 @@
 	}
 }
 
+void vf_pop_menu_refresh_cb(GtkWidget *widget, gpointer data)
+{
+	ViewFile *vf = data;
+
+	switch(vf->type)
+	{
+	case FILEVIEW_LIST: vflist_pop_menu_refresh_cb(widget, data); break;
+	case FILEVIEW_ICON: vficon_pop_menu_refresh_cb(widget, data); break;
+	}
+}
+
+void vf_popup_destroy_cb(GtkWidget *widget, gpointer data)
+{
+	ViewFile *vf = data;
+
+	switch(vf->type)
+	{
+	case FILEVIEW_LIST: vflist_popup_destroy_cb(widget, data); break;
+	case FILEVIEW_ICON: vficon_popup_destroy_cb(widget, data); break;
+	}
+}
 
 
 
--- a/src/view_file.h	Sun May 11 23:56:40 2008 +0000
+++ b/src/view_file.h	Mon May 12 00:22:38 2008 +0000
@@ -33,8 +33,10 @@
 GList *vf_pop_menu_file_list(ViewFile *vf);
 void vf_pop_menu_edit_cb(GtkWidget *widget, gpointer data);
 void vf_pop_menu_info_cb(GtkWidget *widget, gpointer data);
+void vf_pop_menu_view_cb(GtkWidget *widget, gpointer data);
 void vf_pop_menu_copy_cb(GtkWidget *widget, gpointer data);
 void vf_pop_menu_move_cb(GtkWidget *widget, gpointer data);
+void vf_pop_menu_rename_cb(GtkWidget *widget, gpointer data);
 void vf_pop_menu_delete_cb(GtkWidget *widget, gpointer data);
 void vf_pop_menu_copy_path_cb(GtkWidget *widget, gpointer data);
 void vf_pop_menu_sort_cb(GtkWidget *widget, gpointer data);
@@ -47,6 +49,8 @@
 void vf_pop_menu_res_mark_sel_cb(GtkWidget *widget, gpointer data);
 void vf_pop_menu_toggle_mark_sel_cb(GtkWidget *widget, gpointer data);
 void vf_pop_menu_toggle_view_type_cb(GtkWidget *widget, gpointer data);
+void vf_pop_menu_refresh_cb(GtkWidget *widget, gpointer data);
+void vf_popup_destroy_cb(GtkWidget *widget, gpointer data);
 
 FileData *vf_index_get_data(ViewFile *vf, gint row);
 gint vf_index_by_path(ViewFile *vf, const gchar *path);
--- a/src/view_file_icon.c	Sun May 11 23:56:40 2008 +0000
+++ b/src/view_file_icon.c	Mon May 12 00:22:38 2008 +0000
@@ -176,7 +176,7 @@
 	return g_list_append(NULL, file_data_ref(VFICON_INFO(vf, click_id)->fd));
 }
 
-static void vficon_pop_menu_view_cb(GtkWidget *widget, gpointer data)
+void vficon_pop_menu_view_cb(GtkWidget *widget, gpointer data)
 {
 	ViewFile *vf = data;
 
@@ -196,7 +196,7 @@
 		}
 }
 
-static void vficon_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
+void vficon_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
 {
 	ViewFile *vf = data;
 
@@ -210,14 +210,14 @@
 	vficon_toggle_filenames(vf);
 }
 
-static void vficon_pop_menu_refresh_cb(GtkWidget *widget, gpointer data)
+void vficon_pop_menu_refresh_cb(GtkWidget *widget, gpointer data)
 {
 	ViewFile *vf = data;
 
 	vf_refresh(vf);
 }
 
-static void vficon_popup_destroy_cb(GtkWidget *widget, gpointer data)
+void vficon_popup_destroy_cb(GtkWidget *widget, gpointer data)
 {
 	ViewFile *vf = data;
 	vficon_selection_remove(vf, VFICON_INFO(vf, click_id), SELECTION_PRELIGHT, NULL);
@@ -234,7 +234,7 @@
 	menu = popup_menu_short_lived();
 
 	g_signal_connect(G_OBJECT(menu), "destroy",
-			 G_CALLBACK(vficon_popup_destroy_cb), vf);
+			 G_CALLBACK(vf_popup_destroy_cb), vf);
 
 	submenu_add_edit(menu, &item, G_CALLBACK(vf_pop_menu_edit_cb), vf);
 	gtk_widget_set_sensitive(item, active);
@@ -251,7 +251,7 @@
 	menu_item_add_sensitive(menu, _("_Move..."), active,
 				G_CALLBACK(vf_pop_menu_move_cb), vf);
 	menu_item_add_sensitive(menu, _("_Rename..."), active,
-				G_CALLBACK(vficon_pop_menu_rename_cb), vf);
+				G_CALLBACK(vf_pop_menu_rename_cb), vf);
 	menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, active,
 				      G_CALLBACK(vf_pop_menu_delete_cb), vf);
 	if (options->show_copy_path)
@@ -272,7 +272,7 @@
 			    G_CALLBACK(vf_pop_menu_toggle_view_type_cb), vf);
 	menu_item_add_check(menu, _("Show filename _text"), VFICON_INFO(vf, show_text),
 			    G_CALLBACK(vficon_pop_menu_show_names_cb), vf);
-	menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH, G_CALLBACK(vficon_pop_menu_refresh_cb), vf);
+	menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH, G_CALLBACK(vf_pop_menu_refresh_cb), vf);
 
 	return menu;
 }
--- a/src/view_file_icon.h	Sun May 11 23:56:40 2008 +0000
+++ b/src/view_file_icon.h	Mon May 12 00:22:38 2008 +0000
@@ -28,7 +28,10 @@
 void vficon_sort_set(ViewFile *vf, SortType type, gint ascend);
 
 GList *vficon_pop_menu_file_list(ViewFile *vf);
-
+void vficon_pop_menu_view_cb(GtkWidget *widget, gpointer data);
+void vficon_pop_menu_rename_cb(GtkWidget *widget, gpointer data);
+void vficon_pop_menu_refresh_cb(GtkWidget *widget, gpointer data);
+void vficon_popup_destroy_cb(GtkWidget *widget, gpointer data);
 
 FileData *vficon_index_get_data(ViewFile *vf, gint row);
 gint vficon_index_by_path(ViewFile *vf, const gchar *path);
--- a/src/view_file_list.c	Sun May 11 23:56:40 2008 +0000
+++ b/src/view_file_list.c	Mon May 12 00:22:38 2008 +0000
@@ -289,7 +289,7 @@
 	return g_list_append(NULL, file_data_ref(VFLIST_INFO(vf, click_fd)));
 }
 
-static void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer data)
+void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer data)
 {
 	ViewFile *vf = data;
 
@@ -307,7 +307,7 @@
 		}
 }
 
-static void vflist_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
+void vflist_pop_menu_rename_cb(GtkWidget *widget, gpointer data)
 {
 	ViewFile *vf = data;
 	GList *list;
@@ -353,7 +353,7 @@
 		}
 }
 
-static void vflist_pop_menu_refresh_cb(GtkWidget *widget, gpointer data)
+void vflist_pop_menu_refresh_cb(GtkWidget *widget, gpointer data)
 {
 	ViewFile *vf = data;
 
@@ -361,7 +361,7 @@
 	vf_refresh(vf);
 }
 
-static void vflist_popup_destroy_cb(GtkWidget *widget, gpointer data)
+void vflist_popup_destroy_cb(GtkWidget *widget, gpointer data)
 {
 	ViewFile *vf = data;
 	vflist_color_set(vf, VFLIST_INFO(vf, click_fd), FALSE);
@@ -382,7 +382,7 @@
 
 	menu = popup_menu_short_lived();
 	g_signal_connect(G_OBJECT(menu), "destroy",
-			 G_CALLBACK(vflist_popup_destroy_cb), vf);
+			 G_CALLBACK(vf_popup_destroy_cb), vf);
 
 	if (col_idx >= FILE_COLUMN_MARKS && col_idx <= FILE_COLUMN_MARKS_LAST)
 		{
@@ -434,7 +434,7 @@
 	menu_item_add_stock_sensitive(menu, _("_Properties"), GTK_STOCK_PROPERTIES, active,
 				      G_CALLBACK(vf_pop_menu_info_cb), vf);
 	menu_item_add_stock_sensitive(menu, _("View in _new window"), GTK_STOCK_NEW, active,
-				      G_CALLBACK(vflist_pop_menu_view_cb), vf);
+				      G_CALLBACK(vf_pop_menu_view_cb), vf);
 
 	menu_item_add_divider(menu);
 	menu_item_add_stock_sensitive(menu, _("_Copy..."), GTK_STOCK_COPY, active,
@@ -442,7 +442,7 @@
 	menu_item_add_sensitive(menu, _("_Move..."), active,
 				G_CALLBACK(vf_pop_menu_move_cb), vf);
 	menu_item_add_sensitive(menu, _("_Rename..."), active,
-				G_CALLBACK(vflist_pop_menu_rename_cb), vf);
+				G_CALLBACK(vf_pop_menu_rename_cb), vf);
 	menu_item_add_stock_sensitive(menu, _("_Delete..."), GTK_STOCK_DELETE, active,
 				      G_CALLBACK(vf_pop_menu_delete_cb), vf);
 	if (options->show_copy_path)
@@ -464,7 +464,7 @@
 			    G_CALLBACK(vf_pop_menu_toggle_view_type_cb), vf);
 	menu_item_add_check(menu, _("Show _thumbnails"), VFLIST_INFO(vf, thumbs_enabled),
 			    G_CALLBACK(vflist_pop_menu_thumbs_cb), vf);
-	menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH, G_CALLBACK(vflist_pop_menu_refresh_cb), vf);
+	menu_item_add_stock(menu, _("Re_fresh"), GTK_STOCK_REFRESH, G_CALLBACK(vf_pop_menu_refresh_cb), vf);
 
 	return menu;
 }
--- a/src/view_file_list.h	Sun May 11 23:56:40 2008 +0000
+++ b/src/view_file_list.h	Mon May 12 00:22:38 2008 +0000
@@ -33,6 +33,10 @@
 void vflist_sort_set(ViewFile *vf, SortType type, gint ascend);
 
 GList *vflist_pop_menu_file_list(ViewFile *vf);
+void vflist_pop_menu_view_cb(GtkWidget *widget, gpointer data);
+void vflist_pop_menu_rename_cb(GtkWidget *widget, gpointer data);
+void vflist_pop_menu_refresh_cb(GtkWidget *widget, gpointer data);
+void vflist_popup_destroy_cb(GtkWidget *widget, gpointer data);
 
 FileData *vflist_index_get_data(ViewFile *vf, gint row);
 gint vflist_index_by_path(ViewFile *vf, const gchar *path);