summaryrefslogtreecommitdiff
path: root/src/file-manager
diff options
context:
space:
mode:
Diffstat (limited to 'src/file-manager')
-rw-r--r--src/file-manager/Makefile.am31
-rw-r--r--src/file-manager/fm-actions.h66
-rw-r--r--src/file-manager/fm-bonobo-provider.c635
-rw-r--r--src/file-manager/fm-bonobo-provider.h51
-rw-r--r--src/file-manager/fm-desktop-icon-view.c180
-rw-r--r--src/file-manager/fm-desktop-icon-view.h3
-rw-r--r--src/file-manager/fm-directory-view.c2344
-rw-r--r--src/file-manager/fm-directory-view.h34
-rw-r--r--src/file-manager/fm-ditem-page.c3
-rw-r--r--src/file-manager/fm-icon-view.c740
-rw-r--r--src/file-manager/fm-icon-view.h4
-rw-r--r--src/file-manager/fm-list-view.c328
-rw-r--r--src/file-manager/fm-list-view.h3
-rw-r--r--src/file-manager/fm-properties-window.c6
-rw-r--r--src/file-manager/fm-properties-window.h1
-rw-r--r--src/file-manager/fm-search-list-view.c818
-rw-r--r--src/file-manager/fm-search-list-view.h50
-rw-r--r--src/file-manager/fm-tree-view.c218
-rw-r--r--src/file-manager/fm-tree-view.h10
-rw-r--r--src/file-manager/nautilus-desktop-icon-view-ui.xml76
-rw-r--r--src/file-manager/nautilus-directory-view-ui.xml455
-rw-r--r--src/file-manager/nautilus-icon-view-ui.xml176
-rw-r--r--src/file-manager/nautilus-indexing-info.c340
-rw-r--r--src/file-manager/nautilus-indexing-info.h35
-rw-r--r--src/file-manager/nautilus-list-view-ui.xml21
-rw-r--r--src/file-manager/nautilus-search-list-view-ui.xml31
26 files changed, 2382 insertions, 4277 deletions
diff --git a/src/file-manager/Makefile.am b/src/file-manager/Makefile.am
index f34fdc8b5..afcf82a43 100644
--- a/src/file-manager/Makefile.am
+++ b/src/file-manager/Makefile.am
@@ -15,44 +15,39 @@ INCLUDES = \
libnautilus_file_manager_la_SOURCES= \
- fm-bonobo-provider.c \
+ fm-actions.h \
fm-desktop-icon-view.c \
- fm-directory-view.c \
- fm-ditem-page.c \
- fm-error-reporting.c \
- fm-icon-container.c \
- fm-icon-view.c \
- fm-list-model.c \
- fm-list-view.c \
- fm-properties-window.c \
- fm-search-list-view.c \
- nautilus-indexing-info.c \
- fm-tree-model.c \
- fm-tree-view.c \
- fm-bonobo-provider.h \
fm-desktop-icon-view.h \
+ fm-directory-view.c \
fm-directory-view.h \
+ fm-ditem-page.c \
fm-ditem-page.h \
+ fm-error-reporting.c \
fm-error-reporting.h \
+ fm-icon-container.c \
fm-icon-container.h \
+ fm-icon-view.c \
fm-icon-view.h \
+ fm-list-model.c \
fm-list-model.h \
fm-list-view-private.h \
+ fm-list-view.c \
fm-list-view.h \
+ fm-properties-window.c \
fm-properties-window.h \
- fm-search-list-view.h \
- nautilus-indexing-info.h \
+ fm-tree-model.c \
fm-tree-model.h \
+ fm-tree-view.c \
fm-tree-view.h \
$(NULL)
-uidir = $(datadir)/gnome-2.0/ui
+
+uidir = $(datadir)/nautilus/ui
ui_DATA = \
nautilus-desktop-icon-view-ui.xml \
nautilus-directory-view-ui.xml \
nautilus-icon-view-ui.xml \
nautilus-list-view-ui.xml \
- nautilus-search-list-view-ui.xml \
$(NULL)
EXTRA_DIST = $(ui_DATA)
diff --git a/src/file-manager/fm-actions.h b/src/file-manager/fm-actions.h
new file mode 100644
index 000000000..74fc42449
--- /dev/null
+++ b/src/file-manager/fm-actions.h
@@ -0,0 +1,66 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* fm-actions.h
+ *
+ * Copyright (C) 2004 Red Hat, Inc
+ *
+ * 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
+ * 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.
+ *
+ * Authors: Alexander Larsson < alexl@redhat.com>
+ */
+
+#ifndef FM_ACTIONS_H
+#define FM_ACTIONS_H
+
+#define FM_ACTION_OPEN "Open"
+#define FM_ACTION_OPEN_ALTERNATE "OpenAlternate"
+#define FM_ACTION_OTHER_APPLICATION1 "OtherApplication1"
+#define FM_ACTION_OTHER_APPLICATION2 "OtherApplication2"
+#define FM_ACTION_NEW_FOLDER "New Folder"
+#define FM_ACTION_PROPERTIES "Properties"
+#define FM_ACTION_PROPERTIES_ACCEL "PropertiesAccel"
+#define FM_ACTION_NO_TEMPLATES "No Templates"
+#define FM_ACTION_EMPTY_TRASH "Empty Trash"
+#define FM_ACTION_CUT "Cut"
+#define FM_ACTION_COPY "Copy"
+#define FM_ACTION_PASTE "Paste"
+#define FM_ACTION_PASTE_FILES_INTO "Paste Files Into"
+#define FM_ACTION_NEW_LAUNCHER "New Launcher"
+#define FM_ACTION_RENAME "Rename"
+#define FM_ACTION_DUPLICATE "Duplicate"
+#define FM_ACTION_CREATE_LINK "Create Link"
+#define FM_ACTION_SELECT_ALL "Select All"
+#define FM_ACTION_TRASH "Trash"
+#define FM_ACTION_DELETE "Delete"
+#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"
+#define FM_ACTION_MOUNT_VOLUME "Mount Volume"
+#define FM_ACTION_UNMOUNT_VOLUME "Unmount Volume"
+#define FM_ACTION_SCRIPTS "Scripts"
+#define FM_ACTION_NEW_DOCUMENTS "New Documents"
+#define FM_ACTION_EMPTY_TRASH_CONDITIONAL "Empty Trash Conditional"
+#define FM_ACTION_MANUAL_LAYOUT "Manual Layout"
+#define FM_ACTION_TIGHTER_LAYOUT "Tighter Layout"
+#define FM_ACTION_REVERSED_ORDER "Reversed Order"
+#define FM_ACTION_CLEAN_UP "Clean Up"
+#define FM_ACTION_KEEP_ALIGNED "Keep Aligned"
+#define FM_ACTION_ARRANGE_ITEMS "Arrange Items"
+#define FM_ACTION_STRETCH "Stretch"
+#define FM_ACTION_UNSTRETCH "Unstretch"
+#define FM_ACTION_ZOOM_ITEMS "Zoom Items"
+
+#endif /* FM_ACTIONS_H */
diff --git a/src/file-manager/fm-bonobo-provider.c b/src/file-manager/fm-bonobo-provider.c
deleted file mode 100644
index af55a8d52..000000000
--- a/src/file-manager/fm-bonobo-provider.c
+++ /dev/null
@@ -1,635 +0,0 @@
-/*
- * fm-bonobo-provider.h - Bonobo API support
- *
- * Copyright (C) 2002 James Willcox
- * 2003 Novell, Inc.
- *
- * This library 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 library 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 library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: James Willcox <jwillcox@gnome.org>
- * Dave Camp <dave@ximian.com>
- *
- */
-
-/* This object exports the bonobo context menus and property pages
- * using the new extension interface. */
-
-#include <config.h>
-#include "fm-bonobo-provider.h"
-
-#include <string.h>
-
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-property-bag-client.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-widget.h>
-#include <bonobo/bonobo-window.h>
-#include <bonobo/bonobo-zoomable.h>
-#include <eel/eel-glib-extensions.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkvbox.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include <libnautilus-extension/nautilus-extension-types.h>
-#include <libnautilus-extension/nautilus-file-info.h>
-#include <libnautilus-extension/nautilus-menu-provider.h>
-#include <libnautilus-extension/nautilus-property-page-provider.h>
-#include <libnautilus-private/nautilus-mime-actions.h>
-#include <libnautilus-private/nautilus-view-identifier.h>
-#include <libnautilus-private/nautilus-view-query.h>
-
-typedef struct {
- char *id;
- char *verb;
- CORBA_sequence_CORBA_string *uri_list;
-} BonoboMimeActionData;
-
-
-typedef struct {
- GList *files;
- GtkWidget *vbox;
- char *view_name;
-} ActivationData;
-
-static void fm_bonobo_provider_instance_init (FMBonoboProvider *provider);
-static void fm_bonobo_provider_class_init (FMBonoboProviderClass *class);
-
-static GObjectClass *parent_class;
-
-static BonoboMimeActionData *
-bonobo_mime_action_data_new (const char *id, const char *verb, GList *files)
-{
- BonoboMimeActionData *data;
- CORBA_sequence_CORBA_string *uri_list;
- int i;
-
- data = g_new (BonoboMimeActionData, 1);
- data->id = g_strdup (id);
- data->verb = g_strdup (verb);
-
- /* convert the GList of files into a CORBA sequence */
-
- uri_list = CORBA_sequence_CORBA_string__alloc ();
- uri_list->_maximum = g_list_length (files);
- uri_list->_length = uri_list->_maximum;
- uri_list->_buffer = CORBA_sequence_CORBA_string_allocbuf (uri_list->_length);
-
- for (i=0; files; files = files->next, i++)
- {
- NautilusFile *file;
- char *uri;
-
- file = files->data;
- uri = nautilus_file_get_uri (file);
-
- uri_list->_buffer[i] = CORBA_string_dup ((char*)uri);
-
- g_free (uri);
- }
-
- CORBA_sequence_set_release (uri_list, CORBA_TRUE);
- data->uri_list = uri_list;
-
-
- return data;
-}
-
-static void
-bonobo_mime_action_data_free (BonoboMimeActionData *data)
-{
- g_free (data->id);
- g_free (data->verb);
- g_free (data);
-}
-
-static void
-bonobo_mime_action_activate_callback (CORBA_Object obj,
- const char *error_reason,
- gpointer user_data)
-{
- Bonobo_Listener listener;
- CORBA_Environment ev;
- BonoboMimeActionData *data;
- CORBA_any any;
-
- data = user_data;
-
- if (obj == CORBA_OBJECT_NIL) {
- GtkWidget *dialog;
-
- /* FIXME: make an error message that is not so lame */
- dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Could not complete specified action: %s"), error_reason);
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
- gtk_widget_show (dialog);
- return;
- }
-
- CORBA_exception_init (&ev);
-
- listener = Bonobo_Unknown_queryInterface (obj,
- "IDL:Bonobo/Listener:1.0",
- &ev);
-
- if (!BONOBO_EX (&ev)) {
- any._type = TC_CORBA_sequence_CORBA_string;
- any._value = data->uri_list;
- Bonobo_Listener_event (listener, data->verb, &any, &ev);
- bonobo_object_release_unref (listener, &ev);
- } else {
- GtkWidget *dialog;
-
- /* FIXME: make an error message that is not so lame */
- dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("Could not complete specified action."));
- g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
- gtk_widget_show (dialog);
- }
-
-}
-
-static void
-bonobo_mime_action_callback (NautilusMenuItem *item,
- gpointer callback_data)
-{
- BonoboMimeActionData *data;
-
- data = callback_data;
-
- bonobo_activation_activate_from_id_async (data->id, 0,
- bonobo_mime_action_activate_callback,
- data, NULL);
-
-}
-
-static void
-bonobo_mime_action_menu_data_destroy_callback (gpointer data, GClosure *closure)
-{
- bonobo_mime_action_data_free ((BonoboMimeActionData *)data);
-}
-
-static gboolean
-no_locale_at_end (const char *str)
-{
- int len;
-
- len = strlen (str);
- if (len > 3 &&
- str[len-3] == '-' &&
- g_ascii_isalpha (str[len-2]) &&
- g_ascii_isalpha (str[len-1])) {
- return FALSE;
- }
- if (len > 6 &&
- str[len-6] == '-' &&
- g_ascii_isalpha (str[len-5]) &&
- g_ascii_isalpha (str[len-4]) &&
- str[len-3] == '_' &&
- g_ascii_isalpha (str[len-2]) &&
- g_ascii_isalpha (str[len-1])) {
- return FALSE;
- }
- return TRUE;
-}
-
-static GList *
-get_bonobo_menu_verb_names (Bonobo_ServerInfo *info)
-{
- GList *l;
- unsigned int i;
- int offset;
-
- offset = strlen ("nautilusverb:");
-
- l = NULL;
- for (i = 0; i < info->props._length; i++) {
-
- /* look for properties that start with "nautilusverb:". The
- * part following the colon is the verb name
- */
- if (strstr (info->props._buffer[i].name, "nautilusverb:") &&
- no_locale_at_end (info->props._buffer[i].name)) {
- l = g_list_prepend (l,
- g_strdup (&info->props._buffer[i].name[offset]));
- }
- }
-
- return l;
-}
-
-static gboolean
-can_handle_multiple_files (Bonobo_ServerInfo *info)
-{
- Bonobo_ActivationProperty *prop;
-
- prop = bonobo_server_info_prop_find (info, "nautilus:can_handle_multiple_files");
-
- if (prop == NULL || prop->v._d != Bonobo_ACTIVATION_P_BOOLEAN) {
- return FALSE;
- } else {
- return prop->v._u.value_boolean;
- }
-}
-
-static GList *
-get_menu_items_for_server (Bonobo_ServerInfo *info,
- GList *verb_names,
- GList *files)
-{
- GList *items;
- GList *l;
- const GList *langs;
- GSList *langs_cpy;
-
- langs = gnome_i18n_get_language_list ("LANG");
- langs_cpy = NULL;
- /* copy it to a singly linked list since bonobo wants that...sigh */
- for (; langs; langs = langs->next) {
- langs_cpy = g_slist_append (langs_cpy, langs->data);
- }
-
- items = NULL;
-
- /* build the commands */
- for (l = verb_names; l; l = l->next) {
- NautilusMenuItem *item;
- BonoboMimeActionData *data;
- char *verb;
- char *prop_name;
- const char *label;
- const char *icon_name;
- GClosure *closure;
-
- verb = l->data;
-
- prop_name = g_strdup_printf ("nautilusverb:%s", verb);
- label = bonobo_server_info_prop_lookup (info, prop_name,
- langs_cpy);
- g_free (prop_name);
-
- prop_name = g_strdup_printf ("nautilusverbicon:%s", verb);
- icon_name = bonobo_server_info_prop_lookup (info, prop_name,
- langs_cpy);
- g_free (prop_name);
- if (!icon_name) {
- icon_name = bonobo_server_info_prop_lookup (info, "nautilus:icon",
- langs_cpy);
- }
-
- data = bonobo_mime_action_data_new (info->iid,
- verb, files);
- closure = g_cclosure_new
- (G_CALLBACK (bonobo_mime_action_callback),
- data,
- bonobo_mime_action_menu_data_destroy_callback);
-
- item = nautilus_menu_item_new (verb,
- label,
- "", /* no tip for bonobo items */
- icon_name);
- g_signal_connect_data (item, "activate",
- G_CALLBACK (bonobo_mime_action_callback),
- data,
- bonobo_mime_action_menu_data_destroy_callback,
- 0);
- items = g_list_prepend (items, item);
- }
- items = g_list_reverse (items);
-
- g_slist_free (langs_cpy);
-
- /* if it doesn't handle multiple files, disable the menu items */
- if ((g_list_length (files) > 1) &&
- (can_handle_multiple_files (info) == FALSE)) {
- GList *l;
-
- for (l = items; l != NULL; l = l->next) {
- g_object_set (l->data, "sensitive", FALSE, NULL);
- }
- }
-
- return items;
-}
-
-static GList *
-fm_bonobo_provider_get_file_items (NautilusMenuProvider *provider,
- GtkWidget *window,
- GList *selection)
-{
- GList *components;
- GList *items;
- GList *l;
-
- components = nautilus_view_query_get_popup_components_for_files (selection);
-
- items = NULL;
- for (l = components; l; l = l->next) {
- Bonobo_ServerInfo *info;
- GList *verb_names;
-
- info = l->data;
- verb_names = get_bonobo_menu_verb_names (info);
- items = g_list_concat (items,
- get_menu_items_for_server (info, verb_names, selection));
- eel_g_list_free_deep (verb_names);
-
- }
-
- if (components != NULL) {
- gnome_vfs_mime_component_list_free (components);
- }
-
- return items;
-}
-
-static void
-fm_bonobo_provider_menu_provider_iface_init (NautilusMenuProviderIface *iface)
-{
- iface->get_file_items = fm_bonobo_provider_get_file_items;
-}
-
-static GtkWidget *
-bonobo_page_error_message (const char *view_name,
- const char *msg)
-{
- GtkWidget *hbox;
- GtkWidget *label;
- GtkWidget *image;
-
- hbox = gtk_hbox_new (FALSE, GNOME_PAD);
- image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR,
- GTK_ICON_SIZE_DIALOG);
-
- msg = g_strdup_printf ("There was an error while trying to create the view named `%s': %s", view_name, msg);
- label = gtk_label_new (msg);
-
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-
- gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_widget_show_all (hbox);
-
- return hbox;
-}
-
-static CORBA_sequence_CORBA_string *
-get_uri_list (GList *file_list)
-{
- CORBA_sequence_CORBA_string *uri_list;
- GList *l;
- int i;
-
- uri_list = CORBA_sequence_CORBA_string__alloc ();
- uri_list->_maximum = g_list_length (file_list);
- uri_list->_length = uri_list->_maximum;
- uri_list->_buffer = CORBA_sequence_CORBA_string_allocbuf (uri_list->_length);
- for (i = 0, l = file_list; l != NULL; i++, l = l->next) {
- char *uri;
-
- uri = nautilus_file_get_uri (NAUTILUS_FILE (l->data));
- uri_list->_buffer[i] = CORBA_string_dup (uri);
- g_free (uri);
- }
-
- return uri_list;
-}
-
-static void
-bonobo_page_activate_callback (CORBA_Object obj,
- const char *error_reason,
- gpointer user_data)
-{
- ActivationData *data;
- GtkWidget *widget;
- CORBA_Environment ev;
-
- data = (ActivationData *)user_data;
-
- CORBA_exception_init (&ev);
- widget = NULL;
-
- if (obj != CORBA_OBJECT_NIL) {
- Bonobo_Control control;
- Bonobo_PropertyBag pb;
- GList *keys;
-
- control = Bonobo_Unknown_queryInterface
- (obj, "IDL:Bonobo/Control:1.0", &ev);
-
- pb = Bonobo_Control_getProperties (control, &ev);
-
- if (!BONOBO_EX (&ev)) {
- gboolean new_property;
-
- keys = bonobo_pbclient_get_keys (pb, NULL);
- new_property = FALSE;
- if (g_list_find_custom (keys, "uris", (GCompareFunc)strcmp)) {
- new_property = TRUE;
- }
- bonobo_pbclient_free_keys (keys);
-
- if (new_property) {
- /* Set the 'uris' property. */
- CORBA_sequence_CORBA_string *uri_list;
- BonoboArg *arg;
-
- uri_list = get_uri_list (data->files);
- arg = bonobo_arg_new (TC_CORBA_sequence_CORBA_string);
- arg->_value = uri_list;
- bonobo_pbclient_set_value_async (pb, "uris", arg, &ev);
- bonobo_arg_release (arg);
- } else {
- /* Set the 'URI' property. */
- BonoboArg *arg;
- char *uri;
-
- if (data->files->next != NULL) {
- g_warning ("Multifile property page does not support the 'uris' property");
- bonobo_object_release_unref (pb, NULL);
- bonobo_object_release_unref (control, NULL);
- return;
- }
-
- uri = nautilus_file_info_get_uri (NAUTILUS_FILE_INFO (data->files->data));
-
- arg = bonobo_arg_new (BONOBO_ARG_STRING);
- BONOBO_ARG_SET_STRING (arg, uri);
- bonobo_pbclient_set_value_async (pb, "URI", arg, &ev);
- bonobo_arg_release (arg);
- g_free (uri);
- }
-
- bonobo_object_release_unref (pb, NULL);
-
- if (!BONOBO_EX (&ev)) {
- widget = bonobo_widget_new_control_from_objref
- (control, CORBA_OBJECT_NIL);
- bonobo_object_release_unref (control, &ev);
- }
- }
- }
-
- if (widget == NULL) {
- widget = bonobo_page_error_message (data->view_name,
- error_reason);
- }
-
- gtk_container_add (GTK_CONTAINER (data->vbox), widget);
- gtk_widget_show (widget);
-
- g_free (data->view_name);
- g_free (data);
-}
-
-static GList *
-fm_bonobo_provider_get_pages (NautilusPropertyPageProvider *provider,
- GList *files)
-{
- GList *all_components, *l;
- GList *components;
- CORBA_Environment ev;
- GList *pages;
-
- /* find all the property pages for this file */
- all_components = nautilus_view_query_get_property_components_for_files
- (files);
-
- /* filter out property pages that don't support multiple files */
- if (files->next) {
- components = NULL;
- for (l = all_components; l != NULL; l = l->next) {
- if (can_handle_multiple_files (l->data)) {
- components = g_list_prepend (components,
- l->data);
- }
- }
- components = g_list_reverse (components);
- g_list_free (all_components);
- } else {
- components = all_components;
- }
-
- CORBA_exception_init (&ev);
-
- pages = NULL;
-
- l = components;
- while (l != NULL) {
- NautilusViewIdentifier *view_id;
- Bonobo_ServerInfo *server;
- ActivationData *data;
- GtkWidget *vbox;
- NautilusPropertyPage *page;
-
- server = l->data;
- l = l->next;
-
- view_id = nautilus_view_identifier_new_from_property_page (server);
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox),
- GNOME_PAD);
- gtk_widget_show (vbox);
-
- page = nautilus_property_page_new (view_id->iid,
- gtk_label_new (view_id->name),
- vbox);
-
- pages = g_list_prepend (pages, page);
-
- data = g_new (ActivationData, 1);
- data->files = nautilus_file_info_list_copy (files);
- data->vbox = vbox;
- data->view_name = g_strdup (view_id->name);
-
- bonobo_activation_activate_from_id_async
- (view_id->iid,
- 0, bonobo_page_activate_callback,
- data, &ev);
- }
-
- return g_list_reverse (pages);
-}
-
-static void
-fm_bonobo_provider_property_page_provider_iface_init (NautilusPropertyPageProviderIface *iface)
-{
- iface->get_pages = fm_bonobo_provider_get_pages;
-}
-
-static void
-fm_bonobo_provider_instance_init (FMBonoboProvider *provider)
-{
-}
-
-static void
-fm_bonobo_provider_class_init (FMBonoboProviderClass *class)
-{
- parent_class = g_type_class_peek_parent (class);
-}
-
-GType
-fm_bonobo_provider_get_type (void)
-{
- static GType provider_type = 0;
-
- if (!provider_type) {
- static const GTypeInfo type_info = {
- sizeof (FMBonoboProviderClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) fm_bonobo_provider_class_init,
- NULL,
- NULL,
- sizeof (FMBonoboProvider),
- 0,
- (GInstanceInitFunc) fm_bonobo_provider_instance_init,
- };
-
- static const GInterfaceInfo menu_provider_iface_info = {
- (GInterfaceInitFunc) fm_bonobo_provider_menu_provider_iface_init,
- NULL,
- NULL
- };
-
- static const GInterfaceInfo property_page_provider_iface_info = {
- (GInterfaceInitFunc) fm_bonobo_provider_property_page_provider_iface_init,
- NULL,
- NULL
- };
-
- provider_type = g_type_register_static (G_TYPE_OBJECT,
- "FMBonoboProvider",
- &type_info, 0);
-
- g_type_add_interface_static (provider_type,
- NAUTILUS_TYPE_MENU_PROVIDER,
- &menu_provider_iface_info);
- g_type_add_interface_static (provider_type,
- NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER,
- &property_page_provider_iface_info);
- }
-
- return provider_type;
-}
-
diff --git a/src/file-manager/fm-bonobo-provider.h b/src/file-manager/fm-bonobo-provider.h
deleted file mode 100644
index c30098dac..000000000
--- a/src/file-manager/fm-bonobo-provider.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * fm-bonobo-provider.h - Bonobo API support
- *
- * Copyright (C) 2002 James Willcox
- * 2003 Novell, Inc.
- *
- * This library 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 library 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 library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Dave Camp <dave@ximian.com>
- * James Willcox <jwillcox@gnome.org>
- *
- */
-
-#ifndef FM_BONOBO_PROVIDER_H
-#define FM_BONOBO_PROVIDER_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define FM_TYPE_BONOBO_PROVIDER (fm_bonobo_provider_get_type ())
-#define FM_BONOBO_PROVIDER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), FM_TYPE_BONOBO_PROVIDER, FMBonoboProvider))
-#define FM_IS_BONOBO_PROVIDER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), FM_TYPE_BONOBO_PROVIDER))
-typedef struct _FMBonoboProvider FMBonoboProvider;
-typedef struct _FMBonoboProviderClass FMBonoboProviderClass;
-
-struct _FMBonoboProvider {
- GObject parent_slot;
-};
-
-struct _FMBonoboProviderClass {
- GObjectClass parent_slot;
-};
-
-GType fm_bonobo_provider_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index 4922e6cd3..2e8ee237f 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -27,9 +27,9 @@
#include <config.h>
#include "fm-icon-container.h"
#include "fm-desktop-icon-view.h"
+#include "fm-actions.h"
#include <X11/Xatom.h>
-#include <bonobo/bonobo-ui-util.h>
#include <gtk/gtkmain.h>
#include <dirent.h>
#include <eel/eel-glib-extensions.h>
@@ -45,14 +45,15 @@
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
#include <libgnomevfs/gnome-vfs.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
#include <libnautilus-private/nautilus-desktop-icon-file.h>
#include <libnautilus-private/nautilus-directory-background.h>
#include <libnautilus-private/nautilus-directory-notify.h>
#include <libnautilus-private/nautilus-file-changes-queue.h>
#include <libnautilus-private/nautilus-file-operations.h>
#include <libnautilus-private/nautilus-file-utilities.h>
+#include <libnautilus-private/nautilus-ui-utilities.h>
#include <libnautilus-private/nautilus-global-preferences.h>
+#include <libnautilus-private/nautilus-view-factory.h>
#include <libnautilus-private/nautilus-link.h>
#include <libnautilus-private/nautilus-metadata.h>
#include <libnautilus-private/nautilus-monitor.h>
@@ -67,23 +68,15 @@
#include <unistd.h>
#include <gtk/gtkmessagedialog.h>
-#define DESKTOP_COMMAND_EMPTY_TRASH_CONDITIONAL "/commands/Empty Trash Conditional"
-#define DESKTOP_COMMAND_UNMOUNT_VOLUME_CONDITIONAL "/commands/Unmount Volume Conditional"
-#define DESKTOP_COMMAND_PROTECT_VOLUME_CONDITIONAL "/commands/Protect Conditional"
-#define DESKTOP_COMMAND_FORMAT_VOLUME_CONDITIONAL "/commands/Format Conditional"
-#define DESKTOP_COMMAND_MEDIA_PROPERTIES_VOLUME_CONDITIONAL "/commands/Media Properties Conditional"
-
-#define DESKTOP_BACKGROUND_POPUP_PATH_DISKS "/popups/background/Before Zoom Items/Volume Items/Disks"
-#define DESKTOP_BACKGROUND_POPUP_PATH_VOLUME_ITEMS "/popups/background/Before Zoom Items/Volume Items"
-
/* Timeout to check the desktop directory for updates */
#define RESCAN_TIMEOUT 4000
struct FMDesktopIconViewDetails
{
- BonoboUIComponent *ui;
GdkWindow *root_window;
-
+ GtkActionGroup *desktop_action_group;
+ guint desktop_merge_id;
+
/* For the desktop rescanning
*/
gulong delayed_init_signal;
@@ -230,6 +223,7 @@ static void
fm_desktop_icon_view_destroy (GtkObject *object)
{
FMDesktopIconView *icon_view;
+ GtkUIManager *ui_manager;
icon_view = FM_DESKTOP_ICON_VIEW (object);
@@ -243,11 +237,11 @@ fm_desktop_icon_view_destroy (GtkObject *object)
default_zoom_level_changed,
icon_view);
- /* Clean up details */
- if (icon_view->details->ui != NULL) {
- bonobo_ui_component_unset_container (icon_view->details->ui, NULL);
- bonobo_object_unref (icon_view->details->ui);
- icon_view->details->ui = NULL;
+ ui_manager = fm_directory_view_get_ui_manager (FM_DIRECTORY_VIEW (icon_view));
+ if (ui_manager != NULL) {
+ nautilus_ui_unmerge_ui (ui_manager,
+ &icon_view->details->desktop_merge_id,
+ &icon_view->details->desktop_action_group);
}
GTK_OBJECT_CLASS (parent_class)->destroy (object);
@@ -558,7 +552,7 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view)
}
static void
-new_terminal_callback (BonoboUIComponent *component, gpointer data, const char *verb)
+action_new_terminal_callback (GtkAction *action, gpointer data)
{
g_assert (FM_DIRECTORY_VIEW (data));
@@ -566,7 +560,7 @@ new_terminal_callback (BonoboUIComponent *component, gpointer data, const char *
}
static void
-new_launcher_callback (BonoboUIComponent *component, gpointer data, const char *verb)
+action_new_launcher_callback (GtkAction *action, gpointer data)
{
char *desktop_directory;
@@ -584,9 +578,8 @@ new_launcher_callback (BonoboUIComponent *component, gpointer data, const char *
}
static void
-change_background_callback (BonoboUIComponent *component,
- gpointer data,
- const char *verb)
+action_change_background_callback (GtkAction *action,
+ gpointer data)
{
g_assert (FM_DIRECTORY_VIEW (data));
@@ -598,25 +591,14 @@ change_background_callback (BonoboUIComponent *component,
}
static void
-empty_trash_callback (BonoboUIComponent *component,
- gpointer data,
- const char *verb)
+action_empty_trash_conditional_callback (GtkAction *action,
+ gpointer data)
{
g_assert (FM_IS_DIRECTORY_VIEW (data));
nautilus_file_operations_empty_trash (GTK_WIDGET (data));
}
-static void
-reset_background_callback (BonoboUIComponent *component,
- gpointer data,
- const char *verb)
-{
- eel_background_reset
- (fm_directory_view_get_background
- (FM_DIRECTORY_VIEW (data)));
-}
-
static gboolean
trash_link_is_selection (FMDirectoryView *view)
{
@@ -648,6 +630,7 @@ real_update_menus (FMDirectoryView *view)
FMDesktopIconView *desktop_view;
char *label;
gboolean include_empty_trash;
+ GtkAction *action;
g_assert (FM_IS_DESKTOP_ICON_VIEW (view));
@@ -655,59 +638,74 @@ real_update_menus (FMDirectoryView *view)
desktop_view = FM_DESKTOP_ICON_VIEW (view);
- bonobo_ui_component_freeze (desktop_view->details->ui, NULL);
-
/* Empty Trash */
include_empty_trash = trash_link_is_selection (view);
- nautilus_bonobo_set_hidden
- (desktop_view->details->ui,
- DESKTOP_COMMAND_EMPTY_TRASH_CONDITIONAL,
- !include_empty_trash);
+ action = gtk_action_group_get_action (desktop_view->details->desktop_action_group,
+ FM_ACTION_EMPTY_TRASH_CONDITIONAL);
+ gtk_action_set_visible (action,
+ include_empty_trash);
if (include_empty_trash) {
label = g_strdup (_("Empty Trash"));
- nautilus_bonobo_set_label
- (desktop_view->details->ui,
- DESKTOP_COMMAND_EMPTY_TRASH_CONDITIONAL,
- label);
- nautilus_bonobo_set_sensitive
- (desktop_view->details->ui,
- DESKTOP_COMMAND_EMPTY_TRASH_CONDITIONAL,
- !nautilus_trash_monitor_is_empty ());
+ g_object_set (action , "label", label, NULL);
+ gtk_action_set_sensitive (action,
+ !nautilus_trash_monitor_is_empty ());
g_free (label);
}
-
- bonobo_ui_component_thaw (desktop_view->details->ui, NULL);
}
+static GtkActionEntry desktop_view_entries[] = {
+ { "New Terminal", NULL, /* name, stock id */
+ N_("Open T_erminal"), NULL, /* label, accelerator */
+ N_("Open a new GNOME terminal window"), /* tooltip */
+ G_CALLBACK (action_new_terminal_callback) },
+ { "New Launcher Desktop", NULL, /* name, stock id */
+ N_("Create L_auncher"), NULL, /* label, accelerator */
+ N_("Create a new launcher"), /* tooltip */
+ G_CALLBACK (action_new_launcher_callback) },
+ { "Change Background", NULL, /* name, stock id */
+ N_("Change Desktop _Background"), NULL, /* label, accelerator */
+ N_("Show a window that lets you set your desktop background's pattern or color"), /* tooltip */
+ G_CALLBACK (action_change_background_callback) },
+ { "Empty Trash Conditional", NULL, /* name, stock id */
+ N_("Empty Trash"), NULL, /* label, accelerator */
+ N_("Delete all items in the Trash"), /* tooltip */
+ G_CALLBACK (action_empty_trash_conditional_callback) },
+};
+
static void
real_merge_menus (FMDirectoryView *view)
{
FMDesktopIconView *desktop_view;
- Bonobo_UIContainer ui_container;
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("Change Background", change_background_callback),
- BONOBO_UI_VERB ("Empty Trash Conditional", empty_trash_callback),
- BONOBO_UI_VERB ("New Terminal", new_terminal_callback),
- BONOBO_UI_VERB ("New Launcher Desktop", new_launcher_callback),
- BONOBO_UI_VERB ("Reset Background", reset_background_callback),
- BONOBO_UI_VERB_END
- };
+ GtkUIManager *ui_manager;
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ const char *ui;
EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS, merge_menus, (view));
desktop_view = FM_DESKTOP_ICON_VIEW (view);
- desktop_view->details->ui = bonobo_ui_component_new ("Desktop Icon View");
+ ui_manager = fm_directory_view_get_ui_manager (view);
- ui_container = fm_directory_view_get_bonobo_ui_container (view);
- bonobo_ui_component_set_container (desktop_view->details->ui,
- ui_container, NULL);
- bonobo_object_release_unref (ui_container, NULL);
- bonobo_ui_util_set_ui (desktop_view->details->ui,
- DATADIR,
- "nautilus-desktop-icon-view-ui.xml",
- "nautilus", NULL);
- bonobo_ui_component_add_verb_list_with_data (desktop_view->details->ui, verbs, view);
+ action_group = gtk_action_group_new ("DesktopViewActions");
+ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+ desktop_view->details->desktop_action_group = action_group;
+ gtk_action_group_add_actions (action_group,
+ desktop_view_entries, G_N_ELEMENTS (desktop_view_entries),
+ view);
+
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ g_object_unref (action_group); /* owned by ui manager */
+
+ ui = nautilus_ui_string_get ("nautilus-desktop-icon-view-ui.xml");
+ desktop_view->details->desktop_merge_id =
+ gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
+
+ /* We hide the reset background item on the desktop */
+ action = gtk_ui_manager_get_action (ui_manager,
+ "/background/After Zoom Items/Background Items/Use Default Background");
+ gtk_action_set_visible (action,
+ FALSE);
}
static gboolean
@@ -740,3 +738,43 @@ real_supports_zooming (FMDirectoryView *view)
*/
return FALSE;
}
+
+static NautilusView *
+fm_desktop_icon_view_create (NautilusWindowInfo *window)
+{
+ FMIconView *view;
+
+ view = g_object_new (FM_TYPE_DESKTOP_ICON_VIEW, "window", window, NULL);
+ g_object_ref (view);
+ gtk_object_sink (GTK_OBJECT (view));
+ return NAUTILUS_VIEW (view);
+}
+
+static gboolean
+fm_desktop_icon_view_supports_uri (const char *uri,
+ GnomeVFSFileType file_type,
+ const char *mime_type)
+{
+ if (g_str_has_prefix (uri, "x-nautilus-desktop:")) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static NautilusViewInfo fm_desktop_icon_view = {
+ FM_DESKTOP_ICON_VIEW_ID,
+ N_("Desktop"),
+ N_("_Desktop"),
+ fm_desktop_icon_view_create,
+ fm_desktop_icon_view_supports_uri
+};
+
+void
+fm_desktop_icon_view_register (void)
+{
+ fm_desktop_icon_view.label = _(fm_desktop_icon_view.label);
+ fm_desktop_icon_view.label_with_mnemonic = _(fm_desktop_icon_view.label_with_mnemonic);
+
+ nautilus_view_factory_register (&fm_desktop_icon_view);
+}
diff --git a/src/file-manager/fm-desktop-icon-view.h b/src/file-manager/fm-desktop-icon-view.h
index 60d8635a5..866278daa 100644
--- a/src/file-manager/fm-desktop-icon-view.h
+++ b/src/file-manager/fm-desktop-icon-view.h
@@ -33,6 +33,8 @@
#define FM_IS_DESKTOP_ICON_VIEW(obj) (GTK_CHECK_TYPE ((obj), FM_TYPE_DESKTOP_ICON_VIEW))
#define FM_IS_DESKTOP_ICON_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), FM_TYPE_DESKTOP_ICON_VIEW))
+#define FM_DESKTOP_ICON_VIEW_ID "OAFIID:Nautilus_File_Manager_Desktop_Icon_View"
+
typedef struct FMDesktopIconViewDetails FMDesktopIconViewDetails;
typedef struct {
FMIconView parent;
@@ -45,5 +47,6 @@ typedef struct {
/* GObject support */
GType fm_desktop_icon_view_get_type (void);
+void fm_desktop_icon_view_register (void);
#endif /* FM_DESKTOP_ICON_VIEW_H */
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 7eb7418c2..f7e0eba5f 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -32,14 +32,10 @@
#include "fm-directory-view.h"
#include "fm-list-view.h"
+#include "fm-actions.h"
#include "fm-error-reporting.h"
#include "fm-properties-window.h"
#include <libgnome/gnome-url.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-window.h>
-#include <bonobo/bonobo-zoomable.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-exception.h>
#include <eel/eel-alert-dialog.h>
#include <eel/eel-background.h>
#include <eel/eel-glib-extensions.h>
@@ -50,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>
@@ -59,7 +56,9 @@
#include <gtk/gtkstock.h>
#include <gtk/gtkmessagedialog.h>
#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>
@@ -72,7 +71,6 @@
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libnautilus-private/nautilus-recent.h>
#include <libnautilus-extension/nautilus-menu-provider.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
#include <libnautilus-private/nautilus-clipboard-monitor.h>
#include <libnautilus-private/nautilus-desktop-icon-file.h>
#include <libnautilus-private/nautilus-desktop-directory.h>
@@ -92,17 +90,12 @@
#include <libnautilus-private/nautilus-program-choosing.h>
#include <libnautilus-private/nautilus-trash-directory.h>
#include <libnautilus-private/nautilus-trash-monitor.h>
-#include <libnautilus-private/nautilus-view-identifier.h>
-#include <libnautilus/nautilus-bonobo-ui.h>
+#include <libnautilus-private/nautilus-ui-utilities.h>
#include <unistd.h>
-
/* Number of seconds until cancel dialog shows up */
#define DELAY_UNTIL_CANCEL_MSECS 5000
-#define DISPLAY_TIMEOUT_FIRST_MSECS 1000
-#define DISPLAY_TIMEOUT_INTERVAL_MSECS 10*1000
-
#define SILENT_WINDOW_OPEN_LIMIT 5
#define DUPLICATE_HORIZONTAL_ICON_OFFSET 70
@@ -112,80 +105,21 @@
#define RESPONSE_DISPLAY 1001
#define RESPONSE_RUN_IN_TERMINAL 1002
-/* MOD2 is num lock -- I would include MOD3-5 if I was sure they were not lock keys */
-#define ALL_NON_LOCK_MODIFIER_KEYS (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)
+#define FM_DIRECTORY_VIEW_MENU_PATH_APPLICATIONS_SUBMENU_PLACEHOLDER "/MenuBar/File/Open Placeholder/Open With/Applications Placeholder"
+#define FM_DIRECTORY_VIEW_MENU_PATH_APPLICATIONS_PLACEHOLDER "/MenuBar/File/Open Placeholder/Applications Placeholder"
+#define FM_DIRECTORY_VIEW_MENU_PATH_SCRIPTS_PLACEHOLDER "/MenuBar/File/Open Placeholder/Scripts/Scripts Placeholder"
+#define FM_DIRECTORY_VIEW_MENU_PATH_EXTENSION_ACTIONS_PLACEHOLDER "/MenuBar/Edit/Extension Actions"
+#define FM_DIRECTORY_VIEW_MENU_PATH_NEW_DOCUMENTS_PLACEHOLDER "/MenuBar/File/New Items Placeholder/New Documents/New Documents Placeholder"
-/* Paths to use when referring to bonobo menu items. Paths used by
- * subclasses are in fm-directory-view.h
- */
-#define FM_DIRECTORY_VIEW_COMMAND_RENAME "/commands/Rename"
-#define FM_DIRECTORY_VIEW_COMMAND_OPEN "/commands/Open"
-#define FM_DIRECTORY_VIEW_COMMAND_OPEN_ALTERNATE "/commands/OpenAlternate"
-#define FM_DIRECTORY_VIEW_COMMAND_OPEN_WITH "/commands/Open With"
-#define FM_DIRECTORY_VIEW_COMMAND_NEW_FOLDER "/commands/New Folder"
-#define FM_DIRECTORY_VIEW_COMMAND_NEW_LAUNCHER "/commands/New Launcher"
-#define FM_DIRECTORY_VIEW_COMMAND_EDIT_LAUNCHER "/commands/Edit Launcher"
-#define FM_DIRECTORY_VIEW_COMMAND_DELETE "/commands/Delete"
-#define FM_DIRECTORY_VIEW_COMMAND_TRASH "/commands/Trash"
-#define FM_DIRECTORY_VIEW_COMMAND_EMPTY_TRASH "/commands/Empty Trash"
-#define FM_DIRECTORY_VIEW_COMMAND_DUPLICATE "/commands/Duplicate"
-#define FM_DIRECTORY_VIEW_COMMAND_CREATE_LINK "/commands/Create Link"
-#define FM_DIRECTORY_VIEW_COMMAND_PROPERTIES "/commands/Properties"
-#define FM_DIRECTORY_VIEW_COMMAND_OTHER_APPLICATION "/commands/OtherApplication"
-#define FM_DIRECTORY_VIEW_COMMAND_CUT_FILES "/commands/Cut Files"
-#define FM_DIRECTORY_VIEW_COMMAND_COPY_FILES "/commands/Copy Files"
-#define FM_DIRECTORY_VIEW_COMMAND_PASTE_FILES "/commands/Paste Files"
-#define FM_DIRECTORY_VIEW_COMMAND_PASTE_FILES_INTO "/commands/Paste Files Into"
-#define FM_DIRECTORY_VIEW_COMMAND_MOUNT_VOLUME_CONDITIONAL "/commands/Mount Volume Conditional"
-#define FM_DIRECTORY_VIEW_COMMAND_UNMOUNT_VOLUME_CONDITIONAL "/commands/Unmount Volume Conditional"
-#define FM_DIRECTORY_VIEW_COMMAND_PROTECT_VOLUME_CONDITIONAL "/commands/Protect Conditional"
-#define FM_DIRECTORY_VIEW_COMMAND_FORMAT_VOLUME_CONDITIONAL "/commands/Format Conditional"
-#define FM_DIRECTORY_VIEW_COMMAND_MEDIA_PROPERTIES_VOLUME_CONDITIONAL "/commands/Media Properties Conditional"
-#define FM_DIRECTORY_VIEW_COMMAND_CONNECT_TO_SERVER_LINK_CONDITIONAL "/commands/Connect To Server Link Conditional"
-
-#define FM_DIRECTORY_VIEW_MENU_PATH_OPEN_WITH "/menu/File/Open Placeholder/Open With"
-#define FM_DIRECTORY_VIEW_MENU_PATH_NEW_DOCUMENTS "/menu/File/New Items Placeholder/New Documents"
-#define FM_DIRECTORY_VIEW_MENU_PATH_NEW_DOCUMENTS_NO_TEMPLATES "/menu/File/New Items Placeholder/New Documents/No Templates"
-#define FM_DIRECTORY_VIEW_MENU_PATH_SCRIPTS "/menu/File/Open Placeholder/Scripts"
-#define FM_DIRECTORY_VIEW_MENU_PATH_TRASH "/menu/Edit/Dangerous File Items Placeholder/Trash"
-#define FM_DIRECTORY_VIEW_MENU_PATH_DELETE "/menu/Edit/Dangerous File Items Placeholder/Delete"
-#define FM_DIRECTORY_VIEW_MENU_PATH_EMPTY_TRASH "/menu/File/Global File Items Placeholder/Empty Trash"
-#define FM_DIRECTORY_VIEW_MENU_PATH_CREATE_LINK "/menu/Edit/File Items Placeholder/Create Link"
-#define FM_DIRECTORY_VIEW_MENU_PATH_APPLICATIONS_SUBMENU_PLACEHOLDER "/menu/File/Open Placeholder/Open With/Applications Placeholder"
-#define FM_DIRECTORY_VIEW_MENU_PATH_APPLICATIONS_PLACEHOLDER "/menu/File/Open Placeholder/Applications Placeholder"
-#define FM_DIRECTORY_VIEW_MENU_PATH_OTHER_APPLICATION_PLACEHOLDER "/menu/File/Open Placeholder/OtherApplicationPlaceholder"
-#define FM_DIRECTORY_VIEW_MENU_PATH_OTHER_APPLICATION "/menu/File/Open Placeholder/OtherApplicationPlaceholder/OtherApplication"
-#define FM_DIRECTORY_VIEW_MENU_PATH_SCRIPTS_PLACEHOLDER "/menu/File/Open Placeholder/Scripts/Scripts Placeholder"
-#define FM_DIRECTORY_VIEW_MENU_PATH_SCRIPTS_SEPARATOR "/menu/File/Open Placeholder/Scripts/After Scripts"
-#define FM_DIRECTORY_VIEW_MENU_PATH_NEW_DOCUMENTS_PLACEHOLDER "/menu/File/New Items Placeholder/New Documents/New Documents Placeholder"
-#define FM_DIRECTORY_VIEW_MENU_PATH_NEW_DOCUMENTS_SEPARATOR "/menu/File/New Items Placeholder/New Documents/After New Documents"
-#define FM_DIRECTORY_VIEW_MENU_PATH_CUT_FILES "/menu/Edit/Cut"
-#define FM_DIRECTORY_VIEW_MENU_PATH_COPY_FILES "/menu/Edit/Copy"
-#define FM_DIRECTORY_VIEW_MENU_PATH_PASTE_FILES "/menu/Edit/Paste"
-#define FM_DIRECTORY_VIEW_MENU_PATH_EXTENSION_ACTIONS_PLACEHOLDER "/menu/Edit/Extension Actions"
-
-#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND "/popups/background"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_SELECTION "/popups/selection"
-
-#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_SCRIPTS "/popups/background/Before Zoom Items/Scripts"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_SCRIPTS_PLACEHOLDER "/popups/background/Before Zoom Items/Scripts/Scripts Placeholder"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_SCRIPTS_SEPARATOR "/popups/background/Before Zoom Items/Scripts/After Scripts"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_NEW_DOCUMENTS "/popups/background/Before Zoom Items/New Documents"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_NEW_DOCUMENTS_NO_TEMPLATES "/popups/background/Before Zoom Items/New Documents/No Templates"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_NEW_DOCUMENTS_PLACEHOLDER "/popups/background/Before Zoom Items/New Documents/New Documents Placeholder"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_NEW_DOCUMENTS_SEPARATOR "/popups/background/Before Zoom Items/New Documents/After New Documents"
-
-#define FM_DIRECTORY_VIEW_POPUP_PATH_APPLICATIONS_SUBMENU_PLACEHOLDER "/popups/selection/Open Placeholder/Open With/Applications Placeholder"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_APPLICATIONS_PLACEHOLDER "/popups/selection/Open Placeholder/Applications Placeholder"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_OPEN_PLACEHOLDER "/popups/selection/Open Placeholder"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_OTHER_APPLICATION_PLACEHOLDER "/popups/selection/Open Placeholder/OtherApplicationPlaceholder"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_OTHER_APPLICATION "/popups/selection/Open Placeholder/OtherApplicationPlaceholder/OtherApplication"
-
-#define FM_DIRECTORY_VIEW_POPUP_PATH_SCRIPTS_PLACEHOLDER "/popups/selection/Open Placeholder/Scripts/Scripts Placeholder"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_SCRIPTS_SEPARATOR "/popups/selection/Open Placeholder/Scripts/After Scripts"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_OPEN_WITH "/popups/selection/Open Placeholder/Open With"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_SCRIPTS "/popups/selection/Open Placeholder/Scripts"
-#define FM_DIRECTORY_VIEW_POPUP_PATH_EXTENSION_ACTIONS "/popups/selection/Extension Actions"
+#define FM_DIRECTORY_VIEW_POPUP_PATH_SELECTION "/selection"
+#define FM_DIRECTORY_VIEW_POPUP_PATH_APPLICATIONS_SUBMENU_PLACEHOLDER "/selection/Open Placeholder/Open With/Applications Placeholder"
+#define FM_DIRECTORY_VIEW_POPUP_PATH_APPLICATIONS_PLACEHOLDER "/selection/Open Placeholder/Applications Placeholder"
+#define FM_DIRECTORY_VIEW_POPUP_PATH_SCRIPTS_PLACEHOLDER "/selection/Open Placeholder/Scripts/Scripts Placeholder"
+#define FM_DIRECTORY_VIEW_POPUP_PATH_EXTENSION_ACTIONS "/selection/Extension Actions"
+
+#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND "/background"
+#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_SCRIPTS_PLACEHOLDER "/background/Before Zoom Items/New Object Items/Scripts/Scripts Placeholder"
+#define FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_NEW_DOCUMENTS_PLACEHOLDER "/background/Before Zoom Items/New Object Items/New Documents/New Documents Placeholder"
#define MAX_MENU_LEVELS 5
@@ -201,9 +135,18 @@ enum {
LOAD_ERROR,
MOVE_COPY_ITEMS,
REMOVE_FILE,
+ TRASH,
+ DELETE,
LAST_SIGNAL
};
+enum
+{
+ PROP_0,
+ PROP_WINDOW
+};
+
+
static guint signals[LAST_SIGNAL];
static GdkAtom copied_files_atom;
@@ -220,16 +163,23 @@ static int templates_directory_uri_length;
struct FMDirectoryViewDetails
{
- NautilusView *nautilus_view;
- BonoboZoomable *zoomable;
-
+ NautilusWindowInfo *window;
NautilusDirectory *model;
NautilusFile *directory_as_file;
- BonoboUIComponent *ui;
+ GtkActionGroup *dir_action_group;
+ guint dir_merge_id;
GList *scripts_directory_list;
+ GtkActionGroup *scripts_action_group;
+ guint scripts_merge_id;
+
GList *templates_directory_list;
+ GtkActionGroup *templates_action_group;
+ guint templates_merge_id;
+ GtkActionGroup *extensions_menu_action_group;
+ guint extensions_menu_merge_id;
+
guint display_selection_idle_id;
guint update_menus_timeout_id;
guint update_status_idle_id;
@@ -258,7 +208,6 @@ struct FMDirectoryViewDetails
* after it finishes loading the directory and its view.
*/
gboolean loading;
- gboolean menus_merged;
gboolean menu_states_untrustworthy;
gboolean scripts_invalid;
gboolean templates_invalid;
@@ -280,6 +229,8 @@ struct FMDirectoryViewDetails
gboolean send_selection_change_to_shell;
NautilusFile *file_monitored_for_open_with;
+ GtkActionGroup *open_with_action_group;
+ guint open_with_merge_id;
};
typedef enum {
@@ -296,8 +247,8 @@ typedef enum {
typedef struct {
FMDirectoryView *view;
NautilusFile *file;
- Nautilus_ViewFrame_OpenMode mode;
- Nautilus_ViewFrame_OpenFlags flags;
+ NautilusWindowOpenMode mode;
+ NautilusWindowOpenFlags flags;
NautilusFileCallback callback;
gboolean mounted;
gboolean mounting;
@@ -334,34 +285,20 @@ static void trash_or_delete_files (FMDirectoryView
const GList *files);
static void fm_directory_view_activate_file (FMDirectoryView *view,
NautilusFile *file,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags);
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags);
static void load_directory (FMDirectoryView *view,
NautilusDirectory *directory);
static void fm_directory_view_merge_menus (FMDirectoryView *view);
static void fm_directory_view_init_show_hidden_files (FMDirectoryView *view);
static char * file_name_from_uri (const char *uri);
-static void stop_loading_callback (NautilusView *nautilus_view,
- FMDirectoryView *directory_view);
-static void load_location_callback (NautilusView *nautilus_view,
- const char *location,
- FMDirectoryView *directory_view);
+static void fm_directory_view_load_location (NautilusView *nautilus_view,
+ const char *location);
+static void fm_directory_view_stop_loading (NautilusView *nautilus_view);
static void clipboard_changed_callback (NautilusClipboardMonitor *monitor,
FMDirectoryView *view);
-static void selection_changed_callback (NautilusView *nautilus_view,
- GList *selection,
- FMDirectoryView *directory_view);
static void open_one_in_new_window (gpointer data,
gpointer callback_data);
-static void zoomable_set_zoom_level_callback (BonoboZoomable *zoomable,
- float level,
- FMDirectoryView *view);
-static void zoomable_zoom_in_callback (BonoboZoomable *zoomable,
- FMDirectoryView *directory_view);
-static void zoomable_zoom_out_callback (BonoboZoomable *zoomable,
- FMDirectoryView *directory_view);
-static void zoomable_zoom_to_fit_callback (BonoboZoomable *zoomable,
- FMDirectoryView *directory_view);
static void schedule_update_menus (FMDirectoryView *view);
static void schedule_update_menus_callback (gpointer callback_data);
static void remove_update_menus_timeout_callback (FMDirectoryView *view);
@@ -387,10 +324,37 @@ static void monitor_file_for_open_with (FMDirectoryView
static void create_scripts_directory (void);
static void activate_activation_uri_ready_callback (NautilusFile *file,
gpointer callback_data);
+static gboolean can_show_default_app (FMDirectoryView *view,
+ NautilusFile *file);
+
static gboolean activate_check_mime_types (FMDirectoryView *view,
NautilusFile *file,
gboolean warn_on_mismatch);
+
+static void action_open_scripts_folder_callback (GtkAction *action,
+ gpointer callback_data);
+static void action_cut_files_callback (GtkAction *action,
+ gpointer callback_data);
+static void action_copy_files_callback (GtkAction *action,
+ gpointer callback_data);
+static void action_paste_files_callback (GtkAction *action,
+ gpointer callback_data);
+static void action_rename_callback (GtkAction *action,
+ gpointer callback_data);
+static void action_show_hidden_files_callback (GtkAction *action,
+ gpointer callback_data);
+static void action_reset_background_callback (GtkAction *action,
+ gpointer callback_data);
+static void action_paste_files_into_callback (GtkAction *action,
+ gpointer callback_data);
+static void action_connect_to_server_link_callback (GtkAction *action,
+ gpointer data);
+static void action_mount_volume_callback (GtkAction *action,
+ gpointer data);
+static void action_unmount_volume_callback (GtkAction *action,
+ gpointer data);
+
EEL_CLASS_BOILERPLATE (FMDirectoryView, fm_directory_view, GTK_TYPE_SCROLLED_WINDOW)
EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, add_file)
@@ -408,6 +372,7 @@ EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, restore_default_zoom_leve
EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, select_all)
EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, set_selection)
EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, zoom_to_level)
+EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, get_zoom_level)
typedef struct {
GnomeVFSMimeApplication *application;
@@ -499,6 +464,15 @@ create_templates_parameters_free (CreateTemplateParameters *parameters)
g_free (parameters);
}
+NautilusWindowInfo *
+fm_directory_view_get_nautilus_window (FMDirectoryView *view)
+{
+ g_assert (view->details->window != NULL);
+
+ return view->details->window;
+}
+
+
/* Returns the GtkWindow that this directory view occupies, or NULL
* if at the moment this directory view is not in a GtkWindow or the
@@ -586,7 +560,8 @@ selection_not_empty_in_menu_callback (FMDirectoryView *view, GList *selection)
}
static void
-open_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_open_callback (GtkAction *action,
+ gpointer callback_data)
{
GList *selection;
FMDirectoryView *view;
@@ -595,13 +570,14 @@ open_callback (BonoboUIComponent *component, gpointer callback_data, const char
selection = fm_directory_view_get_selection (view);
fm_directory_view_activate_files (view, selection,
- Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE,
+ NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
0);
nautilus_file_list_free (selection);
}
static void
-open_close_parent_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_open_close_parent_callback (GtkAction *action,
+ gpointer callback_data)
{
GList *selection;
FMDirectoryView *view;
@@ -610,14 +586,15 @@ open_close_parent_callback (BonoboUIComponent *component, gpointer callback_data
selection = fm_directory_view_get_selection (view);
fm_directory_view_activate_files (view, selection,
- Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE,
- Nautilus_ViewFrame_OPEN_FLAG_CLOSE_BEHIND);
+ NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
+ NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND);
nautilus_file_list_free (selection);
}
static void
-open_alternate_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_open_alternate_callback (GtkAction *action,
+ gpointer callback_data)
{
FMDirectoryView *view;
GList *selection;
@@ -687,8 +664,8 @@ fm_directory_view_chose_application_callback (GnomeVFSMimeApplication *applicati
static void
open_location (FMDirectoryView *directory_view,
const char *new_uri,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags)
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags)
{
NautilusFile *file;
@@ -706,8 +683,8 @@ open_location (FMDirectoryView *directory_view,
}
nautilus_file_unref (file);
- nautilus_view_open_location (directory_view->details->nautilus_view,
- new_uri, mode, flags, NULL);
+ nautilus_window_info_open_location (directory_view->details->window,
+ new_uri, mode, flags, NULL);
}
static void
@@ -778,7 +755,8 @@ open_with_other_program (FMDirectoryView *view)
}
static void
-other_application_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_other_application_callback (GtkAction *action,
+ gpointer callback_data)
{
g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
@@ -786,41 +764,6 @@ other_application_callback (BonoboUIComponent *component, gpointer callback_data
}
static void
-edit_launcher (FMDirectoryView *view,
- NautilusFile *file)
-{
- char *uri;
-
- uri = nautilus_file_get_uri (file);
-
- nautilus_launch_application_from_command (gtk_widget_get_screen (GTK_WIDGET (view)),
- "gnome-desktop-item-edit",
- "gnome-desktop-item-edit",
- uri,
- FALSE);
- g_free (uri);
-}
-
-static void
-edit_launcher_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
-{
- GList *selection;
- FMDirectoryView *view;
-
- g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
-
- view = FM_DIRECTORY_VIEW (callback_data);
-
- selection = fm_directory_view_get_selection (view);
-
- if (selection_contains_one_item_in_menu_callback (view, selection)) {
- edit_launcher (view, NAUTILUS_FILE (selection->data));
- }
-
- nautilus_file_list_free (selection);
-}
-
-static void
trash_or_delete_selected_files (FMDirectoryView *view)
{
GList *selection;
@@ -830,8 +773,16 @@ 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
-trash_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_trash_callback (GtkAction *action,
+ gpointer callback_data)
{
trash_or_delete_selected_files (FM_DIRECTORY_VIEW (callback_data));
}
@@ -910,7 +861,8 @@ delete_selected_files (FMDirectoryView *view)
}
static void
-delete_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_delete_callback (GtkAction *action,
+ gpointer callback_data)
{
if (!show_delete_command_auto_value) {
return;
@@ -918,8 +870,19 @@ delete_callback (BonoboUIComponent *component, gpointer callback_data, const cha
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
-duplicate_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_duplicate_callback (GtkAction *action,
+ gpointer callback_data)
{
FMDirectoryView *view;
GList *selection;
@@ -943,7 +906,8 @@ duplicate_callback (BonoboUIComponent *component, gpointer callback_data, const
}
static void
-create_link_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_create_link_callback (GtkAction *action,
+ gpointer callback_data)
{
FMDirectoryView *view;
GList *selection;
@@ -963,9 +927,8 @@ create_link_callback (BonoboUIComponent *component, gpointer callback_data, cons
}
static void
-bonobo_menu_select_all_callback (BonoboUIComponent *component,
- gpointer callback_data,
- const char *verb)
+action_select_all_callback (GtkAction *action,
+ gpointer callback_data)
{
g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
@@ -990,7 +953,7 @@ pattern_select_response_cb (GtkWidget *dialog, int response, gpointer user_data)
gtk_entry_get_text (GTK_ENTRY (entry)));
if (selection) {
- fm_directory_view_set_selection(view, selection);
+ fm_directory_view_set_selection (view, selection);
nautilus_file_list_free (selection);
fm_directory_view_reveal_selection(view);
@@ -1042,9 +1005,8 @@ select_pattern (FMDirectoryView *view)
}
static void
-bonobo_menu_select_pattern_callback (BonoboUIComponent *component,
- gpointer callback_data,
- const char *verb)
+action_select_pattern_callback (GtkAction *action,
+ gpointer callback_data)
{
g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
@@ -1052,9 +1014,8 @@ bonobo_menu_select_pattern_callback (BonoboUIComponent *component,
}
static void
-reset_to_defaults_callback (BonoboUIComponent *component,
- gpointer callback_data,
- const char *verb)
+action_reset_to_defaults_callback (GtkAction *action,
+ gpointer callback_data)
{
g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
@@ -1063,39 +1024,31 @@ reset_to_defaults_callback (BonoboUIComponent *component,
static void
-show_hidden_files_toggle_callback (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
+action_show_hidden_files_callback (GtkAction *action,
gpointer callback_data)
{
FMDirectoryView *directory_view;
- Nautilus_ShowHiddenFilesMode mode;
+ NautilusWindowShowHiddenFilesMode mode;
g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
directory_view = FM_DIRECTORY_VIEW (callback_data);
-
- if (strcmp (state, "") == 0) {
- /* State goes blank when component is removed; ignore this. */
- return;
- }
- directory_view->details->show_hidden_files = strcmp (state, "1") == 0;
+ directory_view->details->show_hidden_files = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+
if (directory_view->details->show_hidden_files) {
- mode = Nautilus_SHOW_HIDDEN_FILES_ENABLE;
+ mode = NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_ENABLE;
} else {
- mode = Nautilus_SHOW_HIDDEN_FILES_DISABLE;
+ mode = NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DISABLE;
}
- nautilus_view_set_show_hidden_files_mode (directory_view->details->nautilus_view, mode);
+ nautilus_window_info_set_hidden_files_mode (directory_view->details->window, mode);
if (directory_view->details->model != NULL) {
load_directory (directory_view, directory_view->details->model);
}
}
static void
-bonobo_menu_empty_trash_callback (BonoboUIComponent *component,
- gpointer callback_data,
- const char *verb)
+action_empty_trash_callback (GtkAction *action,
+ gpointer callback_data)
{
g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
@@ -1103,7 +1056,8 @@ bonobo_menu_empty_trash_callback (BonoboUIComponent *component,
}
static void
-new_folder_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_new_folder_callback (GtkAction *action,
+ gpointer callback_data)
{
g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
@@ -1111,7 +1065,8 @@ new_folder_callback (BonoboUIComponent *component, gpointer callback_data, const
}
static void
-new_empty_file_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_new_empty_file_callback (GtkAction *action,
+ gpointer callback_data)
{
g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
@@ -1119,7 +1074,8 @@ new_empty_file_callback (BonoboUIComponent *component, gpointer callback_data, c
}
static void
-new_launcher_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_new_launcher_callback (GtkAction *action,
+ gpointer callback_data)
{
char *parent_uri;
FMDirectoryView *view;
@@ -1140,7 +1096,8 @@ new_launcher_callback (BonoboUIComponent *component, gpointer callback_data, con
}
static void
-open_properties_window_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_properties_callback (GtkAction *action,
+ gpointer callback_data)
{
FMDirectoryView *view;
GList *selection;
@@ -1215,32 +1172,6 @@ we_are_in_vfolder_desktop_dir (FMDirectoryView *view)
}
}
-static void
-bonobo_control_activate_callback (BonoboObject *control, gboolean state, gpointer callback_data)
-{
- FMDirectoryView *view;
-
- g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
-
- view = FM_DIRECTORY_VIEW (callback_data);
-
- if (state) {
- /* Add new menu items and perhaps whole menus */
- fm_directory_view_merge_menus (view);
-
- /* Set initial sensitivity, wording, toggle state, etc. */
- fm_directory_view_update_menus (view);
-
- /* initialise show hidden mode */
- fm_directory_view_init_show_hidden_files (view);
- }
-
- /*
- * Nothing to do on deactivate case, which never happens because
- * of the way Nautilus content views are handled.
- */
-}
-
/* Preferences changed callbacks */
static void
text_attribute_names_changed_callback (gpointer callback_data)
@@ -1303,16 +1234,6 @@ sort_directories_first_changed_callback (gpointer callback_data)
}
}
-static float fm_directory_view_preferred_zoom_levels[] = {
- (float) NAUTILUS_ICON_SIZE_SMALLEST / NAUTILUS_ICON_SIZE_STANDARD,
- (float) NAUTILUS_ICON_SIZE_SMALLER / NAUTILUS_ICON_SIZE_STANDARD,
- (float) NAUTILUS_ICON_SIZE_SMALL / NAUTILUS_ICON_SIZE_STANDARD,
- (float) NAUTILUS_ICON_SIZE_STANDARD / NAUTILUS_ICON_SIZE_STANDARD,
- (float) NAUTILUS_ICON_SIZE_LARGE / NAUTILUS_ICON_SIZE_STANDARD,
- (float) NAUTILUS_ICON_SIZE_LARGER / NAUTILUS_ICON_SIZE_STANDARD,
- (float) NAUTILUS_ICON_SIZE_LARGEST / NAUTILUS_ICON_SIZE_STANDARD
-};
-
static void
set_up_scripts_directory_global (void)
{
@@ -1497,7 +1418,128 @@ remove_directory_from_templates_directory_list (FMDirectoryView *view,
G_CALLBACK (templates_added_or_changed_callback));
}
+static void
+fm_directory_view_set_parent_window (FMDirectoryView *directory_view,
+ NautilusWindowInfo *window)
+{
+
+ directory_view->details->window = window;
+
+ /* Add new menu items and perhaps whole menus */
+ fm_directory_view_merge_menus (directory_view);
+
+ /* Set initial sensitivity, wording, toggle state, etc. */
+ fm_directory_view_update_menus (directory_view);
+
+ /* initialise show hidden mode */
+ fm_directory_view_init_show_hidden_files (directory_view);
+}
+
+static GtkWidget *
+fm_directory_view_get_widget (NautilusView *view)
+{
+ return GTK_WIDGET (view);
+}
+
+static int
+fm_directory_view_get_selection_count (NautilusView *view)
+{
+ /* FIXME: This could be faster if we special cased it in subclasses */
+ GList *files;
+ int len;
+
+ files = fm_directory_view_get_selection (FM_DIRECTORY_VIEW (view));
+ len = g_list_length (files);
+ nautilus_file_list_free (files);
+
+ return len;
+}
+
+static GList *
+fm_directory_view_get_selection_uris (NautilusView *view)
+{
+ GList *files;
+ GList *uris;
+ char *uri;
+ GList *l;
+
+ files = fm_directory_view_get_selection (FM_DIRECTORY_VIEW (view));
+ uris = NULL;
+ for (l = files; l != NULL; l = l->next) {
+ uri = nautilus_file_get_uri (NAUTILUS_FILE (l->data));
+ uris = g_list_prepend (uris, uri);
+ }
+ nautilus_file_list_free (files);
+
+ return g_list_reverse (uris);
+}
+
+static GList *
+file_list_from_uri_list (GList *uri_list)
+{
+ GList *file_list, *node;
+
+ file_list = NULL;
+ for (node = uri_list; node != NULL; node = node->next) {
+ file_list = g_list_prepend
+ (file_list,
+ nautilus_file_get (node->data));
+ }
+ return g_list_reverse (file_list);
+}
+
+static void
+fm_directory_view_set_selection_uris (NautilusView *nautilus_view,
+ GList *selection_uris)
+{
+ GList *selection;
+ FMDirectoryView *view;
+
+ view = FM_DIRECTORY_VIEW (nautilus_view);
+
+ if (!view->details->loading) {
+ /* If we aren't still loading, set the selection right now,
+ * and reveal the new selection.
+ */
+ selection = file_list_from_uri_list (selection_uris);
+ view->details->selection_change_is_due_to_shell = TRUE;
+ fm_directory_view_set_selection (view, selection);
+ view->details->selection_change_is_due_to_shell = FALSE;
+ fm_directory_view_reveal_selection (view);
+ nautilus_file_list_free (selection);
+ } else {
+ /* If we are still loading, set the list of pending URIs instead.
+ * done_loading() will eventually select the pending URIs and reveal them.
+ */
+ eel_g_list_free_deep (view->details->pending_uris_selected);
+ view->details->pending_uris_selected = NULL;
+
+ view->details->pending_uris_selected =
+ g_list_concat (view->details->pending_uris_selected,
+ eel_g_str_list_copy (selection_uris));
+ }
+}
+
+
+void
+fm_directory_view_init_view_iface (NautilusViewIface *iface)
+{
+ iface->get_widget = fm_directory_view_get_widget;
+ iface->load_location = fm_directory_view_load_location;
+ iface->stop_loading = fm_directory_view_stop_loading;
+ iface->get_selection_count = fm_directory_view_get_selection_count;
+ iface->get_selection = fm_directory_view_get_selection_uris;
+ iface->set_selection = fm_directory_view_set_selection_uris;
+
+ iface->supports_zooming = (gpointer)fm_directory_view_supports_zooming;
+ iface->bump_zoom_level = (gpointer)fm_directory_view_bump_zoom_level;
+ iface->zoom_to_level = (gpointer)fm_directory_view_zoom_to_level;
+ iface->restore_default_zoom_level = (gpointer)fm_directory_view_restore_default_zoom_level;
+ iface->can_zoom_in = (gpointer)fm_directory_view_can_zoom_in;
+ iface->can_zoom_out = (gpointer)fm_directory_view_can_zoom_out;
+ iface->get_zoom_level = (gpointer)fm_directory_view_get_zoom_level;
+}
static void
fm_directory_view_init (FMDirectoryView *view)
@@ -1524,8 +1566,6 @@ fm_directory_view_init (FMDirectoryView *view)
gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (view), NULL);
gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (view), NULL);
- view->details->nautilus_view = nautilus_view_new (GTK_WIDGET (view));
-
set_up_scripts_directory_global ();
scripts_directory = nautilus_directory_get (scripts_directory_uri);
add_directory_to_scripts_directory_list (view, scripts_directory);
@@ -1536,38 +1576,9 @@ fm_directory_view_init (FMDirectoryView *view)
add_directory_to_templates_directory_list (view, templates_directory);
nautilus_directory_unref (templates_directory);
- view->details->zoomable = bonobo_zoomable_new ();
- bonobo_zoomable_set_parameters_full (view->details->zoomable,
- 0.0, .25, 4.0, TRUE, TRUE, FALSE,
- fm_directory_view_preferred_zoom_levels, NULL,
- G_N_ELEMENTS (fm_directory_view_preferred_zoom_levels));
- bonobo_object_add_interface (BONOBO_OBJECT (view->details->nautilus_view),
- BONOBO_OBJECT (view->details->zoomable));
-
view->details->sort_directories_first =
eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST);
- g_signal_connect_object (view->details->nautilus_view, "stop_loading",
- G_CALLBACK (stop_loading_callback), view, 0);
- g_signal_connect_object (view->details->nautilus_view, "load_location",
- G_CALLBACK (load_location_callback), view, 0);
-
- nautilus_view_set_listener_mask
- (NAUTILUS_VIEW (view->details->nautilus_view),
- NAUTILUS_VIEW_LISTEN_SELECTION);
-
- g_signal_connect_object (view->details->nautilus_view, "selection_changed",
- G_CALLBACK (selection_changed_callback), view, 0);
- g_signal_connect_object (fm_directory_view_get_bonobo_control (view), "activate",
- G_CALLBACK (bonobo_control_activate_callback), view, 0);
- g_signal_connect_object (view->details->zoomable, "zoom_in",
- G_CALLBACK (zoomable_zoom_in_callback), view, 0);
- g_signal_connect_object (view->details->zoomable, "zoom_out",
- G_CALLBACK (zoomable_zoom_out_callback), view, 0);
- g_signal_connect_object (view->details->zoomable, "set_zoom_level",
- G_CALLBACK (zoomable_set_zoom_level_callback), view, 0);
- g_signal_connect_object (view->details->zoomable, "zoom_to_fit",
- G_CALLBACK (zoomable_zoom_to_fit_callback), view, 0);
g_signal_connect_object (nautilus_trash_monitor_get (), "trash_state_changed",
G_CALLBACK (fm_directory_view_trash_state_changed_callback), view, 0);
@@ -1601,6 +1612,34 @@ fm_directory_view_init (FMDirectoryView *view)
}
static void
+unmerge_ui (FMDirectoryView *view)
+{
+ GtkUIManager *ui_manager;
+
+ if (view->details->window == NULL) {
+ return;
+ }
+
+ ui_manager = nautilus_window_info_get_ui_manager (view->details->window);
+
+ nautilus_ui_unmerge_ui (ui_manager,
+ &view->details->dir_merge_id,
+ &view->details->dir_action_group);
+ nautilus_ui_unmerge_ui (ui_manager,
+ &view->details->extensions_menu_merge_id,
+ &view->details->extensions_menu_action_group);
+ nautilus_ui_unmerge_ui (ui_manager,
+ &view->details->open_with_merge_id,
+ &view->details->open_with_action_group);
+ nautilus_ui_unmerge_ui (ui_manager,
+ &view->details->scripts_merge_id,
+ &view->details->scripts_action_group);
+ nautilus_ui_unmerge_ui (ui_manager,
+ &view->details->templates_merge_id,
+ &view->details->templates_action_group);
+}
+
+static void
fm_directory_view_destroy (GtkObject *object)
{
FMDirectoryView *view;
@@ -1610,13 +1649,10 @@ fm_directory_view_destroy (GtkObject *object)
disconnect_model_handlers (view);
- /* Since we are owned by the NautilusView, if we're going it's
- * gone. It would be even better to NULL this out when the
- * NautilusView goes away, but this is good enough for our
- * purposes.
- */
- view->details->zoomable = NULL;
- view->details->nautilus_view = NULL;
+ unmerge_ui (view);
+
+ /* We don't own the window, so no unref */
+ view->details->window = NULL;
monitor_file_for_open_with (view, NULL);
@@ -1653,8 +1689,6 @@ fm_directory_view_destroy (GtkObject *object)
fm_directory_view_ignore_hidden_file_preferences (view);
- eel_remove_weak_pointer (&view->details->ui);
-
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
}
@@ -1861,95 +1895,37 @@ fm_directory_view_display_selection_info (FMDirectoryView *view)
g_free (folder_item_count_str);
g_free (non_folder_str);
- nautilus_view_report_status (view->details->nautilus_view,
- status_string);
+ nautilus_window_info_set_status (view->details->window,
+ status_string);
g_free (status_string);
}
void
fm_directory_view_send_selection_change (FMDirectoryView *view)
{
- GList *selection, *uris, *p;
-
- /* Collect a list of URIs. */
- selection = fm_directory_view_get_selection (view);
- uris = NULL;
- for (p = selection; p != NULL; p = p->next) {
- uris = g_list_prepend (uris, nautilus_file_get_uri (p->data));
- }
- nautilus_file_list_free (selection);
-
- /* Send the selection change. */
- nautilus_view_report_selection_change (view->details->nautilus_view,
- uris);
-
- /* Free the URIs. */
- eel_g_list_free_deep (uris);
+ nautilus_window_info_report_selection_changed (view->details->window);
view->details->send_selection_change_to_shell = FALSE;
}
static void
-load_location_callback (NautilusView *nautilus_view,
- const char *location,
- FMDirectoryView *directory_view)
+fm_directory_view_load_location (NautilusView *nautilus_view,
+ const char *location)
{
NautilusDirectory *directory;
+ FMDirectoryView *directory_view;
+
+ directory_view = FM_DIRECTORY_VIEW (nautilus_view);
directory = nautilus_directory_get (location);
load_directory (directory_view, directory);
nautilus_directory_unref (directory);
}
-static GList *
-file_list_from_uri_list (GList *uri_list)
-{
- GList *file_list, *node;
-
- file_list = NULL;
- for (node = uri_list; node != NULL; node = node->next) {
- file_list = g_list_prepend
- (file_list,
- nautilus_file_get (node->data));
- }
- return g_list_reverse (file_list);
-}
-
-static void
-selection_changed_callback (NautilusView *nautilus_view,
- GList *selection_uris,
- FMDirectoryView *view)
-{
- GList *selection;
-
- if (!view->details->loading) {
- /* If we aren't still loading, set the selection right now,
- * and reveal the new selection.
- */
- selection = file_list_from_uri_list (selection_uris);
- view->details->selection_change_is_due_to_shell = TRUE;
- fm_directory_view_set_selection (view, selection);
- view->details->selection_change_is_due_to_shell = FALSE;
- fm_directory_view_reveal_selection (view);
- nautilus_file_list_free (selection);
- } else {
- /* If we are still loading, set the list of pending URIs instead.
- * done_loading() will eventually select the pending URIs and reveal them.
- */
- eel_g_list_free_deep (view->details->pending_uris_selected);
- view->details->pending_uris_selected = NULL;
-
- view->details->pending_uris_selected =
- g_list_concat (view->details->pending_uris_selected,
- eel_g_str_list_copy (selection_uris));
- }
-}
-
static void
-stop_loading_callback (NautilusView *nautilus_view,
- FMDirectoryView *view)
+fm_directory_view_stop_loading (NautilusView *nautilus_view)
{
- fm_directory_view_stop (view);
+ fm_directory_view_stop (FM_DIRECTORY_VIEW (nautilus_view));
}
static void
@@ -2009,10 +1985,10 @@ done_loading (FMDirectoryView *view)
}
/* This can be called during destruction, in which case there
- * is no NautilusView any more.
+ * is no NautilusWindowInfo any more.
*/
- if (view->details->nautilus_view != NULL) {
- nautilus_view_report_load_complete (view->details->nautilus_view);
+ if (view->details->window != NULL) {
+ nautilus_window_info_report_load_complete (view->details->window, NAUTILUS_VIEW (view));
schedule_update_menus (view);
schedule_update_status (view);
check_for_directory_hard_limit (view);
@@ -2041,7 +2017,8 @@ done_loading (FMDirectoryView *view)
}
static void
-reset_background_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_reset_background_callback (GtkAction *action,
+ gpointer callback_data)
{
g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
@@ -2050,55 +2027,6 @@ reset_background_callback (BonoboUIComponent *component, gpointer callback_data,
(FM_DIRECTORY_VIEW (callback_data)));
}
-static void
-zoomable_zoom_in_callback (BonoboZoomable *zoomable, FMDirectoryView *directory_view)
-{
- fm_directory_view_bump_zoom_level (directory_view, 1);
-}
-
-static void
-zoomable_zoom_out_callback (BonoboZoomable *zoomable, FMDirectoryView *directory_view)
-{
- fm_directory_view_bump_zoom_level (directory_view, -1);
-}
-
-static NautilusZoomLevel
-nautilus_zoom_level_from_float(float zoom_level)
-{
- int icon_size = floor(zoom_level * NAUTILUS_ICON_SIZE_STANDARD + 0.5);
-
- if (icon_size <= NAUTILUS_ICON_SIZE_SMALLEST) {
- return NAUTILUS_ZOOM_LEVEL_SMALLEST;
- } else if (icon_size <= NAUTILUS_ICON_SIZE_SMALLER) {
- return NAUTILUS_ZOOM_LEVEL_SMALLER;
- } else if (icon_size <= NAUTILUS_ICON_SIZE_SMALL) {
- return NAUTILUS_ZOOM_LEVEL_SMALL;
- } else if (icon_size <= NAUTILUS_ICON_SIZE_STANDARD) {
- return NAUTILUS_ZOOM_LEVEL_STANDARD;
- } else if (icon_size <= NAUTILUS_ICON_SIZE_LARGE) {
- return NAUTILUS_ZOOM_LEVEL_LARGE;
- } else if (icon_size <= NAUTILUS_ICON_SIZE_LARGER) {
- return NAUTILUS_ZOOM_LEVEL_LARGER;
- } else {
- return NAUTILUS_ZOOM_LEVEL_LARGEST;
- }
-}
-
-static void
-zoomable_set_zoom_level_callback (BonoboZoomable *zoomable, float level, FMDirectoryView *view)
-{
- fm_directory_view_zoom_to_level (view, nautilus_zoom_level_from_float (level));
-}
-
-static void
-zoomable_zoom_to_fit_callback (BonoboZoomable *zoomable, FMDirectoryView *view)
-{
- /* FIXME bugzilla.gnome.org 42388:
- * Need to really implement "zoom to fit"
- */
- fm_directory_view_restore_default_zoom_level (view);
-}
-
typedef struct {
GHashTable *debuting_uris;
GList *added_files;
@@ -2526,7 +2454,7 @@ static gboolean
update_menus_timeout_callback (gpointer data)
{
FMDirectoryView *view;
-
+
view = FM_DIRECTORY_VIEW (data);
g_object_ref (G_OBJECT (view));
@@ -2790,7 +2718,8 @@ fm_directory_view_bump_zoom_level (FMDirectoryView *view, int zoom_increment)
*
**/
void
-fm_directory_view_zoom_to_level (FMDirectoryView *view, int zoom_level)
+fm_directory_view_zoom_to_level (FMDirectoryView *view,
+ NautilusZoomLevel zoom_level)
{
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
@@ -2804,22 +2733,18 @@ fm_directory_view_zoom_to_level (FMDirectoryView *view, int zoom_level)
}
-void
-fm_directory_view_set_zoom_level (FMDirectoryView *view, int zoom_level)
+NautilusZoomLevel
+fm_directory_view_get_zoom_level (FMDirectoryView *view)
{
- float new_zoom_level;
-
- g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
+ g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), NAUTILUS_ZOOM_LEVEL_STANDARD);
if (!fm_directory_view_supports_zooming (view)) {
- return;
+ return NAUTILUS_ZOOM_LEVEL_STANDARD;
}
- new_zoom_level = (float) nautilus_get_icon_size_for_zoom_level (zoom_level)
- / NAUTILUS_ICON_SIZE_STANDARD;
-
- bonobo_zoomable_report_zoom_level_changed (
- view->details->zoomable, new_zoom_level, NULL);
+ return EEL_CALL_METHOD_WITH_RETURN_VALUE
+ (FM_DIRECTORY_VIEW_CLASS, view,
+ get_zoom_level, (view));
}
/**
@@ -2953,62 +2878,13 @@ fm_directory_view_get_item_count (FMDirectoryView *view)
get_item_count, (view));
}
-/**
- * fm_directory_view_get_bonobo_ui_container:
- *
- * Get the BonoboUIContainer for this FMDirectoryView.
- * This is normally called only by subclasses in order to
- * install and modify bonobo menus and such.
- * @view: FMDirectoryView of interest.
- *
- * Return value: BonoboUIContainer for this view.
- *
- **/
-Bonobo_UIContainer
-fm_directory_view_get_bonobo_ui_container (FMDirectoryView *view)
-{
- g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), NULL);
-
- return bonobo_control_get_remote_ui_container
- (fm_directory_view_get_bonobo_control (view), NULL);
-}
-
-/**
- * fm_directory_view_get_bonobo_control:
- *
- * Get the BonoboControl for this FMDirectoryView.
- * This is normally called only by subclasses in order to
- * help editables interact with the clipboard ui component
- * @view: FMDirectoryView of interest.
- *
- * Return value: BonoboUIContainer for this view.
- *
- **/
-BonoboControl *
-fm_directory_view_get_bonobo_control (FMDirectoryView *view)
-{
- NautilusView *nautilus_view;
-
- nautilus_view = fm_directory_view_get_nautilus_view (view);
- return nautilus_view_get_bonobo_control (nautilus_view);
-}
-
-/**
- * fm_directory_view_get_nautilus_view:
- *
- * Get the NautilusView for this FMDirectoryView.
- * This is normally called only by the embedding framework.
- * @view: FMDirectoryView of interest.
- *
- * Return value: NautilusView for this view.
- *
- **/
-NautilusView *
-fm_directory_view_get_nautilus_view (FMDirectoryView *view)
+GtkUIManager *
+fm_directory_view_get_ui_manager (FMDirectoryView *view)
{
- g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), NULL);
-
- return view->details->nautilus_view;
+ if (view->details->window == NULL) {
+ return NULL;
+ }
+ return nautilus_window_info_get_ui_manager (view->details->window);
}
/**
@@ -3630,7 +3506,7 @@ open_one_in_new_window (gpointer data, gpointer callback_data)
fm_directory_view_activate_file (FM_DIRECTORY_VIEW (callback_data),
NAUTILUS_FILE (data),
- Nautilus_ViewFrame_OPEN_IN_NAVIGATION,
+ NAUTILUS_WINDOW_OPEN_IN_NAVIGATION,
0);
}
@@ -3643,7 +3519,8 @@ fm_directory_view_get_directory_as_file (FMDirectoryView *view)
}
static void
-bonobo_launch_application_callback (BonoboUIComponent *component, gpointer callback_data, const char *path)
+open_with_launch_application_callback (GtkAction *action,
+ gpointer callback_data)
{
ApplicationLaunchParameters *launch_parameters;
@@ -3652,108 +3529,176 @@ bonobo_launch_application_callback (BonoboUIComponent *component, gpointer callb
(launch_parameters->application,
launch_parameters->file,
launch_parameters->directory_view);
-}
+}
-static void
-add_numbered_menu_item (BonoboUIComponent *ui,
- const char *parent_path,
- const char *label,
- const char *tip,
- int index,
- GdkPixbuf *pixbuf,
- gpointer callback,
- gpointer callback_data,
- GDestroyNotify destroy_notify)
+static char *
+escape_action_name (const char *action_name,
+ const char *prefix)
{
- char *escaped_parent_path, *escaped_label, *verb_name, *item_path;
+ GString *s;
- if (parent_path == NULL) {
- return;
+ if (action_name == NULL) {
+ return NULL;
}
- escaped_parent_path = eel_str_double_underscores (parent_path);
+ s = g_string_new (prefix);
- escaped_label = eel_str_double_underscores (label);
- nautilus_bonobo_add_numbered_menu_item
- (ui,
- escaped_parent_path,
- index,
- escaped_label,
- pixbuf);
- g_free (escaped_label);
+ while (*action_name != 0) {
+ switch (*action_name) {
+ case '\\':
+ g_string_append (s, "\\\\");
+ break;
+ case '/':
+ g_string_append (s, "\\s");
+ break;
+ case '&':
+ g_string_append (s, "\\a");
+ break;
+ case '"':
+ g_string_append (s, "\\q");
+ break;
+ default:
+ g_string_append_c (s, *action_name);
+ }
- item_path = nautilus_bonobo_get_numbered_menu_item_path
- (ui, escaped_parent_path, index);
- nautilus_bonobo_set_tip (ui, item_path, tip);
- g_free (item_path);
+ action_name ++;
+ }
+ return g_string_free (s, FALSE);
+}
+
+static char *
+escape_action_path (const char *action_path)
+{
+ GString *s;
+
+ if (action_path == NULL) {
+ return NULL;
+ }
+
+ s = g_string_sized_new (strlen (action_path) + 2);
- verb_name = nautilus_bonobo_get_numbered_menu_item_command
- (ui, escaped_parent_path, index);
- bonobo_ui_component_add_verb_full (ui, verb_name,
- g_cclosure_new (callback, callback_data,
- (GClosureNotify) destroy_notify));
- g_free (verb_name);
+ while (*action_path != 0) {
+ switch (*action_path) {
+ case '\\':
+ g_string_append (s, "\\\\");
+ break;
+ case '&':
+ g_string_append (s, "\\a");
+ break;
+ case '"':
+ g_string_append (s, "\\q");
+ break;
+ default:
+ g_string_append_c (s, *action_path);
+ }
- g_free (escaped_parent_path);
+ action_path ++;
+ }
+ return g_string_free (s, FALSE);
}
+
static void
-add_submenu (BonoboUIComponent *ui,
+add_submenu (GtkUIManager *ui_manager,
+ GtkActionGroup *action_group,
+ guint merge_id,
const char *parent_path,
+ const char *uri,
const char *label,
GdkPixbuf *pixbuf)
{
- char *escaped_parent_path, *escaped_label;
-
+ char *escaped_label;
+ char *action_name;
+ char *submenu_name;
+ char *escaped_submenu_name;
+ GtkAction *action;
+
if (parent_path != NULL) {
- escaped_parent_path = eel_str_double_underscores (parent_path);
+ action_name = escape_action_name (uri, "submenu_");
+ submenu_name = g_path_get_basename (uri);
+ escaped_submenu_name = escape_action_path (submenu_name);
escaped_label = eel_str_double_underscores (label);
- nautilus_bonobo_add_submenu (ui, escaped_parent_path, escaped_label, pixbuf);
+
+ action = gtk_action_new (action_name,
+ escaped_label,
+ NULL,
+ NULL);
+ g_object_set_data_full (G_OBJECT (action), "menu-icon",
+ g_object_ref (pixbuf),
+ g_object_unref);
+
+ g_object_set (action, "hide-if-empty", FALSE, NULL);
+
+ gtk_action_group_add_action (action_group,
+ action);
+ g_object_unref (action);
+
+ gtk_ui_manager_add_ui (ui_manager,
+ merge_id,
+ parent_path,
+ escaped_submenu_name,
+ action_name,
+ GTK_UI_MANAGER_MENU,
+ FALSE);
+ g_free (action_name);
g_free (escaped_label);
- g_free (escaped_parent_path);
+ g_free (submenu_name);
+ g_free (escaped_submenu_name);
}
}
static void
-add_application_to_bonobo_menu (FMDirectoryView *directory_view,
- GnomeVFSMimeApplication *application,
- NautilusFile *file,
- int index,
- const char *menu_placeholder,
- const char *popup_placeholder)
+add_application_to_open_with_menu (FMDirectoryView *view,
+ GnomeVFSMimeApplication *application,
+ NautilusFile *file,
+ int index,
+ const char *menu_placeholder,
+ const char *popup_placeholder)
{
ApplicationLaunchParameters *launch_parameters;
char *tip;
char *label;
+ char *action_name;
+ GtkAction *action;
launch_parameters = application_launch_parameters_new
- (application, file, directory_view);
+ (application, file, view);
label = g_strdup_printf (_("Open with \"%s\""), application->name);
tip = g_strdup_printf (_("Use \"%s\" to open the selected item"), application->name);
- add_numbered_menu_item (directory_view->details->ui,
- menu_placeholder,
- label,
- tip,
- index,
- NULL,
- bonobo_launch_application_callback,
- launch_parameters,
- (GDestroyNotify) application_launch_parameters_free);
-
+ action_name = g_strdup_printf ("open_with_%d", index);
- /* Use same launch parameters and no DestroyNotify for popup item, which has same
- * lifetime as the item in the File menu in the menu bar.
- */
- add_numbered_menu_item (directory_view->details->ui,
- popup_placeholder,
- label,
- tip,
- index,
- NULL,
- bonobo_launch_application_callback,
- launch_parameters,
- NULL);
+ action = gtk_action_new (action_name,
+ label,
+ tip,
+ NULL);
+
+ g_signal_connect_data (action, "activate",
+ G_CALLBACK (open_with_launch_application_callback),
+ launch_parameters,
+ (GClosureNotify)application_launch_parameters_free, 0);
+
+ gtk_action_group_add_action (view->details->open_with_action_group,
+ action);
+ g_object_unref (action);
+
+ gtk_ui_manager_add_ui (nautilus_window_info_get_ui_manager (view->details->window),
+ view->details->open_with_merge_id,
+ menu_placeholder,
+ action_name,
+ action_name,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+
+ gtk_ui_manager_add_ui (nautilus_window_info_get_ui_manager (view->details->window),
+ view->details->open_with_merge_id,
+ popup_placeholder,
+ action_name,
+ action_name,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+
+ g_free (action_name);
g_free (label);
g_free (tip);
}
@@ -3894,7 +3839,7 @@ get_activation_action (NautilusFile *file)
}
static void
-reset_bonobo_open_with_menu (FMDirectoryView *view, GList *selection)
+reset_open_with_menu (FMDirectoryView *view, GList *selection)
{
GList *applications, *node;
NautilusFile *file;
@@ -3903,16 +3848,20 @@ reset_bonobo_open_with_menu (FMDirectoryView *view, GList *selection)
int num_applications;
int index;
gboolean other_applications_visible;
+ GtkUIManager *ui_manager;
+ GtkAction *action;
/* Clear any previous inserted items in the applications and viewers placeholders */
- nautilus_bonobo_remove_menu_items_and_commands
- (view->details->ui, FM_DIRECTORY_VIEW_MENU_PATH_APPLICATIONS_PLACEHOLDER);
- nautilus_bonobo_remove_menu_items_and_commands
- (view->details->ui, FM_DIRECTORY_VIEW_POPUP_PATH_APPLICATIONS_PLACEHOLDER);
- nautilus_bonobo_remove_menu_items_and_commands
- (view->details->ui, FM_DIRECTORY_VIEW_MENU_PATH_APPLICATIONS_SUBMENU_PLACEHOLDER);
- nautilus_bonobo_remove_menu_items_and_commands
- (view->details->ui, FM_DIRECTORY_VIEW_POPUP_PATH_APPLICATIONS_SUBMENU_PLACEHOLDER);
+
+ ui_manager = nautilus_window_info_get_ui_manager (view->details->window);
+ nautilus_ui_unmerge_ui (ui_manager,
+ &view->details->open_with_merge_id,
+ &view->details->open_with_action_group);
+
+ nautilus_ui_prepare_merge_ui (ui_manager,
+ "OpenWithGroup",
+ &view->details->open_with_merge_id,
+ &view->details->open_with_action_group);
num_applications = 0;
@@ -3935,12 +3884,12 @@ reset_bonobo_open_with_menu (FMDirectoryView *view, GList *selection)
a mime mismatch, otherwise we can't use it in the
open with menu */
if (action == ACTIVATION_ACTION_OPEN_IN_APPLICATION &&
- activate_check_mime_types (view, file, FALSE)) {
+ can_show_default_app (view, file)) {
default_app = nautilus_mime_get_default_application_for_file (file);
} else {
default_app = NULL;
}
-
+
applications = NULL;
if (other_applications_visible) {
applications = nautilus_mime_get_open_with_applications_for_file (NAUTILUS_FILE (selection->data));
@@ -3966,12 +3915,20 @@ reset_bonobo_open_with_menu (FMDirectoryView *view, GList *selection)
menu_path = FM_DIRECTORY_VIEW_MENU_PATH_APPLICATIONS_PLACEHOLDER;
popup_path = FM_DIRECTORY_VIEW_POPUP_PATH_APPLICATIONS_PLACEHOLDER;
}
-
- add_application_to_bonobo_menu (view,
- node->data,
- file,
- index,
- menu_path,popup_path);
+
+ gtk_ui_manager_add_ui (nautilus_window_info_get_ui_manager (view->details->window),
+ view->details->open_with_merge_id,
+ menu_path,
+ "separator",
+ NULL,
+ GTK_UI_MANAGER_SEPARATOR,
+ FALSE);
+
+ add_application_to_open_with_menu (view,
+ node->data,
+ file,
+ index,
+ menu_path, popup_path);
}
gnome_vfs_mime_application_list_free (applications);
@@ -3980,28 +3937,21 @@ reset_bonobo_open_with_menu (FMDirectoryView *view, GList *selection)
submenu_visible = (num_applications > 3);
}
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_OTHER_APPLICATION,
- !other_applications_visible);
-
- /* It's OK to set the visibility of the menu items (rather than the verbs)
- * here because these are submenu titles, not items with verbs.
- */
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_MENU_PATH_OPEN_WITH,
- !submenu_visible);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_POPUP_PATH_OPEN_WITH,
- !submenu_visible);
-
-
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_POPUP_PATH_OTHER_APPLICATION_PLACEHOLDER,
- submenu_visible);
-
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_MENU_PATH_OTHER_APPLICATION_PLACEHOLDER,
- submenu_visible);
+ if (submenu_visible) {
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_OTHER_APPLICATION1);
+ gtk_action_set_visible (action, other_applications_visible);
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_OTHER_APPLICATION2);
+ gtk_action_set_visible (action, FALSE);
+ } else {
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_OTHER_APPLICATION1);
+ gtk_action_set_visible (action, FALSE);
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_OTHER_APPLICATION2);
+ gtk_action_set_visible (action, other_applications_visible);
+ }
}
static GList *
@@ -4038,6 +3988,7 @@ typedef struct
GList *selection;
} ExtensionActionCallbackData;
+
static void
extension_action_callback_data_free (ExtensionActionCallbackData *data)
{
@@ -4092,8 +4043,8 @@ extension_action_slow_mime_types_ready_callback (GList *selection,
}
static void
-extension_action_callback (BonoboUIComponent *component,
- gpointer callback_data, const char *path)
+extension_action_callback (GtkAction *action,
+ gpointer callback_data)
{
ExtensionActionCallbackData *data;
@@ -4106,37 +4057,67 @@ extension_action_callback (BonoboUIComponent *component,
callback_data);
}
-static void
-add_extension_command_for_files (FMDirectoryView *view,
- NautilusMenuItem *item,
- GList *files)
+static GtkAction *
+add_extension_action_for_files (FMDirectoryView *view,
+ NautilusMenuItem *item,
+ GList *files)
{
- char *xml;
- char *name;
+ char *name, *label, *tip, *icon;
+ gboolean sensitive, priority;
+ GtkAction *action;
+ GdkPixbuf *pixbuf;
ExtensionActionCallbackData *data;
- GClosure *closure;
-
- xml = nautilus_bonobo_get_extension_item_command_xml (item);
-
- bonobo_ui_component_set (view->details->ui, "/commands", xml, NULL);
-
- g_free (xml);
+
+ g_object_get (G_OBJECT (item),
+ "name", &name, "label", &label,
+ "tip", &tip, "icon", &icon,
+ "sensitive", &sensitive,
+ "priority", &priority,
+ NULL);
+
+ action = gtk_action_new (name,
+ label,
+ tip,
+ icon);
+
+ /* TODO: This should really use themed icons, but that
+ doesn't work here yet */
+ if (icon != NULL) {
+ pixbuf = nautilus_icon_factory_get_pixbuf_from_name
+ (icon,
+ NULL,
+ NAUTILUS_ICON_SIZE_FOR_MENUS,
+ NULL);
+ if (pixbuf != NULL) {
+ g_object_set_data_full (G_OBJECT (action), "menu-icon",
+ pixbuf,
+ g_object_unref);
+ }
+ }
- g_object_get (G_OBJECT (item), "name", &name, NULL);
+ gtk_action_set_sensitive (action, sensitive);
+ g_object_set (action, "is-important", priority, NULL);
data = g_new0 (ExtensionActionCallbackData, 1);
data->item = g_object_ref (item);
data->view = view;
data->selection = nautilus_file_list_copy (files);
- closure = g_cclosure_new
- (G_CALLBACK (extension_action_callback),
- data,
- (GClosureNotify)extension_action_callback_data_free);
-
- bonobo_ui_component_add_verb_full (view->details->ui, name, closure);
+ g_signal_connect_data (action, "activate",
+ G_CALLBACK (extension_action_callback),
+ data,
+ (GClosureNotify)extension_action_callback_data_free, 0);
+
+ gtk_action_group_add_action (view->details->extensions_menu_action_group,
+ GTK_ACTION (action));
+ g_object_unref (action);
g_free (name);
+ g_free (label);
+ g_free (tip);
+ g_free (icon);
+
+ return action;
}
static void
@@ -4212,6 +4193,13 @@ warn_mismatched_mime_types (FMDirectoryView *view,
gtk_widget_show (dialog);
}
+static gboolean
+can_show_default_app (FMDirectoryView *view, NautilusFile *file)
+{
+ return (!nautilus_file_check_if_ready (file, NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE) || activate_check_mime_types (view, file, FALSE));
+
+}
+
static gboolean
activate_check_mime_types (FMDirectoryView *view,
NautilusFile *file,
@@ -4260,20 +4248,34 @@ add_extension_menu_items (FMDirectoryView *view,
GList *files,
GList *menu_items)
{
+ GtkUIManager *ui_manager;
GList *l;
+
+ ui_manager = nautilus_window_info_get_ui_manager (view->details->window);
+
for (l = menu_items; l; l = l->next) {
NautilusMenuItem *item;
+ GtkAction *action;
item = NAUTILUS_MENU_ITEM (l->data);
- add_extension_command_for_files (view, item, files);
-
- nautilus_bonobo_add_extension_item (view->details->ui,
- FM_DIRECTORY_VIEW_POPUP_PATH_EXTENSION_ACTIONS,
- item);
- nautilus_bonobo_add_extension_item (view->details->ui,
- FM_DIRECTORY_VIEW_MENU_PATH_EXTENSION_ACTIONS_PLACEHOLDER,
- item);
+ action = add_extension_action_for_files (view, item, files);
+
+ gtk_ui_manager_add_ui (ui_manager,
+ view->details->extensions_menu_merge_id,
+ FM_DIRECTORY_VIEW_POPUP_PATH_EXTENSION_ACTIONS,
+ gtk_action_get_name (action),
+ gtk_action_get_name (action),
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+
+ gtk_ui_manager_add_ui (ui_manager,
+ view->details->extensions_menu_merge_id,
+ FM_DIRECTORY_VIEW_MENU_PATH_EXTENSION_ACTIONS_PLACEHOLDER,
+ gtk_action_get_name (action),
+ gtk_action_get_name (action),
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
}
}
@@ -4325,12 +4327,19 @@ reset_extension_actions_menu (FMDirectoryView *view, GList *selection)
GList *unique_selection;
GList *items;
GList *l;
-
+ GtkUIManager *ui_manager;
+
/* Clear any previous inserted items in the extension actions placeholder */
- nautilus_bonobo_remove_menu_items_and_commands
- (view->details->ui, FM_DIRECTORY_VIEW_POPUP_PATH_EXTENSION_ACTIONS);
- nautilus_bonobo_remove_menu_items_and_commands
- (view->details->ui, FM_DIRECTORY_VIEW_MENU_PATH_EXTENSION_ACTIONS_PLACEHOLDER);
+ ui_manager = nautilus_window_info_get_ui_manager (view->details->window);
+
+ nautilus_ui_unmerge_ui (ui_manager,
+ &view->details->extensions_menu_merge_id,
+ &view->details->extensions_menu_action_group);
+
+ nautilus_ui_prepare_merge_ui (ui_manager,
+ "DirExtensionsMenuGroup",
+ &view->details->extensions_menu_merge_id,
+ &view->details->extensions_menu_action_group);
/* only query for the unique files */
unique_selection = get_unique_files (selection);
@@ -4491,7 +4500,7 @@ unset_script_environment_variables (void)
}
static void
-run_script_callback (BonoboUIComponent *component, gpointer callback_data, const char *path)
+run_script_callback (GtkAction *action, gpointer callback_data)
{
ScriptLaunchParameters *launch_parameters;
GdkScreen *screen;
@@ -4550,63 +4559,87 @@ run_script_callback (BonoboUIComponent *component, gpointer callback_data, const
static void
add_script_to_scripts_menus (FMDirectoryView *directory_view,
- NautilusFile *file,
- int index,
- const char *menu_path,
- const char *popup_path,
- const char *popup_bg_path)
+ NautilusFile *file,
+ const char *menu_path,
+ const char *popup_path,
+ const char *popup_bg_path)
{
ScriptLaunchParameters *launch_parameters;
char *tip;
char *name;
+ char *uri;
+ char *action_name;
+ char *escaped_label;
GdkPixbuf *pixbuf;
+ GtkUIManager *ui_manager;
+ GtkAction *action;
name = nautilus_file_get_display_name (file);
+ uri = nautilus_file_get_uri (file);
tip = g_strdup_printf (_("Run \"%s\" on any selected items"), name);
launch_parameters = script_launch_parameters_new (file, directory_view);
pixbuf = nautilus_icon_factory_get_pixbuf_for_file
(file, NULL, NAUTILUS_ICON_SIZE_FOR_MENUS);
- add_numbered_menu_item (directory_view->details->ui,
- menu_path,
- name,
- tip,
- index,
- pixbuf,
- run_script_callback,
- launch_parameters,
- (GDestroyNotify) script_launch_parameters_free);
-
- /* Use same launch parameters and no DestroyNotify for popup item, which has same
- * lifetime as the item in the File menu in the menu bar.
- */
- add_numbered_menu_item (directory_view->details->ui,
- popup_path,
- name,
- tip,
- index,
- pixbuf,
- run_script_callback,
- launch_parameters,
- NULL);
- add_numbered_menu_item (directory_view->details->ui,
- popup_bg_path,
- name,
- tip,
- index,
- pixbuf,
- run_script_callback,
- launch_parameters,
- NULL);
+ action_name = escape_action_name (uri, "script_");
+ escaped_label = eel_str_double_underscores (name);
+
+ action = gtk_action_new (action_name,
+ escaped_label,
+ tip,
+ NULL);
+
+ g_object_set_data_full (G_OBJECT (action), "menu-icon",
+ g_object_ref (pixbuf),
+ g_object_unref);
+
+ g_signal_connect_data (action, "activate",
+ G_CALLBACK (run_script_callback),
+ launch_parameters,
+ (GClosureNotify)script_launch_parameters_free, 0);
+
+ gtk_action_group_add_action (directory_view->details->scripts_action_group,
+ action);
+ g_object_unref (action);
+
+ ui_manager = nautilus_window_info_get_ui_manager (directory_view->details->window);
+
+ gtk_ui_manager_add_ui (ui_manager,
+ directory_view->details->scripts_merge_id,
+ menu_path,
+ action_name,
+ action_name,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+ gtk_ui_manager_add_ui (ui_manager,
+ directory_view->details->scripts_merge_id,
+ popup_path,
+ action_name,
+ action_name,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+ gtk_ui_manager_add_ui (ui_manager,
+ directory_view->details->scripts_merge_id,
+ popup_bg_path,
+ action_name,
+ action_name,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+
g_object_unref (pixbuf);
g_free (name);
+ g_free (uri);
g_free (tip);
+ g_free (action_name);
+ g_free (escaped_label);
}
static void
add_submenu_to_directory_menus (FMDirectoryView *directory_view,
+ GtkActionGroup *action_group,
+ guint merge_id,
NautilusFile *file,
const char *menu_path,
const char *popup_path,
@@ -4614,15 +4647,20 @@ add_submenu_to_directory_menus (FMDirectoryView *directory_view,
{
char *name;
GdkPixbuf *pixbuf;
+ char *uri;
+ GtkUIManager *ui_manager;
+ ui_manager = nautilus_window_info_get_ui_manager (directory_view->details->window);
+ uri = nautilus_file_get_uri (file);
name = nautilus_file_get_display_name (file);
pixbuf = nautilus_icon_factory_get_pixbuf_for_file
(file, NULL, NAUTILUS_ICON_SIZE_FOR_MENUS);
- add_submenu (directory_view->details->ui, menu_path, name, pixbuf);
- add_submenu (directory_view->details->ui, popup_path, name, pixbuf);
- add_submenu (directory_view->details->ui, popup_bg_path, name, pixbuf);
+ add_submenu (ui_manager, action_group, merge_id, menu_path, uri, name, pixbuf);
+ add_submenu (ui_manager, action_group, merge_id, popup_path, uri, name, pixbuf);
+ add_submenu (ui_manager, action_group, merge_id, popup_bg_path, uri, name, pixbuf);
g_object_unref (pixbuf);
g_free (name);
+ g_free (uri);
}
static gboolean
@@ -4659,10 +4697,9 @@ update_directory_in_scripts_menu (FMDirectoryView *view, NautilusDirectory *dire
NautilusDirectory *dir;
char *uri;
char *escaped_path;
- int i;
uri = nautilus_directory_get_uri (directory);
- escaped_path = gnome_vfs_escape_path_string (uri + scripts_directory_uri_length);
+ escaped_path = escape_action_path (uri + scripts_directory_uri_length);
g_free (uri);
menu_path = g_strconcat (FM_DIRECTORY_VIEW_MENU_PATH_SCRIPTS_PLACEHOLDER,
escaped_path,
@@ -4682,12 +4719,11 @@ update_directory_in_scripts_menu (FMDirectoryView *view, NautilusDirectory *dire
file_list = nautilus_file_list_sort_by_display_name (filtered);
any_scripts = FALSE;
- i = 0;
for (node = file_list; node != NULL; node = node->next) {
file = node->data;
if (file_is_launchable (file)) {
- add_script_to_scripts_menus (view, file, i++, menu_path, popup_path, popup_bg_path);
+ add_script_to_scripts_menus (view, file, menu_path, popup_path, popup_bg_path);
any_scripts = TRUE;
} else if (nautilus_file_is_directory (file)) {
uri = nautilus_file_get_uri (file);
@@ -4696,7 +4732,10 @@ update_directory_in_scripts_menu (FMDirectoryView *view, NautilusDirectory *dire
add_directory_to_scripts_directory_list (view, dir);
nautilus_directory_unref (dir);
- add_submenu_to_directory_menus (view, file, menu_path, popup_path, popup_bg_path);
+ add_submenu_to_directory_menus (view,
+ view->details->scripts_action_group,
+ view->details->scripts_merge_id,
+ file, menu_path, popup_path, popup_bg_path);
any_scripts = TRUE;
}
@@ -4720,18 +4759,23 @@ update_scripts_menu (FMDirectoryView *view)
GList *sorted_copy, *node;
NautilusDirectory *directory;
char *uri;
+ GtkUIManager *ui_manager;
+ GtkAction *action;
/* There is a race condition here. If we don't mark the scripts menu as
valid before we begin our task then we can lose script menu updates that
occur before we finish. */
view->details->scripts_invalid = FALSE;
- nautilus_bonobo_remove_menu_items_and_commands
- (view->details->ui, FM_DIRECTORY_VIEW_MENU_PATH_SCRIPTS_PLACEHOLDER);
- nautilus_bonobo_remove_menu_items_and_commands
- (view->details->ui, FM_DIRECTORY_VIEW_POPUP_PATH_SCRIPTS_PLACEHOLDER);
- nautilus_bonobo_remove_menu_items_and_commands
- (view->details->ui, FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_SCRIPTS_PLACEHOLDER);
+ ui_manager = nautilus_window_info_get_ui_manager (view->details->window);
+ nautilus_ui_unmerge_ui (ui_manager,
+ &view->details->scripts_merge_id,
+ &view->details->scripts_action_group);
+
+ nautilus_ui_prepare_merge_ui (ui_manager,
+ "ScriptsGroup",
+ &view->details->scripts_merge_id,
+ &view->details->scripts_action_group);
/* As we walk through the directories, remove any that no longer belong. */
any_scripts = FALSE;
@@ -4750,28 +4794,12 @@ update_scripts_menu (FMDirectoryView *view)
}
nautilus_directory_list_free (sorted_copy);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_MENU_PATH_SCRIPTS,
- !any_scripts);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_POPUP_PATH_SCRIPTS,
- !any_scripts);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_SCRIPTS,
- !any_scripts);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_MENU_PATH_SCRIPTS_SEPARATOR,
- !any_scripts);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_POPUP_PATH_SCRIPTS_SEPARATOR,
- !any_scripts);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_SCRIPTS_SEPARATOR,
- !any_scripts);
-}
-
-static void
-create_template_callback (BonoboUIComponent *component, gpointer callback_data, const char *path)
+ action = gtk_action_group_get_action (view->details->dir_action_group, FM_ACTION_SCRIPTS);
+ gtk_action_set_visible (action, any_scripts);
+}
+
+static void
+create_template_callback (GtkAction *action, gpointer callback_data)
{
CreateTemplateParameters *parameters;
@@ -4780,22 +4808,23 @@ create_template_callback (BonoboUIComponent *component, gpointer callback_data,
fm_directory_view_new_file (parameters->directory_view, parameters->file);
}
-
static void
add_template_to_templates_menus (FMDirectoryView *directory_view,
NautilusFile *file,
- int index,
const char *menu_path,
const char *popup_bg_path)
{
- char *tip;
- char *name;
- char *dot;
+ char *tip, *uri, *name;
+ char *dot, *escaped_label;
GdkPixbuf *pixbuf;
+ char *action_name;
CreateTemplateParameters *parameters;
+ GtkUIManager *ui_manager;
+ GtkAction *action;
+
name = nautilus_file_get_display_name (file);
-
+ uri = nautilus_file_get_uri (file);
tip = g_strdup_printf (_("Create Document from template \"%s\""), name);
/* Remove extension */
@@ -4807,33 +4836,53 @@ add_template_to_templates_menus (FMDirectoryView *directory_view,
pixbuf = nautilus_icon_factory_get_pixbuf_for_file
(file, NULL, NAUTILUS_ICON_SIZE_FOR_MENUS);
+ action_name = escape_action_name (uri, "template_");
+ escaped_label = eel_str_double_underscores (name);
+
parameters = create_template_parameters_new (file, directory_view);
- add_numbered_menu_item (directory_view->details->ui,
- menu_path,
- name,
- tip,
- index,
- pixbuf,
- create_template_callback,
- parameters,
- (GDestroyNotify) create_templates_parameters_free);
-
- /* Use same uri and no DestroyNotify for popup item, which has same
- * lifetime as the item in the File menu in the menu bar.
- */
- add_numbered_menu_item (directory_view->details->ui,
- popup_bg_path,
- name,
- tip,
- index,
- pixbuf,
- create_template_callback,
- parameters,
- NULL);
+ action = gtk_action_new (action_name,
+ escaped_label,
+ tip,
+ NULL);
+
+ g_object_set_data_full (G_OBJECT (action), "menu-icon",
+ g_object_ref (pixbuf),
+ g_object_unref);
+
+ g_signal_connect_data (action, "activate",
+ G_CALLBACK (create_template_callback),
+ parameters,
+ (GClosureNotify)create_templates_parameters_free, 0);
+
+ gtk_action_group_add_action (directory_view->details->templates_action_group,
+ action);
+ g_object_unref (action);
+
+ ui_manager = nautilus_window_info_get_ui_manager (directory_view->details->window);
+
+ gtk_ui_manager_add_ui (ui_manager,
+ directory_view->details->templates_merge_id,
+ menu_path,
+ action_name,
+ action_name,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+
+ gtk_ui_manager_add_ui (ui_manager,
+ directory_view->details->templates_merge_id,
+ popup_bg_path,
+ action_name,
+ action_name,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+
g_object_unref (pixbuf);
+ g_free (escaped_label);
g_free (name);
g_free (tip);
+ g_free (uri);
+ g_free (action_name);
}
@@ -4871,18 +4920,16 @@ update_directory_in_templates_menu (FMDirectoryView *view, NautilusDirectory *di
NautilusDirectory *dir;
char *escaped_path;
char *uri;
- int i;
uri = nautilus_directory_get_uri (directory);
- escaped_path = gnome_vfs_escape_path_string (uri + templates_directory_uri_length);
+ escaped_path = escape_action_path (uri + templates_directory_uri_length);
g_free (uri);
menu_path = g_strconcat (FM_DIRECTORY_VIEW_MENU_PATH_NEW_DOCUMENTS_PLACEHOLDER,
escaped_path,
NULL);
popup_bg_path = g_strconcat (FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_NEW_DOCUMENTS_PLACEHOLDER,
escaped_path,
- NULL);;
-
+ NULL);
g_free (escaped_path);
file_list = nautilus_directory_get_file_list (directory);
@@ -4892,7 +4939,6 @@ update_directory_in_templates_menu (FMDirectoryView *view, NautilusDirectory *di
file_list = nautilus_file_list_sort_by_display_name (filtered);
any_templates = FALSE;
- i = 0;
for (node = file_list; node != NULL; node = node->next) {
file = node->data;
@@ -4903,13 +4949,16 @@ update_directory_in_templates_menu (FMDirectoryView *view, NautilusDirectory *di
add_directory_to_templates_directory_list (view, dir);
nautilus_directory_unref (dir);
- add_submenu_to_directory_menus (view, file, menu_path, NULL, popup_bg_path);
+ add_submenu_to_directory_menus (view,
+ view->details->templates_action_group,
+ view->details->templates_merge_id,
+ file, menu_path, NULL, popup_bg_path);
any_templates = TRUE;
}
g_free (uri);
} else if (nautilus_file_can_read (file)) {
- add_template_to_templates_menus (view, file, i++, menu_path, popup_bg_path);
+ add_template_to_templates_menus (view, file, menu_path, popup_bg_path);
any_templates = TRUE;
}
}
@@ -4930,17 +4979,24 @@ update_templates_menu (FMDirectoryView *view)
gboolean any_templates;
GList *sorted_copy, *node;
NautilusDirectory *directory;
+ GtkUIManager *ui_manager;
char *uri;
+ GtkAction *action;
/* There is a race condition here. If we don't mark the scripts menu as
valid before we begin our task then we can lose template menu updates that
occur before we finish. */
view->details->templates_invalid = FALSE;
- nautilus_bonobo_remove_menu_items_and_commands
- (view->details->ui, FM_DIRECTORY_VIEW_MENU_PATH_NEW_DOCUMENTS_PLACEHOLDER);
- nautilus_bonobo_remove_menu_items_and_commands
- (view->details->ui, FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_NEW_DOCUMENTS_PLACEHOLDER);
+ ui_manager = nautilus_window_info_get_ui_manager (view->details->window);
+ nautilus_ui_unmerge_ui (ui_manager,
+ &view->details->templates_merge_id,
+ &view->details->templates_action_group);
+
+ nautilus_ui_prepare_merge_ui (ui_manager,
+ "TemplatesGroup",
+ &view->details->templates_merge_id,
+ &view->details->templates_action_group);
/* As we walk through the directories, remove any that no longer belong. */
any_templates = FALSE;
@@ -4959,25 +5015,20 @@ update_templates_menu (FMDirectoryView *view)
}
nautilus_directory_list_free (sorted_copy);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_MENU_PATH_NEW_DOCUMENTS_NO_TEMPLATES,
- any_templates);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_NEW_DOCUMENTS_NO_TEMPLATES,
- any_templates);
+ action = gtk_action_group_get_action (view->details->dir_action_group, FM_ACTION_NO_TEMPLATES);
+ gtk_action_set_visible (action, !any_templates);
}
static void
-open_scripts_folder_callback (BonoboUIComponent *component,
- gpointer callback_data,
- const char *verb)
+action_open_scripts_folder_callback (GtkAction *action,
+ gpointer callback_data)
{
FMDirectoryView *view;
view = FM_DIRECTORY_VIEW (callback_data);
- open_location (view, scripts_directory_uri, Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE, 0);
+ open_location (view, scripts_directory_uri, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, 0);
eel_show_info_dialog_with_details
(_("All executable files in this folder will appear in the "
@@ -5001,21 +5052,6 @@ open_scripts_folder_callback (BonoboUIComponent *component,
fm_directory_view_get_containing_window (view));
}
-static BonoboWindow *
-get_bonobo_window (FMDirectoryView *view)
-{
- GtkWidget *window;
-
- /* Note: This works only because we are in the same process
- * as the Nautilus shell. Bonobo components in their own
- * processes can't do this.
- */
- window = gtk_widget_get_ancestor (GTK_WIDGET (view), BONOBO_TYPE_WINDOW);
- g_assert (window != NULL);
-
- return BONOBO_WINDOW (window);
-}
-
static void
popup_menu_hidden (FMDirectoryView *view)
{
@@ -5025,18 +5061,18 @@ popup_menu_hidden (FMDirectoryView *view)
static GtkMenu *
create_popup_menu (FMDirectoryView *view, const char *popup_path)
{
- GtkMenu *menu;
+ GtkWidget *menu;
- menu = GTK_MENU (gtk_menu_new ());
- gtk_menu_set_screen (menu, gtk_widget_get_screen (GTK_WIDGET (view)));
+ menu = gtk_ui_manager_get_widget (nautilus_window_info_get_ui_manager (view->details->window),
+ popup_path);
+ gtk_menu_set_screen (GTK_MENU (menu),
+ gtk_widget_get_screen (GTK_WIDGET (view)));
gtk_widget_show (GTK_WIDGET (menu));
- bonobo_window_add_popup (get_bonobo_window (view), menu, popup_path);
-
g_signal_connect_object (menu, "hide",
G_CALLBACK (popup_menu_hidden), G_OBJECT (view), G_CONNECT_SWAPPED);
-
- return menu;
+
+ return GTK_MENU (menu);
}
typedef struct {
@@ -5192,23 +5228,21 @@ copy_or_cut_files (FMDirectoryView *view,
nautilus_file_list_free (clipboard_contents);
- nautilus_view_report_status (view->details->nautilus_view,
- status_string);
+ nautilus_window_info_set_status (view->details->window,
+ status_string);
g_free (status_string);
}
static void
-copy_files_callback (BonoboUIComponent *component,
- gpointer callback_data,
- const char *verb)
+action_copy_files_callback (GtkAction *action,
+ gpointer callback_data)
{
copy_or_cut_files (callback_data, FALSE);
}
static void
-cut_files_callback (BonoboUIComponent *component,
- gpointer callback_data,
- const char *verb)
+action_cut_files_callback (GtkAction *action,
+ gpointer callback_data)
{
copy_or_cut_files (callback_data, TRUE);
}
@@ -5263,8 +5297,8 @@ paste_clipboard_data (FMDirectoryView *view,
}
if (item_uris == NULL|| destination_uri == NULL) {
- nautilus_view_report_status (view->details->nautilus_view,
- _("There is nothing on the clipboard to paste."));
+ nautilus_window_info_set_status (view->details->window,
+ _("There is nothing on the clipboard to paste."));
} else {
fm_directory_view_move_copy_items (item_uris, NULL, destination_uri,
cut ? GDK_ACTION_MOVE : GDK_ACTION_COPY,
@@ -5317,9 +5351,8 @@ paste_into_clipboard_received_callback (GtkClipboard *clipboard,
}
static void
-paste_files_callback (BonoboUIComponent *component,
- gpointer callback_data,
- const char *verb)
+action_paste_files_callback (GtkAction *action,
+ gpointer callback_data)
{
FMDirectoryView *view;
@@ -5332,9 +5365,8 @@ paste_files_callback (BonoboUIComponent *component,
}
static void
-paste_files_into_callback (BonoboUIComponent *component,
- gpointer callback_data,
- const char *verb)
+action_paste_files_into_callback (GtkAction *action,
+ gpointer callback_data)
{
FMDirectoryView *view;
@@ -5347,7 +5379,8 @@ paste_files_into_callback (BonoboUIComponent *component,
}
static void
-rename_file_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_rename_callback (GtkAction *action,
+ gpointer callback_data)
{
FMDirectoryView *view;
NautilusFile *file;
@@ -5378,9 +5411,8 @@ drive_mounted_callback (gboolean succeeded,
static void
-mount_volume_callback (BonoboUIComponent *component,
- gpointer data,
- const char *verb)
+action_mount_volume_callback (GtkAction *action,
+ gpointer data)
{
NautilusFile *file;
GList *selection;
@@ -5444,9 +5476,8 @@ volume_or_drive_unmounted_callback (gboolean succeeded,
static void
-unmount_volume_callback (BonoboUIComponent *component,
- gpointer data,
- const char *verb)
+action_unmount_volume_callback (GtkAction *action,
+ gpointer data)
{
NautilusFile *file;
GList *selection;
@@ -5529,9 +5560,8 @@ entry_activate_callback (GtkEntry *entry,
}
static void
-connect_to_server_link_callback (BonoboUIComponent *component,
- gpointer data,
- const char *verb)
+action_connect_to_server_link_callback (GtkAction *action,
+ gpointer data)
{
NautilusFile *file;
GList *selection;
@@ -5615,18 +5645,19 @@ connect_to_server_link_callback (BonoboUIComponent *component,
static void
fm_directory_view_init_show_hidden_files (FMDirectoryView *view)
{
- Nautilus_ShowHiddenFilesMode mode;
+ NautilusWindowShowHiddenFilesMode mode;
gboolean show_hidden_changed;
gboolean show_hidden_default_setting;
+ GtkAction *action;
if (view->details->ignore_hidden_file_preferences) {
return;
}
show_hidden_changed = FALSE;
- mode = nautilus_view_get_show_hidden_files_mode (view->details->nautilus_view);
+ mode = nautilus_window_info_get_hidden_files_mode (view->details->window);
- if (mode == Nautilus_SHOW_HIDDEN_FILES_DEFAULT) {
+ if (mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) {
show_hidden_default_setting = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
if (show_hidden_default_setting != view->details->show_hidden_files) {
view->details->show_hidden_files = show_hidden_default_setting;
@@ -5634,7 +5665,7 @@ fm_directory_view_init_show_hidden_files (FMDirectoryView *view)
show_hidden_changed = TRUE;
}
} else {
- if (mode == Nautilus_SHOW_HIDDEN_FILES_ENABLE) {
+ if (mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_ENABLE) {
show_hidden_changed = !view->details->show_hidden_files;
view->details->show_hidden_files = TRUE;
view->details->show_backup_files = TRUE;
@@ -5645,9 +5676,10 @@ fm_directory_view_init_show_hidden_files (FMDirectoryView *view)
}
}
- nautilus_bonobo_set_toggle_state (view->details->ui,
- "/commands/Show Hidden Files",
- view->details->show_hidden_files);
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_SHOW_HIDDEN_FILES);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ view->details->show_hidden_files);
if (show_hidden_changed && (view->details->model != NULL)) {
load_directory (view, view->details->model);
@@ -5655,68 +5687,174 @@ fm_directory_view_init_show_hidden_files (FMDirectoryView *view)
}
+static GtkActionEntry directory_view_entries[] = {
+ { "New Documents", NULL, N_("Create _Document") }, /* name, stock id, label */
+ { "Open With", NULL, N_("Open Wit_h"), /* name, stock id, label */
+ NULL, N_("Choose a program with which to open the selected item") },
+ { "Scripts", NULL, N_("_Scripts"), /* name, stock id, label */
+ NULL, N_("Run or manage scripts from ~/.gnome2/nautilus-scripts") },
+ { "Properties", GTK_STOCK_PROPERTIES, /* name, stock id */
+ N_("_Properties"), "<alt>Return", /* label, accelerator */
+ N_("View or modify the properties of each selected item"), /* tooltip */
+ G_CALLBACK (action_properties_callback) },
+ { "PropertiesAccel", NULL, /* name, stock id */
+ "PropertiesAccel", "<control>I", /* label, accelerator */
+ NULL, /* tooltip */
+ G_CALLBACK (action_properties_callback) },
+ { "New Folder", NULL, /* name, stock id */
+ N_("Create _Folder"), "<control><shift>N", /* label, accelerator */
+ N_("Create a new empty folder inside this folder"), /* tooltip */
+ G_CALLBACK (action_new_folder_callback) },
+ { "No Templates", NULL, N_("No templates Installed") }, /* name, stock id, label */
+ { "New Empty File", NULL, /* name, stock id */
+ N_("_Empty File"), NULL, /* label, accelerator */
+ N_("Create a new empty file inside this folder"), /* tooltip */
+ G_CALLBACK (action_new_empty_file_callback) },
+ { "New Launcher", NULL, /* name, stock id */
+ N_("Create L_auncher"), NULL, /* label, accelerator */
+ N_("Create a new launcher"), /* tooltip */
+ G_CALLBACK (action_new_launcher_callback) },
+ { "Open", GTK_STOCK_OPEN, /* name, stock id */
+ N_("_Open"), "<control>o", /* label, accelerator */
+ N_("Open the selected item in this window"), /* tooltip */
+ G_CALLBACK (action_open_callback) },
+ { "OpenAccel", NULL, /* name, stock id */
+ "OpenAccel", "<alt>Down", /* label, accelerator */
+ NULL, /* tooltip */
+ G_CALLBACK (action_open_callback) },
+ { "OpenAlternate", NULL, /* name, stock id */
+ N_("Open in Navigation Window"), "<control><shift>o", /* label, accelerator */
+ N_("Open each selected item in a navigation window"), /* tooltip */
+ G_CALLBACK (action_open_alternate_callback) },
+ { "OtherApplication1", NULL, /* name, stock id */
+ N_("Open with Other _Application..."), NULL, /* label, accelerator */
+ N_("Choose another application with which to open the selected item"), /* tooltip */
+ G_CALLBACK (action_other_application_callback) },
+ { "OtherApplication2", NULL, /* name, stock id */
+ N_("Open with Other _Application..."), NULL, /* label, accelerator */
+ N_("Choose another application with which to open the selected item"), /* tooltip */
+ G_CALLBACK (action_other_application_callback) },
+ { "Open Scripts Folder", NULL, /* name, stock id */
+ N_("_Open Scripts Folder"), NULL, /* label, accelerator */
+ N_("Show the folder containing the scripts that appear in this menu"), /* tooltip */
+ G_CALLBACK (action_open_scripts_folder_callback) },
+ { "Empty Trash", NULL, /* name, stock id */
+ N_("_Empty Trash"), NULL, /* label, accelerator */
+ N_("Delete all items in the Trash"), /* tooltip */
+ G_CALLBACK (action_empty_trash_callback) },
+ { "Cut", GTK_STOCK_CUT, /* name, stock id */
+ N_("Cu_t Files"), "<control>x", /* label, accelerator */
+ N_("Prepare the selected files to be moved with a Paste Files command"), /* tooltip */
+ G_CALLBACK (action_cut_files_callback) },
+ { "Copy", GTK_STOCK_COPY, /* name, stock id */
+ N_("_Copy Files"), "<control>c", /* label, accelerator */
+ N_("Prepare the selected files to be copied with a Paste Files command"), /* tooltip */
+ G_CALLBACK (action_copy_files_callback) },
+ { "Paste", GTK_STOCK_PASTE, /* name, stock id */
+ N_("_Paste Files"), "<control>v", /* label, accelerator */
+ N_("Move or copy files previously selected by a Cut Files or Copy Files command"), /* tooltip */
+ G_CALLBACK (action_paste_files_callback) },
+ /* We make accelerator "" instead of null here to not inherit the stock
+ accelerator for paste */
+ { "Paste Files Into", GTK_STOCK_PASTE, /* name, stock id */
+ N_("_Paste Files Into Folder"), "", /* label, accelerator */
+ N_("Move or copy files previously selected by a Cut Files or Copy Files command into the selected folder"), /* tooltip */
+ G_CALLBACK (action_paste_files_into_callback) },
+ { "Select All", NULL, /* name, stock id */
+ N_("Select _All Files"), "<control>A", /* label, accelerator */
+ N_("Select all items in this window"), /* tooltip */
+ G_CALLBACK (action_select_all_callback) },
+ { "Select Pattern", NULL, /* name, stock id */
+ N_("Select _Pattern"), "<control>S", /* label, accelerator */
+ N_("Select items in this window matching a given pattern"), /* tooltip */
+ G_CALLBACK (action_select_pattern_callback) },
+ { "Duplicate", NULL, /* name, stock id */
+ N_("D_uplicate"), NULL, /* label, accelerator */
+ N_("Duplicate each selected item"), /* tooltip */
+ G_CALLBACK (action_duplicate_callback) },
+ { "Create Link", NULL, /* name, stock id */
+ N_("Ma_ke Link"), "<control>M", /* label, accelerator */
+ N_("Create a symbolic link for each selected item"), /* tooltip */
+ G_CALLBACK (action_create_link_callback) },
+ { "Rename", NULL, /* name, stock id */
+ N_("_Rename..."), "F2", /* label, accelerator */
+ N_("Rename selected item"), /* tooltip */
+ G_CALLBACK (action_rename_callback) },
+ { "Trash", GTK_STOCK_DELETE, /* name, stock id */
+ N_("Mo_ve to Trash"), "<control>T", /* label, accelerator */
+ N_("Move each selected item to the Trash"), /* 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) },
+ { "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 */
+ G_CALLBACK (action_reset_to_defaults_callback) },
+ { "Reset Background", NULL, /* name, stock id */
+ N_("Use _Default Background"), NULL, /* label, accelerator */
+ N_("Use the default background for this location"), /* tooltip */
+ G_CALLBACK (action_reset_background_callback) },
+ { "Connect To Server Link", NULL, /* name, stock id */
+ N_("Connect To This Server"), NULL, /* label, accelerator */
+ N_("Make a permanent connection to this server"), /* tooltip */
+ G_CALLBACK (action_connect_to_server_link_callback) },
+ { "Mount Volume", NULL, /* name, stock id */
+ N_("_Mount Volume"), NULL, /* label, accelerator */
+ N_("Mount the selected volume"), /* tooltip */
+ G_CALLBACK (action_mount_volume_callback) },
+ { "Unmount Volume", NULL, /* name, stock id */
+ N_("_Unmount Volume"), NULL, /* label, accelerator */
+ N_("Unmount the selected volume"), /* tooltip */
+ G_CALLBACK (action_unmount_volume_callback) },
+ { "OpenCloseParent", NULL, /* name, stock id */
+ N_("Open File and Close window"), "<alt><shift>Down", /* label, accelerator */
+ NULL, /* tooltip */
+ G_CALLBACK (action_open_close_parent_callback) },
+};
+
+static GtkToggleActionEntry directory_view_toggle_entries[] = {
+ { "Show Hidden Files", NULL, /* name, stock id */
+ N_("Show _Hidden Files"), NULL, /* label, accelerator */
+ N_("Toggles the display of hidden files in the current window"), /* tooltip */
+ G_CALLBACK (action_show_hidden_files_callback),
+ TRUE },
+};
+
static void
real_merge_menus (FMDirectoryView *view)
{
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("Rename", rename_file_callback),
- BONOBO_UI_VERB ("Copy Files", copy_files_callback),
- BONOBO_UI_VERB ("Create Link", create_link_callback),
- BONOBO_UI_VERB ("Cut Files", cut_files_callback),
- BONOBO_UI_VERB ("Delete", delete_callback),
- BONOBO_UI_VERB ("Duplicate", duplicate_callback),
- BONOBO_UI_VERB ("Empty Trash", bonobo_menu_empty_trash_callback),
- BONOBO_UI_VERB ("New Folder", new_folder_callback),
- BONOBO_UI_VERB ("New Empty File", new_empty_file_callback),
- BONOBO_UI_VERB ("New Launcher", new_launcher_callback),
- BONOBO_UI_VERB ("Open Scripts Folder", open_scripts_folder_callback),
- BONOBO_UI_VERB ("Open", open_callback),
- BONOBO_UI_VERB ("OpenCloseParent", open_close_parent_callback),
- BONOBO_UI_VERB ("OpenAlternate", open_alternate_callback),
- BONOBO_UI_VERB ("OtherApplication", other_application_callback),
- BONOBO_UI_VERB ("Edit Launcher", edit_launcher_callback),
- BONOBO_UI_VERB ("Paste Files", paste_files_callback),
- BONOBO_UI_VERB ("Paste Files Into", paste_files_into_callback),
- BONOBO_UI_VERB ("Reset Background", reset_background_callback),
- BONOBO_UI_VERB ("Reset to Defaults", reset_to_defaults_callback),
- BONOBO_UI_VERB ("Select All", bonobo_menu_select_all_callback),
- BONOBO_UI_VERB ("Select Pattern", bonobo_menu_select_pattern_callback),
- BONOBO_UI_VERB ("Properties", open_properties_window_callback),
- BONOBO_UI_VERB ("Trash", trash_callback),
- BONOBO_UI_VERB ("Mount Volume Conditional", mount_volume_callback),
- BONOBO_UI_VERB ("Unmount Volume Conditional", unmount_volume_callback),
- BONOBO_UI_VERB ("Connect To Server Link Conditional", connect_to_server_link_callback),
- BONOBO_UI_VERB_END
- };
-
- view->details->ui = nautilus_view_set_up_ui (view->details->nautilus_view,
- DATADIR,
- "nautilus-directory-view-ui.xml",
- "nautilus");
- eel_add_weak_pointer (&view->details->ui);
-
- bonobo_ui_component_add_verb_list_with_data (view->details->ui, verbs, view);
-
- bonobo_ui_component_add_listener
- (view->details->ui,
- "Show Hidden Files",
- show_hidden_files_toggle_callback,
- view);
-
- nautilus_bonobo_set_toggle_state (view->details->ui,
- "/commands/Show Hidden Files",
- view->details->show_hidden_files);
-
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+ GtkAction *action;
+ const char *ui;
+
+ ui_manager = nautilus_window_info_get_ui_manager (view->details->window);
+
+ action_group = gtk_action_group_new ("DirViewActions");
+ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+ view->details->dir_action_group = action_group;
+ gtk_action_group_add_actions (action_group,
+ directory_view_entries, G_N_ELEMENTS (directory_view_entries),
+ view);
+ gtk_action_group_add_toggle_actions (action_group,
+ directory_view_toggle_entries, G_N_ELEMENTS (directory_view_toggle_entries),
+ view);
+
+ action = gtk_action_group_get_action (action_group, FM_ACTION_NO_TEMPLATES);
+ gtk_action_set_sensitive (action, FALSE);
+
+ /* Insert action group at end so clipboard action group ends up before it */
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, -1);
+ g_object_unref (action_group); /* owned by ui manager */
+
+ ui = nautilus_ui_string_get ("nautilus-directory-view-ui.xml");
+ view->details->dir_merge_id = gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
g_signal_connect_object (fm_directory_view_get_background (view), "settings_changed",
G_CALLBACK (schedule_update_menus), G_OBJECT (view),
G_CONNECT_SWAPPED);
-
- /* Do one-time state changes here; context-dependent ones go in update_menus */
- if (!fm_directory_view_supports_zooming (view)) {
- nautilus_bonobo_set_hidden
- (view->details->ui, NAUTILUS_POPUP_PATH_ZOOM_ITEMS_PLACEHOLDER, TRUE);
- }
-
+
view->details->scripts_invalid = TRUE;
view->details->templates_invalid = TRUE;
}
@@ -5731,7 +5869,10 @@ clipboard_targets_received (GtkClipboard *clipboard,
GdkAtom *targets;
int n_targets;
int i;
-
+ GList *selection;
+ int count;
+ GtkAction *action;
+
view = FM_DIRECTORY_VIEW (user_data);
can_paste = FALSE;
@@ -5744,36 +5885,44 @@ clipboard_targets_received (GtkClipboard *clipboard,
g_free (targets);
}
+
+
+ selection = fm_directory_view_get_selection (view);
+ count = g_list_length (selection);
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_PASTE);
+ gtk_action_set_sensitive (action,
+ can_paste && !fm_directory_view_is_read_only (view));
- if (view->details->ui != NULL) {
- GList *selection;
- int count;
-
- selection = fm_directory_view_get_selection (view);
- count = g_list_length (selection);
-
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_PASTE_FILES,
- can_paste && !fm_directory_view_is_read_only (view));
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_PASTE_FILES_INTO,
- can_paste && count == 1 && nautilus_file_is_directory (NAUTILUS_FILE (selection->data)) && nautilus_file_can_write (NAUTILUS_FILE (selection->data)));
-
- nautilus_file_list_free (selection);
- }
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_PASTE_FILES_INTO);
+ gtk_action_set_sensitive (action,
+ can_paste && count == 1 &&
+ nautilus_file_is_directory (NAUTILUS_FILE (selection->data)) &&
+ nautilus_file_can_write (NAUTILUS_FILE (selection->data)));
+
+ nautilus_file_list_free (selection);
+
g_object_unref (view);
}
static gboolean
showing_trash_directory (FMDirectoryView *view)
{
- return nautilus_file_is_in_trash (fm_directory_view_get_directory_as_file (view));
+ NautilusFile *file;
+
+ file = fm_directory_view_get_directory_as_file (view);
+ if (file != NULL) {
+ return nautilus_file_is_in_trash (file);
+ }
+ return FALSE;
}
static gboolean
should_show_empty_trash (FMDirectoryView *view)
{
- return (showing_trash_directory (view) || nautilus_view_get_window_type (view->details->nautilus_view) == Nautilus_WINDOW_NAVIGATION);
+ return (showing_trash_directory (view) || nautilus_window_info_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION);
}
static gboolean
@@ -5835,21 +5984,16 @@ real_update_menus_volumes (FMDirectoryView *view,
NautilusFile *file;
gboolean show_mount;
gboolean show_unmount;
- gboolean show_properties;
- gboolean show_format;
- gboolean show_protect;
gboolean unmount_is_eject;
gboolean show_connect;
GnomeVFSVolume *volume;
GnomeVFSDrive *drive;
+ GtkAction *action;
char *uri;
show_mount = FALSE;
show_unmount = FALSE;
unmount_is_eject = FALSE;
- show_properties = FALSE;
- show_format = FALSE;
- show_protect = FALSE;
show_connect = FALSE;
if (selection_count == 1) {
@@ -5884,31 +6028,24 @@ real_update_menus_volumes (FMDirectoryView *view,
}
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_CONNECT_TO_SERVER_LINK_CONDITIONAL,
- !show_connect);
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_CONNECT_TO_SERVER_LINK);
+ gtk_action_set_visible (action, show_connect);
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_MOUNT_VOLUME);
+ gtk_action_set_visible (action, show_mount);
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_UNMOUNT_VOLUME);
+ gtk_action_set_visible (action, show_unmount);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_MOUNT_VOLUME_CONDITIONAL,
- !show_mount);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_UNMOUNT_VOLUME_CONDITIONAL,
- !show_unmount);
if (show_unmount) {
- nautilus_bonobo_set_label (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_UNMOUNT_VOLUME_CONDITIONAL,
- unmount_is_eject? _("E_ject"):_("_Unmount Volume"));
+ g_object_set (action, "label",
+ unmount_is_eject? _("E_ject"):_("_Unmount Volume"),
+ NULL);
}
-
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_PROTECT_VOLUME_CONDITIONAL,
- !show_protect);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_FORMAT_VOLUME_CONDITIONAL,
- !show_format);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_MEDIA_PROPERTIES_VOLUME_CONDITIONAL,
- !show_properties);
+
}
static void
@@ -5919,6 +6056,7 @@ real_update_paste_menu (FMDirectoryView *view,
gboolean can_paste_files_into;
gboolean selection_is_read_only;
gboolean is_read_only;
+ GtkAction *action;
selection_is_read_only = selection_count == 1
&& !nautilus_file_can_write (NAUTILUS_FILE (selection->data));
@@ -5927,16 +6065,15 @@ real_update_paste_menu (FMDirectoryView *view,
can_paste_files_into = selection_count == 1 &&
nautilus_file_is_directory (NAUTILUS_FILE (selection->data));
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_PASTE);
+ gtk_action_set_sensitive (action, !is_read_only);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_PASTE_FILES_INTO,
- !can_paste_files_into);
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_PASTE_FILES_INTO,
- !selection_is_read_only);
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_PASTE_FILES,
- is_read_only);
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_PASTE_FILES_INTO);
+ gtk_action_set_visible (action, can_paste_files_into);
+ gtk_action_set_sensitive (action, !selection_is_read_only);
if (!selection_is_read_only || !is_read_only) {
/* Ask the clipboard */
g_object_ref (view); /* Need to keep the object alive until we get the reply */
@@ -5953,17 +6090,10 @@ clipboard_changed_callback (NautilusClipboardMonitor *monitor, FMDirectoryView *
GList *selection;
gint selection_count;
- if (view->details->ui == NULL) {
- return;
- }
selection = fm_directory_view_get_selection (view);
selection_count = g_list_length (selection);
- bonobo_ui_component_freeze (view->details->ui, NULL);
-
real_update_paste_menu (view, selection, selection_count);
-
- bonobo_ui_component_thaw (view->details->ui, NULL);
nautilus_file_list_free (selection);
@@ -5974,7 +6104,7 @@ real_update_menus (FMDirectoryView *view)
{
GList *selection;
gint selection_count;
- const char *tip, *accelerator, *label;
+ const char *tip, *label;
char *label_with_underscore;
gboolean selection_contains_special_link;
gboolean is_read_only;
@@ -5987,13 +6117,10 @@ real_update_menus (FMDirectoryView *view)
gboolean vfolder_directory;
gboolean show_open_alternate;
gboolean can_open;
- ActivationAction action;
+ ActivationAction activation_action;
EelBackground *background;
+ GtkAction *action;
- if (view->details->ui == NULL) {
- return;
- }
-
selection = fm_directory_view_get_selection (view);
selection_count = g_list_length (selection);
@@ -6012,20 +6139,19 @@ real_update_menus (FMDirectoryView *view)
vfolder_directory = we_are_in_vfolder_desktop_dir (view);
- bonobo_ui_component_freeze (view->details->ui, NULL);
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_RENAME);
+ gtk_action_set_sensitive (action,
+ selection_count == 1 &&
+ fm_directory_view_can_rename_file (view, selection->data));
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_RENAME,
- selection_count == 1 &&
- fm_directory_view_can_rename_file (view, selection->data));
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_NEW_FOLDER);
+ gtk_action_set_sensitive (action, can_create_files);
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_NEW_FOLDER,
- can_create_files);
-
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_OPEN,
- selection_count != 0);
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_OPEN);
+ gtk_action_set_sensitive (action, selection_count != 0);
label_with_underscore = NULL;
can_open = TRUE;
@@ -6034,13 +6160,13 @@ real_update_menus (FMDirectoryView *view)
file = NAUTILUS_FILE (selection->data);
- action = get_activation_action (file);
+ activation_action = get_activation_action (file);
/* Only use the default app for open if there is not
a mime mismatch, otherwise we can't use it in the
open with menu */
- if (action == ACTIVATION_ACTION_OPEN_IN_APPLICATION &&
- activate_check_mime_types (view, file, FALSE)) {
+ if (activation_action == ACTIVATION_ACTION_OPEN_IN_APPLICATION &&
+ can_show_default_app (view, file)) {
GnomeVFSMimeApplication *app;
app = nautilus_mime_get_default_application_for_file (file);
@@ -6053,184 +6179,155 @@ real_update_menus (FMDirectoryView *view)
}
}
}
+
+ g_object_set (action, "label",
+ label_with_underscore ? label_with_underscore : _("_Open"),
+ NULL);
+ gtk_action_set_visible (action, can_open);
- nautilus_bonobo_set_label
- (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_OPEN,
- label_with_underscore ? label_with_underscore : _("_Open"));
- nautilus_bonobo_set_hidden
- (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_OPEN,
- !can_open);
g_free (label_with_underscore);
- if (nautilus_view_get_window_type (view->details->nautilus_view) == Nautilus_WINDOW_NAVIGATION) {
- show_open_alternate = TRUE;
- label_with_underscore = g_strdup_printf (ngettext("Open in New Window",
- "Open in %d New Windows",
- selection_count),
- selection_count);
+ show_open_alternate = file_list_all_are_folders (selection);
+ if (nautilus_window_info_get_window_type (view->details->window) == NAUTILUS_WINDOW_NAVIGATION) {
+ if (selection_count == 0) {
+ label_with_underscore = g_strdup (_("Open in New Window"));
+ } else {
+ label_with_underscore = g_strdup_printf (ngettext("Open in New Window",
+ "Open in %d New Windows",
+ selection_count),
+ selection_count);
+ }
} else {
- show_open_alternate = file_list_all_are_folders (selection);
if (selection_count <= 1) {
label_with_underscore = g_strdup (_("Browse Folder"));
} else {
label_with_underscore = g_strdup_printf (_("Browse Folders"));
}
}
-
- nautilus_bonobo_set_label
- (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_OPEN_ALTERNATE,
- label_with_underscore);
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_OPEN_ALTERNATE);
+ g_object_set (action, "label",
+ label_with_underscore,
+ NULL);
g_free (label_with_underscore);
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_OPEN_ALTERNATE,
- selection_count != 0);
-
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_OPEN_ALTERNATE,
- !show_open_alternate);
+ gtk_action_set_sensitive (action, selection_count != 0);
+ gtk_action_set_visible (action, show_open_alternate);
/* Broken into its own function just for convenience */
- reset_bonobo_open_with_menu (view, selection);
+ reset_open_with_menu (view, selection);
reset_extension_actions_menu (view, selection);
if (all_selected_items_in_trash (view)) {
label = _("_Delete from Trash");
- accelerator = "*ctl*t";
tip = _("Delete all selected items permanently");
show_separate_delete_command = FALSE;
} else {
label = _("Mo_ve to Trash");
- accelerator = "*ctl*t";
tip = _("Move each selected item to the Trash");
show_separate_delete_command = show_delete_command_auto_value;
}
- nautilus_bonobo_set_label
- (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_TRASH,
- label);
- nautilus_bonobo_set_accelerator (view->details->ui,
- FM_DIRECTORY_VIEW_MENU_PATH_TRASH,
- accelerator);
- nautilus_bonobo_set_tip (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_TRASH,
- tip);
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_TRASH,
- can_delete_files);
-
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_DELETE,
- !show_separate_delete_command);
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_TRASH);
+ g_object_set (action,
+ "label", label,
+ "tooltip", tip,
+ NULL);
+ 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);
+
if (show_separate_delete_command) {
- nautilus_bonobo_set_label
- (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_DELETE, _("_Delete"));
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_DELETE,
- can_delete_files);
+ g_object_set (action,
+ "label", _("_Delete"),
+ NULL);
+ gtk_action_set_sensitive (action, can_delete_files);
}
-
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_DUPLICATE,
- can_duplicate_files);
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_DUPLICATE);
+ gtk_action_set_sensitive (action, can_duplicate_files);
background = fm_directory_view_get_background (view);
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_RESET_BACKGROUND,
- background != NULL
- && nautilus_file_background_is_set (background));
-
- nautilus_bonobo_set_label
- (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_CREATE_LINK,
- selection_count > 1
- ? _("Ma_ke Links")
- : _("Ma_ke Link"));
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_CREATE_LINK,
- can_link_files);
-
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_PROPERTIES,
- selection_count != 0
- && fm_directory_view_supports_properties (view));
-
- nautilus_bonobo_set_label
- (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_EMPTY_TRASH,
- _("_Empty Trash"));
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_EMPTY_TRASH,
- !nautilus_trash_monitor_is_empty ());
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_EMPTY_TRASH,
- !should_show_empty_trash (view));
-
- nautilus_bonobo_set_sensitive (view->details->ui,
- NAUTILUS_COMMAND_SELECT_ALL,
- !fm_directory_view_is_empty (view));
-
- nautilus_bonobo_set_label
- (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_CUT_FILES,
- selection_count == 1
- ? _("Cu_t File")
- : _("Cu_t Files"));
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_CUT_FILES,
- can_delete_files);
-
- nautilus_bonobo_set_label
- (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_COPY_FILES,
- selection_count == 1
- ? _("_Copy File")
- : _("_Copy Files"));
-
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_COPY_FILES,
- can_copy_files);
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_RESET_BACKGROUND);
+ gtk_action_set_sensitive (action,
+ background != NULL &&
+ nautilus_file_background_is_set (background));
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_CREATE_LINK);
+ gtk_action_set_sensitive (action, can_link_files);
+ g_object_set (action, "label",
+ selection_count > 1
+ ? _("Ma_ke Links")
+ : _("Ma_ke Link"),
+ NULL);
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_PROPERTIES);
+ gtk_action_set_sensitive (action,
+ selection_count != 0 &&
+ fm_directory_view_supports_properties (view));
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_PROPERTIES_ACCEL);
+ gtk_action_set_sensitive (action,
+ selection_count != 0 &&
+ fm_directory_view_supports_properties (view));
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_EMPTY_TRASH);
+ g_object_set (action,
+ "label", _("_Empty Trash"),
+ NULL);
+ gtk_action_set_sensitive (action, !nautilus_trash_monitor_is_empty ());
+ gtk_action_set_visible (action, should_show_empty_trash (view));
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_SELECT_ALL);
+ gtk_action_set_sensitive (action, !fm_directory_view_is_empty (view));
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_CUT);
+ g_object_set (action, "label",
+ selection_count == 1
+ ? _("Cu_t File")
+ : _("Cu_t Files"),
+ NULL);
+ gtk_action_set_sensitive (action, can_delete_files);
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_COPY);
+ g_object_set (action, "label",
+ selection_count == 1
+ ? _("_Copy File")
+ : _("_Copy Files"),
+ NULL);
+ gtk_action_set_sensitive (action, can_copy_files);
real_update_paste_menu (view, selection, selection_count);
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_NEW_LAUNCHER,
- ! vfolder_directory);
-
- nautilus_bonobo_set_hidden (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_EDIT_LAUNCHER,
- ! vfolder_directory);
-
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_NEW_LAUNCHER,
- can_create_files);
-
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_COMMAND_EDIT_LAUNCHER,
- selection_count == 1);
-
-
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_NEW_LAUNCHER);
+ gtk_action_set_visible (action, vfolder_directory);
+ gtk_action_set_sensitive (action, can_create_files);
real_update_menus_volumes (view, selection, selection_count);
-
- bonobo_ui_component_thaw (view->details->ui, NULL);
nautilus_file_list_free (selection);
if (view->details->scripts_invalid) {
update_scripts_menu (view);
}
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_MENU_PATH_NEW_DOCUMENTS,
- can_create_files);
- nautilus_bonobo_set_sensitive (view->details->ui,
- FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND_NEW_DOCUMENTS,
- can_create_files);
+
+ action = gtk_action_group_get_action (view->details->dir_action_group,
+ FM_ACTION_NEW_DOCUMENTS);
+ gtk_action_set_sensitive (action, can_create_files);
+
if (can_create_files && view->details->templates_invalid) {
update_templates_menu (view);
}
@@ -6297,12 +6394,11 @@ schedule_update_menus (FMDirectoryView *view)
g_assert (FM_IS_DIRECTORY_VIEW (view));
/* Make sure we haven't already destroyed it */
- g_assert (view->details->nautilus_view != NULL);
+ /*g_assert (view->details->window != NULL);*/
view->details->menu_states_untrustworthy = TRUE;
- if (view->details->menus_merged
- && view->details->update_menus_timeout_id == 0) {
+ if (view->details->update_menus_timeout_id == 0) {
view->details->update_menus_timeout_id
= g_timeout_add (300, update_menus_timeout_callback, view);
}
@@ -6334,7 +6430,7 @@ schedule_update_status (FMDirectoryView *view)
g_assert (FM_IS_DIRECTORY_VIEW (view));
/* Make sure we haven't already destroyed it */
- g_assert (view->details->nautilus_view != NULL);
+ g_assert (view->details->window != NULL);
if (view->details->loading) {
/* Don't update status bar while loading the dir */
@@ -6573,9 +6669,9 @@ activate_callback (NautilusFile *file, gpointer callback_data)
nautilus_launch_show_file
(file, fm_directory_view_get_containing_window (view));
- if ((parameters->flags & Nautilus_ViewFrame_OPEN_FLAG_CLOSE_BEHIND) != 0) {
- if (nautilus_view_get_window_type (view->details->nautilus_view) == Nautilus_WINDOW_SPATIAL) {
- nautilus_view_close_window (view->details->nautilus_view);
+ if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0) {
+ if (nautilus_window_info_get_window_type (view->details->window) == NAUTILUS_WINDOW_SPATIAL) {
+ nautilus_window_info_close (view->details->window);
}
}
@@ -6723,8 +6819,8 @@ cancel_activate_callback (gpointer callback_data)
static void
fm_directory_view_activate_file (FMDirectoryView *view,
NautilusFile *file,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags)
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags)
{
ActivateParameters *parameters;
NautilusFileAttributes attributes;
@@ -6788,8 +6884,8 @@ fm_directory_view_activate_file (FMDirectoryView *view,
void
fm_directory_view_activate_files (FMDirectoryView *view,
GList *files,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags)
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags)
{
GList *node;
int file_count;
@@ -6806,10 +6902,10 @@ fm_directory_view_activate_files (FMDirectoryView *view,
file_count = g_list_length (files);
use_new_window = file_count > 1;
- if (use_new_window && mode == Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE) {
+ if (use_new_window && mode == NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE) {
#if !NEW_UI_COMPLETE
/* Match the current window type */
- mode = Nautilus_ViewFrame_OPEN_IN_SPATIAL;
+ mode = NAUTILUS_WINDOW_OPEN_IN_SPATIAL;
#endif
}
@@ -6917,7 +7013,8 @@ finish_loading (FMDirectoryView *view)
{
NautilusFileAttributes attributes;
- nautilus_view_report_load_underway (view->details->nautilus_view);
+ nautilus_window_info_report_load_underway (view->details->window,
+ NAUTILUS_VIEW (view));
/* Tell interested parties that we've begun loading this directory now.
* Subclasses use this to know that the new metadata is now available.
@@ -7054,11 +7151,6 @@ fm_directory_view_merge_menus (FMDirectoryView *view)
{
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
- /* Remember that the menus have been merged so that we
- * won't try to update them before merging them.
- */
- view->details->menus_merged = TRUE;
-
EEL_CALL_METHOD
(FM_DIRECTORY_VIEW_CLASS, view,
merge_menus, (view));
@@ -7117,17 +7209,17 @@ disconnect_model_handlers (FMDirectoryView *view)
void
fm_directory_view_reset_to_defaults (FMDirectoryView *view)
{
- Nautilus_ShowHiddenFilesMode mode;
+ NautilusWindowShowHiddenFilesMode mode;
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
EEL_CALL_METHOD
(FM_DIRECTORY_VIEW_CLASS, view,
reset_to_defaults, (view));
- mode = nautilus_view_get_show_hidden_files_mode (view->details->nautilus_view);
- if (mode != Nautilus_SHOW_HIDDEN_FILES_DEFAULT) {
- nautilus_view_set_show_hidden_files_mode (view->details->nautilus_view,
- Nautilus_SHOW_HIDDEN_FILES_DEFAULT);
+ mode = nautilus_window_info_get_hidden_files_mode (view->details->window);
+ if (mode != NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) {
+ nautilus_window_info_set_hidden_files_mode (view->details->window,
+ NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT);
fm_directory_view_init_show_hidden_files (view);
}
}
@@ -7271,7 +7363,13 @@ fm_directory_view_is_empty (FMDirectoryView *view)
static gboolean
real_is_read_only (FMDirectoryView *view)
{
- return !nautilus_file_can_write (fm_directory_view_get_directory_as_file (view));
+ NautilusFile *file;
+
+ file = fm_directory_view_get_directory_as_file (view);
+ if (file != NULL) {
+ return !nautilus_file_can_write (file);
+ }
+ return FALSE;
}
gboolean
@@ -7347,10 +7445,6 @@ fm_directory_view_supports_zooming (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
- if (!view->details->zoomable) {
- return FALSE;
- }
-
return EEL_CALL_METHOD_WITH_RETURN_VALUE
(FM_DIRECTORY_VIEW_CLASS, view,
supports_zooming, (view));
@@ -7393,20 +7487,23 @@ filtering_changed_callback (gpointer callback_data)
{
FMDirectoryView *directory_view;
gboolean new_show_hidden;
- Nautilus_ShowHiddenFilesMode mode;
+ NautilusWindowShowHiddenFilesMode mode;
+ GtkAction *action;
directory_view = FM_DIRECTORY_VIEW (callback_data);
new_show_hidden = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
- mode = nautilus_view_get_show_hidden_files_mode (directory_view->details->nautilus_view);
+ mode = nautilus_window_info_get_hidden_files_mode (directory_view->details->window);
/* only apply global show hidden files pref if local setting has not been set for this window */
if (new_show_hidden != directory_view->details->show_hidden_files
- && mode == Nautilus_SHOW_HIDDEN_FILES_DEFAULT) {
+ && mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) {
directory_view->details->show_hidden_files = new_show_hidden;
directory_view->details->show_backup_files = new_show_hidden;
- nautilus_bonobo_set_toggle_state (directory_view->details->ui,
- "/commands/Show Hidden Files",
- directory_view->details->show_hidden_files);
+
+ action = gtk_action_group_get_action (directory_view->details->dir_action_group,
+ FM_ACTION_SHOW_HIDDEN_FILES);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ directory_view->details->show_hidden_files);
/* Reload the current uri so that the filtering changes take place. */
if (directory_view->details->model != NULL) {
@@ -7620,15 +7717,40 @@ real_get_selected_icon_locations (FMDirectoryView *view)
}
static void
+fm_directory_view_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ FMDirectoryView *directory_view;
+
+ directory_view = FM_DIRECTORY_VIEW (object);
+
+ switch (prop_id) {
+ case PROP_WINDOW:
+ g_assert (directory_view->details->window == NULL);
+ fm_directory_view_set_parent_window (directory_view, NAUTILUS_WINDOW_INFO (g_value_get_object (value)));
+
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
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);
G_OBJECT_CLASS (klass)->finalize = fm_directory_view_finalize;
+ G_OBJECT_CLASS (klass)->set_property = fm_directory_view_set_property;
+
GTK_OBJECT_CLASS (klass)->destroy = fm_directory_view_destroy;
/* Get rid of the strange 3-pixel gap that GtkScrolledWindow
@@ -7749,7 +7871,47 @@ fm_directory_view_class_init (FMDirectoryViewClass *klass)
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, select_all);
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, set_selection);
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, zoom_to_level);
+ EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, get_zoom_level);
copied_files_atom = gdk_atom_intern ("x-special/gnome-copied-files", FALSE);
utf8_string_atom = gdk_atom_intern ("UTF8_STRING", FALSE);
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass),
+ PROP_WINDOW,
+ g_param_spec_object ("window",
+ "Window",
+ "The parent NautilusWindowInfo reference",
+ NAUTILUS_TYPE_WINDOW_INFO,
+ 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 6f138e9bb..0623109e9 100644
--- a/src/file-manager/fm-directory-view.h
+++ b/src/file-manager/fm-directory-view.h
@@ -38,15 +38,12 @@
#include <libnautilus-private/nautilus-icon-container.h>
#include <libnautilus-private/nautilus-link.h>
#include <eel/eel-string-list.h>
-#include <libnautilus/nautilus-view.h>
+#include <libnautilus-private/nautilus-view.h>
+#include <libnautilus-private/nautilus-window-info.h>
typedef struct FMDirectoryView FMDirectoryView;
typedef struct FMDirectoryViewClass FMDirectoryViewClass;
-
-/* Bonobo command paths that are used by subclasses. Others are defined in fm-directory-view.c */
-#define FM_DIRECTORY_VIEW_COMMAND_RESET_BACKGROUND "/commands/Reset Background"
-
#define FM_TYPE_DIRECTORY_VIEW (fm_directory_view_get_type ())
#define FM_DIRECTORY_VIEW(obj) (GTK_CHECK_CAST ((obj), FM_TYPE_DIRECTORY_VIEW, FMDirectoryView))
#define FM_DIRECTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), FM_TYPE_DIRECTORY_VIEW, FMDirectoryViewClass))
@@ -162,9 +159,11 @@ struct FMDirectoryViewClass {
/* zoom_to_level is a function pointer that subclasses must override
* to set the zoom level of an object to the specified level. */
void (* zoom_to_level) (FMDirectoryView *view,
- gint level);
+ NautilusZoomLevel level);
+
+ NautilusZoomLevel (* get_zoom_level) (FMDirectoryView *view);
- /* restore_default_zoom_level is a function pointer that subclasses must override
+ /* restore_default_zoom_level is a function pointer that subclasses must override
* to restore the zoom level of an object to a default setting. */
void (* restore_default_zoom_level) (FMDirectoryView *view);
@@ -284,15 +283,17 @@ 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 */
GType fm_directory_view_get_type (void);
-/* Component embedding support */
-NautilusView * fm_directory_view_get_nautilus_view (FMDirectoryView *view);
-
/* Functions callable from the user interface and elsewhere. */
+NautilusWindowInfo *fm_directory_view_get_nautilus_window (FMDirectoryView *view);
char * fm_directory_view_get_uri (FMDirectoryView *view);
char * fm_directory_view_get_backing_uri (FMDirectoryView *view);
gboolean fm_directory_view_can_accept_item (NautilusFile *target_item,
@@ -308,9 +309,8 @@ GtkWidget * fm_directory_view_get_background_widget (FMDirect
void fm_directory_view_bump_zoom_level (FMDirectoryView *view,
int zoom_increment);
void fm_directory_view_zoom_to_level (FMDirectoryView *view,
- int zoom_level);
-void fm_directory_view_set_zoom_level (FMDirectoryView *view,
- int zoom_level);
+ NautilusZoomLevel zoom_level);
+NautilusZoomLevel fm_directory_view_get_zoom_level (FMDirectoryView *view);
void fm_directory_view_restore_default_zoom_level (FMDirectoryView *view);
void fm_directory_view_reset_to_defaults (FMDirectoryView *view);
void fm_directory_view_select_all (FMDirectoryView *view);
@@ -347,8 +347,8 @@ void fm_directory_view_end_loading (FMDirect
*/
void fm_directory_view_activate_files (FMDirectoryView *view,
GList *files,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags);
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags);
void fm_directory_view_start_batching_selection_changes (FMDirectoryView *view);
void fm_directory_view_stop_batching_selection_changes (FMDirectoryView *view);
gboolean fm_directory_view_confirm_multiple_windows (FMDirectoryView *view,
@@ -356,8 +356,7 @@ gboolean fm_directory_view_confirm_multiple_windows (FMDirect
void fm_directory_view_queue_file_change (FMDirectoryView *view,
NautilusFile *file);
void fm_directory_view_notify_selection_changed (FMDirectoryView *view);
-Bonobo_UIContainer fm_directory_view_get_bonobo_ui_container (FMDirectoryView *view);
-BonoboControl * fm_directory_view_get_bonobo_control (FMDirectoryView *view);
+GtkUIManager * fm_directory_view_get_ui_manager (FMDirectoryView *view);
EelStringList * fm_directory_view_get_emblem_names_to_exclude (FMDirectoryView *view);
NautilusDirectory *fm_directory_view_get_model (FMDirectoryView *view);
GtkWindow *fm_directory_view_get_containing_window (FMDirectoryView *view);
@@ -376,5 +375,6 @@ void fm_directory_view_new_folder (FMDirect
void fm_directory_view_new_file (FMDirectoryView *view,
NautilusFile *source);
void fm_directory_view_ignore_hidden_file_preferences (FMDirectoryView *view);
+void fm_directory_view_init_view_iface (NautilusViewIface *iface);
#endif /* FM_DIRECTORY_VIEW_H */
diff --git a/src/file-manager/fm-ditem-page.c b/src/file-manager/fm-ditem-page.c
index b339b619b..dcc3aa298 100644
--- a/src/file-manager/fm-ditem-page.c
+++ b/src/file-manager/fm-ditem-page.c
@@ -21,9 +21,6 @@
*
*/
-/* This object exports the bonobo context menus and property pages
- * using the new extension interface. */
-
#include <config.h>
#include "fm-ditem-page.h"
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index 96a8bfa4b..b4b681f94 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -25,11 +25,11 @@
#include <config.h>
#include "fm-icon-view.h"
+#include "fm-actions.h"
#include "fm-icon-container.h"
#include "fm-desktop-icon-view.h"
#include "fm-error-reporting.h"
#include <stdlib.h>
-#include <bonobo/bonobo-ui-util.h>
#include <eel/eel-background.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-extensions.h>
@@ -43,6 +43,7 @@
#include <gtk/gtkmenu.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkradiomenuitem.h>
+#include <gtk/gtkradioaction.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkwindow.h>
#include <libgnome/gnome-i18n.h>
@@ -56,11 +57,11 @@
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-xfer.h>
#include <libnautilus-private/nautilus-audio-player.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
#include <libnautilus-private/nautilus-directory-background.h>
#include <libnautilus-private/nautilus-directory.h>
#include <libnautilus-private/nautilus-dnd.h>
#include <libnautilus-private/nautilus-file-utilities.h>
+#include <libnautilus-private/nautilus-ui-utilities.h>
#include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-icon-container.h>
#include <libnautilus-private/nautilus-icon-dnd.h>
@@ -68,9 +69,8 @@
#include <libnautilus-private/nautilus-link.h>
#include <libnautilus-private/nautilus-metadata.h>
#include <libnautilus-private/nautilus-sound.h>
-#include <libnautilus/nautilus-bonobo-ui.h>
-#include <libnautilus/nautilus-clipboard.h>
-#include <libnautilus/nautilus-scroll-positionable.h>
+#include <libnautilus-private/nautilus-view-factory.h>
+#include <libnautilus-private/nautilus-clipboard.h>
#include <locale.h>
#include <signal.h>
#include <stdio.h>
@@ -81,36 +81,12 @@
#define USE_OLD_AUDIO_PREVIEW 1
#define READ_CHUNK_SIZE 16384
-/* Paths to use when creating & referring to Bonobo menu items */
-#define MENU_PATH_STRETCH_ICON "/menu/Edit/Edit Items Placeholder/Stretch"
-#define MENU_PATH_UNSTRETCH_ICONS "/menu/Edit/Edit Items Placeholder/Unstretch"
-#define MENU_PATH_LAY_OUT "/menu/View/View Items Placeholder/Arrange Items"
-#define MENU_PATH_MANUAL_LAYOUT "/menu/View/View Items Placeholder/Arrange Items/Manual Layout"
-#define MENU_PATH_TIGHTER_LAYOUT "/menu/View/View Items Placeholder/Arrange Items/Tighter Layout"
-#define MENU_PATH_SORT_REVERSED "/menu/View/View Items Placeholder/Arrange Items/Reversed Order"
-#define MENU_PATH_CLEAN_UP "/menu/View/View Items Placeholder/Clean Up"
-
-#define POPUP_PATH_LAY_OUT "/popups/background/Before Zoom Items/View Items/Arrange Items"
-
-#define POPUP_PATH_ICON_APPEARANCE "/popups/selection/Icon Appearance Items"
-
-#define COMMAND_PREFIX "/commands/"
-#define COMMAND_STRETCH_ICON "/commands/Stretch"
-#define COMMAND_UNSTRETCH_ICONS "/commands/Unstretch"
-#define COMMAND_TIGHTER_LAYOUT "/commands/Tighter Layout"
-#define COMMAND_SORT_REVERSED "/commands/Reversed Order"
-#define COMMAND_CLEAN_UP "/commands/Clean Up"
-#define COMMAND_KEEP_ALIGNED "/commands/Keep Aligned"
-
-#define ID_MANUAL_LAYOUT "Manual Layout"
-#define ID_TIGHTER_LAYOUT "Tighter Layout"
-#define ID_SORT_REVERSED "Reversed Order"
-#define ID_KEEP_ALIGNED "Keep Aligned"
+#define POPUP_PATH_ICON_APPEARANCE "/selection/Icon Appearance Items"
typedef struct {
NautilusFileSortType sort_type;
const char *metadata_text;
- const char *id;
+ const char *action;
const char *menu_label;
const char *menu_hint;
} SortCriterion;
@@ -127,16 +103,14 @@ struct FMIconViewDetails
GList *icons_not_positioned;
guint react_to_icon_change_idle_id;
- gboolean menus_ready;
gboolean loading;
const SortCriterion *sort;
gboolean sort_reversed;
- NautilusScrollPositionable *positionable;
-
- BonoboUIComponent *ui;
+ GtkActionGroup *icon_action_group;
+ guint icon_merge_id;
NautilusAudioPlayerData *audio_player_data;
int audio_preview_timeout;
@@ -193,47 +167,42 @@ static gboolean default_sort_in_reverse_order = FALSE;
static int preview_sound_auto_value;
static gboolean gnome_esd_enabled_auto_value;
-static void fm_icon_view_set_directory_sort_by (FMIconView *icon_view,
- NautilusFile *file,
- const char *sort_by);
-static void fm_icon_view_set_zoom_level (FMIconView *view,
- NautilusZoomLevel new_level,
- gboolean always_set_level);
-static void fm_icon_view_update_click_mode (FMIconView *icon_view);
-static void fm_icon_view_set_directory_tighter_layout (FMIconView *icon_view,
- NautilusFile *file,
- gboolean tighter_layout);
-static const SortCriterion *get_sort_criterion_by_id (const char *id);
-static const SortCriterion *get_sort_criterion_by_sort_type (NautilusFileSortType sort_type);
-static void set_sort_criterion_by_id (FMIconView *icon_view,
- const char *id);
-static gboolean set_sort_reversed (FMIconView *icon_view,
- gboolean new_value);
-static void switch_to_manual_layout (FMIconView *view);
-static void preview_audio (FMIconView *icon_view,
- NautilusFile *file,
- gboolean start_flag);
-static void update_layout_menus (FMIconView *view);
-
-GNOME_CLASS_BOILERPLATE (FMIconView, fm_icon_view,
- FMDirectoryView, FM_TYPE_DIRECTORY_VIEW)
+static void fm_icon_view_set_directory_sort_by (FMIconView *icon_view,
+ NautilusFile *file,
+ const char *sort_by);
+static void fm_icon_view_set_zoom_level (FMIconView *view,
+ NautilusZoomLevel new_level,
+ gboolean always_emit);
+static void fm_icon_view_update_click_mode (FMIconView *icon_view);
+static void fm_icon_view_set_directory_tighter_layout (FMIconView *icon_view,
+ NautilusFile *file,
+ gboolean tighter_layout);
+static const SortCriterion *get_sort_criterion_by_sort_type (NautilusFileSortType sort_type);
+static void set_sort_criterion_by_sort_type (FMIconView *icon_view,
+ NautilusFileSortType sort_type);
+static gboolean set_sort_reversed (FMIconView *icon_view,
+ gboolean new_value);
+static void switch_to_manual_layout (FMIconView *view);
+static void preview_audio (FMIconView *icon_view,
+ NautilusFile *file,
+ gboolean start_flag);
+static void update_layout_menus (FMIconView *view);
+
+
+static void fm_icon_view_iface_init (NautilusViewIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (FMIconView, fm_icon_view, FM_TYPE_DIRECTORY_VIEW,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_VIEW,
+ fm_icon_view_iface_init));
static void
fm_icon_view_destroy (GtkObject *object)
{
FMIconView *icon_view;
+ GtkUIManager *ui_manager;
icon_view = FM_ICON_VIEW (object);
- /* don't try to update menus during the destroy process */
- icon_view->details->menus_ready = FALSE;
-
- if (icon_view->details->ui != NULL) {
- bonobo_ui_component_unset_container (icon_view->details->ui, NULL);
- bonobo_object_unref (icon_view->details->ui);
- icon_view->details->ui = NULL;
- }
-
if (icon_view->details->react_to_icon_change_idle_id != 0) {
g_source_remove (icon_view->details->react_to_icon_change_idle_id);
icon_view->details->react_to_icon_change_idle_id = 0;
@@ -247,7 +216,14 @@ fm_icon_view_destroy (GtkObject *object)
icon_view->details->icons_not_positioned = NULL;
}
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
+ ui_manager = fm_directory_view_get_ui_manager (FM_DIRECTORY_VIEW (icon_view));
+ if (ui_manager != NULL) {
+ nautilus_ui_unmerge_ui (ui_manager,
+ &icon_view->details->icon_merge_id,
+ &icon_view->details->icon_action_group);
+ }
+
+ GTK_OBJECT_CLASS (fm_icon_view_parent_class)->destroy (object);
}
@@ -260,7 +236,7 @@ fm_icon_view_finalize (GObject *object)
g_free (icon_view->details);
- EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
+ G_OBJECT_CLASS (fm_icon_view_parent_class)->finalize (object);
}
static NautilusIconContainer *
@@ -353,7 +329,8 @@ set_sort_criterion (FMIconView *icon_view, const SortCriterion *sort)
}
static void
-show_stretch_handles_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_stretch_callback (GtkAction *action,
+ gpointer callback_data)
{
g_assert (FM_IS_ICON_VIEW (callback_data));
@@ -362,7 +339,8 @@ show_stretch_handles_callback (BonoboUIComponent *component, gpointer callback_d
}
static void
-unstretch_icons_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_unstretch_callback (GtkAction *action,
+ gpointer callback_data)
{
g_assert (FM_IS_ICON_VIEW (callback_data));
@@ -397,7 +375,7 @@ fm_icon_view_real_clean_up (FMIconView *icon_view)
}
static void
-clean_up_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+action_clean_up_callback (GtkAction *action, gpointer callback_data)
{
fm_icon_view_clean_up (FM_ICON_VIEW (callback_data));
}
@@ -414,21 +392,13 @@ set_tighter_layout (FMIconView *icon_view, gboolean new_value)
}
static void
-tighter_layout_state_changed_callback (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+action_tighter_layout_callback (GtkAction *action,
+ gpointer user_data)
{
- g_assert (strcmp (path, ID_TIGHTER_LAYOUT) == 0);
g_assert (FM_IS_ICON_VIEW (user_data));
- if (strcmp (state, "") == 0) {
- /* State goes blank when component is removed; ignore this. */
- return;
- }
-
- set_tighter_layout (FM_ICON_VIEW (user_data), strcmp (state, "1") == 0);
+ set_tighter_layout (FM_ICON_VIEW (user_data),
+ gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
}
@@ -447,16 +417,21 @@ fm_icon_view_using_tighter_layout (FMIconView *icon_view)
}
static void
-handle_radio_item (FMIconView *view,
- const char *id)
+action_sort_radio_callback (GtkAction *action,
+ GtkRadioAction *current,
+ FMIconView *view)
{
+ NautilusFileSortType sort_type;
+
+ sort_type = gtk_radio_action_get_current_value (current);
+
/* Note that id might be a toggle item.
* Ignore non-sort ids so that they don't cause sorting.
*/
- if (strcmp (id, ID_MANUAL_LAYOUT) == 0) {
+ if (sort_type == NAUTILUS_FILE_SORT_NONE) {
switch_to_manual_layout (view);
- } else if (get_sort_criterion_by_id (id) != NULL) {
- set_sort_criterion_by_id (view, id);
+ } else {
+ set_sort_criterion_by_sort_type (view, sort_type);
}
}
@@ -625,55 +600,46 @@ fm_icon_view_supports_labels_beside_icons (FMIconView *view)
static void
update_layout_menus (FMIconView *view)
{
- char *path;
gboolean is_auto_layout;
-
- if (!view->details->menus_ready) {
+ GtkAction *action;
+ const char *action_name;
+
+ if (view->details->icon_action_group == NULL) {
return;
}
is_auto_layout = fm_icon_view_using_auto_layout (view);
- bonobo_ui_component_freeze (view->details->ui, NULL);
-
if (fm_icon_view_supports_auto_layout (view)) {
/* Mark sort criterion. */
- path = g_strconcat (COMMAND_PREFIX,
- is_auto_layout ? view->details->sort->id : ID_MANUAL_LAYOUT,
- NULL);
- nautilus_bonobo_set_toggle_state (view->details->ui, path, TRUE);
- g_free (path);
-
- /* Set the checkmark for the "tighter layout" item */
- nautilus_bonobo_set_toggle_state
- (view->details->ui, COMMAND_TIGHTER_LAYOUT, fm_icon_view_using_tighter_layout (view));
-
- /* Set the checkmark for the "reversed order" item */
- nautilus_bonobo_set_toggle_state
- (view->details->ui, COMMAND_SORT_REVERSED, view->details->sort_reversed);
-
- /* Sort order isn't relevant for manual layout. */
- nautilus_bonobo_set_sensitive
- (view->details->ui, COMMAND_SORT_REVERSED, is_auto_layout);
+ action_name = is_auto_layout ? view->details->sort->action : FM_ACTION_MANUAL_LAYOUT;
+ action = gtk_action_group_get_action (view->details->icon_action_group,
+ action_name);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+
+ action = gtk_action_group_get_action (view->details->icon_action_group,
+ FM_ACTION_TIGHTER_LAYOUT);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ fm_icon_view_using_tighter_layout (view));
+ action = gtk_action_group_get_action (view->details->icon_action_group,
+ FM_ACTION_REVERSED_ORDER);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ view->details->sort_reversed);
+ gtk_action_set_sensitive (action, is_auto_layout);
}
/* Clean Up is only relevant for manual layout */
- nautilus_bonobo_set_sensitive
- (view->details->ui, COMMAND_CLEAN_UP, !is_auto_layout);
+ action = gtk_action_group_get_action (view->details->icon_action_group,
+ FM_ACTION_CLEAN_UP);
+ gtk_action_set_sensitive (action, !is_auto_layout);
-
- nautilus_bonobo_set_hidden (view->details->ui,
- COMMAND_KEEP_ALIGNED,
- !fm_icon_view_supports_keep_aligned (view));
-
- nautilus_bonobo_set_toggle_state
- (view->details->ui, COMMAND_KEEP_ALIGNED,
- nautilus_icon_container_is_keep_aligned (get_icon_container (view)));
-
- nautilus_bonobo_set_sensitive
- (view->details->ui, COMMAND_KEEP_ALIGNED, !is_auto_layout);
-
- bonobo_ui_component_thaw (view->details->ui, NULL);
+ action = gtk_action_group_get_action (view->details->icon_action_group,
+ FM_ACTION_KEEP_ALIGNED);
+ gtk_action_set_visible (action,
+ fm_icon_view_supports_keep_aligned (view));
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ nautilus_icon_container_is_keep_aligned (get_icon_container (view)));
+ gtk_action_set_sensitive (action, !is_auto_layout);
}
@@ -1018,20 +984,6 @@ get_sort_criterion_by_metadata_text (const char *metadata_text)
}
static const SortCriterion *
-get_sort_criterion_by_id (const char *id)
-{
- guint i;
-
- /* Figure out what the new sort setting should be. */
- for (i = 0; i < G_N_ELEMENTS (sort_criteria); i++) {
- if (strcmp (sort_criteria[i].id, id) == 0) {
- return &sort_criteria[i];
- }
- }
- return NULL;
-}
-
-static const SortCriterion *
get_sort_criterion_by_sort_type (NautilusFileSortType sort_type)
{
guint i;
@@ -1108,7 +1060,7 @@ fm_icon_view_begin_loading (FMDirectoryView *view)
} else {
GdkDragAction default_action;
- if (nautilus_view_get_window_type (fm_directory_view_get_nautilus_view (view)) == Nautilus_WINDOW_NAVIGATION) {
+ if (nautilus_window_info_get_window_type (fm_directory_view_get_nautilus_window (view)) == NAUTILUS_WINDOW_NAVIGATION) {
default_action = NAUTILUS_DND_ACTION_SET_AS_GLOBAL_BACKGROUND;
} else {
default_action = NAUTILUS_DND_ACTION_SET_AS_FOLDER_BACKGROUND;
@@ -1157,6 +1109,9 @@ fm_icon_view_begin_loading (FMDirectoryView *view)
nautilus_icon_container_set_auto_layout
(get_icon_container (icon_view),
fm_icon_view_get_directory_auto_layout (icon_view, file));
+
+ /* e.g. keep aligned may have changed */
+ update_layout_menus (icon_view);
}
static void
@@ -1167,106 +1122,18 @@ fm_icon_view_end_loading (FMDirectoryView *view)
icon_view = FM_ICON_VIEW (view);
}
-static void
-fm_icon_view_update_font_size_table (FMIconView *view)
-{
- NautilusIconContainer *container;
- int font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST + 1];
-
- container = get_icon_container (view);
- g_assert (container != NULL);
-
- switch (get_default_zoom_level ())
- {
- case NAUTILUS_ZOOM_LEVEL_LARGEST:
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -5 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = -4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = -3 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = -3 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = -2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 0 * PANGO_SCALE;
- break;
- case NAUTILUS_ZOOM_LEVEL_LARGER:
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = -3 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = -3 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = -2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 0 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 2 * PANGO_SCALE;
- break;
- case NAUTILUS_ZOOM_LEVEL_LARGE:
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -3 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = -3 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = -2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 0 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 4 * PANGO_SCALE;
- break;
- case NAUTILUS_ZOOM_LEVEL_STANDARD:
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -3 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -3 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = -2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 0 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 4 * PANGO_SCALE;
- break;
- case NAUTILUS_ZOOM_LEVEL_SMALL:
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -3 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = 0 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 5 * PANGO_SCALE;
- break;
- case NAUTILUS_ZOOM_LEVEL_SMALLER:
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = 0 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = 2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 5 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 5 * PANGO_SCALE;
- break;
- case NAUTILUS_ZOOM_LEVEL_SMALLEST:
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = 0 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = 2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = 4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 5 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 5 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 6 * PANGO_SCALE;
- break;
- default:
- g_warning ("invalid default list-view zoom level");
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLEST] = -3 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALLER] = -3 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_SMALL] = -2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_STANDARD] = 0 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGE] = 2 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGER] = 4 * PANGO_SCALE;
- font_size_table[NAUTILUS_ZOOM_LEVEL_LARGEST] = 4 * PANGO_SCALE;
- break;
- }
-
- nautilus_icon_container_set_font_size_table (container, font_size_table);
-}
-
static NautilusZoomLevel
-fm_icon_view_get_zoom_level (FMIconView *view)
+fm_icon_view_get_zoom_level (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_ICON_VIEW (view), NAUTILUS_ZOOM_LEVEL_STANDARD);
- return nautilus_icon_container_get_zoom_level (get_icon_container (view));
+
+ return nautilus_icon_container_get_zoom_level (get_icon_container (FM_ICON_VIEW (view)));
}
static void
fm_icon_view_set_zoom_level (FMIconView *view,
NautilusZoomLevel new_level,
- gboolean always_set_level)
+ gboolean always_emit)
{
NautilusIconContainer *icon_container;
@@ -1276,8 +1143,8 @@ fm_icon_view_set_zoom_level (FMIconView *view,
icon_container = get_icon_container (view);
if (nautilus_icon_container_get_zoom_level (icon_container) == new_level) {
- if (always_set_level) {
- fm_directory_view_set_zoom_level (&view->parent, new_level);
+ if (always_emit) {
+ g_signal_emit_by_name (view, "zoom_level_changed");
}
return;
}
@@ -1289,8 +1156,9 @@ fm_icon_view_set_zoom_level (FMIconView *view,
new_level);
nautilus_icon_container_set_zoom_level (icon_container, new_level);
- fm_directory_view_set_zoom_level (&view->parent, new_level);
+ g_signal_emit_by_name (view, "zoom_level_changed");
+
fm_directory_view_update_menus (FM_DIRECTORY_VIEW (view));
}
@@ -1303,16 +1171,17 @@ fm_icon_view_bump_zoom_level (FMDirectoryView *view, int zoom_increment)
g_return_if_fail (FM_IS_ICON_VIEW (view));
icon_view = FM_ICON_VIEW (view);
- new_level = fm_icon_view_get_zoom_level (icon_view) + zoom_increment;
+ new_level = fm_icon_view_get_zoom_level (view) + zoom_increment;
if (new_level >= NAUTILUS_ZOOM_LEVEL_SMALLEST &&
new_level <= NAUTILUS_ZOOM_LEVEL_LARGEST) {
- fm_icon_view_set_zoom_level(icon_view, new_level, FALSE);
+ fm_directory_view_zoom_to_level (view, new_level);
}
}
static void
-fm_icon_view_zoom_to_level (FMDirectoryView *view, int zoom_level)
+fm_icon_view_zoom_to_level (FMDirectoryView *view,
+ NautilusZoomLevel zoom_level)
{
FMIconView *icon_view;
@@ -1325,13 +1194,8 @@ fm_icon_view_zoom_to_level (FMDirectoryView *view, int zoom_level)
static void
fm_icon_view_restore_default_zoom_level (FMDirectoryView *view)
{
- FMIconView *icon_view;
-
- g_return_if_fail (FM_IS_ICON_VIEW (view));
-
- icon_view = FM_ICON_VIEW (view);
- fm_icon_view_set_zoom_level
- (icon_view, get_default_zoom_level (), FALSE);
+ fm_directory_view_zoom_to_level
+ (view, get_default_zoom_level ());
}
static gboolean
@@ -1339,7 +1203,7 @@ fm_icon_view_can_zoom_in (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_ICON_VIEW (view), FALSE);
- return fm_icon_view_get_zoom_level (FM_ICON_VIEW (view))
+ return fm_icon_view_get_zoom_level (view)
< NAUTILUS_ZOOM_LEVEL_LARGEST;
}
@@ -1348,7 +1212,7 @@ fm_icon_view_can_zoom_out (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_ICON_VIEW (view), FALSE);
- return fm_icon_view_get_zoom_level (FM_ICON_VIEW (view))
+ return fm_icon_view_get_zoom_level (view)
> NAUTILUS_ZOOM_LEVEL_SMALLEST;
}
@@ -1408,16 +1272,15 @@ fm_icon_view_get_item_count (FMDirectoryView *view)
return count;
}
-
static void
-set_sort_criterion_by_id (FMIconView *icon_view, const char *id)
+set_sort_criterion_by_sort_type (FMIconView *icon_view,
+ NautilusFileSortType sort_type)
{
const SortCriterion *sort;
g_assert (FM_IS_ICON_VIEW (icon_view));
- g_assert (id != NULL);
- sort = get_sort_criterion_by_id (id);
+ sort = get_sort_criterion_by_sort_type (sort_type);
g_return_if_fail (sort != NULL);
if (sort == icon_view->details->sort
@@ -1429,50 +1292,32 @@ set_sort_criterion_by_id (FMIconView *icon_view, const char *id)
nautilus_icon_container_sort (get_icon_container (icon_view));
}
+
static void
-sort_reversed_state_changed_callback (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+action_reversed_order_callback (GtkAction *action,
+ gpointer user_data)
{
FMIconView *icon_view;
- g_assert (strcmp (path, ID_SORT_REVERSED) == 0);
-
icon_view = FM_ICON_VIEW (user_data);
- if (strcmp (state, "") == 0) {
- /* State goes blank when component is removed; ignore this. */
- return;
- }
-
- if (set_sort_reversed (icon_view, strcmp (state, "1") == 0)) {
+ if (set_sort_reversed (icon_view,
+ gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))) {
nautilus_icon_container_sort (get_icon_container (icon_view));
}
}
static void
-keep_aligned_state_changed_callback (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+action_keep_aligned_callback (GtkAction *action,
+ gpointer user_data)
{
FMIconView *icon_view;
NautilusFile *file;
gboolean keep_aligned;
- g_assert (strcmp (path, ID_KEEP_ALIGNED) == 0);
-
icon_view = FM_ICON_VIEW (user_data);
- if (strcmp (state, "") == 0) {
- /* State goes blank when component is removed; ignore this. */
- return;
- }
-
- keep_aligned = strcmp (state, "1") == 0 ? TRUE : FALSE;
+ keep_aligned = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
file = fm_directory_view_get_directory_as_file (FM_DIRECTORY_VIEW (icon_view));
fm_icon_view_set_directory_keep_aligned (icon_view,
@@ -1524,106 +1369,152 @@ layout_changed_callback (NautilusIconContainer *container,
static gboolean
fm_icon_view_can_rename_file (FMDirectoryView *view, NautilusFile *file)
{
- if (!(fm_icon_view_get_zoom_level (FM_ICON_VIEW (view)) > NAUTILUS_ZOOM_LEVEL_SMALLEST)) {
+ if (!(fm_icon_view_get_zoom_level (view) > NAUTILUS_ZOOM_LEVEL_SMALLEST)) {
return FALSE;
}
- return EEL_CALL_PARENT_WITH_RETURN_VALUE (
- FM_DIRECTORY_VIEW_CLASS, can_rename_file, (view, file));
+ return FM_DIRECTORY_VIEW_CLASS(fm_icon_view_parent_class)->can_rename_file (view, file);
}
static void
fm_icon_view_start_renaming_file (FMDirectoryView *view, NautilusFile *file)
{
/* call parent class to make sure the right icon is selected */
- EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS, start_renaming_file, (view, file));
+ FM_DIRECTORY_VIEW_CLASS(fm_icon_view_parent_class)->start_renaming_file (view, file);
/* start renaming */
nautilus_icon_container_start_renaming_selected_item
(get_icon_container (FM_ICON_VIEW (view)));
}
-static void
-handle_ui_event (BonoboUIComponent *ui,
- const char *id,
- Bonobo_UIComponent_EventType type,
- const char *state,
- FMIconView *view)
-{
- if (type == Bonobo_UIComponent_STATE_CHANGED
- && strcmp (state, "1") == 0) {
- handle_radio_item (view, id);
- }
-}
+static GtkActionEntry icon_view_entries[] = {
+ { "Arrange Items", NULL, N_("Arran_ge Items") }, /* name, stock id, label */
+ { "Stretch", NULL, /* name, stock id */
+ N_("Str_etch Icon"), NULL, /* label, accelerator */
+ N_("Make the selected icon stretchable"), /* tooltip */
+ G_CALLBACK (action_stretch_callback) },
+ { "Unstretch", NULL, /* name, stock id */
+ N_("Restore Icons' Original Si_zes"), NULL, /* label, accelerator */
+ N_("Restore each selected icon to its original size"), /* tooltip */
+ G_CALLBACK (action_unstretch_callback) },
+ { "Clean Up", NULL, /* name, stock id */
+ N_("Clean _Up by Name"), NULL, /* label, accelerator */
+ N_("Reposition icons to better fit in the window and avoaction overlapping"), /* tooltip */
+ G_CALLBACK (action_clean_up_callback) },
+};
+
+static GtkToggleActionEntry icon_view_toggle_entries[] = {
+ { "Tighter Layout", NULL, /* name, stock id */
+ N_("Compact _Layout"), NULL, /* label, accelerator */
+ N_("Toggle using a tighter layout scheme"), /* tooltip */
+ G_CALLBACK (action_tighter_layout_callback),
+ 0 },
+ { "Reversed Order", NULL, /* name, stock id */
+ N_("Re_versed Order"), NULL, /* label, accelerator */
+ N_("Display icons in the opposite order"), /* tooltip */
+ G_CALLBACK (action_reversed_order_callback),
+ 0 },
+ { "Keep Aligned", NULL, /* name, stock id */
+ N_("_Keep Aligned"), NULL, /* label, accelerator */
+ N_("Keep icons lined up on a grid"), /* tooltip */
+ G_CALLBACK (action_keep_aligned_callback),
+ 0 },
+};
+
+static GtkRadioActionEntry arrange_radio_entries[] = {
+ { "Manual Layout", NULL,
+ N_("_Manually"), NULL,
+ N_("Leave icons wherever they are dropped"),
+ NAUTILUS_FILE_SORT_NONE },
+ { "Sort by Name", NULL,
+ N_("By _Name"), NULL,
+ N_("Keep icons sorted by name in rows"),
+ NAUTILUS_FILE_SORT_BY_DISPLAY_NAME },
+ { "Sort by Size", NULL,
+ N_("By _Size"), NULL,
+ N_("Keep icons sorted by size in rows"),
+ NAUTILUS_FILE_SORT_BY_SIZE },
+ { "Sort by Type", NULL,
+ N_("By _Type"), NULL,
+ N_("Keep icons sorted by type in rows"),
+ NAUTILUS_FILE_SORT_BY_TYPE },
+ { "Sort by Modification Date", NULL,
+ N_("By Modification _Date"), NULL,
+ N_("Keep icons sorted by modification date in rows"),
+ NAUTILUS_FILE_SORT_BY_MTIME },
+ { "Sort by Emblems", NULL,
+ N_("By _Emblems"), NULL,
+ N_("Keep icons sorted by emblems in rows"),
+ NAUTILUS_FILE_SORT_BY_EMBLEMS },
+};
static void
fm_icon_view_merge_menus (FMDirectoryView *view)
{
FMIconView *icon_view;
- Bonobo_UIContainer ui_container;
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("Stretch", show_stretch_handles_callback),
- BONOBO_UI_VERB ("Unstretch", unstretch_icons_callback),
- BONOBO_UI_VERB ("Clean Up", clean_up_callback),
- BONOBO_UI_VERB_END
- };
+ GtkUIManager *ui_manager;
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ const char *ui;
g_assert (FM_IS_ICON_VIEW (view));
- EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS, merge_menus, (view));
+ FM_DIRECTORY_VIEW_CLASS (fm_icon_view_parent_class)->merge_menus (view);
icon_view = FM_ICON_VIEW (view);
- icon_view->details->ui = bonobo_ui_component_new ("Icon View");
- g_signal_connect_object (icon_view->details->ui,
- "ui_event", G_CALLBACK (handle_ui_event), icon_view, 0);
- ui_container = fm_directory_view_get_bonobo_ui_container (view);
- bonobo_ui_component_set_container (icon_view->details->ui,
- ui_container, NULL);
- bonobo_object_release_unref (ui_container, NULL);
- bonobo_ui_util_set_ui (icon_view->details->ui,
- DATADIR,
- "nautilus-icon-view-ui.xml",
- "nautilus", NULL);
-
- bonobo_ui_component_add_verb_list_with_data (icon_view->details->ui, verbs, view);
-
- bonobo_ui_component_add_listener (icon_view->details->ui, ID_TIGHTER_LAYOUT, tighter_layout_state_changed_callback, view);
- bonobo_ui_component_add_listener (icon_view->details->ui, ID_SORT_REVERSED, sort_reversed_state_changed_callback, view);
- bonobo_ui_component_add_listener (icon_view->details->ui, ID_KEEP_ALIGNED, keep_aligned_state_changed_callback, view);
- icon_view->details->menus_ready = TRUE;
+ ui_manager = fm_directory_view_get_ui_manager (FM_DIRECTORY_VIEW (icon_view));
+
+ action_group = gtk_action_group_new ("IconViewActions");
+ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+ icon_view->details->icon_action_group = action_group;
+ gtk_action_group_add_actions (action_group,
+ icon_view_entries, G_N_ELEMENTS (icon_view_entries),
+ icon_view);
+ gtk_action_group_add_toggle_actions (action_group,
+ icon_view_toggle_entries, G_N_ELEMENTS (icon_view_toggle_entries),
+ icon_view);
+ gtk_action_group_add_radio_actions (action_group,
+ arrange_radio_entries,
+ G_N_ELEMENTS (arrange_radio_entries),
+ -1,
+ G_CALLBACK (action_sort_radio_callback),
+ icon_view);
+
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ g_object_unref (action_group); /* owned by ui manager */
+
+ ui = nautilus_ui_string_get ("nautilus-icon-view-ui.xml");
+ icon_view->details->icon_merge_id =
+ gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
- bonobo_ui_component_freeze (icon_view->details->ui, NULL);
-
/* Do one-time state-setting here; context-dependent state-setting
* is done in update_menus.
*/
if (!fm_icon_view_supports_auto_layout (icon_view)) {
- nautilus_bonobo_set_hidden
- (icon_view->details->ui, POPUP_PATH_LAY_OUT, TRUE);
+ action = gtk_action_group_get_action (action_group,
+ FM_ACTION_ARRANGE_ITEMS);
+ gtk_action_set_visible (action, FALSE);
}
if (FM_IS_DESKTOP_ICON_VIEW (icon_view)) {
- bonobo_ui_component_set (icon_view->details->ui,
- POPUP_PATH_ICON_APPEARANCE,
- "<menuitem name=\"Stretch\" verb=\"Stretch\"/>",
- NULL);
- bonobo_ui_component_set (icon_view->details->ui,
- POPUP_PATH_ICON_APPEARANCE,
- "<menuitem name=\"Unstretch\" verb=\"Unstretch\"/>",
- NULL);
+ gtk_ui_manager_add_ui (ui_manager,
+ icon_view->details->icon_merge_id,
+ POPUP_PATH_ICON_APPEARANCE,
+ FM_ACTION_STRETCH,
+ FM_ACTION_STRETCH,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+ gtk_ui_manager_add_ui (ui_manager,
+ icon_view->details->icon_merge_id,
+ POPUP_PATH_ICON_APPEARANCE,
+ FM_ACTION_UNSTRETCH,
+ FM_ACTION_UNSTRETCH,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
}
- nautilus_bonobo_set_hidden
- (icon_view->details->ui, POPUP_PATH_ICON_APPEARANCE, TRUE);
-
- nautilus_bonobo_set_hidden
- (icon_view->details->ui, POPUP_PATH_ICON_APPEARANCE,
- !FM_IS_DESKTOP_ICON_VIEW (view));
-
update_layout_menus (icon_view);
-
- bonobo_ui_component_thaw (icon_view->details->ui, NULL);
}
static void
@@ -1632,47 +1523,34 @@ fm_icon_view_update_menus (FMDirectoryView *view)
FMIconView *icon_view;
GList *selection;
int selection_count;
+ GtkAction *action;
NautilusIconContainer *icon_container;
icon_view = FM_ICON_VIEW (view);
- /* don't update if the menus aren't ready */
- if (!icon_view->details->menus_ready) {
- return;
- }
-
- EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS, update_menus, (view));
-
- /* don't update if we have no remote BonoboUIContainer */
- if (bonobo_ui_component_get_container (icon_view->details->ui)
- == CORBA_OBJECT_NIL) {
- return;
- }
+ FM_DIRECTORY_VIEW_CLASS (fm_icon_view_parent_class)->update_menus(view);
selection = fm_directory_view_get_selection (view);
selection_count = g_list_length (selection);
icon_container = get_icon_container (icon_view);
- bonobo_ui_component_freeze (icon_view->details->ui, NULL);
-
- nautilus_bonobo_set_sensitive (icon_view->details->ui,
- COMMAND_STRETCH_ICON,
- selection_count == 1
- && icon_container != NULL
- && !nautilus_icon_container_has_stretch_handles (icon_container));
-
- nautilus_bonobo_set_label
- (icon_view->details->ui,
- COMMAND_UNSTRETCH_ICONS,
- eel_g_list_more_than_one_item (selection)
- ? _("Restore Icons' Original Si_zes")
- : _("Restore Icon's Original Si_ze"));
- nautilus_bonobo_set_sensitive (icon_view->details->ui,
- COMMAND_UNSTRETCH_ICONS,
- icon_container != NULL
- && nautilus_icon_container_is_stretched (icon_container));
-
- bonobo_ui_component_thaw (icon_view->details->ui, NULL);
+ action = gtk_action_group_get_action (icon_view->details->icon_action_group,
+ FM_ACTION_STRETCH);
+ gtk_action_set_sensitive (action,
+ selection_count == 1
+ && icon_container != NULL
+ && !nautilus_icon_container_has_stretch_handles (icon_container));
+
+ action = gtk_action_group_get_action (icon_view->details->icon_action_group,
+ FM_ACTION_UNSTRETCH);
+ g_object_set (action, "label",
+ eel_g_list_more_than_one_item (selection)
+ ? _("Restore Icons' Original Si_zes")
+ : _("Restore Icon's Original Si_ze"),
+ NULL);
+ gtk_action_set_sensitive (action,
+ icon_container != NULL
+ && nautilus_icon_container_is_stretched (icon_container));
nautilus_file_list_free (selection);
}
@@ -1767,7 +1645,7 @@ icon_container_activate_callback (NautilusIconContainer *container,
fm_directory_view_activate_files (FM_DIRECTORY_VIEW (icon_view),
file_list,
- Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE, 0);
+ NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, 0);
}
static void
@@ -1780,8 +1658,8 @@ icon_container_activate_alternate_callback (NautilusIconContainer *container,
fm_directory_view_activate_files (FM_DIRECTORY_VIEW (icon_view),
file_list,
- Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE,
- Nautilus_ViewFrame_OPEN_FLAG_CLOSE_BEHIND);
+ NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
+ NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND);
}
static void
@@ -2026,13 +1904,13 @@ icon_container_preview_callback (NautilusIconContainer *container,
/* Display file name in status area at low zoom levels, since
* the name is not displayed or hard to read in the icon view.
*/
- if (fm_icon_view_get_zoom_level (icon_view) <= NAUTILUS_ZOOM_LEVEL_SMALLER) {
+ if (fm_icon_view_get_zoom_level (FM_DIRECTORY_VIEW (icon_view)) <= NAUTILUS_ZOOM_LEVEL_SMALLER) {
if (start_flag) {
file_name = nautilus_file_get_display_name (file);
message = g_strdup_printf (_("pointing at \"%s\""), file_name);
g_free (file_name);
- nautilus_view_report_status
- (fm_directory_view_get_nautilus_view (FM_DIRECTORY_VIEW (icon_view)),
+ nautilus_window_info_set_status
+ (fm_directory_view_get_nautilus_window (FM_DIRECTORY_VIEW (icon_view)),
message);
g_free (message);
} else {
@@ -2051,9 +1929,9 @@ renaming_icon_callback (NautilusIconContainer *container,
FMDirectoryView *directory_view;
directory_view = FM_DIRECTORY_VIEW (callback_data);
- nautilus_clipboard_set_up_editable_in_control
+ nautilus_clipboard_set_up_editable
(GTK_EDITABLE (widget),
- fm_directory_view_get_bonobo_control (directory_view),
+ fm_directory_view_get_ui_manager (directory_view),
FALSE);
}
@@ -2086,8 +1964,8 @@ fm_icon_view_screen_changed (GtkWidget *widget,
NautilusFile *file;
NautilusIconContainer *icon_container;
- if (GTK_WIDGET_CLASS (parent_class)->screen_changed) {
- GTK_WIDGET_CLASS (parent_class)->screen_changed (widget, previous_screen);
+ if (GTK_WIDGET_CLASS (fm_icon_view_parent_class)->screen_changed) {
+ GTK_WIDGET_CLASS (fm_icon_view_parent_class)->screen_changed (widget, previous_screen);
}
view = FM_DIRECTORY_VIEW (widget);
@@ -2444,8 +2322,7 @@ default_zoom_level_changed_callback (gpointer callback_data)
level = nautilus_file_get_integer_metadata (file,
NAUTILUS_METADATA_KEY_ICON_VIEW_ZOOM_LEVEL,
get_default_zoom_level ());
- fm_icon_view_update_font_size_table (icon_view);
- fm_icon_view_set_zoom_level (icon_view, level, TRUE);
+ fm_directory_view_zoom_to_level (FM_DIRECTORY_VIEW (icon_view), level);
}
}
@@ -2577,7 +2454,6 @@ create_icon_container (FMIconView *icon_view)
GTK_WIDGET (icon_container));
fm_icon_view_update_click_mode (icon_view);
- fm_icon_view_update_font_size_table (icon_view);
gtk_widget_show (GTK_WIDGET (icon_container));
}
@@ -2771,10 +2647,12 @@ icon_view_handle_uri_list (NautilusIconContainer *container, const char *item_ur
}
static char *
-icon_view_get_first_visible_file_callback (NautilusScrollPositionable *positionable,
- FMIconView *icon_view)
+icon_view_get_first_visible_file (NautilusView *view)
{
NautilusFile *file;
+ FMIconView *icon_view;
+
+ icon_view = FM_ICON_VIEW (view);
file = NAUTILUS_FILE (nautilus_icon_container_get_first_visible_icon (get_icon_container (icon_view)));
@@ -2786,12 +2664,14 @@ icon_view_get_first_visible_file_callback (NautilusScrollPositionable *positiona
}
static void
-icon_view_scroll_to_file_callback (NautilusScrollPositionable *positionable,
- const char *uri,
- FMIconView *icon_view)
+icon_view_scroll_to_file (NautilusView *view,
+ const char *uri)
{
NautilusFile *file;
+ FMIconView *icon_view;
+ icon_view = FM_ICON_VIEW (view);
+
if (uri != NULL) {
file = nautilus_file_get (uri);
if (file != NULL) {
@@ -2838,6 +2718,7 @@ fm_icon_view_class_init (FMIconViewClass *klass)
fm_directory_view_class->set_selection = fm_icon_view_set_selection;
fm_directory_view_class->sort_files = fm_icon_view_sort_files;
fm_directory_view_class->zoom_to_level = fm_icon_view_zoom_to_level;
+ fm_directory_view_class->get_zoom_level = fm_icon_view_get_zoom_level;
fm_directory_view_class->click_policy_changed = fm_icon_view_click_policy_changed;
fm_directory_view_class->embedded_text_policy_changed = fm_icon_view_embedded_text_policy_changed;
fm_directory_view_class->emblems_changed = fm_icon_view_emblems_changed;
@@ -2862,11 +2743,30 @@ fm_icon_view_class_init (FMIconViewClass *klass)
klass->set_directory_tighter_layout = fm_icon_view_real_set_directory_tighter_layout;
}
+static const char *
+fm_icon_view_get_id (NautilusView *view)
+{
+ if (FM_IS_DESKTOP_ICON_VIEW (view)) {
+ return FM_DESKTOP_ICON_VIEW_ID;
+ }
+ return FM_ICON_VIEW_ID;
+}
+
+static void
+fm_icon_view_iface_init (NautilusViewIface *iface)
+{
+ fm_directory_view_init_view_iface (iface);
+
+ iface->get_view_id = fm_icon_view_get_id;
+ iface->get_first_visible_file = icon_view_get_first_visible_file;
+ iface->scroll_to_file = icon_view_scroll_to_file;
+ iface->get_title = NULL;
+}
+
static void
-fm_icon_view_instance_init (FMIconView *icon_view)
+fm_icon_view_init (FMIconView *icon_view)
{
static gboolean setup_sound_preview = FALSE;
- NautilusView *nautilus_view;
g_return_if_fail (GTK_BIN (icon_view)->child == NULL);
@@ -2876,11 +2776,6 @@ fm_icon_view_instance_init (FMIconView *icon_view)
create_icon_container (icon_view);
- icon_view->details->positionable = nautilus_scroll_positionable_new ();
- nautilus_view = fm_directory_view_get_nautilus_view (FM_DIRECTORY_VIEW (icon_view));
- bonobo_object_add_interface (BONOBO_OBJECT (nautilus_view),
- BONOBO_OBJECT (icon_view->details->positionable));
-
if (!setup_sound_preview) {
eel_preferences_add_auto_enum (NAUTILUS_PREFERENCES_PREVIEW_SOUND,
&preview_sound_auto_value);
@@ -2913,8 +2808,47 @@ fm_icon_view_instance_init (FMIconView *icon_view)
g_signal_connect_object (get_icon_container (icon_view), "handle_uri_list",
G_CALLBACK (icon_view_handle_uri_list), icon_view, 0);
- g_signal_connect_object (icon_view->details->positionable, "get_first_visible_file",
- G_CALLBACK (icon_view_get_first_visible_file_callback), icon_view, 0);
- g_signal_connect_object (icon_view->details->positionable, "scroll_to_file",
- G_CALLBACK (icon_view_scroll_to_file_callback), icon_view, 0);
+}
+
+static NautilusView *
+fm_icon_view_create (NautilusWindowInfo *window)
+{
+ FMIconView *view;
+
+ view = g_object_new (FM_TYPE_ICON_VIEW, "window", window, NULL);
+ g_object_ref (view);
+ gtk_object_sink (GTK_OBJECT (view));
+ return NAUTILUS_VIEW (view);
+}
+
+static gboolean
+fm_icon_view_supports_uri (const char *uri,
+ GnomeVFSFileType file_type,
+ const char *mime_type)
+{
+ if (file_type == GNOME_VFS_FILE_TYPE_DIRECTORY) {
+ return TRUE;
+ }
+ if (g_str_has_prefix (uri, "trash:")) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static NautilusViewInfo fm_icon_view = {
+ FM_ICON_VIEW_ID,
+ N_("Icons"),
+ N_("_Icons"),
+ fm_icon_view_create,
+ fm_icon_view_supports_uri
+};
+
+void
+fm_icon_view_register (void)
+{
+ fm_icon_view.label = _(fm_icon_view.label);
+ fm_icon_view.label_with_mnemonic = _(fm_icon_view.label_with_mnemonic);
+
+ nautilus_view_factory_register (&fm_icon_view);
}
diff --git a/src/file-manager/fm-icon-view.h b/src/file-manager/fm-icon-view.h
index 64bcd0127..d3f2cbed8 100644
--- a/src/file-manager/fm-icon-view.h
+++ b/src/file-manager/fm-icon-view.h
@@ -36,6 +36,8 @@ typedef struct FMIconViewClass FMIconViewClass;
#define FM_IS_ICON_VIEW(obj) (GTK_CHECK_TYPE ((obj), FM_TYPE_ICON_VIEW))
#define FM_IS_ICON_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), FM_TYPE_ICON_VIEW))
+#define FM_ICON_VIEW_ID "OAFIID:Nautilus_File_Manager_Icon_View"
+
typedef struct FMIconViewDetails FMIconViewDetails;
struct FMIconView {
@@ -104,4 +106,6 @@ int fm_icon_view_compare_files (FMIconView *icon_view,
NautilusFile *b);
void fm_icon_view_filter_by_screen (FMIconView *icon_view, gboolean filter);
+void fm_icon_view_register (void);
+
#endif /* FM_ICON_VIEW_H */
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index f5a877609..c663757a5 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -32,7 +32,6 @@
#include "fm-error-reporting.h"
#include "fm-list-model.h"
#include <string.h>
-#include <bonobo/bonobo-ui-util.h>
#include <eel/eel-cell-renderer-pixbuf-list.h>
#include <eel/eel-vfs-extensions.h>
#include <eel/eel-glib-extensions.h>
@@ -57,14 +56,16 @@
#include <libnautilus-private/nautilus-directory-background.h>
#include <libnautilus-private/nautilus-dnd.h>
#include <libnautilus-private/nautilus-file-dnd.h>
+#include <libnautilus-private/nautilus-file-utilities.h>
+#include <libnautilus-private/nautilus-ui-utilities.h>
#include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-icon-dnd.h>
#include <libnautilus-private/nautilus-icon-factory.h>
#include <libnautilus-private/nautilus-metadata.h>
#include <libnautilus-private/nautilus-module.h>
#include <libnautilus-private/nautilus-tree-view-drag-dest.h>
-#include <libnautilus/nautilus-scroll-positionable.h>
-#include <libnautilus/nautilus-clipboard.h>
+#include <libnautilus-private/nautilus-view-factory.h>
+#include <libnautilus-private/nautilus-clipboard.h>
#include <libnautilus-private/nautilus-cell-renderer-pixbuf-emblem.h>
/* Included for the typeselect flush delay */
@@ -78,6 +79,8 @@ typedef struct {
struct FMListViewDetails {
GtkTreeView *tree_view;
FMListModel *model;
+ GtkActionGroup *list_action_group;
+ guint list_merge_id;
GtkTreeViewColumn *file_name_column;
int file_name_column_num;
@@ -88,8 +91,6 @@ struct FMListViewDetails {
NautilusZoomLevel zoom_level;
- NautilusScrollPositionable *positionable;
-
NautilusTreeViewDragDest *drag_dest;
GtkTargetList *source_target_list;
@@ -107,7 +108,6 @@ struct FMListViewDetails {
/* typeahead selection state */
TypeSelectState *type_select_state;
- BonoboUIComponent *ui;
gboolean menus_ready;
GHashTable *columns;
@@ -128,18 +128,24 @@ static NautilusZoomLevel default_zoom_level_auto_value;
static GList * default_visible_columns_auto_value;
static GList * default_column_order_auto_value;
-static GList * fm_list_view_get_selection (FMDirectoryView *view);
-static void fm_list_view_set_zoom_level (FMListView *view,
- NautilusZoomLevel new_level,
- gboolean always_set_level);
-static void fm_list_view_scale_font_size (FMListView *view,
- NautilusZoomLevel new_level,
- gboolean update_size_table);
-static void fm_list_view_scroll_to_file (FMListView *view,
- NautilusFile *file);
+static GList *fm_list_view_get_selection (FMDirectoryView *view);
+static void fm_list_view_set_zoom_level (FMListView *view,
+ NautilusZoomLevel new_level,
+ gboolean always_set_level);
+static void fm_list_view_scale_font_size (FMListView *view,
+ NautilusZoomLevel new_level);
+static void fm_list_view_scroll_to_file (FMListView *view,
+ NautilusFile *file);
+static void fm_list_view_iface_init (NautilusViewIface *iface);
+
+
-GNOME_CLASS_BOILERPLATE (FMListView, fm_list_view,
- FMDirectoryView, FM_TYPE_DIRECTORY_VIEW)
+G_DEFINE_TYPE_WITH_CODE (FMListView, fm_list_view, FM_TYPE_DIRECTORY_VIEW,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_VIEW,
+ fm_list_view_iface_init));
+
+/* for EEL_CALL_PARENT */
+#define parent_class fm_list_view_parent_class
static void
list_selection_changed_callback (GtkTreeSelection *selection, gpointer user_data)
@@ -188,7 +194,7 @@ activate_selected_items (FMListView *view)
file_list = fm_list_view_get_selection (FM_DIRECTORY_VIEW (view));
fm_directory_view_activate_files (FM_DIRECTORY_VIEW (view),
file_list,
- Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE,
+ NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
0);
nautilus_file_list_free (file_list);
@@ -209,8 +215,8 @@ activate_selected_items_alternate (FMListView *view,
}
fm_directory_view_activate_files (FM_DIRECTORY_VIEW (view),
file_list,
- Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE,
- Nautilus_ViewFrame_OPEN_FLAG_CLOSE_BEHIND);
+ NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
+ NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND);
nautilus_file_list_free (file_list);
}
@@ -451,7 +457,7 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
view = FM_LIST_VIEW (callback_data);
tree_view = GTK_TREE_VIEW (widget);
tree_view_class = GTK_WIDGET_GET_CLASS (tree_view);
- selection = gtk_tree_view_get_selection(tree_view);
+ selection = gtk_tree_view_get_selection (tree_view);
if (event->window != gtk_tree_view_get_bin_window (tree_view)) {
return FALSE;
@@ -487,6 +493,8 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
allow_drag = FALSE;
if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y,
&path, NULL, NULL, NULL)) {
+ /* Keep track of path of last click so double clicks only happen
+ * on the same item */
if ((event->button == 1 || event->button == 2) &&
event->type == GDK_BUTTON_PRESS) {
if (view->details->double_click_path[1]) {
@@ -498,9 +506,9 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
if (event->type == GDK_2BUTTON_PRESS) {
/* Double clicking does not trigger a D&D action. */
view->details->drag_button = 0;
- call_parent = TRUE;
if (view->details->double_click_path[1] &&
gtk_tree_path_compare (view->details->double_click_path[0], view->details->double_click_path[1]) == 0) {
+ /* NOTE: Activation can actually destroy the view if we're switching */
if (!button_event_modifies_selection (event)) {
if ((event->button == 1 || event->button == 3)) {
activate_selected_items (view);
@@ -517,46 +525,48 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba
}
}
}
- }
-
- /* We're going to filter out some situations where
- * we can't let the default code run because all
- * but one row would be would be deselected. We don't
- * want that; we want the right click menu or single
- * click to apply to everything that's currently selected. */
-
- if (event->button == 3 && gtk_tree_selection_path_is_selected (selection, path)) {
- call_parent = FALSE;
- }
-
- if ((event->button == 1 || event->button == 2) &&
- ((event->state & GDK_CONTROL_MASK) != 0 ||
- (event->state & GDK_SHIFT_MASK) == 0)) {
- view->details->row_selected_on_button_down = gtk_tree_selection_path_is_selected (selection, path);
- if (view->details->row_selected_on_button_down) {
- call_parent = FALSE;
- } else if ((event->state & GDK_CONTROL_MASK) != 0) {
+ tree_view_class->button_press_event (widget, event);
+ } else {
+
+ /* We're going to filter out some situations where
+ * we can't let the default code run because all
+ * but one row would be would be deselected. We don't
+ * want that; we want the right click menu or single
+ * click to apply to everything that's currently selected. */
+
+ if (event->button == 3 && gtk_tree_selection_path_is_selected (selection, path)) {
call_parent = FALSE;
- gtk_tree_selection_select_path (selection, path);
+ }
+
+ if ((event->button == 1 || event->button == 2) &&
+ ((event->state & GDK_CONTROL_MASK) != 0 ||
+ (event->state & GDK_SHIFT_MASK) == 0)) {
+ view->details->row_selected_on_button_down = gtk_tree_selection_path_is_selected (selection, path);
+ if (view->details->row_selected_on_button_down) {
+ call_parent = FALSE;
+ } else if ((event->state & GDK_CONTROL_MASK) != 0) {
+ call_parent = FALSE;
+ gtk_tree_selection_select_path (selection, path);
+ }
+ }
+
+ if (call_parent) {
+ tree_view_class->button_press_event (widget, event);
+ } else if (gtk_tree_selection_path_is_selected (selection, path)) {
+ gtk_widget_grab_focus (widget);
+ }
+
+ if ((event->button == 1 || event->button == 2) &&
+ event->type == GDK_BUTTON_PRESS) {
+ view->details->drag_started = FALSE;
+ view->details->drag_button = event->button;
+ view->details->drag_x = event->x;
+ view->details->drag_y = event->y;
+ }
+
+ if (event->button == 3) {
+ do_popup_menu (widget, view, event);
}
- }
-
- if (call_parent) {
- tree_view_class->button_press_event (widget, event);
- } else if (gtk_tree_selection_path_is_selected (selection, path)) {
- gtk_widget_grab_focus (widget);
- }
-
- if ((event->button == 1 || event->button == 2) &&
- event->type == GDK_BUTTON_PRESS) {
- view->details->drag_started = FALSE;
- view->details->drag_button = event->button;
- view->details->drag_x = event->x;
- view->details->drag_y = event->y;
- }
-
- if (event->button == 3) {
- do_popup_menu (widget, view, event);
}
gtk_tree_path_free (path);
@@ -1251,9 +1261,6 @@ set_zoom_level_from_metadata_and_preferences (FMListView *list_view)
get_default_zoom_level ());
fm_list_view_set_zoom_level (list_view, level, TRUE);
- /* reset the font size table for the new default zoom level */
- fm_list_view_scale_font_size (list_view, level, TRUE);
-
/* updated the rows after updating the font size */
gtk_tree_model_foreach (GTK_TREE_MODEL (list_view->details->model),
list_view_changed_foreach, NULL);
@@ -1596,9 +1603,8 @@ create_column_editor (FMListView *view)
}
static void
-visible_columns_callback (BonoboUIComponent *component,
- gpointer callback_data,
- const char *verb)
+action_visible_columns_callback (GtkAction *action,
+ gpointer callback_data)
{
FMListView *list_view;
@@ -1614,31 +1620,39 @@ visible_columns_callback (BonoboUIComponent *component,
}
}
+static GtkActionEntry list_view_entries[] = {
+ { "Visible Columns", NULL, /* name, stock id */
+ N_("Visible _Columns..."), NULL, /* label, accelerator */
+ N_("Select the columns visible in this folder"), /* tooltip */
+ G_CALLBACK (action_visible_columns_callback) },
+};
+
static void
fm_list_view_merge_menus (FMDirectoryView *view)
{
FMListView *list_view;
- Bonobo_UIContainer ui_container;
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("Visible Columns", visible_columns_callback),
- BONOBO_UI_VERB_END
- };
-
+ GtkUIManager *ui_manager;
+ GtkActionGroup *action_group;
+ const char *ui;
+
EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS, merge_menus, (view));
list_view = FM_LIST_VIEW (view);
- list_view->details->ui = bonobo_ui_component_new ("List View");
- ui_container = fm_directory_view_get_bonobo_ui_container (view);
- bonobo_ui_component_set_container (list_view->details->ui,
- ui_container, NULL);
- bonobo_object_release_unref (ui_container, NULL);
- bonobo_ui_util_set_ui (list_view->details->ui,
- DATADIR,
- "nautilus-list-view-ui.xml",
- "nautilus", NULL);
+ ui_manager = fm_directory_view_get_ui_manager (view);
+
+ action_group = gtk_action_group_new ("ListViewActions");
+ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+ list_view->details->list_action_group = action_group;
+ gtk_action_group_add_actions (action_group,
+ list_view_entries, G_N_ELEMENTS (list_view_entries),
+ list_view);
+
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ g_object_unref (action_group); /* owned by ui manager */
- bonobo_ui_component_add_verb_list_with_data (list_view->details->ui, verbs, view);
+ ui = nautilus_ui_string_get ("nautilus-list-view-ui.xml");
+ list_view->details->list_merge_id = gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
list_view->details->menus_ready = TRUE;
}
@@ -1684,27 +1698,25 @@ fm_list_view_reset_to_defaults (FMDirectoryView *view)
static void
fm_list_view_scale_font_size (FMListView *view,
- NautilusZoomLevel new_level,
- gboolean update_size_table)
+ NautilusZoomLevel new_level)
{
GList *l;
static gboolean first_time = TRUE;
static double pango_scale[7];
- int default_zoom_level, i;
+ int medium;
+ int i;
g_return_if_fail (new_level >= NAUTILUS_ZOOM_LEVEL_SMALLEST &&
new_level <= NAUTILUS_ZOOM_LEVEL_LARGEST);
- if (update_size_table || first_time) {
+ if (first_time) {
first_time = FALSE;
-
- default_zoom_level = get_default_zoom_level ();
-
- pango_scale[default_zoom_level] = PANGO_SCALE_MEDIUM;
- for (i = default_zoom_level; i > NAUTILUS_ZOOM_LEVEL_SMALLEST; i--) {
+ medium = NAUTILUS_ZOOM_LEVEL_SMALLER;
+ pango_scale[medium] = PANGO_SCALE_MEDIUM;
+ for (i = medium; i > NAUTILUS_ZOOM_LEVEL_SMALLEST; i--) {
pango_scale[i - 1] = (1 / 1.2) * pango_scale[i];
}
- for (i = default_zoom_level; i < NAUTILUS_ZOOM_LEVEL_LARGEST; i++) {
+ for (i = medium; i < NAUTILUS_ZOOM_LEVEL_LARGEST; i++) {
pango_scale[i + 1] = 1.2 * pango_scale[i];
}
}
@@ -1722,7 +1734,7 @@ fm_list_view_scale_font_size (FMListView *view,
static void
fm_list_view_set_zoom_level (FMListView *view,
NautilusZoomLevel new_level,
- gboolean always_set_level)
+ gboolean always_emit)
{
int icon_size;
int column, emblem_column;
@@ -1732,14 +1744,14 @@ fm_list_view_set_zoom_level (FMListView *view,
new_level <= NAUTILUS_ZOOM_LEVEL_LARGEST);
if (view->details->zoom_level == new_level) {
- if (always_set_level) {
- fm_directory_view_set_zoom_level (FM_DIRECTORY_VIEW(view), new_level);
+ if (always_emit) {
+ g_signal_emit_by_name (FM_DIRECTORY_VIEW(view), "zoom_level_changed");
}
return;
}
view->details->zoom_level = new_level;
- fm_directory_view_set_zoom_level (FM_DIRECTORY_VIEW(view), new_level);
+ g_signal_emit_by_name (FM_DIRECTORY_VIEW(view), "zoom_level_changed");
nautilus_file_set_integer_metadata
(fm_directory_view_get_directory_as_file (FM_DIRECTORY_VIEW (view)),
@@ -1757,7 +1769,7 @@ fm_list_view_set_zoom_level (FMListView *view,
NULL);
/* Scale text. */
- fm_list_view_scale_font_size (view, new_level, FALSE);
+ fm_list_view_scale_font_size (view, new_level);
/* Make all rows the same size. */
icon_size = nautilus_get_icon_size_for_zoom_level (new_level);
@@ -1784,8 +1796,21 @@ fm_list_view_bump_zoom_level (FMDirectoryView *view, int zoom_increment)
}
}
+static NautilusZoomLevel
+fm_list_view_get_zoom_level (FMDirectoryView *view)
+{
+ FMListView *list_view;
+
+ g_return_val_if_fail (FM_IS_LIST_VIEW (view), NAUTILUS_ZOOM_LEVEL_STANDARD);
+
+ list_view = FM_LIST_VIEW (view);
+
+ return list_view->details->zoom_level;
+}
+
static void
-fm_list_view_zoom_to_level (FMDirectoryView *view, int zoom_level)
+fm_list_view_zoom_to_level (FMDirectoryView *view,
+ NautilusZoomLevel zoom_level)
{
FMListView *list_view;
@@ -1869,9 +1894,9 @@ fm_list_view_start_renaming_file (FMDirectoryView *view, NautilusFile *file)
gtk_tree_path_free (path);
- nautilus_clipboard_set_up_editable_in_control
+ nautilus_clipboard_set_up_editable
(GTK_EDITABLE (entry),
- fm_directory_view_get_bonobo_control (view),
+ fm_directory_view_get_ui_manager (view),
FALSE);
}
@@ -1974,6 +1999,7 @@ static void
fm_list_view_dispose (GObject *object)
{
FMListView *list_view;
+ GtkUIManager *ui_manager;
list_view = FM_LIST_VIEW (object);
@@ -1987,12 +2013,13 @@ fm_list_view_dispose (GObject *object)
list_view->details->drag_dest = NULL;
}
- if (list_view->details->ui != NULL) {
- bonobo_ui_component_unset_container (list_view->details->ui, NULL);
- bonobo_object_unref (list_view->details->ui);
- list_view->details->ui = NULL;
+ ui_manager = fm_directory_view_get_ui_manager (FM_DIRECTORY_VIEW (list_view));
+ if (ui_manager != NULL) {
+ nautilus_ui_unmerge_ui (ui_manager,
+ &list_view->details->list_merge_id,
+ &list_view->details->list_action_group);
}
-
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -2035,12 +2062,14 @@ fm_list_view_emblems_changed (FMDirectoryView *directory_view)
}
static char *
-list_view_get_first_visible_file_callback (NautilusScrollPositionable *positionable,
- FMListView *list_view)
+fm_list_view_get_first_visible_file (NautilusView *view)
{
NautilusFile *file;
GtkTreePath *path;
GtkTreeIter iter;
+ FMListView *list_view;
+
+ list_view = FM_LIST_VIEW (view);
if (gtk_tree_view_get_path_at_pos (list_view->details->tree_view,
0, 0,
@@ -2069,7 +2098,8 @@ list_view_get_first_visible_file_callback (NautilusScrollPositionable *positiona
}
static void
-fm_list_view_scroll_to_file (FMListView *view, NautilusFile *file)
+fm_list_view_scroll_to_file (FMListView *view,
+ NautilusFile *file)
{
GtkTreePath *path;
GtkTreeIter iter;
@@ -2088,15 +2118,14 @@ fm_list_view_scroll_to_file (FMListView *view, NautilusFile *file)
}
static void
-list_view_scroll_to_file_callback (NautilusScrollPositionable *positionable,
- const char *uri,
- FMListView *list_view)
+list_view_scroll_to_file (NautilusView *view,
+ const char *uri)
{
NautilusFile *file;
if (uri != NULL) {
file = nautilus_file_get (uri);
- fm_list_view_scroll_to_file (list_view, file);
+ fm_list_view_scroll_to_file (FM_LIST_VIEW (view), file);
nautilus_file_unref (file);
}
}
@@ -2135,6 +2164,7 @@ fm_list_view_class_init (FMListViewClass *class)
fm_directory_view_class->sort_files = fm_list_view_sort_files;
fm_directory_view_class->sort_directories_first_changed = fm_list_view_sort_directories_first_changed;
fm_directory_view_class->start_renaming_file = fm_list_view_start_renaming_file;
+ fm_directory_view_class->get_zoom_level = fm_list_view_get_zoom_level;
fm_directory_view_class->zoom_to_level = fm_list_view_zoom_to_level;
fm_directory_view_class->emblems_changed = fm_list_view_emblems_changed;
@@ -2152,20 +2182,31 @@ fm_list_view_class_init (FMListViewClass *class)
(const GList **) &default_column_order_auto_value);
}
+static const char *
+fm_list_view_get_id (NautilusView *view)
+{
+ return FM_LIST_VIEW_ID;
+}
+
+
static void
-fm_list_view_instance_init (FMListView *list_view)
+fm_list_view_iface_init (NautilusViewIface *iface)
{
- NautilusView *nautilus_view;
+ fm_directory_view_init_view_iface (iface);
- list_view->details = g_new0 (FMListViewDetails, 1);
+ iface->get_view_id = fm_list_view_get_id;
+ iface->get_first_visible_file = fm_list_view_get_first_visible_file;
+ iface->scroll_to_file = list_view_scroll_to_file;
+ iface->get_title = NULL;
+}
- create_and_set_up_tree_view (list_view);
- list_view->details->positionable = nautilus_scroll_positionable_new ();
- nautilus_view = fm_directory_view_get_nautilus_view (FM_DIRECTORY_VIEW (list_view));
- bonobo_object_add_interface (BONOBO_OBJECT (nautilus_view),
- BONOBO_OBJECT (list_view->details->positionable));
+static void
+fm_list_view_init (FMListView *list_view)
+{
+ list_view->details = g_new0 (FMListViewDetails, 1);
+ create_and_set_up_tree_view (list_view);
eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER,
default_sort_order_changed_callback,
@@ -2192,10 +2233,49 @@ fm_list_view_instance_init (FMListView *list_view)
"icons_changed",
G_CALLBACK (icons_changed_callback),
list_view, 0);
- g_signal_connect_object (list_view->details->positionable, "get_first_visible_file",
- G_CALLBACK (list_view_get_first_visible_file_callback), list_view, 0);
- g_signal_connect_object (list_view->details->positionable, "scroll_to_file",
- G_CALLBACK (list_view_scroll_to_file_callback), list_view, 0);
list_view->details->type_select_state = NULL;
}
+
+static NautilusView *
+fm_list_view_create (NautilusWindowInfo *window)
+{
+ FMListView *view;
+
+ view = g_object_new (FM_TYPE_LIST_VIEW, "window", window, NULL);
+ g_object_ref (view);
+ gtk_object_sink (GTK_OBJECT (view));
+ return NAUTILUS_VIEW (view);
+}
+
+static gboolean
+fm_list_view_supports_uri (const char *uri,
+ GnomeVFSFileType file_type,
+ const char *mime_type)
+{
+ if (file_type == GNOME_VFS_FILE_TYPE_DIRECTORY) {
+ return TRUE;
+ }
+ if (g_str_has_prefix (uri, "trash:")) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static NautilusViewInfo fm_list_view = {
+ FM_LIST_VIEW_ID,
+ N_("List"),
+ N_("_List"),
+ fm_list_view_create,
+ fm_list_view_supports_uri
+};
+
+void
+fm_list_view_register (void)
+{
+ fm_list_view.label = _(fm_list_view.label);
+ fm_list_view.label_with_mnemonic = _(fm_list_view.label_with_mnemonic);
+
+ nautilus_view_factory_register (&fm_list_view);
+}
diff --git a/src/file-manager/fm-list-view.h b/src/file-manager/fm-list-view.h
index 5078dfa72..72dc07718 100644
--- a/src/file-manager/fm-list-view.h
+++ b/src/file-manager/fm-list-view.h
@@ -35,6 +35,8 @@
#define FM_IS_LIST_VIEW(obj) (GTK_CHECK_TYPE ((obj), FM_TYPE_LIST_VIEW))
#define FM_IS_LIST_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), FM_TYPE_LIST_VIEW))
+#define FM_LIST_VIEW_ID "OAFIID:Nautilus_File_Manager_List_View"
+
typedef struct FMListViewDetails FMListViewDetails;
typedef struct {
@@ -47,5 +49,6 @@ typedef struct {
} FMListViewClass;
GType fm_list_view_get_type (void);
+void fm_list_view_register (void);
#endif /* FM_LIST_VIEW_H */
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index cd4b23937..7ee0da117 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -76,11 +76,7 @@
#include <libnautilus-private/nautilus-module.h>
#include <libnautilus-private/nautilus-undo-signal-handlers.h>
#include <libnautilus-private/nautilus-mime-actions.h>
-#include <libnautilus-private/nautilus-view-identifier.h>
-#include <libnautilus/nautilus-undo.h>
-#include <libnautilus/nautilus-view.h>
-#include <bonobo/bonobo-widget.h>
-#include <bonobo/bonobo-exception.h>
+#include <libnautilus-private/nautilus-undo.h>
#include <string.h>
static GHashTable *windows;
diff --git a/src/file-manager/fm-properties-window.h b/src/file-manager/fm-properties-window.h
index b05c3b729..f2440b7d4 100644
--- a/src/file-manager/fm-properties-window.h
+++ b/src/file-manager/fm-properties-window.h
@@ -28,7 +28,6 @@
#include <gtk/gtkwindow.h>
#include <libnautilus-private/nautilus-file.h>
-#include <libnautilus/nautilus-view.h>
typedef struct FMPropertiesWindow FMPropertiesWindow;
diff --git a/src/file-manager/fm-search-list-view.c b/src/file-manager/fm-search-list-view.c
deleted file mode 100644
index ecf497f5f..000000000
--- a/src/file-manager/fm-search-list-view.c
+++ /dev/null
@@ -1,818 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* fm-search-list-view.c - implementation of list view of a virtual directory,
- based on FMListView.
-
- Copyright (C) 2000 Eazel, Inc.
-
- The Gnome Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The Gnome Library 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 Library General Public
- License along with the Gnome Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Authors: Rebecca Schulman <rebecka@eazel.com>
-*/
-
-#include <config.h>
-#include "fm-search-list-view.h"
-
-#include "fm-directory-view.h"
-#include "nautilus-indexing-info.h"
-#include <bonobo/bonobo-ui-util.h>
-#include <gtk/gtksignal.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include <libgnomevfs/gnome-vfs-result.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#ifdef HAVE_MEDUSA
-#include <libmedusa/medusa-indexed-search.h>
-#include <libmedusa/medusa-unindexed-search.h>
-#include <libmedusa/medusa-index-progress.h>
-#endif
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
-#include <libnautilus-private/nautilus-file-attributes.h>
-#include <libnautilus-private/nautilus-file-utilities.h>
-#include <libnautilus-private/nautilus-medusa-support.h>
-#include <eel/eel-glib-extensions.h>
-#include <eel/eel-gnome-extensions.h>
-#include <eel/eel-gtk-macros.h>
-#include <libnautilus-private/nautilus-search-uri.h>
-#include <eel/eel-stock-dialogs.h>
-#include <eel/eel-string.h>
-
-/* FIXME bugzilla.gnome.org 42815: This code uses part of the
- * NautilusSearchBarCriterion class, which is really for complex
- * search bar user interface. We only need to do some non-UI
- * manipulations of the search URI, so we can refactor the code, put
- * more into nautilus-search-uri.[ch] and get rid of this terrible
- * include statement.
- */
-#include "../nautilus-search-bar-criterion.h"
-
-/* Paths to use when creating & referring to Bonobo menu items */
-#define MENU_PATH_INDEXING_INFO "/menu/File/General Status Placeholder/Indexing Info"
-#define MENU_PATH_REVEAL_IN_NEW_WINDOW "/menu/File/Open Placeholder/Reveal"
-
-#define COMMAND_REVEAL_IN_NEW_WINDOW "/commands/Reveal"
-
-struct FMSearchListViewDetails {
- BonoboUIComponent *ui;
-};
-
-static void fm_search_list_view_init (gpointer object,
- gpointer klass);
-static void fm_search_list_view_class_init (gpointer klass);
-static void real_destroy (GtkObject *object);
-static void real_add_file (FMDirectoryView *view,
- NautilusFile *file);
-static gboolean real_file_still_belongs (FMDirectoryView *view,
- NautilusFile *file);
-#if GNOME2_CONVERSION_COMPLETE
-static void real_adding_file (FMListView *view,
- NautilusFile *file);
-static void real_removing_file (FMListView *view,
- NautilusFile *file);
-static int real_get_number_of_columns (FMListView *list_view);
-static int real_get_emblems_column (FMListView *list_view);
-static int real_get_link_column (FMListView *list_view);
-static char * real_get_default_sort_attribute (FMListView *view);
-static void real_get_column_specification (FMListView *list_view,
- int column_number,
- FMListViewColumn *specification);
-#endif
-static EelStringList * real_get_emblem_names_to_exclude (FMDirectoryView *view);
-static void real_file_limit_reached (FMDirectoryView *view);
-static void real_merge_menus (FMDirectoryView *view);
-static gboolean real_is_read_only (FMDirectoryView *view);
-static gboolean real_accepts_dragged_files (FMDirectoryView *view);
-static gboolean real_supports_properties (FMDirectoryView *view);
-static void load_location_callback (NautilusView *nautilus_view,
- char *location);
-static void real_update_menus (FMDirectoryView *view);
-#ifdef HAVE_MEDUSA
-static void display_system_services_are_disabled_dialog (gboolean unindexed_search_is_available);
-static void display_indexed_search_problems_dialog (gboolean unindexed_search_is_available);
-#endif
-static void reveal_selected_items_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb);
-
-
-EEL_CLASS_BOILERPLATE (FMSearchListView,
- fm_search_list_view,
- FM_TYPE_LIST_VIEW)
-
-
-#ifdef HAVE_MEDUSA
-static void
-report_index_age_as_status (NautilusView *nautilus_view)
-{
- char *last_indexing_time, *status_string;
-
- last_indexing_time = nautilus_indexing_info_get_last_index_time ();
- if (last_indexing_time) {
- status_string = g_strdup_printf (_("Search results may not include items modified after %s, "
- "when your drive was last indexed."),
- last_indexing_time);
-
- g_free (last_indexing_time);
- nautilus_view_report_status (nautilus_view, status_string);
- g_free (status_string);
- }
-}
-#endif
-
-static void
-load_location_callback (NautilusView *nautilus_view, char *location)
-{
-#ifdef HAVE_MEDUSA
- char *unescaped_location;
- gboolean unindexed_search_is_available_for_uri;
- gboolean indexed_search_is_available;
-
-
- nautilus_view_set_title (nautilus_view, _("Search Results"));
-
- unescaped_location = gnome_vfs_unescape_string (location, NULL);
- unindexed_search_is_available_for_uri = (medusa_unindexed_search_is_available_for_uri (unescaped_location) == GNOME_VFS_OK);
- g_free (unescaped_location);
-
- if (!nautilus_medusa_services_are_enabled ()) {
- display_system_services_are_disabled_dialog (unindexed_search_is_available_for_uri);
- }
- else {
- /* Fast (indexed) searching is enabled */
- indexed_search_is_available = medusa_indexed_search_is_available () == GNOME_VFS_OK;
-
- if (indexed_search_is_available) {
- report_index_age_as_status (nautilus_view);
- }
- else {
-
- display_indexed_search_problems_dialog (unindexed_search_is_available_for_uri);
- }
- }
-#else
- eel_show_error_dialog (_("Sorry, but the Medusa search service is not available."),
- _("Medusa is not installed."),
- _("Search Service Not Available"),
- NULL);
-#endif
-
-
-}
-
-/* FIXME bugzilla.gnome.org 45057: GnomeVFSResults may not be the
- best way to communicate an error code to
- a view */
-static void
-real_load_error (FMDirectoryView *nautilus_view,
- GnomeVFSResult result)
-{
- GtkDialog *load_error_dialog;
-
- /* Do not call parent's function; we handle all search errors
- * here and don't want fm-directory-view's default handling.
- */
-
- switch (result) {
- case GNOME_VFS_ERROR_SERVICE_OBSOLETE:
- load_error_dialog = eel_show_info_dialog (_("The search you have selected "
- "is newer than the index on your "
- "system. The search will return "
- "no results right now."),
- _("You can create a new "
- "index by running \"medusa-indexd\" as root "
- "on the command line."),
- _("Search For Items That Are Too New"),
- NULL);
- break;
- case GNOME_VFS_ERROR_TOO_BIG:
- eel_show_error_dialog (_("Every indexed file on your computer "
- "matches the criteria you selected. "),
- _("You can check the spelling on your selections "
- "or add more criteria to narrow your results."),
- _("Error During Search"),
- NULL);
- break;
- case GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE:
- /* FIXME: This dialog does not get shown because a slow search
- will be performed and will not return an error. */
- eel_show_error_dialog (_("Find cannot open your file system index. "
- "Your index may be missing or corrupt."),
- _("You can create a new index by running \"medusa-indexd\" as root "
- "on the command line."),
- _("Error Reading File Index"),
- NULL);
- break;
- case GNOME_VFS_ERROR_CANCELLED:
- break;
- default:
- eel_show_error_dialog (_("An error occurred while loading this search's contents."),
- gnome_vfs_result_to_string (result),
- _("Error During Search"),
- NULL);
- }
-}
-
-
-#ifdef HAVE_MEDUSA
-static void
-display_indexed_search_problems_dialog (gboolean backup_search_is_available)
-{
- const char *error_string, *detail_string, *title_string;
-
- if (medusa_indexed_search_system_index_files_look_available ()) {
- /* There is an index on the system, but there is no
- way to run a search anyways. The system is
- confused. Tell the user this. */
- error_string = backup_search_is_available
- ? N_("To do a fast search, Find requires an index "
- "of the files on your system.")
- : N_("To do a content search, Find requires an index "
- "of the files on your system.");
- detail_string = backup_search_is_available
- ? N_("Find can't access your index right now "
- "so a slower search will be performed that "
- "doesn't use the index.")
- : N_("Find can't access your index right now.");
- title_string = backup_search_is_available
- ? N_("Fast Searches Are Not Available")
- : N_("Content Searches Are Not Available");
- eel_show_error_dialog_with_details (error_string,
- detail_string,
- title_string,
- _("Your index files are available "
- "but the Medusa search daemon, which handles "
- "index requests, isn't running. "
- "To start this program, log in as root and "
- "enter this command at the command line:\n\n"
- "medusa-searchd"),
- NULL);
- }
- else {
- /* There is currently no index available, so we need to explain
- whether a new index needs to be made, or whether one is currently
- being made. */
- if (medusa_indexing_is_currently_in_progress ()) {
- error_string = backup_search_is_available
- ? N_("To do a fast search, Find requires an index "
- "of the files on your system. "
- "Your computer is currently creating that "
- "index.")
- : N_("To do a content search, Find requires an index "
- "of the content on your system. "
- "Your computer is currently creating that "
- "index.");
- detail_string = backup_search_is_available
- ? N_("Because Find cannot use an index, "
- "this search may take several "
- "minutes.")
- : N_("Content searches will be available "
- "when the index is complete.");
- title_string = backup_search_is_available
- ? N_("Indexed Searches Are Not Available")
- : N_("Content Searches Are Not Available");
- eel_show_error_dialog (error_string,
- detail_string,
- title_string,
- NULL);
- }
- else {
- error_string = backup_search_is_available
- ? N_("To do a fast search, Find requires an index "
- "of the files on your system. No index "
- "is available right now.")
- : N_("To do a content search, Find requires an index "
- "of the content on your system. No index is "
- "available right now.");
- detail_string = backup_search_is_available
- ? N_("You can create an "
- "index by running \"medusa-indexd\" as root "
- "on the command line. Until a complete index "
- "is available, searches will "
- "take several minutes.")
- : N_("You can create an "
- "index by running \"medusa-indexd\" as root "
- "on the command line. Until a complete index "
- "is available, content searches cannot be "
- "performed.");
- title_string = backup_search_is_available
- ? N_("Indexed Searches Are Not Available")
- : N_("Content Searches Are Not Available");
- eel_show_error_dialog (error_string,
- detail_string,
- title_string,
- NULL);
- }
- }
-
-}
-
-static void
-display_system_services_are_disabled_dialog (gboolean unindexed_search_is_available)
-{
- GtkDialog *dialog_shown;
- char *details_string;
-
- details_string = nautilus_medusa_get_explanation_of_enabling ();
- dialog_shown = eel_show_info_dialog_with_details (_("Fast searches are not enabled on your computer."),
- _("To do a fast search, Find requires an index of "
- "the files on your system. Your system administrator "
- "has disabled fast search on your computer, so no index "
- "is available."),
- _("Fast Searches Not Enabled"),
- details_string,
- NULL);
- g_free (details_string);
-}
-
-
-#endif
-
-static void
-fm_search_list_view_class_init (gpointer klass)
-{
- GtkObjectClass *object_class;
- FMDirectoryViewClass *fm_directory_view_class;
- FMListViewClass *fm_list_view_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
- fm_directory_view_class = FM_DIRECTORY_VIEW_CLASS (klass);
- fm_list_view_class = FM_LIST_VIEW_CLASS (klass);
-
- object_class->destroy = real_destroy;
-
- fm_directory_view_class->add_file = real_add_file;
- fm_directory_view_class->file_still_belongs = real_file_still_belongs;
- fm_directory_view_class->get_emblem_names_to_exclude =
- real_get_emblem_names_to_exclude;
- fm_directory_view_class->file_limit_reached = real_file_limit_reached;
- fm_directory_view_class->merge_menus = real_merge_menus;
- fm_directory_view_class->is_read_only = real_is_read_only;
- fm_directory_view_class->accepts_dragged_files =
- real_accepts_dragged_files;
- fm_directory_view_class->supports_properties =
- real_supports_properties;
- fm_directory_view_class->update_menus = real_update_menus;
- fm_directory_view_class->load_error = real_load_error;
-
-#if GNOME2_CONVERSION_COMPLETE
- fm_list_view_class->adding_file = real_adding_file;
- fm_list_view_class->removing_file = real_removing_file;
- fm_list_view_class->get_number_of_columns = real_get_number_of_columns;
- fm_list_view_class->get_emblems_column = real_get_emblems_column;
- fm_list_view_class->get_link_column = real_get_link_column;
- fm_list_view_class->get_column_specification = real_get_column_specification;
- fm_list_view_class->get_default_sort_attribute = real_get_default_sort_attribute;
-#endif
-}
-
-static void
-fm_search_list_view_init (gpointer object,
- gpointer klass)
-{
- FMSearchListView *search_view;
- NautilusView *nautilus_view;
- FMDirectoryView *directory_view;
-
- search_view = FM_SEARCH_LIST_VIEW (object);
- directory_view = FM_DIRECTORY_VIEW (object);
-
- search_view->details = g_new0 (FMSearchListViewDetails, 1);
-
- nautilus_view = fm_directory_view_get_nautilus_view (directory_view);
-
- g_signal_connect (nautilus_view, "load_location",
- G_CALLBACK (load_location_callback), NULL);
-}
-
-static void
-real_destroy (GtkObject *object)
-{
- FMSearchListView *search_view;
-
- search_view = FM_SEARCH_LIST_VIEW (object);
-
- if (search_view->details->ui != NULL) {
- bonobo_ui_component_unset_container (search_view->details->ui, NULL);
- bonobo_object_unref (search_view->details->ui);
- }
- g_free (search_view->details);
-
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-static EelStringList *
-real_get_emblem_names_to_exclude (FMDirectoryView *view)
-{
- g_assert (FM_IS_DIRECTORY_VIEW (view));
-
- /* Overridden to show even the trash emblem here */
- return NULL;
-}
-
-#if GNOME2_CONVERSION_COMPLETE
-
-static int
-real_get_number_of_columns (FMListView *view)
-{
- return 7;
-}
-
-static char *
-get_sort_attribute_from_search_criterion (const char *criterion)
-{
- if (criterion != NULL) {
- if (strcmp (criterion, NAUTILUS_SEARCH_URI_TEXT_NAME) == 0) {
- return g_strdup ("name");
- } else if (strcmp (criterion, NAUTILUS_SEARCH_URI_TEXT_TYPE) == 0) {
- return g_strdup ("type");
- } else if (strcmp (criterion, NAUTILUS_SEARCH_URI_TEXT_SIZE) == 0) {
- return g_strdup ("size");
- } else if (strcmp (criterion, NAUTILUS_SEARCH_URI_TEXT_EMBLEMS) == 0) {
- return g_strdup ("emblems");
- } else if (strcmp (criterion, NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED) == 0) {
- return g_strdup ("date_modified");
- }
- }
-
- return NULL;
-}
-
-static char *
-real_get_default_sort_attribute (FMListView *view)
-{
- char *uri;
- char *criterion;
- char *sort_attribute;
-
- uri = fm_directory_view_get_uri (FM_DIRECTORY_VIEW (view));
- criterion = nautilus_search_uri_get_first_criterion (uri);
- g_free (uri);
- sort_attribute = get_sort_attribute_from_search_criterion (criterion);
-
- /* Default to "name" if we're using some unknown search criterion, or
- * search criterion that doesn't correspond to any column.
- */
- if (sort_attribute == NULL) {
- return g_strdup ("name");
- }
-
- return sort_attribute;
-}
-
-static int
-real_get_link_column (FMListView *view)
-{
- return 1;
-}
-
-static int
-real_get_emblems_column (FMListView *view)
-{
- return 2;
-}
-
-static void
-real_get_column_specification (FMListView *view,
- int column_number,
- FMListViewColumn *specification)
-{
- switch (column_number) {
- case 0:
- fm_list_view_column_set (specification,
- "icon", NULL,
- NAUTILUS_FILE_SORT_BY_TYPE,
- 0, 0, 0, FALSE);
- break;
- case 1:
- fm_list_view_column_set (specification,
- "name", _("Name"),
- NAUTILUS_FILE_SORT_BY_DISPLAY_NAME,
- 30, 150, 300, FALSE);
- break;
- case 2:
- fm_list_view_column_set (specification,
- "emblems", _("Emblems"),
- NAUTILUS_FILE_SORT_BY_EMBLEMS,
- 20, 52, 300, FALSE);
- break;
- case 3:
- fm_list_view_column_set (specification,
- "where", _("Where"),
- NAUTILUS_FILE_SORT_BY_DIRECTORY,
- 30, 120, 500, FALSE);
- break;
- case 4:
- fm_list_view_column_set (specification,
- "size", _("Size"),
- NAUTILUS_FILE_SORT_BY_SIZE,
- 20, 55, 80, TRUE);
- break;
- case 5:
- fm_list_view_column_set (specification,
- "type", _("Type"),
- NAUTILUS_FILE_SORT_BY_TYPE,
- 20, 75, 200, FALSE);
- break;
- case 6:
- fm_list_view_column_set (specification,
- "date_modified", _("Date Modified"),
- NAUTILUS_FILE_SORT_BY_MTIME,
- 30, 75, 200, FALSE);
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
-#endif
-
-static void
-indexing_info_callback (BonoboUIComponent *component, gpointer data, const char *verb)
-{
- nautilus_indexing_info_show_dialog ();
-}
-
-static void
-compute_reveal_item_name_and_sensitivity (GList *selected_files,
- char **return_name_with_underscore,
- char **return_name_no_underscore,
- gboolean *return_sensitivity)
-{
- char *name_with_underscore;
- int count;
-
- g_assert (return_name_with_underscore != NULL || return_name_no_underscore != NULL);
- g_assert (return_sensitivity != NULL);
-
- count = g_list_length (selected_files);
- /* "Reveal in n New Windows" means open the parent folder for each
- * selected item in a separate new window, select each selected
- * item in its new window, and scroll as necessary to make those
- * items visible (this comment is to inform translators of this
- * tricky concept).
- */
- name_with_underscore = g_strdup_printf (ngettext("_Reveal in New Window",
- "Reveal in %d _New Windows",
- count),
- count);
-
- *return_sensitivity = selected_files != NULL;
-
- if (return_name_no_underscore != NULL) {
- *return_name_no_underscore = eel_str_strip_chr (name_with_underscore, '_');
- }
-
- if (return_name_with_underscore != NULL) {
- *return_name_with_underscore = name_with_underscore;
- } else {
- g_free (name_with_underscore);
- }
-}
-
-static void
-real_add_file (FMDirectoryView *view, NautilusFile *file)
-{
- char *fake_file_name;
- char *real_file_uri;
- NautilusFile *real_file;
-
- g_return_if_fail (FM_IS_SEARCH_LIST_VIEW (view));
-
- /* Get the real file that the funky search symbolic link file
- * refers to. The real file name is hacked into the name of the
- * search results virtual file.
- */
- fake_file_name = nautilus_file_get_name (file);
- real_file_uri = nautilus_get_target_uri_from_search_result_name (fake_file_name);
- real_file = nautilus_file_get (real_file_uri);
-
- /* We don't benefit from the filtering done in queue_pending_files,
- * since that's done on the fake file, so we do our own filtering here.
- */
- if (fm_directory_view_should_show_file (view, real_file)) {
- /* Tell the normal list view code to add this file. It will add
- * and ref it only if it's not already in the list.
- */
- EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS, add_file, (view, real_file));
- }
-
- g_free (fake_file_name);
- g_free (real_file_uri);
- nautilus_file_unref (real_file);
-}
-
-#if GNOME2_CONVERSION_COMPLETE
-
-static void
-real_adding_file (FMListView *view, NautilusFile *file)
-{
- GList *attributes;
-
- g_assert (FM_IS_SEARCH_LIST_VIEW (view));
- g_assert (NAUTILUS_IS_FILE (file));
-
- EEL_CALL_PARENT (FM_LIST_VIEW_CLASS, adding_file, (view, file));
-
- /* FIXME bugzilla.gnome.org 45059: this implies that positioning, custom icon, icon
- * stretching, etc, will be based on the real directory the file is in,
- * and won't be specific to the search directory. Is that OK?
- */
-
- g_signal_connect_object (G_OBJECT (file), "changed",
- G_CALLBACK (fm_directory_view_queue_file_change),
- view, G_CONNECT_SWAPPED);
-
- /* Monitor the things needed to get the right
- * icon. Also monitor a directory's item count because
- * the "size" attribute is based on that, and the file's metadata, and
- * possible custom icon.
- */
- attributes = nautilus_icon_factory_get_required_file_attributes ();
- attributes = g_list_prepend (attributes,
- NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT);
- attributes = g_list_prepend (attributes,
- NAUTILUS_FILE_ATTRIBUTE_METADATA);
- attributes = g_list_prepend (attributes,
- NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
- attributes = g_list_prepend (attributes,
- NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME);
- nautilus_file_monitor_add (file, view, attributes);
- g_list_free (attributes);
-}
-
-static void
-real_removing_file (FMListView *view, NautilusFile *file)
-{
- g_assert (FM_IS_SEARCH_LIST_VIEW (view));
- g_assert (NAUTILUS_IS_FILE (file));
-
- nautilus_file_monitor_remove (file, view);
- g_signal_handlers_disconnect_by_func
- (G_OBJECT (file), G_CALLBACK (fm_directory_view_queue_file_change), view);
- EEL_CALL_PARENT (FM_LIST_VIEW_CLASS, removing_file, (view, file));
-}
-
-#endif
-
-static gboolean
-real_file_still_belongs (FMDirectoryView *view, NautilusFile *file)
-{
- return !nautilus_file_is_gone (file);
-}
-
-static void
-real_file_limit_reached (FMDirectoryView *view)
-{
- g_assert (FM_IS_SEARCH_LIST_VIEW (view));
-
- /* Note that the number of items actually displayed varies somewhat due
- * to the way files are collected in batches. So you can't assume that
- * no more than the constant limit are displayed.
- */
- eel_show_warning_dialog (_("Nautilus found more search results than it can display."),
- _("Some matching items will not be displayed. "),
- _("Too Many Matches"),
- fm_directory_view_get_containing_window (view));
-}
-
-static void
-update_reveal_item (FMSearchListView *view)
-{
- GList *selected_files;
- char *label_with_underscore, *label_no_underscore;
- gboolean sensitive;
-
- g_assert (FM_IS_DIRECTORY_VIEW (view));
-
- selected_files = fm_directory_view_get_selection (FM_DIRECTORY_VIEW (view));
-
- compute_reveal_item_name_and_sensitivity
- (selected_files, &label_with_underscore, &label_no_underscore, &sensitive);
-
- nautilus_bonobo_set_sensitive (view->details->ui,
- COMMAND_REVEAL_IN_NEW_WINDOW,
- sensitive);
- nautilus_bonobo_set_label (view->details->ui, COMMAND_REVEAL_IN_NEW_WINDOW, label_no_underscore);
- nautilus_bonobo_set_label (view->details->ui, MENU_PATH_REVEAL_IN_NEW_WINDOW, label_with_underscore);
-
- g_free (label_with_underscore);
- g_free (label_no_underscore);
-
- nautilus_file_list_free (selected_files);
-}
-
-static void
-real_merge_menus (FMDirectoryView *view)
-{
- FMSearchListView *search_view;
- Bonobo_UIContainer ui_container;
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("Indexing Info", indexing_info_callback),
- BONOBO_UI_VERB ("Reveal", reveal_selected_items_callback),
- BONOBO_UI_VERB_END
- };
-
- EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS, merge_menus, (view));
-
- search_view = FM_SEARCH_LIST_VIEW (view);
-
- search_view->details->ui = bonobo_ui_component_new ("Search List View");
- ui_container = fm_directory_view_get_bonobo_ui_container (view);
- bonobo_ui_component_set_container (search_view->details->ui,
- ui_container, NULL);
- bonobo_object_release_unref (ui_container, NULL);
- bonobo_ui_util_set_ui (search_view->details->ui,
- DATADIR,
- "nautilus-search-list-view-ui.xml",
- "nautilus", NULL);
- bonobo_ui_component_add_verb_list_with_data (search_view->details->ui, verbs, view);
-}
-
-static gboolean
-real_is_read_only (FMDirectoryView *view)
-{
- /* The user is not allowed to modify the contents of a search
- * results view.
- */
- return TRUE;
-}
-
-static gboolean
-real_accepts_dragged_files (FMDirectoryView *view)
-{
- /* The user is not allowed to modify the contents of a search
- * results view.
- */
- return FALSE;
-}
-
-static gboolean
-real_supports_properties (FMDirectoryView *view)
-{
- /* Disable "Show Properties" menu item in this view, because changing
- * properties could cause the item to no longer match the search
- * criteria. Eventually we might want to solve this a different way,
- * perhaps by showing items that don't match the search criteria any
- * more a different way.
- */
- return FALSE;
-}
-
-static void
-real_update_menus (FMDirectoryView *view)
-{
- EEL_CALL_PARENT (FM_DIRECTORY_VIEW_CLASS, update_menus, (view));
-
- update_reveal_item (FM_SEARCH_LIST_VIEW (view));
-}
-
-static void
-reveal_selected_items_callback (BonoboUIComponent *component, gpointer user_data, const char *verb)
-{
- FMDirectoryView *directory_view;
- char *parent_uri;
- NautilusFile *file;
- GList *file_as_list;
- GList *selection;
- GList *node;
-
- g_assert (FM_IS_SEARCH_LIST_VIEW (user_data));
-
- directory_view = FM_DIRECTORY_VIEW (user_data);
-
- selection = fm_directory_view_get_selection (directory_view);
-
- if (fm_directory_view_confirm_multiple_windows (directory_view, g_list_length (selection))) {
- for (node = selection; node != NULL; node = node->next) {
- file = NAUTILUS_FILE (node->data);
- parent_uri = nautilus_file_get_parent_uri (file);
- if (parent_uri != NULL) {
- file_as_list = g_list_prepend (NULL, nautilus_file_get_uri (file));
- /* FIXME: match the current window type */
- nautilus_view_open_location
- (fm_directory_view_get_nautilus_view (directory_view),
- parent_uri,
- Nautilus_ViewFrame_OPEN_IN_SPATIAL,
- 0,
- file_as_list);
- eel_g_list_free_deep (file_as_list);
- }
- g_free (parent_uri);
- }
- }
-
- nautilus_file_list_free (selection);
-}
diff --git a/src/file-manager/fm-search-list-view.h b/src/file-manager/fm-search-list-view.h
deleted file mode 100644
index 45729dc7b..000000000
--- a/src/file-manager/fm-search-list-view.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* fm-search-list-view.h - interface for list view of a virtual directory.
-
- Copyright (C) 2000 Eazel, Inc.
-
- The Gnome Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The Gnome Library 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 Library General Public
- License along with the Gnome Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Authors: Rebecca Schulman <rebecka@eazel.com>
-*/
-
-#ifndef FM_SEARCH_LIST_VIEW_H
-#define FM_SEARCH_LIST_VIEW_H
-
-#include "fm-list-view.h"
-
-#define FM_TYPE_SEARCH_LIST_VIEW (fm_search_list_view_get_type ())
-#define FM_SEARCH_LIST_VIEW(obj) (GTK_CHECK_CAST ((obj), FM_TYPE_SEARCH_LIST_VIEW, FMSearchListView))
-#define FM_SEARCH_LIST_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), FM_TYPE_SEARCH_LIST_VIEW, FMSearch_ListViewClass))
-#define FM_IS_SEARCH_LIST_VIEW(obj) (GTK_CHECK_TYPE ((obj), FM_TYPE_SEARCH_LIST_VIEW))
-#define FM_IS_SEARCH_LIST_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), FM_TYPE_SEARCH_LIST_VIEW))
-
-typedef struct FMSearchListViewDetails FMSearchListViewDetails;
-
-typedef struct {
- FMListView parent_slot;
- FMSearchListViewDetails *details;
-} FMSearchListView;
-
-typedef struct {
- FMListViewClass parent_slot;
-} FMSearchListViewClass;
-
-/* GObject support */
-GType fm_search_list_view_get_type (void);
-
-#endif /* FM_SEARCH_LIST_VIEW_H */
diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c
index 2315c6efe..3856db94c 100644
--- a/src/file-manager/fm-tree-view.c
+++ b/src/file-manager/fm-tree-view.c
@@ -67,9 +67,20 @@
#include <libnautilus-private/nautilus-tree-view-drag-dest.h>
#include <libnautilus-private/nautilus-icon-factory.h>
#include <libnautilus-private/nautilus-cell-renderer-pixbuf-emblem.h>
+#include <libnautilus-private/nautilus-sidebar-provider.h>
+#include <libnautilus-private/nautilus-module.h>
+
+typedef struct {
+ GObject parent;
+} FMTreeViewProvider;
+
+typedef struct {
+ GObjectClass parent;
+} FMTreeViewProviderClass;
+
struct FMTreeViewDetails {
- GtkWidget *scrolled_window;
+ NautilusWindowInfo *window;
GtkTreeView *tree_widget;
GtkTreeModelSort *sort_model;
FMTreeModel *child_model;
@@ -116,8 +127,18 @@ static const GtkTargetEntry clipboard_targets[] = {
{ "x-special/gnome-copied-files", 0, GNOME_COPIED_FILES },
};
-BONOBO_CLASS_BOILERPLATE (FMTreeView, fm_tree_view,
- NautilusView, NAUTILUS_TYPE_VIEW)
+static void fm_tree_view_iface_init (NautilusSidebarIface *iface);
+static void sidebar_provider_iface_init (NautilusSidebarProviderIface *iface);
+static GType fm_tree_view_provider_get_type (void);
+
+G_DEFINE_TYPE_WITH_CODE (FMTreeView, fm_tree_view, GTK_TYPE_SCROLLED_WINDOW,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_SIDEBAR,
+ fm_tree_view_iface_init));
+#define parent_class fm_tree_view_parent_class
+
+G_DEFINE_TYPE_WITH_CODE (FMTreeViewProvider, fm_tree_view_provider, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_SIDEBAR_PROVIDER,
+ sidebar_provider_iface_init));
static gboolean
show_iter_for_file (FMTreeView *view, NautilusFile *file, GtkTreeIter *iter)
@@ -228,6 +249,16 @@ schedule_show_selection (FMTreeView *view)
}
static void
+schedule_select_and_show_location (FMTreeView *view, char *location)
+{
+ if (view->details->selection_location != NULL) {
+ g_free (view->details->selection_location);
+ }
+ view->details->selection_location = g_strdup (location);
+ schedule_show_selection (view);
+}
+
+static void
row_loaded_callback (GtkTreeModel *tree_model,
GtkTreeIter *iter,
FMTreeView *view)
@@ -292,7 +323,7 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
char *uri, *file_uri;
FMTreeView *view;
GdkScreen *screen;
- Nautilus_ViewFrame_OpenMode mode;
+ NautilusWindowOpenMode mode;
view = FM_TREE_VIEW (callback_data);
@@ -300,7 +331,7 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
g_assert (file == view->details->activation_file);
- mode = view->details->activation_in_new_window ? Nautilus_ViewFrame_OPEN_IN_NAVIGATION : Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE;
+ mode = view->details->activation_in_new_window ? NAUTILUS_WINDOW_OPEN_IN_NAVIGATION : NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE;
/* FIXME: reenable && !eel_uris_match_ignore_fragments (view->details->current_main_view_uri, uri) */
@@ -327,8 +358,8 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
/* Non-local executables don't get launched. They act like non-executables. */
if (file_uri == NULL) {
- nautilus_view_open_location
- (NAUTILUS_VIEW (view),
+ nautilus_window_info_open_location
+ (view->details->window,
uri,
mode,
0,
@@ -345,8 +376,8 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
g_free (view->details->selection_location);
}
view->details->selection_location = g_strdup (uri);
- nautilus_view_open_location
- (NAUTILUS_VIEW (view),
+ nautilus_window_info_open_location
+ (view->details->window,
uri,
mode,
0,
@@ -871,8 +902,8 @@ copy_or_cut_files (FMTreeView *view,
}
g_free (name);
- nautilus_view_report_status (NAUTILUS_VIEW (view),
- status_string);
+ nautilus_window_info_set_status (view->details->window,
+ status_string);
g_free (status_string);
}
@@ -940,8 +971,8 @@ paste_clipboard_data (FMTreeView *view,
}
if (item_uris == NULL|| destination_uri == NULL) {
- nautilus_view_report_status (NAUTILUS_VIEW (view),
- _("There is nothing on the clipboard to paste."));
+ nautilus_window_info_set_status (view->details->window,
+ _("There is nothing on the clipboard to paste."));
} else {
nautilus_file_operations_copy_move
(item_uris, NULL, destination_uri,
@@ -1205,6 +1236,7 @@ create_tree (FMTreeView *view)
GnomeVFSVolumeMonitor *volume_monitor;
char *home_uri;
GList *volumes, *l;
+ char *location;
view->details->child_model = fm_tree_model_new ();
view->details->sort_model = GTK_TREE_MODEL_SORT
@@ -1283,7 +1315,7 @@ create_tree (FMTreeView *view)
gtk_widget_show (GTK_WIDGET (view->details->tree_widget));
- gtk_container_add (GTK_CONTAINER (view->details->scrolled_window),
+ gtk_container_add (GTK_CONTAINER (view),
GTK_WIDGET (view->details->tree_widget));
g_signal_connect_object (gtk_tree_view_get_selection (GTK_TREE_VIEW (view->details->tree_widget)), "changed",
@@ -1297,28 +1329,30 @@ create_tree (FMTreeView *view)
"button_press_event", G_CALLBACK (button_pressed_callback),
view);
- schedule_show_selection (view);
+ location = nautilus_window_info_get_current_location (view->details->window);
+ schedule_select_and_show_location (view, location);
+ g_free (location);
}
static void
update_filtering_from_preferences (FMTreeView *view)
{
- Nautilus_ShowHiddenFilesMode mode;
+ NautilusWindowShowHiddenFilesMode mode;
if (view->details->child_model == NULL) {
return;
}
- mode = nautilus_view_get_show_hidden_files_mode (NAUTILUS_VIEW (view));
+ mode = nautilus_window_info_get_hidden_files_mode (view->details->window);
- if (mode == Nautilus_SHOW_HIDDEN_FILES_DEFAULT) {
+ if (mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) {
fm_tree_model_set_show_hidden_files
(view->details->child_model,
eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES));
} else {
fm_tree_model_set_show_hidden_files
(view->details->child_model,
- mode == Nautilus_SHOW_HIDDEN_FILES_ENABLE);
+ mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_ENABLE);
}
fm_tree_model_set_show_backup_files
(view->details->child_model,
@@ -1329,13 +1363,15 @@ update_filtering_from_preferences (FMTreeView *view)
}
static void
-tree_activate_callback (BonoboControl *control, gboolean activating, gpointer user_data)
+parent_set_callback (GtkWidget *widget,
+ GtkWidget *previous_parent,
+ gpointer callback_data)
{
FMTreeView *view;
- view = FM_TREE_VIEW (user_data);
+ view = FM_TREE_VIEW (callback_data);
- if (activating && view->details->tree_widget == NULL) {
+ if (widget->parent != NULL && view->details->tree_widget == NULL) {
create_tree (view);
update_filtering_from_preferences (view);
}
@@ -1348,41 +1384,31 @@ filtering_changed_callback (gpointer callback_data)
}
static void
-load_location_callback (FMTreeView *view, char *location)
+loading_uri_callback (NautilusWindowInfo *window,
+ char *location,
+ FMTreeView *view)
{
- if (view->details->selection_location != NULL) {
- g_free (view->details->selection_location);
- }
- view->details->selection_location = g_strdup (location);
-
- schedule_show_selection (view);
+ schedule_select_and_show_location (view, location);
}
static void
-fm_tree_view_instance_init (FMTreeView *view)
+fm_tree_view_init (FMTreeView *view)
{
- BonoboControl *control;
-
view->details = g_new0 (FMTreeViewDetails, 1);
-
- view->details->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
-
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (view->details->scrolled_window),
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (view),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (view), NULL);
+ gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (view), NULL);
- gtk_widget_show (view->details->scrolled_window);
-
- control = bonobo_control_new (view->details->scrolled_window);
- g_signal_connect_object (control, "activate",
- G_CALLBACK (tree_activate_callback), view, 0);
+ gtk_widget_show (GTK_WIDGET (view));
- nautilus_view_construct_from_bonobo_control (NAUTILUS_VIEW (view), control);
+ g_signal_connect_object (view, "parent_set",
+ G_CALLBACK (parent_set_callback), view, 0);
view->details->selection_location = NULL;
- g_signal_connect_object (view, "load_location",
- G_CALLBACK (load_location_callback), view, 0);
+
view->details->selecting = FALSE;
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
@@ -1391,13 +1417,6 @@ fm_tree_view_instance_init (FMTreeView *view)
filtering_changed_callback, view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES,
filtering_changed_callback, view);
- g_signal_connect_object (view, "show_hidden_files_mode_changed",
- G_CALLBACK (filtering_changed_callback), view, 0);
-
- nautilus_view_set_listener_mask
- (NAUTILUS_VIEW (view),
- NAUTILUS_VIEW_LISTEN_SHOW_HIDDEN_FILES_MODE);
-
g_signal_connect_object (nautilus_icon_factory_get(), "icons_changed",
G_CALLBACK (theme_changed_callback), view, 0);
@@ -1465,3 +1484,100 @@ fm_tree_view_class_init (FMTreeViewClass *class)
copied_files_atom = gdk_atom_intern ("x-special/gnome-copied-files", FALSE);
}
+
+static const char *
+fm_tree_view_get_sidebar_id (NautilusSidebar *sidebar)
+{
+ return TREE_SIDEBAR_ID;
+}
+
+static char *
+fm_tree_view_get_tab_label (NautilusSidebar *sidebar)
+{
+ return g_strdup (_("Tree"));
+}
+
+static GdkPixbuf *
+fm_tree_view_get_tab_icon (NautilusSidebar *sidebar)
+{
+ return NULL;
+}
+
+static void
+fm_tree_view_is_visible_changed (NautilusSidebar *sidebar,
+ gboolean is_visible)
+{
+ /* Do nothing */
+}
+
+static void
+hidden_files_mode_changed_callback (NautilusWindowInfo *window,
+ FMTreeView *view)
+{
+ update_filtering_from_preferences (view);
+}
+
+static void
+fm_tree_view_iface_init (NautilusSidebarIface *iface)
+{
+ iface->get_sidebar_id = fm_tree_view_get_sidebar_id;
+ iface->get_tab_label = fm_tree_view_get_tab_label;
+ iface->get_tab_icon = fm_tree_view_get_tab_icon;
+ iface->is_visible_changed = fm_tree_view_is_visible_changed;
+}
+
+static void
+fm_tree_view_set_parent_window (FMTreeView *sidebar,
+ NautilusWindowInfo *window)
+{
+ char *location;
+
+ sidebar->details->window = window;
+
+ g_signal_connect_object (window, "loading_uri",
+ G_CALLBACK (loading_uri_callback), sidebar, 0);
+ location = nautilus_window_info_get_current_location (window);
+ loading_uri_callback (window, location, sidebar);
+ g_free (location);
+
+ g_signal_connect_object (window, "hidden_files_mode_changed",
+ G_CALLBACK (hidden_files_mode_changed_callback), sidebar, 0);
+
+}
+
+static NautilusSidebar *
+fm_tree_view_create (NautilusSidebarProvider *provider,
+ NautilusWindowInfo *window)
+{
+ FMTreeView *sidebar;
+
+ sidebar = g_object_new (fm_tree_view_get_type (), NULL);
+ fm_tree_view_set_parent_window (sidebar, window);
+ g_object_ref (sidebar);
+ gtk_object_sink (GTK_OBJECT (sidebar));
+
+ return NAUTILUS_SIDEBAR (sidebar);
+}
+
+static void
+sidebar_provider_iface_init (NautilusSidebarProviderIface *iface)
+{
+ iface->create = fm_tree_view_create;
+}
+
+static void
+fm_tree_view_provider_init (FMTreeViewProvider *sidebar)
+{
+}
+
+static void
+fm_tree_view_provider_class_init (FMTreeViewProviderClass *class)
+{
+}
+
+void
+fm_tree_view_register (void)
+{
+ nautilus_module_add_type (fm_tree_view_provider_get_type ());
+}
+
diff --git a/src/file-manager/fm-tree-view.h b/src/file-manager/fm-tree-view.h
index 31ec9da54..12ec9c86b 100644
--- a/src/file-manager/fm-tree-view.h
+++ b/src/file-manager/fm-tree-view.h
@@ -29,7 +29,7 @@
#ifndef FM_TREE_VIEW_H
#define FM_TREE_VIEW_H
-#include <libnautilus/nautilus-view.h>
+#include <gtk/gtkscrolledwindow.h>
#define FM_TYPE_TREE_VIEW (fm_tree_view_get_type ())
#define FM_TREE_VIEW(obj) (GTK_CHECK_CAST ((obj), FM_TYPE_TREE_VIEW, FMTreeView))
@@ -37,17 +37,21 @@
#define FM_IS_TREE_VIEW(obj) (GTK_CHECK_TYPE ((obj), FM_TYPE_TREE_VIEW))
#define FM_IS_TREE_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), FM_TYPE_TREE_VIEW))
+#define TREE_SIDEBAR_ID "NautilusTreeSidebar"
+
typedef struct FMTreeViewDetails FMTreeViewDetails;
typedef struct {
- NautilusView parent;
+ GtkScrolledWindow parent;
+
FMTreeViewDetails *details;
} FMTreeView;
typedef struct {
- NautilusViewClass parent_class;
+ GtkScrolledWindowClass parent_class;
} FMTreeViewClass;
GType fm_tree_view_get_type (void);
+void fm_tree_view_register (void);
#endif /* FM_TREE_VIEW_H */
diff --git a/src/file-manager/nautilus-desktop-icon-view-ui.xml b/src/file-manager/nautilus-desktop-icon-view-ui.xml
index b1417c7df..c78e21ed1 100644
--- a/src/file-manager/nautilus-desktop-icon-view-ui.xml
+++ b/src/file-manager/nautilus-desktop-icon-view-ui.xml
@@ -1,60 +1,22 @@
-<Root>
-<commands>
- <cmd name="Change Background"
- _label="Change Desktop _Background"
- _tip="Show a window that lets you set your desktop background's pattern or color"/>
- <cmd name="Close" sensitive="0"/>
- <cmd name="Add Bookmark" sensitive="0"/>
- <cmd name="Empty Trash Conditional"
- _label="Empty Trash"
- _tip="Delete all items in the Trash"/>
- <cmd name="New Terminal"
- _label="Open T_erminal"
- _tip="Open a new GNOME terminal window"/>
- <cmd name="New Launcher Desktop"
- _label="Create L_auncher"
- _tip="Create a new launcher"/>
- <cmd name="Reset Background"
- _label="Use _Default Background"
- _tip="Use the default desktop background"/>
-</commands>
-<menu>
- <!-- By re-labelling these submenus to names without underscores, we
- prevent the user from bringing up the otherwise-invisible menu bar
- menus on the desktop from the keyboard. Setting the labels to "" in
- code does not work (presumably Bonobo bug), but doing so here does.
- -->
- <submenu name="File" label=""/>
- <submenu name="Edit" label=""/>
- <submenu name="View" label=""/>
- <submenu name="Go" label=""/>
- <submenu name="Bookmarks" label=""/>
- <submenu name="Profiler" label=""/>
- <submenu name="Help" label=""/>
- <submenu name="Preferences" label=""/>
-</menu>
-<popups>
- <popup name="background">
- <placeholder name="Before Zoom Items">
- <placeholder name="New Window Items">
- <menuitem name="New Terminal" verb="New Terminal"/>
- </placeholder>
- <placeholder name="New Object Items">
- <menuitem name="New Launcher" verb="New Launcher Desktop"/>
- </placeholder>
+<ui>
+<popup name="background">
+ <placeholder name="Before Zoom Items">
+ <placeholder name="New Window Items">
+ <menuitem name="New Terminal" action="New Terminal"/>
</placeholder>
- <placeholder name="After Zoom Items">
- <placeholder name="Background Items">
- <menuitem name="Use Default Background" verb="Reset Background"/>
- <menuitem name="Change Background" verb="Change Background"/>
- </placeholder>
+ <placeholder name="New Object Items">
+ <menuitem name="New Launcher" action="New Launcher Desktop"/>
</placeholder>
- </popup>
-
- <popup name="selection">
- <placeholder name="Empty Trash Holder" delimit="top">
- <menuitem name="Empty Trash" verb="Empty Trash Conditional"/>
+ </placeholder>
+ <placeholder name="After Zoom Items">
+ <placeholder name="Background Items">
+ <menuitem name="Change Background" action="Change Background"/>
</placeholder>
- </popup>
-</popups>
-</Root>
+ </placeholder>
+</popup>
+<popup name="selection">
+ <placeholder name="Empty Trash Holder">
+ <menuitem name="Empty Trash" action="Empty Trash Conditional"/>
+ </placeholder>
+</popup>
+</ui>
diff --git a/src/file-manager/nautilus-directory-view-ui.xml b/src/file-manager/nautilus-directory-view-ui.xml
index bac7f6969..83b9aee2c 100644
--- a/src/file-manager/nautilus-directory-view-ui.xml
+++ b/src/file-manager/nautilus-directory-view-ui.xml
@@ -1,354 +1,151 @@
-<Root>
-<commands>
- <cmd name="Rename"
- _label="_Rename..."
- _tip="Rename selected item"/>
- <cmd name="Create Link"
- _label="Ma_ke Link"
- _tip="Create a symbolic link for each selected item"/>
- <cmd name="Delete"
- _label="_Delete"
- _tip="Delete each selected item, without moving to the Trash"/>
- <cmd name="Duplicate"
- _label="D_uplicate"
- _tip="Duplicate each selected item"/>
- <cmd name="Empty Trash"
- _label="_Empty Trash"
- _tip="Delete all items in the Trash"/>
- <cmd name="New Folder"
- _label="Create _Folder"
- _tip="Create a new empty folder inside this folder"/>
- <cmd name="New Empty File"
- _label="_Empty File"
- _tip="Create a new empty file inside this folder"/>
- <cmd name="New Launcher"
- _label="Create L_auncher"
- _tip="Create a new launcher"/>
- <cmd name="Edit Launcher"
- _label="Edit Launcher"
- _tip="Edit the launcher information"/>
- <cmd name="Open"
- _label="_Open"
- _tip="Open the selected item in this window"/>
- <cmd name="OpenAlternate"
- _label="Open in Navigation Window"
- _tip="Open each selected item in a navigation window"/>
- <cmd name="Open Scripts Folder"
- _label="_Open Scripts Folder"
- _tip="Show the folder containing the scripts that appear in this menu"/>
- <cmd name="OtherApplication"
- _label="Open with Other _Application..."
- _tip="Choose another application with which to open the selected item"/>
- <cmd name="Show Hidden Files"
- _label="Show _Hidden Files"
- _tip="Toggles the display of hidden files in the current window"/>
- <cmd name="Reset to Defaults"
- _label="Reset View to _Defaults"
- _tip="Reset sorting order and zoom level to match preferences for this view"/>
- <cmd name="Reset Background"
- _label="Use _Default Background"
- _tip="Use the default background for this location"/>
- <cmd name="Cut Files"
- _label="Cu_t Files"
- _tip="Prepare the selected files to be moved with a Paste Files command"/>
- <cmd name="Copy Files"
- _label="_Copy Files"
- _tip="Prepare the selected files to be copied with a Paste Files command"/>
- <cmd name="Paste Files"
- _label="_Paste Files"
- _tip="Move or copy files previously selected by a Cut Files or Copy Files command"/>
- <cmd name="Paste Files Into"
- _label="_Paste Files Into Folder"
- _tip="Move or copy files previously selected by a Cut Files or Copy Files command into the selected folder"/>
- <cmd name="Select All"
- _label="Select _All Files"
- _tip="Select all items in this window"/>
- <cmd name="Select Pattern"
- _label="Select _Pattern"
- _tip="Select items in this window matching a given pattern"/>
- <cmd name="Properties"
- _label="_Properties"
- _tip="View or modify the properties of each selected item"/>
- <cmd name="Trash"
- _label="Mo_ve to Trash"
- _tip="Move each selected item to the Trash"/>
- <cmd name="Unmount Volume Conditional"
- _label="_Unmount Volume"
- _tip="Unmount the selected volume"/>
- <cmd name="Mount Volume Conditional"
- _label="_Mount Volume"
- _tip="Mount the selected volume"/>
- <cmd name="Format Conditional"
- _label="_Format"
- _tip="Format the selected volume"/>
- <cmd name="Protect Conditional"
- _label="Prot_ect"
- _tip="Protect the selected volume"/>
- <cmd name="Media Properties Conditional"
- _label="Medi_a Properties"
- _tip="Show media properties for the selected volume"/>
- <cmd name="Connect To Server Link Conditional"
- _label="Connect To This Server"
- _tip="Make a permanent connection to this server"/>
-</commands>
-<keybindings>
- <accel name="*Control*BackSpace" verb="Trash"/>
- <accel name="*Control*T" verb="Trash"/>
- <accel name="KP_Delete" verb="Trash"/>
- <accel name="Delete" verb="Trash"/>
- <accel name="*Shift*KP_Delete" verb="Delete"/>
- <accel name="*Shift*Delete" verb="Delete"/>
- <accel name="*Alt*Down" verb="Open"/>
- <accel name="*Alt**Shift*Down" verb="OpenCloseParent"/>
- <accel name="*Control*i" verb="Properties"/>
- <accel name="*Shift**Control*n" verb="New Folder"/>
- <accel name="*Control*o" verb="Open"/>
- <accel name="*Control**Shift*o" verb="OpenAlternate"/>
- <accel name="*Alt*Return" verb="Properties"/>
- <accel name="*Control*x" verb="Cut Files"/>
- <accel name="*Control*c" verb="Copy Files"/>
- <accel name="*Control*v" verb="Paste Files"/>
- <accel name="*Control*m" verb="Create Link"/>
- <accel name="F2" verb="Rename"/>
- <accel name="*Control*a" verb="Select All"/>
- <accel name="*Control*s" verb="Select Pattern"/>
-</keybindings>
-<menu>
- <submenu name="File">
-
+<ui>
+<accelerator action="OpenAccel"/>
+<accelerator action="OpenCloseParent"/>
+<accelerator action="PropertiesAccel"/>
+<menubar name="MenuBar">
+ <menu action="File">
<placeholder name="New Items Placeholder">
- <menuitem name="New Folder"
- accel="*Shift**Control*n"
- verb="New Folder"/>
- <submenu name="New Documents"
- _label="Create _Document">
- <menuitem name="No Templates"
- _label="No templates Installed"
- sensitive="0"/>
- <placeholder name="New Documents Placeholder" delimit="none"/>
+ <menuitem name="New Folder" action="New Folder"/>
+ <menu action="New Documents">
+ <menuitem name="No Templates" action="No Templates"/>
+ <placeholder name="New Documents Placeholder"/>
<separator name="After New Documents"/>
- <menuitem name="New Empty File"
- verb="New Empty File"/>
- </submenu>
- <menuitem name="New Launcher"
- pixtype="stock" pixname="gtk-new"
- verb="New Launcher"/>
+ <menuitem name="New Empty File" action="New Empty File"/>
+ </menu>
+ <menuitem name="New Launcher" action="New Launcher"/>
</placeholder>
<placeholder name="Open Placeholder">
- <menuitem name="Open"
- accel="*Control*o"
- pixtype="stock" pixname="gtk-open"
- verb="Open"/>
- <menuitem name="OpenAlternate"
- accel="*Control**Shift*o"
- verb="OpenAlternate"/>
- <placeholder name="Applications Placeholder" delimit="top"/>
- <submenu name="Open With"
- _label="Open Wit_h"
- _tip="Choose a program with which to open the selected item">
- <placeholder name="Applications Placeholder" delimit="none"/>
- <separator/>
- <menuitem name="OtherApplication"
- verb="OtherApplication"/>
- </submenu>
+ <menuitem name="Open" action="Open"/>
+ <menuitem name="OpenAlternate" action="OpenAlternate"/>
+ <placeholder name="Applications Placeholder">
+ </placeholder>
+ <menu action="Open With">
+ <placeholder name="Applications Placeholder"/>
+ <separator name="Open With Separator"/>
+ <menuitem name="OtherApplication" action="OtherApplication1"/>
+ </menu>
<placeholder name="OtherApplicationPlaceholder">
- <menuitem name="OtherApplication"
- verb="OtherApplication"/>
+ <menuitem name="OtherApplication" action="OtherApplication2"/>
</placeholder>
- <menuitem name="Edit Launcher"
- verb="Edit Launcher"/>
- <submenu name="Scripts"
- _label="_Scripts"
- _tip="Run or manage scripts from ~/Nautilus/scripts">
- <placeholder name="Scripts Placeholder" delimit="none"/>
+ <menu action="Scripts">
+ <placeholder name="Scripts Placeholder"/>
<separator name="After Scripts"/>
- <menuitem name="Open Scripts Folder"
- verb="Open Scripts Folder"/>
- </submenu>
+ <menuitem name="Open Scripts Folder" action="Open Scripts Folder"/>
+ </menu>
</placeholder>
-
<placeholder name="File Items Placeholder">
- <menuitem name="Properties"
- pixtype="stock" pixname="gtk-properties"
- accel="*Alt*Return"
- verb="Properties"/>
+ <menuitem name="Properties" action="Properties"/>
</placeholder>
<placeholder name="Global File Items Placeholder">
- <menuitem name="Empty Trash"
- verb="Empty Trash"/>
+ <menuitem name="Empty Trash" action="Empty Trash"/>
+ </placeholder>
+ </menu>
+ <menu action="Edit">
+ <placeholder name="Clipboard Actions">
+ <menuitem name="Cut" action="Cut"/>
+ <menuitem name="Copy" action="Copy"/>
+ <menuitem name="Paste" action="Paste"/>
</placeholder>
- </submenu>
-
- <submenu name="Edit">
- <menuitem name="Cut"
- accel="*Control*x"
- pixtype="stock" pixname="gtk-cut"
- verb="Cut Files"/>
- <menuitem name="Copy"
- accel="*Control*c"
- pixtype="stock" pixname="gtk-copy"
- verb="Copy Files"/>
- <menuitem name="Paste"
- accel="*Control*v"
- pixtype="stock" pixname="gtk-paste"
- verb="Paste Files"/>
-
<placeholder name="Select Items">
- <menuitem name="Select All"
- accel="*Control*a"
- verb="Select All"/>
- <menuitem name="Select Pattern"
- accel="*Control*s"
- verb="Select Pattern"/>
+ <menuitem name="Select All" action="Select All"/>
+ <menuitem name="Select Pattern" action="Select Pattern"/>
</placeholder>
-
<placeholder name="File Items Placeholder">
- <menuitem name="Duplicate"
- verb="Duplicate"/>
- <menuitem name="Create Link"
- accel="*Control*m"
- verb="Create Link"/>
- <menuitem name="Rename"
- accel="F2"
- verb="Rename"/>
+ <menuitem name="Duplicate" action="Duplicate"/>
+ <menuitem name="Create Link" action="Create Link"/>
+ <menuitem name="Rename"action="Rename"/>
</placeholder>
-
<placeholder name="Dangerous File Items Placeholder">
- <menuitem name="Trash"
- pixtype="stock" pixname="gtk-delete"
- verb="Trash"/>
- <menuitem name="Delete"
- accel="*Shift*Delete"
- verb="Delete"/>
+ <menuitem name="Trash" action="Trash"/>
+ <menuitem name="Delete" action="Delete"/>
</placeholder>
-
<placeholder name="Extension Actions"/>
- </submenu>
-
- <submenu name="View">
+ </menu>
+ <menu action="View">
<placeholder name="View Preferences Placeholder">
- <menuitem name="Reset to Defaults"
- verb="Reset to Defaults"/>
- <menuitem name="Show Hidden Files"
- type="toggle"
- accel="*Control*h"
- verb="Show Hidden Files"/>
- </placeholder>
- </submenu>
-</menu>
-<popups>
- <popup name="background">
- <placeholder name="Before Zoom Items">
- <placeholder name="New Object Items">
- <menuitem name="New Folder"
- verb="New Folder"/>
- <menuitem name="New Launcher"
- pixtype="stock" pixname="gtk-new"
- verb="New Launcher"/>
- </placeholder>
- <submenu name="New Documents"
- _label="Create _Document">
- <menuitem name="No Templates"
- _label="No templates Installed"
- sensitive="0"/>
- <placeholder name="New Documents Placeholder" delimit="none"/>
- <separator name="After New Documents"/>
- <menuitem name="New Empty File"
- verb="New Empty File"/>
- </submenu>
- <submenu name="Scripts"
- _label="_Scripts"
- _tip="Run or manage scripts from ~/Nautilus/scripts"
- tearoff="0">
- <placeholder name="Scripts Placeholder" delimit="none"/>
- <separator name="After Scripts"/>
- <menuitem name="Open Scripts Folder" verb="Open Scripts Folder"/>
- </submenu>
- <placeholder name="View Items" delimit="top"/>
- <placeholder name="File Clipboard Actions" delimit="top">
- <menuitem name="Paste Files"
- pixtype="stock" pixname="gtk-paste"
- verb="Paste Files"/>
- </placeholder>
- </placeholder>
- <placeholder name="After Zoom Items">
- <placeholder name="Background Items" delimit="none">
- <menuitem name="Use Default Background" verb="Reset Background"/>
- </placeholder>
- </placeholder>
- </popup>
-
- <popup name="selection" tearoff="0">
- <placeholder name="Open Placeholder" delimit="none">
- <menuitem name="Open"
- pixtype="stock" pixname="gtk-open"
- verb="Open"/>
- <menuitem name="OpenAlternate"
- verb="OpenAlternate"/>
- <placeholder name="Applications Placeholder" delimit="top"/>
- <submenu name="Open With"
- _label="Open Wit_h"
- tearoff="0"
- _tip="Choose a program with which to open the selected item">
- <placeholder name="Applications Placeholder" delimit="none"/>
- <separator/>
- <menuitem name="OtherApplication" verb="OtherApplication"/>
- </submenu>
- <placeholder name="OtherApplicationPlaceholder">
- <menuitem name="OtherApplication"
- verb="OtherApplication"/>
- </placeholder>
- <menuitem name="Edit Launcher"
- verb="Edit Launcher"/>
- <submenu name="Scripts"
- _label="_Scripts"
- _tip="Run or manage scripts from ~/Nautilus/scripts"
- tearoff="0">
- <placeholder name="Scripts Placeholder" delimit="none"/>
- <separator name="After Scripts"/>
- <menuitem name="Open Scripts Folder" verb="Open Scripts Folder"/>
- </submenu>
-
+ <menuitem name="Reset to Defaults" action="Reset to Defaults"/>
+ <menuitem name="Show Hidden Files" action="Show Hidden Files"/>
</placeholder>
- <placeholder name="File Clipboard Actions" delimit="top">
- <menuitem name="Cut Files"
- pixtype="stock" pixname="gtk-cut"
- verb="Cut Files"/>
- <menuitem name="Copy Files"
- pixtype="stock" pixname="gtk-copy"
- verb="Copy Files"/>
- <menuitem name="Paste Files Into"
- pixtype="stock" pixname="gtk-paste"
- verb="Paste Files Into"/>
+ </menu>
+</menubar>
+<popup name="background">
+ <placeholder name="Before Zoom Items">
+ <placeholder name="New Object Items">
+ <menuitem name="New Folder" action="New Folder"/>
+ <menuitem name="New Launcher" action="New Launcher"/>
+ <menu action="New Documents">
+ <menuitem name="No Templates" action="No Templates"/>
+ <placeholder name="New Documents Placeholder"/>
+ <separator name="After New Documents"/>
+ <menuitem name="New Empty File" action="New Empty File"/>
+ </menu>
+ <menu action="Scripts">
+ <placeholder name="Scripts Placeholder"/>
+ <separator name="After Scripts"/>
+ <menuitem name="Open Scripts Folder" action="Open Scripts Folder"/>
+ </menu>
</placeholder>
- <placeholder name="File Actions" delimit="top">
- <menuitem name="Create Link" verb="Create Link"/>
- <menuitem name="Rename" verb="Rename"/>
+ <separator name="View items separator"/>
+ <placeholder name="View Items"/>
+ <separator name="Clipboard separator"/>
+ <placeholder name="File Clipboard Actions">
+ <menuitem name="Paste" action="Paste"/>
</placeholder>
- <placeholder name="Dangerous File Actions" delimit="top">
- <menuitem name="Trash"
- pixtype="stock" pixname="gtk-delete"
- verb="Trash"/>
- <menuitem name="Delete" verb="Delete"/>
+ </placeholder>
+ <placeholder name="After Zoom Items">
+ <placeholder name="Background Items">
+ <menuitem name="Use Default Background" action="Reset Background"/>
</placeholder>
-
- <placeholder name="Icon Appearance Items" delimit="top">
+ </placeholder>
+</popup>
+<popup name="selection">
+ <placeholder name="Open Placeholder">
+ <menuitem name="Open" action="Open"/>
+ <menuitem name="OpenAlternate" action="OpenAlternate"/>
+ <separator name="applications separator"/>
+ <placeholder name="Applications Placeholder"/>
+ <menu action="Open With">
+ <placeholder name="Applications Placeholder"/>
+ <separator name="open with separator"/>
+ <menuitem name="OtherApplication" action="OtherApplication1"/>
+ </menu>
+ <placeholder name="OtherApplicationPlaceholder">
+ <menuitem name="OtherApplication2" action="OtherApplication2"/>
</placeholder>
-
- <placeholder name="Extension Actions" delimit="top"/>
- <separator/>
-
- <menuitem name="Properties"
- pixtype="stock" pixname="gtk-properties"
- verb="Properties"/>
- <placeholder name="Removabel Media Holder" delimit="top">
- <menuitem name="Mount Volume" verb="Mount Volume Conditional"/>
- <menuitem name="Unmount Volume" verb="Unmount Volume Conditional"/>
- <menuitem name="Protect Media" verb="Protect Conditional"/>
- <menuitem name="Format Media" verb="Format Conditional"/>
- <menuitem name="Media Properties" verb="Media Properties Conditional"/>
- </placeholder>
- <menuitem name="Connect To Server Link" verb="Connect To Server Link Conditional"/>
- </popup>
-</popups>
-</Root>
+ <menu action="Scripts">
+ <placeholder name="Scripts Placeholder"/>
+ <separator name="After Scripts"/>
+ <menuitem name="Open Scripts Folder" action="Open Scripts Folder"/>
+ </menu>
+ </placeholder>
+ <separator name="Clipboard separator"/>
+ <placeholder name="File Clipboard Actions">
+ <menuitem name="Cut" action="Cut"/>
+ <menuitem name="Copy" action="Copy"/>
+ <menuitem name="Paste Files Into" action="Paste Files Into"/>
+ </placeholder>
+ <separator name="File actions separator"/>
+ <placeholder name="File Actions">
+ <menuitem name="Create Link" action="Create Link"/>
+ <menuitem name="Rename" action="Rename"/>
+ </placeholder>
+ <separator name="Dangerous separator"/>
+ <placeholder name="Dangerous File Actions">
+ <menuitem name="Trash" action="Trash"/>
+ <menuitem name="Delete" action="Delete"/>
+ </placeholder>
+ <separator name="Appearande separator"/>
+ <placeholder name="Icon Appearance Items">
+ </placeholder>
+ <separator name="Extension actions separator"/>
+ <placeholder name="Extension Actions"/>
+ <separator name="Properties separator"/>
+ <menuitem name="Properties" action="Properties"/>
+ <separator name="Removable separator"/>
+ <placeholder name="Removabel Media Holder">
+ <menuitem name="Mount Volume" action="Mount Volume"/>
+ <menuitem name="Unmount Volume" action="Unmount Volume"/>
+ </placeholder>
+ <menuitem name="Connect To Server Link" action="Connect To Server Link"/>
+</popup>
+</ui>
diff --git a/src/file-manager/nautilus-icon-view-ui.xml b/src/file-manager/nautilus-icon-view-ui.xml
index 15206ec7e..9897f9e4d 100644
--- a/src/file-manager/nautilus-icon-view-ui.xml
+++ b/src/file-manager/nautilus-icon-view-ui.xml
@@ -1,138 +1,54 @@
-<Root>
-<commands>
- <cmd name="Stretch"
- _label="Str_etch Icon"
- _tip="Make the selected icon stretchable"/>
- <cmd name="Unstretch"
- _label="Restore Icons' Original Si_zes"
- _tip="Restore each selected icon to its original size"/>
- <cmd name="Manual Layout"
- _label="_Manually"
- _tip="Leave icons wherever they are dropped"/>
- <cmd name="Sort by Name"
- _label="By _Name"
- _tip="Keep icons sorted by name in rows"/>
- <cmd name="Sort by Size"
- _label="By _Size"
- _tip="Keep icons sorted by size in rows"/>
- <cmd name="Sort by Type"
- _label="By _Type"
- _tip="Keep icons sorted by type in rows"/>
- <cmd name="Sort by Modification Date"
- _label="By Modification _Date"
- _tip="Keep icons sorted by modification date in rows"/>
- <cmd name="Sort by Emblems"
- _label="By _Emblems"
- _tip="Keep icons sorted by emblems in rows"/>
- <cmd name="Keep Aligned"
- _label="_Keep Aligned"
- _tip="Keep icons lined up on a grid"/>
- <cmd name="Tighter Layout"
- _label="Compact _Layout"
- _tip="Toggle using a tighter layout scheme"/>
- <cmd name="Reversed Order"
- _label="Re_versed Order"
- _tip="Display icons in the opposite order"/>
- <cmd name="Clean Up"
- _label="Clean _Up by Name"
- _tip="Reposition icons to better fit in the window and avoid overlapping"/>
-</commands>
-<menu>
- <submenu name="Edit">
+<ui>
+<menubar name="MenuBar">
+ <menu action="Edit">
<placeholder name="Edit Items Placeholder">
- <menuitem name="Stretch"
- verb="Stretch"/>
- <menuitem name="Unstretch"
- verb="Unstretch"/>
+ <menuitem name="Stretch" action="Stretch"/>
+ <menuitem name="Unstretch" action="Unstretch"/>
</placeholder>
-
- </submenu>
-
- <submenu name="View">
+ </menu>
+ <menu action="View">
<placeholder name="View Items Placeholder">
- <submenu name="Arrange Items" _label="Arran_ge Items">
- <menuitem name="Manual Layout"
- type="radio" group="layout group"
- id="Manual Layout"/>
+ <menu action="Arrange Items">
+ <menuitem name="Manual Layout" action="Manual Layout"/>
<placeholder name="Auto Layout">
- <menuitem name="Sort by Name"
- type="radio" group="layout group"
- id="Sort by Name"/>
- <menuitem name="Sort by Size"
- type="radio" group="layout group"
- id="Sort by Size"/>
- <menuitem name="Sort by Type"
- type="radio" group="layout group"
- id="Sort by Type"/>
- <menuitem name="Sort by Modification Date"
- type="radio" group="layout group"
- id="Sort by Modification Date"/>
- <menuitem name="Sort by Emblems"
- type="radio" group="layout group"
- id="Sort by Emblems"/>
+ <menuitem name="Sort by Name" action="Sort by Name"/>
+ <menuitem name="Sort by Size" action="Sort by Size"/>
+ <menuitem name="Sort by Type" action="Sort by Type"/>
+ <menuitem name="Sort by Modification Date" action="Sort by Modification Date"/>
+ <menuitem name="Sort by Emblems" action="Sort by Emblems"/>
</placeholder>
- <separator/>
- <menuitem name="Tighter Layout"
- id="Tighter Layout"
- type="toggle"/>
- <menuitem name="Reversed Order"
- id="Reversed Order"
- type="toggle"/>
- </submenu>
- <menuitem name="Clean Up"
- verb="Clean Up"/>
- <menuitem name="Keep Aligned"
- id="Keep Aligned"
- type="toggle"/>
+ <separator name="Layout separator"/>
+ <menuitem name="Tighter Layout" action="Tighter Layout"/>
+ <menuitem name="Reversed Order" action="Reversed Order"/>
+ </menu>
+ <menuitem name="Clean Up" action="Clean Up"/>
+ <menuitem name="Keep Aligned" action="Keep Aligned"/>
</placeholder>
- </submenu>
-</menu>
-<popups>
- <popup name="background">
- <placeholder name="Before Zoom Items">
- <placeholder name="View Items">
- <submenu name="Arrange Items" _label="Arran_ge Items" tearoff="0">
- <menuitem name="Manual Layout"
- type="radio" group="context menu layout group"
- id="Manual Layout"/>
- <placeholder name="Auto Layout">
- <menuitem name="Sort by Name"
- type="radio" group="context menu layout group"
- id="Sort by Name"/>
- <menuitem name="Sort by Size"
- type="radio" group="context menu layout group"
- id="Sort by Size"/>
- <menuitem name="Sort by Type"
- type="radio" group="context menu layout group"
- id="Sort by Type"/>
- <menuitem name="Sort by Modification Date"
- type="radio" group="context menu layout group"
- id="Sort by Modification Date"/>
- <menuitem name="Sort by Emblems"
- type="radio" group="context menu layout group"
- id="Sort by Emblems"/>
- </placeholder>
- <separator/>
-
- <menuitem name="Tighter Layout"
- id="Tighter Layout"
- type="toggle"/>
- <menuitem name="Reversed Order"
- id="Reversed Order"
- type="toggle"/>
- </submenu>
-
- <menuitem name="Clean Up" verb="Clean Up"/>
- <menuitem name="Keep Aligned"
- id="Keep Aligned"
- type="toggle"/>
- </placeholder>
- </placeholder>
- </popup>
- <popup name="selection">
- <placeholder name="Icon Appearance Items">
+ </menu>
+</menubar>
+<popup name="background">
+ <placeholder name="Before Zoom Items">
+ <placeholder name="View Items">
+ <menu action="Arrange Items">
+ <menuitem name="Manual Layout" action="Manual Layout"/>
+ <placeholder name="Auto Layout">
+ <menuitem name="Sort by Name" action="Sort by Name"/>
+ <menuitem name="Sort by Size" action="Sort by Size"/>
+ <menuitem name="Sort by Type" action="Sort by Type"/>
+ <menuitem name="Sort by Modification Date" action="Sort by Modification Date"/>
+ <menuitem name="Sort by Emblems" action="Sort by Emblems"/>
+ </placeholder>
+ <separator name="Layout separator"/>
+ <menuitem name="Tighter Layout" action="Tighter Layout"/>
+ <menuitem name="Reversed Order" action="Reversed Order"/>
+ </menu>
+ <menuitem name="Clean Up" action="Clean Up"/>
+ <menuitem name="Keep Aligned" action="Keep Aligned"/>
</placeholder>
- </popup>
-</popups>
-</Root>
+ </placeholder>
+</popup>
+<popup name="selection">
+ <placeholder name="Icon Appearance Items"/>
+</popup>
+</ui>
diff --git a/src/file-manager/nautilus-indexing-info.c b/src/file-manager/nautilus-indexing-info.c
deleted file mode 100644
index 85e445e12..000000000
--- a/src/file-manager/nautilus-indexing-info.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- * nautilus-indexing-info.c: Indexing Info for the search service
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This library 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 library 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: George Lebl <jirka@5z.com>
- * Rebecca Schulman <rebecka@eazel.com>
- */
-
-#include <config.h>
-#include "nautilus-indexing-info.h"
-
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkprogressbar.h>
-#include <gtk/gtkvbox.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include <eel/eel-debug.h>
-#include <eel/eel-gdk-extensions.h>
-#include <eel/eel-glib-extensions.h>
-#include <eel/eel-gtk-extensions.h>
-#include <libnautilus-private/nautilus-medusa-support.h>
-#include <eel/eel-stock-dialogs.h>
-
-#ifdef HAVE_MEDUSA
-
-#include <libmedusa/medusa-index-service.h>
-#include <libmedusa/medusa-index-progress.h>
-#include <libmedusa/medusa-indexed-search.h>
-#include <libmedusa/medusa-system-state.h>
-
-#define PROGRESS_UPDATE_INTERVAL 5000
-
-typedef struct {
- GtkLabel *progress_label;
- GtkProgressBar *progress_bar;
-} ProgressChangeData;
-
-typedef struct {
- GtkDialog *last_index_time_dialog;
- GtkDialog *index_in_progress_dialog;
- gboolean indexing_is_in_progress;
-} IndexingInfoDialogs;
-
-static IndexingInfoDialogs *dialogs = NULL;
-
-static GtkDialog * last_index_time_dialog_new (void);
-
-static int
-get_index_percentage_complete (void)
-{
- return medusa_index_progress_get_percentage_complete ();
-}
-
-/* We set up a callback so that if medusa state changes, we
- close the dialog. To avoid race conditions with removing
- the callback entirely when we destroy it, we set it so
- that the dialog just hides, rather than closing */
-static void
-set_close_hides_for_dialog (GtkDialog *dialog)
-{
-#if GNOME2_CONVERSION_COMPLETE
- gtk_dialog_set_close (dialog, TRUE /*click_closes*/);
- gtk_dialog_close_hides (dialog, TRUE /*just_hide*/);
-#endif
-
-}
-
-static char *
-get_text_for_progress_label (void)
-{
- return g_strdup_printf (_("Indexing is %d%% complete."), get_index_percentage_complete ());
-}
-
-
-static gboolean
-update_progress_display (gpointer callback_data)
-{
- GtkLabel *progress_label;
- ProgressChangeData *progress_change_data;
- char *progress_string;
-
- progress_change_data = (ProgressChangeData *) callback_data;
-
- progress_label = GTK_LABEL (progress_change_data->progress_label);
- progress_string = get_text_for_progress_label ();
- gtk_label_set_text (progress_label, progress_string);
- g_free (progress_string);
- gtk_progress_bar_set_fraction (progress_change_data->progress_bar,
- get_index_percentage_complete () / 100.0f);
-
-
- return TRUE;
-}
-
-static void
-dialog_close_cover (gpointer dialog_data)
-{
- g_assert (GTK_IS_DIALOG (dialog_data));
-
-#if GNOME2_CONVERSION_COMPLETE
- gtk_dialog_close (dialog_data);
-#endif
-}
-
-static void
-show_index_progress_dialog (void)
-{
- int callback_id;
-
-#if GNOME2_CONVERSION_COMPLETE
- gtk_dialog_close (dialogs->last_index_time_dialog);
-#endif
- gtk_widget_show_all (GTK_WIDGET (dialogs->index_in_progress_dialog));
- callback_id = medusa_execute_once_when_system_state_changes (dialog_close_cover,
- dialogs->index_in_progress_dialog);
- g_signal_connect_swapped (dialogs->index_in_progress_dialog, "destroy",
- G_CALLBACK (medusa_remove_state_changed_function),
- GINT_TO_POINTER (callback_id));
-}
-
-
-static void
-show_last_index_time_dialog (void)
-{
- int callback_id;
-
-#if GNOME2_CONVERSION_COMPLETE
- gtk_dialog_close (dialogs->index_in_progress_dialog);
-#endif
- gtk_widget_show_all (GTK_WIDGET (dialogs->last_index_time_dialog));
- callback_id = medusa_execute_once_when_system_state_changes (dialog_close_cover,
- dialogs->last_index_time_dialog);
- g_signal_connect_swapped (dialogs->last_index_time_dialog, "destroy",
- G_CALLBACK (medusa_remove_state_changed_function),
- GINT_TO_POINTER (callback_id));
-}
-
-static GtkDialog *
-last_index_time_dialog_new (void)
-{
- char *time_str;
- char *label_str;
- GtkWidget *label;
- GtkDialog *dialog;
-
- time_str = nautilus_indexing_info_get_last_index_time ();
- label_str = g_strdup_printf (_("Your files were last indexed at %s."),
- time_str);
- g_free (time_str);
-
- dialog = eel_create_info_dialog (label_str,
- _("Once a day your files and text content are indexed so "
- "your searches are fast. "),
- _("Indexing Status"),
- NULL);
- set_close_hides_for_dialog (dialog);
-
- return dialog;
-}
-
-static void
-timeout_remove_callback (gpointer callback_data)
-{
- gtk_timeout_remove (GPOINTER_TO_UINT (callback_data));
-}
-
-static GtkDialog *
-index_progress_dialog_new (void)
-{
- GtkWidget *progress_label;
- GtkWidget *indexing_progress_bar;
- GtkWidget *progress_bar_hbox, *embedded_vbox;
- GtkDialog *dialog;
- char *progress_string;
- int percentage_complete;
- ProgressChangeData *progress_data;
- guint timeout_id;
-
- dialog = eel_create_info_dialog (_("Your files are currently being indexed."),
- _("Once a day your files and text content are indexed so "
- "your searches are fast."),
- _("Indexing Status"), NULL);
- set_close_hides_for_dialog (dialog);
- percentage_complete = get_index_percentage_complete ();
- indexing_progress_bar = gtk_progress_bar_new ();
-
- embedded_vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
-
- /* turn off text display by setting text to NULL */
- gtk_progress_bar_set_text (GTK_PROGRESS_BAR (indexing_progress_bar), NULL);
- /* Put the progress bar in an hbox to make it a more sane size */
- gtk_box_pack_start (GTK_BOX (embedded_vbox), indexing_progress_bar, FALSE, FALSE, 0);
-
- progress_string = get_text_for_progress_label ();
- progress_label = gtk_label_new (progress_string);
- g_free (progress_string);
- gtk_box_pack_start (GTK_BOX (embedded_vbox), progress_label, FALSE, FALSE, 0);
-
- progress_bar_hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (progress_bar_hbox), embedded_vbox,
- FALSE, FALSE, GNOME_PAD_SMALL);
-
- gtk_box_pack_start (GTK_BOX (dialog->vbox), progress_bar_hbox,
- FALSE, FALSE, 0);
-
- /* Keep the dialog current with actual indexing progress */
- progress_data = g_new (ProgressChangeData, 1);
- progress_data->progress_label = GTK_LABEL (progress_label);
- progress_data->progress_bar = GTK_PROGRESS_BAR (indexing_progress_bar);
- timeout_id = gtk_timeout_add_full (PROGRESS_UPDATE_INTERVAL,
- update_progress_display,
- NULL,
- progress_data,
- g_free);
- g_signal_connect (progress_bar_hbox, "destroy", /* FIXME: will be called twice */
- G_CALLBACK (timeout_remove_callback),
- GLONG_TO_POINTER (timeout_id));
-
- return dialog;
-}
-
-static void
-destroy_indexing_info_dialogs_on_exit (void)
-{
- gtk_widget_destroy (GTK_WIDGET (dialogs->index_in_progress_dialog));
- gtk_widget_destroy (GTK_WIDGET (dialogs->last_index_time_dialog));
- g_free (dialogs);
-}
-
-static void
-show_indexing_info_dialog (void)
-{
- GtkDialog *dialog_shown;
- char *details_string;
- int callback_id;
-
- if (!medusa_system_services_are_enabled ()) {
- details_string = nautilus_medusa_get_explanation_of_enabling ();
- dialog_shown = eel_show_info_dialog_with_details (_("There is no index of your files right now."),
- _("When Fast Search is enabled, Find creates an "
- "index to speed up searches. Fast searching "
- "is not enabled on your computer, so you "
- "do not have an index right now."),
- _("No Index of Files"),
- details_string,
- NULL);
- g_free (details_string);
- set_close_hides_for_dialog (dialog_shown);
-
- callback_id = medusa_execute_once_when_system_state_changes (dialog_close_cover,
- dialog_shown);
- g_signal_connect_swapped (dialog_shown, "destroy",
- G_CALLBACK (medusa_remove_state_changed_function),
- GINT_TO_POINTER (callback_id));
- return;
- }
- if (dialogs == NULL) {
- dialogs = g_new0 (IndexingInfoDialogs, 1);
- eel_debug_call_at_shutdown (destroy_indexing_info_dialogs_on_exit);
-
- dialogs->last_index_time_dialog = last_index_time_dialog_new ();
- dialogs->index_in_progress_dialog = index_progress_dialog_new ();
- }
-
- dialogs->indexing_is_in_progress = medusa_indexing_is_currently_in_progress ();
-
- if (dialogs->indexing_is_in_progress) {
- show_index_progress_dialog ();
- } else {
- show_last_index_time_dialog ();
- }
-
-}
-
-#endif /* HAVE_MEDUSA */
-
-#ifndef HAVE_MEDUSA
-static void
-show_search_service_not_available_dialog (void)
-{
- eel_show_error_dialog (_("Sorry, but the medusa search service is not available."),
- _("Please verify medusa has been setup correctly."),
- _("Search Service Not Available"),
- NULL);
-}
-#endif
-
-
-char *
-nautilus_indexing_info_get_last_index_time (void)
-{
-#ifdef HAVE_MEDUSA
- time_t update_time;
-
- update_time = medusa_index_service_get_last_index_update_time ();
- if (update_time) {
- return eel_strdup_strftime (_("%I:%M %p, %x"),
- localtime (&update_time));
- } else {
- return NULL;
- }
-#else
- g_warning ("called nautilus_indexing_info_get_last_index_time with HAVE_MEDUSA off");
- return g_strdup ("");
-#endif
-}
-
-/**
- * nautilus_indexing_info_show_dialog:
- *
- * Show the indexing info dialog. If one is already
- * running, just raise that one.
- **/
-void
-nautilus_indexing_info_show_dialog (void)
-{
-#ifdef HAVE_MEDUSA
- show_indexing_info_dialog ();
-#else
- show_search_service_not_available_dialog ();
-#endif
-}
diff --git a/src/file-manager/nautilus-indexing-info.h b/src/file-manager/nautilus-indexing-info.h
deleted file mode 100644
index 373796d72..000000000
--- a/src/file-manager/nautilus-indexing-info.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * nautilus-indexing-info.h: Indexing Info for the search service
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This library 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 library 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: George Lebl <jirka@5z.com>
- *
- */
-
-#ifndef NAUTILUS_INDEXING_INFO_H
-#define NAUTILUS_INDEXING_INFO_H
-
-/* Show the indexing info dialog, If one is already running
- * just raise that one.
- */
-void nautilus_indexing_info_show_dialog (void);
-char *nautilus_indexing_info_get_last_index_time (void);
-
-#endif /* NAUTILUS_INDEXING_INFO_H */
diff --git a/src/file-manager/nautilus-list-view-ui.xml b/src/file-manager/nautilus-list-view-ui.xml
index 3c59dfec7..ad9e6255e 100644
--- a/src/file-manager/nautilus-list-view-ui.xml
+++ b/src/file-manager/nautilus-list-view-ui.xml
@@ -1,16 +1,9 @@
-<Root>
-<commands>
- <cmd name="Visible Columns"
- _label="Visible _Columns..."
- _tip="Select the columns visible in this folder"/>
-</commands>
-<menu>
- <submenu name="View">
+<ui>
+<menubar name="MenuBar">
+ <menu action="View">
<placeholder name="View Items Placeholder">
- <menuitem name="Visible Columns"
- verb="Visible Columns"/>
+ <menuitem name="Visible Columns" action="Visible Columns"/>
</placeholder>
-
- </submenu>
-</menu>
-</Root>
+ </menu>
+</menubar>
+</ui>
diff --git a/src/file-manager/nautilus-search-list-view-ui.xml b/src/file-manager/nautilus-search-list-view-ui.xml
deleted file mode 100644
index 6a7449564..000000000
--- a/src/file-manager/nautilus-search-list-view-ui.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<Root>
-<commands>
- <cmd name="Reveal"
- _label="Reveal in New Window"
- _tip="Reveal each selected item in its original folder"/>
- <cmd name="Indexing Info"
- _label="Show Indexing Status"
- _tip="Show status of indexing used when searching"/>
-</commands>
-<menu>
- <submenu name="File">
- <placeholder name="Open Placeholder">
- <menuitem name="Reveal"
- _label="_Reveal in New Window"
- verb="Reveal"/>
- </placeholder>
- <placeholder name="General Status Placeholder">
- <menuitem name="Indexing Info"
- _label="Show _Indexing Status"
- verb="Indexing Info"/>
- </placeholder>
- </submenu>
-</menu>
-<popups>
- <popup name="selection">
- <placeholder name="Open Placeholder">
- <menuitem name="Reveal" verb="Reveal"/>
- </placeholder>
- </popup>
-</popups>
-</Root>