Yasumichi Akahoshi
yasum****@users*****
2005年 4月 10日 (日) 00:11:30 JST
Index: cxplorer/src/cxplorer-window.c diff -u cxplorer/src/cxplorer-window.c:1.20 cxplorer/src/cxplorer-window.c:1.21 --- cxplorer/src/cxplorer-window.c:1.20 Sat Apr 9 18:27:24 2005 +++ cxplorer/src/cxplorer-window.c Sun Apr 10 00:11:30 2005 @@ -70,6 +70,7 @@ gpointer g_class); static void cxplorer_window_dispose (GObject * obj); static void cxplorer_window_finalize (GObject * obj); +static void cxplorer_window_entry_activate (GtkWidget *widget, gpointer user_data); static void cxplorer_window_on_directory_changed (CxpDirView * dirview, gpointer user_data); static void cxplorer_window_on_dir_double_clicked (CxpRightPane * right_pane, @@ -248,13 +249,15 @@ private->statusbar = statusbar; private->dispose_has_run = FALSE; + g_signal_connect (entry, "activate", + G_CALLBACK (cxplorer_window_entry_activate), + self); g_signal_connect (dirview, "directory_changed", G_CALLBACK (cxplorer_window_on_directory_changed), self); - g_signal_connect (G_OBJECT (right_pane), "dir_double_clicked", + g_signal_connect (right_pane, "dir_double_clicked", G_CALLBACK (cxplorer_window_on_dir_double_clicked), - (gpointer) self); - + self); } static void cxplorer_window_dispose (GObject * obj) @@ -322,6 +325,31 @@ } /** + * This function is called back when value of TextEntry is changed by user. + * @param gwCaller [in] GtkWidget which call this function. + * @param gpUserData [in] pointer to instance of Cxplorer. + * @todo Fixed me to process symlink. + */ +static void cxplorer_window_entry_activate (GtkWidget *widget, gpointer user_data) +{ + CxplorerWindowPrivate *private = CXPLORER_WINDOW_GET_PRIVATE (user_data); + const gchar *address; + + address = gtk_entry_get_text (GTK_ENTRY (widget)); + switch (address[0]) + { + case '/': + cxp_dir_view_change_directory (CXP_DIR_VIEW(private->dirview), address); + break; + case '.': + break; + default: + g_spawn_command_line_async (address, NULL); + break; + } +} + +/** * This function is called back when cursor is changed on directory view. * It have file list view shown file list. * @param treeview [in] Pointer to directory view. @@ -332,26 +360,32 @@ { CxplorerWindowPrivate *private = CXPLORER_WINDOW_GET_PRIVATE (user_data); - gchar *fullpath; + gchar *locale_path; + gchar *utf8_path; - fullpath = cxp_dir_view_get_current_directory (dirview); - gtk_entry_set_text (GTK_ENTRY (private->entry), fullpath); + locale_path = cxp_dir_view_get_current_directory (dirview); + utf8_path = g_locale_to_utf8(locale_path, -1, NULL, NULL, NULL); + gtk_entry_set_text (GTK_ENTRY (private->entry), utf8_path); cxp_right_pane_change_directory (CXP_RIGHT_PANE (private->right_pane), - fullpath); - g_free (fullpath); + locale_path); + g_free (locale_path); + g_free (utf8_path); } static void cxplorer_window_on_dir_double_clicked (CxpRightPane * right_pane, gpointer user_data) { CxplorerWindowPrivate *private = CXPLORER_WINDOW_GET_PRIVATE (user_data); - gchar *dir_name; + gchar *locale_path; + gchar *utf8_path; - dir_name = cxp_right_pane_get_active_file_name (right_pane); + locale_path = cxp_right_pane_get_active_file_name (right_pane); + utf8_path = g_locale_to_utf8(locale_path, -1, NULL, NULL, NULL); cxp_dir_view_change_directory (CXP_DIR_VIEW (private->dirview), - dir_name); - gtk_entry_set_text (GTK_ENTRY (private->entry), dir_name); - g_free (dir_name); + locale_path); + gtk_entry_set_text (GTK_ENTRY (private->entry), utf8_path); + g_free (locale_path); + g_free (utf8_path); } /**