Yasumichi Akahoshi
yasum****@users*****
2005年 4月 9日 (土) 15:41:36 JST
Index: cxplorer/src/actcalls.c diff -u cxplorer/src/actcalls.c:1.32 cxplorer/src/actcalls.c:removed --- cxplorer/src/actcalls.c:1.32 Wed Apr 6 01:01:59 2005 +++ cxplorer/src/actcalls.c Sat Apr 9 15:41:36 2005 @@ -1,194 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - * @file - * @brief This file contains common action. - * - * This file conatains common functions which is called back by GtkMenuItem and - * GtkButton on toolbar. - * @author Yasumichi Akahoshi <yasum****@users*****> - * @date Fri Jun 11 00:16:18 2004 - * $Revision: 1.32 $ - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <cxp.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include "cxplorer.h" -#include "cxp-property-dialog.h" -#include "cxp-right-pane.h" - -/** - * This function generate new file in directory when user click - * "File->New->File". - * @param menuitem [in] Pointer to menu item "File->New->File". - * @param user_data [in] Pointer to data which is defined by user. - */ -void on_new_file_activate (GtkWidget * gwCaller, gpointer user_data) -{ - Cxplorer *cxplorer; - gchar *user_input; - GtkWidget *dialog; - - cxplorer = (Cxplorer *) user_data; - dialog = cxp_entry_dialog_new(_("New file"), _("Please input the name of a new file."), _("NewFile")); - if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) - { - user_input = cxp_entry_dialog_get_entry_text (CXP_ENTRY_DIALOG(dialog)); - cxp_right_pane_make_file (CXP_RIGHT_PANE (cxplorer->right_pane), - user_input); - g_free(user_input); - } - gtk_widget_destroy(dialog); -} - -/** - * This function delete selected file when user clicked "File->Delete". - * @param menuitem [in] Pointer to menu item "File->Delete". - * @param user_data [in] Pointer to instance of Cxplorer. - * @todo Implement code to remove directory. - */ -void on_delete_activate (GtkWidget * gwCaller, gpointer user_data) -{ - Cxplorer *cxplorer; - - cxplorer = (Cxplorer *) user_data; - cxp_right_pane_delete_current_file (CXP_RIGHT_PANE - (cxplorer->right_pane)); -} - -/** - * This function show property of selected file when user click - * "File->Property". - * @param menuitem [in] Pointer to menu item "File->Property". - * @param user_data [in] Pointer to instance of Cxplorer. - * @todo Implement code. - */ -void on_property_activate (GtkWidget * gwCaller, gpointer user_data) -{ - Cxplorer *cxplorer; - gchar *fullpath; - GtkWidget *dialog; - - cxplorer = (Cxplorer *) user_data; - if ((fullpath = - cxp_right_pane_get_active_file_name (CXP_RIGHT_PANE - (cxplorer->right_pane))) != - NULL) - { - dialog = cxp_property_dialog_new (fullpath); - - gtk_dialog_run (GTK_DIALOG (dialog)); - - gtk_widget_destroy (dialog); - - g_free (fullpath); - } -} - -/** - * 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. - */ -void on_copy_activate (GtkWidget * gwCaller, gpointer user_data) -{ - Cxplorer *cxplorer; - gchar *fullpath; - GtkClipboard *clipboard; - - cxplorer = (Cxplorer *) user_data; - - if ((fullpath = - cxp_right_pane_get_active_file_name (CXP_RIGHT_PANE - (cxplorer->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. - */ -void on_paste_activate (GtkWidget * gwCaller, gpointer user_data) -{ - Cxplorer *cxplorer = (Cxplorer *)user_data; - - cxp_right_pane_paste_from_clipboard (CXP_RIGHT_PANE(cxplorer->right_pane)); -} - -/** - * This function refresh views When user request. - * @param gwCaller [in] Pointer to GtkWidget which calls this function. - * @param user_data [in] Pointer to data which is defined by user. - */ -void on_refresh_views_activate (GtkWidget * gwCaller, gpointer user_data) -{ - Cxplorer *cxplorer; - - cxplorer = (Cxplorer *) user_data; - cxp_dir_view_refresh (cxplorer->dirview); -} - -/** - * This function select home directory when user request. - * @param gwCaller [in] Pointer to GtkWidget which calls this function. - * @param user_data [in] Pointer to data which is defined by user. - */ -void on_go_home_activate (GtkWidget * gwCaller, gpointer user_data) -{ - Cxplorer *cxplorer; - - cxplorer = (Cxplorer *) user_data; - cxp_dir_view_change_directory (cxplorer->dirview, g_get_home_dir ()); -} - -/** - * This function select parent directory when user request. - * @param gwCaller [in] Pointer to GtkWidget which calls this function. - * @param user_data [in] Pointer to data which is defined by user. - */ -void on_go_parent_directory (GtkWidget * gwCaller, gpointer user_data) -{ - gchar *gcParentDirectory; - gchar *gcCurrentDirectory; - - gcCurrentDirectory = - cxplorer_get_current_directory ((Cxplorer *) user_data); - if (gcCurrentDirectory != NULL) - { - gcParentDirectory = g_path_get_dirname (gcCurrentDirectory); - cxp_dir_view_change_directory (((Cxplorer *) user_data)-> - dirview, gcParentDirectory); - g_free (gcParentDirectory); - g_free (gcCurrentDirectory); - } -} Index: cxplorer/src/actcalls.h diff -u cxplorer/src/actcalls.h:1.2 cxplorer/src/actcalls.h:removed --- cxplorer/src/actcalls.h:1.2 Sun Jul 11 00:38:46 2004 +++ cxplorer/src/actcalls.h Sat Apr 9 15:41:36 2005 @@ -1,33 +0,0 @@ -/** - * @file - * @brief This file contains prototypes of function in actcalls.c. - * - * @sa actcalls.c - * @author Yasumichi Akahoshi <yasum****@users*****> - * @date Fri Jun 11 00:19:10 2004 - * $Revision: 1.2 $ - */ - -#ifndef _ACTCALLS_H -#define _ACTCALLS_H - -#ifdef __cplusplus -extern "C" -{ -#endif - - void on_new_file_activate (GtkWidget * gwCaller, gpointer user_data); - void on_delete_activate (GtkWidget * gwCaller, gpointer user_data); - void on_property_activate (GtkWidget * gwCaller, gpointer user_data); - void on_copy_activate (GtkWidget * gwCaller, gpointer user_data); - void on_paste_activate (GtkWidget * gwCaller, gpointer user_data); - void on_refresh_views_activate (GtkWidget * gwCaller, - gpointer user_data); - void on_go_home_activate (GtkWidget * gwCaller, gpointer user_data); - void on_go_parent_directory (GtkWidget * gwCaller, gpointer user_data); - -#ifdef __cplusplus -} -#endif - -#endif /* _ACTCALLS_H */ Index: cxplorer/src/cxplorer-window.c diff -u cxplorer/src/cxplorer-window.c:1.12 cxplorer/src/cxplorer-window.c:1.13 --- cxplorer/src/cxplorer-window.c:1.12 Sat Apr 9 15:24:40 2005 +++ cxplorer/src/cxplorer-window.c Sat Apr 9 15:41:36 2005 @@ -72,6 +72,7 @@ static void cxplorer_window_on_dir_double_clicked (CxpRightPane * right_pane, gpointer user_data); static void cxplorer_window_new_win_action (GtkWidget *widget, gpointer user_data); +void cxplorer_window_delete_action (GtkWidget * widget, gpointer user_data); static void cxplorer_window_rename_action (GtkWidget *widget, gpointer user_data); /** @@ -85,7 +86,7 @@ {"NewWinAction", NULL, N_("_Window"), NULL, NULL, G_CALLBACK(cxplorer_window_new_win_action)}, {"NewFileAction", "gtk-new", N_("_File..."), NULL, NULL, NULL}, {"NewDirAction", NULL, N_("_Directory..."), NULL, NULL, NULL}, - {"DeleteAction", "gtk-delete", N_("_Delete"), NULL, NULL, NULL}, + {"DeleteAction", "gtk-delete", N_("_Delete"), NULL, NULL, G_CALLBACK(cxplorer_window_delete_action)}, {"RenameAction", NULL, N_("_Rename..."), NULL, NULL, G_CALLBACK(cxplorer_window_rename_action)}, {"SendAction", NULL, N_("_Send to"), NULL, NULL, NULL}, {"MailAction", NULL, N_("_Mail"), NULL, NULL, NULL}, @@ -354,6 +355,19 @@ } /** + * This function delete selected file when user clicked "File->Delete". + * @param menuitem [in] Pointer to menu item "File->Delete". + * @param user_data [in] Pointer to instance of Cxplorer. + * @todo Implement code to remove directory. + */ +void cxplorer_window_delete_action (GtkWidget * widget, gpointer user_data) +{ + CxplorerWindowPrivate *private = CXPLORER_WINDOW_GET_PRIVATE (user_data); + + cxp_right_pane_delete_current_file (CXP_RIGHT_PANE(private->right_pane)); +} + +/** * This function rename selected file when user click "File->Rename". * @param menuitem [in] Pointer to menu item "File->Rename". * @param user_data [in] Pointer to instance of Cxplorer.