diff options
author | Alexander Larsson <alexl@redhat.com> | 2004-11-19 15:34:54 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2004-11-19 15:34:54 +0000 |
commit | 3beb26a74f8fe364d98068db4efce51100c6627d (patch) | |
tree | e3e6f54276d418491bec7fe086ff1f89d774302c | |
parent | 167478ebee55d6b403fc1fee08a67aa846d76b6f (diff) | |
download | nautilus-3beb26a74f8fe364d98068db4efce51100c6627d.tar.gz |
Require new eel
2004-11-19 Alexander Larsson <alexl@redhat.com>
* configure.in:
Require new eel
* src/file-manager/fm-actions.h:
* src/file-manager/fm-directory-view.[ch]:
* src/file-manager/nautilus-directory-view-ui.xml:
* src/nautilus-actions.h:
* src/nautilus-shell-ui.xml:
* src/nautilus-spatial-window-ui.xml:
* src/nautilus-spatial-window.c:
* src/nautilus-window-menus.c:
* src/nautilus-window.[ch]:
Implement some accels as GtkBindings instead to avoid
overriding widget-specific keybindings like "delete" and "backspace".
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | src/file-manager/fm-actions.h | 4 | ||||
-rw-r--r-- | src/file-manager/fm-directory-view.c | 84 | ||||
-rw-r--r-- | src/file-manager/fm-directory-view.h | 4 | ||||
-rw-r--r-- | src/file-manager/nautilus-directory-view-ui.xml | 3 | ||||
-rw-r--r-- | src/nautilus-actions.h | 2 | ||||
-rw-r--r-- | src/nautilus-shell-ui.xml | 1 | ||||
-rw-r--r-- | src/nautilus-spatial-window-ui.xml | 2 | ||||
-rw-r--r-- | src/nautilus-spatial-window.c | 51 | ||||
-rw-r--r-- | src/nautilus-window-menus.c | 2 | ||||
-rw-r--r-- | src/nautilus-window.c | 51 | ||||
-rw-r--r-- | src/nautilus-window.h | 4 |
13 files changed, 129 insertions, 98 deletions
@@ -1,5 +1,22 @@ 2004-11-19 Alexander Larsson <alexl@redhat.com> + * configure.in: + Require new eel + + * src/file-manager/fm-actions.h: + * src/file-manager/fm-directory-view.[ch]: + * src/file-manager/nautilus-directory-view-ui.xml: + * src/nautilus-actions.h: + * src/nautilus-shell-ui.xml: + * src/nautilus-spatial-window-ui.xml: + * src/nautilus-spatial-window.c: + * src/nautilus-window-menus.c: + * src/nautilus-window.[ch]: + Implement some accels as GtkBindings instead to avoid + overriding widget-specific keybindings like "delete" and "backspace". + +2004-11-19 Alexander Larsson <alexl@redhat.com> + * src/nautilus-navigation-window.c: * src/nautilus-window-private.h: Put location entry etc in a toolbar. diff --git a/configure.in b/configure.in index 5bf299716..59179defd 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ dnl =========================================================================== ART_REQUIRED=2.3.10 BONOBO_ACTIVATION_REQUIRED=2.1.0 BONOBO_REQUIRED=2.1.0 -EEL_REQUIRED=2.8.2 +EEL_REQUIRED=2.9.1 ESOUND_REQUIRED=0.2.27 GLIB_REQUIRED=2.3.0 GNOME_DESKTOP_REQUIRED=2.1.0 diff --git a/src/file-manager/fm-actions.h b/src/file-manager/fm-actions.h index 83f13b058..1421669d0 100644 --- a/src/file-manager/fm-actions.h +++ b/src/file-manager/fm-actions.h @@ -45,11 +45,7 @@ #define FM_ACTION_CREATE_LINK "Create Link" #define FM_ACTION_SELECT_ALL "Select All" #define FM_ACTION_TRASH "Trash" -#define FM_ACTION_TRASH_ACCEL "TrashAccel" -#define FM_ACTION_TRASH_ACCEL2 "TrashAccel2" -#define FM_ACTION_TRASH_ACCEL3 "TrashAccel3" #define FM_ACTION_DELETE "Delete" -#define FM_ACTION_DELETE_ACCEL "DeleteAccel" #define FM_ACTION_SHOW_HIDDEN_FILES "Show Hidden Files" #define FM_ACTION_RESET_BACKGROUND "Reset Background" #define FM_ACTION_CONNECT_TO_SERVER_LINK "Connect To Server Link" diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index de658e309..7aaf3dc1b 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -46,6 +46,7 @@ #include <eel/eel-stock-dialogs.h> #include <eel/eel-string.h> #include <eel/eel-vfs-extensions.h> +#include <eel/eel-marshal.h> #include <gtk/gtkcheckmenuitem.h> #include <gtk/gtkclipboard.h> #include <gtk/gtkmain.h> @@ -57,6 +58,7 @@ #include <gtk/gtkhbox.h> #include <gtk/gtktoggleaction.h> #include <gtk/gtkentry.h> +#include <gtk/gtkbindings.h> #include <libgnome/gnome-i18n.h> #include <libgnome/gnome-util.h> #include <libgnomeui/gnome-uidefs.h> @@ -133,6 +135,8 @@ enum { LOAD_ERROR, MOVE_COPY_ITEMS, REMOVE_FILE, + TRASH, + DELETE, LAST_SIGNAL }; @@ -802,6 +806,13 @@ trash_or_delete_selected_files (FMDirectoryView *view) nautilus_file_list_free (selection); } +static gboolean +real_trash (FMDirectoryView *view) +{ + trash_or_delete_selected_files (view); + return TRUE; +} + static void action_trash_callback (GtkAction *action, gpointer callback_data) @@ -892,6 +903,16 @@ action_delete_callback (GtkAction *action, delete_selected_files (FM_DIRECTORY_VIEW (callback_data)); } +static gboolean +real_delete (FMDirectoryView *view) +{ + if (!show_delete_command_auto_value) { + return FALSE; + } + delete_selected_files (view); + return TRUE; +} + static void action_duplicate_callback (GtkAction *action, gpointer callback_data) @@ -5795,26 +5816,10 @@ static GtkActionEntry directory_view_entries[] = { N_("Mo_ve to Trash"), "<control>T", /* label, accelerator */ N_("Move each selected item to the Trash"), /* tooltip */ G_CALLBACK (action_trash_callback) }, - { "TrashAccel", NULL, /* name, stock id */ - "TrashAccel", "Delete", /* label, accelerator */ - NULL, /* tooltip */ - G_CALLBACK (action_trash_callback) }, - { "TrashAccel2", NULL, /* name, stock id */ - "TrashAccel2", "KP_Delete", /* label, accelerator */ - NULL, /* tooltip */ - G_CALLBACK (action_trash_callback) }, - { "TrashAccel3", NULL, /* name, stock id */ - "TrashAccel3", "<control>BackSpace", /* label, accelerator */ - NULL, /* tooltip */ - G_CALLBACK (action_trash_callback) }, { "Delete", NULL, /* name, stock id */ N_("_Delete"), "<shift>Delete", /* label, accelerator */ N_("Delete each selected item, without moving to the Trash"), /* tooltip */ G_CALLBACK (action_delete_callback) }, - { "DeleteAccel", NULL, /* name, stock id */ - "DeleteAccel", "<shift>KP_Delete", /* label, accelerator */ - NULL, /* tooltip */ - G_CALLBACK (action_delete_callback) }, { "Reset to Defaults", NULL, /* name, stock id */ N_("Reset View to _Defaults"), NULL, /* label, accelerator */ N_("Reset sorting order and zoom level to match preferences for this view"), /* tooltip */ @@ -6265,17 +6270,6 @@ real_update_menus (FMDirectoryView *view) gtk_action_set_sensitive (action, can_delete_files); action = gtk_action_group_get_action (view->details->dir_action_group, - FM_ACTION_TRASH_ACCEL); - gtk_action_set_sensitive (action, can_delete_files); - action = gtk_action_group_get_action (view->details->dir_action_group, - FM_ACTION_TRASH_ACCEL2); - gtk_action_set_sensitive (action, can_delete_files); - action = gtk_action_group_get_action (view->details->dir_action_group, - FM_ACTION_TRASH_ACCEL3); - gtk_action_set_sensitive (action, can_delete_files); - - - action = gtk_action_group_get_action (view->details->dir_action_group, FM_ACTION_DELETE); gtk_action_set_visible (action, show_separate_delete_command); @@ -6285,12 +6279,6 @@ real_update_menus (FMDirectoryView *view) NULL); gtk_action_set_sensitive (action, can_delete_files); } - - action = gtk_action_group_get_action (view->details->dir_action_group, - FM_ACTION_DELETE_ACCEL); - gtk_action_set_sensitive (action, - show_separate_delete_command && can_delete_files); - action = gtk_action_group_get_action (view->details->dir_action_group, FM_ACTION_DUPLICATE); @@ -7793,6 +7781,7 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass) { GtkWidgetClass *widget_class; GtkScrolledWindowClass *scrolled_window_class; + GtkBindingSet *binding_set; widget_class = GTK_WIDGET_CLASS (klass); scrolled_window_class = GTK_SCROLLED_WINDOW_CLASS (klass); @@ -7934,4 +7923,33 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass) G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + signals[TRASH] = + g_signal_new ("trash", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (FMDirectoryViewClass, trash), + g_signal_accumulator_true_handled, NULL, + eel_marshal_BOOLEAN__VOID, + G_TYPE_BOOLEAN, 0); + signals[DELETE] = + g_signal_new ("delete", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (FMDirectoryViewClass, trash), + g_signal_accumulator_true_handled, NULL, + eel_marshal_BOOLEAN__VOID, + G_TYPE_BOOLEAN, 0); + + binding_set = gtk_binding_set_by_class (klass); + gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, GDK_CONTROL_MASK, + "trash", 0); + gtk_binding_entry_add_signal (binding_set, GDK_Delete, 0, + "trash", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Delete, 0, + "trash", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Delete, GDK_SHIFT_MASK, + "delete", 0); + + klass->trash = real_trash; + klass->delete = real_delete; } diff --git a/src/file-manager/fm-directory-view.h b/src/file-manager/fm-directory-view.h index c6c4e92b6..0623109e9 100644 --- a/src/file-manager/fm-directory-view.h +++ b/src/file-manager/fm-directory-view.h @@ -283,6 +283,10 @@ struct FMDirectoryViewClass { void (* sort_directories_first_changed) (FMDirectoryView *view); void (* emblems_changed) (FMDirectoryView *view); + + /* Signals used only for keybindings */ + gboolean (* trash) (FMDirectoryView *view); + gboolean (* delete) (FMDirectoryView *view); }; /* GObject support */ diff --git a/src/file-manager/nautilus-directory-view-ui.xml b/src/file-manager/nautilus-directory-view-ui.xml index 0c9bdc042..d8692004f 100644 --- a/src/file-manager/nautilus-directory-view-ui.xml +++ b/src/file-manager/nautilus-directory-view-ui.xml @@ -2,9 +2,6 @@ <accelerator action="OpenAccel"/> <accelerator action="OpenCloseParent"/> <accelerator action="PropertiesAccel"/> -<accelerator action="TrashAccel"/> -<accelerator action="TrashAccel2"/> -<accelerator action="TrashAccel3"/> <menubar name="MenuBar"> <menu action="File"> <placeholder name="New Items Placeholder"> diff --git a/src/nautilus-actions.h b/src/nautilus-actions.h index 78cb1414c..8d5f69982 100644 --- a/src/nautilus-actions.h +++ b/src/nautilus-actions.h @@ -32,8 +32,6 @@ #define NAUTILUS_ACTION_UP "Up" #define NAUTILUS_ACTION_UP_ACCEL "UpAccel" #define NAUTILUS_ACTION_UP_ACCEL "UpAccel" -#define NAUTILUS_ACTION_UP_CLOSE_ACCEL "UpCloseAccel" -#define NAUTILUS_ACTION_UP_CLOSE_ACCEL2 "UpCloseAccel2" #define NAUTILUS_ACTION_FORWARD "Forward" #define NAUTILUS_ACTION_SHOW_HIDE_SIDEBAR "Show Hide Sidebar" #define NAUTILUS_ACTION_SHOW_HIDE_STATUSBAR "Show Hide Statusbar" diff --git a/src/nautilus-shell-ui.xml b/src/nautilus-shell-ui.xml index 276efcdcd..ed4770e85 100644 --- a/src/nautilus-shell-ui.xml +++ b/src/nautilus-shell-ui.xml @@ -1,5 +1,4 @@ <ui> -<accelerator action="UpAccel"/> <menubar name="MenuBar"> <menu action="File"> <placeholder name="New Items Placeholder"/> diff --git a/src/nautilus-spatial-window-ui.xml b/src/nautilus-spatial-window-ui.xml index e6b1dfe7e..5b3d9178f 100644 --- a/src/nautilus-spatial-window-ui.xml +++ b/src/nautilus-spatial-window-ui.xml @@ -1,6 +1,4 @@ <ui> -<accelerator action="UpCloseAccel"/> -<accelerator action="UpCloseAccel2"/> <menubar name="MenuBar"> <menu action="File"> <placeholder name="Location Placeholder"> diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c index 09425cb06..cb0b625fe 100644 --- a/src/nautilus-spatial-window.c +++ b/src/nautilus-spatial-window.c @@ -311,14 +311,6 @@ action_close_all_folders_callback (GtkAction *action, } static void -action_go_up_close_callback (GtkAction *action, - gpointer user_data) -{ - nautilus_window_go_up (NAUTILUS_WINDOW (user_data), TRUE); -} - - -static void real_prompt_for_location (NautilusWindow *window) { GtkWidget *dialog; @@ -368,30 +360,6 @@ real_window_close (NautilusWindow *window) nautilus_spatial_window_save_show_hidden_files_mode (NAUTILUS_SPATIAL_WINDOW (window)); } -static void -real_allow_up (NautilusWindow *nautilus_window, gboolean allow) -{ - GtkAction *action; - NautilusSpatialWindow *window; - - window = NAUTILUS_SPATIAL_WINDOW (nautilus_window); - - EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS, allow_up, - (nautilus_window, allow)); - - action = gtk_action_group_get_action (window->details->spatial_action_group, - NAUTILUS_ACTION_UP_CLOSE_ACCEL); - if (action != NULL) { - gtk_action_set_sensitive (action, allow); - } - action = gtk_action_group_get_action (window->details->spatial_action_group, - NAUTILUS_ACTION_UP_CLOSE_ACCEL2); - if (action != NULL) { - gtk_action_set_sensitive (action, allow); - } -} - - static void real_get_default_size (NautilusWindow *window, guint *default_width, guint *default_height) @@ -615,12 +583,6 @@ static GtkActionEntry spatial_entries[] = { { "Close All Folders", NULL, N_("Clos_e All Folders"), /* name, stock id, label */ "<control>Q", N_("Close all folder windows"), G_CALLBACK (action_close_all_folders_callback) }, - { "UpCloseAccel", NULL, N_("Go up and close the current window"), /* name, stock id, label */ - "<alt><shift>Up", NULL, - G_CALLBACK (action_go_up_close_callback) }, - { "UpCloseAccel2", NULL, N_("Go up and close the current window"), /* name, stock id, label */ - "<shift>BackSpace", NULL, - G_CALLBACK (action_go_up_close_callback) }, }; static void @@ -703,6 +665,8 @@ nautilus_spatial_window_instance_init (NautilusSpatialWindow *window) static void nautilus_spatial_window_class_init (NautilusSpatialWindowClass *class) { + GtkBindingSet *binding_set; + NAUTILUS_WINDOW_CLASS (class)->window_type = NAUTILUS_WINDOW_SPATIAL; G_OBJECT_CLASS (class)->finalize = nautilus_spatial_window_finalize; @@ -721,8 +685,17 @@ nautilus_spatial_window_class_init (NautilusSpatialWindowClass *class) NAUTILUS_WINDOW_CLASS (class)->close = real_window_close; NAUTILUS_WINDOW_CLASS(class)->get_default_size = real_get_default_size; - NAUTILUS_WINDOW_CLASS(class)->allow_up = real_allow_up; NAUTILUS_WINDOW_CLASS(class)->set_throbber_active = real_set_throbber_active; + + + binding_set = gtk_binding_set_by_class (class); + gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, GDK_SHIFT_MASK, + "go_up", 1, + G_TYPE_BOOLEAN, TRUE); + gtk_binding_entry_add_signal (binding_set, GDK_Up, GDK_SHIFT_MASK | GDK_MOD1_MASK, + "go_up", 1, + G_TYPE_BOOLEAN, TRUE); + } diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c index f7ae6c7e8..79dcacf34 100644 --- a/src/nautilus-window-menus.c +++ b/src/nautilus-window-menus.c @@ -592,7 +592,7 @@ static GtkActionEntry main_entries[] = { "<alt>Up", N_("Open the parent folder"), G_CALLBACK (action_up_callback) }, { "UpAccel", NULL, "UpAccel", /* name, stock id, label */ - "BackSpace", NULL, + "", NULL, G_CALLBACK (action_up_callback) }, { "Stop", GTK_STOCK_STOP, /* name, stock id */ N_("_Stop"), NULL, /* label, accelerator */ diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 63a6e8315..c3e2e09a4 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -39,6 +39,7 @@ #include "nautilus-window-manage-views.h" #include "nautilus-zoom-control.h" #include <eel/eel-debug.h> +#include <eel/eel-marshal.h> #include <eel/eel-gdk-extensions.h> #include <eel/eel-gdk-pixbuf-extensions.h> #include <eel/eel-gtk-extensions.h> @@ -48,6 +49,7 @@ #include <eel/eel-vfs-extensions.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk/gdkx.h> +#include <gdk/gdkkeysyms.h> #include <gtk/gtkmain.h> #include <gtk/gtkmenubar.h> #include <gtk/gtkmenuitem.h> @@ -100,6 +102,13 @@ enum { ARG_APP }; +enum { + GO_UP, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + static void cancel_view_as_callback (NautilusWindow *window); static void nautilus_window_info_iface_init (NautilusWindowInfoIface *iface); @@ -249,12 +258,22 @@ nautilus_window_go_to (NautilusWindow *window, const char *uri) nautilus_window_open_location (window, uri, FALSE); } + void nautilus_window_go_to_with_selection (NautilusWindow *window, const char *uri, GList *new_selection) { nautilus_window_open_location_with_selection (window, uri, new_selection, FALSE); } +static gboolean +nautilus_window_go_up_signal (NautilusWindow *window, gboolean close_behind) +{ + nautilus_window_go_up (window, close_behind); + return TRUE; +} + + + void nautilus_window_go_up (NautilusWindow *window, gboolean close_behind) { @@ -272,7 +291,6 @@ nautilus_window_go_up (NautilusWindow *window, gboolean close_behind) gnome_vfs_uri_unref (current_uri); if (parent_uri == NULL) { - g_warning ("Can't go Up from here. The UI should have prevented us from getting this far."); return; } @@ -287,8 +305,8 @@ nautilus_window_go_up (NautilusWindow *window, gboolean close_behind) eel_g_list_free_deep (selection); } -static void -real_nautilus_window_allow_up (NautilusWindow *window, gboolean allow) +void +nautilus_window_allow_up (NautilusWindow *window, gboolean allow) { GtkAction *action; @@ -303,13 +321,6 @@ real_nautilus_window_allow_up (NautilusWindow *window, gboolean allow) } void -nautilus_window_allow_up (NautilusWindow *window, gboolean allow) -{ - EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window, - allow_up, (window, allow)); -} - -void nautilus_window_allow_stop (NautilusWindow *window, gboolean allow) { GtkAction *action; @@ -1459,6 +1470,8 @@ nautilus_window_info_iface_init (NautilusWindowInfoIface *iface) static void nautilus_window_class_init (NautilusWindowClass *class) { + GtkBindingSet *binding_set; + G_OBJECT_CLASS (class)->finalize = nautilus_window_finalize; G_OBJECT_CLASS (class)->get_property = nautilus_window_get_property; G_OBJECT_CLASS (class)->set_property = nautilus_window_set_property; @@ -1470,7 +1483,6 @@ nautilus_window_class_init (NautilusWindowClass *class) class->set_title = real_set_title; class->set_content_view_widget = real_set_content_view_widget; class->load_view_as_menu = real_load_view_as_menu; - class->allow_up = real_nautilus_window_allow_up; g_object_class_install_property (G_OBJECT_CLASS (class), ARG_APP_ID, @@ -1494,4 +1506,21 @@ nautilus_window_class_init (NautilusWindowClass *class) * dialogs? */ set_up_default_icon_list (); + + + signals[GO_UP] = + g_signal_new ("go_up", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (NautilusWindowClass, go_up), + g_signal_accumulator_true_handled, NULL, + eel_marshal_BOOLEAN__BOOLEAN, + G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN); + + binding_set = gtk_binding_set_by_class (class); + gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, 0, + "go_up", 1, + G_TYPE_BOOLEAN, FALSE); + + class->go_up = nautilus_window_go_up_signal; } diff --git a/src/nautilus-window.h b/src/nautilus-window.h index f4a768490..adbb375be 100644 --- a/src/nautilus-window.h +++ b/src/nautilus-window.h @@ -75,7 +75,9 @@ typedef struct { void (* prompt_for_location) (NautilusWindow *window); void (* get_default_size) (NautilusWindow *window, guint *default_width, guint *default_height); void (* close) (NautilusWindow *window); - void (* allow_up) (NautilusWindow *window, gboolean allow); + + /* Signals used only for keybindings */ + gboolean (* go_up) (NautilusWindow *window, gboolean close); } NautilusWindowClass; typedef enum { |