Yasumichi Akahoshi
yasum****@users*****
2005年 4月 9日 (土) 16:33:01 JST
Index: cxplorer/src/cxplorer-window.c diff -u cxplorer/src/cxplorer-window.c:1.15 cxplorer/src/cxplorer-window.c:1.16 --- cxplorer/src/cxplorer-window.c:1.15 Sat Apr 9 16:16:04 2005 +++ cxplorer/src/cxplorer-window.c Sat Apr 9 16:33:01 2005 @@ -77,6 +77,8 @@ void cxplorer_window_delete_action (GtkWidget * widget, gpointer user_data); static void cxplorer_window_rename_action (GtkWidget *widget, gpointer user_data); static void cxplorer_window_property_action (GtkWidget * widget, gpointer user_data); +static void cxplorer_window_copy_action (GtkWidget * widget, gpointer user_data); +static void cxplorer_window_paste_action (GtkWidget *widget, gpointer user_data); /** * Actions @@ -97,8 +99,8 @@ {"QuitAction", "gtk-quit", N_("_Quit"), NULL, NULL, gtk_main_quit}, /* Edit menu */ {"EditAction", NULL, N_("_Edit"), NULL, NULL, NULL}, - {"CopyAction", "gtk-copy", N_("_Copy"), NULL, NULL, NULL}, - {"PasteAction", "gtk-paste", N_("_Paste"), NULL, NULL, NULL}, + {"CopyAction", "gtk-copy", N_("_Copy"), NULL, NULL, G_CALLBACK(cxplorer_window_copy_action)}, + {"PasteAction", "gtk-paste", N_("_Paste"), NULL, NULL, G_CALLBACK(cxplorer_window_paste_action)}, {"PrefAction", "gtk-preferences", N_("_Preferences"), NULL, NULL, NULL}, /* View menu */ {"ViewAction", NULL, N_("_View"), NULL, NULL, NULL}, @@ -432,6 +434,39 @@ } /** + * This function copy file to clipboard when user click "Edit->Copy". + * @param menuitem [in] Pointer to menu item "Edit->Copy". + * @param user_data [in] Pointer to instance of Cxplorer. + * @todo Implement code. + */ +static void cxplorer_window_copy_action (GtkWidget * widget, gpointer user_data) +{ + CxplorerWindowPrivate *private = CXPLORER_WINDOW_GET_PRIVATE (user_data); + gchar *fullpath; + GtkClipboard *clipboard; + + if ((fullpath = cxp_right_pane_get_active_file_name (CXP_RIGHT_PANE (private->right_pane))) != NULL) + { + clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY); + gtk_clipboard_set_text (clipboard, fullpath, -1); + g_free (fullpath); + } +} + +/** + * This function paste file from clipboard when user click "Edit->Paste". + * @param menuitem [in] Pointer to menu item "Edit->Paste". + * @param user_data [in] Pointer to instance of Cxplorer. + * @todo Implement code. + */ +static void cxplorer_window_paste_action (GtkWidget *widget, gpointer user_data) +{ + CxplorerWindowPrivate *private = CXPLORER_WINDOW_GET_PRIVATE (user_data); + + cxp_right_pane_paste_from_clipboard (CXP_RIGHT_PANE(private->right_pane)); +} + +/** * This function show about dialog when user click "Help->About". * @param menuitem [in] Pointer to menu item "Help->About". * @param user_data [in] Pointer to data which is defined by user, but it isn't