summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog649
-rw-r--r--Makefile.am3
-rw-r--r--components/Makefile.am19
-rw-r--r--components/adapter/Makefile.am53
-rw-r--r--components/adapter/Nautilus_ComponentAdapterFactory_std.server.in.in22
-rw-r--r--components/adapter/main.c129
-rw-r--r--components/adapter/nautilus-adapter-control-embed-strategy.c206
-rw-r--r--components/adapter/nautilus-adapter-control-embed-strategy.h59
-rw-r--r--components/adapter/nautilus-adapter-control-factory-embed-strategy.c212
-rw-r--r--components/adapter/nautilus-adapter-control-factory-embed-strategy.h60
-rw-r--r--components/adapter/nautilus-adapter-embed-strategy-private.h36
-rw-r--r--components/adapter/nautilus-adapter-embed-strategy.c178
-rw-r--r--components/adapter/nautilus-adapter-embed-strategy.h80
-rw-r--r--components/adapter/nautilus-adapter-factory-server.c152
-rw-r--r--components/adapter/nautilus-adapter-factory-server.h55
-rw-r--r--components/adapter/nautilus-adapter-file-load-strategy.c181
-rw-r--r--components/adapter/nautilus-adapter-file-load-strategy.h58
-rw-r--r--components/adapter/nautilus-adapter-load-strategy.c278
-rw-r--r--components/adapter/nautilus-adapter-load-strategy.h92
-rw-r--r--components/adapter/nautilus-adapter-stream-load-strategy.c207
-rw-r--r--components/adapter/nautilus-adapter-stream-load-strategy.h58
-rw-r--r--components/adapter/nautilus-adapter.c274
-rw-r--r--components/adapter/nautilus-adapter.h55
-rw-r--r--components/adapter/nautilus-zoomable-proxy.c312
-rw-r--r--components/adapter/nautilus-zoomable-proxy.h56
-rw-r--r--components/emblem/Makefile.am41
-rw-r--r--components/emblem/Nautilus_View_emblem.server.in.in15
-rw-r--r--components/emblem/libmain.c85
-rw-r--r--components/emblem/nautilus-emblem-view-iids.h30
-rw-r--r--components/emblem/nautilus-emblem-view.h57
-rw-r--r--components/history/Makefile.am35
-rw-r--r--components/history/Nautilus_View_history.server.in.in18
-rw-r--r--components/history/libmain.c85
-rw-r--r--components/history/nautilus-history-view.c311
-rw-r--r--components/image_properties/Makefile.am38
-rw-r--r--components/image_properties/Nautilus_View_image_properties.server.in.in29
-rw-r--r--components/image_properties/libmain.c63
-rw-r--r--components/image_properties/nautilus-image-properties-view.h48
-rw-r--r--components/loser/Makefile.am10
-rw-r--r--components/loser/README30
-rw-r--r--components/loser/content/Makefile.am35
-rw-r--r--components/loser/content/Nautilus_View_content-loser.server.in.in32
-rw-r--r--components/loser/content/main.c100
-rw-r--r--components/loser/content/nautilus-content-loser-ui.xml21
-rw-r--r--components/loser/content/nautilus-content-loser.c278
-rw-r--r--components/loser/content/nautilus-content-loser.h68
-rw-r--r--components/loser/sidebar/Makefile.am35
-rw-r--r--components/loser/sidebar/Nautilus_View_sidebar-loser.server.in.in27
-rw-r--r--components/loser/sidebar/main.c104
-rw-r--r--components/loser/sidebar/nautilus-sidebar-loser-ui.xml21
-rw-r--r--components/loser/sidebar/nautilus-sidebar-loser.c280
-rw-r--r--components/loser/sidebar/nautilus-sidebar-loser.h68
-rw-r--r--components/news/Makefile.am42
-rw-r--r--components/news/Nautilus_View_news.server.in25
-rw-r--r--components/news/changed_bullet.pngbin583 -> 0 bytes
-rw-r--r--components/news/nautilus-cell-renderer-news.c489
-rw-r--r--components/news/nautilus-cell-renderer-news.h62
-rw-r--r--components/news/nautilus-news.c2562
-rw-r--r--components/news/news_bullet.pngbin441 -> 0 bytes
-rw-r--r--components/news/news_channels.xml46
-rw-r--r--components/notes/Makefile.am33
-rw-r--r--components/notes/Nautilus_View_notes.server.in.in23
-rw-r--r--components/notes/nautilus-notes.c489
-rw-r--r--components/sample/Makefile.am36
-rw-r--r--components/sample/Nautilus_View_sample.server.in.in46
-rw-r--r--components/sample/README6
-rw-r--r--components/sample/main.c64
-rw-r--r--components/sample/nautilus-sample-content-view-ui.xml22
-rw-r--r--components/sample/nautilus-sample-content-view.c210
-rw-r--r--components/sample/nautilus-sample-content-view.h59
-rw-r--r--components/text/Makefile.am35
-rw-r--r--components/text/Nautilus_View_text.server.in.in30
-rw-r--r--components/text/main.c56
-rw-r--r--components/text/nautilus-text-view-ui.xml11
-rw-r--r--components/text/nautilus-text-view.c329
-rw-r--r--components/text/nautilus-text-view.h57
-rw-r--r--components/throbber/Makefile.am34
-rw-r--r--components/throbber/Nautilus_Control_throbber.server.in.in21
-rw-r--r--components/throbber/main.c61
-rw-r--r--configure.in55
-rw-r--r--libnautilus-adapter/Makefile.am45
-rw-r--r--libnautilus-adapter/nautilus-adapter-factory.idl44
-rw-r--r--libnautilus-private/Makefile.am53
-rw-r--r--libnautilus-private/apps_nautilus_preferences.schemas.in15
-rw-r--r--libnautilus-private/nautilus-bonobo-extensions.c886
-rw-r--r--libnautilus-private/nautilus-bonobo-extensions.h131
-rw-r--r--libnautilus-private/nautilus-clipboard-monitor.c16
-rw-r--r--libnautilus-private/nautilus-clipboard.c (renamed from libnautilus/nautilus-clipboard.c)391
-rw-r--r--libnautilus-private/nautilus-clipboard.h (renamed from libnautilus/nautilus-clipboard.h)19
-rw-r--r--libnautilus-private/nautilus-desktop-link.c29
-rw-r--r--libnautilus-private/nautilus-directory-async.c93
-rw-r--r--libnautilus-private/nautilus-directory-background.c1
-rw-r--r--libnautilus-private/nautilus-directory-metafile-monitor.c1
-rw-r--r--libnautilus-private/nautilus-directory-private.h3
-rw-r--r--libnautilus-private/nautilus-drag-window.c393
-rw-r--r--libnautilus-private/nautilus-drag-window.h40
-rw-r--r--libnautilus-private/nautilus-file.c9
-rw-r--r--libnautilus-private/nautilus-global-preferences.c16
-rw-r--r--libnautilus-private/nautilus-global-preferences.h4
-rw-r--r--libnautilus-private/nautilus-icon-factory.c8
-rw-r--r--libnautilus-private/nautilus-icon-factory.h1
-rw-r--r--libnautilus-private/nautilus-idle-queue.c (renamed from libnautilus/nautilus-idle-queue.c)0
-rw-r--r--libnautilus-private/nautilus-idle-queue.h (renamed from libnautilus/nautilus-idle-queue.h)0
-rw-r--r--libnautilus-private/nautilus-lib-self-check-functions.h1
-rw-r--r--libnautilus-private/nautilus-medusa-support.c145
-rw-r--r--libnautilus-private/nautilus-medusa-support.h47
-rw-r--r--libnautilus-private/nautilus-metafile-server.idl2
-rw-r--r--libnautilus-private/nautilus-metafile.c5
-rw-r--r--libnautilus-private/nautilus-mime-actions.c1
-rw-r--r--libnautilus-private/nautilus-program-choosing.h3
-rw-r--r--libnautilus-private/nautilus-search-uri.c727
-rw-r--r--libnautilus-private/nautilus-search-uri.h42
-rw-r--r--libnautilus-private/nautilus-sidebar-functions.c91
-rw-r--r--libnautilus-private/nautilus-sidebar-functions.h33
-rw-r--r--libnautilus-private/nautilus-sidebar-provider.c72
-rw-r--r--libnautilus-private/nautilus-sidebar-provider.h56
-rw-r--r--libnautilus-private/nautilus-sidebar.c116
-rw-r--r--libnautilus-private/nautilus-sidebar.h78
-rw-r--r--libnautilus-private/nautilus-ui-utilities.c215
-rw-r--r--libnautilus-private/nautilus-ui-utilities.h43
-rw-r--r--libnautilus-private/nautilus-undo-context.c80
-rw-r--r--libnautilus-private/nautilus-undo-context.h56
-rw-r--r--libnautilus-private/nautilus-undo-manager.c111
-rw-r--r--libnautilus-private/nautilus-undo-manager.h14
-rw-r--r--libnautilus-private/nautilus-undo-private.h (renamed from libnautilus/nautilus-undo-private.h)7
-rw-r--r--libnautilus-private/nautilus-undo-transaction.c (renamed from libnautilus/nautilus-undo-transaction.c)64
-rw-r--r--libnautilus-private/nautilus-undo-transaction.h (renamed from libnautilus/nautilus-undo-transaction.h)25
-rw-r--r--libnautilus-private/nautilus-undo.c (renamed from libnautilus/nautilus-undo.c)85
-rw-r--r--libnautilus-private/nautilus-undo.h (renamed from libnautilus/nautilus-undo.h)6
-rw-r--r--libnautilus-private/nautilus-view-factory.c110
-rw-r--r--libnautilus-private/nautilus-view-factory.h67
-rw-r--r--libnautilus-private/nautilus-view-identifier.c237
-rw-r--r--libnautilus-private/nautilus-view-identifier.h51
-rw-r--r--libnautilus-private/nautilus-view-query.c889
-rw-r--r--libnautilus-private/nautilus-view-query.h52
-rw-r--r--libnautilus-private/nautilus-view.c251
-rw-r--r--libnautilus-private/nautilus-view.h147
-rw-r--r--libnautilus-private/nautilus-window-info.c261
-rw-r--r--libnautilus-private/nautilus-window-info.h164
-rw-r--r--libnautilus/Makefile.am105
-rw-r--r--libnautilus/README5
-rw-r--r--libnautilus/libnautilus.h35
-rw-r--r--libnautilus/libnautilus.pc.in11
-rw-r--r--libnautilus/nautilus-bonobo-ui.h130
-rw-r--r--libnautilus/nautilus-clipboard-ui.xml49
-rw-r--r--libnautilus/nautilus-distributed-undo.idl103
-rw-r--r--libnautilus/nautilus-scroll-positionable.c155
-rw-r--r--libnautilus/nautilus-scroll-positionable.h64
-rw-r--r--libnautilus/nautilus-view-component.idl190
-rw-r--r--libnautilus/nautilus-view-standard-main.c422
-rw-r--r--libnautilus/nautilus-view-standard-main.h73
-rw-r--r--libnautilus/nautilus-view.c1152
-rw-r--r--libnautilus/nautilus-view.h141
-rw-r--r--po/POTFILES.in48
-rw-r--r--po/POTFILES.skip10
-rw-r--r--src/Makefile.am101
-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
-rw-r--r--src/nautilus-actions.h44
-rw-r--r--src/nautilus-applicable-views.c195
-rw-r--r--src/nautilus-applicable-views.h71
-rw-r--r--src/nautilus-application.c94
-rw-r--r--src/nautilus-bookmarks-window.c2
-rw-r--r--src/nautilus-complex-search-bar.c608
-rw-r--r--src/nautilus-complex-search-bar.h64
-rw-r--r--src/nautilus-component-adapter-factory.c211
-rw-r--r--src/nautilus-component-adapter-factory.h67
-rw-r--r--src/nautilus-desktop-window.c23
-rw-r--r--src/nautilus-emblem-sidebar.c (renamed from components/emblem/nautilus-emblem-view.c)353
-rw-r--r--src/nautilus-emblem-sidebar.h60
-rw-r--r--src/nautilus-history-sidebar.c346
-rw-r--r--src/nautilus-history-sidebar.h (renamed from components/history/nautilus-history-view.h)26
-rw-r--r--src/nautilus-image-properties-page.c (renamed from components/image_properties/nautilus-image-properties-view.c)311
-rw-r--r--src/nautilus-image-properties-page.h49
-rw-r--r--src/nautilus-information-panel.c236
-rw-r--r--src/nautilus-information-panel.h12
-rw-r--r--src/nautilus-location-bar.c4
-rw-r--r--src/nautilus-location-dialog.c14
-rw-r--r--src/nautilus-location-entry.c2
-rw-r--r--src/nautilus-main.c6
-rw-r--r--src/nautilus-navigation-action.c302
-rw-r--r--src/nautilus-navigation-action.h68
-rw-r--r--src/nautilus-navigation-window-menus.c647
-rw-r--r--src/nautilus-navigation-window-ui.xml230
-rw-r--r--src/nautilus-navigation-window.c988
-rw-r--r--src/nautilus-navigation-window.h72
-rw-r--r--src/nautilus-notes-viewer.c529
-rw-r--r--src/nautilus-notes-viewer.h49
-rw-r--r--src/nautilus-profiler.c317
-rw-r--r--src/nautilus-profiler.h46
-rw-r--r--src/nautilus-property-browser.c19
-rw-r--r--src/nautilus-search-bar-criterion-private.h62
-rw-r--r--src/nautilus-search-bar-criterion.c1105
-rw-r--r--src/nautilus-search-bar-criterion.h105
-rw-r--r--src/nautilus-search-bar-private.h39
-rw-r--r--src/nautilus-search-bar.c52
-rw-r--r--src/nautilus-search-bar.h59
-rw-r--r--src/nautilus-shell-interface.idl3
-rw-r--r--src/nautilus-shell-ui.xml307
-rw-r--r--src/nautilus-shell.c4
-rw-r--r--src/nautilus-side-pane.c1
-rw-r--r--src/nautilus-side-pane.h10
-rw-r--r--src/nautilus-sidebar-title.c101
-rw-r--r--src/nautilus-simple-search-bar.c251
-rw-r--r--src/nautilus-simple-search-bar.h61
-rw-r--r--src/nautilus-spatial-window-ui.xml84
-rw-r--r--src/nautilus-spatial-window.c208
-rw-r--r--src/nautilus-switchable-navigation-bar.c281
-rw-r--r--src/nautilus-switchable-navigation-bar.h73
-rw-r--r--src/nautilus-switchable-search-bar.c314
-rw-r--r--src/nautilus-switchable-search-bar.h67
-rw-r--r--src/nautilus-throbber.c (renamed from components/throbber/nautilus-throbber.c)176
-rw-r--r--src/nautilus-throbber.h (renamed from components/throbber/nautilus-throbber.h)2
-rw-r--r--src/nautilus-view-frame-corba.c420
-rw-r--r--src/nautilus-view-frame-private.h84
-rw-r--r--src/nautilus-view-frame.c1708
-rw-r--r--src/nautilus-view-frame.h152
-rw-r--r--src/nautilus-window-manage-views.c2194
-rw-r--r--src/nautilus-window-manage-views.h59
-rw-r--r--src/nautilus-window-menus.c630
-rw-r--r--src/nautilus-window-private.h92
-rw-r--r--src/nautilus-window-toolbars.c371
-rw-r--r--src/nautilus-window.c983
-rw-r--r--src/nautilus-window.h31
-rw-r--r--src/nautilus-zoom-control.c114
-rw-r--r--src/nautilus-zoom-control.h41
-rw-r--r--test/Makefile.am1
251 files changed, 9924 insertions, 32742 deletions
diff --git a/ChangeLog b/ChangeLog
index 574e1d9ac..c9b78cbfa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,652 @@
+2004-11-22 Alexander Larsson <alexl@redhat.com>
+ * Merge bonobo-slay-branch
+
+2004-11-22 Alexander Larsson <alexl@redhat.com>
+
+ * src/nautilus-window.c: (action_view_as_callback),
+ (nautilus_window_synch_view_as_menus):
+ Don't reenter action callback when switching views.
+
+2004-11-19 Dave Camp <dave@novell.com>
+
+ * src/file-manager/fm-directory-view.c: (reset_open_with_menu),
+ (can_show_default_app), (real_update_menus): Fix some jumping
+ menus.
+ * test/Makefile.am: Don't link to libnautilus
+
+2004-11-19 Alexander Larsson <alexl@redhat.com>
+
+ * libnautilus-private/nautilus-mime-actions.c:
+ removed unneeded includes
+
+ * src/nautilus-application.c:
+ * src/nautilus-desktop-window.c:
+ Removed app_id property on NautilusWindow
+
+ * src/nautilus-main.c: (main):
+ Remove old code
+
+ * src/nautilus-navigation-window.c:
+ * src/nautilus-sidebar-title.c:
+ * src/nautilus-window-menus.c:
+ * src/file-manager/fm-ditem-page.c:
+ Remove bonobo comments
+
+ * src/nautilus-window.c:
+ Remove app_id property
+ fix last bonobo details
+
+ * src/file-manager/fm-actions.h:
+ * src/file-manager/fm-directory-view.c:
+ * src/file-manager/nautilus-directory-view-ui.xml:
+ remove edit launcher action
+
+2004-11-19 Alexander Larsson <alexl@redhat.com>
+
+ * configure.in:
+ Require new eel
+
+ * src/file-manager/fm-actions.h:
+ * src/file-manager/fm-directory-view.[ch]:
+ * src/file-manager/nautilus-directory-view-ui.xml:
+ * src/nautilus-actions.h:
+ * src/nautilus-shell-ui.xml:
+ * src/nautilus-spatial-window-ui.xml:
+ * src/nautilus-spatial-window.c:
+ * src/nautilus-window-menus.c:
+ * src/nautilus-window.[ch]:
+ Implement some accels as GtkBindings instead to avoid
+ overriding widget-specific keybindings like "delete" and "backspace".
+
+2004-11-19 Alexander Larsson <alexl@redhat.com>
+
+ * src/nautilus-navigation-window.c:
+ * src/nautilus-window-private.h:
+ Put location entry etc in a toolbar.
+
+2004-11-19 Alexander Larsson <alexl@redhat.com>
+
+ * libnautilus-private/nautilus-file.c: (is_desktop_file),
+ (nautilus_file_is_nautilus_link):
+ Don't check for "application/x-gnome-app-info", as that is already
+ handled by the alias system. This also avoids stating for a
+ mimetype xml file.
+
+ * src/nautilus-throbber.c:
+ Don't create a new icon theme for each throbber.
+ Use GtkIconTheme instead of GnomeIconTheme
+
+ * libnautilus-private/nautilus-ui-utilities.[ch]:
+ New function nautilus_ui_string_get to cache the loaded ui files.
+
+ * src/nautilus-navigation-window.c:
+ Remove old bonoboui stuff
+
+ * src/nautilus-navigation-window-menus.c:
+ Open New window is Ctrl-N.
+ Use the new nautilus_ui_string_get call
+
+ * src/nautilus-spatial-window.c:
+ * src/nautilus-window-menus.c:
+ * src/file-manager/fm-desktop-icon-view.c:
+ * src/file-manager/fm-directory-view.c:
+ * src/file-manager/fm-icon-view.c:
+ * src/file-manager/fm-list-view.c:
+ Use the new nautilus_ui_string_get call
+
+ * src/file-manager/nautilus-directory-view-ui.xml:
+ * src/file-manager/nautilus-icon-view-ui.xml:
+ Name separators to work around bug #158620
+
+2004-11-18 Alexander Larsson <alexl@redhat.com>
+
+ * src/file-manager/fm-actions.h:
+ * src/file-manager/fm-directory-view.c:
+ * src/file-manager/nautilus-desktop-icon-view-ui.xml:
+ * src/file-manager/nautilus-directory-view-ui.xml:
+ * src/file-manager/nautilus-icon-view-ui.xml:
+ * src/file-manager/nautilus-list-view-ui.xml:
+ * src/nautilus-actions.h:
+ * src/nautilus-navigation-window-ui.xml:
+ * src/nautilus-shell-ui.xml:
+ * src/nautilus-spatial-window-ui.xml:
+ * src/nautilus-spatial-window.c:
+ * src/nautilus-window-menus.c:
+ * src/nautilus-window.[ch]:
+ Add all extra accellerators and clean up ui files.
+
+2004-11-18 Alexander Larsson <alexl@redhat.com>
+
+ * src/nautilus-window-menus.c:
+ * src/nautilus-window-toolbars.c:
+ * libnautilus-private/nautilus-ui-utilities.[ch]:
+ (nautilus_action_from_menu_item), (nautilus_toolbar_action_from_menu_item):
+ Move code to utility functions.
+
+2004-11-18 Alexander Larsson <alexl@redhat.com>
+
+ * libnautilus-private/nautilus-file-utilities.[ch]:
+ * src/nautilus-spatial-window.c:
+ * src/nautilus-navigation-window-menus.c:
+ * src/nautilus-window-menus.c:
+ Move some functions to nautilus-ui-utilities
+
+ * libnautilus-private/Makefile.am:
+ * libnautilus-private/nautilus-ui-utilities.[ch]:
+ Various ui utility functions
+
+ * src/file-manager/fm-desktop-icon-view.c:
+ * src/file-manager/fm-directory-view.c:
+ * src/file-manager/fm-icon-view.c:
+ * src/file-manager/fm-list-view.c:
+ Unmerge everything on destroy
+
+ * src/nautilus-shell-ui.xml:
+ Remove unused stuff
+
+2004-11-18 Alexander Larsson <alexl@redhat.com>
+
+ * libnautilus-private/nautilus-clipboard-monitor.c:
+ Handle ownership changes from XFixes
+
+ * libnautilus-private/Makefile.am:
+ * libnautilus-private/nautilus-clipboard-ui.xml:
+ Remove (is now inline)
+
+ * libnautilus-private/nautilus-clipboard.[ch]:
+ Convert to GtkUIManager
+
+ * src/nautilus-location-bar.c:
+ * src/nautilus-notes-viewer.c:
+ Adapt to NautilusClipboard changes
+
+ * src/nautilus-window-menus.c:
+ Remove duplicated action
+
+ * src/file-manager/fm-actions.h:
+ * src/file-manager/fm-directory-view.c:
+ * src/file-manager/fm-icon-view.c:
+ * src/file-manager/fm-list-view.c:
+ * src/file-manager/nautilus-directory-view-ui.xml:
+ Adapt to NautilusClipboard changes
+ Fix paste into folder to not use stock accelerator
+
+2004-11-17 Alexander Larsson <alexl@redhat.com>
+
+ * components/Makefile.am:
+ Remove references to throbber
+
+ * src/Makefile.am:
+ * src/nautilus-throbber.[ch]:
+ Moved throbber here and made it not be a bonobo object
+
+ * src/nautilus-window-private.h:
+ * src/nautilus-window-toolbars.c:
+ Work with the throbber
+
+2004-11-17 Alexander Larsson <alexl@redhat.com>
+
+ * src/nautilus-application.c:
+ * src/nautilus-navigation-window.c:
+ * src/nautilus-spatial-window.c:
+ * src/nautilus-window-private.h:
+ * src/nautilus-window.c:
+ Make initial window geometry work.
+
+2004-11-17 Alexander Larsson <alexl@redhat.com>
+
+ * src/nautilus-image-properties-page.c: (get_property_pages):
+ Only show for images.
+
+2004-11-17 Alexander Larsson <alexl@redhat.com>
+
+ * src/file-manager/fm-properties-window.h:
+ Don't include libnautilus files.
+
+2004-11-17 Alexander Larsson <alexl@redhat.com>
+
+ * src/file-manager/fm-desktop-icon-view.c:
+ * src/nautilus-navigation-window.c:
+ * src/nautilus-desktop-window.c:
+ Remove old defines
+
+ * src/file-manager/fm-directory-view.c:
+ * src/file-manager/nautilus-directory-view-ui.xml:
+ * src/nautilus-navigation-window-ui.xml:
+ * src/nautilus-shell-ui.xml:
+ Make the menus look like pre-bonobo-removal
+
+2004-11-17 Alexander Larsson <alexl@redhat.com>
+
+ * src/file-manager/fm-desktop-icon-view.c: (real_merge_menus):
+ Don't have use default background on desktop context menu.
+
+2004-11-17 Alexander Larsson <alexl@redhat.com>
+
+ * Makefile.am:
+ Remove libnautilus-adapter subdir
+
+ * components/Makefile.am:
+ Don't build throbber atm
+
+ * src/nautilus-navigation-action.c:
+ Use GtkMenuToolButton instead of NautilusArrowToolbutton
+
+ * src/Makefile.am:
+ * src/nautilus-arrow-toolbutton.[ch]:
+ Remove.
+
+2004-11-16 Anders Carlsson <andersca@gnome.org>
+
+ * libnautilus-private/nautilus-window-info.c:
+ (nautilus_window_info_get_ui_manager):
+ It's NULL now, not CORBA_OBJECT_NIL.
+
+2004-11-16 Alexander Larsson <alexl@redhat.com>
+
+ * libnautilus-private/nautilus-view.h:
+ remove bonoboui inclide
+
+ * src/nautilus-navigation-action.[ch]:
+ Add navigation GtkAction, based on epi code
+
+ * src/nautilus-window-menus.c:
+ * src/nautilus-window-toolbars.c:
+ Correctly handle toolbar icons for extensions
+
+2004-11-16 Alexander Larsson <alexl@redhat.com>
+
+ * configure.in:
+ Remove bonoboui dependencies
+
+ * libnautilus-private/Makefile.am:
+ * libnautilus-private/nautilus-bonobo-extensions.[ch]:
+ * libnautilus-private/nautilus-bonobo-ui.h:
+ Remove unneeded files
+
+ * libnautilus-private/nautilus-clipboard.c:
+ Comment out for now.
+
+ * libnautilus-private/nautilus-directory-metafile-monitor.c:
+ * libnautilus-private/nautilus-metafile.c:
+ * src/nautilus-application.c:
+ * src/nautilus-history-sidebar.c:
+ * src/nautilus-information-panel.c:
+ * src/nautilus-main.c: (main):
+ * src/nautilus-notes-viewer.c:
+ * src/nautilus-sidebar-title.c:
+ * src/file-manager/fm-properties-window.c:
+ Remove bonobo includes
+
+ * libnautilus-private/nautilus-file-utilities.[ch]:
+ (nautilus_get_ui_directory), (nautilus_ui_file):
+ Util functions for ui files.
+
+ * libnautilus-private/nautilus-view.[ch]:
+ * libnautilus-private/nautilus-window-info.[ch]:
+ Remove bonoboui methods
+
+ * src/Makefile.am:
+ Add new files, remove some old ones
+ Move ui files to datadir/nautilus/ui
+
+ * src/nautilus-actions.h:
+ New file with action names
+
+ * src/nautilus-arrow-toolbutton.[ch]:
+ New widget for back/forward buttons.
+
+ * src/nautilus-desktop-window.c:
+ * src/nautilus-navigation-window-menus.c:
+ * src/nautilus-navigation-window-ui.xml:
+ * src/nautilus-navigation-window.[ch]:
+ * src/nautilus-shell-ui.xml:
+ * src/nautilus-spatial-window-ui.xml:
+ * src/nautilus-spatial-window.c:
+ * src/nautilus-window-manage-views.[ch]:
+ * src/nautilus-window-menus.c:
+ * src/nautilus-window-private.h:
+ * src/nautilus-window-toolbars.c:
+ * src/nautilus-window.[ch]:
+ Initial port to GtkUIManager
+
+ * src/nautilus-profiler.[ch]:
+ Remove
+
+ * src/file-manager/Makefile.am:
+ * src/file-manager/fm-actions.h:
+ New file with action names
+
+ * src/file-manager/fm-desktop-icon-view.c:
+ * src/file-manager/fm-directory-view.[ch]:
+ * src/file-manager/fm-icon-view.c:
+ * src/file-manager/fm-list-view.c:
+ * src/file-manager/nautilus-desktop-icon-view-ui.xml:
+ * src/file-manager/nautilus-directory-view-ui.xml:
+ * src/file-manager/nautilus-icon-view-ui.xml:
+ * src/file-manager/nautilus-list-view-ui.xml:
+ Initial port of views to GtkUIManager
+
+2004-11-09 Alexander Larsson <alexl@redhat.com>
+
+ * libnautilus-private/nautilus-bonobo-extensions.[ch]:
+ Remove some unused bonobo extensions.
+
+ * libnautilus-private/Makefile.am:
+ * src/nautilus-navigation-window.c:
+ * src/nautilus-property-browser.c:
+ * src/nautilus-spatial-window.c:
+ * src/nautilus-window.c:
+ * libnautilus-private/nautilus-drag-window.[ch]:
+ Remove NautilusDragWindow (not used anyway)
+
+2004-11-09 Alexander Larsson <alexl@redhat.com>
+
+ * configure.in:
+ * libnautilus-private/Makefile.am:
+ * libnautilus-private/nautilus-directory-async.c:
+ * libnautilus-private/nautilus-lib-self-check-functions.h:
+ * libnautilus-private/nautilus-medusa-support.[ch]:
+ * libnautilus-private/nautilus-metafile.c:
+ * libnautilus-private/nautilus-search-uri.[ch]:
+ * src/Makefile.am:
+ * src/file-manager/Makefile.am:
+ * src/file-manager/fm-search-list-view.[ch]:
+ * src/file-manager/nautilus-indexing-info.[ch]:
+ * src/file-manager/nautilus-search-list-view-ui.xml:
+ * src/nautilus-application.c:
+ * src/nautilus-complex-search-bar.[ch]:
+ * src/nautilus-navigation-window-menus.c:
+ * src/nautilus-navigation-window-ui.xml:
+ * src/nautilus-navigation-window.[ch]:
+ * src/nautilus-search-bar-criterion-private.h:
+ * src/nautilus-search-bar-criterion.[ch]:
+ * src/nautilus-search-bar-private.h:
+ * src/nautilus-search-bar.[ch]:
+ * src/nautilus-shell-ui.xml:
+ * src/nautilus-sidebar-title.c:
+ * src/nautilus-simple-search-bar.[ch]:
+ * src/nautilus-spatial-window.c:
+ * src/nautilus-switchable-navigation-bar.[ch]:
+ * src/nautilus-switchable-search-bar.[ch]:
+ * src/nautilus-window-manage-views.c:
+ * src/nautilus-window-menus.c:
+ * src/nautilus-window.c:
+ Remove all traces of old medusa support.
+
+2004-11-09 Alexander Larsson <alexl@redhat.com>
+
+ * libnautilus-private/nautilus-icon-factory.[ch]:
+ (nautilus_get_relative_icon_size_for_zoom_level):
+ New function.
+
+ * libnautilus-private/nautilus-view.[ch]:
+ Redo the zooming interface
+
+ * src/file-manager/fm-directory-view.[ch]:
+ * src/file-manager/fm-icon-view.c:
+ * src/file-manager/fm-list-view.c:
+ Implement the new interface for zooming and clean up.
+ Remove the "default zoom affects fonts" behaviour.
+
+ * src/nautilus-navigation-window.c:
+ * src/nautilus-zoom-control.[ch]:
+ Use the new simplified zoom interfaces
+
+2004-11-09 Alexander Larsson <alexl@redhat.com>
+
+ * libnautilus-private/nautilus-directory-async.c:
+ (nautilus_async_destroying_file), (extension_info_cancel),
+ (info_provider_idle_callback), (info_provider_callback):
+ * libnautilus-private/nautilus-directory-private.h:
+ Handle the case when the file we're getting extension info
+ from goes away.
+
+2004-11-08 Alexander Larsson <alexl@redhat.com>
+
+ * src/nautilus-navigation-window.c:
+ (nautilus_navigation_window_set_up_sidebar):
+ * src/nautilus-window-manage-views.c:
+ (viewed_file_changed_callback):
+ Remove some BONOBO TODOs
+
+2004-11-08 Alexander Larsson <alexl@redhat.com>
+
+ * components/Makefile.am:
+ Remove image_properties subdir
+
+ * src/Makefile.am:
+ * src/nautilus-application.c: (nautilus_application_instance_init):
+ * src/nautilus-image-properties-page.[ch]:
+ Image property page using new system
+
+ * src/nautilus-notes-viewer.c:
+ add static
+
+2004-11-08 Alexander Larsson <alexl@redhat.com>
+
+ * libnautilus-private/Makefile.am:
+ * libnautilus-private/nautilus-sidebar-factory.c:
+ * libnautilus-private/nautilus-sidebar-factory.h:
+ Remove old sidebar-factory API
+
+ * src/file-manager/fm-tree-view.c:
+ * src/nautilus-emblem-sidebar.c:
+ * src/nautilus-history-sidebar.c:
+ * src/nautilus-information-panel.c:
+ * src/nautilus-navigation-window.c:
+ Convert to new provider API.
+
+2004-11-08 Alexander Larsson <alexl@redhat.com>
+
+ * libnautilus-private/Makefile.am:
+ * libnautilus-private/nautilus-sidebar-provider.[ch]:
+ Add new extensions-style sidebar provider interface
+
+ * src/nautilus-navigation-window.c:
+ Use it.
+
+ * src/nautilus-notes-viewer.[ch]:
+ Convert notes viewer to new iface
+
+2004-11-08 Alexander Larsson <alexl@redhat.com>
+
+ * src/Makefile.am:
+ * src/nautilus-application.c: (nautilus_application_instance_init):
+ * src/nautilus-notes-sidebar.[ch]:
+ * src/nautilus-notes-viewer.[ch]:
+ Turn NautilusNotesSidebar into NautilusNotesViewer that is also a
+ property page
+
+2004-11-08 Alexander Larsson <alexl@redhat.com>
+
+ * components/Makefile.am:
+ Remove emblem subdir
+
+ * libnautilus-private/nautilus-window-info.[ch]:
+ * src/nautilus-window.c: (nautilus_window_set_hidden_files_mode):
+ hidden_files_mode_changed signal
+
+ * src/file-manager/Makefile.am:
+ * src/file-manager/fm-tree-view.[ch]:
+ * src/nautilus-application.c: (nautilus_application_instance_init):
+ Make tree view work with new system.
+
+ * src/nautilus-window-manage-views.c: (load_new_location),
+ (location_has_really_changed):
+ Only emit loading_uri after load_underway has been reported.
+
+2004-11-05 Alexander Larsson <alexl@redhat.com>
+
+ * src/Makefile.am:
+ * src/nautilus-emblem-sidebar.[ch]:
+ * src/nautilus-application.c:
+ Add emblem sidebar, based on old compontent
+ now uses NautilusSignaller to detect/signal emblem changes
+
+ * src/nautilus-property-browser.c:
+ Catch the emblems_changed signal and refresh
+
+2004-11-05 Alexander Larsson <alexl@redhat.com>
+
+ * src/file-manager/fm-list-view.c:
+ Fix crash when switching view.
+
+ * src/nautilus-history-sidebar.c:
+ Some cleanups
+
+ * src/nautilus-navigation-window.c:
+ Fix unref-null warning
+
+ * src/Makefile.am:
+ * src/nautilus-application.c:
+ * src/nautilus-notes-sidebar.[ch]:
+ Add notes sidebar widget, based on old component
+
+ * components/Makefile.am (SUBDIRS):
+ Remove notes
+
+2004-11-05 Alexander Larsson <alexl@redhat.com>
+
+ * components/Makefile.am:
+ Remove stuff that are now replaced or not needed anymore.
+
+ * libnautilus-private/nautilus-window-info.[ch]:
+ * src/nautilus-window.c:
+ Add nautilus_window_info_get_history.
+
+ * src/Makefile.am:
+ * src/nautilus-history-sidebar.[ch]:
+ * src/nautilus-application.c: (nautilus_application_instance_init):
+ Add history sidebar widget, based on old component.
+
+ * src/nautilus-information-panel.[ch]:
+ Some fixes
+
+2004-11-05 Alexander Larsson <alexl@redhat.com>
+
+ * libnautilus-private/nautilus-directory-background.c:
+ Fix spew
+
+ * libnautilus-private/nautilus-sidebar-factory.h:
+ * libnautilus-private/nautilus-window-info.[ch]:
+ * src/nautilus-application.c:
+ * src/nautilus-information-panel.[ch]:
+ * src/nautilus-navigation-window.c:
+ * src/nautilus-side-pane.c:
+ * src/nautilus-window.c:
+ More work on sidebars. Now the information sidebar works.
+
+2004-11-04 Alexander Larsson <alexl@redhat.com>
+
+ * Makefile.am:
+ Don't build libnautilus subdir
+
+ * libnautilus-private/Makefile.am:
+ Don't link to libnautilus
+ Add new files (some from libnautilus)
+ Remove not used files
+
+ * libnautilus-private/apps_nautilus_preferences.schemas.in:
+ Remove hide_built_in_bookmarks
+
+ * libnautilus-private/nautilus-bonobo-ui.h:
+ * libnautilus-private/nautilus-clipboard-ui.xml:
+ * libnautilus-private/nautilus-clipboard.[ch]:
+ * libnautilus-private/nautilus-idle-queue.[ch]:
+ Move here from libnautilus
+
+ * libnautilus-private/nautilus-desktop-link.c:
+ * libnautilus-private/nautilus-global-preferences.[ch]:
+ Remove WEB_NAVIGATION_ENABLED ifdef and HOME_URI/BUILT_IN_BOOKMARKS
+ prefs
+
+ * libnautilus-private/nautilus-directory-private.h:
+ * libnautilus-private/nautilus-metafile-server.idl:
+ * libnautilus-private/nautilus-program-choosing.h:
+ Remove not needed header inclusions
+
+ * libnautilus-private/nautilus-sidebar-factory.[ch]:
+ NautilusSidebar registration and creation
+
+ * libnautilus-private/nautilus-sidebar.[ch]:
+ New NautilusSidebar interface
+
+ * libnautilus-private/nautilus-sidebar-functions.[ch]:
+ * libnautilus-private/nautilus-undo-context.[ch]:
+ * libnautilus-private/nautilus-view-identifier.[ch]:
+ * libnautilus-private/nautilus-view-query.[ch]:
+ Remove not needed files
+
+ * libnautilus-private/nautilus-undo-manager.[ch]:
+ * libnautilus-private/nautilus-undo-private.h:
+ * libnautilus-private/nautilus-undo-transaction.[ch]:
+ * libnautilus-private/nautilus-undo.[ch]:
+ Convert from bonobo. Some moved from libnautilus.
+
+ * libnautilus-private/nautilus-view-factory.[ch]:
+ NautilusView registration and creation
+
+ * libnautilus-private/nautilus-view.[ch]:
+ New NautilusView interface
+
+ * libnautilus-private/nautilus-window-info.[ch]:
+ New NautilusWindowInfo interface
+
+ * src/Makefile.am:
+ Don't link to libnautilus
+ Remove not used files
+
+ * src/nautilus-applicable-views.[ch]:
+ * src/nautilus-component-adapter-factory.[ch]:
+ * src/nautilus-view-frame-corba.[ch]:
+ * src/nautilus-view-frame-private.h:
+ * src/nautilus-view-frame.[ch]:
+ Removed. Not needed anymore.
+
+ * src/nautilus-bookmarks-window.c:
+ * src/nautilus-complex-search-bar.c:
+ * src/nautilus-information-panel.[ch]:
+ * src/nautilus-location-bar.c:
+ * src/nautilus-location-dialog.c:
+ * src/nautilus-location-entry.c:
+ * src/nautilus-shell-interface.idl:
+ * src/nautilus-side-pane.h:
+ * src/nautilus-sidebar-title.c:
+ * src/nautilus-simple-search-bar.c:
+ Minor changes to build.
+
+ * src/nautilus-shell.c:
+ Remove WEB_NAVIGATION_ENABLED
+
+ * src/nautilus-application.c:
+ * src/nautilus-desktop-window.c:
+ * src/nautilus-navigation-window-menus.c:
+ * src/nautilus-navigation-window.[ch]:
+ * src/nautilus-spatial-window.c:
+ * src/nautilus-window-manage-views.[ch]:
+ * src/nautilus-window-menus.c:
+ * src/nautilus-window-private.h:
+ * src/nautilus-window.[ch]:
+ Initial conversion to new NautilusView interface.
+
+ * src/file-manager/Makefile.am:
+ * src/file-manager/fm-bonobo-provider.[ch]:
+ Removed. Not needed anymore.
+ Temporary commented out fm-tree-view.[ch]
+
+ * src/file-manager/fm-desktop-icon-view.c:
+ * src/file-manager/fm-desktop-icon-view.h:
+ * src/file-manager/fm-directory-view.c:
+ * src/file-manager/fm-directory-view.h:
+ * src/file-manager/fm-icon-view.c:
+ * src/file-manager/fm-icon-view.h:
+ * src/file-manager/fm-list-view.c:
+ * src/file-manager/fm-list-view.h:
+ * src/file-manager/fm-properties-window.c:
+ * src/file-manager/fm-tree-view.h:
+ Initial conversion to new NautilusView interface.
+
2004-11-09 Mark McLoughlin <mark@skynet.ie>
* Makefile.am: install nautilus-file-management-properties.desktop
diff --git a/Makefile.am b/Makefile.am
index f2e83ef9d..1a15c7d31 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,15 +11,12 @@ desktop_in_files = \
nautilus-file-management-properties.desktop.in
SUBDIRS = \
- libnautilus \
libnautilus-extension \
cut-n-paste-code \
libbackground \
libnautilus-private \
- libnautilus-adapter \
src \
test \
- components \
po \
data \
icons \
diff --git a/components/Makefile.am b/components/Makefile.am
deleted file mode 100644
index 01670366f..000000000
--- a/components/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-NULL=
-
-SUBDIRS = \
- adapter \
- history \
- notes \
- text \
- throbber \
- emblem \
- image_properties \
- $(NULL)
-
-# loser \
-# sample \
-# These should only be built by people that know what they do
-
-# news \
-# Disable the news-sidebar for now, It has lots of bugs and doesn't
-# really fit into a file manager.
diff --git a/components/adapter/Makefile.am b/components/adapter/Makefile.am
deleted file mode 100644
index 45dc52cd0..000000000
--- a/components/adapter/Makefile.am
+++ /dev/null
@@ -1,53 +0,0 @@
-NULL =
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"Nautilus-Adapter\" \
- -DICON_DIR=\"$(datadir)/pixmaps/nautilus\" \
- -I$(top_srcdir) \
- $(DISABLE_DEPRECATED_CFLAGS) \
- $(COMPONENT_CFLAGS) \
- $(NULL)
-
-serverdir = $(libdir)/bonobo/servers
-server_in_files = Nautilus_ComponentAdapterFactory_std.server.in
-server_DATA = $(server_in_files:.server.in=.server)
-
-$(server_in_files): $(server_in_files).in
- sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
-
-@INTLTOOL_SERVER_RULE@
-
-libexec_PROGRAMS=nautilus-adapter
-
-nautilus_adapter_SOURCES = \
- main.c \
- nautilus-adapter-control-embed-strategy.c \
- nautilus-adapter-control-embed-strategy.h \
- nautilus-adapter-embed-strategy-private.h \
- nautilus-adapter-embed-strategy.c \
- nautilus-adapter-embed-strategy.h \
- nautilus-adapter-control-factory-embed-strategy.c \
- nautilus-adapter-control-factory-embed-strategy.h \
- nautilus-adapter-factory-server.c \
- nautilus-adapter-factory-server.h \
- nautilus-adapter-file-load-strategy.c \
- nautilus-adapter-file-load-strategy.h \
- nautilus-adapter-load-strategy.c \
- nautilus-adapter-load-strategy.h \
- nautilus-adapter-load-strategy.h \
- nautilus-adapter-stream-load-strategy.c \
- nautilus-adapter-stream-load-strategy.h \
- nautilus-zoomable-proxy.c \
- nautilus-zoomable-proxy.h \
- nautilus-adapter.c \
- nautilus-adapter.h \
- $(NULL)
-
-nautilus_adapter_LDADD = \
- $(top_builddir)/libnautilus/libnautilus.la \
- $(top_builddir)/libnautilus-adapter/libnautilus-adapter.la \
- $(COMPONENT_LIBS) \
- $(NULL)
-
-EXTRA_DIST = $(server_in_files).in
-CLEANFILES = $(server_in_files) $(server_DATA)
diff --git a/components/adapter/Nautilus_ComponentAdapterFactory_std.server.in.in b/components/adapter/Nautilus_ComponentAdapterFactory_std.server.in.in
deleted file mode 100644
index db5151fd8..000000000
--- a/components/adapter/Nautilus_ComponentAdapterFactory_std.server.in.in
+++ /dev/null
@@ -1,22 +0,0 @@
-<oaf_info>
-
-
-<oaf_server iid="OAFIID:Nautilus_Adapter_Factory_Factory"
- type="exe" location="@LIBEXECDIR@/nautilus-adapter">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Factory for Nautilus component adapter factories"/>
- <oaf_attribute name="description" type="string" _value="Factory for Nautilus component adapter factories "/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:Nautilus_Adapter_Factory" type="factory" location="OAFIID:Nautilus_Adapter_Factory_Factory">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Nautilus/ComponentAdapterFactory:1.0"/>
- <item value="IDL:Bonobo/Unknown:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Nautilus component adapter factory"/>
- <oaf_attribute name="description" type="string" _value="Factory for objects that wrap ordinary Bonobo Controls or Embeddables to look like Nautilus Views"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/components/adapter/main.c b/components/adapter/main.c
deleted file mode 100644
index a496c2d31..000000000
--- a/components/adapter/main.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* main.c - Main function and object activation function for component adapter
- */
-
-#include <config.h>
-
-#include "nautilus-adapter-factory-server.h"
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-ui-main.h>
-#include <eel/eel-debug.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtksignal.h>
-#include <libgnome/gnome-init.h>
-#include <libgnomeui/gnome-authentication-manager.h>
-#include <libgnomeui/gnome-client.h>
-#include <libgnomevfs/gnome-vfs-init.h>
-#include <eel/eel-gnome-extensions.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define META_FACTORY_IID "OAFIID:Nautilus_Adapter_Factory_Factory"
-#define FACTORY_OBJECT_IID "OAFIID:Nautilus_Adapter_Factory"
-
-static int object_count = 0;
-
-static void
-adapter_factory_object_weak_notify (gpointer data, GObject *object)
-{
- object_count--;
- if (object_count <= 0) {
- bonobo_main_quit ();
- }
-}
-
-static BonoboObject *
-adapter_factory_make_object (BonoboGenericFactory *factory,
- const char *iid,
- gpointer callback_data)
-{
- NautilusAdapterFactoryServer *adapter;
-
- g_assert (BONOBO_IS_GENERIC_FACTORY (factory));
- g_assert (iid != NULL);
- g_assert (callback_data == NULL);
-
- /* Check that this is the one type of object we know how to
- * create.
- */
- if (strcmp (iid, FACTORY_OBJECT_IID) != 0) {
- return NULL;
- }
-
- adapter = NAUTILUS_ADAPTER_FACTORY_SERVER (g_object_new (NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER, NULL));
-
- /* Connect a handler that will get us out of the main loop
- * when there are no more objects outstanding.
- */
- object_count++;
- g_object_weak_ref (G_OBJECT (adapter),
- adapter_factory_object_weak_notify,
- NULL);
-
- return BONOBO_OBJECT (adapter);
-}
-
-int
-main (int argc, char *argv[])
-{
- BonoboGenericFactory *factory;
- char *registration_id;
-
- if (g_getenv ("NAUTILUS_DEBUG") != NULL) {
- eel_make_warnings_and_criticals_stop_in_debugger ();
- }
-
- if (!bonobo_ui_init ("nautilus-adapter", VERSION, &argc, argv)) {
- g_error (_("bonobo_ui_init() failed."));
- }
-
- /* Disable session manager connection */
- g_object_set (G_OBJECT (gnome_program_get()),
- GNOME_CLIENT_PARAM_SM_CONNECT, FALSE, NULL);
-
- /* Create the factory. */
-
- registration_id = eel_bonobo_make_registration_id (META_FACTORY_IID);
-
- factory = bonobo_generic_factory_new (registration_id, adapter_factory_make_object, NULL);
-
- g_free (registration_id);
-
- gnome_authentication_manager_init ();
-
- /* Loop until we have no more objects. */
- do {
- bonobo_main ();
- } while (object_count > 0);
-
- /* Let the factory go. */
- bonobo_object_unref (factory);
-
- gnome_vfs_shutdown ();
-
- return EXIT_SUCCESS;
-}
diff --git a/components/adapter/nautilus-adapter-control-embed-strategy.c b/components/adapter/nautilus-adapter-control-embed-strategy.c
deleted file mode 100644
index 11dfeec72..000000000
--- a/components/adapter/nautilus-adapter-control-embed-strategy.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-
-/* nautilus-adapter-control-embed-strategy.c -
- */
-
-
-#include <config.h>
-
-#include "nautilus-adapter-control-embed-strategy.h"
-#include "nautilus-adapter-embed-strategy-private.h"
-#include "nautilus-zoomable-proxy.h"
-
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
-#include <eel/eel-gtk-macros.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-control-frame.h>
-
-
-struct NautilusAdapterControlEmbedStrategyDetails {
- BonoboControlFrame *control_frame;
- BonoboObject *zoomable;
- GtkWidget *widget;
-};
-
-
-static void nautilus_adapter_control_embed_strategy_class_init (NautilusAdapterControlEmbedStrategyClass *klass);
-static void nautilus_adapter_control_embed_strategy_init (NautilusAdapterControlEmbedStrategy *strategy);
-static void nautilus_adapter_control_embed_strategy_activate (NautilusAdapterEmbedStrategy *object,
- gpointer ui_container);
-static void nautilus_adapter_control_embed_strategy_deactivate (NautilusAdapterEmbedStrategy *object);
-static void nautilus_adapter_control_embed_strategy_destroy (GtkObject *object);
-
-static GtkWidget *nautilus_adapter_control_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *strategy);
-static BonoboObject *nautilus_adapter_control_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *strategy);
-
-
-EEL_CLASS_BOILERPLATE (NautilusAdapterControlEmbedStrategy, nautilus_adapter_control_embed_strategy, NAUTILUS_TYPE_ADAPTER_EMBED_STRATEGY)
-
-
-static void
-nautilus_adapter_control_embed_strategy_class_init (NautilusAdapterControlEmbedStrategyClass *klass)
-{
- GtkObjectClass *object_class;
- NautilusAdapterEmbedStrategyClass *adapter_embed_strategy_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
-
- object_class->destroy = nautilus_adapter_control_embed_strategy_destroy;
-
- adapter_embed_strategy_class = NAUTILUS_ADAPTER_EMBED_STRATEGY_CLASS (klass);
-
- adapter_embed_strategy_class->get_widget = nautilus_adapter_control_embed_strategy_get_widget;
- adapter_embed_strategy_class->get_zoomable = nautilus_adapter_control_embed_strategy_get_zoomable;
- adapter_embed_strategy_class->activate = nautilus_adapter_control_embed_strategy_activate;
- adapter_embed_strategy_class->deactivate = nautilus_adapter_control_embed_strategy_deactivate;
-}
-
-static void
-nautilus_adapter_control_embed_strategy_init (NautilusAdapterControlEmbedStrategy *strategy)
-{
- strategy->details = g_new0 (NautilusAdapterControlEmbedStrategyDetails, 1);
-}
-
-static void
-nautilus_adapter_control_embed_strategy_destroy (GtkObject *object)
-{
- NautilusAdapterControlEmbedStrategy *strategy;
-
- strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (object);
-
- bonobo_object_unref (strategy->details->control_frame);
- g_free (strategy->details);
-
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-static void
-nautilus_adapter_control_embed_strategy_activate (NautilusAdapterEmbedStrategy *object,
- gpointer ui_container)
-{
- NautilusAdapterControlEmbedStrategy *strategy;
- Bonobo_UIContainer corba_container = ui_container;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (NAUTILUS_IS_ADAPTER_CONTROL_EMBED_STRATEGY (object));
-
- strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (object);
-
- bonobo_control_frame_set_ui_container (strategy->details->control_frame,
- corba_container, NULL);
-
- bonobo_control_frame_control_activate (strategy->details->control_frame);
-}
-
-static void
-nautilus_adapter_control_embed_strategy_deactivate (NautilusAdapterEmbedStrategy *object)
-{
- NautilusAdapterControlEmbedStrategy *strategy;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (NAUTILUS_IS_ADAPTER_CONTROL_EMBED_STRATEGY (object));
-
- strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (object);
-
- /* This is not strictly necessary, but it makes sure that the component's menus
- * and toolbars are really unmerged even if our component is badly behaving or
- * leaking a reference somewhere. */
- bonobo_control_frame_control_deactivate (strategy->details->control_frame);
-}
-
-static void
-activate_uri_callback (BonoboControlFrame *frame,
- const char *uri,
- gboolean relative,
- NautilusAdapterControlEmbedStrategy *strategy)
-{
- /* FIXME bugzilla.gnome.org 44404: ignoring `relative' parameter as
- * the concept is kind of broken.
- */
- nautilus_adapter_embed_strategy_emit_open_location (NAUTILUS_ADAPTER_EMBED_STRATEGY (strategy),
- uri);
-}
-
-NautilusAdapterEmbedStrategy *
-nautilus_adapter_control_embed_strategy_new (Bonobo_Control control,
- Bonobo_UIContainer ui_container)
-{
- NautilusAdapterControlEmbedStrategy *strategy;
- Bonobo_Zoomable corba_zoomable;
- CORBA_Environment ev;
-
- strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (g_object_new (NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY, NULL));
- g_object_ref (strategy);
- gtk_object_sink (GTK_OBJECT (strategy));
-
- strategy->details->control_frame = bonobo_control_frame_new (ui_container);
-
- bonobo_control_frame_bind_to_control (strategy->details->control_frame, control, NULL);
-
- strategy->details->widget = bonobo_control_frame_get_widget (strategy->details->control_frame);
-
- g_signal_connect_object (strategy->details->control_frame, "activate_uri",
- G_CALLBACK (activate_uri_callback), strategy, 0);
-
- CORBA_exception_init (&ev);
- corba_zoomable = Bonobo_Unknown_queryInterface (control,
- "IDL:Bonobo/Zoomable:1.0",
- &ev);
- if ((ev._major == CORBA_NO_EXCEPTION) &&
- !CORBA_Object_is_nil (corba_zoomable, &ev)) {
- strategy->details->zoomable = nautilus_zoomable_proxy_get
- (corba_zoomable);
- bonobo_object_release_unref (corba_zoomable, &ev);
- }
-
- CORBA_exception_free (&ev);
-
- return NAUTILUS_ADAPTER_EMBED_STRATEGY (strategy);
-}
-
-static GtkWidget *
-nautilus_adapter_control_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *abstract_strategy)
-{
- NautilusAdapterControlEmbedStrategy *strategy;
-
- strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (abstract_strategy);
-
- return strategy->details->widget;
-}
-
-static BonoboObject *
-nautilus_adapter_control_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *abstract_strategy)
-{
- NautilusAdapterControlEmbedStrategy *strategy;
-
- strategy = NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY (abstract_strategy);
-
- return strategy->details->zoomable;
-}
-
-
diff --git a/components/adapter/nautilus-adapter-control-embed-strategy.h b/components/adapter/nautilus-adapter-control-embed-strategy.h
deleted file mode 100644
index c0c8de3d1..000000000
--- a/components/adapter/nautilus-adapter-control-embed-strategy.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-adapter-control-embed-strategy.h
- */
-
-#ifndef NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY_H
-#define NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY_H
-
-#include "nautilus-adapter-embed-strategy.h"
-
-#define NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY (nautilus_adapter_control_embed_strategy_get_type ())
-#define NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY, NautilusAdapterControlEmbedStrategy))
-#define NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY, NautilusAdapterControlEmbedStrategyClass))
-#define NAUTILUS_IS_ADAPTER_CONTROL_EMBED_STRATEGY(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY))
-#define NAUTILUS_IS_ADAPTER_CONTROL_EMBED_STRATEGY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ADAPTER_CONTROL_EMBED_STRATEGY))
-
-typedef struct NautilusAdapterControlEmbedStrategyDetails NautilusAdapterControlEmbedStrategyDetails;
-
-typedef struct {
- NautilusAdapterEmbedStrategy parent;
- NautilusAdapterControlEmbedStrategyDetails *details;
-} NautilusAdapterControlEmbedStrategy;
-
-typedef struct {
- NautilusAdapterEmbedStrategyClass parent;
-} NautilusAdapterControlEmbedStrategyClass;
-
-/* GObject support */
-GType nautilus_adapter_control_embed_strategy_get_type (void);
-
-NautilusAdapterEmbedStrategy *nautilus_adapter_control_embed_strategy_new (Bonobo_Control control,
- Bonobo_UIContainer ui_container);
-
-
-#endif /* NAUTILUS_ADAPTER_CONTROL_EMBED_STRATEGY_H */
-
-
-
diff --git a/components/adapter/nautilus-adapter-control-factory-embed-strategy.c b/components/adapter/nautilus-adapter-control-factory-embed-strategy.c
deleted file mode 100644
index 15c2e59f3..000000000
--- a/components/adapter/nautilus-adapter-control-factory-embed-strategy.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-
-/* nautilus-adapter-control_factory-embed-strategy.c -
- */
-
-#include <config.h>
-#include "nautilus-adapter-control-factory-embed-strategy.h"
-
-#include "nautilus-adapter-embed-strategy-private.h"
-#include "nautilus-zoomable-proxy.h"
-
-#include <bonobo/bonobo-control-frame.h>
-#include <eel/eel-gtk-macros.h>
-#include <libnautilus/nautilus-view.h>
-
-struct NautilusAdapterControlFactoryEmbedStrategyDetails {
- Bonobo_ControlFactory control_factory;
- BonoboControlFrame *control_frame;
- GtkWidget *client_widget;
- BonoboObject *zoomable;
-};
-
-static void nautilus_adapter_control_factory_embed_strategy_class_init (NautilusAdapterControlFactoryEmbedStrategyClass *klass);
-static void nautilus_adapter_control_factory_embed_strategy_init (NautilusAdapterControlFactoryEmbedStrategy *strategy);
-static void nautilus_adapter_control_factory_embed_strategy_destroy (GtkObject *object);
-static void nautilus_adapter_control_factory_embed_strategy_activate (NautilusAdapterEmbedStrategy *object,
- gpointer ui_container);
-static void nautilus_adapter_control_factory_embed_strategy_deactivate (NautilusAdapterEmbedStrategy *object);
-
-
-static GtkWidget *nautilus_adapter_control_factory_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *strategy);
-static BonoboObject *nautilus_adapter_control_factory_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *strategy);
-
-
-EEL_CLASS_BOILERPLATE (NautilusAdapterControlFactoryEmbedStrategy, nautilus_adapter_control_factory_embed_strategy, NAUTILUS_TYPE_ADAPTER_EMBED_STRATEGY)
-
-
-static void
-nautilus_adapter_control_factory_embed_strategy_class_init (NautilusAdapterControlFactoryEmbedStrategyClass *klass)
-{
- GtkObjectClass *object_class;
- NautilusAdapterEmbedStrategyClass *adapter_embed_strategy_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
-
- object_class->destroy = nautilus_adapter_control_factory_embed_strategy_destroy;
-
- adapter_embed_strategy_class = NAUTILUS_ADAPTER_EMBED_STRATEGY_CLASS (klass);
-
- adapter_embed_strategy_class->get_widget = nautilus_adapter_control_factory_embed_strategy_get_widget;
- adapter_embed_strategy_class->get_zoomable = nautilus_adapter_control_factory_embed_strategy_get_zoomable;
- adapter_embed_strategy_class->activate = nautilus_adapter_control_factory_embed_strategy_activate;
- adapter_embed_strategy_class->deactivate = nautilus_adapter_control_factory_embed_strategy_deactivate;
-}
-
-static void
-nautilus_adapter_control_factory_embed_strategy_init (NautilusAdapterControlFactoryEmbedStrategy *strategy)
-{
- strategy->details = g_new0 (NautilusAdapterControlFactoryEmbedStrategyDetails, 1);
-}
-
-
-static void
-nautilus_adapter_control_factory_embed_strategy_destroy (GtkObject *object)
-{
- NautilusAdapterControlFactoryEmbedStrategy *strategy;
-
- strategy = NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY (object);
-
- bonobo_object_unref (strategy->details->control_frame);
- g_free (strategy->details);
- strategy->details = NULL;
-
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-
-static void
-nautilus_adapter_control_factory_embed_strategy_activate (NautilusAdapterEmbedStrategy *object,
- gpointer ui_container)
-{
- NautilusAdapterControlFactoryEmbedStrategy *strategy;
- Bonobo_UIContainer corba_container = ui_container;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (NAUTILUS_IS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY (object));
-
- strategy = NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY (object);
-
- bonobo_control_frame_set_ui_container (BONOBO_CONTROL_FRAME (strategy->details->control_frame),
- corba_container, NULL);
-
- bonobo_control_frame_control_activate (BONOBO_CONTROL_FRAME (strategy->details->control_frame));
-}
-
-static void
-nautilus_adapter_control_factory_embed_strategy_deactivate (NautilusAdapterEmbedStrategy *object)
-{
- NautilusAdapterControlFactoryEmbedStrategy *strategy;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (NAUTILUS_IS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY (object));
-
- strategy = NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY (object);
-
- /* This is not strictly necessary, but it makes sure that the component's menus
- * and toolbars are really unmerged even if our component is badly behaving or
- * leaking a reference somewhere. */
- bonobo_control_frame_control_deactivate (BONOBO_CONTROL_FRAME (strategy->details->control_frame));
-}
-
-static void
-activate_uri_callback (BonoboControlFrame *frame,
- const char *uri,
- gboolean relative,
- NautilusAdapterControlFactoryEmbedStrategy *strategy)
-{
- /* FIXME: ignoring `relative' parameter as the concept is kind
- of broken. */
-
- nautilus_adapter_embed_strategy_emit_open_location (NAUTILUS_ADAPTER_EMBED_STRATEGY (strategy),
- uri);
-}
-
-NautilusAdapterEmbedStrategy *
-nautilus_adapter_control_factory_embed_strategy_new (Bonobo_ControlFactory control_factory,
- Bonobo_UIContainer ui_container)
-{
- NautilusAdapterControlFactoryEmbedStrategy *strategy;
- Bonobo_Control control;
- CORBA_Environment ev;
-
- strategy = NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY (g_object_new (NAUTILUS_TYPE_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY, NULL));
- g_object_ref (strategy);
- gtk_object_sink (GTK_OBJECT (strategy));
-
- CORBA_exception_init (&ev);
-
- strategy->details->control_frame = bonobo_control_frame_new (ui_container);
- control = Bonobo_ControlFactory_createControl (control_factory,
- BONOBO_OBJREF (strategy->details->control_frame),
- ui_container, &ev);
-
- if ((ev._major == CORBA_NO_EXCEPTION) &&
- !CORBA_Object_is_nil (control, &ev)) {
- Bonobo_Zoomable corba_zoomable;
- strategy->details->client_widget = bonobo_control_frame_get_widget
- (strategy->details->control_frame);
- g_signal_connect_object (strategy->details->control_frame, "activate_uri",
- G_CALLBACK (activate_uri_callback), strategy, 0);
-
- gtk_widget_show (strategy->details->client_widget);
-
- corba_zoomable = Bonobo_Unknown_queryInterface (control,
- "IDL:Bonobo/Zoomable:1.0",
- &ev);
-
- if ((ev._major == CORBA_NO_EXCEPTION) &&
- !CORBA_Object_is_nil (corba_zoomable, &ev)) {
- strategy->details->zoomable = nautilus_zoomable_proxy_get
- (corba_zoomable);
- }
- } else
- strategy->details->client_widget = NULL;
-
- CORBA_exception_free (&ev);
-
- return NAUTILUS_ADAPTER_EMBED_STRATEGY (strategy);
-}
-
-static GtkWidget *
-nautilus_adapter_control_factory_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *abstract_strategy)
-{
- NautilusAdapterControlFactoryEmbedStrategy *strategy;
-
- strategy = NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY (abstract_strategy);
- return strategy->details->client_widget;
-}
-
-static BonoboObject *
-nautilus_adapter_control_factory_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *abstract_strategy)
-{
- NautilusAdapterControlFactoryEmbedStrategy *strategy;
-
- strategy = NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY (abstract_strategy);
-
- return strategy->details->zoomable;
-}
diff --git a/components/adapter/nautilus-adapter-control-factory-embed-strategy.h b/components/adapter/nautilus-adapter-control-factory-embed-strategy.h
deleted file mode 100644
index 2ebb05949..000000000
--- a/components/adapter/nautilus-adapter-control-factory-embed-strategy.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-adapter-control_factory-embed-strategy.h
- */
-
-#ifndef NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY_H
-#define NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY_H
-
-#include "nautilus-adapter-embed-strategy.h"
-
-#define NAUTILUS_TYPE_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY \
- (nautilus_adapter_control_factory_embed_strategy_get_type ())
-#define NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY, NautilusAdapterControlFactoryEmbedStrategy))
-#define NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY, NautilusAdapterControlFactoryEmbedStrategyClass))
-#define NAUTILUS_IS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY))
-#define NAUTILUS_IS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY))
-
-typedef struct NautilusAdapterControlFactoryEmbedStrategyDetails NautilusAdapterControlFactoryEmbedStrategyDetails;
-
-typedef struct {
- NautilusAdapterEmbedStrategy parent;
- NautilusAdapterControlFactoryEmbedStrategyDetails *details;
-} NautilusAdapterControlFactoryEmbedStrategy;
-
-typedef struct {
- NautilusAdapterEmbedStrategyClass parent;
-} NautilusAdapterControlFactoryEmbedStrategyClass;
-
-/* GObject support */
-GType nautilus_adapter_control_factory_embed_strategy_get_type (void);
-
-NautilusAdapterEmbedStrategy *nautilus_adapter_control_factory_embed_strategy_new (Bonobo_ControlFactory control_factory,
- Bonobo_UIContainer ui_container);
-
-#endif /* NAUTILUS_ADAPTER_CONTROL_FACTORY_EMBED_STRATEGY_H */
diff --git a/components/adapter/nautilus-adapter-embed-strategy-private.h b/components/adapter/nautilus-adapter-embed-strategy-private.h
deleted file mode 100644
index 306582803..000000000
--- a/components/adapter/nautilus-adapter-embed-strategy-private.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-adapter-embed-strategy.h
- */
-
-#ifndef NAUTILUS_ADAPTER_EMBED_STRATEGY_PRIVATE_H
-#define NAUTILUS_ADAPTER_EMBED_STRATEGY_PRIVATE_H
-
-#include "nautilus-adapter-embed-strategy.h"
-
-void nautilus_adapter_embed_strategy_emit_open_location (NautilusAdapterEmbedStrategy *strategy,
- const char *uri);
-
-
-#endif /* NAUTILUS_ADAPTER_EMBED_STRATEGY_PRIVATE_H */
diff --git a/components/adapter/nautilus-adapter-embed-strategy.c b/components/adapter/nautilus-adapter-embed-strategy.c
deleted file mode 100644
index f52b11dcd..000000000
--- a/components/adapter/nautilus-adapter-embed-strategy.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000, 2001 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-
-/* nautilus-adapter-embed-strategy.h
- */
-
-
-#include <config.h>
-#include "nautilus-adapter-embed-strategy.h"
-
-#include "nautilus-adapter-control-embed-strategy.h"
-#include "nautilus-adapter-embed-strategy-private.h"
-#include "nautilus-adapter-control-factory-embed-strategy.h"
-
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
-#include <eel/eel-gtk-macros.h>
-#include <stdio.h>
-
-enum {
- ACTIVATE,
- DEACTIVATE,
- OPEN_LOCATION,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-static void nautilus_adapter_embed_strategy_class_init (NautilusAdapterEmbedStrategyClass *klass);
-static void nautilus_adapter_embed_strategy_init (NautilusAdapterEmbedStrategy *strategy);
-
-EEL_CLASS_BOILERPLATE (NautilusAdapterEmbedStrategy,
- nautilus_adapter_embed_strategy,
- GTK_TYPE_OBJECT)
-
-EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (nautilus_adapter_embed_strategy, get_widget)
-EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (nautilus_adapter_embed_strategy, get_zoomable)
-
-static void
-nautilus_adapter_embed_strategy_class_init (NautilusAdapterEmbedStrategyClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) klass;
-
- signals[ACTIVATE] =
- g_signal_new ("activate",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusAdapterEmbedStrategyClass, activate),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals[DEACTIVATE] =
- g_signal_new ("deactivate",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusAdapterEmbedStrategyClass, deactivate),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[OPEN_LOCATION] =
- g_signal_new ("open_location",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusAdapterEmbedStrategyClass, open_location),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, nautilus_adapter_embed_strategy, get_widget);
- EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, nautilus_adapter_embed_strategy, get_zoomable);
-}
-
-static void
-nautilus_adapter_embed_strategy_init (NautilusAdapterEmbedStrategy *strategy)
-{
-}
-
-NautilusAdapterEmbedStrategy *
-nautilus_adapter_embed_strategy_get (Bonobo_Unknown component)
-{
- NautilusAdapterEmbedStrategy *strategy;
- Bonobo_ControlFactory control_factory;
- Bonobo_Control control;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- strategy = NULL;
-
- control = Bonobo_Unknown_queryInterface
- (component, "IDL:Bonobo/Control:1.0", &ev);
- if (ev._major == CORBA_NO_EXCEPTION && !CORBA_Object_is_nil (control, &ev)) {
- strategy = nautilus_adapter_control_embed_strategy_new
- (control, CORBA_OBJECT_NIL);
- bonobo_object_release_unref (control, NULL);
- }
-
- if (strategy != NULL) {
- control_factory = Bonobo_Unknown_queryInterface
- (component, "IDL:Bonobo/ControlFactory:1.0", &ev);
- if (ev._major == CORBA_NO_EXCEPTION && !CORBA_Object_is_nil (control_factory, &ev)) {
- strategy = nautilus_adapter_control_factory_embed_strategy_new
- (control_factory, CORBA_OBJECT_NIL);
- bonobo_object_release_unref (control_factory, NULL);
- }
- }
-
- CORBA_exception_free (&ev);
-
- return strategy;
-}
-
-GtkWidget *
-nautilus_adapter_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *strategy)
-{
- return EEL_CALL_METHOD_WITH_RETURN_VALUE
- (NAUTILUS_ADAPTER_EMBED_STRATEGY_CLASS, strategy,
- get_widget, (strategy));
-}
-
-BonoboObject *
-nautilus_adapter_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *strategy)
-{
- return EEL_CALL_METHOD_WITH_RETURN_VALUE
- (NAUTILUS_ADAPTER_EMBED_STRATEGY_CLASS, strategy,
- get_zoomable, (strategy));
-}
-
-
-void
-nautilus_adapter_embed_strategy_activate (NautilusAdapterEmbedStrategy *strategy,
- Bonobo_UIContainer ui_container)
-{
- g_signal_emit (strategy,
- signals[ACTIVATE], 0,
- ui_container);
-}
-
-void
-nautilus_adapter_embed_strategy_deactivate (NautilusAdapterEmbedStrategy *strategy)
-{
- g_signal_emit (strategy,
- signals[DEACTIVATE], 0);
-}
-
-void
-nautilus_adapter_embed_strategy_emit_open_location (NautilusAdapterEmbedStrategy *strategy,
- const char *uri)
-{
- g_signal_emit (strategy,
- signals[OPEN_LOCATION], 0,
- uri);
-}
diff --git a/components/adapter/nautilus-adapter-embed-strategy.h b/components/adapter/nautilus-adapter-embed-strategy.h
deleted file mode 100644
index af97bf37b..000000000
--- a/components/adapter/nautilus-adapter-embed-strategy.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-adapter-embed-strategy.h
- */
-
-#ifndef NAUTILUS_ADAPTER_EMBED_STRATEGY_H
-#define NAUTILUS_ADAPTER_EMBED_STRATEGY_H
-
-#include <gtk/gtkobject.h>
-#include <bonobo/Bonobo.h>
-#include <libnautilus/nautilus-view.h>
-
-#define NAUTILUS_TYPE_ADAPTER_EMBED_STRATEGY (nautilus_adapter_embed_strategy_get_type ())
-#define NAUTILUS_ADAPTER_EMBED_STRATEGY(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ADAPTER_EMBED_STRATEGY, NautilusAdapterEmbedStrategy))
-#define NAUTILUS_ADAPTER_EMBED_STRATEGY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ADAPTER_EMBED_STRATEGY, NautilusAdapterEmbedStrategyClass))
-#define NAUTILUS_IS_ADAPTER_EMBED_STRATEGY(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ADAPTER_EMBED_STRATEGY))
-#define NAUTILUS_IS_ADAPTER_EMBED_STRATEGY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ADAPTER_EMBED_STRATEGY))
-
-typedef struct NautilusAdapterEmbedStrategyDetails NautilusAdapterEmbedStrategyDetails;
-
-typedef struct {
- GtkObject parent;
-} NautilusAdapterEmbedStrategy;
-
-typedef struct {
- GtkObjectClass parent;
-
- /* signals */
- void (*activate) (NautilusAdapterEmbedStrategy *strategy,
- gpointer corba_container);
- void (*deactivate) (NautilusAdapterEmbedStrategy *strategy);
- void (*open_location) (NautilusAdapterEmbedStrategy *strategy,
- const char *uri);
-
- /* virtual functions */
- GtkWidget *(*get_widget) (NautilusAdapterEmbedStrategy *strategy);
- BonoboObject *(*get_zoomable)(NautilusAdapterEmbedStrategy *strategy);
-
-} NautilusAdapterEmbedStrategyClass;
-
-/* GObject support */
-GType nautilus_adapter_embed_strategy_get_type (void);
-
-/* Instantiates the proper concrete subclass */
-NautilusAdapterEmbedStrategy *nautilus_adapter_embed_strategy_get (Bonobo_Unknown component);
-
-void nautilus_adapter_embed_strategy_activate (NautilusAdapterEmbedStrategy *strategy,
- Bonobo_UIContainer ui_container);
-void nautilus_adapter_embed_strategy_deactivate (NautilusAdapterEmbedStrategy *strategy);
-
-GtkWidget *nautilus_adapter_embed_strategy_get_widget (NautilusAdapterEmbedStrategy *strategy);
-
-BonoboObject *nautilus_adapter_embed_strategy_get_zoomable (NautilusAdapterEmbedStrategy *strategy);
-
-
-#endif /* NAUTILUS_ADAPTER_EMBED_STRATEGY_H */
-
-
-
diff --git a/components/adapter/nautilus-adapter-factory-server.c b/components/adapter/nautilus-adapter-factory-server.c
deleted file mode 100644
index 3431c3745..000000000
--- a/components/adapter/nautilus-adapter-factory-server.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-adapter-factory-server.c - Server object for a factory to
- * create NautilusAdapter objects.
- */
-
-#include <config.h>
-#include "nautilus-adapter-factory-server.h"
-
-#include "nautilus-adapter.h"
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-main.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gtk/gtksignal.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-stock-icons.h>
-#include <libnautilus-adapter/nautilus-adapter-factory.h>
-#include <eel/eel-gtk-macros.h>
-#include <libnautilus/nautilus-bonobo-ui.h>
-
-static Nautilus_View
-impl_Nautilus_ComponentAdapterFactory_create_adapter (PortableServer_Servant servant,
- const Bonobo_Unknown component,
- CORBA_Environment *ev);
-
-static void nautilus_adapter_factory_server_class_init (NautilusAdapterFactoryServerClass *klass);
-static void nautilus_adapter_factory_server_init (NautilusAdapterFactoryServer *server);
-static void nautilus_adapter_factory_server_finalize (GObject *object);
-
-static BonoboObjectClass *parent_class;
-
-
-static void
-nautilus_adapter_factory_server_class_init (NautilusAdapterFactoryServerClass *klass)
-{
- GObjectClass *object_class;
- POA_Nautilus_ComponentAdapterFactory__epv *epv = &klass->epv;
-
- g_assert (NAUTILUS_IS_ADAPTER_FACTORY_SERVER_CLASS (klass));
-
- parent_class = g_type_class_peek_parent (klass);
-
- epv->create_adapter = impl_Nautilus_ComponentAdapterFactory_create_adapter;
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = nautilus_adapter_factory_server_finalize;
-}
-
-static void
-nautilus_adapter_factory_server_init (NautilusAdapterFactoryServer *server)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- g_assert (NAUTILUS_IS_ADAPTER_FACTORY_SERVER (server));
-
- CORBA_exception_free (&ev);
-}
-
-static void
-nautilus_adapter_factory_server_finalize (GObject *object)
-{
- EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-static void
-adapter_object_weak_notify (gpointer server,
- GObject *adapter)
-{
- bonobo_object_unref (server);
-}
-
-
-static Nautilus_View
-impl_Nautilus_ComponentAdapterFactory_create_adapter (PortableServer_Servant servant,
- const Bonobo_Unknown component,
- CORBA_Environment *ev)
-{
- NautilusAdapterFactoryServer *factory_servant;
- NautilusAdapter *adapter;
- NautilusView *adapter_view;
-
- factory_servant = NAUTILUS_ADAPTER_FACTORY_SERVER (bonobo_object (servant));
- adapter = nautilus_adapter_new (component);
-
- if (adapter == NULL) {
- return CORBA_OBJECT_NIL;
- } else {
- bonobo_object_ref (factory_servant);
-
- adapter_view = nautilus_adapter_get_nautilus_view (adapter);
- g_object_weak_ref (G_OBJECT (adapter_view),
- adapter_object_weak_notify,
- factory_servant);
-
- return CORBA_Object_duplicate (BONOBO_OBJREF (adapter_view),
- ev);
- }
-}
-
-GType
-nautilus_adapter_factory_server_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof (NautilusAdapterFactoryServerClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc)nautilus_adapter_factory_server_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (NautilusAdapterFactoryServer),
- 0, /* n_preallocs */
- (GInstanceInitFunc)nautilus_adapter_factory_server_init
- };
-
- type = bonobo_type_unique
- (BONOBO_OBJECT_TYPE,
- POA_Nautilus_ComponentAdapterFactory__init, NULL,
- G_STRUCT_OFFSET (NautilusAdapterFactoryServerClass,
- epv),
- &info, "NautilusAdapterFactoryServer");
- }
-
- return type;
-}
-
-
diff --git a/components/adapter/nautilus-adapter-factory-server.h b/components/adapter/nautilus-adapter-factory-server.h
deleted file mode 100644
index 06d8e90a6..000000000
--- a/components/adapter/nautilus-adapter-factory-server.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-adapter-factory-server.c - Server object for a factory to
- * create NautilusAdapter objects.
- */
-
-#ifndef NAUTILUS_ADAPTER_FACTORY_SERVER_H
-#define NAUTILUS_ADAPTER_FACTORY_SERVER_H
-
-#include <libnautilus-adapter/nautilus-adapter-factory.h>
-#include <gtk/gtklabel.h>
-#include <libnautilus/nautilus-view.h>
-
-#define NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER (nautilus_adapter_factory_server_get_type ())
-#define NAUTILUS_ADAPTER_FACTORY_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER, NautilusAdapterFactoryServer))
-#define NAUTILUS_ADAPTER_FACTORY_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER, NautilusAdapterFactoryServerClass))
-#define NAUTILUS_IS_ADAPTER_FACTORY_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER))
-#define NAUTILUS_IS_ADAPTER_FACTORY_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ADAPTER_FACTORY_SERVER))
-
-typedef struct {
- BonoboObject parent;
-} NautilusAdapterFactoryServer;
-
-typedef struct {
- BonoboObjectClass parent;
-
- POA_Nautilus_ComponentAdapterFactory__epv epv;
-} NautilusAdapterFactoryServerClass;
-
-/* GObject support */
-GType nautilus_adapter_factory_server_get_type (void);
-
-
-#endif /* NAUTILUS_ADAPTER_FACTORY_SERVER_H */
diff --git a/components/adapter/nautilus-adapter-file-load-strategy.c b/components/adapter/nautilus-adapter-file-load-strategy.c
deleted file mode 100644
index caf43672c..000000000
--- a/components/adapter/nautilus-adapter-file-load-strategy.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-
-/* nautilus-adapter-file-load-strategy.c -
- */
-
-
-#include <config.h>
-
-#include <string.h>
-#include "nautilus-adapter-file-load-strategy.h"
-
-#include <gtk/gtkobject.h>
-#include <eel/eel-gtk-macros.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <libnautilus/nautilus-view.h>
-
-
-struct NautilusAdapterFileLoadStrategyDetails {
- Bonobo_PersistFile persist_file;
-};
-
-
-static void nautilus_adapter_file_load_strategy_class_init (NautilusAdapterFileLoadStrategyClass *klass);
-static void nautilus_adapter_file_load_strategy_init (NautilusAdapterFileLoadStrategy *strategy);
-static void nautilus_adapter_file_load_strategy_destroy (GtkObject *object);
-
-static void nautilus_adapter_file_load_strategy_load_location (NautilusAdapterLoadStrategy *strategy,
- const char *uri);
-
-static void nautilus_adapter_file_load_strategy_stop_loading (NautilusAdapterLoadStrategy *strategy);
-
-
-EEL_CLASS_BOILERPLATE (NautilusAdapterFileLoadStrategy, nautilus_adapter_file_load_strategy, NAUTILUS_TYPE_ADAPTER_LOAD_STRATEGY)
-
-
-static void
-nautilus_adapter_file_load_strategy_class_init (NautilusAdapterFileLoadStrategyClass *klass)
-{
- GtkObjectClass *object_class;
- NautilusAdapterLoadStrategyClass *adapter_load_strategy_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
-
- object_class->destroy = nautilus_adapter_file_load_strategy_destroy;
-
- adapter_load_strategy_class = NAUTILUS_ADAPTER_LOAD_STRATEGY_CLASS (klass);
-
- adapter_load_strategy_class->load_location = nautilus_adapter_file_load_strategy_load_location;
- adapter_load_strategy_class->stop_loading = nautilus_adapter_file_load_strategy_stop_loading;
-}
-
-static void
-nautilus_adapter_file_load_strategy_init (NautilusAdapterFileLoadStrategy *strategy)
-{
- strategy->details = g_new0 (NautilusAdapterFileLoadStrategyDetails, 1);
-}
-
-static void
-nautilus_adapter_file_load_strategy_destroy (GtkObject *object)
-{
- NautilusAdapterFileLoadStrategy *strategy;
- CORBA_Environment ev;
-
- strategy = NAUTILUS_ADAPTER_FILE_LOAD_STRATEGY (object);
-
- if (strategy->details->persist_file != CORBA_OBJECT_NIL) {
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (strategy->details->persist_file, &ev);
- CORBA_exception_free (&ev);
- }
-
- g_free (strategy->details);
-
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-
-
-
-NautilusAdapterLoadStrategy *
-nautilus_adapter_file_load_strategy_new (Bonobo_PersistFile persist_file)
-{
- NautilusAdapterFileLoadStrategy *strategy;
-
- strategy = NAUTILUS_ADAPTER_FILE_LOAD_STRATEGY (g_object_new (NAUTILUS_TYPE_ADAPTER_FILE_LOAD_STRATEGY, NULL));
- g_object_ref (strategy);
- gtk_object_sink (GTK_OBJECT (strategy));
-
- strategy->details->persist_file = persist_file;
-
- return NAUTILUS_ADAPTER_LOAD_STRATEGY (strategy);
-}
-
-static ORBit_IMethod *
-get_file_load_method (void)
-{
- guint i;
- ORBit_IInterface *iface;
- static ORBit_IMethod *method = NULL;
-
- iface = &Bonobo_PersistFile__iinterface;
- if (!method) {
- for (i = 0; i < iface->methods._length; i++) {
- if (!strcmp ("load", iface->methods._buffer [i].name)) {
- method = &iface->methods._buffer [i];
- }
- }
- }
- g_assert (method);
-
- return method;
-}
-
-static void
-nautilus_adapter_file_load_strategy_load_location (NautilusAdapterLoadStrategy *abstract_strategy,
- const char *uri)
-
-{
- char *local_path;
- gpointer args[1];
- NautilusAdapterFileLoadStrategy *strategy;
-
- strategy = NAUTILUS_ADAPTER_FILE_LOAD_STRATEGY (abstract_strategy);
-
- g_object_ref (strategy);
-
- local_path = gnome_vfs_get_local_path_from_uri (uri);
-
- if (local_path == NULL) {
- nautilus_adapter_load_strategy_report_load_failed (abstract_strategy);
- return;
- }
-
- nautilus_adapter_load_strategy_report_load_underway (abstract_strategy);
-
- args [0] = &local_path;
-
- nautilus_adapter_load_strategy_load_async (
- abstract_strategy,
- strategy->details->persist_file,
- get_file_load_method (),
- args,
- NULL, NULL);
-
- g_object_unref (strategy);
-
- g_free (local_path);
-}
-
-static void
-nautilus_adapter_file_load_strategy_stop_loading (NautilusAdapterLoadStrategy *abstract_strategy)
-{
-
- g_return_if_fail (NAUTILUS_IS_ADAPTER_FILE_LOAD_STRATEGY (abstract_strategy));
-
-}
-
diff --git a/components/adapter/nautilus-adapter-file-load-strategy.h b/components/adapter/nautilus-adapter-file-load-strategy.h
deleted file mode 100644
index 646c92360..000000000
--- a/components/adapter/nautilus-adapter-file-load-strategy.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-adapter-file-load-strategy.h
- */
-
-#ifndef NAUTILUS_ADAPTER_FILE_LOAD_STRATEGY_H
-#define NAUTILUS_ADAPTER_FILE_LOAD_STRATEGY_H
-
-#include "nautilus-adapter-load-strategy.h"
-
-#define NAUTILUS_TYPE_ADAPTER_FILE_LOAD_STRATEGY (nautilus_adapter_file_load_strategy_get_type ())
-#define NAUTILUS_ADAPTER_FILE_LOAD_STRATEGY(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ADAPTER_FILE_LOAD_STRATEGY, NautilusAdapterFileLoadStrategy))
-#define NAUTILUS_ADAPTER_FILE_LOAD_STRATEGY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ADAPTER_FILE_LOAD_STRATEGY, NautilusAdapterFileLoadStrategyClass))
-#define NAUTILUS_IS_ADAPTER_FILE_LOAD_STRATEGY(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ADAPTER_FILE_LOAD_STRATEGY))
-#define NAUTILUS_IS_ADAPTER_FILE_LOAD_STRATEGY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ADAPTER_FILE_LOAD_STRATEGY))
-
-typedef struct NautilusAdapterFileLoadStrategyDetails NautilusAdapterFileLoadStrategyDetails;
-
-typedef struct {
- NautilusAdapterLoadStrategy parent;
- NautilusAdapterFileLoadStrategyDetails *details;
-} NautilusAdapterFileLoadStrategy;
-
-typedef struct {
- NautilusAdapterLoadStrategyClass parent;
-} NautilusAdapterFileLoadStrategyClass;
-
-/* GObject support */
-GType nautilus_adapter_file_load_strategy_get_type (void);
-
-NautilusAdapterLoadStrategy *nautilus_adapter_file_load_strategy_new (Bonobo_PersistFile persist_file);
-
-
-#endif /* NAUTILUS_ADAPTER_FILE_LOAD_STRATEGY_H */
-
-
-
diff --git a/components/adapter/nautilus-adapter-load-strategy.c b/components/adapter/nautilus-adapter-load-strategy.c
deleted file mode 100644
index 4c1a31961..000000000
--- a/components/adapter/nautilus-adapter-load-strategy.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-
-/* nautilus-adapter-load-strategy.h
- */
-
-
-#include <config.h>
-
-#include "nautilus-adapter-load-strategy.h"
-#include "nautilus-adapter-stream-load-strategy.h"
-#include "nautilus-adapter-file-load-strategy.h"
-
-#include <gtk/gtkobject.h>
-#include <eel/eel-gtk-macros.h>
-#include <eel/eel-gtk-extensions.h>
-#include <bonobo/bonobo-exception.h>
-
-enum {
- REPORT_LOAD_UNDERWAY,
- REPORT_LOAD_PROGRESS,
- REPORT_LOAD_COMPLETE,
- REPORT_LOAD_FAILED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-
-
-static void nautilus_adapter_load_strategy_class_init (NautilusAdapterLoadStrategyClass *klass);
-static void nautilus_adapter_load_strategy_init (NautilusAdapterLoadStrategy *strategy);
-static void nautilus_adapter_load_strategy_destroy (GtkObject *object);
-
-EEL_CLASS_BOILERPLATE (NautilusAdapterLoadStrategy, nautilus_adapter_load_strategy, GTK_TYPE_OBJECT)
-
-EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (nautilus_adapter_load_strategy, load_location)
-EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (nautilus_adapter_load_strategy, stop_loading)
-
-static void
-nautilus_adapter_load_strategy_class_init (NautilusAdapterLoadStrategyClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) klass;
-
- object_class->destroy = nautilus_adapter_load_strategy_destroy;
-
- EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, nautilus_adapter_load_strategy, load_location);
- EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, nautilus_adapter_load_strategy, stop_loading);
-
-
- signals[REPORT_LOAD_UNDERWAY] =
- g_signal_new ("report_load_underway",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusAdapterLoadStrategyClass, report_load_underway),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[REPORT_LOAD_PROGRESS] =
- g_signal_new ("report_load_progress",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusAdapterLoadStrategyClass, report_load_progress),
- NULL, NULL,
- g_cclosure_marshal_VOID__DOUBLE,
- G_TYPE_NONE, 1, G_TYPE_DOUBLE);
- signals[REPORT_LOAD_COMPLETE] =
- g_signal_new ("report_load_complete",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusAdapterLoadStrategyClass, report_load_complete),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[REPORT_LOAD_FAILED] =
- g_signal_new ("report_load_failed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusAdapterLoadStrategyClass, report_load_failed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-static void
-nautilus_adapter_load_strategy_init (NautilusAdapterLoadStrategy *strategy)
-{
-
-}
-
-static void
-nautilus_adapter_load_strategy_destroy (GtkObject *object)
-{
- NautilusAdapterLoadStrategy *strategy;
-
- strategy = NAUTILUS_ADAPTER_LOAD_STRATEGY (object);
-
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-
-
-
-NautilusAdapterLoadStrategy *
-nautilus_adapter_load_strategy_get (Bonobo_Unknown component)
-{
- Bonobo_PersistStream persist_stream;
- Bonobo_PersistFile persist_file;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- persist_stream = Bonobo_Unknown_queryInterface (component,
- "IDL:Bonobo/PersistStream:1.0", &ev);
-
- if (ev._major == CORBA_NO_EXCEPTION && !CORBA_Object_is_nil (persist_stream, &ev)) {
- CORBA_exception_free (&ev);
-
- return nautilus_adapter_stream_load_strategy_new (persist_stream);
- }
-
-
- persist_file = Bonobo_Unknown_queryInterface (component,
- "IDL:Bonobo/PersistFile:1.0", &ev);
-
- if (ev._major == CORBA_NO_EXCEPTION && !CORBA_Object_is_nil (persist_file, &ev)) {
- CORBA_exception_free (&ev);
-
- return nautilus_adapter_file_load_strategy_new (persist_file);
- }
-
- CORBA_exception_free (&ev);
-
- return NULL;
-}
-
-
-void
-nautilus_adapter_load_strategy_load_location (NautilusAdapterLoadStrategy *strategy,
- const char *uri)
-{
- g_return_if_fail (NAUTILUS_IS_ADAPTER_LOAD_STRATEGY (strategy));
-
- EEL_CALL_METHOD (NAUTILUS_ADAPTER_LOAD_STRATEGY_CLASS, strategy,
- load_location, (strategy, uri));
-}
-
-void
-nautilus_adapter_load_strategy_stop_loading (NautilusAdapterLoadStrategy *strategy)
-{
-
- g_return_if_fail (NAUTILUS_IS_ADAPTER_LOAD_STRATEGY (strategy));
-
- EEL_CALL_METHOD (NAUTILUS_ADAPTER_LOAD_STRATEGY_CLASS, strategy,
- stop_loading, (strategy));
-}
-
-
-/* "protected" calls, should only be called by subclasses */
-
-void
-nautilus_adapter_load_strategy_report_load_underway (NautilusAdapterLoadStrategy *strategy)
-{
- g_signal_emit (strategy,
- signals[REPORT_LOAD_UNDERWAY], 0);
-}
-
-void
-nautilus_adapter_load_strategy_report_load_progress (NautilusAdapterLoadStrategy *strategy,
- double fraction_done)
-{
- g_signal_emit (strategy,
- signals[REPORT_LOAD_PROGRESS], 0,
- fraction_done);
-}
-
-void
-nautilus_adapter_load_strategy_report_load_complete (NautilusAdapterLoadStrategy *strategy)
-{
- g_signal_emit (strategy, signals[REPORT_LOAD_COMPLETE], 0);
-}
-
-void
-nautilus_adapter_load_strategy_report_load_failed (NautilusAdapterLoadStrategy *strategy)
-{
- g_signal_emit (strategy, signals[REPORT_LOAD_FAILED], 0);
-}
-
-typedef struct {
- gpointer user_data;
- GDestroyNotify done_cb;
- NautilusAdapterLoadStrategy *strategy;
-} AsyncClosure;
-
-static void
-nautilus_adapter_load_strategy_report_async_status (CORBA_Object object,
- ORBit_IMethod *m_data,
- ORBitAsyncQueueEntry *aqe,
- gpointer user_data,
- CORBA_Environment *ev)
-{
- AsyncClosure *c;
-
- c = user_data;
- g_return_if_fail (NAUTILUS_IS_ADAPTER_LOAD_STRATEGY (c->strategy));
-
- if (BONOBO_EX (ev)) {
- nautilus_adapter_load_strategy_report_load_failed (c->strategy);
- } else {
- nautilus_adapter_load_strategy_report_load_complete (c->strategy);
- }
-
- g_object_unref (c->strategy);
-
- if (c->done_cb) {
- c->done_cb (c->user_data);
- }
-
- g_free (c);
-}
-
-void
-nautilus_adapter_load_strategy_load_async (NautilusAdapterLoadStrategy *strategy,
- CORBA_Object object,
- ORBit_IMethod *m_data,
- gpointer *args,
- GDestroyNotify done_cb,
- gpointer user_data)
-{
- AsyncClosure *c;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- c = g_new (AsyncClosure, 1);
- c->done_cb = done_cb;
- c->strategy = strategy;
- c->user_data = user_data;
-
- g_object_ref (G_OBJECT (strategy));
-
- ORBit_small_invoke_async
- (object, m_data,
- nautilus_adapter_load_strategy_report_async_status,
- c, args, NULL, &ev);
-
- if (BONOBO_EX (&ev)) {
- nautilus_adapter_load_strategy_report_async_status (
- object, m_data, NULL, c, &ev);
- }
-
- CORBA_exception_free (&ev);
-}
diff --git a/components/adapter/nautilus-adapter-load-strategy.h b/components/adapter/nautilus-adapter-load-strategy.h
deleted file mode 100644
index c88a73bc5..000000000
--- a/components/adapter/nautilus-adapter-load-strategy.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-adapter-load-strategy.h
- */
-
-#ifndef NAUTILUS_ADAPTER_LOAD_STRATEGY_H
-#define NAUTILUS_ADAPTER_LOAD_STRATEGY_H
-
-#include <gtk/gtkobject.h>
-#include <bonobo/Bonobo.h>
-#include <libnautilus/nautilus-view.h>
-
-#define NAUTILUS_TYPE_ADAPTER_LOAD_STRATEGY (nautilus_adapter_load_strategy_get_type ())
-#define NAUTILUS_ADAPTER_LOAD_STRATEGY(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ADAPTER_LOAD_STRATEGY, NautilusAdapterLoadStrategy))
-#define NAUTILUS_ADAPTER_LOAD_STRATEGY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ADAPTER_LOAD_STRATEGY, NautilusAdapterLoadStrategyClass))
-#define NAUTILUS_IS_ADAPTER_LOAD_STRATEGY(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ADAPTER_LOAD_STRATEGY))
-#define NAUTILUS_IS_ADAPTER_LOAD_STRATEGY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ADAPTER_LOAD_STRATEGY))
-
-typedef struct NautilusAdapterLoadStrategyDetails NautilusAdapterLoadStrategyDetails;
-
-typedef struct {
- GtkObject parent;
-} NautilusAdapterLoadStrategy;
-
-typedef struct {
- GtkObjectClass parent;
-
- /* signals */
- void (* report_load_underway) (NautilusAdapterLoadStrategy *strategy);
- void (* report_load_progress) (NautilusAdapterLoadStrategy *strategy,
- double fraction_done);
- void (* report_load_complete) (NautilusAdapterLoadStrategy *strategy);
- void (* report_load_failed) (NautilusAdapterLoadStrategy *strategy);
-
- /* virtual methods */
- void (*load_location) (NautilusAdapterLoadStrategy *strategy,
- const char *uri);
-
- void (*stop_loading) (NautilusAdapterLoadStrategy *strategy);
-} NautilusAdapterLoadStrategyClass;
-
-/* GObject support */
-GType nautilus_adapter_load_strategy_get_type (void);
-
-/* Instantiates the proper concrete subclass */
-NautilusAdapterLoadStrategy *nautilus_adapter_load_strategy_get (Bonobo_Unknown component);
-
-void nautilus_adapter_load_strategy_load_location (NautilusAdapterLoadStrategy *strategy,
- const char *uri);
-void nautilus_adapter_load_strategy_stop_loading (NautilusAdapterLoadStrategy *strategy);
-
-
-/* "protected" calls, should only be called by subclasses */
-
-void nautilus_adapter_load_strategy_report_load_underway (NautilusAdapterLoadStrategy *strategy);
-void nautilus_adapter_load_strategy_report_load_progress (NautilusAdapterLoadStrategy *strategy,
- double fraction_done);
-void nautilus_adapter_load_strategy_report_load_complete (NautilusAdapterLoadStrategy *strategy);
-void nautilus_adapter_load_strategy_report_load_failed (NautilusAdapterLoadStrategy *strategy);
-
-void nautilus_adapter_load_strategy_load_async (NautilusAdapterLoadStrategy *strategy,
- CORBA_Object object,
- ORBit_IMethod *m_data,
- gpointer *args,
- GDestroyNotify done_cb,
- gpointer user_data);
-
-#endif /* NAUTILUS_ADAPTER_LOAD_STRATEGY_H */
-
-
-
diff --git a/components/adapter/nautilus-adapter-stream-load-strategy.c b/components/adapter/nautilus-adapter-stream-load-strategy.c
deleted file mode 100644
index 37cf7552f..000000000
--- a/components/adapter/nautilus-adapter-stream-load-strategy.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-
-/* nautilus-adapter-stream-load-strategy.c -
- */
-
-
-#include <config.h>
-
-#include <string.h>
-#include "nautilus-adapter-stream-load-strategy.h"
-
-#include <bonobo/bonobo-stream.h>
-#include <bonobo/bonobo-moniker-util.h>
-#include <bonobo/bonobo-exception.h>
-#include <gtk/gtkobject.h>
-#include <eel/eel-gtk-macros.h>
-#include <libnautilus/nautilus-view.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libgnomevfs/gnome-vfs-mime-utils.h>
-
-struct NautilusAdapterStreamLoadStrategyDetails {
- Bonobo_PersistStream persist_stream;
-};
-
-
-static void nautilus_adapter_stream_load_strategy_class_init (NautilusAdapterStreamLoadStrategyClass *klass);
-static void nautilus_adapter_stream_load_strategy_init (NautilusAdapterStreamLoadStrategy *strategy);
-static void nautilus_adapter_stream_load_strategy_destroy (GtkObject *object);
-
-static void nautilus_adapter_stream_load_strategy_load_location (NautilusAdapterLoadStrategy *strategy,
- const char *uri);
-
-static void nautilus_adapter_stream_load_strategy_stop_loading (NautilusAdapterLoadStrategy *strategy);
-
-
-EEL_CLASS_BOILERPLATE (NautilusAdapterStreamLoadStrategy, nautilus_adapter_stream_load_strategy, NAUTILUS_TYPE_ADAPTER_LOAD_STRATEGY)
-
-
-static void
-nautilus_adapter_stream_load_strategy_class_init (NautilusAdapterStreamLoadStrategyClass *klass)
-{
- GtkObjectClass *object_class;
- NautilusAdapterLoadStrategyClass *adapter_load_strategy_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
-
- object_class->destroy = nautilus_adapter_stream_load_strategy_destroy;
-
- adapter_load_strategy_class = NAUTILUS_ADAPTER_LOAD_STRATEGY_CLASS (klass);
-
- adapter_load_strategy_class->load_location = nautilus_adapter_stream_load_strategy_load_location;
- adapter_load_strategy_class->stop_loading = nautilus_adapter_stream_load_strategy_stop_loading;
-}
-
-static void
-nautilus_adapter_stream_load_strategy_init (NautilusAdapterStreamLoadStrategy *strategy)
-{
- strategy->details = g_new0 (NautilusAdapterStreamLoadStrategyDetails, 1);
-}
-
-static void
-nautilus_adapter_stream_load_strategy_destroy (GtkObject *object)
-{
- NautilusAdapterStreamLoadStrategy *strategy;
- CORBA_Environment ev;
-
- strategy = NAUTILUS_ADAPTER_STREAM_LOAD_STRATEGY (object);
-
- if (strategy->details->persist_stream != CORBA_OBJECT_NIL) {
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (strategy->details->persist_stream, &ev);
- CORBA_exception_free (&ev);
- }
-
- g_free (strategy->details);
-
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-
-NautilusAdapterLoadStrategy *
-nautilus_adapter_stream_load_strategy_new (Bonobo_PersistStream persist_stream)
-{
- NautilusAdapterStreamLoadStrategy *strategy;
-
- strategy = NAUTILUS_ADAPTER_STREAM_LOAD_STRATEGY (g_object_new (NAUTILUS_TYPE_ADAPTER_STREAM_LOAD_STRATEGY, NULL));
- g_object_ref (strategy);
- gtk_object_sink (GTK_OBJECT (strategy));
-
- strategy->details->persist_stream = persist_stream;
-
- return NAUTILUS_ADAPTER_LOAD_STRATEGY (strategy);
-}
-
-static ORBit_IMethod *
-get_stream_load_method (void)
-{
- guint i;
- ORBit_IInterface *iface;
- static ORBit_IMethod *method = NULL;
-
- iface = &Bonobo_PersistStream__iinterface;
- if (!method) {
- for (i = 0; i < iface->methods._length; i++) {
- if (!strcmp ("load", iface->methods._buffer [i].name)) {
- method = &iface->methods._buffer [i];
- }
- }
- }
- g_assert (method);
-
- return method;
-}
-
-static void
-unref_stream_cb (gpointer user_data)
-{
- bonobo_object_release_unref (user_data, NULL);
-}
-
-static void
-nautilus_adapter_stream_load_strategy_load_location (NautilusAdapterLoadStrategy *abstract_strategy,
- const char *uri)
-{
- NautilusAdapterStreamLoadStrategy *strategy;
- Bonobo_Stream stream;
- CORBA_Environment ev;
- char *moniker_str;
- char *escaped_uri;
- char *mime_type;
- gpointer args[2];
-
- strategy = NAUTILUS_ADAPTER_STREAM_LOAD_STRATEGY (abstract_strategy);
- g_object_ref (strategy);
-
- CORBA_exception_init (&ev);
-
- nautilus_adapter_load_strategy_report_load_underway (abstract_strategy);
-
- /* We must escape the '!' in the URI here, because it is
- * used as argument delimiter within monikers.
- */
- escaped_uri = gnome_vfs_escape_set (uri, "!");
- moniker_str = g_strconcat ("vfs:", escaped_uri, NULL);
- stream = bonobo_get_object (moniker_str, "IDL:Bonobo/Stream:1.0", &ev);
- g_free (moniker_str);
- g_free (escaped_uri);
-
- if (BONOBO_EX (&ev) || CORBA_Object_is_nil (stream, &ev)) {
- nautilus_adapter_load_strategy_report_load_failed (abstract_strategy);
- } else {
- /* This adds an extra sniffing, which is a bit of a problem.
- * We think this is ok, since it is relatively cheap and
- * the adapter isn't used often. When the adapter is
- * moved into the nautilus process, this should use the
- * mime type from the NautilusFile. */
- mime_type = gnome_vfs_get_mime_type (uri);
- args [0] = &stream;
- args [1] = &mime_type;
-
- nautilus_adapter_load_strategy_load_async (
- abstract_strategy,
- strategy->details->persist_stream,
- get_stream_load_method (),
- args,
- unref_stream_cb,
- stream);
-
- g_free (mime_type);
- }
-
- g_object_unref (strategy);
-
- CORBA_exception_free (&ev);
-}
-
-static void
-nautilus_adapter_stream_load_strategy_stop_loading (NautilusAdapterLoadStrategy *strategy)
-{
- g_return_if_fail (NAUTILUS_IS_ADAPTER_STREAM_LOAD_STRATEGY (strategy));
-
- /* FIXME bugzilla.gnome.org 43456: is there anything we can do? */
-}
diff --git a/components/adapter/nautilus-adapter-stream-load-strategy.h b/components/adapter/nautilus-adapter-stream-load-strategy.h
deleted file mode 100644
index b02666f65..000000000
--- a/components/adapter/nautilus-adapter-stream-load-strategy.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-adapter-stream-load-strategy.h
- */
-
-#ifndef NAUTILUS_ADAPTER_STREAM_LOAD_STRATEGY_H
-#define NAUTILUS_ADAPTER_STREAM_LOAD_STRATEGY_H
-
-#include "nautilus-adapter-load-strategy.h"
-
-#define NAUTILUS_TYPE_ADAPTER_STREAM_LOAD_STRATEGY (nautilus_adapter_stream_load_strategy_get_type ())
-#define NAUTILUS_ADAPTER_STREAM_LOAD_STRATEGY(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ADAPTER_STREAM_LOAD_STRATEGY, NautilusAdapterStreamLoadStrategy))
-#define NAUTILUS_ADAPTER_STREAM_LOAD_STRATEGY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ADAPTER_STREAM_LOAD_STRATEGY, NautilusAdapterStreamLoadStrategyClass))
-#define NAUTILUS_IS_ADAPTER_STREAM_LOAD_STRATEGY(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ADAPTER_STREAM_LOAD_STRATEGY))
-#define NAUTILUS_IS_ADAPTER_STREAM_LOAD_STRATEGY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ADAPTER_STREAM_LOAD_STRATEGY))
-
-typedef struct NautilusAdapterStreamLoadStrategyDetails NautilusAdapterStreamLoadStrategyDetails;
-
-typedef struct {
- NautilusAdapterLoadStrategy parent;
- NautilusAdapterStreamLoadStrategyDetails *details;
-} NautilusAdapterStreamLoadStrategy;
-
-typedef struct {
- NautilusAdapterLoadStrategyClass parent;
-} NautilusAdapterStreamLoadStrategyClass;
-
-/* GObject support */
-GType nautilus_adapter_stream_load_strategy_get_type (void);
-
-NautilusAdapterLoadStrategy *nautilus_adapter_stream_load_strategy_new (Bonobo_PersistStream persist_stream);
-
-
-#endif /* NAUTILUS_ADAPTER_STREAM_LOAD_STRATEGY_H */
-
-
-
diff --git a/components/adapter/nautilus-adapter.c b/components/adapter/nautilus-adapter.c
deleted file mode 100644
index ba17057f2..000000000
--- a/components/adapter/nautilus-adapter.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-adapter.c - Class for adapting bonobo Control/ControlFactory
- * to look like Nautilus views.
- */
-
-#include <config.h>
-#include "nautilus-adapter.h"
-
-#include "nautilus-adapter-embed-strategy-private.h"
-#include "nautilus-adapter-embed-strategy.h"
-#include "nautilus-adapter-load-strategy.h"
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-item-container.h>
-#include <eel/eel-gtk-macros.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gtk/gtkhbox.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-stock-icons.h>
-#include <libnautilus-adapter/nautilus-adapter-factory.h>
-#include <libnautilus/nautilus-bonobo-ui.h>
-
-struct NautilusAdapterDetails {
- NautilusView *nautilus_view;
- NautilusAdapterEmbedStrategy *embed_strategy;
- NautilusAdapterLoadStrategy *load_strategy;
-};
-
-
-static void nautilus_adapter_load_location_callback (NautilusView *view,
- const char *uri,
- NautilusAdapter *adapter);
-static void nautilus_adapter_stop_loading_callback (NautilusView *view,
- NautilusAdapter *adapter);
-static void nautilus_adapter_activate_callback (BonoboControl *control,
- gboolean state,
- NautilusAdapter *adapter);
-static void nautilus_adapter_open_location_callback (NautilusAdapterEmbedStrategy *strategy,
- const char *uri,
- NautilusAdapter *adapter);
-static void nautilus_adapter_load_underway_callback (NautilusAdapter *adapter);
-static void nautilus_adapter_load_progress_callback (NautilusAdapter *adapter,
- double fraction_complete);
-static void nautilus_adapter_load_complete_callback (NautilusAdapter *adapter);
-static void nautilus_adapter_load_failed_callback (NautilusAdapter *adapter);
-static void nautilus_adapter_class_init (NautilusAdapterClass *klass);
-static void nautilus_adapter_init (NautilusAdapter *server);
-static void nautilus_adapter_destroy (GtkObject *object);
-
-
-EEL_CLASS_BOILERPLATE (NautilusAdapter,
- nautilus_adapter,
- GTK_TYPE_OBJECT)
-
-
-static void
-nautilus_adapter_class_init (NautilusAdapterClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
-
- object_class->destroy = nautilus_adapter_destroy;
-}
-
-static void
-nautilus_adapter_init (NautilusAdapter *adapter)
-{
- adapter->details = g_new0 (NautilusAdapterDetails, 1);
- g_object_ref (adapter);
- gtk_object_sink (GTK_OBJECT (adapter));
-}
-
-static void
-nautilus_adapter_destroy (GtkObject *object)
-{
- NautilusAdapter *adapter;
-
- adapter = NAUTILUS_ADAPTER (object);
-
- if (adapter->details->embed_strategy != NULL) {
- nautilus_adapter_embed_strategy_deactivate (adapter->details->embed_strategy);
- }
-
- if (adapter->details->load_strategy != NULL) {
- nautilus_adapter_load_strategy_stop_loading (adapter->details->load_strategy);
- g_object_unref (adapter->details->load_strategy);
- }
-
- if (adapter->details->embed_strategy != NULL) {
- g_object_unref (adapter->details->embed_strategy);
- }
-
- g_free (adapter->details);
-
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-NautilusAdapter *
-nautilus_adapter_new (Bonobo_Unknown component)
-{
- NautilusAdapter *adapter;
- BonoboControl *control;
- GtkWidget *box;
- BonoboObject *zoomable;
-
- /* FIXME bugzilla.gnome.org 44405: should be done with
- * construct args
- */
-
- adapter = NAUTILUS_ADAPTER (g_object_new (NAUTILUS_TYPE_ADAPTER, NULL));
-
- /* Set up a few wrapper framework details */
- box = gtk_hbox_new (FALSE, 0);
- gtk_widget_show (box);
- control = bonobo_control_new (box);
- adapter->details->nautilus_view = nautilus_view_new_from_bonobo_control (control);
-
- g_object_weak_ref (G_OBJECT (adapter->details->nautilus_view),
- (GWeakNotify)g_object_unref, adapter);
-
- /* Get the class to handle embedding this kind of component. */
- adapter->details->embed_strategy = nautilus_adapter_embed_strategy_get (component);
- if (adapter->details->embed_strategy == NULL) {
- g_object_unref (adapter);
- return NULL;
- }
-
- /* Get the NautilusAdapterZoomable proxy object. */
- zoomable = nautilus_adapter_embed_strategy_get_zoomable (adapter->details->embed_strategy);
- if (zoomable != NULL)
- bonobo_object_add_interface (BONOBO_OBJECT (control), zoomable);
-
- g_signal_connect_object (control, "activate",
- G_CALLBACK (nautilus_adapter_activate_callback), adapter, 0);
- g_signal_connect_object (adapter->details->embed_strategy, "open_location",
- G_CALLBACK (nautilus_adapter_open_location_callback), adapter, 0);
-
- /* Get the class to handle loading this kind of component. */
- adapter->details->load_strategy = nautilus_adapter_load_strategy_get (component);
- if (adapter->details->load_strategy == NULL) {
- g_object_unref (adapter);
- return NULL;
- }
-
- /* hook up load strategy signals */
- g_signal_connect_object (adapter->details->load_strategy, "report_load_underway",
- G_CALLBACK (nautilus_adapter_load_underway_callback),
- adapter, G_CONNECT_SWAPPED);
- g_signal_connect_object (adapter->details->load_strategy, "report_load_progress",
- G_CALLBACK (nautilus_adapter_load_progress_callback),
- adapter, G_CONNECT_SWAPPED);
- g_signal_connect_object (adapter->details->load_strategy, "report_load_complete",
- G_CALLBACK (nautilus_adapter_load_complete_callback),
- adapter, G_CONNECT_SWAPPED);
- g_signal_connect_object (adapter->details->load_strategy, "report_load_failed",
- G_CALLBACK (nautilus_adapter_load_failed_callback),
- adapter, G_CONNECT_SWAPPED);
-
- /* complete the embedding */
- gtk_container_add (GTK_CONTAINER (box),
- nautilus_adapter_embed_strategy_get_widget (adapter->details->embed_strategy));
-
- /* hook up view signals. */
- g_signal_connect_object (adapter->details->nautilus_view, "load_location",
- G_CALLBACK (nautilus_adapter_load_location_callback), adapter, 0);
- g_signal_connect_object (adapter->details->nautilus_view, "stop_loading",
- G_CALLBACK (nautilus_adapter_stop_loading_callback), adapter, 0);
-
- return adapter;
-}
-
-NautilusView *
-nautilus_adapter_get_nautilus_view (NautilusAdapter *adapter)
-{
- return adapter->details->nautilus_view;
-}
-
-static void
-nautilus_adapter_load_location_callback (NautilusView *view,
- const char *location,
- NautilusAdapter *adapter)
-{
- nautilus_adapter_load_strategy_load_location (adapter->details->load_strategy,
- location);
-}
-
-
-static void
-nautilus_adapter_stop_loading_callback (NautilusView *view,
- NautilusAdapter *adapter)
-{
- nautilus_adapter_load_strategy_stop_loading (adapter->details->load_strategy);
-}
-
-
-static void
-nautilus_adapter_open_location_callback (NautilusAdapterEmbedStrategy *strategy,
- const char *uri,
- NautilusAdapter *adapter)
-{
- nautilus_view_open_location
- (adapter->details->nautilus_view,
- uri, Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE, 0, NULL);
-}
-
-
-static void
-nautilus_adapter_activate_callback (BonoboControl *control,
- gboolean state,
- NautilusAdapter *adapter)
-{
- g_return_if_fail (control != NULL);
- g_return_if_fail (BONOBO_IS_CONTROL (control));
- g_return_if_fail (adapter != NULL);
- g_return_if_fail (NAUTILUS_IS_ADAPTER (adapter));
-
- if (state) {
- Bonobo_UIContainer corba_container;
-
- corba_container = bonobo_control_get_remote_ui_container (control, NULL);
- nautilus_adapter_embed_strategy_activate (adapter->details->embed_strategy,
- corba_container);
- } else
- nautilus_adapter_embed_strategy_deactivate (adapter->details->embed_strategy);
-}
-
-
-static void
-nautilus_adapter_load_underway_callback (NautilusAdapter *adapter)
-{
- nautilus_view_report_load_underway (adapter->details->nautilus_view);
-}
-
-static void
-nautilus_adapter_load_progress_callback (NautilusAdapter *adapter,
- double fraction_complete)
-{
- nautilus_view_report_load_progress (adapter->details->nautilus_view,
- fraction_complete);
-}
-
-static void
-nautilus_adapter_load_complete_callback (NautilusAdapter *adapter)
-{
- nautilus_view_report_load_complete (adapter->details->nautilus_view);
-}
-
-static void
-nautilus_adapter_load_failed_callback (NautilusAdapter *adapter)
-{
- nautilus_view_report_load_failed (adapter->details->nautilus_view);
-}
diff --git a/components/adapter/nautilus-adapter.h b/components/adapter/nautilus-adapter.h
deleted file mode 100644
index dcd14ef01..000000000
--- a/components/adapter/nautilus-adapter.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-adapter.h - Adapter component.
- */
-
-#ifndef NAUTILUS_ADAPTER_H
-#define NAUTILUS_ADAPTER_H
-
-#include <libnautilus/nautilus-view.h>
-
-#define NAUTILUS_TYPE_ADAPTER (nautilus_adapter_get_type ())
-#define NAUTILUS_ADAPTER(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ADAPTER, NautilusAdapter))
-#define NAUTILUS_ADAPTER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ADAPTER, NautilusAdapterClass))
-#define NAUTILUS_IS_ADAPTER(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ADAPTER))
-#define NAUTILUS_IS_ADAPTER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ADAPTER))
-
-typedef struct NautilusAdapterDetails NautilusAdapterDetails;
-
-typedef struct {
- GtkObject parent;
- NautilusAdapterDetails *details;
-} NautilusAdapter;
-
-typedef struct {
- GtkObjectClass parent;
-} NautilusAdapterClass;
-
-/* GObject support */
-GType nautilus_adapter_get_type (void);
-
-NautilusAdapter *nautilus_adapter_new (Bonobo_Unknown component);
-NautilusView *nautilus_adapter_get_nautilus_view (NautilusAdapter *adapter);
-
-#endif /* NAUTILUS_ADAPTER_H */
diff --git a/components/adapter/nautilus-zoomable-proxy.c b/components/adapter/nautilus-zoomable-proxy.c
deleted file mode 100644
index a57aeb02e..000000000
--- a/components/adapter/nautilus-zoomable-proxy.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2000 Eazel, Inc.
- * 2000 SuSE GmbH.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Maciej Stachowiak <mjs@eazel.com>
- * Martin Baulig <baulig@suse.de>
- *
- */
-
-#include <config.h>
-#include "nautilus-zoomable-proxy.h"
-
-#undef ZOOMABLE_DEBUG
-
-static BonoboObjectClass *nautilus_zoomable_proxy_parent_class;
-
-struct _NautilusZoomableProxyPrivate {
- Bonobo_Zoomable remote_zoomable;
-};
-
-static inline NautilusZoomableProxy *
-nautilus_zoomable_proxy_from_servant (PortableServer_Servant servant)
-{
- g_assert (NAUTILUS_IS_ZOOMABLE_PROXY (bonobo_object_from_servant (servant)));
-
- return NAUTILUS_ZOOMABLE_PROXY (bonobo_object_from_servant (servant));
-}
-
-static CORBA_float
-impl_Nautilus_ZoomableProxy__get_level (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- return Bonobo_Zoomable__get_level (proxy->priv->remote_zoomable, ev);
-}
-
-static CORBA_float
-impl_Nautilus_ZoomableProxy__get_minLevel (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- return Bonobo_Zoomable__get_minLevel (proxy->priv->remote_zoomable, ev);
-}
-
-static CORBA_float
-impl_Nautilus_ZoomableProxy__get_maxLevel (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- return Bonobo_Zoomable__get_maxLevel (proxy->priv->remote_zoomable, ev);
-}
-
-static CORBA_boolean
-impl_Nautilus_ZoomableProxy__get_hasMinLevel (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- return Bonobo_Zoomable__get_hasMinLevel (proxy->priv->remote_zoomable, ev);
-}
-
-static CORBA_boolean
-impl_Nautilus_ZoomableProxy__get_hasMaxLevel (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- return Bonobo_Zoomable__get_hasMaxLevel (proxy->priv->remote_zoomable, ev);
-}
-
-static CORBA_boolean
-impl_Nautilus_ZoomableProxy__get_isContinuous (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- return Bonobo_Zoomable__get_isContinuous (proxy->priv->remote_zoomable, ev);
-}
-
-static Bonobo_ZoomLevelList *
-impl_Nautilus_ZoomableProxy__get_preferredLevels (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- return Bonobo_Zoomable__get_preferredLevels (proxy->priv->remote_zoomable, ev);
-}
-
-static Bonobo_ZoomLevelNameList *
-impl_Nautilus_ZoomableProxy__get_preferredLevelNames (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- return Bonobo_Zoomable__get_preferredLevelNames (proxy->priv->remote_zoomable, ev);
-}
-
-static void
-impl_Nautilus_ZoomableProxy_setLevel (PortableServer_Servant servant,
- const CORBA_float zoom_level,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- Bonobo_Zoomable_setLevel (proxy->priv->remote_zoomable, zoom_level, ev);
-}
-
-static void
-impl_Nautilus_ZoomableProxy_zoomIn (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- Bonobo_Zoomable_zoomIn (proxy->priv->remote_zoomable, ev);
-}
-
-static void
-impl_Nautilus_ZoomableProxy_zoomOut (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- Bonobo_Zoomable_zoomOut (proxy->priv->remote_zoomable, ev);
-}
-
-static void
-impl_Nautilus_ZoomableProxy_zoomFit (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- Bonobo_Zoomable_zoomFit (proxy->priv->remote_zoomable, ev);
-}
-
-static void
-impl_Nautilus_ZoomableProxy_zoomDefault (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- Bonobo_Zoomable_zoomDefault (proxy->priv->remote_zoomable, ev);
-}
-
-static void
-impl_Nautilus_ZoomableProxy_setFrame (PortableServer_Servant servant,
- Bonobo_ZoomableFrame zoomable_frame,
- CORBA_Environment *ev)
-{
- NautilusZoomableProxy *proxy;
-
- proxy = nautilus_zoomable_proxy_from_servant (servant);
- Bonobo_Zoomable_setFrame (proxy->priv->remote_zoomable, zoomable_frame, ev);
-
- Bonobo_ZoomableFrame_onParametersChanged (zoomable_frame, ev);
-}
-
-
-static void
-nautilus_zoomable_proxy_init_epv (POA_Bonobo_Zoomable__epv *epv)
-{
- epv->_get_level = impl_Nautilus_ZoomableProxy__get_level;
- epv->_get_minLevel = impl_Nautilus_ZoomableProxy__get_minLevel;
- epv->_get_maxLevel = impl_Nautilus_ZoomableProxy__get_maxLevel;
- epv->_get_hasMinLevel = impl_Nautilus_ZoomableProxy__get_hasMinLevel;
- epv->_get_hasMaxLevel = impl_Nautilus_ZoomableProxy__get_hasMaxLevel;
- epv->_get_isContinuous = impl_Nautilus_ZoomableProxy__get_isContinuous;
- epv->_get_preferredLevels = impl_Nautilus_ZoomableProxy__get_preferredLevels;
- epv->_get_preferredLevelNames = impl_Nautilus_ZoomableProxy__get_preferredLevelNames;
-
- epv->zoomIn = impl_Nautilus_ZoomableProxy_zoomIn;
- epv->zoomOut = impl_Nautilus_ZoomableProxy_zoomOut;
- epv->zoomFit = impl_Nautilus_ZoomableProxy_zoomFit;
- epv->zoomDefault = impl_Nautilus_ZoomableProxy_zoomDefault;
-
- epv->setLevel = impl_Nautilus_ZoomableProxy_setLevel;
- epv->setFrame = impl_Nautilus_ZoomableProxy_setFrame;
-}
-
-static void
-nautilus_zoomable_proxy_destroy (BonoboObject *object)
-{
- NautilusZoomableProxy *proxy;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (NAUTILUS_IS_ZOOMABLE_PROXY (object));
-
- proxy = NAUTILUS_ZOOMABLE_PROXY (object);
-
- if (proxy->priv->remote_zoomable != CORBA_OBJECT_NIL)
- bonobo_object_release_unref (proxy->priv->remote_zoomable, NULL);
- proxy->priv->remote_zoomable = CORBA_OBJECT_NIL;
-
- BONOBO_OBJECT_CLASS (nautilus_zoomable_proxy_parent_class)->destroy (BONOBO_OBJECT (object));
-}
-
-static void
-nautilus_zoomable_proxy_finalize (GObject *object)
-{
- NautilusZoomableProxy *proxy;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (NAUTILUS_IS_ZOOMABLE_PROXY (object));
-
- proxy = NAUTILUS_ZOOMABLE_PROXY (object);
-
- g_free (proxy->priv);
- proxy->priv = NULL;
-
- G_OBJECT_CLASS (nautilus_zoomable_proxy_parent_class)->finalize (object);
-}
-
-static void
-nautilus_zoomable_proxy_class_init (NautilusZoomableProxyClass *klass)
-{
- GObjectClass *object_class;
- BonoboObjectClass *bonobo_object_class;
-
- object_class = (GObjectClass *) klass;
- bonobo_object_class = (BonoboObjectClass *)klass;
-
- nautilus_zoomable_proxy_parent_class =
- g_type_class_peek_parent (klass);
-
- bonobo_object_class->destroy = nautilus_zoomable_proxy_destroy;
- object_class->finalize = nautilus_zoomable_proxy_finalize;
-
- nautilus_zoomable_proxy_init_epv (&klass->epv);
-}
-
-static void
-nautilus_zoomable_proxy_init (NautilusZoomableProxy *proxy)
-{
- proxy->priv = g_new0 (NautilusZoomableProxyPrivate, 1);
-}
-
-/**
- * nautilus_zoomable_proxy_get_type:
- *
- * Returns: the GType for a NautilusZoomableProxy object.
- */
-GType
-nautilus_zoomable_proxy_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof (NautilusZoomableProxyClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) nautilus_zoomable_proxy_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (NautilusZoomableProxy),
- 0, /* n_preallocs */
- (GInstanceInitFunc) nautilus_zoomable_proxy_init
- };
-
- type = bonobo_type_unique
- (BONOBO_TYPE_OBJECT,
- POA_Bonobo_Zoomable__init, NULL,
- G_STRUCT_OFFSET (NautilusZoomableProxyClass, epv),
- &info, "NautilusZoomableProxy");
- }
-
- return type;
-}
-
-BonoboObject *
-nautilus_zoomable_proxy_get (Bonobo_Zoomable remote_zoomable)
-{
- NautilusZoomableProxy *proxy;
-
- g_return_val_if_fail (remote_zoomable != CORBA_OBJECT_NIL, NULL);
-
- proxy = g_object_new (nautilus_zoomable_proxy_get_type (), NULL);
-
- proxy->priv->remote_zoomable = bonobo_object_dup_ref (remote_zoomable, NULL);
-
- return BONOBO_OBJECT (proxy);
-}
diff --git a/components/adapter/nautilus-zoomable-proxy.h b/components/adapter/nautilus-zoomable-proxy.h
deleted file mode 100644
index b159a7e6e..000000000
--- a/components/adapter/nautilus-zoomable-proxy.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2000 Eazel, Inc.
- * 2000 SuSE GmbH.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Maciej Stachowiak <mjs@eazel.com>
- * Martin Baulig <baulig@suse.de>
- *
- */
-
-#ifndef NAUTILUS_ZOOMABLE_PROXY_H
-#define NAUTILUS_ZOOMABLE_PROXY_H
-
-#include <bonobo/bonobo-zoomable.h>
-
-#define NAUTILUS_ZOOMABLE_PROXY_TYPE (nautilus_zoomable_proxy_get_type ())
-#define NAUTILUS_ZOOMABLE_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NAUTILUS_ZOOMABLE_PROXY_TYPE, NautilusZoomableProxy))
-#define NAUTILUS_ZOOMABLE_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NAUTILUS_ZOOMABLE_PROXY_TYPE, NautilusZoomableProxyClass))
-#define NAUTILUS_IS_ZOOMABLE_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NAUTILUS_ZOOMABLE_PROXY_TYPE))
-#define NAUTILUS_S_ZOOMABLE_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NAUTILUS_ZOOMABLE_PROXY_TYPE))
-
-typedef struct _NautilusZoomableProxy NautilusZoomableProxy;
-typedef struct _NautilusZoomableProxyPrivate NautilusZoomableProxyPrivate;
-typedef struct _NautilusZoomableProxyClass NautilusZoomableProxyClass;
-
-struct _NautilusZoomableProxy {
- BonoboObject parent;
-
- NautilusZoomableProxyPrivate *priv;
-};
-
-struct _NautilusZoomableProxyClass {
- BonoboObjectClass parent;
-
- POA_Bonobo_Zoomable__epv epv;
-};
-
-GType nautilus_zoomable_proxy_get_type (void);
-
-BonoboObject *nautilus_zoomable_proxy_get (Bonobo_Zoomable corba_zoomable);
-
-#endif /* NAUTILUS_ZOOMABLE_PROXY_H */
diff --git a/components/emblem/Makefile.am b/components/emblem/Makefile.am
deleted file mode 100644
index 4c7874db5..000000000
--- a/components/emblem/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-NULL =
-
-INCLUDES = \
- -DGNOMELOCALEDIR=\""$(prefix)/${DATADIRNAME}/locale"\" \
- -DG_LOG_DOMAIN=\"Nautilus-Emblem-Sidebar\" \
- -DDATADIR=\""$(datadir)"\" \
- -I$(top_srcdir) \
- $(EMBLEM_COMPONENT_CFLAGS) \
- $(DISABLE_DEPRECATED_CFLAGS) \
- $(NULL)
-
-EMBLEM_VIEW_COMMON_SOURCES = \
- nautilus-emblem-view.c \
- nautilus-emblem-view.h \
- nautilus-emblem-view-iids.h \
- $(NULL)
-
-bonobodir = $(libdir)/bonobo
-bonobo_LTLIBRARIES = libnautilus-emblem-view.la
-
-libnautilus_emblem_view_la_SOURCES = $(EMBLEM_VIEW_COMMON_SOURCES) \
- libmain.c
-
-libnautilus_emblem_view_la_LDFLAGS = -module -avoid-version -no-undefined
-
-libnautilus_emblem_view_la_LIBADD = \
- $(top_builddir)/libnautilus/libnautilus.la \
- $(top_builddir)/libnautilus-private/libnautilus-private.la \
- $(EMBLEM_COMPONENT_LIBS)
- $(NULL)
-
-server_in_files = Nautilus_View_emblem.server.in.in
-
-serverdir = $(libdir)/bonobo/servers
-server_DATA = $(server_in_files:.server.in.in=.server)
-$(server_in_files:.server.in.in=.server.in): $(server_in_files)
- sed -e "s|\@BONOBODIR\@|$(bonobodir)|" $< > $@
-@INTLTOOL_SERVER_RULE@
-
-EXTRA_DIST = $(server_in_files)
-CLEANFILES = $(server_DATA) $(server_DATA).in
diff --git a/components/emblem/Nautilus_View_emblem.server.in.in b/components/emblem/Nautilus_View_emblem.server.in.in
deleted file mode 100644
index 4a9c825dd..000000000
--- a/components/emblem/Nautilus_View_emblem.server.in.in
+++ /dev/null
@@ -1,15 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:Nautilus_Emblem_View"
- type="shlib" location="@BONOBODIR@/libnautilus-emblem-view">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Unknown:1.0"/>
- <item value="IDL:Bonobo/Control:1.0"/>
- <item value="IDL:Nautilus/View:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Nautilus Emblem view"/>
- <oaf_attribute name="description" type="string" _value="Nautilus Emblem side pane"/>
- <oaf_attribute name="nautilus:sidebar_panel_name" type="string" _value="Emblems"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/components/emblem/libmain.c b/components/emblem/libmain.c
deleted file mode 100644
index 26cf335af..000000000
--- a/components/emblem/libmain.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000, 2001 Eazel, 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.
- *
- * Author: Maciej Stachowiak
- */
-
-/* libmain.c - object activation infrastructure for shared library
- version of emblem view. */
-
-#include <config.h>
-#include <string.h>
-#include "nautilus-emblem-view-iids.h"
-#include "nautilus-emblem-view.h"
-#include <bonobo.h>
-#include <bonobo-activation/bonobo-activation.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
-
-static gboolean shortcut_registered = FALSE;
-
-static CORBA_Object
-create_object (const char *iid,
- gpointer callback_data)
-{
- NautilusEmblemView *view;
-
- if (strcmp (iid, EMBLEM_VIEW_IID) != 0) {
- return CORBA_OBJECT_NIL;
- }
-
- view = NAUTILUS_EMBLEM_VIEW (g_object_new (NAUTILUS_TYPE_EMBLEM_VIEW, NULL));
-
- return CORBA_Object_duplicate (BONOBO_OBJREF (view), NULL);
-}
-
-static CORBA_Object
-emblem_shlib_make_object (PortableServer_POA poa,
- const char *iid,
- gpointer impl_ptr,
- CORBA_Environment *ev)
-{
- NautilusEmblemView *view;
-
- if (!shortcut_registered) {
- nautilus_bonobo_register_activation_shortcut (EMBLEM_VIEW_IID,
- create_object, NULL);
- shortcut_registered = TRUE;
- }
-
- if (strcmp (iid, EMBLEM_VIEW_IID) != 0) {
- return CORBA_OBJECT_NIL;
- }
-
- view = NAUTILUS_EMBLEM_VIEW (g_object_new (NAUTILUS_TYPE_EMBLEM_VIEW, NULL));
-
- bonobo_activation_plugin_use (poa, impl_ptr);
-
- return CORBA_Object_duplicate (BONOBO_OBJREF (view), NULL);
-}
-
-static const BonoboActivationPluginObject emblem_plugin_list[] = {
- { EMBLEM_VIEW_IID, emblem_shlib_make_object },
- { NULL }
-};
-
-const BonoboActivationPlugin Bonobo_Plugin_info = {
- emblem_plugin_list,
- "Nautilus Emblem Sidebar Panel"
-};
diff --git a/components/emblem/nautilus-emblem-view-iids.h b/components/emblem/nautilus-emblem-view-iids.h
deleted file mode 100644
index d3eb024fc..000000000
--- a/components/emblem/nautilus-emblem-view-iids.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2002 James Willcox
- *
- * 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.
- *
- * Author: James Willcox <jwillcox@gnome.org>
- */
-
-#ifndef NAUTILUS_EMBLEM_VIEW_IIDS_H
-#define NAUTILUS_EMBLEM_VIEW_IIDS_H
-
-#define EMBLEM_VIEW_IID "OAFIID:Nautilus_Emblem_View"
-#define EMBLEM_VIEW_FACTORY_IID "OAFIID:Nautilus_Emblem_View_Factory"
-
-#endif /* NAUTILUS_EMBLEM_VIEW_IIDS_H */
diff --git a/components/emblem/nautilus-emblem-view.h b/components/emblem/nautilus-emblem-view.h
deleted file mode 100644
index 9cb9507d6..000000000
--- a/components/emblem/nautilus-emblem-view.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 1999, 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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
- *
- *
- * This is the header file for the index panel widget, which displays overview information
- * in a vertical panel and hosts the meta-views.
- */
-
-#ifndef NAUTILUS_EMBLEM_VIEW_H
-#define NAUTILUS_EMBLEM_VIEW_H
-
-#include <libnautilus/nautilus-view.h>
-
-#define NAUTILUS_TYPE_EMBLEM_VIEW \
- (nautilus_emblem_view_get_type ())
-#define NAUTILUS_EMBLEM_VIEW(obj) \
- (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_EMBLEM_VIEW, NautilusEmblemView))
-#define NAUTILUS_EMBLEM_VIEW_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_EMBLEM_VIEW, NautilusEmblemViewClass))
-#define NAUTILUS_IS_EMBLEM_VIEW(obj) \
- (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_EMBLEM_VIEW))
-#define NAUTILUS_IS_EMBLEM_VIEW_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_EMBLEM_VIEW))
-
-typedef struct NautilusEmblemViewDetails NautilusEmblemViewDetails;
-
-typedef struct {
- NautilusView parent_slot;
- NautilusEmblemViewDetails *details;
-} NautilusEmblemView;
-
-typedef struct {
- NautilusViewClass parent_slot;
-
-} NautilusEmblemViewClass;
-
-GType nautilus_emblem_view_get_type (void);
-
-#endif /* NAUTILUS_EMBLEM_VIEW_H */
diff --git a/components/history/Makefile.am b/components/history/Makefile.am
deleted file mode 100644
index 94787112c..000000000
--- a/components/history/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-NULL =
-
-INCLUDES=\
- -I$(top_srcdir) \
- -DGNOMELOCALEDIR=\""$(prefix)/${DATADIRNAME}/locale"\" \
- $(COMPONENT_CFLAGS) \
- $(NULL)
-
-bonobodir = $(libdir)/bonobo
-bonobo_LTLIBRARIES = libnautilus-history-view.la
-
-libnautilus_history_view_la_SOURCES = \
- libmain.c \
- nautilus-history-view.c \
- nautilus-history-view.h \
- $(NULL)
-
-libnautilus_history_view_la_LDFLAGS = -module -avoid-version -no-undefined
-
-libnautilus_history_view_la_LIBADD = \
- $(top_builddir)/libnautilus/libnautilus.la \
- $(top_builddir)/libnautilus-private/libnautilus-private.la \
- $(COMPONENT_LIBS)
- $(NULL)
-
-server_in_files = Nautilus_View_history.server.in.in
-
-serverdir = $(libdir)/bonobo/servers
-server_DATA = $(server_in_files:.server.in.in=.server)
-$(server_in_files:.server.in.in=.server.in): $(server_in_files)
- sed -e "s|\@BONOBODIR\@|$(bonobodir)|" $< > $@
-@INTLTOOL_SERVER_RULE@
-
-EXTRA_DIST=$(server_in_files)
-CLEANFILES = $(server_DATA) $(server_DATA).in
diff --git a/components/history/Nautilus_View_history.server.in.in b/components/history/Nautilus_View_history.server.in.in
deleted file mode 100644
index 736c4ab46..000000000
--- a/components/history/Nautilus_View_history.server.in.in
+++ /dev/null
@@ -1,18 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:Nautilus_History_View"
- type="shlib" location="@BONOBODIR@/libnautilus-history-view">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Unknown:1.0"/>
- <item value="IDL:Bonobo/Control:1.0"/>
- <item value="IDL:Nautilus/View:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="description" type="string" _value="History side pane for Nautilus"/>
- <oaf_attribute name="name" type="string" _value="History side pane"/>
- <oaf_attribute name="nautilus:sidebar_panel_name" type="string" _value="History"/>
- <oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
- <item value="*"/>
- </oaf_attribute>
-</oaf_server>
-
-</oaf_info>
diff --git a/components/history/libmain.c b/components/history/libmain.c
deleted file mode 100644
index 611ac0c40..000000000
--- a/components/history/libmain.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000, 2001 Eazel, Inc
- * Copyright (C) 2002 Sean Atkinson
- *
- * 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.
- *
- * Author: Sean Atkinson
- */
-
-/* libmain.c - object activation infrastructure for shared library
- version of history view. */
-
-#include <config.h>
-#include <string.h>
-#include "nautilus-history-view.h"
-#include <bonobo.h>
-#include <bonobo-activation/bonobo-activation.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
-
-static gboolean shortcut_registered = FALSE;
-
-static CORBA_Object
-create_object (const char *iid,
- gpointer callback_data)
-{
- NautilusHistoryView *view;
-
- if (strcmp (iid, VIEW_IID) != 0) {
- return CORBA_OBJECT_NIL;
- }
-
- view = NAUTILUS_HISTORY_VIEW (g_object_new (NAUTILUS_TYPE_HISTORY_VIEW, NULL));
-
- return CORBA_Object_duplicate (BONOBO_OBJREF (view), NULL);
-}
-
-static CORBA_Object
-history_shlib_make_object (PortableServer_POA poa,
- const char *iid,
- gpointer impl_ptr,
- CORBA_Environment *ev)
-{
- NautilusHistoryView *view;
-
- if (!shortcut_registered) {
- nautilus_bonobo_register_activation_shortcut (VIEW_IID,
- create_object, NULL);
- shortcut_registered = TRUE;
- }
-
- if (strcmp (iid, VIEW_IID) != 0) {
- return CORBA_OBJECT_NIL;
- }
-
- view = NAUTILUS_HISTORY_VIEW (g_object_new (NAUTILUS_TYPE_HISTORY_VIEW, NULL));
-
- bonobo_activation_plugin_use (poa, impl_ptr);
-
- return CORBA_Object_duplicate (BONOBO_OBJREF (view), ev);
-}
-
-static const BonoboActivationPluginObject history_plugin_list[] = {
- { VIEW_IID, history_shlib_make_object },
- { NULL }
-};
-
-const BonoboActivationPlugin Bonobo_Plugin_info = {
- history_plugin_list,
- "Nautilus History Sidebar Panel"
-};
diff --git a/components/history/nautilus-history-view.c b/components/history/nautilus-history-view.c
deleted file mode 100644
index f911de166..000000000
--- a/components/history/nautilus-history-view.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000, 2001 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: Elliot Lee <sopwith@redhat.com>
- * Darin Adler <darin@bentspoon.com>
- *
- */
-
-#include <config.h>
-
-#include <bonobo/bonobo-ui-util.h>
-#include <eel/eel-debug.h>
-#include <eel/eel-gtk-extensions.h>
-#include <eel/eel-preferences.h>
-#include <gtk/gtkcellrendererpixbuf.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <libgnome/gnome-macros.h>
-#include <libnautilus-private/nautilus-bookmark.h>
-#include <libnautilus-private/nautilus-global-preferences.h>
-
-#include "nautilus-history-view.h"
-
-#define FACTORY_IID "OAFIID:Nautilus_History_View_Factory"
-
-#define NAUTILUS_HISTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_HISTORY_VIEW, NautilusHistoryViewClass))
-#define NAUTILUS_IS_HISTORY_VIEW(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_HISTORY_VIEW))
-#define NAUTILUS_IS_HISTORY_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_HISTORY_VIEW))
-
-typedef struct {
- NautilusViewClass parent;
-} NautilusHistoryViewClass;
-
-enum {
- HISTORY_VIEW_COLUMN_ICON,
- HISTORY_VIEW_COLUMN_NAME,
- HISTORY_VIEW_COLUMN_BOOKMARK,
- HISTORY_VIEW_COLUMN_COUNT
-};
-
-BONOBO_CLASS_BOILERPLATE (NautilusHistoryView, nautilus_history_view,
- NautilusView, NAUTILUS_TYPE_VIEW)
-
-static void
-update_history (NautilusHistoryView *view,
- const Nautilus_History *history)
-{
- GtkListStore *store;
- GtkTreeSelection *selection;
- NautilusBookmark *bookmark;
- Nautilus_HistoryItem *item;
- GdkPixbuf *pixbuf;
- guint i;
- gboolean stop_updating_history;
- GtkTreeIter iter;
-
- /* Set up a local boolean so we can detect that the view has
- * been destroyed. We can't ask the view itself because once
- * it's destroyed it's pointer is a pointer to freed storage.
- */
- /* FIXME: We can't just keep an extra ref to the view as we
- * normally would because of a bug in Bonobo that means a
- * BonoboControl must not outlast its BonoboControlFrame
- * (NautilusHistoryView is a BonoboControl).
- */
- if (view->stop_updating_history != NULL) {
- *view->stop_updating_history = TRUE;
- }
- stop_updating_history = FALSE;
- view->stop_updating_history = &stop_updating_history;
-
- store = GTK_LIST_STORE (gtk_tree_view_get_model (view->tree_view));
-
- gtk_list_store_clear (store);
-
- for (i = 0; i < history->_length; i++) {
- item = &history->_buffer[i];
- bookmark = nautilus_bookmark_new (item->location, item->title);
-
- /* Through a long line of calls, nautilus_bookmark_new
- * can end up calling through to CORBA, so a remote
- * unref can come in at this point. In theory, other
- * calls could result in a similar problem, so in
- * theory we need this check after any call out, but
- * in practice, none of the other calls used here have
- * that problem.
- */
- if (stop_updating_history) {
- return;
- }
-
- pixbuf = nautilus_bookmark_get_pixbuf (bookmark, NAUTILUS_ICON_SIZE_FOR_MENUS, FALSE);
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- HISTORY_VIEW_COLUMN_ICON, pixbuf,
- HISTORY_VIEW_COLUMN_NAME, item->title,
- HISTORY_VIEW_COLUMN_BOOKMARK, bookmark,
- -1);
-
- if (pixbuf != NULL) {
- g_object_unref (pixbuf);
- }
- }
-
- selection = GTK_TREE_SELECTION (gtk_tree_view_get_selection (view->tree_view));
-
- if (gtk_tree_model_get_iter_root (GTK_TREE_MODEL (store), &iter)) {
- gtk_tree_selection_select_iter (selection, &iter);
- }
-
- view->stop_updating_history = NULL;
-}
-
-static void
-history_changed_callback (NautilusHistoryView *view,
- const Nautilus_History *history,
- gpointer callback_data)
-{
- g_assert (view == callback_data);
-
- update_history (view, history);
-}
-
-static void
-row_activated_callback (GtkTreeView *tree_view,
- GtkTreePath *path,
- GtkTreeViewColumn *column,
- gpointer user_data)
-{
- NautilusHistoryView *view;
- GtkTreeModel *model;
- GtkTreeIter iter;
- NautilusBookmark *bookmark;
- char *uri;
-
- view = NAUTILUS_HISTORY_VIEW (user_data);
- model = gtk_tree_view_get_model (tree_view);
-
- if (!gtk_tree_model_get_iter (model, &iter, path)) {
- return;
- }
-
- gtk_tree_model_get
- (model, &iter, HISTORY_VIEW_COLUMN_BOOKMARK, &bookmark, -1);
-
- /* Navigate to the clicked location. */
- uri = nautilus_bookmark_get_uri (NAUTILUS_BOOKMARK (bookmark));
- nautilus_view_open_location
- (NAUTILUS_VIEW (view),
- uri, Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE, 0, NULL);
- g_free (uri);
-}
-
-static void
-update_click_policy (NautilusHistoryView *view)
-{
- int policy;
-
- policy = eel_preferences_get_enum (NAUTILUS_PREFERENCES_CLICK_POLICY);
-
- eel_gtk_tree_view_set_activate_on_single_click
- (view->tree_view, policy == NAUTILUS_CLICK_POLICY_SINGLE);
-}
-
-static void
-click_policy_changed_callback (gpointer user_data)
-{
- NautilusHistoryView *view;
-
- view = NAUTILUS_HISTORY_VIEW (user_data);
-
- update_click_policy (view);
-}
-
-static void
-nautilus_history_view_instance_init (NautilusHistoryView *view)
-{
- GtkTreeView *tree_view;
- GtkTreeViewColumn *col;
- GtkCellRenderer *cell;
- GtkListStore *store;
- GtkTreeSelection *selection;
- GtkWidget *window;
-
- tree_view = GTK_TREE_VIEW (gtk_tree_view_new ());
- gtk_tree_view_set_headers_visible (tree_view, FALSE);
- gtk_widget_show (GTK_WIDGET (tree_view));
-
- col = GTK_TREE_VIEW_COLUMN (gtk_tree_view_column_new ());
-
- cell = gtk_cell_renderer_pixbuf_new ();
- gtk_tree_view_column_pack_start (col, cell, FALSE);
- gtk_tree_view_column_set_attributes (col, cell,
- "pixbuf", HISTORY_VIEW_COLUMN_ICON,
- NULL);
-
- cell = gtk_cell_renderer_text_new ();
- gtk_tree_view_column_pack_start (col, cell, TRUE);
- gtk_tree_view_column_set_attributes (col, cell,
- "text", HISTORY_VIEW_COLUMN_NAME,
- NULL);
-
- gtk_tree_view_column_set_fixed_width (col, NAUTILUS_ICON_SIZE_SMALLER);
- gtk_tree_view_append_column (tree_view, col);
-
- store = gtk_list_store_new (HISTORY_VIEW_COLUMN_COUNT,
- GDK_TYPE_PIXBUF,
- G_TYPE_STRING,
- NAUTILUS_TYPE_BOOKMARK);
-
- gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (store));
-
- window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (tree_view));
- gtk_widget_show (window);
-
- nautilus_view_construct (NAUTILUS_VIEW (view), window);
-
- g_object_ref (tree_view);
- view->tree_view = tree_view;
-
- nautilus_view_set_listener_mask (NAUTILUS_VIEW (view),
- NAUTILUS_VIEW_LISTEN_HISTORY);
-
- selection = gtk_tree_view_get_selection (tree_view);
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
-
- g_signal_connect_object
- (tree_view, "row_activated",
- G_CALLBACK (row_activated_callback), view, 0);
-
- g_signal_connect_object (view, "history_changed",
- G_CALLBACK (history_changed_callback), view, 0);
-
- eel_preferences_add_callback (NAUTILUS_PREFERENCES_CLICK_POLICY,
- click_policy_changed_callback,
- view);
- update_click_policy (view);
-}
-
-static void
-nautilus_history_view_finalize (GObject *object)
-{
- NautilusHistoryView *view;
-
- view = NAUTILUS_HISTORY_VIEW (object);
-
- eel_preferences_remove_callback (NAUTILUS_PREFERENCES_CLICK_POLICY,
- click_policy_changed_callback,
- view);
-
- if (view->stop_updating_history != NULL) {
- *view->stop_updating_history = TRUE;
- }
-
- g_object_unref (view->tree_view);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-nautilus_history_view_class_init (NautilusHistoryViewClass *class)
-{
- G_OBJECT_CLASS (class)->finalize = nautilus_history_view_finalize;
-}
-
-int
-main (int argc, char *argv[])
-{
- if (g_getenv ("NAUTILUS_DEBUG") != NULL) {
- eel_make_warnings_and_criticals_stop_in_debugger ();
- }
-
- return nautilus_view_standard_main ("nautilus_history-view",
- VERSION,
- GETTEXT_PACKAGE,
- GNOMELOCALEDIR,
- argc,
- argv,
- FACTORY_IID,
- VIEW_IID,
- nautilus_view_create_from_get_type_function,
- NULL,
- nautilus_history_view_get_type);
-}
diff --git a/components/image_properties/Makefile.am b/components/image_properties/Makefile.am
deleted file mode 100644
index 6dde6a3b3..000000000
--- a/components/image_properties/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-# WHAT YOU NEED TO CHANGE: Change all the filenames to refer to your
-# component. Also add whatever libraries, include paths, etc you want,
-# and change the G_LOG_DOMAIN.
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"Nautilus-Image-Properties\" \
- -DDATADIR=\"$(datadir)\" \
- -I$(top_srcdir) \
- -I$(top_builddir) \
- $(DISABLE_DEPRECATED_CFLAGS) \
- $(COMPONENT_CFLAGS) \
- $(EXIF_CFLAGS)
-
-bonobodir = $(libdir)/bonobo
-bonobo_LTLIBRARIES = libnautilus-image-properties-view.la
-
-libnautilus_image_properties_view_la_SOURCES = \
- nautilus-image-properties-view.h \
- nautilus-image-properties-view.c \
- libmain.c
-
-libnautilus_image_properties_view_la_LIBADD = \
- $(top_builddir)/libnautilus/libnautilus.la \
- $(COMPONENT_LIBS) \
- $(EXIF_LIBS)
-
-libnautilus_image_properties_view_la_LDFLAGS = -module -avoid-version -no-undefined
-
-server_in_files = Nautilus_View_image_properties.server.in.in
-
-serverdir = $(libdir)/bonobo/servers
-server_DATA = $(server_in_files:.server.in.in=.server)
-$(server_in_files:.server.in.in=.server.in): $(server_in_files)
- sed -e "s|\@BONOBODIR\@|$(bonobodir)|" $< > $@
-@INTLTOOL_SERVER_RULE@
-
-EXTRA_DIST = $(server_in_files)
-CLEANFILES = $(server_DATA) $(server_DATA).in
diff --git a/components/image_properties/Nautilus_View_image_properties.server.in.in b/components/image_properties/Nautilus_View_image_properties.server.in.in
deleted file mode 100644
index 5a6052527..000000000
--- a/components/image_properties/Nautilus_View_image_properties.server.in.in
+++ /dev/null
@@ -1,29 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:Nautilus_Image_Properties_View"
- type="shlib" location="@BONOBODIR@/libnautilus-image-properties-view">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Unknown:1.0"/>
- <item value="IDL:Bonobo/Control:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Nautilus Image Properties view"/>
- <oaf_attribute name="description" type="string" _value="Image Properties content view component"/>
- <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
- <item value="image/x-bmp"/>
- <item value="image/x-ico"/>
- <item value="image/jpeg"/>
- <item value="image/gif"/>
- <item value="image/png"/>
- <item value="image/pnm"/>
- <item value="image/ras"/>
- <item value="image/tga"/>
- <item value="image/tiff"/>
- <item value="image/wbmp"/>
- <item value="image/x-xbitmap"/>
- <item value="image/x-xpixmap"/>
- </oaf_attribute>
- <oaf_attribute name="nautilus:property_page_name" type="string" _value="Image"/>
- <oaf_attribute name="nautilus:can_handle_multiple_files" type="boolean" value="false"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/components/image_properties/libmain.c b/components/image_properties/libmain.c
deleted file mode 100644
index 9d2135380..000000000
--- a/components/image_properties/libmain.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000, 2001 Eazel, 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.
- *
- * Author: Maciej Stachowiak
- */
-
-/* libmain.c - object activation infrastructure for shared library
- version of tree view. */
-
-#include <config.h>
-#include <string.h>
-#include "nautilus-image-properties-view.h"
-#include <bonobo.h>
-#include <bonobo-activation/bonobo-activation.h>
-
-#define VIEW_IID "OAFIID:Nautilus_Image_Properties_View"
-
-
-static CORBA_Object
-image_shlib_make_object (PortableServer_POA poa,
- const char *iid,
- gpointer impl_ptr,
- CORBA_Environment *ev)
-{
- NautilusImagePropertiesView *view;
-
- if (strcmp (iid, VIEW_IID) != 0) {
- return CORBA_OBJECT_NIL;
- }
-
- view = NAUTILUS_IMAGE_PROPERTIES_VIEW (g_object_new (NAUTILUS_TYPE_IMAGE_PROPERTIES_VIEW, NULL));
-
- bonobo_activation_plugin_use (poa, impl_ptr);
-
- return CORBA_Object_duplicate (BONOBO_OBJREF (view), ev);
-}
-
-static const BonoboActivationPluginObject image_plugin_list[] = {
- { VIEW_IID, image_shlib_make_object },
- { NULL }
-};
-
-const BonoboActivationPlugin Bonobo_Plugin_info = {
- image_plugin_list,
- "Nautilus Image Properties Page"
-};
diff --git a/components/image_properties/nautilus-image-properties-view.h b/components/image_properties/nautilus-image-properties-view.h
deleted file mode 100644
index 4844c537c..000000000
--- a/components/image_properties/nautilus-image-properties-view.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-#ifndef NAUTILUS_IMAGE_PROPERTIES_VIEW_H
-#define NAUTILUS_IMAGE_PROPERTIES_VIEW_H
-
-#include <libnautilus/nautilus-view.h>
-
-#define NAUTILUS_TYPE_IMAGE_PROPERTIES_VIEW (nautilus_image_properties_view_get_type ())
-#define NAUTILUS_IMAGE_PROPERTIES_VIEW(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_IMAGE_PROPERTIES_VIEW, NautilusImagePropertiesView))
-#define NAUTILUS_IMAGE_PROPERTIES_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_IMAGE_PROPERTIES_VIEW, NautilusImagePropertiesViewClass))
-#define NAUTILUS_IS_IMAGE_PROPERTIES_VIEW(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_IMAGE_PROPERTIES_VIEW))
-#define NAUTILUS_IS_IMAGE_PROPERTIES_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_IMAGE_PROPERTIES_VIEW))
-
-typedef struct NautilusImagePropertiesViewDetails NautilusImagePropertiesViewDetails;
-
-typedef struct {
- BonoboControl parent;
- NautilusImagePropertiesViewDetails *details;
-} NautilusImagePropertiesView;
-
-typedef struct {
- BonoboControlClass parent;
-} NautilusImagePropertiesViewClass;
-
-GType nautilus_image_properties_view_get_type (void);
-
-#endif /* NAUTILUS_IMAGE_PROPERTIES_VIEW_H */
diff --git a/components/loser/Makefile.am b/components/loser/Makefile.am
deleted file mode 100644
index a87c44130..000000000
--- a/components/loser/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-NULL=
-
-SUBDIRS =\
- content sidebar\
- $(NULL)
-
-EXTRA_DIST=\
- README \
- $(NULL)
-
diff --git a/components/loser/README b/components/loser/README
deleted file mode 100644
index 1cb3ab86f..000000000
--- a/components/loser/README
+++ /dev/null
@@ -1,30 +0,0 @@
-
-To make the content and sidebar "loser" components fail, you must set
-some environment variables.
-
-To pick where the component will fail, set either
-NAUTILUS_CONTENT_LOSER_PLACE or NAUTILUS_SIDEBAR_LOSER_PLACE to one of
-the following values:
-
-pre-init
-post-init
-post-factory-init
-pre-make-object
-post-make-object
-pre-underway
-pre-load
-pre-done
-post-done
-pre-merge
-post-merge
-
-
-Also set either NAUTILUS_CONTENT_LOSER_MODE or
-NAUTILUS_SIDEBAR_LOSER_MODE to one of:
-
-crash
-hang
-exit
-error-exit
-
-
diff --git a/components/loser/content/Makefile.am b/components/loser/content/Makefile.am
deleted file mode 100644
index 13070be69..000000000
--- a/components/loser/content/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-include $(top_srcdir)/Makefile.shared
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"Nautilus-Test\" \
- -DDATADIR=\"$(datadir)\" \
- -DICON_DIR=\"$(datadir)/pixmaps/nautilus\" \
- -I$(top_srcdir) \
- $(COMPONENT_CFLAGS) \
- $(NULL)
-
-uidir = $(datadir)/gnome-2.0/ui
-ui_DATA = nautilus-content-loser-ui.xml
-
-libexec_PROGRAMS=nautilus-content-loser
-
-nautilus_content_loser_SOURCES = \
- nautilus-content-loser.h \
- nautilus-content-loser.c \
- main.c
-
-nautilus_content_loser_LDADD = \
- $(top_builddir)/libnautilus/libnautilus.la \
- $(COMPONENT_LIBS) \
- $(NULL)
-
-server_in_files = Nautilus_View_content-loser.server.in.in
-
-serverdir = $(libdir)/bonobo/servers
-server_DATA = $(server_in_files:.server.in.in=.server)
-$(server_in_files:.server.in.in=.server.in): $(server_in_files)
- sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
-@INTLTOOL_SERVER_RULE@
-
-EXTRA_DIST=$(server_in_files) $(ui_DATA)
-CLEANFILES = $(server_DATA) $(server_DATA).in
diff --git a/components/loser/content/Nautilus_View_content-loser.server.in.in b/components/loser/content/Nautilus_View_content-loser.server.in.in
deleted file mode 100644
index 9e1a03391..000000000
--- a/components/loser/content/Nautilus_View_content-loser.server.in.in
+++ /dev/null
@@ -1,32 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:Nautilus_Content_Loser_Factory"
- type="exe" location="@LIBEXECDIR@/nautilus-content-loser">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Nautilus content loser factory"/>
- <oaf_attribute name="description" type="string" _value="Nautilus content loser component's factory"/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:Nautilus_Content_Loser" type="factory" location="OAFIID:Nautilus_Content_Loser_Factory">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Unknown:1.0"/>
- <item value="IDL:Bonobo/Control:1.0"/>
- <item value="IDL:Nautilus/View:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Nautilus Content Loser"/>
- <oaf_attribute name="description" type="string" _value="Nautilus content view that fails on command"/>
- <oaf_attribute name="bonobo:additional_uri_schemes" type="stringv">
- <item value="*"/>
- </oaf_attribute>
- <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
- <item value="*"/>
- </oaf_attribute>
- <oaf_attribute name="nautilus:view_as_name" type="string" _value="Content Loser"/>
- <oaf_attribute name="nautilus:view_as_label" type="string" _value="View as Content Loser"/>
- <oaf_attribute name="nautilus:viewer_label" type="string" _value="Content Loser Viewer"/>
- <oaf_attribute name="test_only" type="boolean" value="true"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/components/loser/content/main.c b/components/loser/content/main.c
deleted file mode 100644
index 29c9b5bc4..000000000
--- a/components/loser/content/main.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak
- */
-
-/* main.c - main function and object activation function for loser
- content view component that fails on command. */
-
-#include <config.h>
-
-#include "nautilus-content-loser.h"
-
-#include <gnome.h>
-#include <bonobo-activation/bonobo-activation.h>
-#include <bonobo.h>
-#include <eel/eel-gnome-extensions.h>
-
-static int object_count = 0;
-
-static void
-loser_object_destroyed(GtkObject *obj)
-{
- object_count--;
- if (object_count <= 0) {
- gtk_main_quit ();
- }
-}
-
-static BonoboObject *
-loser_make_object (BonoboGenericFactory *factory,
- const char *iid,
- void *closure)
-{
- NautilusContentLoser *view;
- NautilusView *nautilus_view;
-
- nautilus_content_loser_maybe_fail ("pre-make-object");
-
- if (strcmp (iid, "OAFIID:Nautilus_Content_Loser")) {
- return NULL;
- }
-
- view = NAUTILUS_CONTENT_LOSER (g_object_new (NAUTILUS_TYPE_CONTENT_LOSER, NULL));
-
- object_count++;
-
- nautilus_view = nautilus_content_loser_get_nautilus_view (view);
-
- g_signal_connect (nautilus_view, "destroy", G_CALLBACK (loser_object_destroyed), NULL);
-
- nautilus_content_loser_maybe_fail ("post-make-object");
-
- return BONOBO_OBJECT (nautilus_view);
-}
-
-int main(int argc, char *argv[])
-{
- BonoboGenericFactory *factory;
- char *registration_id;
-
- nautilus_content_loser_maybe_fail ("pre-init");
-
- bonobo_ui_init ("nautilus-content-loser", VERSION, &argc, argv);
-
- nautilus_content_loser_maybe_fail ("post-init");
-
- registration_id = eel_bonobo_make_registration_id
- ("OAFIID:Nautilus_Content_Loser_Factory");
- factory = bonobo_generic_factory_new (registration_id,
- loser_make_object,
- NULL);
- g_free (registration_id);
-
- nautilus_content_loser_maybe_fail ("post-factory-init");
-
- if (factory != NULL) {
- do {
- bonobo_main ();
- } while (object_count > 0);
- }
-
- return 0;
-}
diff --git a/components/loser/content/nautilus-content-loser-ui.xml b/components/loser/content/nautilus-content-loser-ui.xml
deleted file mode 100644
index 6c1bf9fab..000000000
--- a/components/loser/content/nautilus-content-loser-ui.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<Root>
-<menu>
- <submenu name="File" _label="_File">
- <placeholder name="File Items Placeholder">
- <menuitem name="Kill Content Loser"
- _label="_Kill Content Loser"
- _tip="Kill the Loser content view"
- verb="Kill Content Loser"/>
- </placeholder>
- </submenu>
-</menu>
-<dockitem name="Toolbar">
- <placeholder name="Extra Buttons Placeholder">
- <toolitem name="Kill Content Loser"
- _label="Kill Content Loser"
- _tip="Kill the Loser content view"
- pixtype="stock" pixname="gtk-cut"
- verb="Kill Content Loser"/>
- </placeholder>
-</dockitem>
-</Root> \ No newline at end of file
diff --git a/components/loser/content/nautilus-content-loser.c b/components/loser/content/nautilus-content-loser.c
deleted file mode 100644
index 59b3b7cb1..000000000
--- a/components/loser/content/nautilus-content-loser.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-content-loser.c - loser content view component. This
- component fails on demand, either controlled by env variables
- during startup, or using toolbar buttons or menu items. */
-
-#include <config.h>
-#include "nautilus-content-loser.h"
-
-#include <bonobo/bonobo-control.h>
-#include <eel/eel-gtk-macros.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gtk/gtksignal.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-stock-icons.h>
-#include <libnautilus/nautilus-bonobo-ui.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-struct NautilusContentLoserDetails {
- char *uri;
- NautilusView *nautilus_view;
-};
-
-static void nautilus_content_loser_class_init (NautilusContentLoserClass *klass);
-static void nautilus_content_loser_init (NautilusContentLoser *view);
-static void nautilus_content_loser_destroy (GtkObject *object);
-
-EEL_CLASS_BOILERPLATE (NautilusContentLoser, nautilus_content_loser, GTK_TYPE_LABEL)
-
-static void loser_load_location_callback (NautilusView *nautilus_view,
- const char *location,
- NautilusContentLoser *view);
-static void loser_merge_bonobo_items_callback (BonoboObject *control,
- gboolean state,
- gpointer user_data);
-static void nautilus_content_loser_fail (void);
-static void ensure_fail_env (void);
-
-static void
-nautilus_content_loser_class_init (NautilusContentLoserClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
-
- object_class->destroy = nautilus_content_loser_destroy;
-}
-
-static void
-nautilus_content_loser_init (NautilusContentLoser *view)
-{
- view->details = g_new0 (NautilusContentLoserDetails, 1);
-
- gtk_label_set_text (GTK_LABEL (view), g_strdup ("(none)"));
-
- view->details->nautilus_view = nautilus_view_new (GTK_WIDGET (view));
-
- g_signal_connect_object (view->details->nautilus_view, "load_location",
- G_CALLBACK (loser_load_location_callback), view, 0);
-
- /* Get notified when our bonobo control is activated so we
- * can merge menu & toolbar items into Nautilus's UI.
- */
- g_signal_connect_object (nautilus_view_get_bonobo_control (view->details->nautilus_view),
- "activate",
- G_CALLBACK (loser_merge_bonobo_items_callback), view, 0);
-
- gtk_widget_show (GTK_WIDGET (view));
-}
-
-static void
-nautilus_content_loser_destroy (GtkObject *object)
-{
- NautilusContentLoser *view;
-
- view = NAUTILUS_CONTENT_LOSER (object);
-
- g_free (view->details->uri);
- g_free (view->details);
-
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-/**
- * nautilus_content_loser_get_nautilus_view:
- *
- * Return the NautilusView object associated with this view; this
- * is needed to export the view via CORBA/Bonobo.
- * @view: NautilusContentLoser to get the nautilus_view from..
- *
- **/
-NautilusView *
-nautilus_content_loser_get_nautilus_view (NautilusContentLoser *view)
-{
- return view->details->nautilus_view;
-}
-
-/**
- * nautilus_content_loser_load_uri:
- *
- * Load the resource pointed to by the specified URI.
- * @view: NautilusContentLoser to get the nautilus_view from.
- *
- **/
-void
-nautilus_content_loser_load_uri (NautilusContentLoser *view,
- const char *uri)
-{
- char *label_text;
-
- g_free (view->details->uri);
- view->details->uri = g_strdup (uri);
-
- label_text = g_strdup_printf (_("%s\n\nThis is a Nautilus content view that fails on demand."), uri);
- gtk_label_set_text (GTK_LABEL (view), label_text);
- g_free (label_text);
-}
-
-static void
-loser_load_location_callback (NautilusView *nautilus_view,
- const char *location,
- NautilusContentLoser *view)
-{
- g_assert (nautilus_view == view->details->nautilus_view);
-
- nautilus_content_loser_maybe_fail ("pre-underway");
-
- /* It's mandatory to call report_load_underway once the
- * component starts loading, otherwise nautilus will assume it
- * failed. In a real component, this will probably happen in
- * some sort of callback from whatever loading mechanism it is
- * using to load the data; this component loads no data, so it
- * gives the progress update here.
- */
- nautilus_view_report_load_underway (nautilus_view);
-
- nautilus_content_loser_maybe_fail ("pre-load");
-
- /* Do the actual load. */
- nautilus_content_loser_load_uri (view, location);
-
- nautilus_content_loser_maybe_fail ("pre-done");
-
- /* It's mandatory to call report_load_complete once the
- * component is done loading successfully, or
- * report_load_failed if it completes unsuccessfully. In a
- * real component, this will probably happen in some sort of
- * callback from whatever loading mechanism it is using to
- * load the data; this component loads no data, so it gives
- * the progrss upodate here.
- */
- nautilus_view_report_load_complete (nautilus_view);
-
- nautilus_content_loser_maybe_fail ("post-done");
-}
-
-static void
-bonobo_loser_callback (BonoboUIComponent *ui, gpointer user_data, const char *verb)
-{
- g_assert (NAUTILUS_IS_CONTENT_LOSER (user_data));
-
- nautilus_content_loser_fail ();
- gtk_label_set_text (GTK_LABEL (user_data), _("You have tried to kill the Content Loser"));
-}
-
-static void
-loser_merge_bonobo_items_callback (BonoboObject *control, gboolean state, gpointer user_data)
-{
- NautilusContentLoser *view;
- BonoboUIComponent *ui_component;
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("Kill Content Loser", bonobo_loser_callback),
- BONOBO_UI_VERB_END
- };
-
- nautilus_content_loser_maybe_fail ("pre-merge");
-
- g_assert (NAUTILUS_IS_CONTENT_LOSER (user_data));
-
- view = NAUTILUS_CONTENT_LOSER (user_data);
-
- if (state) {
- ui_component = nautilus_view_set_up_ui (view->details->nautilus_view,
- DATADIR,
- "nautilus-content-loser-ui.xml",
- "nautilus-content-loser");
-
- bonobo_ui_component_add_verb_list_with_data (ui_component, verbs, view);
- } else {
- /* Do nothing. */
- }
-
- nautilus_content_loser_maybe_fail ("post-merge");
-
-
- /*
- * Note that we do nothing if state is FALSE. Nautilus content views are activated
- * when installed, but never explicitly deactivated. When the view changes to another,
- * the content view object is destroyed, which ends up calling bonobo_ui_handler_unset_container,
- * which removes its merged menu & toolbar items.
- */
-}
-
-static const char *failure_mode = NULL;
-static const char *failure_point = NULL;
-static gboolean env_checked = FALSE;
-
-void
-nautilus_content_loser_maybe_fail (const char *location)
-{
- ensure_fail_env ();
-
- if (g_ascii_strcasecmp (location, failure_point) == 0) {
- nautilus_content_loser_fail ();
- }
-}
-
-
-
-static void
-nautilus_content_loser_fail (void)
-{
- ensure_fail_env ();
-
- if (g_ascii_strcasecmp (failure_mode, "hang") == 0) {
- while (1) {
- }
- } else if (g_ascii_strcasecmp (failure_mode, "exit") == 0) {
- exit (0);
- } else if (g_ascii_strcasecmp (failure_mode, "error-exit") == 0) {
- exit (-1);
- } else if (g_ascii_strcasecmp (failure_mode, "crash") == 0) {
- abort ();
- } else {
- puts ("XXX - would fail now, if NAUTILUS_CONTENT_LOSER_MODE were set properly.");
- }
-}
-
-
-static void
-ensure_fail_env (void)
-{
- if (!env_checked) {
- failure_mode = g_getenv ("NAUTILUS_CONTENT_LOSER_MODE");
- if (failure_mode == NULL) {
- failure_mode = "";
- }
-
- failure_point = g_getenv ("NAUTILUS_CONTENT_LOSER_PLACE");
- if (failure_point == NULL) {
- failure_point = "";
- }
-
- env_checked = TRUE;
- }
-}
diff --git a/components/loser/content/nautilus-content-loser.h b/components/loser/content/nautilus-content-loser.h
deleted file mode 100644
index bb2215508..000000000
--- a/components/loser/content/nautilus-content-loser.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-content-loser.h - Nautilus content view component that
- fails on command. See the README in the `loser' directory to see
- how to control the type of failure. */
-
-#ifndef NAUTILUS_CONTENT_LOSER_H
-#define NAUTILUS_CONTENT_LOSER_H
-
-#include <libnautilus/nautilus-view.h>
-#include <gtk/gtklabel.h>
-
-typedef struct NautilusContentLoser NautilusContentLoser;
-typedef struct NautilusContentLoserClass NautilusContentLoserClass;
-
-#define NAUTILUS_TYPE_CONTENT_LOSER (nautilus_content_loser_get_type ())
-#define NAUTILUS_CONTENT_LOSER(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_CONTENT_LOSER, NautilusContentLoser))
-#define NAUTILUS_CONTENT_LOSER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_CONTENT_LOSER, NautilusContentLoserClass))
-#define NAUTILUS_IS_CONTENT_LOSER(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_CONTENT_LOSER))
-#define NAUTILUS_IS_CONTENT_LOSER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_CONTENT_LOSER))
-
-typedef struct NautilusContentLoserDetails NautilusContentLoserDetails;
-
-struct NautilusContentLoser {
- GtkLabel parent;
- NautilusContentLoserDetails *details;
-};
-
-struct NautilusContentLoserClass {
- GtkLabelClass parent_class;
-};
-
-/* GObject support */
-GType nautilus_content_loser_get_type (void);
-
-/* Component embedding support */
-NautilusView *nautilus_content_loser_get_nautilus_view (NautilusContentLoser *view);
-
-/* URI handling */
-void nautilus_content_loser_load_uri (NautilusContentLoser *view,
- const char *uri);
-
-/* Failing on command. */
-void nautilus_content_loser_maybe_fail (const char *location);
-
-#endif /* NAUTILUS_CONTENT_LOSER_H */
-
diff --git a/components/loser/sidebar/Makefile.am b/components/loser/sidebar/Makefile.am
deleted file mode 100644
index c22d9f9e8..000000000
--- a/components/loser/sidebar/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-include $(top_srcdir)/Makefile.shared
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"Nautilus-Test\" \
- -DDATADIR=\"$(datadir)\" \
- -DICON_DIR=\"$(datadir)/pixmaps/nautilus\" \
- -I$(top_srcdir) \
- $(COMPONENT_CFLAGS) \
- $(NULL)
-
-uidir = $(datadir)/gnome-2.0/ui
-ui_DATA = nautilus-sidebar-loser-ui.xml
-
-libexec_PROGRAMS=nautilus-sidebar-loser
-
-nautilus_sidebar_loser_SOURCES = \
- nautilus-sidebar-loser.h \
- nautilus-sidebar-loser.c \
- main.c
-
-nautilus_sidebar_loser_LDADD = \
- $(top_builddir)/libnautilus/libnautilus.la \
- $(COMPONENT_LIBS) \
- $(NULL)
-
-server_in_files = Nautilus_View_sidebar-loser.server.in.in
-
-serverdir = $(libdir)/bonobo/servers
-server_DATA = $(server_in_files:.server.in.in=.server)
-$(server_in_files:.server.in.in=.server.in): $(server_in_files)
- sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
-@INTLTOOL_SERVER_RULE@
-
-EXTRA_DIST=$(server_in_files) $(ui_DATA)
-CLEANFILES = $(server_DATA) $(server_DATA).in
diff --git a/components/loser/sidebar/Nautilus_View_sidebar-loser.server.in.in b/components/loser/sidebar/Nautilus_View_sidebar-loser.server.in.in
deleted file mode 100644
index 09ef0e89f..000000000
--- a/components/loser/sidebar/Nautilus_View_sidebar-loser.server.in.in
+++ /dev/null
@@ -1,27 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:Nautilus_Sidebar_Loser_Factory"
- type="exe" location="@LIBEXECDIR@/nautilus-sidebar-loser">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Nautilus sidebar loser factory"/>
- <oaf_attribute name="description" type="string" _value="Nautilus sidebar loser component's factory"/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:Nautilus_Sidebar_Loser" type="factory" location="OAFIID:Nautilus_Sidebar_Loser_Factory">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Unknown:1.0"/>
- <item value="IDL:Bonobo/Control:1.0"/>
- <item value="IDL:Nautilus/View:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Nautilus Sidebar Loser"/>
- <oaf_attribute name="description" type="string" _value="Nautilus sidebar view that fails on command"/>
- <oaf_attribute name="bonobo:supported_uri_schemes" type="stringv">
- <item value="*"/>
- </oaf_attribute>
- <oaf_attribute name="nautilus:sidebar_panel_name" type="string" _value="Sidebar Loser"/>
- <oaf_attribute name="test_only" type="boolean" value="true"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/components/loser/sidebar/main.c b/components/loser/sidebar/main.c
deleted file mode 100644
index 28093735d..000000000
--- a/components/loser/sidebar/main.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak
- */
-
-/* main.c - main function and object activation function for loser
- sidebar view component that fails on command. */
-
-#include <config.h>
-
-#include "nautilus-sidebar-loser.h"
-
-#include <gnome.h>
-#include <bonobo-activation/bonobo-activation.h>
-#include <eel/eel-gnome-extensions.h>
-#include <bonobo.h>
-
-#define FACTORY_IID "OAFIID:Nautilus_Sidebar_Loser_Factory"
-
-static int object_count = 0;
-
-static void
-loser_object_destroyed(GtkObject *obj)
-{
- object_count--;
- if (object_count <= 0) {
- gtk_main_quit ();
- }
-}
-
-static BonoboObject *
-loser_make_object (BonoboGenericFactory *factory,
- const char *iid,
- void *closure)
-{
- NautilusSidebarLoser *view;
- NautilusView *nautilus_view;
-
- nautilus_sidebar_loser_maybe_fail ("pre-make-object");
-
- if (strcmp (iid, "OAFIID:Nautilus_Sidebar_Loser")) {
- return NULL;
- }
-
- view = NAUTILUS_SIDEBAR_LOSER (g_object_new (NAUTILUS_TYPE_SIDEBAR_LOSER, NULL));
-
- object_count++;
-
- nautilus_view = nautilus_sidebar_loser_get_nautilus_view (view);
-
- g_signal_connect (nautilus_view, "destroy", G_CALLBACK (loser_object_destroyed), NULL);
-
- nautilus_sidebar_loser_maybe_fail ("post-make-object");
-
- return BONOBO_OBJECT (nautilus_view);
-}
-
-int main(int argc, char *argv[])
-{
- BonoboGenericFactory *factory;
- CORBA_Environment ev;
- char *registration_id;
-
- CORBA_exception_init (&ev);
-
- nautilus_sidebar_loser_maybe_fail ("pre-init");
-
- bonobo_ui_init ("nautilus-sidebar-loser", VERSION, &argc, argv);
-
- nautilus_sidebar_loser_maybe_fail ("post-init");
-
- registration_id = eel_bonobo_make_registration_id (FACTORY_IID);
- factory = bonobo_generic_factory_new (FACTORY_IID,
- loser_make_object,
- NULL);
- g_free (registration_id);
-
- nautilus_sidebar_loser_maybe_fail ("post-factory-init");
-
- if (factory != NULL) {
- do {
- bonobo_main ();
- } while (object_count > 0);
- }
-
- return 0;
-}
diff --git a/components/loser/sidebar/nautilus-sidebar-loser-ui.xml b/components/loser/sidebar/nautilus-sidebar-loser-ui.xml
deleted file mode 100644
index 1a82770c5..000000000
--- a/components/loser/sidebar/nautilus-sidebar-loser-ui.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<Root>
-<menu>
- <submenu name="File" _label="_File">
- <placeholder name="File Items Placeholder">
- <menuitem name="Kill Sidebar Loser"
- _label="_Kill Sidebar Loser"
- _tip="Kill the Loser sidebar panel"
- verb="Kill Sidebar Loser"/>
- </placeholder>
- </submenu>
-</menu>
-<dockitem name="Toolbar">
- <placeholder name="Extra Buttons Placeholder">
- <toolitem name="Kill Sidebar Loser"
- _label="Kill Sidebar Loser"
- _tip="Kill the Loser sidebar panel"
- pixtype="stock" pixname="gtk-cut"
- verb="Kill Sidebar Loser"/>
- </placeholder>
-</dockitem>
-</Root> \ No newline at end of file
diff --git a/components/loser/sidebar/nautilus-sidebar-loser.c b/components/loser/sidebar/nautilus-sidebar-loser.c
deleted file mode 100644
index 49cd00c8f..000000000
--- a/components/loser/sidebar/nautilus-sidebar-loser.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-sidebar-loser.c - loser sidebar view component. This
- component fails on demand, either controlled by env variables
- during startup, or using toolbar buttons or menu items. */
-
-#include <config.h>
-#include "nautilus-sidebar-loser.h"
-
-#include <bonobo/bonobo-control.h>
-#include <gtk/gtksignal.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-stock-icons.h>
-#include <libnautilus/nautilus-bonobo-ui.h>
-#include <eel/eel-gtk-macros.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-/* A NautilusSidebarLoser's private information. */
-struct NautilusSidebarLoserDetails {
- char *uri;
- NautilusView *nautilus_view;
-};
-
-static void nautilus_sidebar_loser_class_init (NautilusSidebarLoserClass *klass);
-static void nautilus_sidebar_loser_init (NautilusSidebarLoser *view);
-static void nautilus_sidebar_loser_destroy (GtkObject *object);
-
-EEL_CLASS_BOILERPLATE (NautilusSidebarLoser, nautilus_sidebar_loser, GTK_TYPE_LABEL)
-
-static void loser_load_location_callback (NautilusView *nautilus_view,
- const char *location,
- NautilusSidebarLoser *view);
-static void loser_merge_bonobo_items_callback (BonoboObject *control,
- gboolean state,
- gpointer user_data);
-static void nautilus_sidebar_loser_fail (void);
-static void ensure_fail_env (void);
-
-static void
-nautilus_sidebar_loser_class_init (NautilusSidebarLoserClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
-
- object_class->destroy = nautilus_sidebar_loser_destroy;
-}
-
-static void
-nautilus_sidebar_loser_init (NautilusSidebarLoser *view)
-{
- view->details = g_new0 (NautilusSidebarLoserDetails, 1);
-
- gtk_label_set_text (GTK_LABEL (view), g_strdup ("(none)"));
-
- view->details->nautilus_view = nautilus_view_new (GTK_WIDGET (view));
-
- g_signal_connect_object (view->details->nautilus_view, "load_location",
- G_CALLBACK (loser_load_location_callback), view, 0);
-
- /* Get notified when our bonobo control is activated so we
- * can merge menu & toolbar items into Nautilus's UI.
- */
- g_signal_connect_object (nautilus_view_get_bonobo_control (view->details->nautilus_view),
- "activate",
- G_CALLBACK (loser_merge_bonobo_items_callback), view, 0);
-
- gtk_widget_show (GTK_WIDGET (view));
-}
-
-static void
-nautilus_sidebar_loser_destroy (GtkObject *object)
-{
- NautilusSidebarLoser *view;
-
- view = NAUTILUS_SIDEBAR_LOSER (object);
-
- g_free (view->details->uri);
- g_free (view->details);
-
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-/**
- * nautilus_sidebar_loser_get_nautilus_view:
- *
- * Return the NautilusView object associated with this view; this
- * is needed to export the view via CORBA/Bonobo.
- * @view: NautilusSidebarLoser to get the nautilus_view from..
- *
- **/
-NautilusView *
-nautilus_sidebar_loser_get_nautilus_view (NautilusSidebarLoser *view)
-{
- return view->details->nautilus_view;
-}
-
-/**
- * nautilus_sidebar_loser_load_uri:
- *
- * Load the resource pointed to by the specified URI.
- * @view: NautilusSidebarLoser to get the nautilus_view from.
- *
- **/
-void
-nautilus_sidebar_loser_load_uri (NautilusSidebarLoser *view,
- const char *uri)
-{
- char *label_text;
-
- g_free (view->details->uri);
- view->details->uri = g_strdup (uri);
-
- label_text = g_strdup_printf (_("%s\n\nLoser sidebar."), uri);
- gtk_label_set_text (GTK_LABEL (view), label_text);
- g_free (label_text);
-}
-
-static void
-loser_load_location_callback (NautilusView *nautilus_view,
- const char *location,
- NautilusSidebarLoser *view)
-{
- g_assert (nautilus_view == view->details->nautilus_view);
-
- nautilus_sidebar_loser_maybe_fail ("pre-underway");
-
- /* It's mandatory to send an underway message once the
- * component starts loading, otherwise nautilus will assume it
- * failed. In a real component, this will probably happen in
- * some sort of callback from whatever loading mechanism it is
- * using to load the data; this component loads no data, so it
- * gives the progress update here.
- */
- nautilus_view_report_load_underway (nautilus_view);
-
- nautilus_sidebar_loser_maybe_fail ("pre-load");
-
- /* Do the actual load. */
- nautilus_sidebar_loser_load_uri (view, location);
-
- nautilus_sidebar_loser_maybe_fail ("pre-done");
-
- /* It's mandatory to call report_load_complete once the
- * component is done loading successfully, or
- * report_load_failed if it completes unsuccessfully. In a
- * real component, this will probably happen in some sort of
- * callback from whatever loading mechanism it is using to
- * load the data; this component loads no data, so it gives
- * the progress update here.
- */
- nautilus_view_report_load_complete (nautilus_view);
-
- nautilus_sidebar_loser_maybe_fail ("post-done");
-}
-
-static void
-bonobo_loser_callback (BonoboUIComponent *ui, gpointer user_data, const char *verb)
-{
- g_assert (NAUTILUS_IS_SIDEBAR_LOSER (user_data));
-
- nautilus_sidebar_loser_fail ();
- gtk_label_set_text (GTK_LABEL (user_data), _("You have tried to kill the Sidebar Loser"));
-}
-
-static void
-loser_merge_bonobo_items_callback (BonoboObject *control, gboolean state, gpointer user_data)
-{
- NautilusSidebarLoser *view;
- BonoboUIComponent *ui_component;
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("Kill Sidebar Loser", bonobo_loser_callback),
- BONOBO_UI_VERB_END
- };
-
- nautilus_sidebar_loser_maybe_fail ("pre-merge");
-
- g_assert (NAUTILUS_IS_SIDEBAR_LOSER (user_data));
-
- view = NAUTILUS_SIDEBAR_LOSER (user_data);
-
- if (state) {
- ui_component = nautilus_view_set_up_ui (view->details->nautilus_view,
- DATADIR,
- "nautilus-sidebar-loser-ui.xml",
- "nautilus-sidebar-loser");
-
- bonobo_ui_component_add_verb_list_with_data (ui_component, verbs, view);
- } else {
- /* Do nothing. */
- }
-
- nautilus_sidebar_loser_maybe_fail ("post-merge");
-
-
- /*
- * Note that we do nothing if state is FALSE. Nautilus sidebar views are activated
- * when installed, but never explicitly deactivated. When the view changes to another,
- * the sidebar view object is destroyed, which ends up calling bonobo_ui_handler_unset_container,
- * which removes its merged menu & toolbar items.
- */
-}
-
-static const char *failure_mode = NULL;
-static const char *failure_point = NULL;
-static gboolean env_checked = FALSE;
-
-void
-nautilus_sidebar_loser_maybe_fail (const char *location)
-{
- ensure_fail_env ();
-
- if (g_ascii_strcasecmp (location, failure_point) == 0) {
- nautilus_sidebar_loser_fail ();
- }
-}
-
-
-
-static void
-nautilus_sidebar_loser_fail (void)
-{
- ensure_fail_env ();
-
- if (g_ascii_strcasecmp (failure_mode, "hang") == 0) {
- while (1) {
- }
- } else if (g_ascii_strcasecmp (failure_mode, "exit") == 0) {
- exit (0);
- } else if (g_ascii_strcasecmp (failure_mode, "error-exit") == 0) {
- exit (-1);
- } else if (g_ascii_strcasecmp (failure_mode, "crash") == 0) {
- abort ();
- } else {
- puts ("XXX - would fail now, if NAUTILUS_SIDEBAR_LOSER_MODE were set properly.");
- }
-}
-
-
-static void
-ensure_fail_env (void)
-{
- if (!env_checked) {
- failure_mode = g_getenv ("NAUTILUS_SIDEBAR_LOSER_MODE");
- if (failure_mode == NULL) {
- failure_mode = "";
- }
-
- failure_point = g_getenv ("NAUTILUS_SIDEBAR_LOSER_PLACE");
- if (failure_point == NULL) {
- failure_point = "";
- }
-
- env_checked = TRUE;
- }
-}
diff --git a/components/loser/sidebar/nautilus-sidebar-loser.h b/components/loser/sidebar/nautilus-sidebar-loser.h
deleted file mode 100644
index 8a8f2c9b1..000000000
--- a/components/loser/sidebar/nautilus-sidebar-loser.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-sidebar-loser.h - Nautilus sidebar view component that
- fails on command. See the README in the `loser' directory to see
- how to control the type of failure. */
-
-#ifndef NAUTILUS_SIDEBAR_LOSER_H
-#define NAUTILUS_SIDEBAR_LOSER_H
-
-#include <libnautilus/nautilus-view.h>
-#include <gtk/gtklabel.h>
-
-typedef struct NautilusSidebarLoser NautilusSidebarLoser;
-typedef struct NautilusSidebarLoserClass NautilusSidebarLoserClass;
-
-#define NAUTILUS_TYPE_SIDEBAR_LOSER (nautilus_sidebar_loser_get_type ())
-#define NAUTILUS_SIDEBAR_LOSER(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_SIDEBAR_LOSER, NautilusSidebarLoser))
-#define NAUTILUS_SIDEBAR_LOSER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_SIDEBAR_LOSER, NautilusSidebarLoserClass))
-#define NAUTILUS_IS_SIDEBAR_LOSER(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_SIDEBAR_LOSER))
-#define NAUTILUS_IS_SIDEBAR_LOSER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_SIDEBAR_LOSER))
-
-typedef struct NautilusSidebarLoserDetails NautilusSidebarLoserDetails;
-
-struct NautilusSidebarLoser {
- GtkLabel parent;
- NautilusSidebarLoserDetails *details;
-};
-
-struct NautilusSidebarLoserClass {
- GtkLabelClass parent_class;
-};
-
-/* GObject support */
-GType nautilus_sidebar_loser_get_type (void);
-
-/* Component embedding support */
-NautilusView *nautilus_sidebar_loser_get_nautilus_view (NautilusSidebarLoser *view);
-
-/* URI handling */
-void nautilus_sidebar_loser_load_uri (NautilusSidebarLoser *view,
- const char *uri);
-
-/* Failing on command. */
-void nautilus_sidebar_loser_maybe_fail (const char *location);
-
-#endif /* NAUTILUS_SIDEBAR_LOSER_H */
-
diff --git a/components/news/Makefile.am b/components/news/Makefile.am
deleted file mode 100644
index 93781a882..000000000
--- a/components/news/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-NULL =
-
-bin_PROGRAMS=nautilus-news
-
-INCLUDES=\
- -I$(top_srcdir) \
- -DNAUTILUS_DATADIR=\""$(datadir)/nautilus"\" \
- -DNAUTILUS_PIXMAPDIR=\""$(datadir)/pixmaps/nautilus"\" \
- -DDATADIR=\""$(datadir)"\" \
- -DGNOMELOCALEDIR=\""$(prefix)/${DATADIRNAME}/locale"\" \
- $(COMPONENT_CFLAGS) \
- $(NULL)
-
-LDADD=\
- $(top_builddir)/libnautilus/libnautilus.la \
- $(top_builddir)/libnautilus-private/libnautilus-private.la \
- $(COMPONENT_LIBS) \
- $(NULL)
-
-nautilus_news_SOURCES= \
- nautilus-cell-renderer-news.c \
- nautilus-cell-renderer-news.h \
- nautilus-news.c
-
-nautilusdir = $(datadir)/nautilus
-nautilus_DATA = news_channels.xml
-
-nautiluspixmapdir = $(datadir)/pixmaps/nautilus
-nautiluspixmap_DATA = news_bullet.png \
- changed_bullet.png
-
-serverdir = $(libdir)/bonobo/servers
-server_in_files = Nautilus_View_news.server.in
-server_DATA = $(server_in_files:.server.in=.server)
-@INTLTOOL_SERVER_RULE@
-
-EXTRA_DIST= \
- $(nautilus_DATA) \
- $(nautiluspixmap_DATA) \
- $(server_DATA)\
- $(server_in_files) \
- $(NULL)
diff --git a/components/news/Nautilus_View_news.server.in b/components/news/Nautilus_View_news.server.in
deleted file mode 100644
index 04b3277ac..000000000
--- a/components/news/Nautilus_View_news.server.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:Nautilus_News_View_Factory" type="exe" location="nautilus-news">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="description" type="string" _value="Factory for news view"/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:Nautilus_News_View" type="factory" location="OAFIID:Nautilus_News_View_Factory">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Unknown:1.0"/>
- <item value="IDL:Bonobo/Control:1.0"/>
- <item value="IDL:Nautilus/View:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string" _value="News sidebar panel fetches and displays RSS feeds"/>
- <oaf_attribute name="name" type="string" _value="News sidebar panel"/>
- <oaf_attribute name="nautilus:sidebar_panel_name" type="string" _value="News"/>
- <oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
- <item value="*"/>
- </oaf_attribute>
-</oaf_server>
-
-</oaf_info>
diff --git a/components/news/changed_bullet.png b/components/news/changed_bullet.png
deleted file mode 100644
index 12c89dd5b..000000000
--- a/components/news/changed_bullet.png
+++ /dev/null
Binary files differ
diff --git a/components/news/nautilus-cell-renderer-news.c b/components/news/nautilus-cell-renderer-news.c
deleted file mode 100644
index c14f55a58..000000000
--- a/components/news/nautilus-cell-renderer-news.c
+++ /dev/null
@@ -1,489 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus News Item Cell Renderer
- *
- * Copyright (C) 2000 Red Hat, Inc., Ximian Inc., Jonathan Blandford
- *
- * 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: Dave Camp <dave@ximian.com>
- * based on the text cell renderer by Jonathan Blandford
- * <jrb@redhat.com>
- *
- */
-
-#include <config.h>
-#include "nautilus-cell-renderer-news.h"
-
-#include <stdlib.h>
-#include <pango/pango-layout.h>
-#include <gtk/gtkcellrendererpixbuf.h>
-#include <libgnome/gnome-i18n.h>
-
-struct _NautilusCellRendererNewsPrivate {
- char *text;
- PangoFontDescription *font;
-
- PangoAttrList *extra_attrs;
-
- GdkPixbuf *bullet;
- GdkPixbuf *prelit_bullet;
-
- int wrap_at;
-};
-
-static void nautilus_cell_renderer_news_init (NautilusCellRendererNews *cellnews);
-static void nautilus_cell_renderer_news_class_init (NautilusCellRendererNewsClass *class);
-static void nautilus_cell_renderer_news_finalize (GObject *object);
-
-static void nautilus_cell_renderer_news_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
-static void nautilus_cell_renderer_news_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
-static void nautilus_cell_renderer_news_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- GdkRectangle *cell_area,
- int *x_offset,
- int *y_offset,
- int *width,
- int *height);
-static void nautilus_cell_renderer_news_render (GtkCellRenderer *cell,
- GdkWindow *window,
- GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
- guint flags);
-
-enum {
- PROP_0,
-
- PROP_MARKUP,
- PROP_BULLET,
- PROP_PRELIT_BULLET,
- PROP_WRAP_AT,
-};
-
-static gpointer parent_class;
-
-#define PAD 2
-
-GType
-nautilus_cell_renderer_news_get_type (void)
-{
- static GType cell_news_type = 0;
-
- if (!cell_news_type) {
- static const GTypeInfo cell_news_info = {
- sizeof (NautilusCellRendererNewsClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) nautilus_cell_renderer_news_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (NautilusCellRendererNews),
- 0, /* n_preallocs */
- (GInstanceInitFunc) nautilus_cell_renderer_news_init,
- };
-
- cell_news_type = g_type_register_static (GTK_TYPE_CELL_RENDERER, "NautilusCellRendererNews", &cell_news_info, 0);
- }
-
- return cell_news_type;
-}
-
-static void
-nautilus_cell_renderer_news_init (NautilusCellRendererNews *cellnews)
-{
- GTK_CELL_RENDERER (cellnews)->xalign = 0.0;
- GTK_CELL_RENDERER (cellnews)->yalign = 0.5;
- GTK_CELL_RENDERER (cellnews)->xpad = 2;
- GTK_CELL_RENDERER (cellnews)->ypad = 2;
-
- cellnews->priv = g_new0 (NautilusCellRendererNewsPrivate, 1);
- cellnews->priv->wrap_at = -1;
- cellnews->priv->font = pango_font_description_new ();
-}
-
-static void
-nautilus_cell_renderer_news_class_init (NautilusCellRendererNewsClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = nautilus_cell_renderer_news_finalize;
-
- object_class->get_property = nautilus_cell_renderer_news_get_property;
- object_class->set_property = nautilus_cell_renderer_news_set_property;
-
- cell_class->get_size = nautilus_cell_renderer_news_get_size;
- cell_class->render = nautilus_cell_renderer_news_render;
-
- g_object_class_install_property (object_class,
- PROP_WRAP_AT,
- g_param_spec_int ("wrap_at",
- _("Wrap at"),
- _("Width the cell should wrap to."),
- -1, G_MAXINT,
- -1,
- G_PARAM_READWRITE));
-
-
- g_object_class_install_property (object_class,
- PROP_MARKUP,
- g_param_spec_string ("markup",
- _("Markup"),
- _("Marked up text to display"),
- "",
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_BULLET,
- g_param_spec_pointer ("bullet",
- _("Bullet"),
- _("Bullet to display"),
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_PRELIT_BULLET,
- g_param_spec_pointer ("prelit_bullet",
- _("Prelight Bullet"),
- _("Bullet to display when prelit"),
- G_PARAM_READWRITE));
-}
-
-static void
-nautilus_cell_renderer_news_finalize (GObject *object)
-{
- NautilusCellRendererNews *cellnews = NAUTILUS_CELL_RENDERER_NEWS (object);
-
- pango_font_description_free (cellnews->priv->font);
-
- if (cellnews->priv->text) {
- g_free (cellnews->priv->text);
- }
-
- if (cellnews->priv->extra_attrs) {
- pango_attr_list_unref (cellnews->priv->extra_attrs);
- }
-
- if (cellnews->priv->bullet) {
- g_object_unref (cellnews->priv->bullet);
- }
-
- if (cellnews->priv->prelit_bullet) {
- g_object_unref (cellnews->priv->prelit_bullet);
- }
-
- g_free (cellnews->priv);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-nautilus_cell_renderer_news_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
-{
- NautilusCellRendererNews *cellnews = NAUTILUS_CELL_RENDERER_NEWS (object);
-
- switch (param_id) {
- case PROP_WRAP_AT :
- g_value_set_int (value, cellnews->priv->wrap_at);
- break;
- case PROP_MARKUP :
- g_value_set_pointer (value, cellnews->priv->text);
- break;
- case PROP_BULLET :
- g_value_set_pointer (value, cellnews->priv->bullet);
- break;
- case PROP_PRELIT_BULLET :
- g_value_set_pointer (value, cellnews->priv->prelit_bullet);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-static void
-nautilus_cell_renderer_news_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- NautilusCellRendererNews *cellnews = NAUTILUS_CELL_RENDERER_NEWS (object);
- GdkPixbuf *pixbuf;
- const gchar *str;
- char *text = NULL;
- GError *error = NULL;
- PangoAttrList *attrs = NULL;
-
-
- switch (param_id) {
- case PROP_WRAP_AT:
- cellnews->priv->wrap_at = g_value_get_int (value);
- g_object_notify (object, "wrap_at");
- break;
- case PROP_BULLET:
- pixbuf = g_value_get_pointer (value);
-
- if (cellnews->priv->bullet) {
- g_object_unref (cellnews->priv->bullet);
- }
- cellnews->priv->bullet = pixbuf;
- if (cellnews->priv->bullet) {
- g_object_ref (cellnews->priv->bullet);
- }
- g_object_notify (object, "bullet");
- break;
- case PROP_PRELIT_BULLET:
- pixbuf = g_value_get_pointer (value);
-
- if (cellnews->priv->prelit_bullet) {
- g_object_unref (cellnews->priv->prelit_bullet);
- }
- cellnews->priv->prelit_bullet = pixbuf;
- if (cellnews->priv->prelit_bullet) {
- g_object_ref (cellnews->priv->prelit_bullet);
- }
-
- g_object_notify (object, "prelit_bullet");
- break;
- case PROP_MARKUP:
- str = g_value_get_string (value);
-
- if (cellnews->priv->extra_attrs) {
- pango_attr_list_unref (cellnews->priv->extra_attrs);
- }
-
- if (str && !pango_parse_markup (str,
- -1,
- 0,
- &attrs,
- &text,
- NULL,
- &error)) {
- g_warning ("Failed to set cell news from markup due to error parsing markup: %s",
- error->message);
- g_error_free (error);
- return;
- }
-
- cellnews->priv->text = text;
- cellnews->priv->extra_attrs = attrs;
-
- g_object_notify (object, "markup");
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-/**
- * nautilus_cell_renderer_news_new:
- *
- * Creates a new #NautilusCellRendererNews. Adjust how news is drawn using
- * object properties. Object properties can be
- * set globally (with g_object_set()). Also, with #GtkTreeViewColumn,
- * you can bind a property to a value in a #GtkTreeModel. For example,
- * you can bind the "news" property on the cell renderer to a string
- * value in the model, thus rendering a different string in each row
- * of the #GtkTreeView
- *
- * Return value: the new cell renderer
- **/
-GtkCellRenderer *
-nautilus_cell_renderer_news_new (void)
-{
- return GTK_CELL_RENDERER (g_object_new (nautilus_cell_renderer_news_get_type (), NULL));
-}
-
-static void
-add_attr (PangoAttrList *attr_list,
- PangoAttribute *attr)
-{
- attr->start_index = 0;
- attr->end_index = G_MAXINT;
-
- pango_attr_list_insert (attr_list, attr);
-}
-
-static PangoLayout*
-get_layout (NautilusCellRendererNews *cellnews,
- GtkWidget *widget,
- gboolean will_render,
- GtkCellRendererState flags)
-{
- PangoAttrList *attr_list;
- PangoLayout *layout;
- int wrap_width;
-
- layout = gtk_widget_create_pango_layout (widget, cellnews->priv->text);
-
- if (cellnews->priv->extra_attrs)
- attr_list = pango_attr_list_copy (cellnews->priv->extra_attrs);
- else
- attr_list = pango_attr_list_new ();
-
- add_attr (attr_list, pango_attr_font_desc_new (cellnews->priv->font));
-
- if ((flags & GTK_CELL_RENDERER_PRELIT) != 0) {
- add_attr (attr_list,
- pango_attr_foreground_new (0, 0, 65535 / 2));
- }
-
- pango_layout_set_attributes (layout, attr_list);
-
- if (cellnews->priv->wrap_at != -1) {
- wrap_width = cellnews->priv->wrap_at;
- if (cellnews->priv->bullet) {
- wrap_width -= (gdk_pixbuf_get_width (cellnews->priv->bullet) + PAD);
- }
-
- pango_layout_set_wrap (layout, PANGO_WRAP_WORD);
- pango_layout_set_width (layout,
- wrap_width * PANGO_SCALE);
- }
-
- pango_attr_list_unref (attr_list);
-
- return layout;
-}
-
-static void
-nautilus_cell_renderer_news_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- GdkRectangle *cell_area,
- int *x_offset,
- int *y_offset,
- int *width,
- int *height)
-{
- NautilusCellRendererNews *cellnews = (NautilusCellRendererNews *) cell;
- PangoRectangle rect;
- PangoLayout *layout;
-
- layout = get_layout (cellnews, widget, FALSE, 0);
- pango_layout_get_pixel_extents (layout, NULL, &rect);
-
- if (width) {
- *width = GTK_CELL_RENDERER (cellnews)->xpad * 2 + rect.width;
- if (cellnews->priv->bullet) {
- *width += gdk_pixbuf_get_width (cellnews->priv->bullet) + PAD;
- }
- }
-
- if (height) {
- *height = GTK_CELL_RENDERER (cellnews)->ypad * 2 + rect.height;
- if (cellnews->priv->bullet) {
- *height = MAX (*height,
- gdk_pixbuf_get_height (cellnews->priv->bullet) + GTK_CELL_RENDERER (cellnews)->ypad * 2);
- }
- }
-
- if (cell_area) {
- if (x_offset) {
- *x_offset = cell->xalign * (cell_area->width - rect.width - (2 * cell->xpad));
- *x_offset = MAX (*x_offset, 0);
- }
- if (y_offset) {
- *y_offset = cell->yalign * (cell_area->height - rect.height - (2 * cell->ypad));
- *y_offset = MAX (*y_offset, 0);
- }
- }
-
- g_object_unref (layout);
-}
-
-static void
-nautilus_cell_renderer_news_render (GtkCellRenderer *cell,
- GdkWindow *window,
- GtkWidget *widget,
- GdkRectangle *background_area,
- GdkRectangle *cell_area,
- GdkRectangle *expose_area,
- guint flags)
-
-{
- NautilusCellRendererNews *cellnews = (NautilusCellRendererNews *) cell;
- PangoLayout *layout;
- GtkStateType state;
- int x_offset;
- int y_offset;
- int height;
- int width;
- GdkPixbuf *pixbuf;
-
- layout = get_layout (cellnews, widget, TRUE, flags);
-
- nautilus_cell_renderer_news_get_size (cell, widget, cell_area, &x_offset, &y_offset, &height, &width);
-
- if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED) {
- if (GTK_WIDGET_HAS_FOCUS (widget)) {
- state = GTK_STATE_SELECTED;
- } else {
- state = GTK_STATE_ACTIVE;
- }
- } else {
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
- state = GTK_STATE_INSENSITIVE;
- else
- state = GTK_STATE_NORMAL;
- }
-
- if (cellnews->priv->prelit_bullet
- && (flags & GTK_CELL_RENDERER_PRELIT) == GTK_CELL_RENDERER_PRELIT) {
- pixbuf = cellnews->priv->prelit_bullet;
- } else {
- pixbuf = cellnews->priv->bullet;
- }
-
- if (pixbuf) {
- gdk_pixbuf_render_to_drawable_alpha
- (pixbuf,
- window,
- 0, 0,
- cell_area->x + cell->xpad,
- cell_area->y + cell->ypad,
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf),
- GDK_PIXBUF_ALPHA_FULL,
- 0,
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
- x_offset += gdk_pixbuf_get_width (pixbuf) + PAD;
- }
- gtk_paint_layout (widget->style,
- window,
- state,
- TRUE,
- cell_area,
- widget,
- "cellrenderernews",
- cell_area->x + x_offset + cell->xpad,
- cell_area->y + y_offset + cell->ypad,
- layout);
-
- g_object_unref (layout);
-}
diff --git a/components/news/nautilus-cell-renderer-news.h b/components/news/nautilus-cell-renderer-news.h
deleted file mode 100644
index 6f995fbbd..000000000
--- a/components/news/nautilus-cell-renderer-news.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus News Item Cell Renderer
- *
- * Copyright (C) 2000 Red Hat, Inc., Ximian Inc., Jonathan Blandford
- *
- * 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: Dave Camp <dave@ximian.com>
- * based on the text cell renderer by Jonathan Blandford
- * <jrb@redhat.com>
- *
- */
-
-#ifndef NAUTILUS_CELL_RENDERER_NEWS_ITEM_H
-#define NAUTILUS_CELL_RENDERER_NEWS_ITEM_H
-
-#include <gtk/gtkcellrenderer.h>
-
-G_BEGIN_DECLS
-
-#define NAUTILUS_TYPE_CELL_RENDERER_NEWS (nautilus_cell_renderer_news_get_type ())
-#define NAUTILUS_CELL_RENDERER_NEWS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_CELL_RENDERER_NEWS, NautilusCellRendererNews))
-#define NAUTILUS_CELL_RENDERER_NEWS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_CELL_RENDERER_NEWS, NautilusCellRendererNewsClass))
-#define NAUTILUS_IS_CELL_RENDERER_NEWS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_CELL_RENDERER_NEWS))
-#define NAUTILUS_IS_CELL_RENDERER_NEWS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_CELL_RENDERER_NEWS))
-
-typedef struct _NautilusCellRendererNews NautilusCellRendererNews;
-typedef struct _NautilusCellRendererNewsClass NautilusCellRendererNewsClass;
-typedef struct _NautilusCellRendererNewsPrivate NautilusCellRendererNewsPrivate;
-
-struct _NautilusCellRendererNews
-{
- GtkCellRenderer parent;
-
- NautilusCellRendererNewsPrivate *priv;
-};
-
-struct _NautilusCellRendererNewsClass
-{
- GtkCellRendererClass parent_class;
-};
-
-GType nautilus_cell_renderer_news_get_type (void);
-GtkCellRenderer *nautilus_cell_renderer_news_new (void);
-
-G_END_DECLS
-
-#endif /* __GTK_CELL_RENDERER_NEWS_H__ */
diff --git a/components/news/nautilus-news.c b/components/news/nautilus-news.c
deleted file mode 100644
index 93710e608..000000000
--- a/components/news/nautilus-news.c
+++ /dev/null
@@ -1,2562 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus News Viewer
- *
- * Copyright (C) 2001 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: Andy Hertzfeld <andy@eazel.com>
- *
- */
-
-/* This is the News sidebar panel, which displays current news headlines from
- * a variety of web sites, by fetching and displaying RSS files
- */
-
-#include <config.h>
-#include <time.h>
-
-#include "nautilus-cell-renderer-news.h"
-
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktreestore.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtkcellrendererpixbuf.h>
-#include <gtk/gtkdrawingarea.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtknotebook.h>
-
-#include <bonobo/bonobo-property-bag.h>
-
-#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-util.h>
-
-#include <libxml/parser.h>
-
-#include <libgnomevfs/gnome-vfs-utils.h>
-
-#include <eel/eel-background.h>
-#include <eel/eel-debug.h>
-#include <eel/eel-gdk-pixbuf-extensions.h>
-#include <eel/eel-glib-extensions.h>
-#include <eel/eel-graphic-effects.h>
-#include <eel/eel-gtk-extensions.h>
-#include <eel/eel-stock-dialogs.h>
-#include <eel/eel-string.h>
-#include <eel/eel-vfs-extensions.h>
-#include <eel/eel-xml-extensions.h>
-
-#include <libnautilus-private/nautilus-entry.h>
-#include <libnautilus-private/nautilus-file-attributes.h>
-#include <libnautilus-private/nautilus-file.h>
-#include <libnautilus-private/nautilus-file-utilities.h>
-#include <libnautilus-private/nautilus-global-preferences.h>
-#include <libnautilus-private/nautilus-metadata.h>
-#include <libnautilus-private/nautilus-theme.h>
-#include <libnautilus-private/nautilus-undo-signal-handlers.h>
-
-#include <libnautilus/nautilus-clipboard.h>
-#include <libnautilus/nautilus-view.h>
-#include <libnautilus/nautilus-view-standard-main.h>
-
-/* property bag getting and setting routines */
-enum {
- TAB_IMAGE,
- CLOSE_NOTIFY,
-};
-
-typedef enum {
- PAGE_MAIN,
- PAGE_CONFIGURE,
- PAGE_ADD_SITE
-} NewsPageNum;
-
-enum {
- MAIN_PAGE_DISPLAY,
- MAIN_PAGE_EMPTY
-};
-
-enum {
- REMOVE_COL_NAME,
- LAST_REMOVE_COL
-};
-
-enum {
- NEWS_COL_DATA,
- NEWS_COL_WIDTH,
- LAST_NEWS_COL
-};
-
-typedef struct _RSSNodeData RSSNodeData;
-typedef struct _RSSChannelData RSSChannelData;
-typedef struct _RSSItemData RSSItemData;
-
-/* data structure for the news view */
-typedef struct {
- NautilusView *view;
- BonoboPropertyBag *property_bag;
-
- GList *channel_list;
-
- GdkPixbuf *bullet;
- GdkPixbuf *prelit_bullet;
- GdkPixbuf *changed_bullet;
- GdkPixbuf *prelight_changed_bullet;
-
- GtkWidget *main_container;
- GtkWidget *main_box;
- GtkWidget *news_notebook;
- GtkWidget *news_display;
- GtkWidget *news_display_scrolled_window;
- GtkWidget *empty_message;
-
- GtkTreeModel *news_model;
-
- GtkWidget *configure_box;
- GtkWidget *checkbox_list;
-
- GtkWidget *edit_site_box;
- GtkWidget *item_name_field;
- GtkWidget *item_location_field;
-
- GtkWidget *remove_site_list;
- GtkWidget *remove_button;
-
- int max_item_count;
- uint update_interval;
- int update_timeout;
-
- gboolean news_changed;
- gboolean opened;
-
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
-
- NewsPageNum current_page;
-
- guint timer_task;
-
- GHashTable *item_uris;
-
- RSSItemData *current_item;
-
- int wrap_idle_handle;
-
- int last_width;
-} News;
-
-struct _RSSNodeData {
- char *title;
- char *markup;
- char *uri;
-
- GtkTreePath *path;
-
- GdkPixbuf *pixbuf;
- GdkPixbuf *prelight_pixbuf;
-};
-
-/* per channel structure for rss channel */
-struct _RSSChannelData {
- RSSNodeData node_data;
-
- char *name;
- char *uri;
- News *owner;
-
- gboolean is_showing;
- gboolean is_open;
- gboolean initial_load_flag;
- gboolean channel_changed;
- gboolean update_in_progress;
-
- GList *items;
-
- EelReadFileHandle *load_file_handle;
- EelPixbufLoadHandle *load_image_handle;
-
- GtkWidget *checkbox;
-
- time_t last_update;
-};
-
-/* per item structure for rss items */
-struct _RSSItemData {
- RSSNodeData node_data;
-
- RSSChannelData *owner;
- gboolean new_item;
-};
-
-#define EMPTY_MESSAGE_MARGIN 12
-#define EXPANDER_EXTRA_PADDING 4
-
-static char *news_get_indicator_image (News *news_data);
-static void nautilus_news_free_channel_list (News *news_data);
-static gboolean nautilus_news_save_channel_state (News* news_data);
-
-static char* get_xml_path (const char *file_name, gboolean force_local);
-static int check_for_updates (gpointer callback_data);
-static RSSChannelData* get_channel_from_name (News *news_data, const char *channel_name);
-static void nautilus_news_clear_changed_flags (News* news_data);
-static void clear_channel_changed_flags (RSSChannelData *channel_data);
-static void set_views_for_mode (News *news);
-static void max_items_changed (gpointer user_data);
-static void update_interval_changed (gpointer user_data);
-
-static void add_channel_entry (News *news_data, const char *channel_name,
- int index, gboolean is_showing);
-static void update_channels (News *news_data);
-static void update_items (RSSChannelData *channel_data, GList *old_items);
-
-static RSSChannelData*
-nautilus_news_make_new_channel (News *news_data,
- const char *name,
- const char* channel_uri,
- gboolean is_open,
- gboolean is_showing);
-
-
-static void
-update_node (News *news, RSSNodeData *node)
-{
- GtkTreeIter iter;
-
- if (node->path) {
- gtk_tree_model_get_iter (news->news_model, &iter, node->path);
- gtk_tree_model_row_changed (news->news_model,
- node->path, &iter);
- }
-}
-
-static char *
-get_channel_markup (RSSChannelData *channel_data)
-{
- const char *title;
- char *markup;
- char *escaped;
-
- title = channel_data->node_data.title ? channel_data->node_data.title : "";
- escaped = g_markup_escape_text (title, -1);
- markup = g_strdup_printf ("<span weight=\"bold\" size=\"large\">%s</span>", escaped);
- g_free (escaped);
- return markup;
-}
-
-static char *
-get_item_markup (RSSItemData *item_data)
-{
- char *title;
- char *markup;
- char *escaped;
- title = item_data->node_data.title ? item_data->node_data.title : "";
- escaped = g_markup_escape_text (title, strlen (title));
- markup = g_strdup_printf ("<u>%s</u>", escaped);
- g_free (escaped);
- return markup;
-}
-
-/* property bag property access routines */
-static void
-get_bonobo_properties (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer callback_data)
-{
- char *indicator_image;
- News *news;
-
- news = (News *) callback_data;
-
- switch (arg_id) {
- case TAB_IMAGE: {
- /* if there is a note, return the name of the indicator image,
- otherwise, return NULL */
- indicator_image = news_get_indicator_image (news);
- BONOBO_ARG_SET_STRING (arg, indicator_image);
- g_free (indicator_image);
- break;
- }
- case CLOSE_NOTIFY: {
- /* this shouldn't be read, but return it anyway */
- BONOBO_ARG_SET_BOOLEAN (arg, news->opened);
- break;
- }
-
- default:
- g_warning ("Unhandled arg %d", arg_id);
- break;
- }
-}
-
-static void
-set_bonobo_properties (BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer callback_data)
-{
- News *news;
-
- news = (News *) callback_data;
-
- switch (arg_id) {
- case TAB_IMAGE: {
- g_warning ("cant set tab image in news view");
- break;
- }
-
- /* when closed, clear the changed flags; also, exit configure mode */
- case CLOSE_NOTIFY: {
- if (BONOBO_ARG_GET_BOOLEAN (arg)) {
- news->opened = FALSE;
- nautilus_news_clear_changed_flags (news);
- news->current_page = PAGE_MAIN;
- set_views_for_mode (news);
- } else {
- news->opened = TRUE;
- }
- break;
- }
-
- default:
- g_warning ("Unhandled arg %d", arg_id);
- break;
- }
-}
-
-/* do_destroy is invoked when the nautilus view is destroyed to deallocate the resources used
- * by the news panel
- */
-static void
-do_destroy (GtkObject *obj, News *news)
-{
- nautilus_news_save_channel_state (news);
-
- if (news->timer_task != 0) {
- gtk_timeout_remove (news->timer_task);
- news->timer_task = 0;
- }
-
- if (news->update_timeout > 0) {
- gtk_timeout_remove (news->update_timeout);
- news->update_timeout = -1;
- }
-
- if (news->bullet != NULL) {
- g_object_unref (news->bullet);
- }
-
- if (news->prelit_bullet != NULL) {
- g_object_unref (news->prelit_bullet);
- }
-
- if (news->changed_bullet != NULL) {
- g_object_unref (news->changed_bullet);
- }
-
- if (news->prelight_changed_bullet != NULL) {
- g_object_unref (news->prelight_changed_bullet);
- }
-
- g_hash_table_destroy (news->item_uris);
-
- /* free all the channel data */
- nautilus_news_free_channel_list (news);
-
- /* free the property bag */
- bonobo_object_unref (news->property_bag);
-
- eel_preferences_remove_callback (NAUTILUS_PREFERENCES_NEWS_MAX_ITEMS,
- max_items_changed,
- news);
- eel_preferences_remove_callback (NAUTILUS_PREFERENCES_NEWS_UPDATE_INTERVAL,
- update_interval_changed,
- news);
-
- g_free (news);
-}
-
-/* utility routine to tell Nautilus to navigate to the passed-in uri */
-static void
-go_to_uri (News* news_data, const char* uri)
-{
- if (uri != NULL) {
- nautilus_view_open_location_in_this_window (news_data->view, uri);
- }
-}
-
-static void
-set_row_widths (News *news)
-{
- GtkTreeIter iter;
- GList *channel_item;
- GList *news_item;
- RSSNodeData *node_data;
- int cell_width;
- int expander_size;
- int horizontal_separator;
-
- /* Set the width attribute on all the rows by getting the width
- * of the widget and subtracting the depth * expander size */
-
- gtk_widget_style_get (news->news_display,
- "expander_size", &expander_size,
- "horizontal_separator", &horizontal_separator,
- NULL);
- expander_size += EXPANDER_EXTRA_PADDING;
-
- channel_item = news->channel_list;
- while (channel_item != NULL) {
- node_data = (RSSNodeData*) channel_item->data;
- channel_item = channel_item->next;
-
- if (node_data->path == NULL) {
- continue;
- }
- cell_width = news->news_display->allocation.width;
- cell_width -= ((gtk_tree_path_get_depth (node_data->path) * expander_size) + horizontal_separator);
- if (cell_width > 0) {
- gtk_tree_model_get_iter (news->news_model,
- &iter, node_data->path);
- gtk_tree_store_set (GTK_TREE_STORE (news->news_model),
- &iter,
- NEWS_COL_WIDTH, cell_width,
- -1);
- }
-
- news_item = ((RSSChannelData*)node_data)->items;
- while (news_item != NULL) {
- node_data = (RSSNodeData*)news_item->data;
- news_item = news_item->next;
- if (node_data->path == NULL) {
- continue;
- }
-
- cell_width = news->news_display->allocation.width;
- cell_width -= (gtk_tree_path_get_depth (node_data->path) * expander_size);
- if (cell_width > 0) {
- gtk_tree_model_get_iter (news->news_model,
- &iter, node_data->path);
-
- gtk_tree_store_set (GTK_TREE_STORE (news->news_model),
- &iter,
- NEWS_COL_WIDTH, cell_width,
- -1);
- }
- }
- }
-}
-
-static gboolean
-wrap_idle (gpointer data)
-{
- News *news = (News*)data;
-
- set_row_widths (news);
-
- news->wrap_idle_handle = -1;
- return FALSE;
-}
-
-static void
-nautilus_news_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
- News *news_data)
-{
- if (news_data->last_width != alloc->width) {
- if (news_data->wrap_idle_handle == -1) {
- news_data->wrap_idle_handle = gtk_idle_add (wrap_idle,
- news_data);
- }
- news_data->last_width = alloc->width;
- }
-}
-
-static RSSNodeData *
-node_data_for_path (News *news, GtkTreePath *path)
-{
- GtkTreeIter iter;
- RSSNodeData *node_data = NULL;
-
- if (gtk_tree_model_get_iter (news->news_model, &iter, path)) {
- gtk_tree_model_get (news->news_model, &iter,
- NEWS_COL_DATA,
- &node_data,
- -1);
- }
-
- return node_data;
-}
-
-static void
-nautilus_news_activate_path (News *news,
- GtkTreePath *path)
-{
- RSSNodeData *node_data;
-
- node_data = node_data_for_path (news, path);
- if (node_data) {
- go_to_uri (news, node_data->uri);
- }
-}
-
-static void
-nautilus_news_row_activated (GtkTreeView *tree_view,
- GtkTreePath *path,
- GtkTreeViewColumn *column,
- gpointer data)
-{
- News *news = (News*)data;
-
- nautilus_news_activate_path (news, path);
-}
-
-/* handle the news display hit-testing */
-static gint
-nautilus_news_button_release_event (GtkWidget *widget, GdkEventButton *event, News *news_data )
-{
- GtkTreePath *path;
-
- /* we only respond to the first button */
- if (event->button != 1) {
- return FALSE;
- }
-
- if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (news_data->news_display),
- event->x, event->y,
- &path, NULL, NULL, NULL)) {
- nautilus_news_activate_path (news_data, path);
- gtk_tree_path_free (path);
- }
-
- return FALSE;
-}
-
-static void
-nautilus_news_set_title (RSSChannelData *channel_data, const char *title)
-{
- if (channel_data->node_data.title) {
- g_free (channel_data->node_data.title);
- channel_data->node_data.title = NULL;
- }
-
- if (channel_data->node_data.markup) {
- g_free (channel_data->node_data.markup);
- channel_data->node_data.markup = NULL;
- }
-
- channel_data->node_data.title = g_strdup (title ? title : "");
-
- if (channel_data->node_data.pixbuf) {
- channel_data->node_data.markup = eel_strdup_strftime (_("%I:%M %p"), localtime (&channel_data->last_update));
- } else {
- channel_data->node_data.markup = get_channel_markup (channel_data);
- }
-
- update_node (channel_data->owner, (RSSNodeData*)channel_data);
-}
-
-static void
-free_rss_data_item (RSSItemData *item)
-{
- g_free (item->node_data.title);
- g_free (item->node_data.uri);
- g_free (item->node_data.markup);
-
- g_free (item);
-}
-
-static void
-free_rss_channel_items (RSSChannelData *channel_data)
-{
- eel_g_list_free_deep_custom (channel_data->items, (GFunc) free_rss_data_item, NULL);
- channel_data->items = NULL;
-}
-
-/* this frees a single channel object */
-static void
-free_channel (RSSChannelData *channel_data)
-{
- g_free (channel_data->name);
- g_free (channel_data->uri);
-
- if (channel_data->node_data.uri) {
- g_free (channel_data->node_data.uri);
- }
-
- if (channel_data->node_data.title != NULL) {
- g_free (channel_data->node_data.title);
- }
-
- if (channel_data->node_data.markup != NULL) {
- g_free (channel_data->node_data.markup);
- }
-
- if (channel_data->node_data.pixbuf != NULL) {
- g_object_unref (channel_data->node_data.pixbuf);
- }
- if (channel_data->node_data.prelight_pixbuf != NULL) {
- g_object_unref (channel_data->node_data.prelight_pixbuf);
- }
-
- if (channel_data->load_file_handle != NULL) {
- eel_read_file_cancel (channel_data->load_file_handle);
- }
-
- if (channel_data->load_image_handle != NULL) {
- eel_cancel_gdk_pixbuf_load (channel_data->load_image_handle);
- }
-
- free_rss_channel_items (channel_data);
-
- g_free (channel_data);
-}
-
-/* free the entire channel list */
-static void
-nautilus_news_free_channel_list (News *news_data)
-{
- GList *current_item;
-
- current_item = news_data->channel_list;
- while (current_item != NULL) {
- free_channel ((RSSChannelData*) current_item->data);
- current_item = current_item->next;
- }
-
- g_list_free (news_data->channel_list);
- news_data->channel_list = NULL;
-}
-
-/* utilities to deal with the changed flags */
-static void
-nautilus_news_set_news_changed (News *news_data, gboolean changed_flag)
-{
- char *tab_image;
- BonoboArg *tab_image_arg;
-
- if (news_data->news_changed != changed_flag) {
- news_data->news_changed = changed_flag;
-
- tab_image = news_get_indicator_image (news_data);
-
- tab_image_arg = bonobo_arg_new (BONOBO_ARG_STRING);
- BONOBO_ARG_SET_STRING (tab_image_arg, tab_image);
- bonobo_event_source_notify_listeners_full (news_data->property_bag->es,
- "Bonobo/Property",
- "change",
- "tab_image",
- tab_image_arg,
- NULL);
-
- bonobo_arg_release (tab_image_arg);
- g_free (tab_image);
- }
-}
-
-static void
-clear_channel_changed_flags (RSSChannelData *channel_data)
-{
- GList *current_item;
- RSSItemData *item_data;
-
- current_item = channel_data->items;
- while (current_item != NULL) {
- item_data = (RSSItemData*) current_item->data;
- item_data->new_item = FALSE;
-
- if (item_data->node_data.path) {
- update_node (channel_data->owner,
- (RSSNodeData*)item_data);
- }
-
- current_item = current_item->next;
- }
- channel_data->channel_changed = FALSE;
- update_node (channel_data->owner, (RSSNodeData*)channel_data);
-}
-
-static void
-nautilus_news_clear_changed_flags (News* news_data)
-{
- GList *current_channel;
- RSSChannelData *channel_data;
-
- current_channel = news_data->channel_list;
- while (current_channel != NULL) {
- channel_data = (RSSChannelData*) current_channel->data;
- clear_channel_changed_flags (channel_data);
- current_channel = current_channel->next;
- }
- nautilus_news_set_news_changed (news_data, FALSE);
-}
-
-/* utility to express boolean as a string */
-static char *
-bool_to_text (gboolean value)
-{
- return value ? "true" : "false";
-}
-
-/* build a channels xml file from the current channels state */
-static xmlDocPtr
-nautilus_news_make_channel_document (News* news_data)
-{
- xmlDoc *channel_doc;
- xmlNode *root_node;
- xmlNode *channel_node;
- RSSChannelData *channel_data;
- GList *next_channel;
- gboolean is_open;
-
- channel_doc = xmlNewDoc ("1.0");
-
- /* add the root node to the channel document */
- root_node = xmlNewDocNode (channel_doc, NULL, "rss_news_channels", NULL);
- xmlDocSetRootElement (channel_doc, root_node);
-
- /* loop through the channels, adding a node for each channel */
- next_channel = news_data->channel_list;
- while (next_channel != NULL) {
- channel_node = xmlNewChild (root_node, NULL, "rss_channel", NULL);
- channel_data = (RSSChannelData*) next_channel->data;
-
- xmlSetProp (channel_node, "name", channel_data->name);
- xmlSetProp (channel_node, "uri", channel_data->uri);
- xmlSetProp (channel_node, "show", bool_to_text (channel_data->is_showing));
-
- is_open = channel_data->is_open;
- xmlSetProp (channel_node, "open", bool_to_text (channel_data->is_open));
-
- next_channel = next_channel->next;
- }
- return channel_doc;
-}
-
-/* save the current channel state to disk */
-static gboolean
-nautilus_news_save_channel_state (News* news_data)
-{
- int result;
- char *path;
- xmlDoc *channel_doc;
-
- path = get_xml_path ("news_channels.xml", TRUE);
- channel_doc = nautilus_news_make_channel_document (news_data);
-
- result = xmlSaveFile (path, channel_doc);
-
- g_free (path);
- xmlFreeDoc (channel_doc);
-
- return result > 0;
-}
-
-
-static void
-rss_logo_callback (GnomeVFSResult error, GdkPixbuf *pixbuf, gpointer callback_data)
-{
- RSSChannelData *channel_data;
-
- channel_data = (RSSChannelData*) callback_data;
- channel_data->load_image_handle = NULL;
-
- if (channel_data->node_data.pixbuf) {
- g_object_unref (channel_data->node_data.pixbuf);
- channel_data->node_data.pixbuf = NULL;
- }
-
- if (pixbuf != NULL) {
- g_object_ref (pixbuf);
- pixbuf = eel_gdk_pixbuf_scale_down_to_fit (pixbuf, 192, 40);
-
- channel_data->node_data.pixbuf = pixbuf;
- channel_data->node_data.prelight_pixbuf = eel_create_spotlight_pixbuf (pixbuf);
-
- if (channel_data->node_data.markup) {
- g_free (channel_data->node_data.markup);
- channel_data->node_data.markup = eel_strdup_strftime (_("%I:%M %p"), localtime (&channel_data->last_update));
- }
-
- update_node (channel_data->owner, (RSSNodeData*)channel_data);
- }
-}
-
-
-/* utility routine to extract items from a node, returning the count of items found */
-static int
-extract_items (RSSChannelData *channel_data, xmlNodePtr container_node)
-{
- RSSItemData *item_parameters;
- xmlNodePtr current_node, title_node, temp_node;
- int item_count;
- char *title, *temp_str;
- gboolean scripting_news_format;
-
- current_node = container_node->children;
- item_count = 0;
- while (current_node != NULL) {
- if (eel_strcmp (current_node->name, "item") == 0) {
- title_node = eel_xml_get_child_by_name (current_node, "title");
- /* look for "text", too, to support Scripting News format */
- scripting_news_format = FALSE;
- if (title_node == NULL) {
- title_node = eel_xml_get_child_by_name (current_node, "text");
- scripting_news_format = title_node != NULL;
- }
- if (title_node != NULL) {
- item_parameters = (RSSItemData*) g_new0 (RSSItemData, 1);
- item_parameters->owner = channel_data;
- title = xmlNodeGetContent (title_node);
- item_parameters->node_data.title = g_strdup (title);
- xmlFree (title);
-
- temp_node = eel_xml_get_child_by_name (current_node, "link");
- if (temp_node) {
- if (scripting_news_format) {
- temp_node = eel_xml_get_child_by_name (temp_node, "url");
- }
- temp_str = xmlNodeGetContent (temp_node);
- item_parameters->node_data.uri = g_strdup (temp_str);
- xmlFree (temp_str);
- }
-
- if (item_parameters->node_data.title != NULL && item_parameters->node_data.uri != NULL) {
- channel_data->items = g_list_append (channel_data->items, item_parameters);
- item_count += 1;
- } else {
- free_rss_data_item (item_parameters);
- }
- }
- }
- current_node = current_node->next;
- }
- return item_count;
-}
-
-/* utility routine to search for the passed-in uri in an item list */
-static gboolean
-has_matching_uri (GList *items, const char *target_uri, gboolean *old_changed_flag)
-{
- GList *current_item;
- RSSItemData *item_data;
- char *mapped_target_uri, *mapped_item_uri;
- gboolean found_match;
-
- *old_changed_flag = FALSE;
-
- if (target_uri == NULL) {
- return FALSE;
- }
-
- mapped_target_uri = gnome_vfs_make_uri_canonical (target_uri);
-
- current_item = items;
- found_match = FALSE;
- while (current_item != NULL && !found_match) {
- item_data = (RSSItemData*) current_item->data;
- mapped_item_uri = gnome_vfs_make_uri_canonical (item_data->node_data.uri);
- if (eel_strcasecmp (mapped_item_uri, target_uri) == 0) {
- found_match = TRUE;
- *old_changed_flag = item_data->new_item;
- }
- g_free (mapped_item_uri);
- current_item = current_item->next;
- }
- g_free (mapped_target_uri);
- return found_match;
-}
-
-/* take a look at the newly generated items in the passed-in channel,
- * comparing them with the old items and marking them as new if necessary.
- */
-static int
-mark_new_items (RSSChannelData *channel_data, GList *old_items)
-{
- GList *current_item;
- RSSItemData *item_data;
- int changed_count;
- gboolean old_changed_flag;
-
- current_item = channel_data->items;
- changed_count = 0;
- while (current_item != NULL) {
- item_data = (RSSItemData*) current_item->data;
- if (!has_matching_uri (old_items, item_data->node_data.uri, &old_changed_flag) && !channel_data->initial_load_flag) {
- item_data->new_item = TRUE;
- channel_data->channel_changed = TRUE;
- nautilus_news_set_news_changed (channel_data->owner, TRUE);
- changed_count += 1;
- } else {
- item_data->new_item = old_changed_flag;
- }
-
- current_item = current_item->next;
- }
- return changed_count;
-}
-
-/* error handling utility */
-static void
-rss_read_error (RSSChannelData *channel_data)
-{
- char *error_message;
-
- channel_data->update_in_progress = FALSE;
- error_message = g_strdup_printf (_("Couldn't load %s"), channel_data->name);
- nautilus_news_set_title (channel_data, error_message);
- g_free (error_message);
-}
-
-/* utility routine to extract the title from a standard rss document. Return TRUE
- * if we find a valid title.
- */
-static gboolean
-extract_rss_title (RSSChannelData *channel_data, xmlDoc *rss_document)
-{
- gboolean got_title;
- xmlNode *channel_node, *temp_node;
- char *title, *temp_str;
-
- got_title = FALSE;
- channel_node = eel_xml_get_child_by_name (xmlDocGetRootElement (rss_document), "channel");
- if (channel_node != NULL) {
- temp_node = eel_xml_get_child_by_name (channel_node, "title");
- if (temp_node != NULL) {
- title = xmlNodeGetContent (temp_node);
- if (title != NULL) {
- nautilus_news_set_title (channel_data, title);
- got_title = TRUE;
- xmlFree (title);
- }
- }
-
- temp_node = eel_xml_get_child_by_name (channel_node, "link");
- if (temp_node != NULL) {
- temp_str = xmlNodeGetContent (temp_node);
- if (temp_str != NULL) {
- g_free (channel_data->node_data.uri);
- channel_data->node_data.uri = g_strdup (temp_str);
- xmlFree (temp_str);
- }
- }
-
- }
- return got_title;
-}
-
-/* extract the title for the scripting news variant format */
-static gboolean
-extract_scripting_news_title (RSSChannelData *channel_data, xmlDoc *rss_document)
-{
- gboolean got_title;
- xmlNode *channel_node, *temp_node;
- char *title, *temp_str;
-
- got_title = FALSE;
- channel_node = eel_xml_get_child_by_name (xmlDocGetRootElement (rss_document), "header");
- if (channel_node != NULL) {
- temp_node = eel_xml_get_child_by_name (channel_node, "channelTitle");
- if (temp_node != NULL) {
- title = xmlNodeGetContent (temp_node);
- if (title != NULL) {
- nautilus_news_set_title (channel_data, title);
- got_title = TRUE;
- xmlFree (title);
- }
- }
- temp_node = eel_xml_get_child_by_name (channel_node, "channelLink");
- if (temp_node != NULL) {
- temp_str = xmlNodeGetContent (temp_node);
- if (temp_str != NULL) {
- g_free (channel_data->node_data.uri);
- channel_data->node_data.uri = g_strdup (temp_str);
- xmlFree (temp_str);
- }
- }
-
- }
- return got_title;
-}
-
-/* utility routine to extract the logo image from a standard rss file and start loading it;
- * return true if we get one
- */
-static gboolean
-extract_rss_image (RSSChannelData *channel_data, xmlDoc *rss_document)
-{
- gboolean got_image;
- xmlNode *image_node, *uri_node;
- xmlNode *channel_node;
- char *image_uri;
-
- got_image = FALSE;
- image_node = eel_xml_get_child_by_name (xmlDocGetRootElement (rss_document), "image");
-
- /* if we can't find it at the top level, look inside the channel */
- if (image_node == NULL) {
- channel_node = eel_xml_get_child_by_name (xmlDocGetRootElement (rss_document), "channel");
- if (channel_node != NULL) {
- image_node = eel_xml_get_child_by_name (channel_node, "image");
- }
- }
-
- if (image_node != NULL) {
- uri_node = eel_xml_get_child_by_name (image_node, "url");
- if (uri_node != NULL) {
- image_uri = xmlNodeGetContent (uri_node);
- if (image_uri != NULL) {
- channel_data->load_image_handle = eel_gdk_pixbuf_load_async (image_uri,
- GNOME_VFS_PRIORITY_DEFAULT, rss_logo_callback, channel_data);
- got_image = TRUE;
- xmlFree (image_uri);
- }
- }
- }
- return got_image;
-}
-
-/* utility routine to extract the logo image from a scripting news format rss file and start loading it;
- * return true if we get one
- */
-static gboolean
-extract_scripting_news_image (RSSChannelData *channel_data, xmlDoc *rss_document)
-{
- gboolean got_image;
- xmlNode *image_node, *header_node;
- char *image_uri;
-
- got_image = FALSE;
- header_node = eel_xml_get_child_by_name (xmlDocGetRootElement (rss_document), "header");
- if (header_node != NULL) {
- image_node = eel_xml_get_child_by_name (header_node, "imageUrl");
- if (image_node != NULL) {
- image_uri = xmlNodeGetContent (image_node);
- if (image_uri != NULL) {
- channel_data->load_image_handle = eel_gdk_pixbuf_load_async (image_uri,
- GNOME_VFS_PRIORITY_DEFAULT, rss_logo_callback, channel_data);
- got_image = TRUE;
- xmlFree (image_uri);
- }
-
- }
- }
- return got_image;
-}
-
-
-/* completion routine invoked when we've loaded the rss file uri. Parse the xml document, and
- * then extract the various elements that we require.
- */
-static void
-rss_read_done_callback (GnomeVFSResult result,
- GnomeVFSFileSize file_size,
- char *file_contents,
- gpointer callback_data)
-{
- xmlDocPtr rss_document;
- xmlNodePtr channel_node, current_node;
- GList *old_items;
- int item_count, changed_count;
- RSSChannelData *channel_data;
- xmlSAXHandler silent_handler;
-
- char *buffer;
-
- channel_data = (RSSChannelData*) callback_data;
- channel_data->load_file_handle = NULL;
-
- /* make sure the read was successful */
- if (result != GNOME_VFS_OK) {
- g_assert (file_contents == NULL);
- rss_read_error (channel_data);
- return;
- }
-
- /* flag the update time */
- time (&channel_data->last_update);
-
- /* Parse the rss file with libxml. The libxml parser requires a zero-terminated array. */
- buffer = g_realloc (file_contents, file_size + 1);
- buffer[file_size] = '\0';
-
- initxmlDefaultSAXHandler (&silent_handler, FALSE);
- silent_handler.error = NULL;
- silent_handler.fatalError = NULL;
- rss_document = xmlSAXParseMemory (&silent_handler, buffer, file_size, 0);
- g_free (buffer);
-
- /* make sure there wasn't in error parsing the document */
- if (rss_document == NULL) {
- rss_read_error (channel_data);
- return;
- }
-
- /* set the title to the channel name, in case we don't get anything better from the file */
- nautilus_news_set_title (channel_data, channel_data->name);
- channel_node = eel_xml_get_child_by_name (xmlDocGetRootElement (rss_document), "channel");
-
- if (!extract_rss_title (channel_data, rss_document)) {
- extract_scripting_news_title (channel_data, rss_document);
- }
-
- /* extract the image uri and, if found, load it asynchronously; don't refetch if we already have one */
- if (channel_data->node_data.pixbuf == NULL && channel_data->load_image_handle == NULL) {
- if (!extract_rss_image (channel_data, rss_document)) {
- extract_scripting_news_image (channel_data, rss_document);
- }
- }
-
- /* extract the items */
- old_items = channel_data->items;
- channel_data->items = NULL;
-
- current_node = xmlDocGetRootElement (rss_document);
-
- item_count = extract_items (channel_data, current_node);
-
- /* if we couldn't find any items at the main level, look inside the channel node */
- if (item_count == 0 && channel_node != NULL) {
- item_count = extract_items (channel_data, channel_node);
- }
-
- changed_count = mark_new_items (channel_data, old_items);
-
- update_items (channel_data, old_items);
- set_row_widths (channel_data->owner);
-
- /* we're done, so free everything up */
- eel_g_list_free_deep_custom (old_items, (GFunc) free_rss_data_item, NULL);
- xmlFreeDoc (rss_document);
- channel_data->update_in_progress = FALSE;
- channel_data->initial_load_flag = FALSE;
-}
-
-static void
-nautilus_news_insert_channel (News *news_data,
- RSSChannelData *channel_data,
- int pos)
-{
- GtkTreeIter iter;
- GtkTreePath *path;
-
- g_return_if_fail (channel_data->is_showing);
- g_return_if_fail (channel_data->node_data.path == NULL);
-
- gtk_tree_store_insert (GTK_TREE_STORE (news_data->news_model),
- &iter, NULL, pos);
- gtk_tree_store_set (GTK_TREE_STORE (news_data->news_model),
- &iter,
- NEWS_COL_DATA, channel_data,
- NEWS_COL_WIDTH, -1,
- -1);
-
- path = gtk_tree_model_get_path (news_data->news_model,
- &iter);
- channel_data->node_data.path = path;
-}
-
-/* initiate the loading of a channel, by fetching the rss file through gnome-vfs */
-static void
-nautilus_news_load_channel (News *news_data, RSSChannelData *channel_data)
-{
- char *title;
-
- /* don't load if it's not showing, or it's already loading */
- if (!channel_data->is_showing || channel_data->update_in_progress ||
- channel_data->load_file_handle != NULL) {
- return;
- }
-
- /* load the uri asynchronously, calling a completion routine when completed */
- channel_data->update_in_progress = TRUE;
- channel_data->load_file_handle = eel_read_entire_file_async (channel_data->uri,
- GNOME_VFS_PRIORITY_DEFAULT, rss_read_done_callback, channel_data);
-
- /* put up a title that's displayed while we wait */
- title = g_strdup_printf (_("Loading %s"), channel_data->name);
- nautilus_news_set_title (channel_data, title);
- g_free (title);
-}
-
-/* detach items from the tree by clearing their path and taking them out
- of the uri hash table */
-static void
-detach_items (News *news, GList *items)
-{
- GList *item;
- RSSItemData *item_data;
-
- item = items;
- while (item) {
- item_data = (RSSItemData *)item->data;
-
- if (item_data->node_data.path) {
- gtk_tree_path_free (item_data->node_data.path);
- item_data->node_data.path = NULL;
- }
-
- if (item_data->node_data.uri) {
- g_hash_table_remove (news->item_uris,
- item_data->node_data.uri);
- }
-
- item = item->next;
- }
-}
-
-
-static void
-remove_items (RSSChannelData *channel_data, GList *items)
-{
- int num_children;
- GtkTreeIter parent_iter;
- GtkTreeIter iter;
-
- detach_items (channel_data->owner, items);
-
- gtk_tree_model_get_iter (channel_data->owner->news_model,
- &parent_iter, channel_data->node_data.path);
-
- num_children = gtk_tree_model_iter_n_children (channel_data->owner->news_model,
- &parent_iter);
- gtk_tree_model_iter_children (channel_data->owner->news_model,
- &iter, &parent_iter);
-
- while (num_children != 0) {
- gtk_tree_store_remove (GTK_TREE_STORE (channel_data->owner->news_model),
- &iter);
- num_children--;
- }
-
-
-}
-
-static void
-update_channels (News *news_data)
-{
- GList *channel_item;
- RSSChannelData *channel_data;
- gboolean was_showing;
-
- gtk_tree_store_clear (GTK_TREE_STORE (news_data->news_model));
-
- channel_item = news_data->channel_list;
- while (channel_item != NULL) {
- channel_data = (RSSChannelData*) channel_item->data;
-
- if (channel_data->node_data.path) {
- gtk_tree_path_free (channel_data->node_data.path);
- channel_data->node_data.path = NULL;
-
- detach_items (news_data, channel_data->items);
-
- was_showing = TRUE;
- } else {
- was_showing = FALSE;
- }
-
- if (channel_data->is_showing) {
- nautilus_news_insert_channel (news_data,
- channel_data, -1);
- if (was_showing) {
- update_items (channel_data, NULL);
- } else {
- nautilus_news_load_channel (news_data,
- channel_data);
- }
- }
-
- channel_item = channel_item->next;
- }
- set_row_widths (news_data);
-}
-
-static void
-update_items (RSSChannelData *channel_data, GList *old_items)
-{
- GtkTreeIter parent_iter;
- GtkTreeIter iter;
- GtkTreePath *path;
- GList *item;
- RSSItemData *item_data;
- int pos;
-
- g_return_if_fail (channel_data->node_data.path != NULL);
-
- remove_items (channel_data, old_items);
-
- gtk_tree_model_get_iter (channel_data->owner->news_model,
- &parent_iter, channel_data->node_data.path);
-
- pos = 0;
- item = channel_data->items;
- while (item && pos < channel_data->owner->max_item_count) {
- item_data = (RSSItemData *)item->data;
- item_data->node_data.markup = get_item_markup (item_data);
-
- if (item_data->new_item && (channel_data->owner->changed_bullet != NULL)) {
- item_data->node_data.pixbuf = channel_data->owner->changed_bullet;
- item_data->node_data.prelight_pixbuf = channel_data->owner->prelight_changed_bullet;
- } else {
- item_data->node_data.pixbuf = channel_data->owner->bullet;
- item_data->node_data.prelight_pixbuf = channel_data->owner->prelit_bullet;
- }
-
- gtk_tree_store_insert (GTK_TREE_STORE (channel_data->owner->news_model),
- &iter, &parent_iter, pos++);
- gtk_tree_store_set (GTK_TREE_STORE (channel_data->owner->news_model),
- &iter,
- NEWS_COL_DATA,
- item_data,
- NEWS_COL_WIDTH,
- -1,
- -1);
- path = gtk_tree_model_get_path (channel_data->owner->news_model,
- &iter);
- item_data->node_data.path = path;
-
- g_hash_table_insert (channel_data->owner->item_uris,
- item_data->node_data.uri,
- item_data);
-
- item = item->next;
- }
-
- if (channel_data->is_open) {
- gtk_tree_view_expand_row (GTK_TREE_VIEW (channel_data->owner->news_display),
- channel_data->node_data.path,
- TRUE);
- }
-}
-
-/* create a new channel object and initialize it, and start loading the content */
-static RSSChannelData*
-nautilus_news_make_new_channel (News *news_data,
- const char *name,
- const char* channel_uri,
- gboolean is_open,
- gboolean is_showing)
-{
- RSSChannelData *channel_data;
-
- channel_data = g_new0 (RSSChannelData, 1);
- channel_data->name = g_strdup (name);
- channel_data->uri = g_strdup (channel_uri);
- channel_data->owner = news_data;
- channel_data->is_open = is_open;
- channel_data->is_showing = is_showing;
- channel_data->initial_load_flag = TRUE;
-
- return channel_data;
-}
-
-/* comparison routine to put channels in alphabetical order */
-static gint
-compare_channel_names (RSSChannelData *channel_1, RSSChannelData *channel_2)
-{
- return strcmp (channel_1->name, channel_2->name);
-}
-
-/* add the channels defined in the passed in xml document to the channel list,
- * and start fetching the actual channel data
- */
-static void
-nautilus_news_add_channels (News *news_data, xmlDocPtr channels)
-{
- xmlNodePtr current_channel;
- RSSChannelData *channel_data;
- char *uri, *name;
- char *open_str, *show_str;
- gboolean is_open, is_showing;
-
- /* walk through the children of the root object, generating new channel
- * objects and adding them to the channel list
- */
- current_channel = xmlDocGetRootElement (channels)->children;
- while (current_channel != NULL) {
- if (eel_strcmp (current_channel->name, "rss_channel") == 0) {
- name = xmlGetProp (current_channel, "name");
- uri = xmlGetProp (current_channel, "uri");
- open_str = xmlGetProp (current_channel, "open");
- show_str = xmlGetProp (current_channel, "show");
-
- if (uri != NULL) {
- is_open = eel_strcasecmp (open_str, "true") == 0;
- is_showing = eel_strcasecmp (show_str, "true") == 0;
-
- channel_data = nautilus_news_make_new_channel (news_data, name, uri, is_open, is_showing);
- xmlFree (uri);
- if (channel_data != NULL) {
- news_data->channel_list = g_list_insert_sorted (news_data->channel_list,
- channel_data,
- (GCompareFunc) compare_channel_names);
- }
- }
- xmlFree (open_str);
- xmlFree (show_str);
- xmlFree (name);
- }
- current_channel = current_channel->next;
- }
-}
-
-static char*
-get_xml_path (const char *file_name, gboolean force_local)
-{
- char *xml_path;
- char *user_directory;
-
- user_directory = nautilus_get_user_directory ();
-
- /* first try the user's home directory */
- xml_path = g_build_filename (user_directory,
- file_name,
- NULL);
- g_free (user_directory);
- if (force_local || g_file_test (xml_path, G_FILE_TEST_EXISTS)) {
- return xml_path;
- }
- g_free (xml_path);
-
- /* next try the shared directory */
- xml_path = g_build_filename (NAUTILUS_DATADIR,
- file_name,
- NULL);
- if (g_file_test (xml_path, G_FILE_TEST_EXISTS)) {
- return xml_path;
- }
- g_free (xml_path);
-
- return NULL;
-}
-
-/* read the channel definition xml file and load the channels */
-static void
-read_channel_list (News *news_data)
-{
- char *path;
- xmlDocPtr channel_doc;
-
- /* free the old channel data, if any */
- nautilus_news_free_channel_list (news_data);
-
- /* get the path to the local copy of the channels file */
- path = get_xml_path ("news_channels.xml", FALSE);
- if (path != NULL) {
- channel_doc = xmlParseFile (path);
-
- if (channel_doc) {
- nautilus_news_add_channels (news_data, channel_doc);
- xmlFreeDoc (channel_doc);
- }
- g_free (path);
- }
-}
-
-/* handle periodically updating the channels if necessary */
-static int
-check_for_updates (gpointer callback_data)
-{
- News *news_data;
- guint current_time, next_update_time;
- GList *current_item;
- RSSChannelData *channel_data;
-
- news_data = (News*) callback_data;
- current_time = time (NULL);
-
- /* loop through the channel list, checking to see if any need updating */
- current_item = news_data->channel_list;
- while (current_item != NULL) {
- channel_data = (RSSChannelData*) current_item->data;
- next_update_time = channel_data->last_update + channel_data->owner->update_interval;
-
- if (current_time > next_update_time && !channel_data->update_in_progress && channel_data->is_showing) {
- nautilus_news_load_channel (news_data, channel_data);
- }
- current_item = current_item->next;
- }
-
- return TRUE;
-}
-
-/* return an image if there is a new article since last viewing, otherwise return NULL */
-static char *
-news_get_indicator_image (News *news_data)
-{
- if (news_data->news_changed) {
- return g_strdup ("changed_bullet.png");
- }
- return NULL;
-}
-
-/* utility routine to load images needed by the news view */
-static void
-nautilus_news_load_images (News *news_data)
-{
- char *news_bullet_path;
-
- if (news_data->bullet != NULL) {
- g_object_unref (news_data->bullet);
- }
- if (news_data->prelit_bullet != NULL) {
- g_object_unref (news_data->prelit_bullet);
- }
-
- news_bullet_path = nautilus_theme_get_image_path ("news_bullet.png");
- if (news_bullet_path != NULL) {
- news_data->bullet = gdk_pixbuf_new_from_file (news_bullet_path, NULL);
- news_data->prelit_bullet = eel_create_spotlight_pixbuf (news_data->bullet);
- g_free (news_bullet_path);
- }
-
- if (news_data->changed_bullet != NULL) {
- g_object_unref (news_data->changed_bullet);
- }
- if (news_data->prelight_changed_bullet != NULL) {
- g_object_unref (news_data->prelight_changed_bullet);
- }
-
- news_bullet_path = nautilus_theme_get_image_path ("changed_bullet.png");
- if (news_bullet_path != NULL) {
- news_data->changed_bullet = gdk_pixbuf_new_from_file (news_bullet_path, NULL);
- news_data->prelight_changed_bullet = eel_create_spotlight_pixbuf (news_data->changed_bullet);
- g_free (news_bullet_path);
- }
-}
-
-static void
-nautilus_news_cell_data_func (GtkTreeViewColumn *column,
- GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- RSSNodeData *node_data;
- int cell_width;
-
- gtk_tree_model_get (model, iter,
- NEWS_COL_DATA, &node_data,
- NEWS_COL_WIDTH, &cell_width,
- -1);
-
- if (node_data) {
- g_object_set (GTK_CELL_RENDERER (cell), "bullet",
- node_data->pixbuf, NULL);
- g_object_set (GTK_CELL_RENDERER (cell), "prelit_bullet",
- node_data->prelight_pixbuf, NULL);
- g_object_set (GTK_CELL_RENDERER (cell), "markup", node_data->markup);
- g_object_set (GTK_CELL_RENDERER (cell), "wrap_at",
- cell_width, NULL);
- }
-}
-
-static void
-nautilus_news_row_expanded (GtkTreeView *tree_view,
- GtkTreeIter *iter,
- GtkTreePath *path,
- gpointer data)
-{
- News *news = (News*)data;
- RSSChannelData *channel_data;
- g_return_if_fail (gtk_tree_path_get_depth (path) == 1);
-
- gtk_tree_model_get (news->news_model, iter,
- NEWS_COL_DATA, &channel_data,
- -1);
-
- channel_data->is_open = TRUE;
-}
-
-static void
-nautilus_news_row_collapsed (GtkTreeView *tree_view,
- GtkTreeIter *iter,
- GtkTreePath *path,
- gpointer data)
-{
- News *news = (News*)data;
- RSSChannelData *channel_data;
- g_return_if_fail (gtk_tree_path_get_depth (path) == 1);
-
- gtk_tree_model_get (news->news_model, iter,
- NEWS_COL_DATA, &channel_data,
- -1);
-
- channel_data->is_open = FALSE;
-}
-
-/* handle preference changes */
-static void
-max_items_changed (gpointer user_data)
-{
- News *news;
-
- news = (News*) user_data;
-
- news->max_item_count = eel_preferences_get_integer (NAUTILUS_PREFERENCES_NEWS_MAX_ITEMS);
- if (news->max_item_count <= 0) {
- news->max_item_count = 2;
- }
-}
-
-static void
-update_interval_changed (gpointer user_data)
-{
- News *news;
-
- news = (News*) user_data;
-
- news->update_interval = 60 * eel_preferences_get_integer (NAUTILUS_PREFERENCES_NEWS_UPDATE_INTERVAL);
- if (news->update_interval < 60) {
- news->update_interval = 60;
- }
-}
-
-/* utility to count the visible channels */
-static int
-count_visible_channels (News *news)
-{
- GList *current_item;
- RSSChannelData *current_channel;
- int visible_count;
-
- visible_count = 0;
- current_item = news->channel_list;
- while (current_item != NULL) {
- current_channel = (RSSChannelData *) current_item->data;
- if (current_channel->is_showing) {
- visible_count += 1;
- }
- current_item = current_item->next;
- }
- return visible_count;
-}
-
-/* utility to show and hide the views based on the mode */
-static void
-set_views_for_mode (News *news)
-{
- gtk_notebook_set_current_page (GTK_NOTEBOOK (news->main_container),
- news->current_page);
-
- if (news->current_page == PAGE_MAIN) {
- if (count_visible_channels (news) == 0) {
- gtk_notebook_set_current_page (GTK_NOTEBOOK (news->news_notebook), MAIN_PAGE_EMPTY);
- } else {
- gtk_notebook_set_current_page (GTK_NOTEBOOK (news->news_notebook), MAIN_PAGE_DISPLAY);
- }
- }
-}
-
-static void
-switch_page (News *news, NewsPageNum page)
-{
- if (news->current_page == PAGE_CONFIGURE) {
- nautilus_news_save_channel_state (news);
- }
-
- news->current_page = page;
- set_views_for_mode (news);
-
- if (page == PAGE_MAIN) {
- update_channels (news);
- check_for_updates (news);
- }
-}
-
-/* here's the button callback routine that toggles between display modes */
-static void
-configure_button_clicked (GtkWidget *widget, News *news)
-{
- if (news->current_page == PAGE_CONFIGURE) {
- switch_page (news, PAGE_MAIN);
- } else {
- switch_page (news, PAGE_CONFIGURE);
- }
-}
-
-/* here's the button callback routine that handles the add new site button
- * by showing the relevant widgets.
- */
-static void
-add_site_button_clicked (GtkWidget *widget, News *news)
-{
- switch_page (news, PAGE_ADD_SITE);
-}
-
-
-/* utility to add an entry to the remove channel clist */
-static void
-add_channel_to_remove_list (News *news_data, const char *channel_name)
-{
- GtkTreeIter iter;
- GtkListStore *store;
- store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (news_data->remove_site_list)));
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, REMOVE_COL_NAME, channel_name, -1);
-}
-
-static void
-update_remove_button (News *news)
-{
- GtkTreeSelection *selection;
- GtkTreeIter iter;
- gboolean sensitive;
-
- sensitive = FALSE;
- if (news->channel_list != NULL) {
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (news->remove_site_list));
- if (gtk_tree_selection_get_selected (selection, NULL, &iter)) {
- sensitive = TRUE;
- }
- }
-
- gtk_widget_set_sensitive (news->remove_button, sensitive);
-}
-
-/* handle adding a new site from the data in the "add site" fields */
-static void
-add_site_from_fields (GtkWidget *widget, News *news)
-{
- char *site_name, *site_location;
- char *site_uri, *buffer;
- RSSChannelData *channel_data;
- GnomeVFSResult result;
- int channel_count, byte_count;
- gboolean got_xml_file;
-
- site_name = (char *) gtk_entry_get_text (GTK_ENTRY (news->item_name_field));
- site_location = (char *)gtk_entry_get_text (GTK_ENTRY (news->item_location_field));
-
- /* make sure there's something in the fields */
- if (site_name == NULL || strlen (site_name) == 0) {
- eel_show_error_dialog (_("Sorry, but you have not specified a name for the site."),
- _("Please specify a name and try again."), _("Missing Site Name Error"), NULL);
- return;
- }
- if (site_location == NULL || strlen (site_location) == 0) {
- eel_show_error_dialog (_("Sorry, but you have not specified a URL for the site."),
- _("Please specify a URL and try again."), _("Missing URL Error"), NULL);
- return;
- }
-
- /* if there isn't a protocol specified for the location, use http */
- if (strchr (site_location, ':') == NULL) {
- site_uri = g_strconcat ("http://", site_location, NULL);
- } else {
- site_uri = g_strdup (site_location);
- }
-
- /* verify that we can read the specified location and that it's an xml file */
- result = eel_read_entire_file (site_uri, &byte_count, &buffer);
- got_xml_file = (result == GNOME_VFS_OK) && eel_istr_has_prefix (buffer, "<?xml");
- g_free (buffer);
- if (!got_xml_file) {
- g_free (site_uri);
- eel_show_error_dialog (_("Sorry, but the specified url doesn't seem to be a valid RSS file."),
- _("Please check the spelling of the url."), _("Invalid RSS URL"), NULL);
- return;
- }
-
- /* make the new channel */
- channel_data = nautilus_news_make_new_channel (news, site_name, site_uri, TRUE, TRUE);
- g_free (site_uri);
-
- if (channel_data != NULL) {
- news->channel_list = g_list_insert_sorted (news->channel_list,
- channel_data,
- (GCompareFunc) compare_channel_names);
- channel_count = g_list_length (news->channel_list);
- add_channel_entry (news, site_name, channel_count, TRUE);
- add_channel_to_remove_list (news, site_name);
- }
- /* clear fields for next time */
- gtk_editable_delete_text (GTK_EDITABLE (news->item_name_field), 0, -1);
- gtk_editable_delete_text (GTK_EDITABLE (news->item_location_field), 0, -1);
-
- update_remove_button (news);
-
- /* back to configure mode */
- switch_page (news, PAGE_CONFIGURE);
-}
-
-/* handle the remove command */
-static void
-remove_selected_site (GtkWidget *widget, News *news)
-{
- GtkTreeSelection *selection;
- GtkTreeIter iter;
- RSSChannelData *channel_data;
- GList *channel_item;
- const char *channel_name;
- GValue channel_name_value = { 0, };
-
- GtkTreeModel *model;
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (news->remove_site_list));
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (news->remove_site_list));
-
- if (gtk_tree_selection_get_selected (selection, NULL, &iter)) {
- gtk_tree_model_get_value (model,
- &iter,
- REMOVE_COL_NAME,
- &channel_name_value);
-
- channel_name = g_value_get_string (&channel_name_value);
-
- /* remove the channel from the channel linked list */
- channel_data = get_channel_from_name (news, channel_name);
-
- channel_item = g_list_find (news->channel_list, channel_data);
- if (channel_item != NULL) {
- news->channel_list = g_list_remove_link (news->channel_list, channel_item);
- }
-
- /* remove the channel from the add list and release it */
- if (channel_data != NULL) {
- gtk_widget_destroy (channel_data->checkbox);
- free_channel (channel_data);
- }
-
- gtk_list_store_remove (GTK_LIST_STORE (model),
- &iter);
- update_remove_button (news);
- switch_page (news, PAGE_CONFIGURE);
- }
-}
-
-/* utility routine to create the button box and constituent buttons */
-static GtkWidget *
-add_command_buttons (News *news_data, const char* label, gboolean from_configure)
-{
- GtkWidget *frame;
- GtkWidget *button_box;
- GtkWidget *button;
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type( GTK_FRAME (frame), GTK_SHADOW_OUT);
-
- button_box = gtk_hbutton_box_new ();
-
- gtk_container_set_border_width (GTK_CONTAINER (button_box), 2);
- gtk_widget_show (button_box);
- gtk_container_add (GTK_CONTAINER (frame), button_box);
-
- /* Set the appearance of the Button Box */
- gtk_button_box_set_layout (GTK_BUTTON_BOX (button_box), GTK_BUTTONBOX_END);
- gtk_box_set_spacing (GTK_BOX (button_box), 4);
-
- if (from_configure) {
- button = gtk_button_new_with_mnemonic (_("Edi_t"));
- gtk_widget_show (button);
- gtk_container_add (GTK_CONTAINER (button_box), button);
-
- g_signal_connect (button, "clicked",
- G_CALLBACK (add_site_button_clicked), news_data);
- }
-
- button = gtk_button_new_from_stock (label);
- gtk_widget_show (button);
- gtk_container_add (GTK_CONTAINER (button_box), button);
-
- g_signal_connect (button, "clicked",
- G_CALLBACK (configure_button_clicked), news_data);
-
- return frame;
-}
-
-/* utility routine to look up a channel from it's name */
-static RSSChannelData*
-get_channel_from_name (News *news_data, const char *channel_name)
-{
- GList *channel_item;
- RSSChannelData *channel_data;
-
- channel_item = news_data->channel_list;
- while (channel_item != NULL) {
- channel_data = (RSSChannelData*) channel_item->data;
- if (eel_strcasecmp (channel_data->name, channel_name) == 0) {
- return channel_data;
- }
- channel_item = channel_item->next;
- }
- return NULL;
-}
-
-/* here's the handler for handling clicks in channel check boxes */
-static void
-check_button_toggled_callback (GtkToggleButton *toggle_button, gpointer user_data)
-{
- News *news_data;
- char *channel_name;
- RSSChannelData *channel_data;
-
- news_data = (News*) user_data;
- channel_name = g_object_get_data (G_OBJECT (toggle_button), "channel_name");
-
- channel_data = get_channel_from_name (news_data, channel_name);
- if (channel_data != NULL) {
- channel_data->is_showing = !channel_data->is_showing;
- if (channel_data->is_showing) {
- channel_data->is_open = TRUE;
- }
- }
-}
-
-static gboolean
-check_button_focus_in_callback (GtkWidget *widget,
- GdkEventFocus *event,
- gpointer data)
-{
- g_return_val_if_fail (widget->parent && widget->parent->parent, FALSE);
- g_return_val_if_fail (GTK_IS_VIEWPORT (widget->parent->parent), FALSE);
-
- eel_gtk_viewport_scroll_to_rect (GTK_VIEWPORT (widget->parent->parent),
- &widget->allocation);
-
- return FALSE;
-}
-
-
-/* callback to maintain the current location */
-static void
-nautilus_news_load_location (NautilusView *view, const char *location, News *news)
-{
- RSSItemData *item;
- char *markup;
- char *bold;
-
- if (news->current_item) {
- if (news->current_item->node_data.markup) {
- g_free (news->current_item->node_data.markup);
- }
- news->current_item->node_data.markup =
- get_item_markup (news->current_item);
- update_node (news, (RSSNodeData*)news->current_item);
-
- news->current_item = NULL;
- }
-
- item = g_hash_table_lookup (news->item_uris, location);
- if (item) {
- markup = get_item_markup (item);
- if (markup) {
- bold = g_strdup_printf ("<b>%s</b>", markup);
- g_free (markup);
-
- } else {
- bold = NULL;
- }
-
- if (item->node_data.markup) {
- g_free (item->node_data.markup);
- }
- item->node_data.markup = bold;
-
- update_node (news, (RSSNodeData *)item);
-
- news->current_item = item;
- }
-}
-
-/* utility routine to determine the sort position of a checkbox */
-static int
-determine_sort_position (GtkWidget *container, const char *name)
-{
- GList *checkboxes, *current_item;
- char *current_name;
- int index;
-
- checkboxes = gtk_container_get_children (GTK_CONTAINER (container));
- index = 0;
- current_item = checkboxes;
- while (current_item != NULL) {
- current_name = g_object_get_data (G_OBJECT (current_item->data), "channel_name");
-
- if (eel_strcasecmp (current_name, name) > 0) {
- g_list_free (checkboxes);
- return index;
- }
-
- index += 1;
- current_item = current_item->next;
- }
- g_list_free (checkboxes);
- return index;
-}
-
-/* utility routine to add a check-box entry to the channel list */
-static void
-add_channel_entry (News *news_data, const char *channel_name, int index, gboolean is_showing)
-{
- GtkWidget *check_button;
- RSSChannelData *channel_data;
- int sort_position;
-
- check_button = gtk_check_button_new_with_label (channel_name);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), is_showing);
- gtk_widget_show (check_button);
- gtk_box_pack_start (GTK_BOX (news_data->checkbox_list), check_button, FALSE, FALSE, 0);
-
- g_signal_connect (check_button, "toggled",
- G_CALLBACK (check_button_toggled_callback),
- news_data);
- g_signal_connect (check_button, "focus_in_event",
- G_CALLBACK (check_button_focus_in_callback),
- news_data);
-
- /* reorder newly added button so it's sorted by it's name */
- sort_position = determine_sort_position (news_data->checkbox_list, channel_name);
- gtk_box_reorder_child (GTK_BOX (news_data->checkbox_list), check_button, sort_position);
-
- /* set up pointer in channel object to checkbox, so we can delete it */
- channel_data = get_channel_from_name (news_data, channel_name);
- if (channel_data != NULL) {
- channel_data->checkbox = check_button;
- }
-
- /* set up user data to use in toggle handler */
- g_object_set_data (G_OBJECT (check_button), "user_data", news_data);
- g_object_set_data_full (G_OBJECT(check_button),
- "channel_name",
- g_strdup (channel_name),
- g_free);
-}
-
-/* here's the routine that loads and parses the xml file, then iterates through it
- * to add channels to the enable/disable lists
- */
-static void
-add_channels_to_lists (News* news_data)
-{
- char *path;
- char *channel_name, *show_str;
- xmlDocPtr channel_doc;
- xmlNodePtr current_channel;
- int channel_index;
- gboolean is_shown;
-
- /* read the xml file and parse it */
- path = get_xml_path ("news_channels.xml", FALSE);
- if (path == NULL) {
- return;
- }
-
- channel_doc = xmlParseFile (path);
- g_free (path);
- if (channel_doc == NULL) {
- return;
- }
-
- /* loop through the channel entries, adding an entry to the configure
- * list for each entry in the file
- */
- current_channel = xmlDocGetRootElement (channel_doc)->children;
- channel_index = 0;
- while (current_channel != NULL) {
- if (eel_strcmp (current_channel->name, "rss_channel") == 0) {
- channel_name = xmlGetProp (current_channel, "name");
- show_str = xmlGetProp (current_channel, "show");
- is_shown = eel_strcasecmp (show_str, "true") == 0;
-
- /* add an entry to the channel list */
- if (channel_name != NULL) {
- add_channel_entry (news_data, channel_name, channel_index, is_shown);
- add_channel_to_remove_list (news_data, channel_name);
-
- channel_index += 1;
- }
-
- xmlFree (show_str);
- xmlFree (channel_name);
- }
- current_channel = current_channel->next;
- }
-
- xmlFreeDoc (channel_doc);
-}
-
-/* code-saving utility to allocate a left-justified anti-aliased label */
-static GtkWidget *
-news_label_new (const char *label_text, gboolean title_mode)
-{
- GtkWidget *label;
-
- label = gtk_label_new_with_mnemonic (label_text);
- if (title_mode) {
- eel_gtk_label_make_bold (GTK_LABEL (label));
- }
-
- gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-
- return label;
-}
-
-static void
-remove_list_selection_changed (GObject *obj, News *news)
-{
- update_remove_button (news);
-}
-
-/* generate the remove widgets */
-static void
-make_remove_widgets (News *news, GtkWidget *container)
-{
- GtkWidget *button_box;
- GtkScrolledWindow *scrolled_window;
- GtkListStore *store;
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
- GtkTreeSelection *selection;
-
- store = gtk_list_store_new (LAST_REMOVE_COL, G_TYPE_STRING);
-
- news->remove_site_list =
- gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (news->remove_site_list), FALSE);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (news->remove_site_list));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- g_signal_connect (selection, "changed",
- G_CALLBACK (remove_list_selection_changed), news);
-
- renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes (_("Site Name"),
- renderer,
- "text",
- REMOVE_COL_NAME,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (news->remove_site_list),
- column);
- g_object_unref (store);
-
- gtk_widget_show (news->remove_site_list);
-
- scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL));
- gtk_scrolled_window_set_policy (scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (scrolled_window,
- GTK_SHADOW_IN);
- gtk_widget_show (GTK_WIDGET (scrolled_window));
- gtk_container_add (GTK_CONTAINER (scrolled_window), news->remove_site_list);
- gtk_box_pack_start (GTK_BOX (container), GTK_WIDGET (scrolled_window), TRUE, TRUE, 0);
-
- /* install the remove button */
- button_box = gtk_hbutton_box_new ();
- gtk_box_pack_start (GTK_BOX (container), button_box, FALSE, FALSE, 4);
-
- gtk_button_box_set_layout (GTK_BUTTON_BOX (button_box), GTK_BUTTONBOX_END);
- gtk_box_set_spacing (GTK_BOX (button_box), 4);
-
- news->remove_button = gtk_button_new_with_mnemonic (_("_Remove Site"));
- gtk_widget_show (news->remove_button);
-
- gtk_container_add (GTK_CONTAINER (button_box), news->remove_button);
-
- gtk_widget_show (button_box);
-
- g_signal_connect (news->remove_button, "clicked",
- (GtkSignalFunc) remove_selected_site, news);
-}
-
-/* generate the add new site widgets */
-static void
-make_add_widgets (News *news, GtkWidget *container)
-{
- GtkWidget *label;
- GtkWidget *temp_vbox;
- GtkWidget *button_box;
- GtkWidget *button;
-
- temp_vbox = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (temp_vbox);
-
- gtk_box_pack_start (GTK_BOX (container), temp_vbox, FALSE, FALSE, 0);
-
- /* allocate the name field */
- label = news_label_new (_("Site _Name:"), FALSE);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (temp_vbox), label, FALSE, FALSE, 0);
-
- news->item_name_field = nautilus_entry_new ();
- gtk_label_set_mnemonic_widget (GTK_LABEL (label),
- news->item_name_field);
-
- gtk_widget_show (news->item_name_field);
- gtk_box_pack_start (GTK_BOX (temp_vbox), news->item_name_field, FALSE, FALSE, 0);
- nautilus_undo_editable_set_undo_key (GTK_EDITABLE (news->item_name_field), TRUE);
-
- /* allocate the location field */
- temp_vbox = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (temp_vbox);
-
- gtk_box_pack_start (GTK_BOX (container), temp_vbox, FALSE, FALSE, 0);
-
- label = news_label_new (_("Site _RSS URL:"), FALSE);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (temp_vbox), label, FALSE, FALSE, 0);
-
- news->item_location_field = nautilus_entry_new ();
- gtk_label_set_mnemonic_widget (GTK_LABEL (label),
- news->item_location_field);
- gtk_widget_show (news->item_location_field);
- gtk_box_pack_start (GTK_BOX (temp_vbox), news->item_location_field, FALSE, FALSE, 0);
- nautilus_undo_editable_set_undo_key (GTK_EDITABLE (news->item_location_field), TRUE);
-
- /* install the add buttons */
- button_box = gtk_hbutton_box_new ();
- gtk_widget_show (button_box);
-
- gtk_box_pack_start (GTK_BOX (container), button_box, FALSE, FALSE, 4);
-
- gtk_button_box_set_layout (GTK_BUTTON_BOX (button_box), GTK_BUTTONBOX_END);
- gtk_box_set_spacing (GTK_BOX (button_box), 4);
-
- button = gtk_button_new_with_mnemonic (_("_Add New Site"));
- gtk_widget_show (button);
-
- gtk_container_add (GTK_CONTAINER (button_box), button);
- g_signal_connect (button, "clicked",
- G_CALLBACK (add_site_from_fields), news);
-}
-
-/* allocate the add/remove location widgets */
-static void
-set_up_edit_widgets (News *news, GtkWidget *container)
-{
- GtkWidget *label;
- GtkWidget *expand_box;
- GtkWidget *button_box;
- GtkWidget *temp_vbox;
-
- news->edit_site_box = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (news->edit_site_box);
-
- gtk_notebook_insert_page (GTK_NOTEBOOK (container),
- news->edit_site_box, NULL, PAGE_ADD_SITE);
-
- expand_box = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (expand_box);
-
- gtk_box_pack_start (GTK_BOX (news->edit_site_box), expand_box, TRUE, TRUE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (expand_box), 4);
-
- /* make the add new site label */
- label = news_label_new (_("Add a New Site:"), TRUE);
- gtk_widget_show (label);
-
- gtk_box_pack_start (GTK_BOX (expand_box), label, FALSE, FALSE, 0);
-
- /* allocate the add new site widgets */
- make_add_widgets (news, expand_box);
-
- /* allocate the remove label */
- temp_vbox = gtk_vbox_new (FALSE, 0);
-
- label = news_label_new (_("Remove a _Site:"), TRUE);
- gtk_widget_show (label);
-
- gtk_box_pack_start (GTK_BOX (temp_vbox), label, FALSE, FALSE, 0);
- gtk_widget_show (temp_vbox);
-
- /* allocate the remove widgets */
- make_remove_widgets (news, temp_vbox);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label),
- news->remove_site_list);
-
- gtk_box_pack_start (GTK_BOX (expand_box), temp_vbox, TRUE, TRUE, 0);
-
- /* add the button box at the bottom with a cancel button */
- button_box = add_command_buttons (news, GTK_STOCK_CANCEL, FALSE);
- gtk_widget_show (button_box);
- gtk_box_pack_start (GTK_BOX (news->edit_site_box), button_box, FALSE, FALSE, 0);
-}
-
-static gboolean
-site_list_mnemonic_activate (GtkWidget *widget, gboolean group_cycling,
- gpointer data)
-{
- News *news;
- RSSChannelData *channel_data;
-
- news = (News*)data;
- channel_data = (RSSChannelData*)news->channel_list->data;
-
- gtk_widget_grab_focus (channel_data->checkbox);
-
- return TRUE;
-}
-
-/* allocate the widgets for the configure mode */
-static void
-set_up_configure_widgets (News *news, GtkWidget *container)
-{
- GtkWidget *button_box;
- GtkWidget *viewport;
- GtkScrolledWindow *scrolled_window;
- GtkWidget *label;
-
- news->configure_box = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (news->configure_box);
-
- gtk_notebook_insert_page (GTK_NOTEBOOK (container),
- news->configure_box, NULL, PAGE_CONFIGURE);
-
- /* add a descriptive label */
- label = news_label_new (_("_Select Sites:"), TRUE);
-
- gtk_widget_show (label);
-
- gtk_box_pack_start (GTK_BOX (news->configure_box), label, FALSE, FALSE, 0);
-
- /* allocate a table to hold the check boxes */
- news->checkbox_list = gtk_vbox_new (FALSE, 0);
- g_signal_connect (GTK_WIDGET (news->checkbox_list),
- "mnemonic_activate",
- G_CALLBACK (site_list_mnemonic_activate), news);
-
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), news->checkbox_list);
-
- gtk_widget_show (news->checkbox_list);
-
- scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new (NULL, NULL));
- gtk_scrolled_window_set_policy (scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_widget_show (GTK_WIDGET (scrolled_window));
-
- viewport = gtk_viewport_new (gtk_scrolled_window_get_hadjustment (scrolled_window),
- gtk_scrolled_window_get_vadjustment (scrolled_window));
- gtk_widget_show (viewport);
-
- gtk_container_add (GTK_CONTAINER (scrolled_window), viewport);
- gtk_container_add (GTK_CONTAINER (viewport), news->checkbox_list);
-
- gtk_box_pack_start (GTK_BOX (news->configure_box), GTK_WIDGET (scrolled_window), TRUE, TRUE, 0);
-
- /* allocate the button box for the done button */
- button_box = add_command_buttons (news, _("_Done"), TRUE);
- gtk_widget_show (button_box);
- gtk_box_pack_start (GTK_BOX (news->configure_box), button_box, FALSE, FALSE, 0);
-}
-
-/* allocate the widgets for the main display mode */
-static void
-set_up_main_widgets (News *news, GtkWidget *container)
-{
- GtkWidget *button_box;
- GtkWidget *scrolled_window;
-
- /* allocate a vbox to hold all of the main UI elements elements */
- news->main_box = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (news->main_box);
-
- gtk_notebook_insert_page (GTK_NOTEBOOK (container),
- news->main_box, NULL, PAGE_MAIN);
-
- news->news_notebook = gtk_notebook_new ();
- gtk_widget_show (news->news_notebook);
-
- gtk_notebook_set_show_border (GTK_NOTEBOOK (news->news_notebook),
- FALSE);
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (news->news_notebook),
- FALSE);
-
- gtk_widget_show (news->news_notebook);
- gtk_box_pack_start (GTK_BOX (news->main_box), news->news_notebook,
- TRUE, TRUE, 0);
-
- /* create and install the display area */
- news->news_model = GTK_TREE_MODEL (gtk_tree_store_new (LAST_NEWS_COL,
- G_TYPE_POINTER,
- G_TYPE_INT));
-
- news->news_display = gtk_tree_view_new_with_model (GTK_TREE_MODEL (news->news_model));
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (news->news_display),
- FALSE);
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (news->news_display)),
- GTK_SELECTION_NONE);
-
- news->column = gtk_tree_view_column_new ();
-
- news->renderer = nautilus_cell_renderer_news_new ();
- gtk_tree_view_column_pack_start (news->column, news->renderer, FALSE);
- gtk_tree_view_column_set_cell_data_func (news->column,
- news->renderer,
- nautilus_news_cell_data_func,
- news, NULL);
-
- gtk_tree_view_append_column (GTK_TREE_VIEW (news->news_display),
- news->column);
-
- gtk_widget_show (news->news_display);
- /* put the display in a scrolled window so it can scroll */
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (scrolled_window),
- news->news_display);
- gtk_widget_show (scrolled_window);
-
- gtk_notebook_append_page (GTK_NOTEBOOK (news->news_notebook),
- scrolled_window, NULL);
- news->news_display_scrolled_window = scrolled_window;
-
- /* add the empty message */
- news->empty_message = gtk_label_new (_("The News panel displays current headlines from your favorite websites. Click the \'Select Sites\' button to select the sites to display."));
- eel_gtk_label_set_scale (GTK_LABEL (news->empty_message), PANGO_SCALE_LARGE);
- gtk_label_set_line_wrap (GTK_LABEL (news->empty_message), TRUE);
- gtk_widget_show (news->empty_message);
-
- gtk_notebook_append_page (GTK_NOTEBOOK (news->news_notebook),
- news->empty_message, NULL);
-
- g_signal_connect (news->news_display, "size_allocate",
- G_CALLBACK (nautilus_news_size_allocate), news);
- g_signal_connect (news->news_display, "row_activated",
- G_CALLBACK (nautilus_news_row_activated), news);
- g_signal_connect (news->news_display, "row_expanded",
- G_CALLBACK (nautilus_news_row_expanded), news);
- g_signal_connect (news->news_display, "row_collapsed",
- G_CALLBACK (nautilus_news_row_collapsed), news);
-
- g_signal_connect_after (news->news_display, "button_release_event",
- G_CALLBACK (nautilus_news_button_release_event), news);
-
- /* create a button box to hold the command buttons */
- button_box = add_command_buttons (news, _("_Select Sites"), FALSE);
- gtk_widget_show (button_box);
- gtk_box_pack_start (GTK_BOX (news->main_box), button_box, FALSE, FALSE, 0);
-}
-
-
-static BonoboObject *
-make_news_view (const char *iid, void *callback_data)
-{
- News *news;
-
- /* create the private data for the news view */
- news = g_new0 (News, 1);
-
-
- /* allocate the main container */
- news->main_container = gtk_notebook_new ();
- gtk_notebook_set_show_border (GTK_NOTEBOOK (news->main_container),
- FALSE);
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (news->main_container),
- FALSE);
-
- /* set up the widgets for the main,configure and add modes */
- set_up_main_widgets (news, news->main_container);
- set_up_configure_widgets (news, news->main_container);
- set_up_edit_widgets (news, news->main_container);
-
- gtk_widget_show (news->main_container);
-
- /* get preferences and sanity check them */
- news->max_item_count = eel_preferences_get_integer (NAUTILUS_PREFERENCES_NEWS_MAX_ITEMS);
- news->update_interval = 60 * eel_preferences_get_integer (NAUTILUS_PREFERENCES_NEWS_UPDATE_INTERVAL);
- news->update_timeout = -1;
-
- if (news->max_item_count <= 0) {
- news->max_item_count = 2;
- }
-
- if (news->update_interval < 60) {
- news->update_interval = 60;
- }
-
- news->wrap_idle_handle = -1;
-
- eel_preferences_add_callback (NAUTILUS_PREFERENCES_NEWS_MAX_ITEMS, max_items_changed, news);
- eel_preferences_add_callback (NAUTILUS_PREFERENCES_NEWS_UPDATE_INTERVAL, update_interval_changed, news);
-
- /* load some images */
- nautilus_news_load_images (news);
-
- /* set up the update timeout */
- news->timer_task = gtk_timeout_add (10000, check_for_updates, news);
-
- gtk_widget_show_all (news->main_container);
-
- /* Create the nautilus view CORBA object. */
- news->view = nautilus_view_new (news->main_container);
- g_signal_connect (news->view, "destroy", G_CALLBACK (do_destroy), news);
-
- g_signal_connect (news->view, "load_location",
- G_CALLBACK (nautilus_news_load_location), news);
-
- /* allocate a property bag to reflect the TAB_IMAGE property */
- news->property_bag = bonobo_property_bag_new (get_bonobo_properties, set_bonobo_properties, news);
-
- bonobo_control_set_properties (nautilus_view_get_bonobo_control (news->view), BONOBO_OBJREF (news->property_bag), NULL);
- bonobo_property_bag_add (news->property_bag, "tab_image", TAB_IMAGE, BONOBO_ARG_STRING, NULL,
- _("image indicating that the news has changed"), 0);
- bonobo_property_bag_add (news->property_bag, "close", CLOSE_NOTIFY,
- BONOBO_ARG_BOOLEAN, NULL, "close notification", 0);
-
- nautilus_news_clear_changed_flags (news);
-
- news->item_uris = g_hash_table_new (g_str_hash, g_str_equal);
-
- /* read the channel definition file and start loading the channels */
- read_channel_list (news);
- update_channels (news);
-
- /* populate the configuration list */
- add_channels_to_lists (news);
- update_remove_button (news);
-
- /* default to the main mode */
- news->current_page = PAGE_MAIN;
- set_views_for_mode (news);
-
- /* return the nautilus view */
- return BONOBO_OBJECT (news->view);
-}
-
-int
-main(int argc, char *argv[])
-{
- if (g_getenv ("NAUTILUS_DEBUG") != NULL) {
- eel_make_warnings_and_criticals_stop_in_debugger ();
- }
-
- return nautilus_view_standard_main ("nautilus-news",
- VERSION,
- GETTEXT_PACKAGE,
- GNOMELOCALEDIR,
- argc,
- argv,
- "OAFIID:Nautilus_News_View_Factory",
- "OAFIID:Nautilus_News_View",
- make_news_view,
- nautilus_global_preferences_init,
- NULL);
-}
diff --git a/components/news/news_bullet.png b/components/news/news_bullet.png
deleted file mode 100644
index c9e9fa03b..000000000
--- a/components/news/news_bullet.png
+++ /dev/null
Binary files differ
diff --git a/components/news/news_channels.xml b/components/news/news_channels.xml
deleted file mode 100644
index 8c4a3dd94..000000000
--- a/components/news/news_channels.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0"?>
-<rss_news_channels>
- <rss_channel name="Advogato" uri="http://advogato.org/rss/articles.xml" show="false" open="false"/>
- <rss_channel name="AppWatch" uri="http://www.appwatch.com/appwatch.rdf" show="false" open="false"/>
- <rss_channel name="Barrapunto" uri="http://barrapunto.com/barrapunto.rdf" show="false" open="false"/>
- <rss_channel name="Barrapunto Gnome" uri="http://barrapunto.com/gnome.rdf" show="false" open="false"/>
- <rss_channel name="BSD Today" uri="http://www.bsdtoday.com/backend/bt.rdf" show="false" open="false"/>
- <rss_channel name="Beyond 2000" uri="http://beyond2000.com/b2k.rdf" show="false" open="false"/>
- <rss_channel name="CNet" uri="http://www.newsisfree.com/export.php3?_f=rss91&amp;_w=f&amp;_i=1443" show="false" open="false"/>
- <rss_channel name="CNN" uri="http://www.cnn.com/cnn.rss" show="false" open="false"/>
- <rss_channel name="Dictionary.com" uri="http://www.dictionary.com/wordoftheday/wotd.rss" show="false" open="false"/>
- <rss_channel name="DVD Review" uri="http://www.dvdreview.com/rss/newschannel.rss" show="false" open="false"/>
- <rss_channel name="Freshmeat" uri="http://freshmeat.net/backend/fm.rdf" show="false" open="false"/>
- <rss_channel name="GNOME News" uri="http://news.gnome.org/gnome-news/rdf" show="false" open="false"/>
- <rss_channel name="Internet.com" uri="http://headlines.internet.com/internetnews/prod-news/news.rss" show="false" open="false"/>
- <rss_channel name="KDE News" uri="http://www.kde.org/dotkdeorg.rdf" show="false" open="false"/>
- <rss_channel name="Kuro5hin" uri="http://www.kuro5hin.org/backend.rdf" show="false" open="false"/>
- <rss_channel name="Linux Games" uri="http://linuxgames.com/bin/mynetscape.pl" show="false" open="false"/>
- <rss_channel name="Linux Jobs" uri="http://linux.com/mrn/jobs/latest_jobs.rss" show="false" open="false"/>
- <rss_channel name="Linux Planet" uri="http://www.linuxplanet.com/rss" show="false" open="false"/>
- <rss_channel name="Linux Today" uri="http://linuxtoday.com/backend/my-netscape.rdf" show="false" open="false"/>
- <rss_channel name="Linux Weekly News" uri="http://lwn.net/headlines/rss" show="false" open="false"/>
- <rss_channel name="Linux.com" uri="http://www.linux.com/mrn/front_page.rss" show="false" open="false"/>
- <rss_channel name="Morons" uri="http://morons.org/morons.rss" show="false" open="false"/>
- <rss_channel name="Mozilla" uri="http://www.mozilla.org/news.rdf" show="false" open="false"/>
- <rss_channel name="Mozilla Zine" uri="http://www.mozillazine.org/contents.rdf" show="false" open="false"/>
- <rss_channel name="The Motley Fool" uri="http://www.fool.com/about/headlines/rss_headlines.asp" show="false" open="false"/>
- <rss_channel name="Newsforge" uri="http://www.newsforge.com/newsforge.rss" show="false" open="false"/>
- <rss_channel name="Nanotech News" uri="http://www.nanotechnews.com/nano/rdf" show="false" open="false"/>
- <rss_channel name="Perl.com" uri="http://www.perl.com/pace/news.rss" show="false" open="false"/>
- <rss_channel name="Pigdog" uri="http://www.pigdog.org/pigdog.rdf" show="false" open="false"/>
- <rss_channel name="Python.org" uri="http://www.python.org/channews.rdf" show="false" open="false"/>
- <rss_channel name="Quotes of the Day" uri="http://www.quotationspage.com/data/mqotd.rss" show="false" open="false"/>
- <rss_channel name="Salon" uri="http://www.salon.com/feed/RDF/salon_use.rdf" show="false" open="false"/>
- <rss_channel name="Scripting News" uri="http://scriptingnews.userland.com/xml/scriptingnews2.xml" show="false" open="false"/>
- <rss_channel name="Security Focus" uri="http://www.securityfocus.com/topnews-rss.html" show="false" open="false"/>
- <rss_channel name="Segfault" uri="http://www.segfault.org/stories.xml" show="false" open="false"/>
- <rss_channel name="Slashdot" uri="http://www.slashdot.org/slashdot.rdf" show="false" open="false"/>
- <rss_channel name="The Register" uri="http://www.theregister.co.uk/tonys/slashdot.rdf" show="false" open="false"/>
- <rss_channel name="Think Geek" uri="http://www.thinkgeek.com/thinkgeek.rdf" show="false" open="false"/>
- <rss_channel name="Tomalak's Realm" uri="http://www.tomalak.org/recentTodaysLinks.xml" show="false" open="false"/>
- <rss_channel name="Web Reference" uri="http://www.webreference.com/webreference.rdf" show="false" open="false"/>
- <rss_channel name="Wired" uri="http://www.wired.com/news_drop/netcenter/netcenter.rdf" show="false" open="false"/>
- <rss_channel name="XML.com" uri="http://xml.com/xml/xmlnews.rdf" show="false" open="false"/>
- <rss_channel name="Zope" uri="http://www.zope.org/SiteIndex/news.rss" show="false" open="false"/>
-</rss_news_channels>
diff --git a/components/notes/Makefile.am b/components/notes/Makefile.am
deleted file mode 100644
index 35ffee771..000000000
--- a/components/notes/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-NULL =
-
-INCLUDES=\
- -DG_LOG_DOMAIN=\"Nautilus-Notes\" \
- -I$(top_srcdir) \
- -DGNOMELOCALEDIR=\""$(prefix)/${DATADIRNAME}/locale"\" \
- $(COMPONENT_CFLAGS) \
- $(NULL) \
- -DGTK_ENABLE_BROKEN
-
-bonobodir = $(libdir)/bonobo
-bonobo_LTLIBRARIES = libnautilus-notes-view.la
-
-libnautilus_notes_view_la_SOURCES = nautilus-notes.c
-
-libnautilus_notes_view_la_LIBADD = \
- $(top_builddir)/libnautilus/libnautilus.la \
- $(top_builddir)/libnautilus-private/libnautilus-private.la \
- $(COMPONENT_LIBS) \
- $(NULL)
-
-libnautilus_notes_view_la_LDFLAGS = -module -avoid-version -no-undefined
-
-server_in_files = Nautilus_View_notes.server.in.in
-
-serverdir = $(libdir)/bonobo/servers
-server_DATA = $(server_in_files:.server.in.in=.server)
-$(server_in_files:.server.in.in=.server.in): $(server_in_files)
- sed -e "s|\@BONOBODIR\@|$(bonobodir)|" $< > $@
-@INTLTOOL_SERVER_RULE@
-
-EXTRA_DIST= $(server_in_files)
-CLEANFILES = $(server_DATA) $(server_DATA).in
diff --git a/components/notes/Nautilus_View_notes.server.in.in b/components/notes/Nautilus_View_notes.server.in.in
deleted file mode 100644
index f87fff972..000000000
--- a/components/notes/Nautilus_View_notes.server.in.in
+++ /dev/null
@@ -1,23 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:Nautilus_Notes_View"
- type="shlib" location="@BONOBODIR@/libnautilus-notes-view">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Unknown:1.0"/>
- <item value="IDL:Bonobo/Control:1.0"/>
- <item value="IDL:Nautilus/View:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="description" type="string" _value="Notes side pane for Nautilus"/>
- <oaf_attribute name="name" type="string" _value="Notes side pane"/>
- <oaf_attribute name="nautilus:sidebar_panel_name" type="string" _value="Notes"/>
- <oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
- <item value="*"/>
- </oaf_attribute>
- <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
- <item value="*/*"/>
- </oaf_attribute>
- <oaf_attribute name="nautilus:property_page_name" type="string" _value="Notes"/>
- <oaf_attribute name="nautilus:can_handle_multiple_files" type="boolean" value="false"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/components/notes/nautilus-notes.c b/components/notes/nautilus-notes.c
deleted file mode 100644
index 16c558318..000000000
--- a/components/notes/nautilus-notes.c
+++ /dev/null
@@ -1,489 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000, 2001 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: Andy Hertzfeld <andy@eazel.com>
- *
- */
-
-/* notes sidebar panel -- allows editing per-directory notes */
-
-#define VIEW_IID "OAFIID:Nautilus_Notes_View"
-
-#include <config.h>
-
-#include <eel/eel-debug.h>
-#include <eel/eel-gtk-extensions.h>
-#include <eel/eel-string.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtktextbuffer.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <bonobo/bonobo-property-bag.h>
-#include <libnautilus-private/nautilus-file-attributes.h>
-#include <libnautilus-private/nautilus-file.h>
-#include <libnautilus-private/nautilus-global-preferences.h>
-#include <libnautilus-private/nautilus-metadata.h>
-#include <libnautilus/nautilus-clipboard.h>
-#include <libnautilus/nautilus-view.h>
-#include <libnautilus/nautilus-view-standard-main.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
-
-/* FIXME bugzilla.gnome.org 44436:
- * Undo not working in notes-view.
- */
-#if 0
-#include <libnautilus-private/nautilus-undo-signal-handlers.h>
-#endif
-
-#define SAVE_TIMEOUT (3 * 1000)
-
-/* property bag getting and setting routines */
-enum {
- TAB_IMAGE,
- NOTES_URI
-};
-
-typedef struct {
- NautilusView *view;
- BonoboPropertyBag *property_bag;
- GtkWidget *note_text_field;
- GtkTextBuffer *text_buffer;
- char *uri;
- NautilusFile *file;
- guint save_timeout_id;
- char *previous_saved_text;
-} Notes;
-
-static void notes_save_metainfo (Notes *notes);
-static char *notes_get_indicator_image (const char *notes_text);
-static void notify_listeners_if_changed (Notes *notes,
- char *new_notes);
-static void notes_load_location (NautilusView *view,
- const char *location,
- Notes *notes);
-
-static void
-get_bonobo_properties (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer callback_data)
-{
- char *indicator_image;
- Notes *notes;
-
- notes = (Notes *) callback_data;
-
- switch (arg_id) {
- case TAB_IMAGE: {
- /* if there is a note, return the name of the indicator image,
- otherwise, return NULL */
- indicator_image = notes_get_indicator_image (notes->previous_saved_text);
- BONOBO_ARG_SET_STRING (arg, indicator_image);
- g_free (indicator_image);
- break;
- }
-
- default:
- g_warning ("Unhandled arg %d", arg_id);
- break;
- }
-}
-
-static void
-set_bonobo_properties (BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer callback_data)
-{
- if (arg_id == NOTES_URI) {
- CORBA_sequence_CORBA_string *uris;
-
- uris = arg->_value;
- notes_load_location (NULL,
- uris->_buffer[0],
- (Notes *)callback_data);
- }
-}
-
-static gboolean
-schedule_save_callback (gpointer data)
-{
- Notes *notes;
-
- notes = data;
-
- /* Zero out save_timeout_id so no one will try to cancel our
- * in-progress timeout callback.
- */
- notes->save_timeout_id = 0;
-
- notes_save_metainfo (notes);
-
- return FALSE;
-}
-
-static void
-cancel_pending_save (Notes *notes)
-{
- if (notes->save_timeout_id != 0) {
- gtk_timeout_remove (notes->save_timeout_id);
- notes->save_timeout_id = 0;
- }
-}
-
-static void
-schedule_save (Notes *notes)
-{
- cancel_pending_save (notes);
-
- notes->save_timeout_id = gtk_timeout_add (SAVE_TIMEOUT, schedule_save_callback, notes);
-}
-
-static void
-load_note_text_from_metadata (NautilusFile *file,
- Notes *notes)
-{
- char *saved_text;
-
- g_assert (NAUTILUS_IS_FILE (file));
- g_assert (notes->file == file);
-
- saved_text = nautilus_file_get_metadata (file, NAUTILUS_METADATA_KEY_ANNOTATION, "");
-
- /* This fn is called for any change signal on the file, so make sure that the
- * metadata has actually changed.
- */
- if (eel_strcmp (saved_text, notes->previous_saved_text) != 0) {
- notify_listeners_if_changed (notes, saved_text);
-
- g_free (notes->previous_saved_text);
- notes->previous_saved_text = saved_text;
- cancel_pending_save (notes);
-
- gtk_text_buffer_set_text (notes->text_buffer, saved_text, -1);
- } else {
- g_free (saved_text);
- }
-
-/* FIXME bugzilla.gnome.org 44436:
- * Undo not working in notes-view.
- */
-#if 0
- nautilus_undo_set_up_editable_for_undo (GTK_EDITABLE (notes->note_text_field));
-#endif
-}
-
-static void
-done_with_file (Notes *notes)
-{
- cancel_pending_save (notes);
-
- if (notes->file != NULL) {
- nautilus_file_monitor_remove (notes->file, notes);
- g_signal_handlers_disconnect_matched (notes->file,
- G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
- G_CALLBACK (load_note_text_from_metadata),
- notes);
- nautilus_file_unref (notes->file);
- }
-}
-
-static void
-notes_load_metainfo (Notes *notes)
-{
- NautilusFileAttributes attributes;
-
- done_with_file (notes);
- notes->file = nautilus_file_get (notes->uri);
-
- gtk_text_buffer_set_text (notes->text_buffer, "", -1);
-
- if (notes->file == NULL) {
- return;
- }
-
- attributes = NAUTILUS_FILE_ATTRIBUTE_METADATA;
- nautilus_file_monitor_add (notes->file, notes, attributes);
-
- if (nautilus_file_check_if_ready (notes->file, attributes)) {
- load_note_text_from_metadata (notes->file, notes);
- }
-
- g_signal_connect (notes->file, "changed",
- G_CALLBACK (load_note_text_from_metadata), notes);
-}
-
-/* utility to notify event listeners if the notes data actually changed */
-static void
-notify_listeners_if_changed (Notes *notes, char *new_notes)
-{
- char *tab_image;
- BonoboArg *tab_image_arg;
-
- if (eel_strcmp (notes->previous_saved_text, new_notes) != 0) {
- /* notify listeners that the notes text has changed */
- tab_image = notes_get_indicator_image (new_notes);
-
- tab_image_arg = bonobo_arg_new (BONOBO_ARG_STRING);
- BONOBO_ARG_SET_STRING (tab_image_arg, tab_image);
-
- bonobo_event_source_notify_listeners_full (notes->property_bag->es,
- "Bonobo/Property",
- "change",
- "tab_image",
- tab_image_arg,
- NULL);
- bonobo_arg_release (tab_image_arg);
- g_free (tab_image);
- }
-}
-
-/* save the metainfo corresponding to the current uri, if any, into the text field */
-static void
-notes_save_metainfo (Notes *notes)
-{
- char *notes_text;
- GtkTextIter start_iter;
- GtkTextIter end_iter;
-
- if (notes->file == NULL) {
- return;
- }
-
- cancel_pending_save (notes);
-
- /* Block the handler, so we don't respond to our own change.
- */
- g_signal_handlers_block_matched (notes->file,
- G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
- G_CALLBACK (load_note_text_from_metadata),
- notes);
-
- gtk_text_buffer_get_start_iter (notes->text_buffer, &start_iter);
- gtk_text_buffer_get_end_iter (notes->text_buffer, &end_iter);
- notes_text = gtk_text_buffer_get_text (notes->text_buffer,
- &start_iter,
- &end_iter,
- FALSE);
-
- nautilus_file_set_metadata (notes->file,
- NAUTILUS_METADATA_KEY_ANNOTATION,
- NULL, notes_text);
-
- g_signal_handlers_unblock_matched (notes->file,
- G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
- G_CALLBACK (load_note_text_from_metadata),
- notes);
-
- notify_listeners_if_changed (notes, notes_text);
-
- g_free (notes->previous_saved_text);
- notes->previous_saved_text = notes_text;
-}
-
-static void
-notes_load_location (NautilusView *view,
- const char *location,
- Notes *notes)
-{
- if (strcmp (notes->uri, location) != 0) {
-/* FIXME bugzilla.gnome.org 44436:
- * Undo not working in notes-view.
- */
-#if 0
- nautilus_undo_tear_down_editable_for_undo (GTK_EDITABLE (notes->note_text_field));
-#endif
- notes_save_metainfo (notes);
- g_free (notes->uri);
- notes->uri = g_strdup (location);
- notes_load_metainfo (notes);
- }
-}
-
-static gboolean
-on_text_field_focus_out_event (GtkWidget *widget,
- GdkEventFocus *event,
- gpointer callback_data)
-{
- Notes *notes;
-
- notes = callback_data;
- notes_save_metainfo (notes);
- return FALSE;
-}
-
-static void
-on_changed (GtkEditable *editable, Notes *notes)
-{
- schedule_save (notes);
-}
-
-static void
-do_destroy (GtkObject *obj, Notes *notes)
-{
- done_with_file (notes);
- g_free (notes->uri);
- g_free (notes->previous_saved_text);
- g_free (notes);
-}
-
-static char *
-notes_get_indicator_image (const char *notes_text)
-{
- if (notes_text != NULL && notes_text[0] != '\0') {
- return g_strdup ("note-indicator.png");
- }
- return NULL;
-}
-
-static BonoboObject *
-make_notes_view ()
-{
- GtkWidget *vbox, *scroll;
- Notes *notes;
- notes = g_new0 (Notes, 1);
- notes->uri = g_strdup ("");
-
- /* allocate a vbox to hold all of the UI elements */
- vbox = gtk_vbox_new (FALSE, 0);
-
- /* create the text container */
- notes->text_buffer = gtk_text_buffer_new (NULL);
- notes->note_text_field = gtk_text_view_new_with_buffer (notes->text_buffer);
-
-#ifdef GNOME2_CONVERSION_COMPLETE
- font = nautilus_font_factory_get_font_from_preferences (14);
- eel_gtk_widget_set_font (notes->note_text_field, font);
- gdk_font_unref (font);
-#endif
- gtk_text_view_set_editable (GTK_TEXT_VIEW (notes->note_text_field), TRUE);
- gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (notes->note_text_field),
- GTK_WRAP_WORD);
- scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
- GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (scroll), notes->note_text_field);
- gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
-
- g_signal_connect (notes->note_text_field, "focus_out_event",
- G_CALLBACK (on_text_field_focus_out_event), notes);
- g_signal_connect (notes->text_buffer, "changed",
- G_CALLBACK (on_changed), notes);
-
- gtk_widget_show_all (vbox);
-
- /* Create CORBA object. */
- notes->view = nautilus_view_new (vbox);
- g_signal_connect (notes->view, "destroy", G_CALLBACK (do_destroy), notes);
-
- /* allocate a property bag to reflect the TAB_IMAGE property */
- notes->property_bag = bonobo_property_bag_new (get_bonobo_properties, set_bonobo_properties, notes);
- bonobo_control_set_properties (nautilus_view_get_bonobo_control (notes->view), BONOBO_OBJREF (notes->property_bag), NULL);
- bonobo_property_bag_add (notes->property_bag, "tab_image", TAB_IMAGE, BONOBO_ARG_STRING, NULL,
- "image indicating that a note is present", 0);
- bonobo_property_bag_add (notes->property_bag, "uris",
- NOTES_URI, TC_CORBA_sequence_CORBA_string,
- NULL, "URI of selected file", 0);
- /* handle events */
- g_signal_connect (notes->view, "load_location",
- G_CALLBACK (notes_load_location), notes);
-
- /* handle selections */
-#ifdef GNOME2_CONVERSION_COMPLETE
- nautilus_clipboard_set_up_editable_in_control
- (GTK_EDITABLE (notes->note_text_field),
- nautilus_view_get_bonobo_control (notes->view),
- FALSE);
-#endif
-
-/* FIXME bugzilla.gnome.org 44436:
- * Undo not working in notes-view.
- */
-#if 0
- nautilus_undo_set_up_editable_for_undo (GTK_EDITABLE (notes->note_text_field));
- nautilus_undo_editable_set_undo_key (GTK_EDITABLE (notes->note_text_field), TRUE);
-#endif
-
- return BONOBO_OBJECT (notes->view);
-}
-
-static gboolean shortcut_registered = FALSE;
-
-static CORBA_Object
-create_object (const char *iid,
- gpointer callback_data)
-{
- BonoboObject *view;
-
- if (strcmp (iid, VIEW_IID) != 0) {
- return CORBA_OBJECT_NIL;
- }
-
- view = make_notes_view ();
-
- return CORBA_Object_duplicate (BONOBO_OBJREF (view), NULL);
-}
-
-
-static CORBA_Object
-notes_shlib_make_object (PortableServer_POA poa,
- const char *iid,
- gpointer impl_ptr,
- CORBA_Environment *ev)
-{
- BonoboObject *view;
-
- if (!shortcut_registered) {
- nautilus_bonobo_register_activation_shortcut (VIEW_IID,
- create_object, NULL);
- shortcut_registered = TRUE;
- }
-
- if (strcmp (iid, VIEW_IID) != 0) {
- return CORBA_OBJECT_NIL;
- }
-
- view = make_notes_view ();
-
- bonobo_activation_plugin_use (poa, impl_ptr);
-
- return CORBA_Object_duplicate (BONOBO_OBJREF (view), ev);
-}
-
-static const BonoboActivationPluginObject notes_plugin_list[] = {
- { VIEW_IID, notes_shlib_make_object },
- { NULL }
-};
-
-const BonoboActivationPlugin Bonobo_Plugin_info = {
- notes_plugin_list,
- "Nautilus Notes Sidebar Panel"
-};
diff --git a/components/sample/Makefile.am b/components/sample/Makefile.am
deleted file mode 100644
index 051f41b82..000000000
--- a/components/sample/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-# WHAT YOU NEED TO CHANGE: Change all the filenames to refer to your
-# component. Also add whatever libraries, include paths, etc you want,
-# and change the G_LOG_DOMAIN.
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"Nautilus-Sample\" \
- -DDATADIR=\"$(datadir)\" \
- -I$(top_srcdir) \
- -I$(top_builddir) \
- $(DISABLE_DEPRECATED_CFLAGS) \
- $(COMPONENT_CFLAGS)
-
-libexec_PROGRAMS=nautilus-sample-content-view
-
-nautilus_sample_content_view_SOURCES = \
- nautilus-sample-content-view.h \
- nautilus-sample-content-view.c \
- main.c
-
-nautilus_sample_content_view_LDADD = \
- $(top_builddir)/libnautilus/libnautilus.la \
- $(COMPONENT_LIBS)
-
-uidir = $(datadir)/gnome-2.0/ui
-ui_DATA = nautilus-sample-content-view-ui.xml
-
-server_in_files = Nautilus_View_sample.server.in.in
-
-serverdir = $(libdir)/bonobo/servers
-server_DATA = $(server_in_files:.server.in.in=.server)
-$(server_in_files:.server.in.in=.server.in): $(server_in_files)
- sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
-@INTLTOOL_SERVER_RULE@
-
-EXTRA_DIST = $(server_in_files) $(ui_DATA)
-CLEANFILES = $(server_DATA) $(server_DATA).in
diff --git a/components/sample/Nautilus_View_sample.server.in.in b/components/sample/Nautilus_View_sample.server.in.in
deleted file mode 100644
index 3749cac20..000000000
--- a/components/sample/Nautilus_View_sample.server.in.in
+++ /dev/null
@@ -1,46 +0,0 @@
-<oaf_info>
-
-<!-- WHAT YOU NEED TO CHANGE:
-
- a) Replace all the OAFIID strings to do this you need to register
- your namespace, and then generate some unique names inside
- it. See bonobo/doc/FAQ 'How should I create unique OAFIIDs for
- components ?'.
-
- b) Alter the repo_ids to the interfaces you support.
-
- c) Point the 'location' at the executable that your project installs
-
- d) And finally, make sure to remove the test_only attribute.
- -->
-
-<oaf_server iid="OAFIID:Nautilus_Sample_Content_View_Factory"
- type="exe" location="@LIBEXECDIR@/nautilus-sample-content-view">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Nautilus Sample view factory"/>
- <oaf_attribute name="description" type="string" _value="Sample content view component's factory"/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:Nautilus_Sample_Content_View" type="factory" location="OAFIID:Nautilus_Sample_Content_View_Factory">
- <oaf_attribute name="test_only" type="boolean" value="true"/>
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Unknown:1.0"/>
- <item value="IDL:Bonobo/Control:1.0"/>
- <item value="IDL:Nautilus/View:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Nautilus Sample view"/>
- <oaf_attribute name="description" type="string" _value="Sample content view component"/>
- <oaf_attribute name="bonobo:additional_uri_schemes" type="stringv">
- <item value="*"/>
- </oaf_attribute>
- <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
- <item value="*"/>
- </oaf_attribute>
- <oaf_attribute name="nautilus:view_as_name" type="string" _value="Sample"/>
- <oaf_attribute name="nautilus:view_as_label" type="string" _value="View as Sample"/>
- <oaf_attribute name="nautilus:viewer_label" type="string" _value="Sample Viewer"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/components/sample/README b/components/sample/README
deleted file mode 100644
index 573e17423..000000000
--- a/components/sample/README
+++ /dev/null
@@ -1,6 +0,0 @@
-
-This is a sample Nautilus component. Each file has a WHAT YOU NEED TO
-CHANGE comment near the top, telling you what you need to change when
-you copy this component as a starting point for your own. Some also
-have CHANGE comments sprinkled throughout pointing out other things you
-may want or need to change.
diff --git a/components/sample/main.c b/components/sample/main.c
deleted file mode 100644
index 5c3f83989..000000000
--- a/components/sample/main.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* main.c - Main function and object activation function for sample
- * view component.
- */
-
-/* WHAT YOU NEED TO CHANGE: You need to change include
- * component-specific header below the include of config.h. Then look
- * for the CHANGE comments below and change the #defines.
- */
-
-#include <config.h>
-
-#include "nautilus-sample-content-view.h"
-#include <libnautilus/nautilus-view-standard-main.h>
-
-/* CHANGE: Replace these OAFIIDs with the new ones you put in the
- * .server file.
- */
-#define FACTORY_IID "OAFIID:Nautilus_Sample_Content_View_Factory"
-#define VIEW_IID "OAFIID:Nautilus_Sample_Content_View"
-
-/* CHANGE: Change to your executable name */
-#define EXECUTABLE_NAME "nautilus-sample-content-view"
-
-/* CHANGE: Change to the get_type function for your view class */
-#define GET_TYPE_FUNCTION nautilus_sample_content_view_get_type
-
-int
-main (int argc, char *argv[])
-{
- return nautilus_view_standard_main (EXECUTABLE_NAME,
- VERSION,
- NULL, /* Could be PACKAGE */
- NULL, /* Could be GNOMELOCALEDIR */
- argc,
- argv,
- FACTORY_IID,
- VIEW_IID,
- nautilus_view_create_from_get_type_function,
- NULL,
- GET_TYPE_FUNCTION);
-}
diff --git a/components/sample/nautilus-sample-content-view-ui.xml b/components/sample/nautilus-sample-content-view-ui.xml
deleted file mode 100644
index ccfeae0e4..000000000
--- a/components/sample/nautilus-sample-content-view-ui.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<Root>
-<menu>
- <submenu name="File" _label="_File">
- <placeholder name="File Items Placeholder">
- <menuitem name="Sample Menu Item"
- _label="_Sample"
- _tip="This is a sample merged menu item"
- pixtype="stock" pixname="gtk-new"
- verb="Sample Menu Item"/>
- </placeholder>
- </submenu>
-</menu>
-<dockitem name="Toolbar">
- <placeholder name="Extra Buttons Placeholder">
- <toolitem name="Sample Dock Item"
- _label="Sample"
- _tip="This is a sample merged toolbar button"
- pixtype="stock" pixname="gtk-new"
- verb="Sample Dock Item"/>
- </placeholder>
-</dockitem>
-</Root> \ No newline at end of file
diff --git a/components/sample/nautilus-sample-content-view.c b/components/sample/nautilus-sample-content-view.c
deleted file mode 100644
index 7eae6e682..000000000
--- a/components/sample/nautilus-sample-content-view.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-sample-content-view.c - sample content view
- component. This component displays a simple label of the URI
- and demonstrates merging menu items & toolbar buttons.
- It should be a good basis for writing out-of-proc content views.
- */
-
-/* WHAT YOU NEED TO CHANGE: You need to rename everything. Then look
- * for the individual CHANGE comments to see some things you could
- * change to make your view do what you want.
- */
-
-#include <config.h>
-#include "nautilus-sample-content-view.h"
-
-#include <bonobo/bonobo-i18n.h>
-#include <gtk/gtklabel.h>
-#include <libgnome/gnome-macros.h>
-#include <string.h>
-
-/* CHANGE: You probably want some different widget than a label to be
- * your main view contents.
- */
-struct NautilusSampleContentViewDetails {
- char *location;
- GtkWidget *label;
-};
-
-BONOBO_CLASS_BOILERPLATE (NautilusSampleContentView, nautilus_sample_content_view,
- NautilusView, NAUTILUS_TYPE_VIEW)
-
-static void
-nautilus_sample_content_view_finalize (GObject *object)
-{
- NautilusSampleContentView *view;
-
- view = NAUTILUS_SAMPLE_CONTENT_VIEW (object);
-
- g_free (view->details->location);
- g_free (view->details);
-
- G_OBJECT_CLASS (object)->finalize (object);
-}
-
-static void
-load_location (NautilusSampleContentView *view,
- const char *location)
-{
- char *label_text;
-
- g_assert (NAUTILUS_IS_SAMPLE_CONTENT_VIEW (view));
- g_assert (location != NULL);
-
- g_free (view->details->location);
- view->details->location = g_strdup (location);
-
- label_text = g_strdup_printf (_("%s\n\nThis is a sample Nautilus content view component."), location);
- gtk_label_set_text (GTK_LABEL (view->details->label), label_text);
- g_free (label_text);
-}
-
-/* CHANGE: Do your own loading here. If loading can be a long-running
- * operation, you should consider doing it async, in which case you
- * should only call load_complete when the load is actually done.
- */
-
-static void
-sample_load_location_callback (NautilusView *nautilus_view,
- const char *location,
- gpointer user_data)
-{
- NautilusSampleContentView *view;
-
- g_assert (NAUTILUS_IS_VIEW (nautilus_view));
- g_assert (location != NULL);
-
- view = NAUTILUS_SAMPLE_CONTENT_VIEW (nautilus_view);
-
- /* It's mandatory to send an underway message once the
- * component starts loading, otherwise nautilus will assume it
- * failed. In a real component, this will probably happen in
- * some sort of callback from whatever loading mechanism it is
- * using to load the data; this component loads no data, so it
- * gives the progress update here.
- */
- nautilus_view_report_load_underway (nautilus_view);
-
- /* Do the actual load. */
- load_location (view, location);
-
- /* It's mandatory to call report_load_complete once the
- * component is done loading successfully, or
- * report_load_failed if it completes unsuccessfully. In a
- * real component, this will probably happen in some sort of
- * callback from whatever loading mechanism it is using to
- * load the data; this component loads no data, so it gives
- * the progress update here.
- */
- nautilus_view_report_load_complete (nautilus_view);
-}
-
-static void
-bonobo_sample_callback (BonoboUIComponent *ui,
- gpointer user_data,
- const char *verb)
-{
- NautilusSampleContentView *view;
- char *label_text;
-
- g_assert (BONOBO_IS_UI_COMPONENT (ui));
- g_assert (verb != NULL);
-
- view = NAUTILUS_SAMPLE_CONTENT_VIEW (user_data);
-
- if (strcmp (verb, "Sample Menu Item") == 0) {
- label_text = g_strdup_printf (_("%s\n\nYou selected the Sample menu item."),
- view->details->location);
- } else {
- g_assert (strcmp (verb, "Sample Dock Item") == 0);
- label_text = g_strdup_printf (_("%s\n\nYou clicked the Sample toolbar button."),
- view->details->location);
- }
-
- gtk_label_set_text (GTK_LABEL (view->details->label), label_text);
- g_free (label_text);
-}
-
-/* CHANGE: Do your own menu/toolbar merging here. */
-static void
-sample_merge_bonobo_items_callback (BonoboControl *control,
- gboolean state,
- gpointer user_data)
-{
- NautilusSampleContentView *view;
- BonoboUIComponent *ui_component;
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("Sample Menu Item", bonobo_sample_callback),
- BONOBO_UI_VERB ("Sample Dock Item", bonobo_sample_callback),
- BONOBO_UI_VERB_END
- };
-
- g_assert (BONOBO_IS_CONTROL (control));
-
- view = NAUTILUS_SAMPLE_CONTENT_VIEW (user_data);
-
- if (state) {
- ui_component = nautilus_view_set_up_ui (NAUTILUS_VIEW (view),
- DATADIR,
- "nautilus-sample-content-view-ui.xml",
- "nautilus-sample-content-view");
-
- bonobo_ui_component_add_verb_list_with_data (ui_component, verbs, view);
- }
-
- /* Note that we do nothing if state is FALSE. Nautilus content
- * views are activated when installed, but never explicitly
- * deactivated. When the view changes to another, the content
- * view object is destroyed, which ends up calling
- * bonobo_ui_handler_unset_container, which removes its merged
- * menu & toolbar items.
- */
-}
-
-static void
-nautilus_sample_content_view_class_init (NautilusSampleContentViewClass *class)
-{
- G_OBJECT_CLASS (class)->finalize = nautilus_sample_content_view_finalize;
-}
-
-static void
-nautilus_sample_content_view_instance_init (NautilusSampleContentView *view)
-{
- view->details = g_new0 (NautilusSampleContentViewDetails, 1);
-
- view->details->label = gtk_label_new (_("(none)"));
- gtk_widget_show (view->details->label);
-
- nautilus_view_construct (NAUTILUS_VIEW (view), view->details->label);
-
- g_signal_connect (view, "load_location",
- G_CALLBACK (sample_load_location_callback), NULL);
-
- /* Get notified when our bonobo control is activated so we can
- * merge menu & toolbar items into the shell's UI.
- */
- g_signal_connect_object (nautilus_view_get_bonobo_control (NAUTILUS_VIEW (view)), "activate",
- G_CALLBACK (sample_merge_bonobo_items_callback), view, 0);
-}
diff --git a/components/sample/nautilus-sample-content-view.h b/components/sample/nautilus-sample-content-view.h
deleted file mode 100644
index e57d1796c..000000000
--- a/components/sample/nautilus-sample-content-view.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-sample-content-view.h - Sample view component. This
- * component just displays a simple message and includes a menu item
- * and a toolbar button else. It should be a good basis for writing
- * Nautilus view components.
- */
-
-/* WHAT YOU NEED TO CHANGE: You should be able to leave this header
- * pretty much unchanged except for renaming everything to match your
- * component.
- */
-
-#ifndef NAUTILUS_SAMPLE_CONTENT_VIEW_H
-#define NAUTILUS_SAMPLE_CONTENT_VIEW_H
-
-#include <libnautilus/nautilus-view.h>
-
-#define NAUTILUS_TYPE_SAMPLE_CONTENT_VIEW (nautilus_sample_content_view_get_type ())
-#define NAUTILUS_SAMPLE_CONTENT_VIEW(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_SAMPLE_CONTENT_VIEW, NautilusSampleContentView))
-#define NAUTILUS_SAMPLE_CONTENT_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_SAMPLE_CONTENT_VIEW, NautilusSampleContentViewClass))
-#define NAUTILUS_IS_SAMPLE_CONTENT_VIEW(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_SAMPLE_CONTENT_VIEW))
-#define NAUTILUS_IS_SAMPLE_CONTENT_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_SAMPLE_CONTENT_VIEW))
-
-typedef struct NautilusSampleContentViewDetails NautilusSampleContentViewDetails;
-
-typedef struct {
- NautilusView parent;
- NautilusSampleContentViewDetails *details;
-} NautilusSampleContentView;
-
-typedef struct {
- NautilusViewClass parent;
-} NautilusSampleContentViewClass;
-
-GType nautilus_sample_content_view_get_type (void);
-
-#endif /* NAUTILUS_SAMPLE_CONTENT_VIEW_H */
diff --git a/components/text/Makefile.am b/components/text/Makefile.am
deleted file mode 100644
index 3e0262933..000000000
--- a/components/text/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-NULL =
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"Nautilus-Text\" \
- -DDATADIR=\""$(datadir)"\" \
- -I$(top_srcdir) \
- -DGNOMELOCALEDIR=\""$(prefix)/${DATADIRNAME}/locale"\" \
- $(DISABLE_DEPRECATED_CFLAGS) \
- $(COMPONENT_CFLAGS) \
- -DGTK_ENABLE_BROKEN \
- $(NULL)
-
-libexec_PROGRAMS=nautilus-text-view
-
-nautilus_text_view_SOURCES = \
- nautilus-text-view.c
-
-nautilus_text_view_LDADD = \
- ../../libnautilus/libnautilus.la \
- $(COMPONENT_LIBS) \
- $(NULL)
-
-uidir = $(datadir)/gnome-2.0/ui
-ui_DATA = nautilus-text-view-ui.xml
-
-server_in_files = Nautilus_View_text.server.in.in
-
-serverdir = $(libdir)/bonobo/servers
-server_DATA = $(server_in_files:.server.in.in=.server)
-$(server_in_files:.server.in.in=.server.in): $(server_in_files)
- sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
-@INTLTOOL_SERVER_RULE@
-
-EXTRA_DIST = $(server_in_files) $(nautilus_text_view_SOURCES) $(ui_DATA)
-CLEANFILES = $(server_DATA) $(server_DATA).in
diff --git a/components/text/Nautilus_View_text.server.in.in b/components/text/Nautilus_View_text.server.in.in
deleted file mode 100644
index b9fc3462e..000000000
--- a/components/text/Nautilus_View_text.server.in.in
+++ /dev/null
@@ -1,30 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:Nautilus_Text_View_Factory"
- type="exe" location="@LIBEXECDIR@/nautilus-text-view">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Text view factory"/>
- <oaf_attribute name="description" type="string" _value="Factory for text view"/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:Nautilus_Text_View" type="factory" location="OAFIID:Nautilus_Text_View_Factory">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Unknown:1.0"/>
- <item value="IDL:Bonobo/Control:1.0"/>
- <item value="IDL:Nautilus/View:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="Text view"/>
- <oaf_attribute name="description" type="string" _value="Text view"/>
- <oaf_attribute name="bonobo:editable" type="boolean" value="true"/>
- <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
- <item value="text/plain"/>
- <item value="text/*"/>
- </oaf_attribute>
- <oaf_attribute name="nautilus:view_as_name" type="string" _value="Text"/>
- <oaf_attribute name="nautilus:view_as_label" type="string" _value="View as Text"/>
- <oaf_attribute name="nautilus:viewer_label" type="string" _value="Text Viewer"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/components/text/main.c b/components/text/main.c
deleted file mode 100644
index ab374f47c..000000000
--- a/components/text/main.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* main.c - Main function and object activation function for text
- * view component.
- */
-
-#include <config.h>
-
-#include "nautilus-text-view.h"
-#include <libnautilus-private/nautilus-global-preferences.h>
-#include <libnautilus/nautilus-view-standard-main.h>
-#include <eel/eel-debug.h>
-
-#define FACTORY_IID "OAFIID:Nautilus_Text_View_Factory"
-#define VIEW_IID "OAFIID:Nautilus_Text_View"
-
-int
-main (int argc, char *argv[])
-{
- if (g_getenv ("NAUTILUS_DEBUG") != NULL) {
- eel_make_warnings_and_criticals_stop_in_debugger ();
- }
-
- return nautilus_view_standard_main ("nautilus-text-view",
- VERSION,
- GETTEXT_PACKAGE,
- GNOMELOCALEDIR,
- argc,
- argv,
- FACTORY_IID,
- VIEW_IID,
- nautilus_view_create_from_get_type_function,
- nautilus_global_preferences_init,
- nautilus_text_view_get_type);
-}
diff --git a/components/text/nautilus-text-view-ui.xml b/components/text/nautilus-text-view-ui.xml
deleted file mode 100644
index 901ae0fe8..000000000
--- a/components/text/nautilus-text-view-ui.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<Root>
-<commands>
- <cmd name="Copy Text"
- accel="*Control*c" sensitive="1"/>
-</commands>
-<menu>
- <submenu name="Edit">
- <menuitem name="Copy" _label="_Copy Text" _tip="Copy the selected text to the clipboard" pixtype="stock" pixname="gtk-copy" verb="Copy Text"/>
- </submenu>
-</menu>
-</Root>
diff --git a/components/text/nautilus-text-view.c b/components/text/nautilus-text-view.c
deleted file mode 100644
index bd9429990..000000000
--- a/components/text/nautilus-text-view.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- * Copyright (C) 2000 Eazel, Inc.
- * Copyright (C) 2002 Sun Microsystems 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: Dave Camp <dave@ximian.com>
- * based on component by Andy Hertzfeld <andy@eazel.com>
- *
- *
- */
-
-/* text view - display a text file */
-
-#include <config.h>
-
-#include <string.h>
-#include <eel/eel-debug.h>
-#include <eel/eel-vfs-extensions.h>
-#include <gconf/gconf-client.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <libnautilus/nautilus-view.h>
-#include <libnautilus/nautilus-view-standard-main.h>
-
-#define VIEW_IID "OAFIID:Nautilus_Text_View"
-#define FACTORY_IID "OAFIID:Nautilus_Text_View_Factory"
-
-#define NAUTILUS_TEXT_VIEW_PATH_COPY "/commands/Copy Text"
-
-typedef struct {
- NautilusView base;
-
- GtkTextView *view;
- GtkTextBuffer *buffer;
- BonoboUIComponent *ui;
-
- EelReadFileHandle *read_handle;
-} NautilusTextView;
-
-typedef struct {
- NautilusViewClass base;
-} NautilusTextViewClass;
-
-static const char *encodings_to_try[2];
-static int n_encodings_to_try;
-
-static GType nautilus_text_view_get_type (void);
-
-BONOBO_CLASS_BOILERPLATE (NautilusTextView, nautilus_text_view,
- NautilusView, NAUTILUS_TYPE_VIEW);
-
-static void
-unload_contents (NautilusTextView *view)
-{
- GtkTextIter start;
- GtkTextIter end;
-
- gtk_text_buffer_get_start_iter (view->buffer, &start);
- gtk_text_buffer_get_end_iter (view->buffer, &end);
-
- gtk_text_buffer_delete (view->buffer, &start, &end);
-}
-
-static void
-cancel_load (NautilusTextView *view)
-{
- if (view->read_handle) {
- eel_read_file_cancel (view->read_handle);
- view->read_handle = NULL;
- }
-}
-
-static GnomeVFSFileSize
-my_strnlen(char *str, GnomeVFSFileSize file_size)
-{
- GnomeVFSFileSize len;
-
- len = 0;
- while (*str != 0 && len < file_size) {
- str++;
- len++;
- }
- return len;
-}
-
-static void
-read_file_callback (GnomeVFSResult result,
- GnomeVFSFileSize file_size,
- char *file_contents,
- gpointer callback_data)
-{
- NautilusView *view;
- NautilusTextView *text_view;
- GnomeVFSFileSize length;
- gsize converted_length;
- char *utf8_contents;
- GError *conversion_error;
- GtkTextIter iter;
- int i;
-
- view = callback_data;
- text_view = callback_data;
-
- text_view->read_handle = NULL;
-
- if (result != GNOME_VFS_OK) {
- nautilus_view_report_load_failed (view);
- return;
- }
-
- /* If the file has zero size file_contents will be NULL, so we just
- report loading is complete and return. */
- if (file_size == 0) {
- nautilus_view_report_load_complete (view);
- return;
- }
-
- /* Find first embedded zero, if any */
- length = my_strnlen (file_contents, file_size);
-
- utf8_contents = NULL;
- if (!g_utf8_validate (file_contents, length, NULL)) {
- for (i = 0; i < n_encodings_to_try; i++) {
- conversion_error = NULL;
- utf8_contents = g_convert (file_contents, length,
- "UTF-8", encodings_to_try[i],
- NULL, &converted_length, &conversion_error);
- if (utf8_contents != NULL) {
- length = converted_length;
- break;
- }
- g_error_free (conversion_error);
- }
-
- if (utf8_contents == NULL) {
- nautilus_view_report_load_failed (view);
- return;
- }
- file_contents = utf8_contents;
- }
-
- gtk_text_buffer_get_start_iter (text_view->buffer, &iter);
-
- gtk_text_buffer_insert (text_view->buffer, &iter,
- file_contents, length);
-
- if (utf8_contents) {
- g_free (utf8_contents);
- }
-
- nautilus_view_report_load_complete (view);
-}
-
-static void
-load_location (NautilusView *view, const char *location_uri)
-{
- NautilusTextView *text_view;
-
- text_view = (NautilusTextView *)view;
-
- cancel_load (text_view);
- unload_contents (text_view);
-
- nautilus_view_report_load_underway (view);
-
- text_view->read_handle =
- eel_read_entire_file_async (location_uri, 0,
- read_file_callback, view);
-}
-
-static void
-copy_callback (BonoboUIComponent *component,
- gpointer callback_data,
- const char *verb)
-{
- NautilusTextView *text_view;
- GdkDisplay *display;
-
- text_view = (NautilusTextView*)callback_data;
-
- display = gtk_widget_get_display (GTK_WIDGET (text_view->view));
-
- gtk_text_buffer_copy_clipboard
- (text_view->buffer,
- gtk_clipboard_get_for_display (display, GDK_NONE));
-}
-
-static void
-bonobo_control_activate_callback (BonoboObject *control,
- gboolean state,
- gpointer callback_data)
-{
- NautilusTextView *text_view;
- BonoboUIVerb verbs[] = {
- BONOBO_UI_VERB ("Copy Text", copy_callback),
- BONOBO_UI_VERB_END
- };
-
- text_view = (NautilusTextView *)callback_data;
-
- if (state) {
- text_view->ui = nautilus_view_set_up_ui
- (NAUTILUS_VIEW (text_view),
- DATADIR,
- "nautilus-text-view-ui.xml",
- "nautilus-text-view");
- bonobo_ui_component_add_verb_list_with_data (text_view->ui,
- verbs,
- text_view);
- }
-}
-
-static void
-nautilus_text_view_instance_init (NautilusTextView *view)
-{
- GtkWidget *text_view;
- GtkWidget *scrolled_window;
- PangoFontDescription *monospace_font_desc;
- GConfClient *conf_client;
- char *monospace_font;
-
- text_view = gtk_text_view_new ();
- view->view = GTK_TEXT_VIEW (text_view);
-
- gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
- gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
- gtk_text_view_set_left_margin (GTK_TEXT_VIEW (text_view), 3);
- gtk_text_view_set_right_margin (GTK_TEXT_VIEW (text_view), 3);
-
- /* Pick up the monospace font from desktop preferences */
- conf_client = gconf_client_get_default ();
- monospace_font = gconf_client_get_string (conf_client, "/desktop/gnome/interface/monospace_font_name", NULL);
- if (monospace_font) {
- monospace_font_desc = pango_font_description_from_string (monospace_font);
- gtk_widget_modify_font (text_view, monospace_font_desc);
- pango_font_description_free (monospace_font_desc);
- }
- g_object_unref (conf_client);
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
-
- gtk_widget_show (text_view);
- gtk_widget_show (scrolled_window);
-
- view->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
-
- nautilus_view_construct (NAUTILUS_VIEW (view), scrolled_window);
-
- g_signal_connect_object (
- nautilus_view_get_bonobo_control (NAUTILUS_VIEW (view)),
- "activate", G_CALLBACK (bonobo_control_activate_callback),
- view, 0);
-}
-
-static void
-nautilus_text_view_finalize (GObject *object)
-{
- NautilusTextView *view;
-
- view = (NautilusTextView*)object;
-
- cancel_load (view);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-nautilus_text_view_class_init (NautilusTextViewClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- NautilusViewClass *view_class = NAUTILUS_VIEW_CLASS (class);
- const char *charset;
- gboolean utf8;
-
- view_class->load_location = load_location;
-
- object_class->finalize = nautilus_text_view_finalize;
-
- n_encodings_to_try = 0;
- utf8 = g_get_charset (&charset);
-
- if (!utf8) {
- encodings_to_try[n_encodings_to_try++] = charset;
- }
-
- if (g_ascii_strcasecmp (charset, "ISO-8859-1") != 0) {
- encodings_to_try[n_encodings_to_try++] = "ISO-8859-1";
- }
-}
-
-int
-main (int argc, char *argv[])
-{
- if (g_getenv ("NAUTILUS_DEBUG") != NULL) {
- eel_make_warnings_and_criticals_stop_in_debugger ();
- }
-
- return nautilus_view_standard_main ("nautilus-text-view",
- VERSION,
- GETTEXT_PACKAGE,
- GNOMELOCALEDIR,
- argc,
- argv,
- FACTORY_IID,
- VIEW_IID,
- nautilus_view_create_from_get_type_function,
- NULL,
- nautilus_text_view_get_type);
-}
diff --git a/components/text/nautilus-text-view.h b/components/text/nautilus-text-view.h
deleted file mode 100644
index 498977c41..000000000
--- a/components/text/nautilus-text-view.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Andy Hertzfeld
- */
-
-/* header file for the text view component */
-
-#ifndef NAUTILUS_TEXT_VIEW_H
-#define NAUTILUS_TEXT_VIEW_H
-
-#include <libnautilus/nautilus-view.h>
-
-
-typedef struct NautilusTextView NautilusTextView;
-typedef struct NautilusTextViewClass NautilusTextViewClass;
-
-#define NAUTILUS_TYPE_TEXT_VIEW (nautilus_text_view_get_type ())
-#define NAUTILUS_TEXT_VIEW(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_TEXT_VIEW, NautilusTextView))
-#define NAUTILUS_TEXT_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_TEXT_VIEW, NautilusTextViewClass))
-#define NAUTILUS_IS_TEXT_VIEW(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_TEXT_VIEW))
-#define NAUTILUS_IS_TEXT_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_TEXT_VIEW))
-
-typedef struct NautilusTextViewDetails NautilusTextViewDetails;
-
-struct NautilusTextView {
- NautilusView base;
- NautilusTextViewDetails *details;
-};
-
-struct NautilusTextViewClass {
- NautilusViewClass base;
-};
-
-
-
-/* GObject support */
-GType nautilus_text_view_get_type (void);
-
-
-#endif /* NAUTILUS_TEXT_VIEW_H */
diff --git a/components/throbber/Makefile.am b/components/throbber/Makefile.am
deleted file mode 100644
index 3405b68a8..000000000
--- a/components/throbber/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-NULL =
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"Nautilus-Throbber\" \
- -DDATADIR=\""$(datadir)"\" \
- -I$(top_srcdir) \
- -DGNOMELOCALEDIR=\""$(prefix)/${DATADIRNAME}/locale"\" \
- $(DISABLE_DEPRECATED_CFLAGS) \
- $(COMPONENT_CFLAGS) \
- $(NULL)
-
-libexec_PROGRAMS=nautilus-throbber
-
-nautilus_throbber_SOURCES = \
- nautilus-throbber.c \
- nautilus-throbber.h \
- main.c
-
-nautilus_throbber_LDADD = \
- $(top_builddir)/libnautilus/libnautilus.la \
- $(top_builddir)/libnautilus-private/libnautilus-private.la \
- $(COMPONENT_LIBS)
- $(NULL)
-
-server_in_files = Nautilus_Control_throbber.server.in.in
-
-serverdir = $(libdir)/bonobo/servers
-server_DATA = $(server_in_files:.server.in.in=.server)
-$(server_in_files:.server.in.in=.server.in): $(server_in_files)
- sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
-@INTLTOOL_SERVER_RULE@
-
-EXTRA_DIST = $(server_in_files)
-CLEANFILES = $(server_DATA) $(server_DATA).in
diff --git a/components/throbber/Nautilus_Control_throbber.server.in.in b/components/throbber/Nautilus_Control_throbber.server.in.in
deleted file mode 100644
index 14d780103..000000000
--- a/components/throbber/Nautilus_Control_throbber.server.in.in
+++ /dev/null
@@ -1,21 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:Nautilus_Throbber_Factory"
- type="exe" location="@LIBEXECDIR@/nautilus-throbber">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="name" type="string" _value="throbber factory"/>
- <oaf_attribute name="description" type="string" _value="throbber object factory"/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:Nautilus_Throbber" type="factory" location="OAFIID:Nautilus_Throbber_Factory">
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Unknown:1.0"/>
- <item value="IDL:Bonobo/Control:1.0"/>
- </oaf_attribute>
-<oaf_attribute name="name" type="string" _value="throbber"/>
-<oaf_attribute name="description" type="string" _value="animation to indicate on-going activity"/>
-</oaf_server>
-
-</oaf_info>
diff --git a/components/throbber/main.c b/components/throbber/main.c
deleted file mode 100644
index 7edd840b4..000000000
--- a/components/throbber/main.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Andy Hertzfeld
- */
-
-/* main.c - main function and object activation function for the throbber component. */
-
-#include <config.h>
-#include "nautilus-throbber.h"
-
-#include <eel/eel-debug.h>
-#include <libnautilus-private/nautilus-global-preferences.h>
-#include <libnautilus/nautilus-view-standard-main.h>
-
-#define FACTORY_IID "OAFIID:Nautilus_Throbber_Factory"
-#define VIEW_IID "OAFIID:Nautilus_Throbber"
-
-static BonoboObject *
-cb_create_throbber (const char *ignore0, void *ignore1)
-{
- NautilusThrobber *throbber =
- g_object_new (NAUTILUS_TYPE_THROBBER, NULL);
- return nautilus_throbber_get_control (throbber);
-}
-
-int
-main (int argc, char *argv[])
-{
- if (g_getenv ("NAUTILUS_DEBUG") != NULL) {
- eel_make_warnings_and_criticals_stop_in_debugger ();
- }
-
- return nautilus_view_standard_main ("nautilus-throbber",
- VERSION,
- GETTEXT_PACKAGE,
- GNOMELOCALEDIR,
- argc,
- argv,
- FACTORY_IID,
- VIEW_IID,
- cb_create_throbber,
- nautilus_global_preferences_init,
- NULL);
-}
diff --git a/configure.in b/configure.in
index 685750c41..686bf2e9c 100644
--- a/configure.in
+++ b/configure.in
@@ -5,8 +5,7 @@ dnl ===========================================================================
ART_REQUIRED=2.3.10
BONOBO_ACTIVATION_REQUIRED=2.1.0
BONOBO_REQUIRED=2.1.0
-BONOBO_UI_REQUIRED=2.2.0
-EEL_REQUIRED=2.8.2
+EEL_REQUIRED=2.9.1
ESOUND_REQUIRED=0.2.27
GLIB_REQUIRED=2.3.0
GNOME_DESKTOP_REQUIRED=2.1.0
@@ -16,7 +15,6 @@ GNOME_VFS_REQUIRED=2.5.1
ORBIT_REQUIRED=2.4.0
PANGO_REQUIRED=1.1.2
GTK_REQUIRED=2.3.0
-MEDUSA_REQUIRED=0.5.1
RSVG_REQUIRED=2.0.1
XML_REQUIRED=2.4.7
STARTUP_NOTIFICATION_REQUIRED=0.5
@@ -25,7 +23,6 @@ EXIF_REQUIRED=0.5.12
AC_SUBST(ART_REQUIRED)
AC_SUBST(BONOBO_ACTIVATION_REQUIRED)
AC_SUBST(BONOBO_REQUIRED)
-AC_SUBST(BONOBO_UI_REQUIRED)
AC_SUBST(EEL_REQUIRED)
AC_SUBST(ESOUND_REQUIRED)
AC_SUBST(GLIB_REQUIRED)
@@ -36,7 +33,6 @@ AC_SUBST(GNOME_VFS_REQUIRED)
AC_SUBST(ORBIT_REQUIRED)
AC_SUBST(PANGO_REQUIRED)
AC_SUBST(GTK_REQUIRED)
-AC_SUBST(MEDUSA_REQUIRED)
AC_SUBST(RSVG_REQUIRED)
AC_SUBST(XML_REQUIRED)
AC_SUBST(STARTUP_NOTIFICATION_REQUIRED)
@@ -88,7 +84,6 @@ PKG_CHECK_MODULES(ALL, \
gtk+-2.0 >= $GTK_REQUIRED \
libart-2.0 >= $ART_REQUIRED \
libbonobo-2.0 >= $BONOBO_REQUIRED \
- libbonoboui-2.0 >= $BONOBO_UI_REQUIRED \
libgnome-2.0 >= $GNOME_REQUIRED \
libgnomeui-2.0 >= $GNOME_UI_REQUIRED \
librsvg-2.0 >= $RSVG_REQUIRED \
@@ -214,16 +209,6 @@ AC_SUBST(HAVE_JW)
dnl ==========================================================================
-dnl medusa checking
-
-AC_MSG_CHECKING(for Medusa)
-
-PKG_CHECK_MODULES(MEDUSA, medusa-2.0 >= $MEDUSA_REQUIRED, have_medusa=yes, have_medusa=no)
-if test "x$have_medusa" = "xyes"; then
- AC_DEFINE(HAVE_MEDUSA,1)
- EXTRA_CORE_MODULES="$EXTRA_CORE_MODULES medusa-2.0"
-fi
-
dnl exif checking
AC_MSG_CHECKING(for libExif)
@@ -296,15 +281,6 @@ LIBEGG_MODULES="gtk+-2.0 libgnome-2.0"
LIBEGG_CFLAGS="`$PKG_CONFIG --cflags $LIBEGG_MODULES`"
AC_SUBST(LIBEGG_CFLAGS)
-dnl libnautilus (must list bonobo-activation and libbonobo because idldir does not respect "requires")
-LIBNAUTILUS_MODULES="eel-2.0 bonobo-activation-2.0 libbonobo-2.0 libbonoboui-2.0"
-LIBNAUTILUS_CFLAGS="`$PKG_CONFIG --cflags $LIBNAUTILUS_MODULES`"
-AC_SUBST(LIBNAUTILUS_CFLAGS)
-LIBNAUTILUS_LIBS="`$PKG_CONFIG --libs $LIBNAUTILUS_MODULES`"
-AC_SUBST(LIBNAUTILUS_LIBS)
-LIBNAUTILUS_IDL_INCLUDES="`$PKG_CONFIG --variable=idldir $LIBNAUTILUS_MODULES | $srcdir/add-include-prefix`"
-AC_SUBST(LIBNAUTILUS_IDL_INCLUDES)
-
dnl libnautilus-extension
LIBNAUTILUS_EXTENSION_MODULES="glib-2.0 gtk+-2.0 gnome-vfs-2.0"
LIBNAUTILUS_EXTENSION_CFLAGS="`$PKG_CONFIG --cflags $LIBNAUTILUS_EXTENSION_MODULES`"
@@ -313,7 +289,7 @@ LIBNAUTILUS_EXTENSION_LIBS="`$PKG_CONFIG --libs $LIBNAUTILUS_EXTENSION_MODULES`"
AC_SUBST(LIBNAUTILUS_EXTENSION_LIBS)
dnl core nautilus (must list bonobo-activation and libbonobo because idldir does not respect "requires")
-CORE_MODULES="eel-2.0 librsvg-2.0 bonobo-activation-2.0 libbonobo-2.0 libbonoboui-2.0 esound gnome-desktop-2.0 $EXTRA_CORE_MODULES"
+CORE_MODULES="eel-2.0 librsvg-2.0 bonobo-activation-2.0 libbonobo-2.0 esound gnome-desktop-2.0 $EXTRA_CORE_MODULES"
CORE_CFLAGS="`$PKG_CONFIG --cflags $CORE_MODULES` $x_cflags"
AC_SUBST(CORE_CFLAGS)
CORE_LIBS="`$PKG_CONFIG --libs $CORE_MODULES` $CDDA_LIBS $LIBJPEG $x_libs"
@@ -321,20 +297,6 @@ AC_SUBST(CORE_LIBS)
CORE_IDL_INCLUDES="`$PKG_CONFIG --variable=idldir $CORE_MODULES | $srcdir/add-include-prefix`"
AC_SUBST(CORE_IDL_INCLUDES)
-dnl typical components
-COMPONENT_MODULES="eel-2.0 libbonoboui-2.0 gnome-vfs-module-2.0 gnome-desktop-2.0"
-COMPONENT_CFLAGS="`$PKG_CONFIG --cflags $COMPONENT_MODULES`"
-AC_SUBST(COMPONENT_CFLAGS)
-COMPONENT_LIBS="`$PKG_CONFIG --libs $COMPONENT_MODULES`"
-AC_SUBST(COMPONENT_LIBS)
-
-dnl emblems component
-EMBLEM_COMPONENT_MODULES="$COMPONENT_MODULES librsvg-2.0"
-EMBLEM_COMPONENT_CFLAGS="`$PKG_CONFIG --cflags $EMBLEM_COMPONENT_MODULES`"
-AC_SUBST(EMBLEM_COMPONENT_CFLAGS)
-EMBLEM_COMPONENT_LIBS="`$PKG_CONFIG --libs $EMBLEM_COMPONENT_MODULES`"
-AC_SUBST(EMBLEM_COMPONENT_LIBS)
-
DISABLE_DEPRECATED_CFLAGS=""
@@ -350,7 +312,7 @@ dnl -DBONOBO_DISABLE_DEPRECATED
AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
dnl libbackground
-PKG_CHECK_MODULES(CAPPLET, "gtk+-2.0 gconf-2.0 libgnomeui-2.0 libbonoboui-2.0")
+PKG_CHECK_MODULES(CAPPLET, "gtk+-2.0 gconf-2.0 libgnomeui-2.0")
dnl ==========================================================================
dnl ==============================================
@@ -367,14 +329,6 @@ AM_GCONF_SOURCE_2
AC_OUTPUT([
Makefile
-components/Makefile
-components/adapter/Makefile
-components/history/Makefile
-components/notes/Makefile
-components/text/Makefile
-components/throbber/Makefile
-components/emblem/Makefile
-components/image_properties/Makefile
cut-n-paste-code/Makefile
cut-n-paste-code/libegg/Makefile
cut-n-paste-code/gsequence/Makefile
@@ -391,10 +345,7 @@ icons/gnome/Makefile
icons/sierra/Makefile
icons/tahoe/Makefile
libbackground/Makefile
-libnautilus-adapter/Makefile
libnautilus-private/Makefile
-libnautilus/Makefile
-libnautilus/libnautilus.pc
libnautilus-extension/Makefile
libnautilus-extension/libnautilus-extension.pc
nautilus.spec
diff --git a/libnautilus-adapter/Makefile.am b/libnautilus-adapter/Makefile.am
deleted file mode 100644
index cf01a52ef..000000000
--- a/libnautilus-adapter/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-NULL=
-
-lib_LTLIBRARIES=libnautilus-adapter.la
-
-
-INCLUDES=\
- -I$(top_srcdir) \
- $(CORE_CFLAGS) \
- $(NULL)
-
-libnautilus_adapter_la_LDFLAGS= \
- -version-info 2:0:0 \
- -no-undefined \
- $(NULL)
-
-libnautilus_adapter_la_LIBADD= ../libnautilus/libnautilus.la @ALL_LIBS@
-
-nautilus_adapter_factory_idl_sources = \
- nautilus-adapter-factory-stubs.c \
- nautilus-adapter-factory-skels.c \
- nautilus-adapter-factory.h \
- nautilus-adapter-factory-common.c
-
-BUILT_SOURCES = \
- $(nautilus_adapter_factory_idl_sources)
-
-libnautilus_adapter_la_SOURCES = \
- $(nautilus_adapter_factory_idl_sources) \
- $(NULL)
-
-$(nautilus_adapter_factory_idl_sources): nautilus_adapter_factory_idl_stamp
-nautilus_adapter_factory_idl_stamp: nautilus-adapter-factory.idl $(ORBIT_IDL)
- $(ORBIT_IDL) -I$(top_srcdir) $(CORE_IDL_INCLUDES) $<
- touch $@
-
-CLEANFILES = \
- $(nautilus_adapter_factory_idl_sources) \
- nautilus_adapter_factory_idl_stamp
-
-EXTRA_DIST = \
- nautilus-adapter-factory.idl
-
-dist-hook:
- cd $(distdir); rm -f $(CLEANFILES)
-
diff --git a/libnautilus-adapter/nautilus-adapter-factory.idl b/libnautilus-adapter/nautilus-adapter-factory.idl
deleted file mode 100644
index 326b2fdb3..000000000
--- a/libnautilus-adapter/nautilus-adapter-factory.idl
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/* nautilus-adapter-factory.idl - IDL for custom factory that creates
- * objects which wrap bonobo controls or embeddables
- * that are not Nautilus::Views as Nautilus::View objects.
- */
-
-#ifndef NAUTILUS_ADAPTER_FACTORY_IDL
-#define NAUTILUS_ADAPTER_FACTORY_IDL
-
-#include <Bonobo.idl>
-#include <libnautilus/nautilus-view-component.idl>
-
-module Nautilus {
-
- interface ComponentAdapterFactory : Bonobo::Unknown {
- /* FIXME: should use exceptions to report reasons for failure. */
- Nautilus::View create_adapter (in Bonobo::Unknown component);
- };
-
-};
-
-#endif /* NAUTILUS_ADAPTER_FACTORY_IDL */
diff --git a/libnautilus-private/Makefile.am b/libnautilus-private/Makefile.am
index 52062cfc9..ea7b245ee 100644
--- a/libnautilus-private/Makefile.am
+++ b/libnautilus-private/Makefile.am
@@ -3,7 +3,6 @@ include $(top_srcdir)/Makefile.shared
lib_LTLIBRARIES=libnautilus-private.la
libnautilus_private_la_LIBADD = \
- ../libnautilus/libnautilus.la \
../libnautilus-extension/libnautilus-extension.la
INCLUDES = \
@@ -43,20 +42,19 @@ marshal_sources = \
nautilus-marshal-guts.c \
$(NULL)
-
libnautilus_private_la_SOURCES = \
$(nautilus_metafile_server_idl_sources) \
nautilus-audio-player.c \
nautilus-audio-player.h \
- nautilus-bonobo-extensions.c \
- nautilus-bonobo-extensions.h \
nautilus-bookmark.c \
nautilus-bookmark.h \
+ nautilus-cdrom-extensions.h \
nautilus-cell-renderer-pixbuf-emblem.c \
nautilus-cell-renderer-pixbuf-emblem.h \
- nautilus-cdrom-extensions.h \
nautilus-clipboard-monitor.c \
nautilus-clipboard-monitor.h \
+ nautilus-clipboard.c \
+ nautilus-clipboard.h \
nautilus-column-chooser.c \
nautilus-column-chooser.h \
nautilus-column-utilities.c \
@@ -65,16 +63,16 @@ libnautilus_private_la_SOURCES = \
nautilus-customization-data.h \
nautilus-default-file-icon.c \
nautilus-default-file-icon.h \
- nautilus-desktop-directory.c \
- nautilus-desktop-directory.h \
nautilus-desktop-directory-file.c \
nautilus-desktop-directory-file.h \
+ nautilus-desktop-directory.c \
+ nautilus-desktop-directory.h \
nautilus-desktop-icon-file.c \
nautilus-desktop-icon-file.h \
- nautilus-desktop-link.c \
- nautilus-desktop-link.h \
nautilus-desktop-link-monitor.c \
nautilus-desktop-link-monitor.h \
+ nautilus-desktop-link.c \
+ nautilus-desktop-link.h \
nautilus-directory-async.c \
nautilus-directory-background.c \
nautilus-directory-background.h \
@@ -88,8 +86,6 @@ libnautilus_private_la_SOURCES = \
nautilus-directory.h \
nautilus-dnd.c \
nautilus-dnd.h \
- nautilus-drag-window.c \
- nautilus-drag-window.h \
nautilus-emblem-utils.c \
nautilus-emblem-utils.h \
nautilus-entry.c \
@@ -99,9 +95,9 @@ libnautilus_private_la_SOURCES = \
nautilus-file-changes-queue.h \
nautilus-file-dnd.c \
nautilus-file-dnd.h \
+ nautilus-file-operations-progress-icons.h \
nautilus-file-operations-progress.c \
nautilus-file-operations-progress.h \
- nautilus-file-operations-progress-icons.h \
nautilus-file-operations.c \
nautilus-file-operations.h \
nautilus-file-private.h \
@@ -125,6 +121,8 @@ libnautilus_private_la_SOURCES = \
nautilus-icon-factory.c \
nautilus-icon-factory.h \
nautilus-icon-private.h \
+ nautilus-idle-queue.c \
+ nautilus-idle-queue.h \
nautilus-iso9660.h \
nautilus-keep-last-vertical-box.c \
nautilus-keep-last-vertical-box.h \
@@ -138,8 +136,6 @@ libnautilus_private_la_SOURCES = \
nautilus-link.h \
nautilus-marshal.c \
nautilus-marshal.h \
- nautilus-medusa-support.c \
- nautilus-medusa-support.h \
nautilus-merged-directory.c \
nautilus-merged-directory.h \
nautilus-metadata.h \
@@ -155,12 +151,12 @@ libnautilus_private_la_SOURCES = \
nautilus-monitor.h \
nautilus-program-choosing.c \
nautilus-program-choosing.h \
- nautilus-recent.h \
nautilus-recent.c \
- nautilus-search-uri.c \
- nautilus-search-uri.h \
- nautilus-sidebar-functions.c \
- nautilus-sidebar-functions.h \
+ nautilus-recent.h \
+ nautilus-sidebar-provider.c \
+ nautilus-sidebar-provider.h \
+ nautilus-sidebar.c \
+ nautilus-sidebar.h \
nautilus-sound.c \
nautilus-sound.h \
nautilus-theme.c \
@@ -175,20 +171,27 @@ libnautilus_private_la_SOURCES = \
nautilus-trash-monitor.h \
nautilus-tree-view-drag-dest.c \
nautilus-tree-view-drag-dest.h \
- nautilus-undo-context.c \
- nautilus-undo-context.h \
+ nautilus-ui-utilities.c \
+ nautilus-ui-utilities.h \
nautilus-undo-manager.c \
nautilus-undo-manager.h \
+ nautilus-undo-private.h \
nautilus-undo-signal-handlers.c \
nautilus-undo-signal-handlers.h \
+ nautilus-undo-transaction.c \
+ nautilus-undo-transaction.h \
+ nautilus-undo.c \
+ nautilus-undo.h \
nautilus-vfs-directory.c \
nautilus-vfs-directory.h \
nautilus-vfs-file.c \
nautilus-vfs-file.h \
- nautilus-view-identifier.c \
- nautilus-view-identifier.h \
- nautilus-view-query.c \
- nautilus-view-query.h \
+ nautilus-view-factory.c \
+ nautilus-view-factory.h \
+ nautilus-view.c \
+ nautilus-view.h \
+ nautilus-window-info.c \
+ nautilus-window-info.h \
$(NULL)
$(lib_LTLIBRARIES): $(dependency_static_libs)
diff --git a/libnautilus-private/apps_nautilus_preferences.schemas.in b/libnautilus-private/apps_nautilus_preferences.schemas.in
index 753ea66ce..d52031681 100644
--- a/libnautilus-private/apps_nautilus_preferences.schemas.in
+++ b/libnautilus-private/apps_nautilus_preferences.schemas.in
@@ -644,21 +644,6 @@
</schema>
<schema>
- <key>/schemas/apps/nautilus/preferences/hide_built_in_bookmarks</key>
- <applyto>/apps/nautilus/preferences/hide_built_in_bookmarks</applyto>
- <owner>nautilus</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Hide default bookmarks in the bookmark menu</short>
- <long>
- If set to true, then Nautilus will just show the user's
- bookmarks in the bookmark menu.
- </long>
- </locale>
- </schema>
-
- <schema>
<key>/schemas/apps/nautilus/preferences/sidebar_width</key>
<applyto>/apps/nautilus/preferences/sidbar_width</applyto>
<owner>nautilus</owner>
diff --git a/libnautilus-private/nautilus-bonobo-extensions.c b/libnautilus-private/nautilus-bonobo-extensions.c
deleted file mode 100644
index 9aacb5201..000000000
--- a/libnautilus-private/nautilus-bonobo-extensions.c
+++ /dev/null
@@ -1,886 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-bonobo-extensions.c - implementation of new functions that conceptually
- belong in bonobo. Perhaps some of these will be
- actually rolled into bonobo someday.
-
- Copyright (C) 2000, 2001 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: John Sullivan <sullivan@eazel.com>
- Darin Adler <darin@bentspoon.com>
-*/
-
-#include <config.h>
-#include "nautilus-bonobo-extensions.h"
-
-#include "nautilus-icon-factory.h"
-
-#include <eel/eel-string.h>
-#include <eel/eel-gnome-extensions.h>
-#include <eel/eel-debug.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <gtk/gtkmain.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
-struct NautilusBonoboActivationHandle {
- NautilusBonoboActivationHandle **early_completion_hook;
- NautilusBonoboActivationCallback callback;
- gpointer callback_data;
- Bonobo_Unknown activated_object;
- gboolean cancel;
- guint idle_id;
- guint timeout_id;
-};
-
-typedef enum {
- NUMBERED_MENU_ITEM_PLAIN,
- NUMBERED_MENU_ITEM_TOGGLE,
- NUMBERED_MENU_ITEM_RADIO
-} NumberedMenuItemType;
-
-void
-nautilus_bonobo_set_accelerator (BonoboUIComponent *ui,
- const char *path,
- const char *accelerator)
-{
- bonobo_ui_component_set_prop (ui, path, "accel", accelerator, NULL);
-}
-
-void
-nautilus_bonobo_set_label (BonoboUIComponent *ui,
- const char *path,
- const char *label)
-{
- bonobo_ui_component_set_prop (ui, path, "label", label, NULL);
-}
-
-void
-nautilus_bonobo_set_tip (BonoboUIComponent *ui,
- const char *path,
- const char *tip)
-{
- bonobo_ui_component_set_prop (ui, path, "tip", tip, NULL);
-}
-
-void
-nautilus_bonobo_set_sensitive (BonoboUIComponent *ui,
- const char *path,
- gboolean sensitive)
-{
- bonobo_ui_component_set_prop (ui, path, "sensitive", sensitive ? "1" : "0", NULL);
-}
-
-void
-nautilus_bonobo_set_toggle_state (BonoboUIComponent *ui,
- const char *path,
- gboolean state)
-{
- bonobo_ui_component_set_prop (ui, path, "state", state ? "1" : "0", NULL);
-}
-
-void
-nautilus_bonobo_set_hidden (BonoboUIComponent *ui,
- const char *path,
- gboolean hidden)
-{
- bonobo_ui_component_set_prop (ui, path, "hidden", hidden ? "1" : "0", NULL);
-}
-
-char *
-nautilus_bonobo_get_label (BonoboUIComponent *ui,
- const char *path)
-{
- return bonobo_ui_component_get_prop (ui, path, "label", NULL);
-}
-
-gboolean
-nautilus_bonobo_get_hidden (BonoboUIComponent *ui,
- const char *path)
-{
- char *value;
- gboolean hidden;
- CORBA_Environment ev;
-
- g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (ui), FALSE);
- g_return_val_if_fail (path != NULL, FALSE);
-
- CORBA_exception_init (&ev);
- value = bonobo_ui_component_get_prop (ui, path, "hidden", &ev);
- CORBA_exception_free (&ev);
-
- if (value == NULL) {
- /* No hidden attribute means not hidden. */
- hidden = FALSE;
- } else {
- /* Anything other than "0" counts as TRUE */
- hidden = strcmp (value, "0") != 0;
- }
-
- g_free (value);
-
- return hidden;
-}
-
-static char *
-get_numbered_menu_item_name (guint index)
-{
- return g_strdup_printf ("%u", index);
-}
-
-char *
-nautilus_bonobo_get_numbered_menu_item_path (BonoboUIComponent *ui,
- const char *container_path,
- guint index)
-{
- char *item_name;
- char *item_path;
-
- g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (ui), NULL);
- g_return_val_if_fail (container_path != NULL, NULL);
-
- item_name = get_numbered_menu_item_name (index);
- item_path = g_strconcat (container_path, "/", item_name, NULL);
- g_free (item_name);
-
- return item_path;
-}
-
-char *
-nautilus_bonobo_get_numbered_menu_item_command (BonoboUIComponent *ui,
- const char *container_path,
- guint index)
-{
- char *command_name;
- char *path;
-
- g_return_val_if_fail (BONOBO_IS_UI_COMPONENT (ui), NULL);
- g_return_val_if_fail (container_path != NULL, NULL);
-
- path = nautilus_bonobo_get_numbered_menu_item_path (ui, container_path, index);
- command_name = gnome_vfs_escape_string (path);
- g_free (path);
-
- return command_name;
-}
-
-guint
-nautilus_bonobo_get_numbered_menu_item_index_from_command (const char *command)
-{
- char *path;
- char *index_string;
- int index;
- gboolean got_index;
-
- path = gnome_vfs_unescape_string (command, NULL);
- index_string = strrchr (path, '/');
-
- if (index_string == NULL) {
- got_index = FALSE;
- } else {
- got_index = eel_str_to_int (index_string + 1, &index);
- }
- g_free (path);
-
- g_return_val_if_fail (got_index, 0);
-
- return index;
-}
-
-char *
-nautilus_bonobo_get_numbered_menu_item_container_path_from_command (const char *command)
-{
- char *path;
- char *index_string;
- char *container_path;
-
- path = gnome_vfs_unescape_string (command, NULL);
- index_string = strrchr (path, '/');
-
- container_path = index_string == NULL
- ? NULL
- : g_strndup (path, index_string - path);
- g_free (path);
-
- return container_path;
-}
-
-static void
-add_numbered_menu_item_internal (BonoboUIComponent *ui,
- const char *container_path,
- guint index,
- const char *label,
- NumberedMenuItemType type,
- GdkPixbuf *pixbuf,
- const char *radio_group_name)
-{
- char *xml_item, *xml_command;
- char *command_name;
- char *item_name, *pixbuf_data;
- char *path;
-
- g_assert (BONOBO_IS_UI_COMPONENT (ui));
- g_assert (container_path != NULL);
- g_assert (label != NULL);
- g_assert (type == NUMBERED_MENU_ITEM_PLAIN || pixbuf == NULL);
- g_assert (type == NUMBERED_MENU_ITEM_RADIO || radio_group_name == NULL);
- g_assert (type != NUMBERED_MENU_ITEM_RADIO || radio_group_name != NULL);
-
- item_name = get_numbered_menu_item_name (index);
- command_name = nautilus_bonobo_get_numbered_menu_item_command
- (ui, container_path, index);
-
- switch (type) {
- case NUMBERED_MENU_ITEM_TOGGLE:
- xml_item = g_strdup_printf ("<menuitem name=\"%s\" id=\"%s\" type=\"toggle\"/>\n",
- item_name, command_name);
- break;
- case NUMBERED_MENU_ITEM_RADIO:
- xml_item = g_strdup_printf ("<menuitem name=\"%s\" id=\"%s\" type=\"radio\" group=\"%s\"/>\n",
- item_name, command_name, radio_group_name);
- break;
- case NUMBERED_MENU_ITEM_PLAIN:
- if (pixbuf != NULL) {
- pixbuf_data = bonobo_ui_util_pixbuf_to_xml (pixbuf);
- xml_item = g_strdup_printf ("<menuitem name=\"%s\" verb=\"%s\" pixtype=\"pixbuf\" pixname=\"%s\"/>\n",
- item_name, command_name, pixbuf_data);
- g_free (pixbuf_data);
- } else {
- xml_item = g_strdup_printf ("<menuitem name=\"%s\" verb=\"%s\"/>\n",
- item_name, command_name);
- }
- break;
- default:
- g_assert_not_reached ();
- xml_item = NULL; /* keep compiler happy */
- }
-
- g_free (item_name);
-
- bonobo_ui_component_set (ui, container_path, xml_item, NULL);
-
- g_free (xml_item);
-
- path = nautilus_bonobo_get_numbered_menu_item_path (ui, container_path, index);
- nautilus_bonobo_set_label (ui, path, label);
- g_free (path);
-
- /* Make the command node here too, so callers can immediately set
- * properties on it (otherwise it doesn't get created until some
- * time later).
- */
- xml_command = g_strdup_printf ("<cmd name=\"%s\"/>\n", command_name);
- bonobo_ui_component_set (ui, "/commands", xml_command, NULL);
- g_free (xml_command);
-
- g_free (command_name);
-}
-
-/* Add a menu item specified by number into a given path. Used for
- * dynamically creating a related series of menu items. Each index
- * must be unique (normal use is to call this in a loop, and
- * increment the index for each item).
- */
-void
-nautilus_bonobo_add_numbered_menu_item (BonoboUIComponent *ui,
- const char *container_path,
- guint index,
- const char *label,
- GdkPixbuf *pixbuf)
-{
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
- g_return_if_fail (container_path != NULL);
- g_return_if_fail (label != NULL);
-
- add_numbered_menu_item_internal (ui, container_path, index, label,
- NUMBERED_MENU_ITEM_PLAIN, pixbuf, NULL);
-}
-
-/* Add a menu item specified by number into a given path. Used for
- * dynamically creating a related series of toggle menu items. Each index
- * must be unique (normal use is to call this in a loop, and
- * increment the index for each item).
- */
-void
-nautilus_bonobo_add_numbered_toggle_menu_item (BonoboUIComponent *ui,
- const char *container_path,
- guint index,
- const char *label)
-{
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
- g_return_if_fail (container_path != NULL);
- g_return_if_fail (label != NULL);
-
- add_numbered_menu_item_internal (ui, container_path, index, label,
- NUMBERED_MENU_ITEM_TOGGLE, NULL, NULL);
-}
-
-/* Add a menu item specified by number into a given path. Used for
- * dynamically creating a related series of radio menu items. Each index
- * must be unique (normal use is to call this in a loop, and
- * increment the index for each item).
- */
-void
-nautilus_bonobo_add_numbered_radio_menu_item (BonoboUIComponent *ui,
- const char *container_path,
- guint index,
- const char *label,
- const char *radio_group_name)
-{
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
- g_return_if_fail (container_path != NULL);
- g_return_if_fail (label != NULL);
-
- add_numbered_menu_item_internal (ui, container_path, index, label,
- NUMBERED_MENU_ITEM_RADIO, NULL, radio_group_name);
-}
-
-void
-nautilus_bonobo_add_submenu (BonoboUIComponent *ui,
- const char *path,
- const char *label,
- GdkPixbuf *pixbuf)
-{
- char *xml_string, *name, *pixbuf_data, *submenu_path;
-
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
- g_return_if_fail (path != NULL);
- g_return_if_fail (label != NULL);
- g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
-
- /* Labels may contain characters that are illegal in names. So
- * we create the name by URI-encoding the label.
- */
- name = gnome_vfs_escape_string (label);
-
- if (pixbuf != NULL) {
- pixbuf_data = bonobo_ui_util_pixbuf_to_xml (pixbuf);
- xml_string = g_strdup_printf ("<submenu name=\"%s\" pixtype=\"pixbuf\" pixname=\"%s\"/>\n",
- name, pixbuf_data);
- g_free (pixbuf_data);
- } else {
- xml_string = g_strdup_printf ("<submenu name=\"%s\"/>\n", name);
- }
-
- bonobo_ui_component_set (ui, path, xml_string, NULL);
-
- g_free (xml_string);
-
- submenu_path = g_strconcat (path, "/", name, NULL);
- nautilus_bonobo_set_label (ui, submenu_path, label);
- g_free (submenu_path);
-
- g_free (name);
-}
-
-void
-nautilus_bonobo_add_menu_separator (BonoboUIComponent *ui, const char *path)
-{
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
- g_return_if_fail (path != NULL);
-
- bonobo_ui_component_set (ui, path, "<separator/>", NULL);
-}
-
-static void
-remove_commands (BonoboUIComponent *ui, const char *container_path)
-{
- BonoboUINode *path_node;
- BonoboUINode *child_node;
- char *verb_name;
- char *id_name;
-
- path_node = bonobo_ui_component_get_tree (ui, container_path, TRUE, NULL);
- if (path_node == NULL) {
- return;
- }
-
- bonobo_ui_component_freeze (ui, NULL);
-
- for (child_node = bonobo_ui_node_children (path_node);
- child_node != NULL;
- child_node = bonobo_ui_node_next (child_node)) {
- verb_name = bonobo_ui_node_get_attr (child_node, "verb");
- if (verb_name != NULL) {
- bonobo_ui_component_remove_verb (ui, verb_name);
- bonobo_ui_node_free_string (verb_name);
- } else {
- /* Only look for an id if there's no verb */
- id_name = bonobo_ui_node_get_attr (child_node, "id");
- if (id_name != NULL) {
- bonobo_ui_component_remove_listener (ui, id_name);
- bonobo_ui_node_free_string (id_name);
- }
- }
- }
-
- bonobo_ui_component_thaw (ui, NULL);
-
- bonobo_ui_node_free (path_node);
-}
-
-/**
- * nautilus_bonobo_remove_menu_items_and_verbs
- *
- * Removes all menu items contained in a menu or placeholder, and
- * their verbs.
- *
- * @uih: The BonoboUIHandler for this menu item.
- * @container_path: The standard bonobo-style path specifier for this placeholder or submenu.
- */
-void
-nautilus_bonobo_remove_menu_items_and_commands (BonoboUIComponent *ui,
- const char *container_path)
-{
- char *remove_wildcard;
-
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
- g_return_if_fail (container_path != NULL);
-
- remove_commands (ui, container_path);
-
- /* For speed, remove menu items themselves all in one fell swoop,
- * though we removed the verbs one-by-one.
- */
- remove_wildcard = g_strdup_printf ("%s/*", container_path);
- bonobo_ui_component_rm (ui, remove_wildcard, NULL);
- g_free (remove_wildcard);
-}
-
-/* Call to set the user-visible label of a command to a string
- * containing an underscore accelerator. The underscore is stripped
- * off before setting the label of the toolitem, because toolbar
- * button labels shouldn't have the underscore.
- */
-void
-nautilus_bonobo_set_label_for_toolitem_and_command (BonoboUIComponent *ui,
- const char *toolitem_path,
- const char *command_path,
- const char *label_with_underscore)
-{
- char *label_no_underscore;
-
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui));
- g_return_if_fail (toolitem_path != NULL);
- g_return_if_fail (command_path != NULL);
- g_return_if_fail (label_with_underscore != NULL);
-
- label_no_underscore = eel_str_strip_chr (label_with_underscore, '_');
- nautilus_bonobo_set_label (ui,
- command_path,
- label_with_underscore);
- nautilus_bonobo_set_label (ui,
- toolitem_path,
- label_no_underscore);
-
- g_free (label_no_underscore);
-}
-
-static char *
-get_extension_menu_item_xml (NautilusMenuItem *item)
-{
- GString *ui_xml;
- char *pixbuf_data;
- GdkPixbuf *pixbuf;
- char *name;
- char *icon;
-
- ui_xml = g_string_new ("");
-
- g_object_get (G_OBJECT (item), "name", &name, "icon", &icon, NULL);
-
- g_string_append_printf (ui_xml,
- "<menuitem name=\"%s\" verb=\"%s\"",
- name, name);
-
- if (icon) {
- pixbuf = nautilus_icon_factory_get_pixbuf_from_name
- (icon,
- NULL,
- NAUTILUS_ICON_SIZE_FOR_MENUS,
- NULL);
- if (pixbuf) {
- pixbuf_data = bonobo_ui_util_pixbuf_to_xml (pixbuf);
- g_string_append_printf (ui_xml, " pixtype=\"pixbuf\" pixname=\"%s\"", pixbuf_data);
- g_free (pixbuf_data);
- g_object_unref (pixbuf);
- }
- }
- g_string_append (ui_xml, "/>");
-
- g_free (name);
- g_free (icon);
-
- return g_string_free (ui_xml, FALSE);
-}
-
-static void
-extension_action_callback (BonoboUIComponent *component,
- gpointer callback_data, const char *path)
-{
- nautilus_menu_item_activate (NAUTILUS_MENU_ITEM (callback_data));
-}
-
-char *
-nautilus_bonobo_get_extension_item_command_xml (NautilusMenuItem *item)
-{
- char *name;
- char *label;
- char *tip;
- gboolean sensitive;
- char *xml;
-
- g_object_get (G_OBJECT (item),
- "name", &name, "label", &label,
- "tip", &tip, "sensitive", &sensitive,
- NULL);
-
- xml = g_strdup_printf ("<cmd name=\"%s\" label=\"%s\" tip=\"%s\" sensitive=\"%s\"/>",
- name, label, tip, sensitive ? "1" : "0");
-
- g_free (name);
- g_free (label);
- g_free (tip);
-
- return xml;
-}
-
-void
-nautilus_bonobo_add_extension_item_command (BonoboUIComponent *ui,
- NautilusMenuItem *item)
-{
- char *xml;
- char *name;
- GClosure *closure;
-
- xml = nautilus_bonobo_get_extension_item_command_xml (item);
-
- bonobo_ui_component_set (ui, "/commands", xml, NULL);
-
- g_free (xml);
-
- g_object_get (G_OBJECT (item), "name", &name, NULL);
-
- closure = g_cclosure_new
- (G_CALLBACK (extension_action_callback),
- g_object_ref (item),
- (GClosureNotify)g_object_unref);
-
- bonobo_ui_component_add_verb_full (ui, name, closure);
-
- g_free (name);
-}
-
-void
-nautilus_bonobo_add_extension_item (BonoboUIComponent *ui,
- const char *path,
- NautilusMenuItem *item)
-{
- char *item_xml;
-
- item_xml = get_extension_menu_item_xml (item);
-
- bonobo_ui_component_set (ui, path, item_xml, NULL);
-
- g_free (item_xml);
-}
-
-static char *
-get_extension_toolbar_item_xml (NautilusMenuItem *item)
-{
- GString *ui_xml;
- char *pixbuf_data;
- GdkPixbuf *pixbuf;
- char *name;
- char *icon;
- gboolean priority;
-
- ui_xml = g_string_new ("");
-
-
- g_object_get (item,
- "name", &name, "priority", &priority,
- "icon", &icon,
- NULL);
- g_string_append_printf (ui_xml,
- "<toolitem name=\"%s\" verb=\"%s\"",
- name, name);
-
- if (priority) {
- g_string_append (ui_xml, " priority=\"1\"");
- }
-
- if (icon) {
- pixbuf = nautilus_icon_factory_get_pixbuf_from_name
- (icon,
- NULL,
- NAUTILUS_ICON_SIZE_FOR_MENUS,
- NULL);
- if (pixbuf) {
- pixbuf_data = bonobo_ui_util_pixbuf_to_xml (pixbuf);
- g_string_append_printf (ui_xml, " pixtype=\"pixbuf\" pixname=\"%s\"", pixbuf_data);
- g_free (pixbuf_data);
- g_object_unref (pixbuf);
- }
- }
- g_string_append (ui_xml, "/>");
-
- g_free (name);
- g_free (icon);
-
- return g_string_free (ui_xml, FALSE);
-}
-
-void
-nautilus_bonobo_add_extension_toolbar_item (BonoboUIComponent *ui,
- const char *path,
- NautilusMenuItem *item)
-{
- char *item_xml;
-
- item_xml = get_extension_toolbar_item_xml (item);
-
- bonobo_ui_component_set (ui, path, item_xml, NULL);
-
- g_free (item_xml);
-}
-
-static void
-activation_handle_done (NautilusBonoboActivationHandle *handle)
-{
- if (handle->early_completion_hook != NULL) {
- g_assert (*handle->early_completion_hook == handle);
- *handle->early_completion_hook = NULL;
- }
-}
-
-static void
-activation_handle_free (NautilusBonoboActivationHandle *handle)
-{
- activation_handle_done (handle);
-
- if (handle->activated_object != NULL) {
- bonobo_object_release_unref (handle->activated_object, NULL);
- }
-
- g_free (handle);
-}
-
-static GHashTable *nautilus_activation_shortcuts = NULL;
-
-struct CreateObjectData {
- NautilusBonoboCreateObject create_object;
- gpointer callback_data;
-};
-
-void
-nautilus_bonobo_register_activation_shortcut (const char *iid,
- NautilusBonoboCreateObject create_object_callback,
- gpointer callback_data)
-{
- struct CreateObjectData *data;
-
- if (nautilus_activation_shortcuts == NULL) {
- nautilus_activation_shortcuts = g_hash_table_new_full
- (g_str_hash, g_str_equal, g_free, g_free);
- eel_debug_call_at_shutdown_with_data ((GFreeFunc)g_hash_table_destroy,
- nautilus_activation_shortcuts);
- }
-
- data = g_new (struct CreateObjectData, 1);
- data->create_object = create_object_callback;
- data->callback_data = callback_data;
- g_hash_table_insert (nautilus_activation_shortcuts,
- g_strdup (iid), data);
-}
-
-void
-nautilus_bonobo_unregister_activation_shortcut (const char *iid)
-{
- if (nautilus_activation_shortcuts == NULL) {
- g_assert_not_reached ();
- return;
- }
- g_hash_table_remove (nautilus_activation_shortcuts, iid);
-}
-
-static gboolean
-activation_idle_callback (gpointer callback_data)
-{
- NautilusBonoboActivationHandle *handle;
-
- handle = (NautilusBonoboActivationHandle *) callback_data;
-
- (* handle->callback) (handle,
- handle->activated_object,
- handle->callback_data);
-
- activation_handle_free (handle);
-
- return FALSE;
-}
-
-static void
-activation_cancel (NautilusBonoboActivationHandle *handle)
-{
- activation_handle_free (handle);
-}
-
-static void
-bonobo_activation_activation_callback (Bonobo_Unknown activated_object,
- const char *error_reason,
- gpointer callback_data)
-{
- NautilusBonoboActivationHandle *handle;
-
- handle = (NautilusBonoboActivationHandle *) callback_data;
-
- if (handle->timeout_id != 0) {
- g_source_remove (handle->timeout_id);
- }
-
- if (activated_object == NULL) {
- g_warning ("activation failed: %s", error_reason);
- }
-
- handle->activated_object = activated_object;
-
- if (handle->cancel) {
- activation_cancel (handle);
- } else {
- handle->idle_id = g_idle_add (activation_idle_callback,
- handle);
- }
-}
-
-static gboolean
-activation_timed_out (gpointer callback_data)
-{
- NautilusBonoboActivationHandle *handle = callback_data;
-
- (* handle->callback) (handle,
- NULL,
- handle->callback_data);
-
- handle->timeout_id = 0;
- nautilus_bonobo_activate_cancel (handle);
- return FALSE;
-}
-
-/**
- * nautilus_bonobo_activate_from_id:
- * @iid: iid of component to activate.
- * @callback: callback to call when activation finished.
- * @user_data: data to pass to callback when activation finished.
- *
- * This function will return NULL if something bad happened during
- * activation.
- */
-NautilusBonoboActivationHandle *
-nautilus_bonobo_activate_from_id (const char *iid,
- NautilusBonoboActivationCallback callback,
- gpointer callback_data)
-{
- NautilusBonoboActivationHandle *handle;
- struct CreateObjectData *data;
- CORBA_Object activated_object;
-
- g_return_val_if_fail (iid != NULL, NULL);
- g_return_val_if_fail (callback != NULL, NULL);
-
- handle = g_new0 (NautilusBonoboActivationHandle, 1);
-
- handle->early_completion_hook = &handle;
- handle->callback = callback;
- handle->callback_data = callback_data;
-
- handle->activated_object = CORBA_OBJECT_NIL;
-
- if (nautilus_activation_shortcuts != NULL) {
- data = g_hash_table_lookup (nautilus_activation_shortcuts, iid);
- if (data != NULL) {
- activated_object = (*data->create_object) (iid, data->callback_data);
- if (activated_object != CORBA_OBJECT_NIL) {
- handle->activated_object = activated_object;
- handle->early_completion_hook = NULL;
- handle->idle_id = g_idle_add (activation_idle_callback,
- handle);
- return handle;
- }
- }
- }
-
- handle->timeout_id = g_timeout_add (4*1000, activation_timed_out, handle);
-
- bonobo_activation_activate_from_id_async ((char *) iid, 0,
- bonobo_activation_activation_callback,
- handle, NULL);
-
- if (handle != NULL) {
- handle->early_completion_hook = NULL;
- }
-
- return handle;
-}
-
-/**
- * nautilus_bonobo_activate_stop:
- * @iid: iid of component to activate.
- * @callback: callback to call when activation finished.
- * @user_data: data to pass to callback when activation finished.
- *
- * Stops activation of a component. Your callback will not be called
- * after this call.
- */
-void
-nautilus_bonobo_activate_cancel (NautilusBonoboActivationHandle *handle)
-{
- if (handle == NULL) {
- return;
- }
-
- if (handle->timeout_id != 0) {
- g_source_remove (handle->timeout_id);
- handle->timeout_id = 0;
- }
-
- activation_handle_done (handle);
-
- if (handle->idle_id == 0) {
- /* no way to cancel the underlying bonobo-activation call, so we just set a flag */
- handle->cancel = TRUE;
- } else {
- g_source_remove (handle->idle_id);
- activation_cancel (handle);
- }
-}
-
-Bonobo_RegistrationResult
-nautilus_bonobo_activation_register_for_display (const char *iid,
- Bonobo_Unknown ref)
-{
- const char *display_name;
- GSList *reg_env ;
- Bonobo_RegistrationResult result;
-
- display_name = gdk_display_get_name (gdk_display_get_default());
- reg_env = bonobo_activation_registration_env_set (NULL,
- "DISPLAY", display_name);
- result = bonobo_activation_register_active_server (iid, ref, reg_env);
- bonobo_activation_registration_env_free (reg_env);
- return result;
-}
diff --git a/libnautilus-private/nautilus-bonobo-extensions.h b/libnautilus-private/nautilus-bonobo-extensions.h
deleted file mode 100644
index 46c985150..000000000
--- a/libnautilus-private/nautilus-bonobo-extensions.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-bonobo-extensions.h - interface for new functions that conceptually
- belong in bonobo. Perhaps some of these will be
- actually rolled into bonobo someday.
-
- 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.
-
- Author: John Sullivan <sullivan@eazel.com>
-*/
-
-#ifndef NAUTILUS_BONOBO_EXTENSIONS_H
-#define NAUTILUS_BONOBO_EXTENSIONS_H
-
-#include <bonobo/bonobo-ui-component.h>
-#include <bonobo/bonobo-xobject.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include <libnautilus-extension/nautilus-menu-item.h>
-
-typedef struct NautilusBonoboActivationHandle NautilusBonoboActivationHandle;
-
-typedef void (*NautilusBonoboActivationCallback) (NautilusBonoboActivationHandle *handle,
- Bonobo_Unknown activated_object,
- gpointer callback_data);
-
-typedef CORBA_Object (*NautilusBonoboCreateObject) (const char *iid,
- gpointer callback_data);
-
-void nautilus_bonobo_set_accelerator (BonoboUIComponent *ui,
- const char *path,
- const char *accelerator);
-char * nautilus_bonobo_get_label (BonoboUIComponent *ui,
- const char *path);
-void nautilus_bonobo_set_label (BonoboUIComponent *ui,
- const char *path,
- const char *label);
-void nautilus_bonobo_set_tip (BonoboUIComponent *ui,
- const char *path,
- const char *tip);
-void nautilus_bonobo_set_sensitive (BonoboUIComponent *ui,
- const char *path,
- gboolean sensitive);
-void nautilus_bonobo_set_toggle_state (BonoboUIComponent *ui,
- const char *path,
- gboolean state);
-void nautilus_bonobo_set_hidden (BonoboUIComponent *ui,
- const char *path,
- gboolean hidden);
-gboolean nautilus_bonobo_get_hidden (BonoboUIComponent *ui,
- const char *path);
-void nautilus_bonobo_add_numbered_menu_item (BonoboUIComponent *ui,
- const char *container_path,
- guint index,
- const char *label,
- GdkPixbuf *pixbuf);
-void nautilus_bonobo_add_numbered_toggle_menu_item (BonoboUIComponent *ui,
- const char *container_path,
- guint index,
- const char *label);
-void nautilus_bonobo_add_numbered_radio_menu_item (BonoboUIComponent *ui,
- const char *container_path,
- guint index,
- const char *label,
- const char *radio_group_name);
-char * nautilus_bonobo_get_numbered_menu_item_command (BonoboUIComponent *ui,
- const char *container_path,
- guint index);
-char * nautilus_bonobo_get_numbered_menu_item_path (BonoboUIComponent *ui,
- const char *container_path,
- guint index);
-
-guint nautilus_bonobo_get_numbered_menu_item_index_from_command
-(const char *command);
-char * nautilus_bonobo_get_numbered_menu_item_container_path_from_command
-(const char *command);
-void nautilus_bonobo_add_submenu (BonoboUIComponent *ui,
- const char *container_path,
- const char *label,
- GdkPixbuf *pixbuf);
-void nautilus_bonobo_add_menu_separator (BonoboUIComponent *ui,
- const char *path);
-void nautilus_bonobo_remove_menu_items_and_commands (BonoboUIComponent *ui,
- const char *container_path);
-void nautilus_bonobo_set_label_for_toolitem_and_command (BonoboUIComponent *ui,
- const char *toolitem_path,
- const char *command_path,
- const char *label_with_underscore);
-void nautilus_bonobo_set_icon (BonoboUIComponent *ui,
- const char *path,
- const char *icon_relative_path);
-void nautilus_bonobo_add_extension_item_command (BonoboUIComponent *ui,
- NautilusMenuItem *item);
-char *nautilus_bonobo_get_extension_item_command_xml (NautilusMenuItem *item);
-
-void nautilus_bonobo_add_extension_item (BonoboUIComponent *ui,
- const char *path,
- NautilusMenuItem *item);
-void nautilus_bonobo_add_extension_toolbar_item (BonoboUIComponent *ui,
- const char *path,
- NautilusMenuItem *item);
-void nautilus_bonobo_register_activation_shortcut (const char *iid,
- NautilusBonoboCreateObject create_object_callback,
- gpointer callback_data);
-void nautilus_bonobo_unregister_activation_shortcut (const char *iid);
-NautilusBonoboActivationHandle *nautilus_bonobo_activate_from_id (const char *iid,
- NautilusBonoboActivationCallback callback,
- gpointer callback_data);
-void nautilus_bonobo_activate_cancel (NautilusBonoboActivationHandle *handle);
-Bonobo_RegistrationResult nautilus_bonobo_activation_register_for_display (const char *iid,
- Bonobo_Unknown ref);
-
-
-
-#endif /* NAUTILUS_BONOBO_EXTENSIONS_H */
diff --git a/libnautilus-private/nautilus-clipboard-monitor.c b/libnautilus-private/nautilus-clipboard-monitor.c
index ffe02d93c..3fb40ac04 100644
--- a/libnautilus-private/nautilus-clipboard-monitor.c
+++ b/libnautilus-private/nautilus-clipboard-monitor.c
@@ -28,6 +28,8 @@
#include <eel/eel-debug.h>
#include <eel/eel-gtk-macros.h>
#include <eel/eel-glib-extensions.h>
+#include <eel/eel-glib-extensions.h>
+#include <gtk/gtkclipboard.h>
/* X11 has a weakness when it comes to clipboard handling,
* there is no way to get told when the owner of the clipboard
@@ -36,8 +38,12 @@
* internally in an app by telling the clipboard monitor when
* we changed the clipboard. Unfortunately this doesn't give
* us perfect results, we still don't catch changes made by
- * other clients. The solution to that is to use the XFIXES
- * extension, which isn't availible yet.
+ * other clients
+ *
+ * This is fixed with the XFIXES extensions, which recent versions
+ * of Gtk+ supports as the owner_change signal on GtkClipboard. We
+ * use this now, but keep the old code since not all X servers support
+ * XFIXES.
*/
enum {
@@ -68,9 +74,15 @@ destroy_clipboard_monitor (void)
NautilusClipboardMonitor *
nautilus_clipboard_monitor_get (void)
{
+ GtkClipboard *clipboard;
+
if (clipboard_monitor == NULL) {
clipboard_monitor = NAUTILUS_CLIPBOARD_MONITOR (g_object_new (NAUTILUS_TYPE_CLIPBOARD_MONITOR, NULL));
eel_debug_call_at_shutdown (destroy_clipboard_monitor);
+
+ clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+ g_signal_connect (clipboard, "owner_change",
+ G_CALLBACK (nautilus_clipboard_monitor_emit_changed), NULL);
}
return clipboard_monitor;
}
diff --git a/libnautilus/nautilus-clipboard.c b/libnautilus-private/nautilus-clipboard.c
index 9e595e103..6863a9007 100644
--- a/libnautilus/nautilus-clipboard.c
+++ b/libnautilus-private/nautilus-clipboard.c
@@ -29,9 +29,11 @@
#include <config.h>
#include "nautilus-clipboard.h"
+#include "nautilus-file-utilities.h"
-#include "nautilus-bonobo-ui.h"
-#include <bonobo/bonobo-ui-util.h>
+#include <libgnome/gnome-i18n.h>
+#include <gtk/gtkclipboard.h>
+#include <gtk/gtkstock.h>
#include <gtk/gtkinvisible.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
@@ -40,62 +42,41 @@
typedef void (* EditableFunction) (GtkEditable *editable);
-static void disconnect_set_up_in_control_handlers (GtkObject *object,
- gpointer callback_data);
static void selection_changed_callback (GtkWidget *widget,
gpointer callback_data);
-
+static void owner_change_callback (GtkClipboard *clipboard,
+ GdkEventOwnerChange *event,
+ gpointer callback_data);
+
static void
-cut_callback (BonoboUIComponent *ui,
- gpointer callback_data,
- const char *command_name)
+action_cut_callback (GtkAction *action,
+ gpointer callback_data)
{
- g_assert (BONOBO_IS_UI_COMPONENT (ui));
- g_assert (strcmp (command_name, "Cut") == 0);
-
gtk_editable_cut_clipboard (GTK_EDITABLE (callback_data));
}
static void
-copy_callback (BonoboUIComponent *ui,
- gpointer callback_data,
- const char *command_name)
+action_copy_callback (GtkAction *action,
+ gpointer callback_data)
{
- g_assert (BONOBO_IS_UI_COMPONENT (ui));
- g_assert (strcmp (command_name, "Copy") == 0);
-
gtk_editable_copy_clipboard (GTK_EDITABLE (callback_data));
}
static void
-paste_callback (BonoboUIComponent *ui,
- gpointer callback_data,
- const char *command_name)
+action_paste_callback (GtkAction *action,
+ gpointer callback_data)
{
- g_assert (BONOBO_IS_UI_COMPONENT (ui));
- g_assert (strcmp (command_name, "Paste") == 0);
-
gtk_editable_paste_clipboard (GTK_EDITABLE (callback_data));
}
static void
-clear_callback (BonoboUIComponent *ui,
- gpointer callback_data,
- const char *command_name)
-{
- g_assert (BONOBO_IS_UI_COMPONENT (ui));
- g_assert (strcmp (command_name, "Clear") == 0);
-
- gtk_editable_delete_selection (GTK_EDITABLE (callback_data));
-}
-
-static void
select_all (GtkEditable *editable)
{
gtk_editable_set_position (editable, -1);
gtk_editable_select_region (editable, 0, -1);
}
+
static void
idle_source_destroy_callback (gpointer data,
GObject *where_the_object_was)
@@ -128,16 +109,12 @@ select_all_idle_callback (gpointer callback_data)
}
static void
-select_all_callback (BonoboUIComponent *ui,
- gpointer callback_data,
- const char *command_name)
+action_select_all_callback (GtkAction *action,
+ gpointer callback_data)
{
GSource *source;
GtkEditable *editable;
- g_assert (BONOBO_IS_UI_COMPONENT (ui));
- g_assert (strcmp (command_name, "Select All") == 0);
-
editable = GTK_EDITABLE (callback_data);
if (g_object_get_data (G_OBJECT (editable),
@@ -159,72 +136,73 @@ select_all_callback (BonoboUIComponent *ui,
}
static void
-set_menu_item_sensitive (BonoboUIComponent *component,
- const char *path,
- gboolean sensitive)
+received_clipboard_contents (GtkClipboard *clipboard,
+ GtkSelectionData *selection_data,
+ gpointer data)
{
- bonobo_ui_component_set_prop (component, path,
- "sensitive", sensitive ? "1" : "0", NULL);
-
+ GtkActionGroup *action_group;
+ GtkAction *action;
+
+ action_group = data;
+
+ action = gtk_action_group_get_action (action_group,
+ "Paste");
+ if (action != NULL) {
+ gtk_action_set_sensitive (action,
+ gtk_selection_data_targets_include_text (selection_data));
+ }
+
+ g_object_unref (action_group);
}
-#if 0
+
static void
-set_paste_sensitive_if_clipboard_contains_data (BonoboUIComponent *component)
+set_paste_sensitive_if_clipboard_contains_data (GtkActionGroup *action_group)
{
- gboolean clipboard_contains_data;
-
- /* FIXME: This check is wrong, because gdk_selection_owner_get
- * will only return non-null if the clipboard owner is in
- * process, which may not be the case, and we may still be
- * able to paste data.
- */
- /* FIXME: PRIMARY is wrong here. We are interested in
- * CLIPBOARD, not PRIMARY.
- */
- /* FIXME: This doesn't tell us what kind of data is on the
- * clipboard, and we only want to be sensitive if it's text.
- */
- clipboard_contains_data =
- (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) != NULL);
-
- set_menu_item_sensitive (component,
- NAUTILUS_COMMAND_PASTE,
- clipboard_contains_data);
+ GtkAction *action;
+ if (gdk_display_supports_selection_notification (gdk_display_get_default ())) {
+ gtk_clipboard_request_contents (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD),
+ gdk_atom_intern ("TARGETS", FALSE),
+ received_clipboard_contents,
+ g_object_ref (action_group));
+ } else {
+ /* If selection notification isn't supported, always activate Paste */
+ action = gtk_action_group_get_action (action_group,
+ "Paste");
+ gtk_action_set_sensitive (action, TRUE);
+ }
}
-#endif
static void
-set_clipboard_menu_items_sensitive (BonoboUIComponent *component)
+set_clipboard_menu_items_sensitive (GtkActionGroup *action_group)
{
- set_menu_item_sensitive (component,
- NAUTILUS_COMMAND_CUT,
- TRUE);
- set_menu_item_sensitive (component,
- NAUTILUS_COMMAND_COPY,
- TRUE);
- set_menu_item_sensitive (component,
- NAUTILUS_COMMAND_CLEAR,
- TRUE);
+ GtkAction *action;
+
+ action = gtk_action_group_get_action (action_group,
+ "Cut");
+ gtk_action_set_sensitive (action, TRUE);
+ action = gtk_action_group_get_action (action_group,
+ "Copy");
+ gtk_action_set_sensitive (action, TRUE);
}
static void
-set_clipboard_menu_items_insensitive (BonoboUIComponent *component)
+set_clipboard_menu_items_insensitive (GtkActionGroup *action_group)
{
- set_menu_item_sensitive (component,
- NAUTILUS_COMMAND_CUT,
- FALSE);
- set_menu_item_sensitive (component,
- NAUTILUS_COMMAND_COPY,
- FALSE);
- set_menu_item_sensitive (component,
- NAUTILUS_COMMAND_CLEAR,
- FALSE);
+ GtkAction *action;
+
+ action = gtk_action_group_get_action (action_group,
+ "Cut");
+ gtk_action_set_sensitive (action, FALSE);
+ action = gtk_action_group_get_action (action_group,
+ "Copy");
+ gtk_action_set_sensitive (action, FALSE);
}
typedef struct {
- BonoboUIComponent *component;
- Bonobo_UIContainer container;
+ GtkUIManager *ui_manager;
+ GtkActionGroup *action_group;
+ guint merge_id;
gboolean editable_shares_selection_changes;
} TargetCallbackData;
@@ -244,42 +222,54 @@ set_clipboard_items_are_merged_in (GObject *widget_as_object,
GINT_TO_POINTER (merged_in));
}
+static char * clipboard_ui =
+"<ui>"
+"<menubar name='MenuBar'>"
+" <menu action='Edit'>"
+" <menuitem name='Cut' "
+" action='Cut'/>"
+" <menuitem name='Copy' "
+" action='Copy'/>"
+" <menuitem name='Paste' "
+" action='Paste'/>"
+" <menuitem name='Select All'"
+" action='Select All'/>"
+" </menu>"
+"</menubar>"
+"</ui>";
+
+
static void
merge_in_clipboard_menu_items (GObject *widget_as_object,
TargetCallbackData *target_data)
{
- BonoboUIComponent *ui;
- Bonobo_UIContainer container;
gboolean add_selection_callback;
g_assert (target_data != NULL);
- ui = target_data->component;
- container = target_data->container;
+
add_selection_callback = target_data->editable_shares_selection_changes;
- if (ui == NULL || container == CORBA_OBJECT_NIL) {
- return;
- }
+ gtk_ui_manager_insert_action_group (target_data->ui_manager,
+ target_data->action_group, 0);
+
+ target_data->merge_id = gtk_ui_manager_add_ui_from_string (target_data->ui_manager,
+ clipboard_ui, -1, NULL);
- bonobo_ui_component_set_container (ui, container, NULL);
- bonobo_ui_component_freeze (ui, NULL);
- bonobo_ui_util_set_ui (ui,
- DATADIR,
- "nautilus-clipboard-ui.xml",
- "nautilus", NULL);
+ set_paste_sensitive_if_clipboard_contains_data (target_data->action_group);
+
+ g_signal_connect (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), "owner_change",
+ G_CALLBACK (owner_change_callback), target_data);
if (add_selection_callback) {
g_signal_connect_after (widget_as_object, "selection_changed",
G_CALLBACK (selection_changed_callback), target_data);
selection_changed_callback (GTK_WIDGET (widget_as_object),
target_data);
-
} else {
/* If we don't use sensitivity, everything should be on */
- set_clipboard_menu_items_sensitive (ui);
+ set_clipboard_menu_items_sensitive (target_data->action_group);
}
set_clipboard_items_are_merged_in (widget_as_object, TRUE);
- bonobo_ui_component_thaw (ui, NULL);
}
static void
@@ -287,18 +277,26 @@ merge_out_clipboard_menu_items (GObject *widget_as_object,
TargetCallbackData *target_data)
{
- BonoboUIComponent *ui;
gboolean selection_callback_was_added;
g_assert (target_data != NULL);
- ui = BONOBO_UI_COMPONENT (target_data->component);
- selection_callback_was_added = target_data->editable_shares_selection_changes;
- if (ui == NULL) {
- return;
+ gtk_ui_manager_remove_action_group (target_data->ui_manager,
+ target_data->action_group);
+
+ if (target_data->merge_id != 0) {
+ gtk_ui_manager_remove_ui (target_data->ui_manager,
+ target_data->merge_id);
+ target_data->merge_id = 0;
}
- bonobo_ui_component_unset_container (ui, NULL);
+ g_signal_handlers_disconnect_matched (widget_as_object,
+ G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL,
+ G_CALLBACK (owner_change_callback),
+ target_data);
+
+ selection_callback_was_added = target_data->editable_shares_selection_changes;
if (selection_callback_was_added) {
g_signal_handlers_disconnect_matched (widget_as_object,
@@ -334,24 +332,35 @@ selection_changed_callback (GtkWidget *widget,
gpointer callback_data)
{
TargetCallbackData *target_data;
- BonoboUIComponent *component;
GtkEditable *editable;
int start, end;
target_data = (TargetCallbackData *) callback_data;
g_assert (target_data != NULL);
- component = target_data->component;
editable = GTK_EDITABLE (widget);
if (gtk_editable_get_selection_bounds (editable, &start, &end) && start != end) {
- set_clipboard_menu_items_sensitive (component);
+ set_clipboard_menu_items_sensitive (target_data->action_group);
} else {
- set_clipboard_menu_items_insensitive (component);
+ set_clipboard_menu_items_insensitive (target_data->action_group);
}
}
static void
+owner_change_callback (GtkClipboard *clipboard,
+ GdkEventOwnerChange *event,
+ gpointer callback_data)
+{
+ TargetCallbackData *target_data;
+
+ g_assert (callback_data != NULL);
+ target_data = callback_data;
+
+ set_paste_sensitive_if_clipboard_contains_data (target_data->action_group);
+}
+
+static void
target_destroy_callback (GtkObject *object,
gpointer callback_data)
{
@@ -360,60 +369,76 @@ target_destroy_callback (GtkObject *object,
g_assert (callback_data != NULL);
target_data = callback_data;
- if (target_data->component != NULL) {
- bonobo_ui_component_unset_container (target_data->component, NULL);
- bonobo_object_unref (target_data->component);
- target_data->component = NULL;
+ if (clipboard_items_are_merged_in (GTK_WIDGET(object))) {
+ merge_out_clipboard_menu_items (G_OBJECT (object), callback_data);
}
- bonobo_object_release_unref (target_data->container, NULL);
- target_data->container = CORBA_OBJECT_NIL;
}
+static void
+target_data_free (TargetCallbackData *target_data)
+{
+ g_object_unref (target_data->action_group);
+ g_free (target_data);
+}
+
+static GtkActionEntry clipboard_entries[] = {
+ { "Cut", GTK_STOCK_CUT, /* name, stock id */
+ N_("Cut _Text"), "<control>x", /* label, accelerator */
+ N_("Cut the selected text to the clipboard"), /* tooltip */
+ G_CALLBACK (action_cut_callback) },
+ { "Copy", GTK_STOCK_COPY, /* name, stock id */
+ N_("_Copy Text"), "<control>c", /* label, accelerator */
+ N_("Copy the selected text to the clipboard"), /* tooltip */
+ G_CALLBACK (action_copy_callback) },
+ { "Paste", GTK_STOCK_PASTE, /* name, stock id */
+ N_("_Paste Text"), "<control>v", /* label, accelerator */
+ N_("Paste the text stored on the clipboard"), /* tooltip */
+ G_CALLBACK (action_paste_callback) },
+ { "Select All", NULL, /* name, stock id */
+ N_("Select _All"), "<control>A", /* label, accelerator */
+ N_("Select all the text in a text field"), /* tooltip */
+ G_CALLBACK (action_select_all_callback) },
+};
+
static TargetCallbackData *
initialize_clipboard_component_with_callback_data (GtkEditable *target,
- Bonobo_UIContainer ui_container,
+ GtkUIManager *ui_manager,
gboolean shares_selection_changes)
{
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("Cut", cut_callback),
- BONOBO_UI_VERB ("Copy", copy_callback),
- BONOBO_UI_VERB ("Paste", paste_callback),
- BONOBO_UI_VERB ("Clear", clear_callback),
- BONOBO_UI_VERB ("Select All", select_all_callback),
- BONOBO_UI_VERB_END
- };
- BonoboUIComponent *ui;
+ GtkActionGroup *action_group;
TargetCallbackData *target_data;
- /* Create the UI component and set up the verbs. */
- ui = bonobo_ui_component_new_default ();
- bonobo_ui_component_add_verb_list_with_data (ui, verbs, target);
-
+ action_group = gtk_action_group_new ("ClipboardActions");
+ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions (action_group,
+ clipboard_entries, G_N_ELEMENTS (clipboard_entries),
+ target);
+
/* Do the actual connection of the UI to the container at
* focus time, and disconnect at both focus and destroy
* time.
*/
target_data = g_new (TargetCallbackData, 1);
- target_data->component = ui;
- target_data->container = bonobo_object_dup_ref (ui_container, NULL);
+ target_data->ui_manager = ui_manager;
+ target_data->action_group = action_group;
target_data->editable_shares_selection_changes = shares_selection_changes;
-
+
return target_data;
}
void
nautilus_clipboard_set_up_editable (GtkEditable *target,
- Bonobo_UIContainer ui_container,
+ GtkUIManager *ui_manager,
gboolean shares_selection_changes)
{
TargetCallbackData *target_data;
g_return_if_fail (GTK_IS_EDITABLE (target));
- g_return_if_fail (ui_container != CORBA_OBJECT_NIL);
+ g_return_if_fail (ui_manager != NULL);
target_data = initialize_clipboard_component_with_callback_data
(target,
- ui_container,
+ ui_manager,
shares_selection_changes);
g_signal_connect (target, "focus_in_event",
@@ -423,90 +448,10 @@ nautilus_clipboard_set_up_editable (GtkEditable *target,
g_signal_connect (target, "destroy",
G_CALLBACK (target_destroy_callback), target_data);
- g_object_weak_ref (G_OBJECT (target), (GWeakNotify) g_free, target_data);
+ g_object_weak_ref (G_OBJECT (target), (GWeakNotify) target_data_free, target_data);
/* Call the focus changed callback once to merge if the window is
* already in focus.
*/
focus_changed_callback (GTK_WIDGET (target), NULL, target_data);
}
-
-static gboolean
-widget_was_set_up_with_selection_sensitivity (GtkWidget *widget)
-{
- return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
- "Nautilus:shares_selection_changes"));
-}
-
-static gboolean
-first_focus_callback (GtkWidget *widget,
- GdkEventAny *event,
- gpointer callback_data)
-{
- /* Don't set up the clipboard again on future focus_in's. This
- * is one-time work.
- */
- disconnect_set_up_in_control_handlers (GTK_OBJECT (widget), callback_data);
-
- /* Do the rest of the setup. */
- nautilus_clipboard_set_up_editable
- (GTK_EDITABLE (widget),
- bonobo_control_get_remote_ui_container (BONOBO_CONTROL (callback_data), NULL),
- widget_was_set_up_with_selection_sensitivity (widget));
-
- return FALSE;
-}
-
-static void
-control_destroyed_callback (GtkObject *object,
- gpointer callback_data)
-{
- disconnect_set_up_in_control_handlers (object, callback_data);
-}
-
-void
-nautilus_clipboard_set_up_editable_in_control (GtkEditable *target,
- BonoboControl *control,
- gboolean shares_selection_changes)
-{
- g_return_if_fail (GTK_IS_EDITABLE (target));
- g_return_if_fail (BONOBO_IS_CONTROL (control));
-
- if (GTK_WIDGET_HAS_FOCUS (target)) {
- nautilus_clipboard_set_up_editable
- (target,
- bonobo_control_get_remote_ui_container (control, NULL),
- shares_selection_changes);
- return;
- }
-
- /* Use lazy initialization, so that we wait until after
- * embedding. At that point, the UI container will be set up,
- * but it's not necessarily set up now.
- */
- /* We'd like to use gtk_signal_connect_while_alive, but it's
- * not compatible with gtk_signal_disconnect calls.
- */
- g_object_set_data (G_OBJECT (target), "Nautilus:shares_selection_changes",
- GINT_TO_POINTER (shares_selection_changes));
- g_signal_connect (target, "focus_in_event",
- G_CALLBACK (first_focus_callback), control);
- g_signal_connect (target, "destroy",
- G_CALLBACK (control_destroyed_callback), control);
-}
-
-static void
-disconnect_set_up_in_control_handlers (GtkObject *object,
- gpointer callback_data)
-{
- g_signal_handlers_disconnect_matched (object,
- G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
- G_CALLBACK (first_focus_callback),
- callback_data);
- g_signal_handlers_disconnect_matched (object,
- G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
- G_CALLBACK (control_destroyed_callback),
- callback_data);
-}
diff --git a/libnautilus/nautilus-clipboard.h b/libnautilus-private/nautilus-clipboard.h
index 20b15511d..041e9c69c 100644
--- a/libnautilus/nautilus-clipboard.h
+++ b/libnautilus-private/nautilus-clipboard.h
@@ -27,28 +27,19 @@
#define NAUTILUS_CLIPBOARD_H
#include <gtk/gtkeditable.h>
-#include <bonobo/bonobo-control.h>
+#include <gtk/gtkuimanager.h>
/* This makes this editable put clipboard commands into the passed UI
- * container when the editable is in focus. Callers in Nautilus
- * normally get the UI container from
- * nautilus_window_get_bonobo_ui_container. */
+ * manager when the editable is in focus. Callers in Nautilus
+ * normally get the UI manager from
+ * nautilus_window_get_ui_manager. */
/* The shares selection changes argument should be set to true if the
* editable is a widget that uses the signal "selection_changed" to
* tell others about text selection changes. The NautilusEntry widget
* is currently the only widget in nautilus that shares selection
* changes. */
void nautilus_clipboard_set_up_editable (GtkEditable *target,
- Bonobo_UIContainer container,
- gboolean shares_selection_changes);
-
-/* Components should use this convenient cover instead of the call
- * above. This cover waits until the UI container shows up, so it can be
- * called even before the control has a UI container. Set the
- */
-/* Set the shares_selection changes as for the nautilus_clipboard_set_up_editable */
-void nautilus_clipboard_set_up_editable_in_control (GtkEditable *target,
- BonoboControl *control,
+ GtkUIManager *ui_manager,
gboolean shares_selection_changes);
#endif /* NAUTILUS_CLIPBOARD_H */
diff --git a/libnautilus-private/nautilus-desktop-link.c b/libnautilus-private/nautilus-desktop-link.c
index 5d3ae3440..2d88a5f2b 100644
--- a/libnautilus-private/nautilus-desktop-link.c
+++ b/libnautilus-private/nautilus-desktop-link.c
@@ -63,7 +63,6 @@ static void trash_state_changed_callback (NautilusTrashMonitor *trash_monito
gboolean state,
gpointer callback_data);
static void nautilus_desktop_link_changed (NautilusDesktopLink *link);
-static void home_uri_changed (gpointer callback_data);
EEL_CLASS_BOILERPLATE (NautilusDesktopLink,
nautilus_desktop_link,
@@ -133,16 +132,9 @@ nautilus_desktop_link_new (NautilusDesktopLinkType type)
link->details->display_name = eel_preferences_get (NAUTILUS_PREFERENCES_DESKTOP_HOME_NAME);
-#ifdef WEB_NAVIGATION_ENABLED
- link->details->activation_uri = eel_preferences_get (NAUTILUS_PREFERENCES_HOME_URI);
-#else
link->details->activation_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
-#endif
link->details->icon = g_strdup ("gnome-fs-home");
- eel_preferences_add_callback (NAUTILUS_PREFERENCES_HOME_URI,
- home_uri_changed,
- link);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_DESKTOP_HOME_NAME,
home_name_changed,
link);
@@ -301,24 +293,6 @@ trash_state_changed_callback (NautilusTrashMonitor *trash_monitor,
nautilus_desktop_link_changed (link);
}
-static void
-home_uri_changed (gpointer callback_data)
-{
- NautilusDesktopLink *link;
-
- link = NAUTILUS_DESKTOP_LINK (callback_data);
-
- g_free (link->details->activation_uri);
-#ifdef WEB_NAVIGATION_ENABLED
- link->details->activation_uri = eel_preferences_get (NAUTILUS_PREFERENCES_HOME_URI);
-#else
- link->details->activation_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
-#endif
-
- nautilus_desktop_link_changed (link);
-}
-
-
gboolean
nautilus_desktop_link_can_rename (NautilusDesktopLink *link)
{
@@ -383,9 +357,6 @@ desktop_link_finalize (GObject *object)
}
if (link->details->type == NAUTILUS_DESKTOP_LINK_HOME) {
- eel_preferences_remove_callback (NAUTILUS_PREFERENCES_HOME_URI,
- home_uri_changed,
- link);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_DESKTOP_HOME_NAME,
home_name_changed,
link);
diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c
index 685d9f693..394e09107 100644
--- a/libnautilus-private/nautilus-directory-async.c
+++ b/libnautilus-private/nautilus-directory-async.c
@@ -34,7 +34,6 @@
#include "nautilus-link.h"
#include "nautilus-marshal.h"
#include "nautilus-metafile.h"
-#include "nautilus-search-uri.h"
#include <eel/eel-glib-extensions.h>
#include <eel/eel-string.h>
#include <gtk/gtkmain.h>
@@ -1601,6 +1600,10 @@ nautilus_async_destroying_file (NautilusFile *file)
directory->details->link_info_read_state->file = NULL;
changed = TRUE;
}
+ if (directory->details->extension_info_file == file) {
+ directory->details->extension_info_file = NULL;
+ changed = TRUE;
+ }
/* Let the directory take care of the rest. */
if (changed) {
@@ -1941,75 +1944,6 @@ mark_all_files_unconfirmed (NautilusDirectory *directory)
}
}
-#if GNOME2_HAS_MEDUSA
-
-static gboolean
-should_display_file_name (const char *name,
- GnomeVFSDirectoryFilterOptions options)
-{
- /* Note that the name is URI-encoded, but this should not
- * affect the . or the ~.
- */
-
- if ((options & GNOME_VFS_DIRECTORY_FILTER_NODOTFILES) != 0
- && nautilus_file_name_matches_hidden_pattern (name)) {
- return FALSE;
- }
-
- if ((options & GNOME_VFS_DIRECTORY_FILTER_NOBACKUPFILES) != 0
- && nautilus_file_name_matches_backup_pattern (name)) {
- return FALSE;
- }
-
- /* Note that we don't bother to check for "." or ".." here, because
- * this function is used only for search results, which never include
- * those special files. If we later use this function more generally,
- * we might have to change this.
- */
- return TRUE;
-}
-
-/* Filter search results based on user preferences. This must be done
- * differently than filtering other files because the search results
- * are encoded: the entire file path is encoded and stored as the file
- * name.
- */
-static gboolean
-filter_search_uri (const GnomeVFSFileInfo *info, gpointer data)
-{
- GnomeVFSDirectoryFilterOptions options;
- char *real_file_uri, *filename;
- gboolean result;
-
- options = GPOINTER_TO_INT (data);
-
- real_file_uri = nautilus_get_target_uri_from_search_result_name (info->name);
- filename = g_path_get_basename (real_file_uri);
- result = should_display_file_name (filename, options);
- g_free (real_file_uri);
- g_free (filename);
-
- return result;
-}
-
-static GnomeVFSDirectoryFilter *
-get_file_count_filter (NautilusDirectory *directory)
-{
- if (nautilus_is_search_uri (directory->details->uri)) {
- return gnome_vfs_directory_filter_new_custom
- (filter_search_uri,
- GNOME_VFS_DIRECTORY_FILTER_NEEDS_NAME,
- GINT_TO_POINTER (get_filter_options_for_directory_count ()));
- }
-
- return gnome_vfs_directory_filter_new
- (GNOME_VFS_DIRECTORY_FILTER_NONE,
- get_filter_options_for_directory_count (),
- NULL);
-}
-
-#endif
-
static void
read_dot_hidden_file (NautilusDirectory *directory)
{
@@ -3219,13 +3153,18 @@ static void
extension_info_cancel (NautilusDirectory *directory)
{
if (directory->details->extension_info_in_progress != NULL) {
- nautilus_info_provider_cancel_update
- (directory->details->extension_info_provider,
- directory->details->extension_info_in_progress);
+ if (directory->details->extension_info_idle) {
+ g_source_remove (directory->details->extension_info_idle);
+ } else {
+ nautilus_info_provider_cancel_update
+ (directory->details->extension_info_provider,
+ directory->details->extension_info_in_progress);
+ }
directory->details->extension_info_in_progress = NULL;
directory->details->extension_info_file = NULL;
directory->details->extension_info_provider = NULL;
+ directory->details->extension_info_idle = 0;
async_job_end (directory, "extension info");
}
@@ -3290,7 +3229,8 @@ info_provider_idle_callback (gpointer user_data)
directory->details->extension_info_file = NULL;
directory->details->extension_info_provider = NULL;
directory->details->extension_info_in_progress = NULL;
-
+ directory->details->extension_info_idle = 0;
+
finish_info_provider (directory, file, response->provider);
}
@@ -3311,7 +3251,10 @@ info_provider_callback (NautilusInfoProvider *provider,
response->result = result;
response->directory = NAUTILUS_DIRECTORY (user_data);
- g_idle_add (info_provider_idle_callback, response);
+ response->directory->details->extension_info_idle =
+ g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
+ info_provider_idle_callback, response,
+ g_free);
}
static void
diff --git a/libnautilus-private/nautilus-directory-background.c b/libnautilus-private/nautilus-directory-background.c
index 75d7ddf56..9c4e60481 100644
--- a/libnautilus-private/nautilus-directory-background.c
+++ b/libnautilus-private/nautilus-directory-background.c
@@ -618,7 +618,6 @@ background_changed_callback (EelBackground *background,
action = default_drag_action;
- g_print ("checking action, default_drag_action is %d\n", action);
}
if (action == NAUTILUS_DND_ACTION_SET_AS_GLOBAL_BACKGROUND) {
diff --git a/libnautilus-private/nautilus-directory-metafile-monitor.c b/libnautilus-private/nautilus-directory-metafile-monitor.c
index 3cc32d56a..4297d0f18 100644
--- a/libnautilus-private/nautilus-directory-metafile-monitor.c
+++ b/libnautilus-private/nautilus-directory-metafile-monitor.c
@@ -28,7 +28,6 @@
#include <eel/eel-gtk-macros.h>
#include <eel/eel-glib-extensions.h>
-#include "nautilus-bonobo-extensions.h"
struct NautilusMetafileMonitorDetails {
NautilusDirectory *directory;
diff --git a/libnautilus-private/nautilus-directory-private.h b/libnautilus-private/nautilus-directory-private.h
index d60554ea1..4c0cf4e0c 100644
--- a/libnautilus-private/nautilus-directory-private.h
+++ b/libnautilus-private/nautilus-directory-private.h
@@ -32,7 +32,7 @@
#include <libnautilus-private/nautilus-file.h>
#include <libnautilus-private/nautilus-metafile-server.h>
#include <libnautilus-private/nautilus-monitor.h>
-#include <libnautilus/nautilus-idle-queue.h>
+#include <libnautilus-private/nautilus-idle-queue.h>
#include <libnautilus-extension/nautilus-info-provider.h>
#include <libxml/tree.h>
@@ -109,6 +109,7 @@ struct NautilusDirectoryDetails
NautilusFile *extension_info_file;
NautilusInfoProvider *extension_info_provider;
NautilusOperationHandle *extension_info_in_progress;
+ guint extension_info_idle;
TopLeftTextReadState *top_left_read_state;
diff --git a/libnautilus-private/nautilus-drag-window.c b/libnautilus-private/nautilus-drag-window.c
deleted file mode 100644
index 67771c35c..000000000
--- a/libnautilus-private/nautilus-drag-window.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2001 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: John Harper <jsh@eazel.com>
- *
- */
-
-/* Registering that a window may be used as a drag 'n drop source */
-
-#include <config.h>
-#include "nautilus-drag-window.h"
-
-#include <eel/eel-gdk-extensions.h>
-#include <gtk/gtk.h>
-#include <X11/Xatom.h>
-#include <gdk/gdkx.h>
-#include <gdk/gdkprivate.h>
-
-/* State for handling focus/raise */
-typedef struct NautilusDragWindowDetails NautilusDragWindowDetails;
-struct NautilusDragWindowDetails {
- gboolean in_button_press;
- gboolean pending_focus;
- gboolean pending_raise;
-
- Time focus_timestamp;
-
- guint focus_timeout_tag;
-};
-
-/* Delay in milliseconds between receiving a TAKE_FOCUS or RAISE_WINDOW
- * client message, and assuming that there's no following button-press
- * event. This seems to be large enough to work, but small enough to be
- * unnoticeable to the user.
- */
-#define WINDOW_FOCUS_TIMEOUT 50
-
-/* Key used to store a NautilusDragWindowDetails structure in each
- * registered window's object data hash
- */
-#define NAUTILUS_DRAG_WINDOW_DETAILS_KEY "nautilus-drag-window-details"
-
-/* Return the nearest ancestor of WIDGET that has type WIDGET_TYPE. But only
- * if there's no widget between the two with type BLOCKING_TYPE.
- */
-static GtkWidget *
-get_ancestor_blocked_by (GtkWidget *widget,
- GType widget_type,
- GType blocking_type)
-{
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- while (widget != NULL)
- {
- if (g_type_is_a (GTK_WIDGET_TYPE (widget), widget_type))
- return widget;
-
- else if (g_type_is_a (GTK_WIDGET_TYPE (widget), blocking_type))
- return NULL;
-
- widget = widget->parent;
- }
-
- return NULL;
-}
-
-/* Returns the details structure associated with WINDOW, or a null pointer
- * if no such structure exists
- */
-static NautilusDragWindowDetails *
-get_details (GtkWindow *window)
-{
- NautilusDragWindowDetails *details;
-
- details = g_object_get_data (G_OBJECT (window),
- NAUTILUS_DRAG_WINDOW_DETAILS_KEY);
- return details;
-}
-
-/* Commit any pending focus/raise requests for WINDOW. */
-static void
-execute_pending_requests (GtkWindow *window,
- NautilusDragWindowDetails *details)
-{
- if (GTK_WIDGET_REALIZED (window)) {
- if (details->pending_focus) {
- eel_gdk_window_focus (GTK_WIDGET (window)->window,
- details->focus_timestamp);
- details->pending_focus = FALSE;
- }
- if (details->pending_raise) {
- gdk_window_raise (GTK_WIDGET (window)->window);
- details->pending_raise = FALSE;
- }
- }
-}
-
-/* Called when no button-press event arrived occurred shortly after
- * receiving a TAKE_FOCUS or RAISE_WINDOW request. So just commit
- * the pending requests.
- */
-static gint
-focus_timeout_callback (gpointer data)
-{
- GtkWindow *window;
- NautilusDragWindowDetails *details;
-
- window = GTK_WINDOW (data);
- details = get_details (window);
-
- if (details != NULL) {
- execute_pending_requests (window, details);
-
- details->focus_timeout_tag = 0;
- }
-
- /* Only ever a one-shot timeout */
- return FALSE;
-}
-
-
-static void
-remove_focus_timeout (GtkWindow *window)
-{
- NautilusDragWindowDetails *details;
-
- details = get_details (window);
-
- if (details != NULL && details->focus_timeout_tag != 0) {
- g_source_remove (details->focus_timeout_tag);
- details->focus_timeout_tag = 0;
- }
-}
-
-static void
-set_focus_timeout (GtkWindow *window)
-{
- NautilusDragWindowDetails *details;
-
- details = get_details (window);
-
- if (details != NULL) {
- remove_focus_timeout (window);
- details->focus_timeout_tag
- = g_timeout_add (WINDOW_FOCUS_TIMEOUT,
- focus_timeout_callback, window);
- }
-}
-
-/* Called for all button-press events; sets the `in_button_press' flag */
-static gboolean
-button_press_emission_callback (GSignalInvocationHint *ihint,
- guint n_params, const GValue *params,
- gpointer data)
-{
- GtkWidget *window;
- NautilusDragWindowDetails *details;
-
- /* This blocking is kind of a hack. But it seems necessary,
- * otherwise we can get duped into counting unbalanced
- * press/release events, which isn't healthy
- */
- window = get_ancestor_blocked_by (GTK_WIDGET (g_value_get_object (&params[0])),
- GTK_TYPE_WINDOW,
- GTK_TYPE_MENU_SHELL);
- if (window != NULL) {
- details = get_details (GTK_WINDOW (window));
- if (details != NULL) {
- remove_focus_timeout (GTK_WINDOW (window));
-
- if (!details->in_button_press) {
- details->in_button_press = TRUE;
- } else {
- /* We never got the last button
- * release. Adapt.
- */
- execute_pending_requests (GTK_WINDOW (window),
- details);
- details->in_button_press = FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-/* Called for button-release events; commits any pending focus/raise */
-static gboolean
-button_release_emission_callback (GSignalInvocationHint *ihint,
- guint n_params, const GValue *params,
- gpointer data)
-{
- GtkWidget *window;
- NautilusDragWindowDetails *details;
-
- window = get_ancestor_blocked_by (GTK_WIDGET (g_value_get_object (&params[0])),
- GTK_TYPE_WINDOW,
- GTK_TYPE_MENU_SHELL);
- if (window != NULL) {
- details = get_details (GTK_WINDOW (window));
- if (details != NULL) {
- execute_pending_requests (GTK_WINDOW (window),
- details);
- details->in_button_press = FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* Called when a drag is started. If a drag-window is found above the
- * widget emitting the signal, cancel any pending focus/raise requests
- */
-static gboolean
-drag_begin_emission_callback (GSignalInvocationHint *ihint,
- guint n_params, const GValue *params,
- gpointer data)
-{
- GtkWidget *window;
- NautilusDragWindowDetails *details;
-
- window = gtk_widget_get_toplevel (GTK_WIDGET (g_value_get_object (&params[0])));
-
- if (window != NULL) {
- details = get_details (GTK_WINDOW (window));
- if (details != NULL) {
-
- details->pending_focus = FALSE;
- details->pending_raise = FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* The process-wide filter for WM_PROTOCOLS client messages */
-static GdkFilterReturn
-wm_protocols_filter (GdkXEvent *xev, GdkEvent *event, gpointer data)
-{
- XEvent *xevent;
- GtkWindow *window;
- NautilusDragWindowDetails *details;
-
- xevent = (XEvent *)xev;
-
- gdk_window_get_user_data (event->any.window, (gpointer *) &window);
- if (window != NULL) {
- details = get_details (window);
- } else {
- details = NULL;
- }
-
- if ((Atom) xevent->xclient.data.l[0] == gdk_x11_get_xatom_by_name ("WM_DELETE_WINDOW")) {
-
- /* (copied from gdkevents.c) */
-
- /* The delete window request specifies a window
- * to delete. We don't actually destroy the
- * window because "it is only a request". (The
- * window might contain vital data that the
- * program does not want destroyed). Instead
- * the event is passed along to the program,
- * which should then destroy the window.
- */
-
- event->any.type = GDK_DELETE;
- return GDK_FILTER_TRANSLATE;
-
- } else if ((Atom) xevent->xclient.data.l[0] == gdk_x11_get_xatom_by_name ("WM_TAKE_FOCUS")) {
-
- if (details != NULL) {
- details->pending_focus = TRUE;
- details->focus_timestamp = xevent->xclient.data.l[1];
-
- /* Wait to see if a button-press event
- * is received in the near future.
- */
- set_focus_timeout (window);
- }
- return GDK_FILTER_REMOVE;
-
- } else if ((Atom) xevent->xclient.data.l[0] == gdk_x11_get_xatom_by_name ("_SAWFISH_WM_RAISE_WINDOW")) {
-
- if (details != NULL) {
- details->pending_raise = TRUE;
-
- /* Wait to see if a button-press event
- * is received in the near future.
- */
- set_focus_timeout (window);
- }
- return GDK_FILTER_REMOVE;
- }
- else {
- return GDK_FILTER_CONTINUE;
- }
-}
-
-static void
-nautilus_drag_window_destroy (GtkObject *object, gpointer data)
-{
- remove_focus_timeout (GTK_WINDOW (object));
-}
-
-static void
-nautilus_drag_window_realize (GtkWidget *widget, gpointer data)
-{
- GdkAtom protocols[3];
-
- /* Tell the window manager _not_ to focus this window by itself */
- eel_gdk_window_set_wm_hints_input (widget->window, FALSE);
-
- /* Set WM_PROTOCOLS to the usual two atoms plus something that tells
- * sawfish to send messages telling us when we might want to raise
- * the window. (This won't work with other wm's, but it won't
- * break anything either.)
- */
- protocols[0] = gdk_atom_intern ("WM_DELETE_WINDOW", FALSE);
- protocols[1] = gdk_atom_intern ("WM_TAKE_FOCUS", FALSE);
- protocols[2] = gdk_atom_intern ("_NET_WM_PING", FALSE);
- eel_gdk_window_set_wm_protocols (widget->window, protocols, 3);
-}
-
-/* Public entry point */
-
-/* initialize the instance's fields */
-void
-nautilus_drag_window_register (GtkWindow *window)
-{
- static gboolean initialized = FALSE;
-
- NautilusDragWindowDetails *details;
- guint signal_id;
-
- /* FIXME: This is disabled until we come up with a better
- * way to do this. Havoc had some ideas.
- */
- return;
-
- if (!initialized) {
- /* Add emission hooks for the signals we need to monitor
- */
- signal_id = g_signal_lookup ("button_press_event",
- GTK_TYPE_WIDGET);
- g_signal_add_emission_hook (signal_id, 0,
- button_press_emission_callback, NULL, NULL);
- signal_id = g_signal_lookup ("button_release_event",
- GTK_TYPE_WIDGET);
- g_signal_add_emission_hook (signal_id, 0,
- button_release_emission_callback, NULL, NULL);
- signal_id = g_signal_lookup ("drag_begin",
- GTK_TYPE_WIDGET);
- g_signal_add_emission_hook (signal_id, 0,
- drag_begin_emission_callback, NULL, NULL);
-
- /* Override the standard GTK filter for handling WM_PROTOCOLS
- * client messages
- */
- gdk_add_client_message_filter (gdk_atom_intern ("WM_PROTOCOLS", FALSE),
- wm_protocols_filter, NULL);
-
- initialized = TRUE;
- }
-
- details = g_new0 (NautilusDragWindowDetails, 1);
-
- g_object_set_data_full (G_OBJECT (window),
- NAUTILUS_DRAG_WINDOW_DETAILS_KEY,
- details, g_free);
-
- g_signal_connect (window, "realize",
- G_CALLBACK (nautilus_drag_window_realize), NULL);
- g_signal_connect (window, "destroy",
- G_CALLBACK (nautilus_drag_window_destroy), NULL);
-}
diff --git a/libnautilus-private/nautilus-drag-window.h b/libnautilus-private/nautilus-drag-window.h
deleted file mode 100644
index 81e7a9c52..000000000
--- a/libnautilus-private/nautilus-drag-window.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2001 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: John Harper <jsh@eazel.com>
- *
- */
-
-#ifndef NAUTILUS_DRAG_WINDOW_H
-#define NAUTILUS_DRAG_WINDOW_H
-
-#include <gtk/gtkwindow.h>
-
-/* Call this function before WINDOW has been realized. It will hook
- * into the window so that it automatically supports the correct focus
- * policy when dragging objects from within the window. (This policy is
- * *not* to focus or raise the window when the activating click is used
- * to drag something)
- */
-
-void nautilus_drag_window_register (GtkWindow *window);
-
-#endif /* NAUTILUS_DRAG_WINDOW_H */
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index ba5ab5506..5bbf8fcec 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -811,8 +811,7 @@ nautilus_file_can_execute (NautilusFile *file)
static gboolean
is_desktop_file (NautilusFile *file)
{
- return nautilus_file_is_mime_type (file, "application/x-gnome-app-info") ||
- nautilus_file_is_mime_type (file, "application/x-desktop");
+ return nautilus_file_is_mime_type (file, "application/x-desktop");
}
static gboolean
@@ -5156,9 +5155,9 @@ nautilus_file_get_symbolic_link_target_uri (NautilusFile *file)
gboolean
nautilus_file_is_nautilus_link (NautilusFile *file)
{
- return nautilus_file_is_mime_type (file, "application/x-nautilus-link") ||
- nautilus_file_is_mime_type (file, "application/x-gnome-app-info") ||
- nautilus_file_is_mime_type (file, "application/x-desktop");
+ /* NOTE: I removed the historical link here, because i don't think we
+ even detect that mimetype anymore */
+ return nautilus_file_is_mime_type (file, "application/x-desktop");
}
/**
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index 5a12b561e..0492dce8e 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -52,7 +52,6 @@ static const char *EXTRA_MONITOR_PATHS[] = { "/system/gnome_vfs",
static void global_preferences_install_defaults (void);
static void global_preferences_register_enumerations (void);
static gpointer default_font_callback (void);
-static gpointer default_home_location_callback (void);
static void import_old_preferences_if_needed (void);
static gpointer default_home_link_name (void);
static gpointer default_computer_link_name (void);
@@ -382,10 +381,6 @@ static const PreferenceDefault preference_defaults[] = {
NULL, NULL,
NULL
},
- { NAUTILUS_PREFERENCES_HIDE_BUILT_IN_BOOKMARKS,
- PREFERENCE_BOOLEAN,
- GINT_TO_POINTER (FALSE)
- },
/* FIXME bugzilla.gnome.org 41245: Saved in pixels instead of in %? */
{ NAUTILUS_PREFERENCES_SIDEBAR_WIDTH,
PREFERENCE_INTEGER,
@@ -427,11 +422,6 @@ static const PreferenceDefault preference_defaults[] = {
NULL, NULL,
"default_folder_viewer"
},
- /* Home URI */
- { NAUTILUS_PREFERENCES_HOME_URI,
- PREFERENCE_STRING,
- NULL, default_home_location_callback, g_free
- },
{ NAUTILUS_PREFERENCES_DESKTOP_FONT,
PREFERENCE_STRING,
NULL, default_font_callback, g_free
@@ -666,12 +656,6 @@ default_font_callback (void)
return g_strdup ("sans 12");
}
-static gpointer
-default_home_location_callback (void)
-{
- return gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
-}
-
/*
* Public functions
*/
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index 5e8d628b0..3596681bc 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -71,10 +71,6 @@ typedef enum
/* Sidebar panels */
#define NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES "sidebar_panels/tree/show_only_directories"
-/* Navigation */
-#define NAUTILUS_PREFERENCES_HOME_URI "preferences/home_uri"
-#define NAUTILUS_PREFERENCES_HIDE_BUILT_IN_BOOKMARKS "preferences/hide_built_in_bookmarks"
-
/* Single/Double click preference */
#define NAUTILUS_PREFERENCES_CLICK_POLICY "preferences/click_policy"
diff --git a/libnautilus-private/nautilus-icon-factory.c b/libnautilus-private/nautilus-icon-factory.c
index aab5bbb58..abb659faf 100644
--- a/libnautilus-private/nautilus-icon-factory.c
+++ b/libnautilus-private/nautilus-icon-factory.c
@@ -1501,6 +1501,14 @@ nautilus_get_icon_size_for_zoom_level (NautilusZoomLevel zoom_level)
g_return_val_if_reached (NAUTILUS_ICON_SIZE_STANDARD);
}
+float
+nautilus_get_relative_icon_size_for_zoom_level (NautilusZoomLevel zoom_level)
+{
+ return (float)nautilus_get_icon_size_for_zoom_level (zoom_level) / NAUTILUS_ICON_SIZE_STANDARD;
+}
+
+
+
/* Convenience cover for nautilus_icon_factory_get_icon_for_file
* and nautilus_icon_factory_get_pixbuf_for_icon.
*/
diff --git a/libnautilus-private/nautilus-icon-factory.h b/libnautilus-private/nautilus-icon-factory.h
index 1b1a055c7..e83963d90 100644
--- a/libnautilus-private/nautilus-icon-factory.h
+++ b/libnautilus-private/nautilus-icon-factory.h
@@ -105,6 +105,7 @@ GObject * nautilus_icon_factory_get (void);
/* Relationship between zoom levels and icons sizes. */
guint nautilus_get_icon_size_for_zoom_level (NautilusZoomLevel zoom_level);
+float nautilus_get_relative_icon_size_for_zoom_level (NautilusZoomLevel zoom_level);
/* Choose the appropriate icon, but don't render it yet. */
char * nautilus_icon_factory_get_icon_for_file (NautilusFile *file,
diff --git a/libnautilus/nautilus-idle-queue.c b/libnautilus-private/nautilus-idle-queue.c
index 431b8d39a..431b8d39a 100644
--- a/libnautilus/nautilus-idle-queue.c
+++ b/libnautilus-private/nautilus-idle-queue.c
diff --git a/libnautilus/nautilus-idle-queue.h b/libnautilus-private/nautilus-idle-queue.h
index 3446973d3..3446973d3 100644
--- a/libnautilus/nautilus-idle-queue.h
+++ b/libnautilus-private/nautilus-idle-queue.h
diff --git a/libnautilus-private/nautilus-lib-self-check-functions.h b/libnautilus-private/nautilus-lib-self-check-functions.h
index 3935595b1..b27db7b8a 100644
--- a/libnautilus-private/nautilus-lib-self-check-functions.h
+++ b/libnautilus-private/nautilus-lib-self-check-functions.h
@@ -39,7 +39,6 @@ void nautilus_run_lib_self_checks (void);
*/
#define NAUTILUS_LIB_FOR_EACH_SELF_CHECK_FUNCTION(macro) \
- macro (nautilus_self_check_search_uri) \
macro (nautilus_self_check_file_utilities) \
macro (nautilus_self_check_file_operations) \
macro (nautilus_self_check_directory) \
diff --git a/libnautilus-private/nautilus-medusa-support.c b/libnautilus-private/nautilus-medusa-support.c
deleted file mode 100644
index 92f5d23e1..000000000
--- a/libnautilus-private/nautilus-medusa-support.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-medusa-support.c - Covers for access to medusa
- from nautilus
-
- Copyright (C) 2001 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: Ramiro Estrugo <ramiro@eazel.com>
- Rebecca Schulman <rebecka@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-medusa-support.h"
-#include <libgnome/gnome-i18n.h>
-
-#include <eel/eel-glib-extensions.h>
-#include <eel/eel-string.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <sys/types.h>
-
-#ifdef HAVE_MEDUSA
-#include <libmedusa/medusa-system-state.h>
-#endif
-
-gboolean
-nautilus_medusa_services_are_enabled (void)
-{
-#ifdef HAVE_MEDUSA
- return medusa_system_services_are_enabled ();
-#else
- return FALSE;
-#endif
-}
-
-
-NautilusCronStatus
-nautilus_medusa_check_cron_is_enabled (void)
-{
- DIR *proc_directory;
- struct dirent *file;
- char *stat_file_name;
- FILE *stat_file;
- char stat_file_data[128];
- const char *stat_file_process_name;
- int process_number, bytes_read;
- NautilusCronStatus status;
-
- /* We figure out whether cron is running by reading the proc
- directory, and checking for a process named or ending with
- "crond" */
-
- proc_directory = opendir ("/proc");
- if (proc_directory == NULL) {
- return NAUTILUS_CRON_STATUS_UNKNOWN;
- }
-
- status = NAUTILUS_CRON_STATUS_UNKNOWN;
-
- while ((file = readdir (proc_directory)) != NULL) {
- /* Process files have numbers */
- if (!eel_str_to_int (file->d_name, &process_number)) {
- continue;
- }
-
- /* Since we've seen at least one process file, we can change our state
- * from "unknown" to "presumed off until proved otherwise".
- */
- status = NAUTILUS_CRON_STATUS_OFF;
-
- stat_file_name = g_strdup_printf ("/proc/%d/stat", process_number);
- stat_file = fopen (stat_file_name, "r");
- g_free (stat_file_name);
-
- if (stat_file == NULL) {
- continue;
- }
-
- bytes_read = fread (stat_file_data, 1, sizeof (stat_file_data) - 1, stat_file);
- fclose (stat_file);
- stat_file_data[bytes_read] = '\0';
-
- stat_file_process_name = strchr (stat_file_data, ' ');
-
- if (eel_str_has_prefix (stat_file_process_name, " (crond)") ||
- eel_str_has_prefix (stat_file_process_name, " (cron)")) {
- status = NAUTILUS_CRON_STATUS_ON;
- break;
- }
- }
-
- closedir (proc_directory);
- return status;
-}
-
-#ifdef HAVE_MEDUSA
-static const char *
-nautilus_medusa_get_configuration_file_path (void)
-{
- return medusa_get_configuration_file_path ();
-}
-#endif
-
-char *
-nautilus_medusa_get_explanation_of_enabling (void)
-{
-#ifdef HAVE_MEDUSA
- return g_strdup_printf (_("If you would like to enable fast searches, you can "
- "edit the file %s as root. "
- "Setting the enabled flag to \"yes\" will turn medusa "
- "services on.\n"
- "To start indexing and search services right away, you "
- "should also run the following commands as root:\n"
- "\n"
- "medusa-indexd\n"
- "medusa-searchd\n"
- "\n"
- "Fast searches will not be available until an initial "
- "index of your files has been created. This may take "
- "a long time."),
- nautilus_medusa_get_configuration_file_path ());
-#else
- return g_strdup_printf (_("Medusa, the application that performs searches, cannot be found on "
- "your system. If you have compiled nautilus yourself, "
- "you will need to install a copy of medusa and recompile nautilus. "
- "(A copy of Medusa may be available at ftp://ftp.gnome.org)\n"
- "If you are using a packaged version of Nautilus, fast searching is "
- "not available.\n"));
-#endif
-}
diff --git a/libnautilus-private/nautilus-medusa-support.h b/libnautilus-private/nautilus-medusa-support.h
deleted file mode 100644
index 048f7860e..000000000
--- a/libnautilus-private/nautilus-medusa-support.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-medusa-support.h - Covers for access to medusa
- from nautilus
-
-
- Copyright (C) 2001 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: Ramiro Estrugo <ramiro@eazel.com>
- Rebecca Schulman <rebecka@eazel.com>
-*/
-
-#ifndef NAUTILUS_MEDUSA_SUPPORT_H
-#define NAUTILUS_MEDUSA_SUPPORT_H
-
-#include <glib/gtypes.h>
-
-typedef void (* NautilusMedusaChangedCallback) (gpointer data);
-
-typedef enum {
- NAUTILUS_CRON_STATUS_ON,
- NAUTILUS_CRON_STATUS_OFF,
- NAUTILUS_CRON_STATUS_UNKNOWN
-} NautilusCronStatus;
-
-
-gboolean nautilus_medusa_services_are_enabled (void);
-NautilusCronStatus nautilus_medusa_check_cron_is_enabled (void);
-char * nautilus_medusa_get_explanation_of_enabling (void);
-
-#endif /* NAUTILUS_MEDUSA_SUPPORT_H */
-
diff --git a/libnautilus-private/nautilus-metafile-server.idl b/libnautilus-private/nautilus-metafile-server.idl
index afa1a6617..0410225e0 100644
--- a/libnautilus-private/nautilus-metafile-server.idl
+++ b/libnautilus-private/nautilus-metafile-server.idl
@@ -24,10 +24,10 @@
#define NAUTILUS_METAFILE_SERVER_IDL_INCLUDED
#include <Bonobo.idl>
-#include <libnautilus/nautilus-view-component.idl>
module Nautilus {
+ typedef string URI;
typedef sequence<string> FileNameList;
/* NautilusFiles creates (and registers) MetafileMonitors in order
diff --git a/libnautilus-private/nautilus-metafile.c b/libnautilus-private/nautilus-metafile.c
index a437b1833..97130e6d4 100644
--- a/libnautilus-private/nautilus-metafile.c
+++ b/libnautilus-private/nautilus-metafile.c
@@ -23,14 +23,12 @@
#include <config.h>
#include "nautilus-metafile.h"
-#include "nautilus-bonobo-extensions.h"
#include "nautilus-directory.h"
#include "nautilus-directory.h"
#include "nautilus-file-private.h"
#include "nautilus-file-utilities.h"
#include "nautilus-global-preferences.h"
#include "nautilus-metadata.h"
-#include "nautilus-search-uri.h"
#include "nautilus-thumbnails.h"
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-macros.h>
@@ -1645,8 +1643,7 @@ allow_metafile (NautilusMetafile *metafile)
* access inside gnome-vfs.
*/
uri = metafile->details->directory_uri;
- if (nautilus_is_search_uri (uri)
- || eel_istr_has_prefix (uri, "ghelp:")
+ if (eel_istr_has_prefix (uri, "ghelp:")
|| eel_istr_has_prefix (uri, "gnome-help:")
|| eel_istr_has_prefix (uri, "help:")
|| eel_istr_has_prefix (uri, "info:")
diff --git a/libnautilus-private/nautilus-mime-actions.c b/libnautilus-private/nautilus-mime-actions.c
index 830301535..dad4a4e18 100644
--- a/libnautilus-private/nautilus-mime-actions.c
+++ b/libnautilus-private/nautilus-mime-actions.c
@@ -28,7 +28,6 @@
#include "nautilus-file-attributes.h"
#include "nautilus-file.h"
#include "nautilus-metadata.h"
-#include <bonobo-activation/bonobo-activation-activate.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-string.h>
#include <libgnomevfs/gnome-vfs-application-registry.h>
diff --git a/libnautilus-private/nautilus-program-choosing.h b/libnautilus-private/nautilus-program-choosing.h
index 5c3c0a1e1..48d5c3249 100644
--- a/libnautilus-private/nautilus-program-choosing.h
+++ b/libnautilus-private/nautilus-program-choosing.h
@@ -29,15 +29,12 @@
#include <gtk/gtkwindow.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <libnautilus-private/nautilus-file.h>
-#include <libnautilus-private/nautilus-view-identifier.h>
#define NAUTILUS_COMMAND_SPECIFIER "command:"
#define NAUTILUS_DESKTOP_COMMAND_SPECIFIER "desktop-file:"
typedef void (*NautilusApplicationChoiceCallback) (GnomeVFSMimeApplication *application,
gpointer callback_data);
-typedef void (*NautilusComponentChoiceCallback) (NautilusViewIdentifier *identifier,
- gpointer callback_data);
void nautilus_launch_application (GnomeVFSMimeApplication *application,
NautilusFile *file,
diff --git a/libnautilus-private/nautilus-search-uri.c b/libnautilus-private/nautilus-search-uri.c
deleted file mode 100644
index 3e886c53a..000000000
--- a/libnautilus-private/nautilus-search-uri.c
+++ /dev/null
@@ -1,727 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* Code to generate human-readable strings from search uris.
-
- Copyright (C) 2000 Eazel, 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; see the file COPYING. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Mathieu Lacage <mathieu@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-search-uri.h"
-
-/* Must be included before other libgnome headers. */
-
-#include "nautilus-lib-self-check-functions.h"
-#include <eel/eel-glib-extensions.h>
-#include <eel/eel-string.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
-static const char *strip_uri_beginning (const char *location_uri);
-static GList * tokenize_uri (const char *string);
-static char * get_translated_criterion (GList *criterion);
-static char * get_nth_criterion_prefix (GList *criterion);
-static char * parse_uri (const char *search_uri);
-static void free_tokenized_uri (GList *list);
-
-/**
- * strip_uri_beginning:
- * @location_uri: search uri.
- *
- * strips the search:[file:///...] part of the input uri.
- *
- */
-static const char *
-strip_uri_beginning (const char *location_uri)
-{
- char **first_token;
- char *ptr;
- const char *ret_val;
-
- first_token = g_strsplit (location_uri, " ", 2);
- if (first_token[0] == NULL) {
- g_strfreev (first_token);
- return NULL;
- }
-
- /* parse the first token from the end to the beginning.
- to extract the search:[] part.
- */
- for (ptr = first_token[0]+strlen(first_token[0]);
- ptr != first_token[0] && *ptr != ']';
- ptr--) {}
-
- ret_val = location_uri + (ptr - first_token[0]) + 1;
-
- g_strfreev (first_token);
-
- return ret_val;
-}
-
-/**
- * free_tokenized_uri:
- * @list: tokenized uri to free
- *
- */
-static void
-free_tokenized_uri (GList *list)
-{
- GList *node;
-
- for (node = list; node != NULL; node = node->next) {
- eel_g_list_free_deep (node->data);
- }
- g_list_free (list);
-}
-
-
-/**
- * tokenize_uri
- * @string: string to parse
- *
- * This function tokenizes a subset of the grand medusa uri specification.
- * If it cannot, it returns NULL. CHECK FOR NULL upon return.
- *
- * Return value: a Singly linked list of singly linked lists.
- * each of the element of the root linked list is a complete criterion.
- * each criterin sinlgly linked list is made of the different tokens
- * of the criterion.
- */
-static GList *
-tokenize_uri (const char *string)
-{
- const char *temp_string;
- char **criteria;
- GList *criterion_list;
- int i, j;
-
- if (string == NULL) {
- return NULL;
- }
-
- string = strip_uri_beginning (string);
- if (string == NULL) {
- return NULL;
- }
-
- /* make sure we can handle this uri */
- if (strchr (string , '(') != NULL
- || strchr (string, ')') != NULL
- || strchr (string, '|') != NULL) {
- return NULL;
- }
-
- criterion_list = NULL;
-
- /* split the uri in different criteria */
- criteria = g_strsplit (string, " & ", 0);
- for (i = 0, temp_string = criteria[0];
- temp_string != NULL;
- i++, temp_string = criteria[i]) {
- char **tokens;
- char *token;
- GList *token_list;
-
- /* split a criterion in different tokens */
- token_list = NULL;
- tokens = g_strsplit (temp_string, " ", 0);
- for (j = 0, token = tokens[0]; token != NULL; j++, token = tokens[j]) {
- /* g_strstrip does not return a newly allocated string. */
- token_list = g_list_prepend (token_list, g_strdup (g_strstrip (token)));
- }
- criterion_list = g_list_prepend (criterion_list, g_list_reverse (token_list));
- g_strfreev (tokens);
- }
- g_strfreev (criteria);
-
- return g_list_reverse (criterion_list);
-}
-
-typedef struct _value_criterion_item value_criterion_item;
-typedef value_criterion_item *value_criterion_table;
-
-typedef struct _operand_criterion_item operand_criterion_item;
-typedef operand_criterion_item *operand_criterion_table;
-
-typedef struct _field_criterion_item field_criterion_item;
-typedef field_criterion_item *field_criterion_table;
-
-/* toplevel structure each entry points to a level 2 structure */
-struct _field_criterion_item {
- char *id;
- /* FIXME: This field is necessary so that
- the size of this structure is the same
- as the size of the other structures.
- see the comment in the definition of "value_criterion_item"
- to see what I mean. Yay, evil!
- someone should make this go away. */
- char *unused_field_for_hack_compatibility;
- operand_criterion_table items;
-};
-/* second level structure. if items is NULL, the entry is a leaf
- of our hierarchy. If it is not, it points to a level 3 leaf
-*/
-struct _operand_criterion_item {
- char *id;
- char *translation;
- value_criterion_table items;
-};
-/* third level structure. leaf */
-struct _value_criterion_item {
- char *id;
- char *translation;
- /* this field is there only to make the 3 structures similar enough
- so that you can safely cast between them it is a kind of evil hack
- but i like it. It is guaranteed to be always NULL. */
- value_criterion_table items;
-};
-
-
-/* -------------------------------------------------------
- - file name -
- -------------------------------------------------------
-*/
-
-static operand_criterion_item file_name2_table [] = {
- {"contains",
- /* Human readable description for a criterion in a search for
- files. Bracketed items are context, and are message
- strings elsewhere. You don't have to translate the whole
- string, and only the translation for "containing '%s' will
- be used. If you do translate the whole string, leave the
- translations of the rest of the text in brackets, so it
- will not be used.
- "%s" here is a pattern the file name
- matched, such as "nautilus" */
- N_("[Items ]containing \"%s\" in their names"),
- NULL},
- {"starts_with",
- /* "%s" here is a pattern the file name started with, such as
- "nautilus" */
- N_("[Items ]starting with \"%s\""),
- NULL},
- {"ends_with",
- /* "%s" here is a pattern the file name ended with, such as
- "mime" */
- N_("[Items ]ending with %s"),
- NULL},
- {"does_not_contain",
- /* "%s" here is a pattern the file name did not match, such
- as "nautilus" */
- N_("[Items ]not containing \"%s\" in their names"),
- NULL},
- {"regexp_matches",
- /* "%s" is a regular expression string, for example "[abc]" */
- N_("[Items ]matching the regular expression \"%s\""),
- NULL},
- {"matches",
- /* "%s" is a file glob, for example "*.txt" */
- N_("[Items ]matching the file pattern \"%s\""),
- NULL},
- {NULL, NULL, NULL}
-
-};
-
-
-/* -------------------------------------------------------
- - file type -
- -------------------------------------------------------
-*/
-static value_criterion_item file_type_options3_table [] = {
- {"file",
- N_("[Items that are ]regular files"),
- NULL},
- {"text_file",
- N_("[Items that are ]text files"),
- NULL},
- {"application",
- N_("[Items that are ]applications"),
- NULL},
- {"directory",
- N_("[Items that are ]folders"),
- NULL},
- {"music",
- N_("[Items that are ]music"),
- NULL},
- {NULL, NULL, NULL}
-};
-static operand_criterion_item file_type2_table [] = {
- {"is_not",
- /* "%s" here is a word describing a file type, for example
- "folder" */
- N_("[Items ]that are not %s"),
- file_type_options3_table},
- {"is",
- /* "%s" here is a word describing a file type, for example
- "folder" */
- N_("[Items ]that are %s"),
- file_type_options3_table},
- {NULL, NULL, NULL}
-};
-
-
-/* -------------------------------------------------------
- - owner -
- -------------------------------------------------------
-*/
-static operand_criterion_item owner2_table [] = {
- {"is_not",
- /* "%s" here is the name of user on a Linux machine, such as
- "root" */
- N_("[Items ]not owned by \"%s\""),
- NULL},
- {"is",
- /* "%s" here is the name of user on a Linux machine, such as
- "root" */
- N_("[Items ]owned by \"%s\""),
- NULL},
- {"has_uid",
- N_("[Items ]with owner UID \"%s\""),
- NULL},
- {"does_not_have_uid",
- N_("[Items ]with owner UID other than \"%s\""),
- NULL},
- {NULL, NULL, NULL}
-};
-
-/* -------------------------------------------------------
- - size -
- -------------------------------------------------------
-*/
-static operand_criterion_item size2_table [] = {
- {"larger_than",
- N_("[Items ]larger than %s bytes"),
- NULL},
- {"smaller_than",
- N_("[Items ]smaller than %s bytes"),
- NULL},
- {"is",
- N_("[Items ]of %s bytes"),
- NULL},
- {NULL, NULL, NULL}
-};
-
-/* -------------------------------------------------------
- - modified time -
- -------------------------------------------------------
-*/
-static operand_criterion_item mod_time2_table [] = {
- {"is today",
- N_("[Items ]modified today"),
- NULL},
- {"is yesterday",
- N_("[Items ]modified yesterday"),
- NULL},
- {"is",
- N_("[Items ]modified on %s"), NULL},
- {"is_not",
- N_("[Items ]not modified on %s"),
- NULL},
- {"is_before",
- N_("[Items ]modified before %s"),
- NULL},
- {"is_after",
- N_("[Items ]modified after %s"),
- NULL},
- {"is_within_a_week_of",
- N_("[Items ]modified within a week of %s"),
- NULL},
- {"is_within_a_month_of",
- N_("[Items ]modified within a month of %s"),
- NULL},
- {NULL, NULL, NULL}
-};
-
-/* -------------------------------------------------------
- - emblems -
- -------------------------------------------------------
-*/
-
-static operand_criterion_item emblem2_table [] = {
- { "include",
- /* "%s" here is the name of an Emblem */
- N_("[Items ]marked with \"%s\""),
- NULL},
- { "do_not_include",
- /* "%s" here is the name of an Emblem */
- N_("[Items ]not marked with \"%s\""),
- NULL},
- {NULL, NULL, NULL}
-};
-
-
-/* -------------------------------------------------------
- - contains -
- -------------------------------------------------------
-*/
-
-
-static operand_criterion_item contains2_table [] = {
- {"includes_all_of",
- /* "%s" here is a word or words present in the file, for
- example "nautilus" or "apple orange" */
- N_("[Items ]with all the words \"%s\""),
- NULL},
- {"includes_any_of",
- /* "%s" here is a word or words present in the file, for
- example "nautilus" or "apple orange" */
- N_("[Items ]containing one of the words \"%s\""),
- NULL},
- {"does_not_include_all_of",
- /* "%s" here is a word or words present in the file, for
- example "nautilus" or "apple orange" */
- N_("[Items ]without all the words \"%s\""),
- NULL},
- {"does_not_include_any_of",
- /* "%s" here is a word or words present in the file, for
- example "nautilus" or "apple orange" */
- N_("[Items ]without any of the words \"%s\""),
- NULL},
- {NULL, NULL, NULL},
-};
-
-
-
-/* -------------------------------------------------------
- - main table -
- ------------------------------------------------------- */
-static field_criterion_item main_table[] = {
- {"file_name",
- NULL,
- file_name2_table},
- {"file_type",
- NULL,
- file_type2_table},
- {"owner",
- NULL,
- owner2_table},
- {"size",
- NULL,
- size2_table},
- {"content",
- NULL,
- contains2_table},
- {"modified",
- NULL,
- mod_time2_table},
- {"keywords",
- NULL,
- emblem2_table},
- {NULL, NULL}
-};
-
-
-
-/**
- * get_item_number:
- * @current_table: the table to parse.
- * @item: the string to search into the table.
- *
- * Small helper function which allows whoich serches for @item
- * into the @current_table.
- * it returns -1 if it could not find it.
- * Yes, I know it is wrong to use the normal function return value
- * to pass error status. */
-static int
-get_item_number (field_criterion_item *current_table, char *item)
-{
- int i;
-
- i = 0;
- while (strcmp (current_table[i].id,
- item) != 0) {
- i++;
- if (current_table[i].id == NULL) {
- return -1;
- }
- }
-
- return i;
-}
-
-/**
- * get_translated_criterion:
- * @criterion: criterion uri to parse
- *
- * Returns a translated string for a given criterion uri.
- */
-static char *
-get_translated_criterion (GList *criterion)
-{
-
- int item_number, value_item_number;
- operand_criterion_item *operand_table;
- value_criterion_item *value_table;
- char *ret_val;
- char *context_stripped_operand, *context_stripped_value;
-
- /* make sure we got a valid criterion */
- if (g_list_length (criterion) != 3) {
- return NULL;
- }
-
-
- /* get through begening of criterion structure */
- item_number = get_item_number (main_table, (char *)criterion->data);
- if (item_number == -1) {
- return NULL;
- }
- operand_table = main_table[item_number].items;
- criterion = criterion->next;
-
- /* get through operanddle criterion structure */
- item_number = get_item_number ((field_criterion_item *)operand_table,
- (char *)criterion->data);
- if (item_number == -1) {
- return NULL;
- }
- value_table = operand_table[item_number].items;
- criterion = criterion->next;
-
- /* get through value criterion structure.
- The fun begins NOW. */
-
- if (value_table == NULL && operand_table[item_number].translation != NULL) {
- /* simplest case: if the pointer to the value criterion
- structure is NULL and we have a translation,
- we output a concat of the translation and the
- last part of the uri.
- */
- context_stripped_operand = eel_str_remove_bracketed_text (_(operand_table[item_number].translation));
- ret_val = g_strdup_printf (context_stripped_operand,
- (char *) criterion->data);
- g_free (context_stripped_operand);
- return ret_val;
- } else if (value_table != NULL) {
- /* get through level 3 structure */
-
- value_item_number = get_item_number ((field_criterion_item *) value_table,
- (char *) criterion->data);
- if (value_item_number == -1) {
- return NULL;
- }
-
- if (operand_table[item_number].translation == NULL) {
- /* if we had no translation in operand criterion table */
- ret_val = eel_str_remove_bracketed_text (_(value_table[value_item_number].translation));
- } else {
- /* if we have both some translation in level 2 and level 3 */
- context_stripped_operand = eel_str_remove_bracketed_text (_(operand_table[item_number].translation));
- context_stripped_value = eel_str_remove_bracketed_text (_(value_table[value_item_number].translation));
- ret_val = g_strdup_printf (context_stripped_operand, context_stripped_value);
- g_free (context_stripped_operand);
- g_free (context_stripped_value);
- }
- return ret_val;
- }
-
- return g_strdup ("");
-}
-
-
-/**
- * get_nth_criterion_prefix:
- * @criterion: The GList whose data field points to the criterion GList.
- *
- * calculates the "," or "and" prefix for any criterion.
- *
- * return value: the translated prefix.
- */
-static char *
-get_nth_criterion_prefix (GList *criterion)
-{
- /* if we are the last criterion, put it here. */
-
- /* Human readable description for a criterion in a search for
- files. Bracketed items are context, and are message
- strings elsewhere. Translate only the words "and" here. */
- if (criterion->next == NULL) {
-
- return eel_str_remove_bracketed_text (_("[Items larger than 400K] and [without all the words \"apple orange\"]"));
- }
- /* Human readable description for a criterion in a search for
- files. Bracketed items are context, and are message
- strings elsewhere. Translate only the words "and" here. */
- return eel_str_remove_bracketed_text (_("[Items larger than 400K], [owned by root and without all the words \"apple orange\"]"));
-}
-
-/**
- * parse_uri:
- * @search_uri: uri to translate.
- *
- * returns the translated version of the uri.
- */
-static char *
-parse_uri (const char *search_uri)
-{
- GList *criteria, *criterion;
- char *translated_criterion, *translated_prefix;
- char *ret_val, *temp;
-
- criteria = tokenize_uri (search_uri);
- if (criteria == NULL) {
- return NULL;
- }
-
- /* processes the first criterion and add the necessary "whose" prefix */
- translated_criterion = get_translated_criterion ((GList *)criteria->data);
- if (translated_criterion == NULL) {
- free_tokenized_uri (criteria);
- return NULL;
- }
- /* The beginning of the description of a search that has just been
- performed. The "%s" here is a description of a single criterion,
- which in english might be "that contain the word 'foo'" */
- ret_val = g_strdup_printf (_("Items %s"),
- translated_criterion);
- g_free (translated_criterion);
-
- /* processes the other criteria and add the necessary "and" prefixes */
- for (criterion = criteria->next; criterion != NULL; criterion = criterion->next) {
- translated_criterion = get_translated_criterion (criterion->data);
- if (translated_criterion == NULL) {
- g_free (ret_val);
- free_tokenized_uri (criteria);
- return NULL;
- }
- translated_prefix = get_nth_criterion_prefix (criterion);
- temp = g_strconcat (ret_val, translated_prefix,
- translated_criterion, NULL);
- g_free (ret_val);
- ret_val = temp;
- g_free (translated_criterion);
- g_free (translated_prefix);
- }
-
- free_tokenized_uri (criteria);
-
- return ret_val;
-}
-
-
-/**
- * nautilus_search_uri_to_human:
- * @search_uri: search uri to translate to human langage.
- *
- * The returned string is already localized.
- */
-char *
-nautilus_search_uri_to_human (const char *search_uri)
-{
- char *uri, *human;
-
- g_return_val_if_fail (search_uri != NULL, NULL);
-
- uri = gnome_vfs_unescape_string_for_display (search_uri);
- human = parse_uri (uri);
- if (human == NULL) {
- return uri;
- }
-
- g_free (uri);
-
- return human;
-}
-
-char *
-nautilus_get_target_uri_from_search_result_name (const char *search_result_name)
-{
- return gnome_vfs_unescape_string (search_result_name, NULL);
-}
-
-gboolean
-nautilus_is_search_uri (const char *uri)
-{
- g_return_val_if_fail (uri != NULL, FALSE);
-
- return eel_istr_has_prefix (uri, "search:")
- || eel_istr_has_prefix (uri, "gnome-search:");
-}
-
-#if !defined (NAUTILUS_OMIT_SELF_CHECK)
-
-void
-nautilus_self_check_search_uri (void)
-{
- /* search_uri_to_human */
-
- /* make sure that it does not accept non-supported uris.*/
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human (""), "");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("s"), "s");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human (" "), " ");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human (" "), " ");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human (" s"), " s");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human (" s "), " s ");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("xxx:yyy"), "xxx:yyy");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]"), "search:[][]");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]fi"), "search:[][]fi");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name"),
- "search:[][]file_name");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name cont"),
- "search:[][]file_name cont");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name contains"),
- "search:[][]file_name contains");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name c stuff"),
- "search:[][]file_name c stuff");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]&"),
- "search:[][]&");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]f & s"),
- "search:[][]f & s");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name contains stuff & f"),
- "search:[][]file_name contains stuff & f");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name contains stuff & file_type i"),
- "search:[][]file_name contains stuff & file_type i");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name contains stuff & file_type is f"),
- "search:[][]file_name contains stuff & file_type is f");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name contains stu)ff & file_type is file"),
- "search:[][]file_name contains stu)ff & file_type is file");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name contains stu(ff & file_type is file"),
- "search:[][]file_name contains stu(ff & file_type is file");
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name contains stu|ff & file_type is file"),
- "search:[][]file_name contains stu|ff & file_type is file");
-
- /* make sure all the code paths work */
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name contains stuff"),
- _("Items containing \"stuff\" in their names"));
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_type is file"),
- _("Items that are regular files"));
- /* FIXME bugzilla.gnome.org 45088: This may be what the function calls "human", but it's bad grammar. */
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name contains stuff & file_type is file"),
- _("Items containing \"stuff\" in their names and that are regular files"));
- /* FIXME bugzilla.gnome.org 45088: This may be what the function calls "human", but it's bad grammar. */
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name contains stuff & file_type is file"
- " & size smaller_than 2000"),
- _("Items containing \"stuff\" in their names, that are regular files and "
- "smaller than 2000 bytes"));
- /* FIXME bugzilla.gnome.org 45088: This may be what the function calls "human", but it's bad grammar. */
- EEL_CHECK_STRING_RESULT (nautilus_search_uri_to_human ("search:[][]file_name contains medusa & file_type is directory"),
- _("Items containing \"medusa\" in their names and that are "
- "folders"));
-
- /* is_search_uri */
- EEL_CHECK_BOOLEAN_RESULT (nautilus_is_search_uri (""), FALSE);
- EEL_CHECK_BOOLEAN_RESULT (nautilus_is_search_uri ("search:"), TRUE);
- EEL_CHECK_BOOLEAN_RESULT (nautilus_is_search_uri ("gnome-search:"), TRUE);
- EEL_CHECK_BOOLEAN_RESULT (nautilus_is_search_uri ("xxx-search:"), FALSE);
- EEL_CHECK_BOOLEAN_RESULT (nautilus_is_search_uri ("search:xxx"), TRUE);
- EEL_CHECK_BOOLEAN_RESULT (nautilus_is_search_uri ("gnome-search:xxx"), TRUE);
- EEL_CHECK_BOOLEAN_RESULT (nautilus_is_search_uri ("xxx-search:xxx"), FALSE);
-}
-
-#endif /* !NAUTILUS_OMIT_SELF_CHECK */
-
diff --git a/libnautilus-private/nautilus-search-uri.h b/libnautilus-private/nautilus-search-uri.h
deleted file mode 100644
index 6da105699..000000000
--- a/libnautilus-private/nautilus-search-uri.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* Code to generate human-readable strings from search uris.
-
- Copyright (C) 2000 Eazel, 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; see the file COPYING. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Mathieu Lacage <mathieu@eazel.com>
-*/
-
-#ifndef NAUTILUS_SEARCH_URI_H
-#define NAUTILUS_SEARCH_URI_H
-
-#include <glib/gtypes.h>
-
-/* These strings are used programatically; they must not be translated */
-#define NAUTILUS_SEARCH_URI_TEXT_NAME "file_name"
-#define NAUTILUS_SEARCH_URI_TEXT_CONTENT "content"
-#define NAUTILUS_SEARCH_URI_TEXT_TYPE "file_type"
-#define NAUTILUS_SEARCH_URI_TEXT_SIZE "size"
-#define NAUTILUS_SEARCH_URI_TEXT_EMBLEMS "keywords"
-#define NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED "modified"
-#define NAUTILUS_SEARCH_URI_TEXT_OWNER "owner"
-
-gboolean nautilus_is_search_uri (const char *uri);
-char * nautilus_search_uri_to_human (const char *search_uri);
-char * nautilus_get_target_uri_from_search_result_name (const char *search_result_name);
-
-#endif /* NAUTILUS_SEARCH_URI_H */
diff --git a/libnautilus-private/nautilus-sidebar-functions.c b/libnautilus-private/nautilus-sidebar-functions.c
deleted file mode 100644
index 4f71c3c3e..000000000
--- a/libnautilus-private/nautilus-sidebar-functions.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-sidebar-functions.c - Sidebar functions used throughout Nautilus.
-
- Copyright (C) 2001 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: Ramiro Estrugo <ramiro@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-sidebar-functions.h"
-
-#include "nautilus-view-identifier.h"
-#include <eel/eel-glib-extensions.h>
-#include <eel/eel-string.h>
-
-static int
-compare_view_identifiers (gconstpointer a, gconstpointer b)
-{
- NautilusViewIdentifier *idenfifier_a;
- NautilusViewIdentifier *idenfifier_b;
-
- g_assert (a != NULL);
- g_assert (b != NULL);
-
- idenfifier_a = (NautilusViewIdentifier*) a;
- idenfifier_b = (NautilusViewIdentifier*) b;
-
- return eel_strcmp (idenfifier_a->name, idenfifier_b->name);
-}
-
-/* Make a query to find out what sidebar panels are available. */
-static GList *
-sidebar_get_sidebar_panel_view_identifiers (void)
-{
- CORBA_Environment ev;
- const char *query;
- Bonobo_ServerInfoList *bonobo_activation_result;
- guint i;
- NautilusViewIdentifier *id;
- GList *view_identifiers;
-
- CORBA_exception_init (&ev);
-
- /* get all the sidebars, and ignore the "loser" ones */
- query = "nautilus:sidebar_panel_name.defined() AND repo_ids.has ('IDL:Bonobo/Control:1.0') AND (NOT test_only == true)";
-
- bonobo_activation_result = bonobo_activation_query (query, NULL, &ev);
-
- view_identifiers = NULL;
-
- if (ev._major == CORBA_NO_EXCEPTION && bonobo_activation_result != NULL) {
- for (i = 0; i < bonobo_activation_result->_length; i++) {
- id = nautilus_view_identifier_new_from_sidebar_panel
- (&bonobo_activation_result->_buffer[i]);
- view_identifiers = g_list_prepend (view_identifiers, id);
- }
- view_identifiers = g_list_reverse (view_identifiers);
- }
-
- if (bonobo_activation_result != NULL) {
- CORBA_free (bonobo_activation_result);
- }
-
- CORBA_exception_free (&ev);
-
- view_identifiers = g_list_sort (view_identifiers, compare_view_identifiers);
-
- return view_identifiers;
-}
-
-GList *
-nautilus_sidebar_get_all_sidebar_panel_view_identifiers (void)
-{
- return sidebar_get_sidebar_panel_view_identifiers ();
-}
diff --git a/libnautilus-private/nautilus-sidebar-functions.h b/libnautilus-private/nautilus-sidebar-functions.h
deleted file mode 100644
index 03d007d77..000000000
--- a/libnautilus-private/nautilus-sidebar-functions.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-sidebar-functions.h - Sidebar functions used throughout Nautilus.
-
- Copyright (C) 2001 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: Ramiro Estrugo <ramiro@eazel.com>
-*/
-
-#ifndef NAUTILUS_SIDEBAR_FUNCTIONS_H
-#define NAUTILUS_SIDEBAR_FUNCTIONS_H
-
-#include <glib/glist.h>
-
-GList *nautilus_sidebar_get_all_sidebar_panel_view_identifiers (void);
-
-#endif /* NAUTILUS_SIDEBAR_FUNCTIONS_H */
-
diff --git a/libnautilus-private/nautilus-sidebar-provider.c b/libnautilus-private/nautilus-sidebar-provider.c
new file mode 100644
index 000000000..f6442b04d
--- /dev/null
+++ b/libnautilus-private/nautilus-sidebar-provider.c
@@ -0,0 +1,72 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-sidebar-provider.c: register and create NautilusSidebars
+
+ 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.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+*/
+
+#include <string.h>
+#include "nautilus-sidebar-provider.h"
+
+static void
+nautilus_sidebar_provider_base_init (gpointer g_class)
+{
+}
+
+GType
+nautilus_sidebar_provider_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (NautilusSidebarProviderIface),
+ nautilus_sidebar_provider_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "NautilusSidebarProvider",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+NautilusSidebar *
+nautilus_sidebar_provider_create (NautilusSidebarProvider *provider,
+ NautilusWindowInfo *window)
+{
+ return (* NAUTILUS_SIDEBAR_PROVIDER_GET_IFACE (provider)->create) (provider, window);
+}
+
+
+GList *
+nautilus_list_sidebar_providers (void)
+{
+ return NULL;
+}
diff --git a/libnautilus-private/nautilus-sidebar-provider.h b/libnautilus-private/nautilus-sidebar-provider.h
new file mode 100644
index 000000000..114988574
--- /dev/null
+++ b/libnautilus-private/nautilus-sidebar-provider.h
@@ -0,0 +1,56 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-sidebar-provider.h: register and create NautilusSidebars
+
+ 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.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+*/
+
+#ifndef NAUTILUS_SIDEBAR_PROVIDER_H
+#define NAUTILUS_SIDEBAR_PROVIDER_H
+
+#include <libnautilus-private/nautilus-sidebar.h>
+#include <libnautilus-private/nautilus-window-info.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_SIDEBAR_PROVIDER (nautilus_sidebar_provider_get_type ())
+#define NAUTILUS_SIDEBAR_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_SIDEBAR_PROVIDER, NautilusSidebarProvider))
+#define NAUTILUS_IS_SIDEBAR_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_SIDEBAR_PROVIDER))
+#define NAUTILUS_SIDEBAR_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_SIDEBAR_PROVIDER, NautilusSidebarProviderIface))
+
+typedef struct _NautilusSidebarProvider NautilusSidebarProvider;
+typedef struct _NautilusSidebarProviderIface NautilusSidebarProviderIface;
+
+struct _NautilusSidebarProviderIface {
+ GTypeInterface g_iface;
+
+ NautilusSidebar * (*create) (NautilusSidebarProvider *provider,
+ NautilusWindowInfo *window);
+};
+
+/* Interface Functions */
+GType nautilus_sidebar_provider_get_type (void);
+NautilusSidebar * nautilus_sidebar_provider_create (NautilusSidebarProvider *provider,
+ NautilusWindowInfo *window);
+GList * nautilus_list_sidebar_providers (void);
+
+G_END_DECLS
+
+#endif /* NAUTILUS_SIDEBAR_PROVIDER_H */
diff --git a/libnautilus-private/nautilus-sidebar.c b/libnautilus-private/nautilus-sidebar.c
new file mode 100644
index 000000000..2f39db63e
--- /dev/null
+++ b/libnautilus-private/nautilus-sidebar.c
@@ -0,0 +1,116 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-sidebar.c: Interface for nautilus sidebar plugins
+
+ 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.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+*/
+
+#include <config.h>
+#include "nautilus-sidebar.h"
+
+enum {
+ TAB_ICON_CHANGED,
+ ZOOM_PARAMETERS_CHANGED,
+ ZOOM_LEVEL_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint nautilus_sidebar_signals[LAST_SIGNAL] = { 0 };
+
+static void
+nautilus_sidebar_base_init (gpointer g_class)
+{
+ static gboolean initialized = FALSE;
+
+ if (! initialized) {
+ nautilus_sidebar_signals[TAB_ICON_CHANGED] =
+ g_signal_new ("tab_icon_changed",
+ NAUTILUS_TYPE_SIDEBAR,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusSidebarIface, tab_icon_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ initialized = TRUE;
+ }
+}
+
+GType
+nautilus_sidebar_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (NautilusSidebarIface),
+ nautilus_sidebar_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "NautilusSidebar",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET);
+ }
+
+ return type;
+}
+
+
+const char *
+nautilus_sidebar_get_sidebar_id (NautilusSidebar *sidebar)
+{
+ g_return_val_if_fail (NAUTILUS_IS_SIDEBAR (sidebar), NULL);
+
+ return (* NAUTILUS_SIDEBAR_GET_IFACE (sidebar)->get_sidebar_id) (sidebar);
+}
+
+char *
+nautilus_sidebar_get_tab_label (NautilusSidebar *sidebar)
+{
+ g_return_val_if_fail (NAUTILUS_IS_SIDEBAR (sidebar), NULL);
+
+ return (* NAUTILUS_SIDEBAR_GET_IFACE (sidebar)->get_tab_label) (sidebar);
+}
+
+GdkPixbuf *
+nautilus_sidebar_get_tab_icon (NautilusSidebar *sidebar)
+{
+ g_return_val_if_fail (NAUTILUS_IS_SIDEBAR (sidebar), NULL);
+
+ return (* NAUTILUS_SIDEBAR_GET_IFACE (sidebar)->get_tab_icon) (sidebar);
+}
+
+void
+nautilus_sidebar_is_visible_changed (NautilusSidebar *sidebar,
+ gboolean is_visible)
+{
+ g_return_if_fail (NAUTILUS_IS_SIDEBAR (sidebar));
+
+ (* NAUTILUS_SIDEBAR_GET_IFACE (sidebar)->is_visible_changed) (sidebar,
+ is_visible);
+}
diff --git a/libnautilus-private/nautilus-sidebar.h b/libnautilus-private/nautilus-sidebar.h
new file mode 100644
index 000000000..4bdade1f1
--- /dev/null
+++ b/libnautilus-private/nautilus-sidebar.h
@@ -0,0 +1,78 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-sidebar.h: Interface for nautilus sidebar plugins
+
+ 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.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+*/
+
+#ifndef NAUTILUS_SIDEBAR_H
+#define NAUTILUS_SIDEBAR_H
+
+#include <glib-object.h>
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_SIDEBAR (nautilus_sidebar_get_type ())
+#define NAUTILUS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_SIDEBAR, NautilusSidebar))
+#define NAUTILUS_IS_SIDEBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_SIDEBAR))
+#define NAUTILUS_SIDEBAR_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_SIDEBAR, NautilusSidebarIface))
+
+typedef struct _NautilusSidebar NautilusSidebar; /* dummy typedef */
+typedef struct _NautilusSidebarIface NautilusSidebarIface;
+
+/* Must also be a GtkWidget */
+struct _NautilusSidebarIface
+{
+ GTypeInterface g_iface;
+
+ /* Signals: */
+ void (* tab_icon_changed) (NautilusSidebar *sidebar);
+
+ /* VTable: */
+ const char * (* get_sidebar_id) (NautilusSidebar *sidebar);
+ char * (* get_tab_label) (NautilusSidebar *sidebar);
+ GdkPixbuf * (* get_tab_icon) (NautilusSidebar *sidebar);
+ void (* is_visible_changed) (NautilusSidebar *sidebar,
+ gboolean is_visible);
+
+
+ /* Padding for future expansion */
+ void (*_reserved1) (void);
+ void (*_reserved2) (void);
+ void (*_reserved3) (void);
+ void (*_reserved4) (void);
+ void (*_reserved5) (void);
+ void (*_reserved6) (void);
+ void (*_reserved7) (void);
+ void (*_reserved8) (void);
+};
+
+GType nautilus_sidebar_get_type (void);
+
+const char *nautilus_sidebar_get_sidebar_id (NautilusSidebar *sidebar);
+char * nautilus_sidebar_get_tab_label (NautilusSidebar *sidebar);
+GdkPixbuf * nautilus_sidebar_get_tab_icon (NautilusSidebar *sidebar);
+void nautilus_sidebar_is_visible_changed (NautilusSidebar *sidebar,
+ gboolean is_visible);
+
+G_END_DECLS
+
+#endif /* NAUTILUS_VIEW_H */
diff --git a/libnautilus-private/nautilus-ui-utilities.c b/libnautilus-private/nautilus-ui-utilities.c
new file mode 100644
index 000000000..e806e945c
--- /dev/null
+++ b/libnautilus-private/nautilus-ui-utilities.c
@@ -0,0 +1,215 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* nautilus-ui-utilities.c - helper functions for GtkUIManager stuff
+
+ Copyright (C) 2004 Red Hat, 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: Alexander Larsson <alexl@redhat.com>
+*/
+
+#include <config.h>
+#include "nautilus-ui-utilities.h"
+#include "nautilus-icon-factory.h"
+
+#include <eel/eel-debug.h>
+
+void
+nautilus_ui_unmerge_ui (GtkUIManager *ui_manager,
+ guint *merge_id,
+ GtkActionGroup **action_group)
+{
+ if (*merge_id != 0) {
+ gtk_ui_manager_remove_ui (ui_manager,
+ *merge_id);
+ *merge_id = 0;
+ }
+ if (*action_group != NULL) {
+ gtk_ui_manager_remove_action_group (ui_manager,
+ *action_group);
+ *action_group = NULL;
+ }
+}
+
+void
+nautilus_ui_prepare_merge_ui (GtkUIManager *ui_manager,
+ const char *name,
+ guint *merge_id,
+ GtkActionGroup **action_group)
+{
+ *merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ *action_group = gtk_action_group_new (name);
+ gtk_action_group_set_translation_domain (*action_group, GETTEXT_PACKAGE);
+ gtk_ui_manager_insert_action_group (ui_manager, *action_group, 0);
+ g_object_unref (*action_group); /* owned by ui manager */
+}
+
+
+char *
+nautilus_get_ui_directory (void)
+{
+ return g_strdup (DATADIR "/nautilus/ui");
+}
+
+char *
+nautilus_ui_file (const char *partial_path)
+{
+ char *path;
+
+ path = g_build_filename (DATADIR "/nautilus/ui", partial_path, NULL);
+ if (g_file_test (path, G_FILE_TEST_EXISTS)) {
+ return path;
+ }
+ g_free (path);
+ return NULL;
+}
+
+const char *
+nautilus_ui_string_get (const char *filename)
+{
+ static GHashTable *ui_cache = NULL;
+ char *ui;
+ char *path;
+
+ if (ui_cache == NULL) {
+ ui_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ eel_debug_call_at_shutdown_with_data ((GFreeFunc)g_hash_table_destroy, ui_cache);
+ }
+
+ ui = g_hash_table_lookup (ui_cache, filename);
+ if (ui == NULL) {
+ path = nautilus_ui_file (filename);
+ if (!g_file_get_contents (path, &ui, NULL, NULL)) {
+ g_warning ("Unable to load ui file %s\n", filename);
+ }
+ g_free (path);
+ g_hash_table_insert (ui_cache,
+ g_strdup (filename),
+ ui);
+ }
+
+ return ui;
+}
+
+static void
+extension_action_callback (GtkAction *action,
+ gpointer callback_data)
+{
+ nautilus_menu_item_activate (NAUTILUS_MENU_ITEM (callback_data));
+}
+
+GtkAction *
+nautilus_action_from_menu_item (NautilusMenuItem *item)
+{
+ char *name, *label, *tip, *icon;
+ gboolean sensitive, priority;
+ GtkAction *action;
+ GdkPixbuf *pixbuf;
+
+ 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);
+ }
+ }
+
+ gtk_action_set_sensitive (action, sensitive);
+ g_object_set (action, "is-important", priority, NULL);
+
+ g_signal_connect_data (action, "activate",
+ G_CALLBACK (extension_action_callback),
+ g_object_ref (item),
+ (GClosureNotify)g_object_unref, 0);
+
+ g_free (name);
+ g_free (label);
+ g_free (tip);
+ g_free (icon);
+
+ return action;
+}
+
+GtkAction *
+nautilus_toolbar_action_from_menu_item (NautilusMenuItem *item)
+{
+ char *name, *label, *tip, *icon;
+ gboolean sensitive, priority;
+ GtkAction *action;
+ GdkPixbuf *pixbuf;
+
+ 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,
+ 24,
+ NULL);
+ if (pixbuf != NULL) {
+ g_object_set_data_full (G_OBJECT (action), "toolbar-icon",
+ pixbuf,
+ g_object_unref);
+ }
+ }
+
+ gtk_action_set_sensitive (action, sensitive);
+ g_object_set (action, "is-important", priority, NULL);
+
+ g_signal_connect_data (action, "activate",
+ G_CALLBACK (extension_action_callback),
+ g_object_ref (item),
+ (GClosureNotify)g_object_unref, 0);
+
+ g_free (name);
+ g_free (label);
+ g_free (tip);
+ g_free (icon);
+
+ return action;
+}
diff --git a/libnautilus-private/nautilus-ui-utilities.h b/libnautilus-private/nautilus-ui-utilities.h
new file mode 100644
index 000000000..9b7c6b066
--- /dev/null
+++ b/libnautilus-private/nautilus-ui-utilities.h
@@ -0,0 +1,43 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* nautilus-ui-utilities.h - helper functions for GtkUIManager stuff
+
+ Copyright (C) 2004 Red Hat, 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: Alexander Larsson <alexl@redhat.com>
+*/
+#ifndef NAUTILUS_UI_UTILITIES_H
+#define NAUTILUS_UI_UTILITIES_H
+
+#include <gtk/gtkuimanager.h>
+#include <libnautilus-extension/nautilus-menu-item.h>
+
+char * nautilus_get_ui_directory (void);
+char * nautilus_ui_file (const char *partial_path);
+void nautilus_ui_unmerge_ui (GtkUIManager *ui_manager,
+ guint *merge_id,
+ GtkActionGroup **action_group);
+void nautilus_ui_prepare_merge_ui (GtkUIManager *ui_manager,
+ const char *name,
+ guint *merge_id,
+ GtkActionGroup **action_group);
+GtkAction * nautilus_action_from_menu_item (NautilusMenuItem *item);
+GtkAction * nautilus_toolbar_action_from_menu_item (NautilusMenuItem *item);
+const char *nautilus_ui_string_get (const char *filename);
+
+#endif /* NAUTILUS_UI_UTILITIES_H */
diff --git a/libnautilus-private/nautilus-undo-context.c b/libnautilus-private/nautilus-undo-context.c
deleted file mode 100644
index e4a55c3c0..000000000
--- a/libnautilus-private/nautilus-undo-context.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* NautilusUndoContext - Used internally by undo machinery.
- * Not public.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Author: Gene Z. Ragan <gzr@eazel.com>
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include "nautilus-undo-context.h"
-
-#include <eel/eel-gtk-macros.h>
-#include <bonobo/bonobo-main.h>
-#include <gtk/gtksignal.h>
-
-BONOBO_CLASS_BOILERPLATE_FULL (NautilusUndoContext, nautilus_undo_context,
- Nautilus_Undo_Context,
- BonoboObject, BONOBO_OBJECT_TYPE)
-
-static Nautilus_Undo_Manager
-impl_Nautilus_Undo_Context__get_undo_manager (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusUndoContext *context;
-
- context = NAUTILUS_UNDO_CONTEXT (bonobo_object_from_servant (servant));
- return CORBA_Object_duplicate (context->undo_manager, ev);
-}
-
-NautilusUndoContext *
-nautilus_undo_context_new (Nautilus_Undo_Manager undo_manager)
-{
- NautilusUndoContext *context;
-
- context = NAUTILUS_UNDO_CONTEXT (g_object_new (nautilus_undo_context_get_type (), NULL));
- context->undo_manager = CORBA_Object_duplicate (undo_manager, NULL);
- return context;
-}
-
-static void
-nautilus_undo_context_instance_init (NautilusUndoContext *context)
-{
-}
-
-static void
-finalize (GObject *object)
-{
- NautilusUndoContext *context;
-
- context = NAUTILUS_UNDO_CONTEXT (object);
-
- CORBA_Object_release (context->undo_manager, NULL);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-nautilus_undo_context_class_init (NautilusUndoContextClass *klass)
-{
- G_OBJECT_CLASS (klass)->finalize = finalize;
-
- klass->epv._get_undo_manager = impl_Nautilus_Undo_Context__get_undo_manager;
-}
diff --git a/libnautilus-private/nautilus-undo-context.h b/libnautilus-private/nautilus-undo-context.h
deleted file mode 100644
index 9aea27bce..000000000
--- a/libnautilus-private/nautilus-undo-context.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* NautilusUndoContext - Used internally by undo machinery.
- * Not public.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Author: Gene Z. Ragan <gzr@eazel.com>
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef NAUTILUS_UNDO_CONTEXT_H
-#define NAUTILUS_UNDO_CONTEXT_H
-
-#include <bonobo/bonobo-object.h>
-#include <libnautilus/nautilus-distributed-undo.h>
-
-#define NAUTILUS_TYPE_UNDO_CONTEXT \
- (nautilus_undo_context_get_type ())
-#define NAUTILUS_UNDO_CONTEXT(obj) \
- (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_UNDO_CONTEXT, NautilusUndoContext))
-#define NAUTILUS_UNDO_CONTEXT_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_UNDO_CONTEXT, NautilusUndoContextClass))
-#define NAUTILUS_IS_UNDO_CONTEXT(obj) \
- (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_UNDO_CONTEXT))
-#define NAUTILUS_IS_UNDO_CONTEXT_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_UNDO_CONTEXT))
-
-typedef struct {
- BonoboObject parent_slot;
- Nautilus_Undo_Manager undo_manager;
-} NautilusUndoContext;
-
-typedef struct {
- BonoboObjectClass parent_slot;
- POA_Nautilus_Undo_Context__epv epv;
-} NautilusUndoContextClass;
-
-GType nautilus_undo_context_get_type (void);
-NautilusUndoContext *nautilus_undo_context_new (Nautilus_Undo_Manager undo_manager);
-
-#endif /* NAUTILUS_UNDO_CONTEXT_H */
diff --git a/libnautilus-private/nautilus-undo-manager.c b/libnautilus-private/nautilus-undo-manager.c
index 0d17a0ed4..2be72abc0 100644
--- a/libnautilus-private/nautilus-undo-manager.c
+++ b/libnautilus-private/nautilus-undo-manager.c
@@ -23,17 +23,17 @@
*/
#include <config.h>
-#include "nautilus-undo-manager.h"
+#include <libnautilus-private/nautilus-undo-manager.h>
+#include <libnautilus-private/nautilus-undo-transaction.h>
#include <eel/eel-gtk-macros.h>
#include <eel/eel-gtk-extensions.h>
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-main.h>
-#include <libnautilus/nautilus-undo-private.h>
-#include "nautilus-undo-context.h"
+#include "nautilus-undo-private.h"
struct NautilusUndoManagerDetails {
- Nautilus_Undo_Transaction transaction;
+ NautilusUndoTransaction *transaction;
/* These are used to tell undo from redo. */
gboolean current_transaction_is_redo;
@@ -61,39 +61,27 @@ typedef struct {
char *no_undo_menu_item_hint;
} UndoMenuHandlerConnection;
-BONOBO_CLASS_BOILERPLATE_FULL (NautilusUndoManager,
- nautilus_undo_manager,
- Nautilus_Undo_Manager,
- BonoboObject,
- BONOBO_OBJECT_TYPE)
+G_DEFINE_TYPE (NautilusUndoManager,
+ nautilus_undo_manager,
+ G_TYPE_OBJECT)
static void
release_transaction (NautilusUndoManager *manager)
{
- Nautilus_Undo_Transaction transaction;
-
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
+ NautilusUndoTransaction *transaction;
transaction = manager->details->transaction;
- manager->details->transaction = CORBA_OBJECT_NIL;
- if (!CORBA_Object_is_nil (transaction, &ev)) {
- bonobo_object_release_unref (transaction, &ev);
+ manager->details->transaction = NULL;
+ if (transaction != NULL) {
+ g_object_unref (transaction);
}
-
- CORBA_exception_free (&ev);
}
-static void
-corba_append (PortableServer_Servant servant,
- Nautilus_Undo_Transaction transaction,
- CORBA_Environment *ev)
+void
+nautilus_undo_manager_append (NautilusUndoManager *manager,
+ NautilusUndoTransaction *transaction)
{
- NautilusUndoManager *manager;
- Nautilus_Undo_Transaction duplicate_transaction;
-
- manager = NAUTILUS_UNDO_MANAGER (bonobo_object_from_servant (servant));
+ NautilusUndoTransaction *duplicate_transaction;
/* Check, complain, and ignore the passed-in transaction if we
* get more than one within a single undo operation. The single
@@ -105,11 +93,10 @@ corba_append (PortableServer_Servant servant,
g_return_if_fail (manager->details->num_transactions_during_undo == 1);
}
- g_return_if_fail (!CORBA_Object_is_nil (transaction, ev));
+ g_return_if_fail (transaction != NULL);
/* Keep a copy of this transaction (dump the old one). */
- duplicate_transaction = CORBA_Object_duplicate (transaction, ev);
- Nautilus_Undo_Transaction_ref (duplicate_transaction, ev);
+ duplicate_transaction = g_object_ref (transaction);
release_transaction (manager);
manager->details->transaction = duplicate_transaction;
manager->details->current_transaction_is_redo =
@@ -119,19 +106,14 @@ corba_append (PortableServer_Servant servant,
g_signal_emit (manager, signals[CHANGED], 0);
}
-static void
-corba_forget (PortableServer_Servant servant,
- Nautilus_Undo_Transaction transaction,
- CORBA_Environment *ev)
+void
+nautilus_undo_manager_forget (NautilusUndoManager *manager,
+ NautilusUndoTransaction *transaction)
{
- NautilusUndoManager *manager;
-
- manager = NAUTILUS_UNDO_MANAGER (bonobo_object_from_servant (servant));
-
/* Nothing to forget unless the item we are passed is the
* transaction we are currently holding.
*/
- if (!CORBA_Object_is_equivalent (manager->details->transaction, transaction, ev)) {
+ if (transaction != manager->details->transaction) {
return;
}
@@ -142,16 +124,6 @@ corba_forget (PortableServer_Servant servant,
g_signal_emit (manager, signals[CHANGED], 0);
}
-static void
-corba_undo (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusUndoManager *manager;
-
- manager = NAUTILUS_UNDO_MANAGER (bonobo_object_from_servant (servant));
- nautilus_undo_manager_undo (manager);
-}
-
NautilusUndoManager *
nautilus_undo_manager_new (void)
{
@@ -159,7 +131,7 @@ nautilus_undo_manager_new (void)
}
static void
-nautilus_undo_manager_instance_init (NautilusUndoManager *manager)
+nautilus_undo_manager_init (NautilusUndoManager *manager)
{
manager->details = g_new0 (NautilusUndoManagerDetails, 1);
}
@@ -167,16 +139,13 @@ nautilus_undo_manager_instance_init (NautilusUndoManager *manager)
void
nautilus_undo_manager_undo (NautilusUndoManager *manager)
{
- CORBA_Environment ev;
- Nautilus_Undo_Transaction transaction;
+ NautilusUndoTransaction *transaction;
g_return_if_fail (NAUTILUS_IS_UNDO_MANAGER (manager));
- CORBA_exception_init (&ev);
-
transaction = manager->details->transaction;
- manager->details->transaction = CORBA_OBJECT_NIL;
- if (!CORBA_Object_is_nil (transaction, &ev)) {
+ manager->details->transaction = NULL;
+ if (transaction != NULL) {
/* Perform the undo. New transactions that come in
* during an undo are redo transactions. New
* transactions that come in during a redo are undo
@@ -187,18 +156,16 @@ nautilus_undo_manager_undo (NautilusUndoManager *manager)
!manager->details->current_transaction_is_redo;
manager->details->undo_in_progress = TRUE;
manager->details->num_transactions_during_undo = 0;
- Nautilus_Undo_Transaction_undo (transaction, &ev);
+ nautilus_undo_transaction_undo (transaction);
manager->details->undo_in_progress = FALSE;
manager->details->new_transaction_is_redo = FALSE;
/* Let go of the transaction. */
- bonobo_object_release_unref (transaction, &ev);
+ g_object_unref (transaction);
/* Fire off signal indicating the undo state has changed. */
g_signal_emit (manager, signals[CHANGED], 0);
}
-
- CORBA_exception_free (&ev);
}
static void
@@ -211,8 +178,10 @@ finalize (GObject *object)
release_transaction (manager);
g_free (manager->details);
-
- EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
+
+ if (G_OBJECT_CLASS (nautilus_undo_manager_parent_class)->finalize) {
+ (* G_OBJECT_CLASS (nautilus_undo_manager_parent_class)->finalize) (object);
+ }
}
void
@@ -221,19 +190,7 @@ nautilus_undo_manager_attach (NautilusUndoManager *manager, GObject *target)
g_return_if_fail (NAUTILUS_IS_UNDO_MANAGER (manager));
g_return_if_fail (G_IS_OBJECT (target));
- nautilus_undo_attach_undo_manager (G_OBJECT (target), BONOBO_OBJREF (manager));
-}
-
-void
-nautilus_undo_manager_add_interface (NautilusUndoManager *manager, BonoboObject *object)
-{
- NautilusUndoContext *context;
-
- g_return_if_fail (NAUTILUS_IS_UNDO_MANAGER (manager));
- g_return_if_fail (BONOBO_IS_OBJECT (object));
-
- context = nautilus_undo_context_new (BONOBO_OBJREF (manager));
- bonobo_object_add_interface (object, BONOBO_OBJECT (context));
+ nautilus_undo_attach_undo_manager (G_OBJECT (target), manager);
}
#ifdef UIH
@@ -347,8 +304,4 @@ nautilus_undo_manager_class_init (NautilusUndoManagerClass *class)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
- class->epv.append = corba_append;
- class->epv.forget = corba_forget;
- class->epv.undo = corba_undo;
}
diff --git a/libnautilus-private/nautilus-undo-manager.h b/libnautilus-private/nautilus-undo-manager.h
index 2f2e0cbf3..0e8b9ac38 100644
--- a/libnautilus-private/nautilus-undo-manager.h
+++ b/libnautilus-private/nautilus-undo-manager.h
@@ -27,7 +27,7 @@
#define NAUTILUS_UNDO_MANAGER_H
#include <bonobo/bonobo-object.h>
-#include <libnautilus/nautilus-distributed-undo.h>
+#include <libnautilus-private/nautilus-undo.h>
#define NAUTILUS_TYPE_UNDO_MANAGER \
(nautilus_undo_manager_get_type ())
@@ -43,13 +43,12 @@
typedef struct NautilusUndoManagerDetails NautilusUndoManagerDetails;
typedef struct {
- BonoboObject parent;
+ GObject parent;
NautilusUndoManagerDetails *details;
} NautilusUndoManager;
typedef struct {
- BonoboObjectClass parent_slot;
- POA_Nautilus_Undo_Manager__epv epv;
+ GObjectClass parent_slot;
void (* changed) (GObject *object, gpointer data);
} NautilusUndoManagerClass;
@@ -73,8 +72,9 @@ void nautilus_undo_manager_set_up_bonobo_ui_handler_undo_item (N
void nautilus_undo_manager_attach (NautilusUndoManager *manager,
GObject *object);
-/* Attach the undo manager to a Bonobo object so another component can find it. */
-void nautilus_undo_manager_add_interface (NautilusUndoManager *manager,
- BonoboObject *object);
+void nautilus_undo_manager_append (NautilusUndoManager *manager,
+ NautilusUndoTransaction *transaction);
+void nautilus_undo_manager_forget (NautilusUndoManager *manager,
+ NautilusUndoTransaction *transaction);
#endif /* NAUTILUS_UNDO_MANAGER_H */
diff --git a/libnautilus/nautilus-undo-private.h b/libnautilus-private/nautilus-undo-private.h
index 3bfa171b4..3e6d75f95 100644
--- a/libnautilus/nautilus-undo-private.h
+++ b/libnautilus-private/nautilus-undo-private.h
@@ -25,11 +25,12 @@
#ifndef NAUTILUS_UNDO_PRIVATE_H
#define NAUTILUS_UNDO_PRIVATE_H
-#include <libnautilus/nautilus-distributed-undo.h>
+#include <libnautilus-private/nautilus-undo.h>
+#include <libnautilus-private/nautilus-undo-manager.h>
#include <glib-object.h>
-Nautilus_Undo_Manager nautilus_undo_get_undo_manager (GObject *attached_object);
+NautilusUndoManager * nautilus_undo_get_undo_manager (GObject *attached_object);
void nautilus_undo_attach_undo_manager (GObject *object,
- Nautilus_Undo_Manager manager);
+ NautilusUndoManager *manager);
#endif /* NAUTILUS_UNDO_PRIVATE_H */
diff --git a/libnautilus/nautilus-undo-transaction.c b/libnautilus-private/nautilus-undo-transaction.c
index e1c7ea697..a3ace2fe3 100644
--- a/libnautilus/nautilus-undo-transaction.c
+++ b/libnautilus-private/nautilus-undo-transaction.c
@@ -25,25 +25,23 @@
*/
#include <config.h>
-#include "nautilus-undo-transaction.h"
+#include <libnautilus-private/nautilus-undo.h>
+#include <libnautilus-private/nautilus-undo-manager.h>
+#include <libnautilus-private/nautilus-undo-transaction.h>
#include "nautilus-undo-private.h"
-#include <bonobo/bonobo-main.h>
#include <gtk/gtksignal.h>
-#include <eel/eel-gtk-macros.h>
#define NAUTILUS_UNDO_TRANSACTION_LIST_DATA "Nautilus undo transaction list"
-static void nautilus_undo_transaction_undo (NautilusUndoTransaction *transaction);
-
/* undo atoms */
static void undo_atom_list_free (GList *list);
static void undo_atom_list_undo_and_free (GList *list);
-BONOBO_CLASS_BOILERPLATE_FULL (NautilusUndoTransaction, nautilus_undo_transaction,
- Nautilus_Undo_Transaction,
- BonoboObject, BONOBO_OBJECT_TYPE)
+G_DEFINE_TYPE (NautilusUndoTransaction, nautilus_undo_transaction,
+ G_TYPE_OBJECT);
+#ifdef UIH
static Nautilus_Undo_MenuItem *
impl_Nautilus_Undo_Transaction__get_undo_menu_item (PortableServer_Servant servant,
CORBA_Environment *ev)
@@ -85,16 +83,8 @@ impl_Nautilus_Undo_Transaction__get_operation_name (PortableServer_Servant serva
transaction = NAUTILUS_UNDO_TRANSACTION (bonobo_object_from_servant (servant));
return CORBA_string_dup (transaction->operation_name);
}
+#endif
-static void
-impl_Nautilus_Undo_Transaction__undo (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusUndoTransaction *transaction;
-
- transaction = NAUTILUS_UNDO_TRANSACTION (bonobo_object_from_servant (servant));
- nautilus_undo_transaction_undo (transaction);
-}
NautilusUndoTransaction *
nautilus_undo_transaction_new (const char *operation_name,
@@ -117,7 +107,7 @@ nautilus_undo_transaction_new (const char *operation_name,
}
static void
-nautilus_undo_transaction_instance_init (NautilusUndoTransaction *transaction)
+nautilus_undo_transaction_init (NautilusUndoTransaction *transaction)
{
}
@@ -166,9 +156,11 @@ nautilus_undo_transaction_finalize (GObject *object)
g_free (transaction->redo_menu_item_label);
g_free (transaction->redo_menu_item_hint);
- CORBA_Object_release (transaction->owner, NULL);
+ if (transaction->owner != NULL) {
+ g_object_unref (transaction->owner);
+ }
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (nautilus_undo_transaction_parent_class)->finalize (object);
}
void
@@ -216,36 +208,27 @@ nautilus_undo_transaction_undo (NautilusUndoTransaction *transaction)
void
nautilus_undo_transaction_add_to_undo_manager (NautilusUndoTransaction *transaction,
- Nautilus_Undo_Manager manager)
+ NautilusUndoManager *manager)
{
- CORBA_Environment ev;
-
g_return_if_fail (NAUTILUS_IS_UNDO_TRANSACTION (transaction));
- g_return_if_fail (transaction->owner == CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
+ g_return_if_fail (transaction->owner == NULL);
- if (!CORBA_Object_is_nil (manager, &ev)) {
- Nautilus_Undo_Manager_append (manager, BONOBO_OBJREF (transaction), &ev);
- transaction->owner = CORBA_Object_duplicate (manager, &ev);
+ if (manager != NULL) {
+ nautilus_undo_manager_append (manager, transaction);
+ transaction->owner = g_object_ref (manager);
}
-
- CORBA_exception_free (&ev);
}
static void
remove_atoms (NautilusUndoTransaction *transaction,
GObject *object)
{
- CORBA_Environment ev;
GList *p, *next;
NautilusUndoAtom *atom;
g_assert (NAUTILUS_IS_UNDO_TRANSACTION (transaction));
g_assert (G_IS_OBJECT (object));
- CORBA_exception_init (&ev);
-
/* Destroy any atoms for this object. */
for (p = transaction->atom_list; p != NULL; p = next) {
atom = p->data;
@@ -262,11 +245,9 @@ remove_atoms (NautilusUndoTransaction *transaction,
* This may end up freeing the transaction.
*/
if (transaction->atom_list == NULL) {
- Nautilus_Undo_Manager_forget (
- transaction->owner, BONOBO_OBJREF (transaction), &ev);
+ nautilus_undo_manager_forget (
+ transaction->owner, transaction);
}
-
- CORBA_exception_free (&ev);
}
static void
@@ -348,12 +329,5 @@ undo_atom_list_undo_and_free (GList *list)
static void
nautilus_undo_transaction_class_init (NautilusUndoTransactionClass *klass)
{
- POA_Nautilus_Undo_Transaction__epv *epv = &klass->epv;
-
G_OBJECT_CLASS (klass)->finalize = nautilus_undo_transaction_finalize;
-
- epv->_get_undo_menu_item = &impl_Nautilus_Undo_Transaction__get_undo_menu_item;
- epv->_get_redo_menu_item = &impl_Nautilus_Undo_Transaction__get_redo_menu_item;
- epv->_get_operation_name = &impl_Nautilus_Undo_Transaction__get_operation_name;
- epv->undo = &impl_Nautilus_Undo_Transaction__undo;
}
diff --git a/libnautilus/nautilus-undo-transaction.h b/libnautilus-private/nautilus-undo-transaction.h
index a077ecf45..26d407457 100644
--- a/libnautilus/nautilus-undo-transaction.h
+++ b/libnautilus-private/nautilus-undo-transaction.h
@@ -27,8 +27,7 @@
#ifndef NAUTILUS_UNDO_TRANSACTION_H
#define NAUTILUS_UNDO_TRANSACTION_H
-#include <libnautilus/nautilus-undo.h>
-#include <libnautilus/nautilus-distributed-undo.h>
+#include <libnautilus-private/nautilus-undo.h>
#define NAUTILUS_TYPE_UNDO_TRANSACTION \
(nautilus_undo_transaction_get_type ())
@@ -41,9 +40,13 @@
#define NAUTILUS_IS_UNDO_TRANSACTION_CLASS(klass) \
(GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_UNDO_TRANSACTION))
-typedef struct {
- BonoboObject parent_slot;
+/* The typedef for NautilusUndoTransaction is in nautilus-undo.h
+ to avoid circular deps */
+typedef struct _NautilusUndoTransactionClass NautilusUndoTransactionClass;
+struct _NautilusUndoTransaction {
+ GObject parent_slot;
+
char *operation_name;
char *undo_menu_item_label;
char *undo_menu_item_hint;
@@ -51,13 +54,12 @@ typedef struct {
char *redo_menu_item_hint;
GList *atom_list;
- Nautilus_Undo_Manager owner;
-} NautilusUndoTransaction;
+ NautilusUndoManager *owner;
+};
-typedef struct {
- BonoboObjectClass parent_slot;
- POA_Nautilus_Undo_Transaction__epv epv;
-} NautilusUndoTransactionClass;
+struct _NautilusUndoTransactionClass {
+ GObjectClass parent_slot;
+};
GType nautilus_undo_transaction_get_type (void);
NautilusUndoTransaction *nautilus_undo_transaction_new (const char *operation_name,
@@ -68,7 +70,8 @@ NautilusUndoTransaction *nautilus_undo_transaction_new (const ch
void nautilus_undo_transaction_add_atom (NautilusUndoTransaction *transaction,
const NautilusUndoAtom *atom);
void nautilus_undo_transaction_add_to_undo_manager (NautilusUndoTransaction *transaction,
- Nautilus_Undo_Manager manager);
+ NautilusUndoManager *manager);
void nautilus_undo_transaction_unregister_object (GObject *atom_target);
+void nautilus_undo_transaction_undo (NautilusUndoTransaction *transaction);
#endif /* NAUTILUS_UNDO_TRANSACTION_H */
diff --git a/libnautilus/nautilus-undo.c b/libnautilus-private/nautilus-undo.c
index ae4fa9e43..29b172b6b 100644
--- a/libnautilus/nautilus-undo.c
+++ b/libnautilus-private/nautilus-undo.c
@@ -108,7 +108,7 @@ nautilus_undo_register_full (GList *atoms,
/* Now we are done with the transaction.
* If the undo manager is holding it, then this will not destroy it.
*/
- bonobo_object_unref (transaction);
+ g_object_unref (transaction);
}
/* Cover for forgetting about all undo relating to a particular target. */
@@ -124,25 +124,20 @@ nautilus_undo_unregister (GObject *target)
void
nautilus_undo (GObject *undo_manager_search_start_object)
{
- Nautilus_Undo_Manager manager;
- CORBA_Environment ev;
+ NautilusUndoManager *manager;
g_return_if_fail (G_IS_OBJECT (undo_manager_search_start_object));
- CORBA_exception_init (&ev);
-
manager = nautilus_undo_get_undo_manager (undo_manager_search_start_object);
- if (!CORBA_Object_is_nil (manager, &ev)) {
- Nautilus_Undo_Manager_undo (manager, &ev);
+ if (manager != NULL) {
+ nautilus_undo_manager_undo (manager);
}
-
- CORBA_exception_free (&ev);
}
-Nautilus_Undo_Manager
+NautilusUndoManager *
nautilus_undo_get_undo_manager (GObject *start_object)
{
- Nautilus_Undo_Manager manager;
+ NautilusUndoManager *manager;
GtkWidget *parent;
GtkWindow *transient_parent;
@@ -189,28 +184,22 @@ nautilus_undo_get_undo_manager (GObject *start_object)
}
/* Found nothing. I can live with that. */
- return CORBA_OBJECT_NIL;
-}
-
-static void
-undo_manager_unref_cover (gpointer manager)
-{
- bonobo_object_release_unref (manager, NULL);
+ return NULL;
}
void
nautilus_undo_attach_undo_manager (GObject *object,
- Nautilus_Undo_Manager manager)
+ NautilusUndoManager *manager)
{
g_return_if_fail (G_IS_OBJECT (object));
if (manager == NULL) {
g_object_set_data (object, NAUTILUS_UNDO_MANAGER_DATA, NULL);
} else {
- bonobo_object_dup_ref (manager, NULL);
+ g_object_ref (manager);
g_object_set_data_full
(object, NAUTILUS_UNDO_MANAGER_DATA,
- manager, undo_manager_unref_cover);
+ manager, g_object_unref);
}
}
@@ -219,60 +208,8 @@ void
nautilus_undo_share_undo_manager (GObject *destination_object,
GObject *source_object)
{
- Nautilus_Undo_Manager manager;
+ NautilusUndoManager *manager;
manager = nautilus_undo_get_undo_manager (source_object);
nautilus_undo_attach_undo_manager (destination_object, manager);
- CORBA_Object_release (manager, NULL);
-}
-
-/* Locates an undo manager for this bonobo control.
- * The undo manager is supplied by an interface on
- * the control frame. The put that undo manager on
- * the Bonobo control's widget.
- */
-static void
-set_up_bonobo_control (BonoboControl *control)
-{
- Nautilus_Undo_Manager manager;
- Bonobo_ControlFrame control_frame;
- CORBA_Environment ev;
- Nautilus_Undo_Context undo_context;
- GtkWidget *widget;
-
- g_assert (BONOBO_IS_CONTROL (control));
-
- manager = CORBA_OBJECT_NIL;
-
- CORBA_exception_init (&ev);
-
- /* Find the undo manager. */
- control_frame = bonobo_control_get_control_frame (control, &ev);
- if (!CORBA_Object_is_nil (control_frame, &ev)) {
- undo_context = Bonobo_Control_queryInterface
- (control_frame, "IDL:Nautilus/Undo/Context:1.0", &ev);
- if (!CORBA_Object_is_nil (undo_context, &ev)) {
- manager = Nautilus_Undo_Context__get_undo_manager (undo_context, &ev);
- Bonobo_Control_unref (undo_context, &ev);
- }
- CORBA_Object_release (undo_context, &ev);
- }
- CORBA_Object_release (control_frame, &ev);
-
- /* Attach the undo manager to the widget, or detach the old one. */
- widget = bonobo_control_get_widget (control);
- nautilus_undo_attach_undo_manager (G_OBJECT (widget), manager);
- CORBA_Object_release (manager, &ev);
-
- CORBA_exception_free (&ev);
-}
-
-void
-nautilus_undo_set_up_bonobo_control (BonoboControl *control)
-{
- g_return_if_fail (BONOBO_IS_CONTROL (control));
-
- set_up_bonobo_control (control);
- g_signal_connect (control, "set_frame",
- G_CALLBACK (set_up_bonobo_control), NULL);
}
diff --git a/libnautilus/nautilus-undo.h b/libnautilus-private/nautilus-undo.h
index c72ef5368..d1ad1355e 100644
--- a/libnautilus/nautilus-undo.h
+++ b/libnautilus-private/nautilus-undo.h
@@ -26,7 +26,10 @@
#ifndef NAUTILUS_UNDO_H
#define NAUTILUS_UNDO_H
-#include <bonobo/bonobo-control.h>
+#include <glib-object.h>
+
+typedef struct _NautilusUndoTransaction NautilusUndoTransaction;
+
/* The basic undoable operation. */
typedef void (* NautilusUndoCallback) (GObject *target, gpointer callback_data);
@@ -69,6 +72,5 @@ void nautilus_undo (GObject *undo_manager_sea
/* Connecting an undo manager. */
void nautilus_undo_share_undo_manager (GObject *destination_object,
GObject *source_object);
-void nautilus_undo_set_up_bonobo_control (BonoboControl *control);
#endif /* NAUTILUS_UNDO_H */
diff --git a/libnautilus-private/nautilus-view-factory.c b/libnautilus-private/nautilus-view-factory.c
new file mode 100644
index 000000000..11850cc6c
--- /dev/null
+++ b/libnautilus-private/nautilus-view-factory.c
@@ -0,0 +1,110 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-view-factory.c: register and create NautilusViews
+
+ 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.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+*/
+
+#include "nautilus-view-factory.h"
+
+static GList *registered_views;
+
+void
+nautilus_view_factory_register (NautilusViewInfo *view_info)
+{
+ g_return_if_fail (view_info != NULL);
+ g_return_if_fail (view_info->id != NULL);
+ g_return_if_fail (nautilus_view_factory_lookup (view_info->id) == NULL);
+
+ registered_views = g_list_append (registered_views, view_info);
+}
+
+const NautilusViewInfo *
+nautilus_view_factory_lookup (const char *id)
+{
+ GList *l;
+ NautilusViewInfo *view_info;
+
+ g_return_val_if_fail (id != NULL, NULL);
+
+
+ for (l = registered_views; l != NULL; l = l->next) {
+ view_info = l->data;
+
+ if (strcmp (view_info->id, id) == 0) {
+ return view_info;
+ }
+ }
+ return NULL;
+}
+
+NautilusView *
+nautilus_view_factory_create (const char *id,
+ NautilusWindowInfo *window)
+{
+ const NautilusViewInfo *view_info;
+
+ view_info = nautilus_view_factory_lookup (id);
+ if (view_info == NULL) {
+ return NULL;
+ }
+
+ return view_info->create (window);
+}
+
+gboolean
+nautilus_view_factory_view_supports_uri (const char *id,
+ const char *uri,
+ GnomeVFSFileType file_type,
+ const char *mime_type)
+{
+ const NautilusViewInfo *view_info;
+
+ view_info = nautilus_view_factory_lookup (id);
+ if (view_info == NULL) {
+ return FALSE;
+ }
+
+ return view_info->supports_uri (uri, file_type, mime_type);
+
+}
+
+GList *
+nautilus_view_factory_get_views_for_uri (const char *uri,
+ GnomeVFSFileType file_type,
+ const char *mime_type)
+{
+ GList *l, *res;
+ const NautilusViewInfo *view_info;
+
+ res = NULL;
+
+ for (l = registered_views; l != NULL; l = l->next) {
+ view_info = l->data;
+
+ if (view_info->supports_uri (uri, file_type, mime_type)) {
+ res = g_list_prepend (res, g_strdup (view_info->id));
+ }
+ }
+
+ return g_list_reverse (res);
+}
+
+
diff --git a/libnautilus-private/nautilus-view-factory.h b/libnautilus-private/nautilus-view-factory.h
new file mode 100644
index 000000000..2396ce3f5
--- /dev/null
+++ b/libnautilus-private/nautilus-view-factory.h
@@ -0,0 +1,67 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-view-factory.h: register and create NautilusViews
+
+ 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.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+*/
+
+#ifndef NAUTILUS_VIEW_FACTORY_H
+#define NAUTILUS_VIEW_FACTORY_H
+
+#include <string.h>
+
+#include <libnautilus-private/nautilus-view.h>
+#include <libnautilus-private/nautilus-window-info.h>
+#include <libgnomevfs/gnome-vfs-file-info.h>
+
+G_BEGIN_DECLS
+
+typedef struct _NautilusViewInfo NautilusViewInfo;
+
+struct _NautilusViewInfo {
+ char *id;
+ char *label;
+ char *label_with_mnemonic;
+ NautilusView * (*create) (NautilusWindowInfo *window);
+ /* BONOBOTODO: More args here */
+ gboolean (*supports_uri) (const char *uri,
+ GnomeVFSFileType file_type,
+ const char *mime_type);
+};
+
+
+void nautilus_view_factory_register (NautilusViewInfo *view_info);
+const NautilusViewInfo *nautilus_view_factory_lookup (const char *id);
+NautilusView * nautilus_view_factory_create (const char *id,
+ NautilusWindowInfo *window);
+gboolean nautilus_view_factory_view_supports_uri (const char *id,
+ const char *uri,
+ GnomeVFSFileType file_type,
+ const char *mime_type);
+GList * nautilus_view_factory_get_views_for_uri (const char *uri,
+ GnomeVFSFileType file_type,
+ const char *mime_type);
+
+
+
+
+G_END_DECLS
+
+#endif /* NAUTILUS_VIEW_FACTORY_H */
diff --git a/libnautilus-private/nautilus-view-identifier.c b/libnautilus-private/nautilus-view-identifier.c
deleted file mode 100644
index c414b0639..000000000
--- a/libnautilus-private/nautilus-view-identifier.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-view-identifier.c: Unique ID/Human-readable name pairs for views
-
- Copyright (C) 2000 Eazel, 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.
-
- Author: Maciej Stachowiak <mjs@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-view-identifier.h"
-
-#include <libgnome/gnome-i18n.h>
-
-
-#include <eel/eel-glib-extensions.h>
-#include <eel/eel-string.h>
-#include <glib.h>
-#include <stdlib.h>
-
-static NautilusViewIdentifier *
-nautilus_view_identifier_new (const char *iid,
- const char *name,
- const char *view_as_label,
- const char *view_as_label_with_mnemonic,
- const char *label_viewer);
-
-
-
-NautilusViewIdentifier *
-nautilus_view_identifier_new (const char *iid,
- const char *name,
- const char *view_as_label,
- const char *view_as_label_with_mnemonic,
- const char *viewer_label)
-{
- NautilusViewIdentifier *new_identifier;
-
- g_return_val_if_fail (iid != NULL, NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- new_identifier = g_new0 (NautilusViewIdentifier, 1);
- new_identifier->iid = g_strdup (iid);
- new_identifier->name = g_strdup (name);
-
- new_identifier->view_as_label = view_as_label ? g_strdup (view_as_label) :
- g_strdup_printf (_("View as %s"), name);
-
- new_identifier->view_as_label_with_mnemonic = view_as_label_with_mnemonic ? g_strdup (view_as_label_with_mnemonic)
- : g_strdup (new_identifier->view_as_label);
-
- new_identifier->viewer_label = view_as_label ? g_strdup (viewer_label) :
- g_strdup_printf (_("%s Viewer"), name);
-
- return new_identifier;
-}
-
-NautilusViewIdentifier *
-nautilus_view_identifier_copy (const NautilusViewIdentifier *identifier)
-{
- if (identifier == NULL) {
- return NULL;
- }
-
- return nautilus_view_identifier_new (identifier->iid,
- identifier->name,
- identifier->view_as_label,
- identifier->view_as_label_with_mnemonic,
- identifier->viewer_label);
-}
-
-/* Returns a list of languages, containing
- the LANG or LANGUAGE environment setting (with and without region code).
- The elements in the returned list must be freed */
-static GSList *
-get_lang_list (void)
-{
- GSList *retval;
- const GList *l;
- const char *lang;
-
- retval = NULL;
-
- for (l = gnome_i18n_get_language_list ("LC_MESSAGES");
- l != NULL;
- l = g_list_next (l)) {
- lang = l->data;
- /* skip C locale */
- if (l->data && strcmp (lang, "C") == 0) {
- continue;
- }
-
- if (!eel_str_is_empty (lang)) {
- retval = g_slist_prepend (retval, g_strdup (lang));
- }
- }
- return retval;
-}
-
-NautilusViewIdentifier *
-nautilus_view_identifier_new_from_bonobo_server_info (Bonobo_ServerInfo *server, char *name_attribute)
-{
- const char *view_as_name;
- const char *view_as_label;
- const char *view_as_label_with_mnemonic;
- const char *viewer_label;
- GSList *langs;
-
- langs = get_lang_list ();
-
- view_as_name = bonobo_server_info_prop_lookup (server, name_attribute, langs);
- view_as_label = bonobo_server_info_prop_lookup (server, "nautilus:view_as_label", langs);
- view_as_label_with_mnemonic = bonobo_server_info_prop_lookup (server, "nautilus:view_as_label_with_mnemonic", langs);
- viewer_label = bonobo_server_info_prop_lookup (server, "nautilus:viewer_label", langs);
-
- if (view_as_name == NULL) {
- view_as_name = bonobo_server_info_prop_lookup (server, "name", langs);
- }
- if (view_as_name == NULL) {
- view_as_name = server->iid;
- }
-
- eel_g_slist_free_deep (langs);
-
- /* if the name is an OAFIID, clean it up for display */
- if (eel_str_has_prefix (view_as_name, "OAFIID:")) {
- char *display_name, *colon_ptr;
- NautilusViewIdentifier *new_identifier;
-
- display_name = g_strdup (view_as_name + 7);
- colon_ptr = strchr (display_name, ':');
- if (colon_ptr) {
- *colon_ptr = '\0';
- }
-
- new_identifier = nautilus_view_identifier_new (server->iid, display_name,
- view_as_label,
- view_as_label_with_mnemonic,
- viewer_label);
- g_free(display_name);
- return new_identifier;
- }
-
- return nautilus_view_identifier_new (server->iid, view_as_name,
- view_as_label,
- view_as_label_with_mnemonic,
- viewer_label);
-}
-
-NautilusViewIdentifier *
-nautilus_view_identifier_new_from_content_view (Bonobo_ServerInfo *server)
-{
- return nautilus_view_identifier_new_from_bonobo_server_info
- (server, "nautilus:view_as_name");
-}
-
-NautilusViewIdentifier *
-nautilus_view_identifier_new_from_property_page (Bonobo_ServerInfo *server)
-{
- return nautilus_view_identifier_new_from_bonobo_server_info
- (server, "nautilus:property_page_name");
-}
-
-NautilusViewIdentifier *
-nautilus_view_identifier_new_from_sidebar_panel (Bonobo_ServerInfo *server)
-{
- return nautilus_view_identifier_new_from_bonobo_server_info
- (server, "nautilus:sidebar_panel_name");
-}
-
-void
-nautilus_view_identifier_free (NautilusViewIdentifier *identifier)
-{
- if (identifier != NULL) {
- g_free (identifier->iid);
- g_free (identifier->name);
- g_free (identifier->view_as_label);
- g_free (identifier->view_as_label_with_mnemonic);
- g_free (identifier->viewer_label);
- g_free (identifier);
- }
-}
-
-GList *
-nautilus_view_identifier_list_copy (GList *list)
-{
- GList *copy, *node;
-
- copy = NULL;
- for (node = list; node != NULL; node = node->next) {
- copy = g_list_prepend
- (copy, nautilus_view_identifier_copy (node->data));
- }
- return g_list_reverse (copy);
-}
-
-static void
-nautilus_view_identifier_free_callback (gpointer identifier, gpointer ignore)
-{
- g_assert (ignore == NULL);
- nautilus_view_identifier_free (identifier);
-}
-
-void
-nautilus_view_identifier_list_free (GList *list)
-{
- eel_g_list_free_deep_custom
- (list, nautilus_view_identifier_free_callback, NULL);
-}
-
-int
-nautilus_view_identifier_compare (const NautilusViewIdentifier *a,
- const NautilusViewIdentifier *b)
-{
- int result;
-
- result = strcmp (a->iid, b->iid);
- if (result != 0) {
- return result;
- }
- return strcmp (a->name, b->name);
-}
diff --git a/libnautilus-private/nautilus-view-identifier.h b/libnautilus-private/nautilus-view-identifier.h
deleted file mode 100644
index 8cf61e1da..000000000
--- a/libnautilus-private/nautilus-view-identifier.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
-
- nautilus-view-identifier.h: Unique ID/Human-readable name pairs for views
-
- Copyright (C) 2000 Eazel, 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.
-
- Author: Maciej Stachowiak <mjs@eazel.com>
-*/
-
-#ifndef NAUTILUS_VIEW_IDENTIFIER_H
-#define NAUTILUS_VIEW_IDENTIFIER_H
-
-#include <bonobo-activation/bonobo-activation.h>
-
-typedef struct {
- char *iid; /* Unique ID */
- char *name; /* human-readable name */
- char *view_as_label; /* "View as <name>" */
- char *view_as_label_with_mnemonic; /* "View as _<name>" */
- char *viewer_label; /* "<name> Viewer" */
-} NautilusViewIdentifier;
-
-NautilusViewIdentifier *nautilus_view_identifier_new_from_bonobo_server_info (Bonobo_ServerInfo *server,
- char *name_attribute);
-NautilusViewIdentifier *nautilus_view_identifier_new_from_content_view (Bonobo_ServerInfo *server);
-NautilusViewIdentifier *nautilus_view_identifier_new_from_sidebar_panel (Bonobo_ServerInfo *server);
-NautilusViewIdentifier *nautilus_view_identifier_new_from_property_page (Bonobo_ServerInfo *server);
-NautilusViewIdentifier *nautilus_view_identifier_copy (const NautilusViewIdentifier *identifier);
-void nautilus_view_identifier_free (NautilusViewIdentifier *identifier);
-int nautilus_view_identifier_compare (const NautilusViewIdentifier *a,
- const NautilusViewIdentifier *b);
-/* lists of NautilusViewIdentifier */
-GList * nautilus_view_identifier_list_copy (GList *list);
-void nautilus_view_identifier_list_free (GList *list);
-
-#endif /* NAUTILUS_VIEW_IDENTIFIER */
diff --git a/libnautilus-private/nautilus-view-query.c b/libnautilus-private/nautilus-view-query.c
deleted file mode 100644
index bc0ce1614..000000000
--- a/libnautilus-private/nautilus-view-query.c
+++ /dev/null
@@ -1,889 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-view-query.c - view queries for directories
-
- Copyright (C) 2000, 2001 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: Maciej Stachowiak <mjs@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-view-query.h"
-
-#include "nautilus-file-attributes.h"
-#include "nautilus-file.h"
-#include "nautilus-metadata.h"
-#include "nautilus-global-preferences.h"
-#include "nautilus-mime-actions.h"
-#include <bonobo-activation/bonobo-activation-activate.h>
-#include <eel/eel-glib-extensions.h>
-#include <eel/eel-string.h>
-#include <libgnomevfs/gnome-vfs-application-registry.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-#include <stdio.h>
-
-static char *mime_type_get_supertype (const char *mime_type);
-static gboolean server_has_content_requirements (Bonobo_ServerInfo *server);
-static GList *nautilus_do_component_query (const char *mime_type,
- const char *uri_scheme,
- GList *content_mime_types,
- gboolean ignore_content_mime_types,
- char **extra_sort_criteria,
- char *extra_requirements,
- gboolean must_be_view);
-static char **strv_concat (char **a,
- char **b);
-
-static gboolean
-is_known_mime_type (const char *mime_type)
-{
- return eel_strcasecmp (mime_type, GNOME_VFS_MIME_TYPE_UNKNOWN) != 0;
-}
-
-static gboolean
-nautilus_view_query_check_if_minimum_attributes_ready (NautilusFile *file)
-{
- NautilusFileAttributes attributes;
- gboolean ready;
-
- attributes = nautilus_mime_actions_get_minimum_file_attributes ();
- ready = nautilus_file_check_if_ready (file, attributes);
-
- return ready;
-}
-
-static gboolean
-nautilus_view_query_check_if_full_attributes_ready (NautilusFile *file)
-{
- NautilusFileAttributes attributes;
- gboolean ready;
-
- attributes = nautilus_mime_actions_get_full_file_attributes ();
- ready = nautilus_file_check_if_ready (file, attributes);
-
- return ready;
-}
-
-static NautilusFileAttributes
-nautilus_view_query_get_popup_file_attributes (void)
-{
- return NAUTILUS_FILE_ATTRIBUTE_VOLUMES |
- NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI |
- NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE;
-}
-
-static gboolean
-nautilus_view_query_check_if_popup_attributes_ready (NautilusFile *file)
-{
- NautilusFileAttributes attributes;
- gboolean ready;
-
- attributes = nautilus_view_query_get_popup_file_attributes ();
- ready = nautilus_file_check_if_ready (file, attributes);
-
- return ready;
-}
-
-static char **
-nautilus_view_query_get_default_component_sort_conditions (NautilusFile *file, char *default_component_string)
-{
- char **sort_conditions;
- char *supertype;
- char *mime_type;
-
- sort_conditions = g_new0 (char *, 4);
-
- mime_type = nautilus_file_get_mime_type (file);
-
- supertype = mime_type_get_supertype (mime_type);
-
- /* prefer the exact right IID */
- if (default_component_string != NULL) {
- sort_conditions[0] = g_strconcat ("iid == '", default_component_string, "'", NULL);
- } else {
- sort_conditions[0] = g_strdup ("true");
- }
-
- /* Prefer something that matches the exact type to something
- that matches the supertype */
- if (is_known_mime_type (mime_type)) {
- sort_conditions[1] = g_strconcat ("bonobo:supported_mime_types.has ('",mime_type,"')", NULL);
- } else {
- sort_conditions[1] = g_strdup ("true");
- }
-
- /* Prefer something that matches the supertype to something that matches `*' */
- if (is_known_mime_type (mime_type) && supertype != NULL) {
- sort_conditions[2] = g_strconcat ("bonobo:supported_mime_types.has ('",supertype,"')", NULL);
- } else {
- sort_conditions[2] = g_strdup ("true");
- }
-
- sort_conditions[3] = NULL;
-
- g_free (mime_type);
- g_free (supertype);
-
- return sort_conditions;
-}
-
-static Bonobo_ServerInfo *
-nautilus_view_query_get_default_component_for_file_internal (NautilusFile *file,
- gboolean fallback)
-{
- GList *info_list;
- char *default_component_string;
- char *mime_type;
- char *uri_scheme;
- GList *item_mime_types;
- Bonobo_ServerInfo *server;
- char **sort_conditions;
- char *extra_requirements;
- gboolean metadata_default;
-
- if (!nautilus_view_query_check_if_minimum_attributes_ready (file)) {
- return NULL;
- }
-
- info_list = NULL;
-
- mime_type = nautilus_file_get_mime_type (file);
-
- uri_scheme = nautilus_file_get_uri_scheme (file);
-
- if (!nautilus_view_query_check_if_full_attributes_ready (file) ||
- !nautilus_file_get_directory_item_mime_types (file, &item_mime_types)) {
- item_mime_types = NULL;
- }
-
- default_component_string = NULL;
- if (!fallback) {
- default_component_string = nautilus_file_get_metadata
- (file, NAUTILUS_METADATA_KEY_DEFAULT_COMPONENT, NULL);
- }
-
- if (default_component_string == NULL) {
- metadata_default = FALSE;
-
- if (nautilus_file_is_directory (file)) {
- default_component_string = nautilus_global_preferences_get_default_folder_viewer_preference_as_iid ();
- } else {
- g_warning ("Trying to load view for non-directory");
- /* Default component chosen based only on type. */
- }
- } else {
- metadata_default = TRUE;
- }
-
- sort_conditions = nautilus_view_query_get_default_component_sort_conditions (file, default_component_string);
-
- /* If the default is specified in the per-uri metadata,
- respect the setting regardless of content type requirements */
- if (metadata_default) {
- extra_requirements = g_strconcat ("iid == '", default_component_string, "'", NULL);
- info_list = nautilus_do_component_query (mime_type, uri_scheme, item_mime_types, TRUE,
- sort_conditions, extra_requirements, TRUE);
- g_free (extra_requirements);
- }
-
- if (info_list == NULL) {
- info_list = nautilus_do_component_query (mime_type, uri_scheme, item_mime_types, FALSE,
- sort_conditions, NULL, TRUE);
- }
-
- if (info_list != NULL) {
- server = Bonobo_ServerInfo_duplicate (info_list->data);
- gnome_vfs_mime_component_list_free (info_list);
- } else {
- server = NULL;
- }
-
- eel_g_list_free_deep (item_mime_types);
- g_strfreev (sort_conditions);
-
- g_free (uri_scheme);
- g_free (mime_type);
- g_free (default_component_string);
-
- return server;
-}
-
-
-Bonobo_ServerInfo *
-nautilus_view_query_get_default_component_for_file (NautilusFile *file)
-{
- return nautilus_view_query_get_default_component_for_file_internal (file, FALSE);
-}
-
-Bonobo_ServerInfo *
-nautilus_view_query_get_fallback_component_for_file (NautilusFile *file)
-{
- return nautilus_view_query_get_default_component_for_file_internal (file, TRUE);
-}
-
-
-GList *
-nautilus_view_query_get_components_for_file (NautilusFile *file)
-{
- char *mime_type;
- char *uri_scheme;
- GList *item_mime_types;
- GList *info_list;
-
- if (!nautilus_view_query_check_if_minimum_attributes_ready (file)) {
- return NULL;
- }
-
- uri_scheme = nautilus_file_get_uri_scheme (file);
-
- mime_type = nautilus_file_get_mime_type (file);
-
- if (!nautilus_view_query_check_if_full_attributes_ready (file) ||
- !nautilus_file_get_directory_item_mime_types (file, &item_mime_types)) {
- item_mime_types = NULL;
- }
-
- info_list = nautilus_do_component_query (mime_type, uri_scheme,
- item_mime_types, FALSE,
- NULL, NULL, TRUE);
-
- eel_g_list_free_deep (item_mime_types);
-
- g_free (uri_scheme);
- g_free (mime_type);
-
- return info_list;
-}
-
-GnomeVFSResult
-nautilus_view_query_set_default_component_for_file (NautilusFile *file,
- const char *component_iid)
-{
- g_return_val_if_fail (nautilus_view_query_check_if_minimum_attributes_ready (file),
- GNOME_VFS_ERROR_GENERIC);
-
- nautilus_file_set_metadata
- (file, NAUTILUS_METADATA_KEY_DEFAULT_COMPONENT, NULL, component_iid);
-
- return GNOME_VFS_OK;
-}
-
-static char *
-extract_prefix_add_suffix (const char *string,
- const char *separator,
- const char *suffix)
-{
- const char *separator_position;
- int prefix_length;
- char *result;
-
- separator_position = strstr (string, separator);
- prefix_length = separator_position == NULL
- ? (int) strlen (string)
- : separator_position - string;
-
- result = g_malloc (prefix_length + strlen(suffix) + 1);
-
- strncpy (result, string, prefix_length);
- result[prefix_length] = '\0';
-
- strcat (result, suffix);
-
- return result;
-}
-
-static char *
-mime_type_get_supertype (const char *mime_type)
-{
- if (mime_type == NULL || mime_type == '\0') {
- return g_strdup (mime_type);
- }
- return extract_prefix_add_suffix (mime_type, "/", "/*");
-}
-
-static char *
-make_bonobo_activation_query_with_known_mime_type (const char *mime_type,
- const char *uri_scheme,
- const char *extra_requirements,
- gboolean must_be_view)
-{
- char *mime_supertype;
- char *result;
- const char *view_as_name_logic;
-
- mime_supertype = mime_type_get_supertype (mime_type);
-
- if (must_be_view) {
- view_as_name_logic = "nautilus:view_as_name.defined ()";
- } else {
- view_as_name_logic = "true";
- }
-
- result = g_strdup_printf
- (
-
-
-
- /* Check that the component either has a specific
- * MIME type or URI scheme. If neither is specified,
- * then we don't trust that to mean "all MIME types
- * and all schemes". For that, you have to do a
- * wildcard for the MIME type or for the scheme.
- */
- "(bonobo:supported_mime_types.defined ()"
- "OR bonobo:supported_uri_schemes.defined ()"
- "OR bonobo:additional_uri_schemes.defined ())"
-
- /* One of two possibilties */
-
- /* FIXME bugzilla.gnome.org 42542: this comment is not very clear. */
- /* 1 The mime type and URI scheme match the supported
- attributes. */
-
- "AND ("
-
- /* Check that the supported MIME types include the
- * URI's MIME type or its supertype.
- */
- "(NOT bonobo:supported_mime_types.defined ()"
- "OR bonobo:supported_mime_types.has ('%s')"
- "OR bonobo:supported_mime_types.has ('%s')"
- "OR bonobo:supported_mime_types.has ('*/*'))"
-
- /* Check that the supported URI schemes include the
- * URI's scheme.
- */
- "AND (NOT bonobo:supported_uri_schemes.defined ()"
- "OR bonobo:supported_uri_schemes.has ('%s')"
- "OR bonobo:supported_uri_schemes.has ('*')))"
-
- /* 2 OR The additional URI schemes include this URI's
- scheme; if that is the case, this view applies
- whether or not the mime type is supported. */
-
- "OR (bonobo:additional_uri_schemes.has ('%s')"
- "OR bonobo:additional_uri_schemes.has ('*')))"
-
- /* Check that the component makes it clear that it's
- * intended for Nautilus by providing a "view_as"
- * name. We could instead support a default, but
- * that would make components that are untested with
- * Nautilus appear. */
- "AND %s)"
-
- /* Make it possible to add extra requirements */
- " AND (%s)"
-
- /* The MIME type, MIME supertype, and URI scheme for
- * the %s above.
- */
- , mime_type, mime_supertype, uri_scheme, uri_scheme,
-
- view_as_name_logic
-
- /* extra requirements */
- , extra_requirements != NULL ? extra_requirements : "true");
-
- if (must_be_view) {
- char *str;
-
-
- /* Check if the component has the interfaces we need.
- * We can work with either a Nautilus View, or
- * with a Bonobo Control or Embeddable that supports
- * one of the three persistence interfaces:
- * PersistStream, ProgressiveDataSink, or
- * PersistFile.
- */
- str = g_strdup_printf ("(((repo_ids.has_all (['IDL:Bonobo/Control:1.0',"
- "'IDL:Nautilus/View:1.0'])"
- "OR (repo_ids.has_one (['IDL:Bonobo/Control:1.0',"
- "'IDL:Bonobo/Embeddable:1.0'])"
- "AND repo_ids.has_one (['IDL:Bonobo/PersistStream:1.0',"
- "'IDL:Bonobo/ProgressiveDataSink:1.0',"
- "'IDL:Bonobo/PersistFile:1.0']))) "
- "AND %s", result);
- g_free (result);
- result = str;
- } else {
- char *str;
- str = g_strdup_printf ("((%s", result);
- g_free (result);
- result = str;
- }
-
- g_free (mime_supertype);
- return result;
-}
-
-static char *
-make_bonobo_activation_query_with_uri_scheme_only (const char *uri_scheme,
- const char *extra_requirements,
- gboolean must_be_view)
-{
- char *result;
- const char *view_as_name_logic;
-
- if (must_be_view) {
- view_as_name_logic = "nautilus:view_as_name.defined ()";
- } else {
- view_as_name_logic = "true";
- }
-
- result = g_strdup_printf
- (
-
- /* Check if the component supports this particular
- * URI scheme.
- */
- "((bonobo:supported_uri_schemes.has ('%s')"
- "OR bonobo:supported_uri_schemes.has ('*'))"
-
- /* Check that the component doesn't require
- * particular MIME types. Note that even saying you support "all"
- */
- "AND (NOT bonobo:supported_mime_types.defined ()))"
-
- /* FIXME bugzilla.gnome.org 42542: improve the comment explaining this. */
-
- /* This attribute allows uri schemes to be supported
- even for unsupported mime types or no mime type. */
- "OR (bonobo:additional_uri_schemes.has ('%s')"
- "OR bonobo:additional_uri_schemes.has ('*')))"
-
- /* Check that the component makes it clear that it's
- * intended for Nautilus by providing a "view_as"
- * name. We could instead support a default, but
- * that would make components that are untested with
- * Nautilus appear. */
- "AND %s)"
-
- /* Make it possible to add extra requirements */
- " AND (%s)"
-
- /* The URI scheme for the %s above. */
- , uri_scheme, uri_scheme, view_as_name_logic
-
- /* The explicit metafile iid query for the %s above. */
- , extra_requirements != NULL ? extra_requirements : "true");
-
-
- if (must_be_view) {
- char *str;
-
-
- /* Check if the component has the interfaces we need.
- * We can work with either a Nautilus View, or
- * with a Bonobo Control or Embeddable that supports
- * one of the three persistence interfaces:
- * PersistStream, ProgressiveDataSink, or
- * PersistFile.
- */
- str = g_strdup_printf ("(((repo_ids.has_all (['IDL:Bonobo/Control:1.0',"
- "'IDL:Nautilus/View:1.0'])"
- "OR (repo_ids.has_one (['IDL:Bonobo/Control:1.0',"
- "'IDL:Bonobo/Embeddable:1.0'])"
- "AND repo_ids.has_one (['IDL:Bonobo/PersistStream:1.0',"
- "'IDL:Bonobo/ProgressiveDataSink:1.0',"
- "'IDL:Bonobo/PersistFile:1.0']))) "
- "AND %s", result);
- g_free (result);
- result = str;
- } else {
- char *str;
- str = g_strdup_printf ("((%s", result);
- g_free (result);
- result = str;
- }
-
- return result;
-}
-
-
-
-static GHashTable *
-mime_type_list_to_hash_table (GList *types)
-{
- GHashTable *result;
- GList *p;
- char *mime_type;
-
- result = g_hash_table_new (g_str_hash, g_str_equal);
-
- for (p = types; p != NULL; p = p->next) {
- if (p->data != NULL) {
- mime_type = (char *) (p->data);
-
- if (g_hash_table_lookup (result, mime_type) == NULL) {
-#ifdef DEBUG_MJS
- printf ("XXX content mime type: %s\n", mime_type);
-#endif
- g_hash_table_insert (result, g_strdup (mime_type), mime_type);
- }
- }
- }
-
- return result;
-}
-
-static void
-free_key (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- g_free (key);
-}
-
-static void
-mime_type_hash_table_destroy (GHashTable *table)
-{
- g_hash_table_foreach (table, free_key, NULL);
- g_hash_table_destroy (table);
-}
-
-
-
-static gboolean
-server_has_content_requirements (Bonobo_ServerInfo *server)
-{
- Bonobo_ActivationProperty *prop;
-
- prop = bonobo_server_info_prop_find (server, "nautilus:required_directory_content_mime_types");
-
- if (prop == NULL || prop->v._d != Bonobo_ACTIVATION_P_STRINGV) {
- return FALSE;
- } else {
- return TRUE;
- }
-}
-
-static gboolean
-server_matches_content_requirements (Bonobo_ServerInfo *server,
- GHashTable *type_table)
-{
- Bonobo_ActivationProperty *prop;
- Bonobo_StringList types;
- guint i;
-
- if (!server_has_content_requirements (server)) {
- return TRUE;
- } else {
- prop = bonobo_server_info_prop_find (server, "nautilus:required_directory_content_mime_types");
-
- types = prop->v._u.value_stringv;
-
- for (i = 0; i < types._length; i++) {
- if (g_hash_table_lookup (type_table, types._buffer[i]) != NULL) {
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-
-
-/* FIXME: do we actually need this it would seem to me that the
- * test_only attribute handles this
- */
-static char *nautilus_sort_criteria[] = {
- /* Prefer anything else over the loser view. */
- "iid != 'OAFIID:Nautilus_Content_Loser'",
- /* Prefer anything else over the sample view. */
- "iid != 'OAFIID:Nautilus_Sample_Content_View'",
- /* Sort alphabetically */
- "name",
- NULL
-};
-
-static GList *
-nautilus_do_component_query (const char *mime_type,
- const char *uri_scheme,
- GList *item_mime_types,
- gboolean ignore_content_mime_types,
- char **extra_sort_criteria,
- char *extra_requirements,
- gboolean must_be_view)
-{
- Bonobo_ServerInfoList *bonobo_activation_result;
- char *query;
- GList *retval;
- char **all_sort_criteria;
- CORBA_Environment ev;
-
- bonobo_activation_result = NULL;
- query = NULL;
-
- if (is_known_mime_type (mime_type)) {
- query = make_bonobo_activation_query_with_known_mime_type (mime_type, uri_scheme, extra_requirements, must_be_view);
- } else {
- query = make_bonobo_activation_query_with_uri_scheme_only (uri_scheme, extra_requirements, must_be_view);
- }
-
- all_sort_criteria = strv_concat (extra_sort_criteria, nautilus_sort_criteria);
-
- CORBA_exception_init (&ev);
-
- bonobo_activation_result = bonobo_activation_query (query, all_sort_criteria, &ev);
-
- g_free (all_sort_criteria);
- g_free (query);
-
- retval = NULL;
-
- if (ev._major == CORBA_NO_EXCEPTION && bonobo_activation_result != NULL && bonobo_activation_result->_length > 0) {
- GHashTable *content_types;
- guint i;
-
- content_types = mime_type_list_to_hash_table (item_mime_types);
-
- for (i = 0; i < bonobo_activation_result->_length; i++) {
- Bonobo_ServerInfo *server;
-
- server = &bonobo_activation_result->_buffer[i];
-
- if (ignore_content_mime_types ||
- server_matches_content_requirements (server, content_types)) {
- if (server->iid != NULL) {
- retval = g_list_prepend
- (retval,
- Bonobo_ServerInfo_duplicate (server));
- }
- }
- }
-
- mime_type_hash_table_destroy (content_types);
- }
-
- CORBA_free (bonobo_activation_result);
-
- CORBA_exception_free (&ev);
-
- return g_list_reverse (retval);
-}
-
-static int
-strv_length (char **a)
-{
- int i;
-
- for (i = 0; a != NULL && a[i] != NULL; i++) {
- }
-
- return i;
-}
-
-static char **
-strv_concat (char **a,
- char **b)
-{
- int a_length;
- int b_length;
- int i;
- int j;
-
- char **result;
-
- a_length = strv_length (a);
- b_length = strv_length (b);
-
- result = g_new0 (char *, a_length + b_length + 1);
-
- j = 0;
-
- for (i = 0; a != NULL && a[i] != NULL; i++) {
- result[j] = a[i];
- j++;
- }
-
- for (i = 0; b != NULL && b[i] != NULL; i++) {
- result[j] = b[i];
- j++;
- }
-
- result[j] = NULL;
-
- return result;
-}
-
-GList *
-nautilus_view_query_get_popup_components_for_file (NautilusFile *file)
-{
- char *mime_type;
- char *uri_scheme;
- char *extra_reqs;
- GList *item_mime_types;
- GList *info_list;
-
- if (!nautilus_view_query_check_if_popup_attributes_ready (file)) {
- return NULL;
- }
-
- uri_scheme = nautilus_file_get_uri_scheme (file);
-
- mime_type = nautilus_file_get_mime_type (file);
-
- if (!nautilus_view_query_check_if_full_attributes_ready (file) ||
- !nautilus_file_get_directory_item_mime_types (file, &item_mime_types)) {
- item_mime_types = NULL;
- }
-
- extra_reqs = "repo_ids.has ('IDL:Bonobo/Listener:1.0') AND (nautilus:context_menu_handler == true) AND nautilus:can_handle_multiple_files.defined()";
-
- info_list = nautilus_do_component_query (mime_type, uri_scheme,
- item_mime_types, FALSE,
- NULL, extra_reqs, FALSE);
-
- eel_g_list_free_deep (item_mime_types);
-
- g_free (uri_scheme);
- g_free (mime_type);
-
- return info_list;
-}
-
-GList *
-nautilus_view_query_get_property_components_for_file (NautilusFile *file)
-{
- char *mime_type;
- char *uri_scheme;
- char *extra_reqs;
- GList *item_mime_types;
- GList *info_list;
-
- if (!nautilus_view_query_check_if_minimum_attributes_ready (file)) {
- return NULL;
- }
-
- uri_scheme = nautilus_file_get_uri_scheme (file);
-
- mime_type = nautilus_file_get_mime_type (file);
-
- if (!nautilus_view_query_check_if_full_attributes_ready (file) ||
- !nautilus_file_get_directory_item_mime_types (file, &item_mime_types
-)) {
- item_mime_types = NULL;
- }
-
- extra_reqs = "repo_ids.has ('IDL:Bonobo/Control:1.0') AND nautilus:property_page_name.defined()";
-
- info_list = nautilus_do_component_query (mime_type, uri_scheme,
- item_mime_types, FALSE,
- NULL, extra_reqs, FALSE);
-
- eel_g_list_free_deep (item_mime_types);
-
- g_free (uri_scheme);
- g_free (mime_type);
-
- return info_list;
-}
-
-static gboolean
-has_server_info_in_list (GList *list, Bonobo_ServerInfo *info)
-{
- for (; list; list = list->next) {
- Bonobo_ServerInfo *tmp_info = list->data;
-
- if (strcmp (tmp_info->iid, info->iid) == 0) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static GList *
-server_info_list_intersection (GList *a, GList *b)
-{
- GList *result = NULL;
-
- if (a == NULL || b == NULL) {
- return NULL;
- }
-
- while (b) {
- Bonobo_ServerInfo *info;
-
- info = (Bonobo_ServerInfo *)b->data;
-
- if (has_server_info_in_list (a, info)) {
- result = g_list_prepend (result,
- Bonobo_ServerInfo_duplicate (info));
-
- }
-
- b = b->next;
- }
-
- return g_list_reverse (result);
-}
-
-GList *
-nautilus_view_query_get_property_components_for_files (GList *files)
-{
- GList *result, *l;
-
- result = NULL;
-
- for (l = files; l; l = l->next) {
- GList *components, *new_result;
-
- components = nautilus_view_query_get_property_components_for_file (l->data);
- if (result != NULL) {
- new_result = server_info_list_intersection (result,
- components);
- gnome_vfs_mime_component_list_free (result);
- gnome_vfs_mime_component_list_free (components);
- result = new_result;
- } else {
- result = components;;
- }
-
-
- }
-
- return result;
-}
-
-GList *
-nautilus_view_query_get_popup_components_for_files (GList *files)
-{
- GList *result, *l;
-
- result = NULL;
-
- for (l = files; l; l = l->next) {
- GList *components, *new_result;
-
- components = nautilus_view_query_get_popup_components_for_file (l->data);
- if (result != NULL) {
- new_result = server_info_list_intersection (result,
- components);
- gnome_vfs_mime_component_list_free (result);
- gnome_vfs_mime_component_list_free (components);
- result = new_result;
- } else {
- result = components;;
- }
-
-
- }
-
- return result;
-}
diff --git a/libnautilus-private/nautilus-view-query.h b/libnautilus-private/nautilus-view-query.h
deleted file mode 100644
index 4907abbbf..000000000
--- a/libnautilus-private/nautilus-view-query.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-mime-actions.h - uri-specific versions of mime action functions
-
- 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: Maciej Stachowiak <mjs@eazel.com>
-*/
-
-#ifndef NAUTILUS_VIEW_QUERY_H
-#define NAUTILUS_VIEW_QUERY_H
-
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-
-#include <libnautilus-private/nautilus-file.h>
-
-
-Bonobo_ServerInfo * nautilus_view_query_get_default_component_for_file (NautilusFile *file);
-GnomeVFSResult nautilus_view_query_set_default_component_for_file
- (NautilusFile *file,
- const char *iid);
-Bonobo_ServerInfo * nautilus_view_query_get_fallback_component_for_file (NautilusFile *file);
-GList * nautilus_view_query_get_components_for_file
- (NautilusFile *file);
-gboolean nautilus_view_query_has_any_components_for_file (NautilusFile *file);
-
-gboolean nautilus_view_query_has_any_components_for_uri_scheme (const char *uri_scheme);
-
-
-/* Bonobo components for popup menus and property pages - should probably
- * be moved into the bonobo extensions */
-GList * nautilus_view_query_get_popup_components_for_file (NautilusFile *file);
-GList * nautilus_view_query_get_popup_components_for_files (GList *files);
-GList * nautilus_view_query_get_property_components_for_file (NautilusFile *file);
-GList * nautilus_view_query_get_property_components_for_files (GList *files);
-
-#endif /* NAUTILUS_MIME_ACTIONS_H */
diff --git a/libnautilus-private/nautilus-view.c b/libnautilus-private/nautilus-view.c
new file mode 100644
index 000000000..bad36efc8
--- /dev/null
+++ b/libnautilus-private/nautilus-view.c
@@ -0,0 +1,251 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-view.c: Interface for nautilus views
+
+ 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.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+*/
+
+#include <config.h>
+#include "nautilus-view.h"
+
+enum {
+ TITLE_CHANGED,
+ ZOOM_PARAMETERS_CHANGED,
+ ZOOM_LEVEL_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint nautilus_view_signals[LAST_SIGNAL] = { 0 };
+
+static void
+nautilus_view_base_init (gpointer g_class)
+{
+ static gboolean initialized = FALSE;
+
+ if (! initialized) {
+ nautilus_view_signals[TITLE_CHANGED] =
+ g_signal_new ("title_changed",
+ NAUTILUS_TYPE_VIEW,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusViewIface, title_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ nautilus_view_signals[ZOOM_PARAMETERS_CHANGED] =
+ g_signal_new ("zoom_parameters_changed",
+ NAUTILUS_TYPE_VIEW,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusViewIface, zoom_parameters_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ nautilus_view_signals[ZOOM_LEVEL_CHANGED] =
+ g_signal_new ("zoom_level_changed",
+ NAUTILUS_TYPE_VIEW,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusViewIface, zoom_level_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ initialized = TRUE;
+ }
+}
+
+GType
+nautilus_view_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (NautilusViewIface),
+ nautilus_view_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "NautilusView",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+const char *
+nautilus_view_get_view_id (NautilusView *view)
+{
+ g_return_val_if_fail (NAUTILUS_IS_VIEW (view), NULL);
+
+ return (* NAUTILUS_VIEW_GET_IFACE (view)->get_view_id) (view);
+}
+
+GtkWidget *
+nautilus_view_get_widget (NautilusView *view)
+{
+ g_return_val_if_fail (NAUTILUS_IS_VIEW (view), NULL);
+
+ return (* NAUTILUS_VIEW_GET_IFACE (view)->get_widget) (view);
+}
+
+void
+nautilus_view_load_location (NautilusView *view,
+ const char *location_uri)
+{
+ g_return_if_fail (NAUTILUS_IS_VIEW (view));
+ g_return_if_fail (location_uri != NULL);
+
+ (* NAUTILUS_VIEW_GET_IFACE (view)->load_location) (view,
+ location_uri);
+}
+
+void
+nautilus_view_stop_loading (NautilusView *view)
+{
+ g_return_if_fail (NAUTILUS_IS_VIEW (view));
+
+ (* NAUTILUS_VIEW_GET_IFACE (view)->stop_loading) (view);
+}
+
+int
+nautilus_view_get_selection_count (NautilusView *view)
+{
+ g_return_val_if_fail (NAUTILUS_IS_VIEW (view), 0);
+
+ return (* NAUTILUS_VIEW_GET_IFACE (view)->get_selection_count) (view);
+}
+
+GList *
+nautilus_view_get_selection (NautilusView *view)
+{
+ g_return_val_if_fail (NAUTILUS_IS_VIEW (view), NULL);
+
+ return (* NAUTILUS_VIEW_GET_IFACE (view)->get_selection) (view);
+}
+
+void
+nautilus_view_set_selection (NautilusView *view,
+ GList *list)
+{
+ g_return_if_fail (NAUTILUS_IS_VIEW (view));
+
+ (* NAUTILUS_VIEW_GET_IFACE (view)->set_selection) (view,
+ list);
+}
+
+
+char *
+nautilus_view_get_first_visible_file (NautilusView *view)
+{
+ g_return_val_if_fail (NAUTILUS_IS_VIEW (view), NULL);
+
+ return (* NAUTILUS_VIEW_GET_IFACE (view)->get_first_visible_file) (view);
+}
+
+void
+nautilus_view_scroll_to_file (NautilusView *view,
+ const char *uri)
+{
+ g_return_if_fail (NAUTILUS_IS_VIEW (view));
+
+ (* NAUTILUS_VIEW_GET_IFACE (view)->scroll_to_file) (view, uri);
+}
+
+char *
+nautilus_view_get_title (NautilusView *view)
+{
+ g_return_val_if_fail (NAUTILUS_IS_VIEW (view), NULL);
+
+ if (NAUTILUS_VIEW_GET_IFACE (view)->get_title != NULL) {
+ return (* NAUTILUS_VIEW_GET_IFACE (view)->get_title) (view);
+ } else {
+ return NULL;
+ }
+}
+
+
+gboolean
+nautilus_view_supports_zooming (NautilusView *view)
+{
+ g_return_val_if_fail (NAUTILUS_IS_VIEW (view), FALSE);
+
+ return (* NAUTILUS_VIEW_GET_IFACE (view)->supports_zooming) (view);
+}
+
+void
+nautilus_view_bump_zoom_level (NautilusView *view,
+ int zoom_increment)
+{
+ g_return_if_fail (NAUTILUS_IS_VIEW (view));
+
+ (* NAUTILUS_VIEW_GET_IFACE (view)->bump_zoom_level) (view,
+ zoom_increment);
+}
+
+void
+nautilus_view_zoom_to_level (NautilusView *view,
+ NautilusZoomLevel level)
+{
+ g_return_if_fail (NAUTILUS_IS_VIEW (view));
+
+ (* NAUTILUS_VIEW_GET_IFACE (view)->zoom_to_level) (view,
+ level);
+}
+
+void
+nautilus_view_restore_default_zoom_level (NautilusView *view)
+{
+ g_return_if_fail (NAUTILUS_IS_VIEW (view));
+
+ (* NAUTILUS_VIEW_GET_IFACE (view)->restore_default_zoom_level) (view);
+}
+
+gboolean
+nautilus_view_can_zoom_in (NautilusView *view)
+{
+ g_return_val_if_fail (NAUTILUS_IS_VIEW (view), FALSE);
+
+ return (* NAUTILUS_VIEW_GET_IFACE (view)->can_zoom_in) (view);
+}
+
+gboolean
+nautilus_view_can_zoom_out (NautilusView *view)
+{
+ g_return_val_if_fail (NAUTILUS_IS_VIEW (view), FALSE);
+
+ return (* NAUTILUS_VIEW_GET_IFACE (view)->can_zoom_out) (view);
+}
+
+NautilusZoomLevel
+nautilus_view_get_zoom_level (NautilusView *view)
+{
+ g_return_val_if_fail (NAUTILUS_IS_VIEW (view), NAUTILUS_ZOOM_LEVEL_STANDARD);
+
+ return (* NAUTILUS_VIEW_GET_IFACE (view)->get_zoom_level) (view);
+}
diff --git a/libnautilus-private/nautilus-view.h b/libnautilus-private/nautilus-view.h
new file mode 100644
index 000000000..b4b90fe39
--- /dev/null
+++ b/libnautilus-private/nautilus-view.h
@@ -0,0 +1,147 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-view.h: Interface for nautilus views
+
+ 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.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+*/
+
+#ifndef NAUTILUS_VIEW_H
+#define NAUTILUS_VIEW_H
+
+#include <glib-object.h>
+#include <gtk/gtkwidget.h>
+
+/* For NautilusZoomLevel */
+#include <libnautilus-private/nautilus-icon-factory.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_VIEW (nautilus_view_get_type ())
+#define NAUTILUS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_VIEW, NautilusView))
+#define NAUTILUS_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_VIEW))
+#define NAUTILUS_VIEW_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_VIEW, NautilusViewIface))
+
+
+typedef struct _NautilusView NautilusView; /* dummy typedef */
+typedef struct _NautilusViewIface NautilusViewIface;
+
+struct _NautilusViewIface
+{
+ GTypeInterface g_iface;
+
+ /* Signals: */
+
+ /* emitted when the view-specific title as returned by get_title changes */
+ void (* title_changed) (NautilusView *view);
+
+ /* BONOBOTODO: remove this? */
+ void (* zoom_parameters_changed)(NautilusView *view);
+ void (* zoom_level_changed) (NautilusView *view);
+
+ /* VTable: */
+
+ /* Get the id string for this view. Its a constant string, not memory managed */
+ const char * (* get_view_id) (NautilusView *view);
+
+ /* Get the widget for this view, can be the same object or a different
+ object owned by the view. Doesn't ref the widget. */
+ GtkWidget * (* get_widget) (NautilusView *view);
+
+ /* Called to tell the view to start loading a location, or to reload it.
+ The view responds with a load_underway as soon as it starts loading,
+ and a load_complete when the location is completely read. */
+ void (* load_location) (NautilusView *view,
+ const char *location_uri);
+
+ /* Called to tell the view to stop loading the location its currently loading */
+ void (* stop_loading) (NautilusView *view);
+
+ /* Returns the number of selected items in the view */
+ int (* get_selection_count) (NautilusView *view);
+
+ /* Returns a list of uris for th selected items in the view, caller frees it */
+ GList * (* get_selection) (NautilusView *view);
+
+ /* This is called when the window wants to change the selection in the view */
+ void (* set_selection) (NautilusView *view,
+ GList *list);
+
+ /* Return the uri of the first visible file */
+ char * (* get_first_visible_file) (NautilusView *view);
+ /* Scroll the view so that the file specified by the uri is at the top
+ of the view */
+ void (* scroll_to_file) (NautilusView *view,
+ const char *uri);
+
+ /* This function can supply a special window title, if you don't want one
+ have this function return NULL, or just don't supply a function */
+ char * (* get_title) (NautilusView *view);
+
+
+ /* Zoom support */
+ gboolean (* supports_zooming) (NautilusView *view);
+ void (* bump_zoom_level) (NautilusView *view,
+ int zoom_increment);
+ void (* zoom_to_level) (NautilusView *view,
+ NautilusZoomLevel level);
+ NautilusZoomLevel (* get_zoom_level) (NautilusView *view);
+ void (* restore_default_zoom_level) (NautilusView *view);
+ gboolean (* can_zoom_in) (NautilusView *view);
+ gboolean (* can_zoom_out) (NautilusView *view);
+
+ /* Padding for future expansion */
+ void (*_reserved1) (void);
+ void (*_reserved2) (void);
+ void (*_reserved3) (void);
+ void (*_reserved4) (void);
+ void (*_reserved5) (void);
+ void (*_reserved6) (void);
+ void (*_reserved7) (void);
+ void (*_reserved8) (void);
+};
+
+GType nautilus_view_get_type (void);
+
+const char * nautilus_view_get_view_id (NautilusView *view);
+GtkWidget * nautilus_view_get_widget (NautilusView *view);
+void nautilus_view_load_location (NautilusView *view,
+ const char *location_uri);
+void nautilus_view_stop_loading (NautilusView *view);
+int nautilus_view_get_selection_count (NautilusView *view);
+GList * nautilus_view_get_selection (NautilusView *view);
+void nautilus_view_set_selection (NautilusView *view,
+ GList *list);
+char * nautilus_view_get_first_visible_file (NautilusView *view);
+void nautilus_view_scroll_to_file (NautilusView *view,
+ const char *uri);
+char * nautilus_view_get_title (NautilusView *view);
+gboolean nautilus_view_supports_zooming (NautilusView *view);
+void nautilus_view_bump_zoom_level (NautilusView *view,
+ int zoom_increment);
+void nautilus_view_zoom_to_level (NautilusView *view,
+ NautilusZoomLevel level);
+void nautilus_view_restore_default_zoom_level (NautilusView *view);
+gboolean nautilus_view_can_zoom_in (NautilusView *view);
+gboolean nautilus_view_can_zoom_out (NautilusView *view);
+NautilusZoomLevel nautilus_view_get_zoom_level (NautilusView *view);
+
+G_END_DECLS
+
+#endif /* NAUTILUS_VIEW_H */
diff --git a/libnautilus-private/nautilus-window-info.c b/libnautilus-private/nautilus-window-info.c
new file mode 100644
index 000000000..3ea5b89ac
--- /dev/null
+++ b/libnautilus-private/nautilus-window-info.c
@@ -0,0 +1,261 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-window-info.c: Interface for nautilus window
+
+ 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.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+*/
+
+#include <config.h>
+#include "nautilus-window-info.h"
+
+enum {
+ LOADING_URI,
+ SELECTION_CHANGED,
+ TITLE_CHANGED,
+ HIDDEN_FILES_MODE_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint nautilus_window_info_signals[LAST_SIGNAL] = { 0 };
+
+static void
+nautilus_window_info_base_init (gpointer g_class)
+{
+ static gboolean initialized = FALSE;
+
+ if (! initialized) {
+ nautilus_window_info_signals[LOADING_URI] =
+ g_signal_new ("loading_uri",
+ NAUTILUS_TYPE_WINDOW_INFO,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusWindowInfoIface, loading_uri),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
+
+ nautilus_window_info_signals[SELECTION_CHANGED] =
+ g_signal_new ("selection_changed",
+ NAUTILUS_TYPE_WINDOW_INFO,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusWindowInfoIface, selection_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ nautilus_window_info_signals[TITLE_CHANGED] =
+ g_signal_new ("title_changed",
+ NAUTILUS_TYPE_WINDOW_INFO,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusWindowInfoIface, title_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
+
+ nautilus_window_info_signals[HIDDEN_FILES_MODE_CHANGED] =
+ g_signal_new ("hidden_files_mode_changed",
+ NAUTILUS_TYPE_WINDOW_INFO,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusWindowInfoIface, hidden_files_mode_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ initialized = TRUE;
+ }
+}
+
+GType
+nautilus_window_info_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (NautilusWindowInfoIface),
+ nautilus_window_info_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "NautilusWindowInfo",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+void
+nautilus_window_info_report_load_underway (NautilusWindowInfo *window,
+ NautilusView *view)
+{
+ g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
+ g_return_if_fail (NAUTILUS_IS_VIEW (view));
+
+ (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->report_load_underway) (window,
+ view);
+}
+
+void
+nautilus_window_info_report_load_complete (NautilusWindowInfo *window,
+ NautilusView *view)
+{
+ g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
+ g_return_if_fail (NAUTILUS_IS_VIEW (view));
+
+ (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->report_load_complete) (window,
+ view);
+}
+
+void
+nautilus_window_info_report_view_failed (NautilusWindowInfo *window,
+ NautilusView *view)
+{
+ g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
+ g_return_if_fail (NAUTILUS_IS_VIEW (view));
+
+ (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->report_view_failed) (window,
+ view);
+}
+
+void
+nautilus_window_info_report_selection_changed (NautilusWindowInfo *window)
+{
+ g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
+
+ (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->report_selection_changed) (window);
+}
+
+void
+nautilus_window_info_open_location (NautilusWindowInfo *window,
+ const char *location,
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags,
+ GList *selection)
+{
+ g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
+
+ (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->open_location) (window,
+ location,
+ mode,
+ flags,
+ selection);
+}
+
+void
+nautilus_window_info_close (NautilusWindowInfo *window)
+{
+ g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
+
+ (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->close_window) (window);
+}
+
+void
+nautilus_window_info_set_status (NautilusWindowInfo *window,
+ const char *status)
+{
+ g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
+
+ (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->set_status) (window,
+ status);
+}
+
+NautilusWindowType
+nautilus_window_info_get_window_type (NautilusWindowInfo *window)
+{
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NAUTILUS_WINDOW_SPATIAL);
+
+ return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_window_type) (window);
+}
+
+char *
+nautilus_window_info_get_title (NautilusWindowInfo *window)
+{
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL);
+
+ return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_title) (window);
+}
+
+GList *
+nautilus_window_info_get_history (NautilusWindowInfo *window)
+{
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL);
+
+ return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_history) (window);
+}
+
+char *
+nautilus_window_info_get_current_location (NautilusWindowInfo *window)
+{
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL);
+
+ return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_current_location) (window);
+}
+
+int
+nautilus_window_info_get_selection_count (NautilusWindowInfo *window)
+{
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), 0);
+
+ return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_selection_count) (window);
+}
+
+GList *
+nautilus_window_info_get_selection (NautilusWindowInfo *window)
+{
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL);
+
+ return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_selection) (window);
+}
+
+NautilusWindowShowHiddenFilesMode
+nautilus_window_info_get_hidden_files_mode (NautilusWindowInfo *window)
+{
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT);
+
+ return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_hidden_files_mode) (window);
+}
+
+void
+nautilus_window_info_set_hidden_files_mode (NautilusWindowInfo *window,
+ NautilusWindowShowHiddenFilesMode mode)
+{
+ g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
+
+ (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->set_hidden_files_mode) (window,
+ mode);
+}
+
+GtkUIManager *
+nautilus_window_info_get_ui_manager (NautilusWindowInfo *window)
+{
+ g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL);
+
+ return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_ui_manager) (window);
+}
+
diff --git a/libnautilus-private/nautilus-window-info.h b/libnautilus-private/nautilus-window-info.h
new file mode 100644
index 000000000..ba6bfe3c5
--- /dev/null
+++ b/libnautilus-private/nautilus-window-info.h
@@ -0,0 +1,164 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
+
+ nautilus-window-info.h: Interface for nautilus windows
+
+ 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.
+
+ Author: Alexander Larsson <alexl@redhat.com>
+*/
+
+#ifndef NAUTILUS_WINDOW_INFO_H
+#define NAUTILUS_WINDOW_INFO_H
+
+#include <glib-object.h>
+#include <libnautilus-private/nautilus-view.h>
+#include <gtk/gtkuimanager.h>
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+ NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT,
+ NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_ENABLE,
+ NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DISABLE
+} NautilusWindowShowHiddenFilesMode;
+
+
+typedef enum {
+ NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
+ NAUTILUS_WINDOW_OPEN_IN_SPATIAL,
+ NAUTILUS_WINDOW_OPEN_IN_NAVIGATION
+} NautilusWindowOpenMode;
+
+typedef enum {
+ NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND = 1<<0
+} NautilusWindowOpenFlags;
+
+typedef enum {
+ NAUTILUS_WINDOW_SPATIAL,
+ NAUTILUS_WINDOW_NAVIGATION,
+ NAUTILUS_WINDOW_DESKTOP
+} NautilusWindowType;
+
+#define NAUTILUS_TYPE_WINDOW_INFO (nautilus_window_info_get_type ())
+#define NAUTILUS_WINDOW_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_WINDOW_INFO, NautilusWindowInfo))
+#define NAUTILUS_IS_WINDOW_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_WINDOW_INFO))
+#define NAUTILUS_WINDOW_INFO_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_WINDOW_INFO, NautilusWindowInfoIface))
+
+#ifndef NAUTILUS_WINDOW_DEFINED
+#define NAUTILUS_WINDOW_DEFINED
+/* Using NautilusWindow for the vtable to make implementing this in
+ * NautilusWindow easier */
+typedef struct NautilusWindow NautilusWindow;
+#endif
+
+typedef NautilusWindow NautilusWindowInfo;
+
+typedef struct _NautilusWindowInfoIface NautilusWindowInfoIface;
+
+struct _NautilusWindowInfoIface
+{
+ GTypeInterface g_iface;
+
+ /* signals: */
+
+ void (* loading_uri) (NautilusWindowInfo *window,
+ const char *uri);
+ /* Emitted when the view in the window changes the selection */
+ void (* selection_changed) (NautilusWindowInfo *window);
+ void (* title_changed) (NautilusWindowInfo *window,
+ const char *title);
+ void (* hidden_files_mode_changed)(NautilusWindowInfo *window);
+
+ /* VTable: */
+ /* A view calls this once after a load_location, once it starts loading the
+ * directory. Might be called directly, or later on the mainloop.
+ * This can also be called at any other time if the view needs to
+ * re-load the location. But the view needs to call load_complete first if
+ * its currently loading. */
+ void (* report_load_underway) (NautilusWindowInfo *window,
+ NautilusView *view);
+ /* A view calls this once after reporting load_underway, when the location
+ has been fully loaded, or when the load was stopped
+ (by an error or by the user). */
+ void (* report_load_complete) (NautilusWindowInfo *window,
+ NautilusView *view);
+ /* This can be called at any time when there has been a catastrophic failure of
+ the view. It will result in the view being removed. */
+ void (* report_view_failed) (NautilusWindowInfo *window,
+ NautilusView *view);
+ void (* report_selection_changed) (NautilusWindowInfo *window);
+
+ /* Returns the number of selected items in the view */
+ int (* get_selection_count) (NautilusWindowInfo *window);
+
+ /* Returns a list of uris for th selected items in the view, caller frees it */
+ GList *(* get_selection) (NautilusWindowInfo *window);
+
+ char * (* get_current_location) (NautilusWindowInfo *window);
+ void (* set_status) (NautilusWindowInfo *window,
+ const char *status);
+ char * (* get_title) (NautilusWindowInfo *window);
+ GList *(* get_history) (NautilusWindowInfo *window);
+ NautilusWindowType
+ (* get_window_type) (NautilusWindowInfo *window);
+ NautilusWindowShowHiddenFilesMode
+ (* get_hidden_files_mode) (NautilusWindowInfo *window);
+ void (* set_hidden_files_mode) (NautilusWindowInfo *window,
+ NautilusWindowShowHiddenFilesMode mode);
+
+ void (* open_location) (NautilusWindowInfo *window,
+ const char *location,
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags,
+ GList *selection);
+ void (* close_window) (NautilusWindowInfo *window);
+ GtkUIManager * (* get_ui_manager) (NautilusWindowInfo *window);
+};
+
+GType nautilus_window_info_get_type (void);
+void nautilus_window_info_report_load_underway (NautilusWindowInfo *window,
+ NautilusView *view);
+void nautilus_window_info_report_load_complete (NautilusWindowInfo *window,
+ NautilusView *view);
+void nautilus_window_info_report_view_failed (NautilusWindowInfo *window,
+ NautilusView *view);
+void nautilus_window_info_report_selection_changed (NautilusWindowInfo *window);
+void nautilus_window_info_open_location (NautilusWindowInfo *window,
+ const char *location,
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags,
+ GList *selection);
+void nautilus_window_info_close (NautilusWindowInfo *window);
+void nautilus_window_info_set_status (NautilusWindowInfo *window,
+ const char *status);
+NautilusWindowType nautilus_window_info_get_window_type (NautilusWindowInfo *window);
+char * nautilus_window_info_get_title (NautilusWindowInfo *window);
+GList * nautilus_window_info_get_history (NautilusWindowInfo *window);
+char * nautilus_window_info_get_current_location (NautilusWindowInfo *window);
+int nautilus_window_info_get_selection_count (NautilusWindowInfo *window);
+GList * nautilus_window_info_get_selection (NautilusWindowInfo *window);
+NautilusWindowShowHiddenFilesMode nautilus_window_info_get_hidden_files_mode (NautilusWindowInfo *window);
+void nautilus_window_info_set_hidden_files_mode (NautilusWindowInfo *window,
+ NautilusWindowShowHiddenFilesMode mode);
+GtkUIManager * nautilus_window_info_get_ui_manager (NautilusWindowInfo *window);
+
+
+G_END_DECLS
+
+#endif /* NAUTILUS_WINDOW_INFO_H */
diff --git a/libnautilus/Makefile.am b/libnautilus/Makefile.am
deleted file mode 100644
index ac57623d9..000000000
--- a/libnautilus/Makefile.am
+++ /dev/null
@@ -1,105 +0,0 @@
-include $(top_srcdir)/Makefile.shared
-
-lib_LTLIBRARIES=libnautilus.la
-
-INCLUDES=\
- -I$(top_srcdir) \
- -I$(top_builddir) \
- $(LIBNAUTILUS_CFLAGS) \
- $(DISABLE_DEPRECATED_CFLAGS) \
- -DDATADIR=\""$(datadir)"\" \
- $(NULL)
-
-libnautilus_la_LDFLAGS=\
- -version-info 2:0:0 \
- $(LIBNAUTILUS_LIBS) \
- -no-undefined \
- $(NULL)
-
-nautilus_view_component_idl_sources = \
- nautilus-view-component-stubs.c \
- nautilus-view-component-skels.c \
- nautilus-view-component.h \
- nautilus-view-component-common.c
-
-nautilus_distributed_undo_idl_sources = \
- nautilus-distributed-undo-stubs.c \
- nautilus-distributed-undo-skels.c \
- nautilus-distributed-undo.h \
- nautilus-distributed-undo-common.c
-
-libnautilusincludedir=$(includedir)/libnautilus
-
-libnautilusinclude_HEADERS= \
- libnautilus.h \
- nautilus-bonobo-ui.h \
- nautilus-clipboard.h \
- nautilus-distributed-undo.h \
- nautilus-idle-queue.h \
- nautilus-scroll-positionable.h \
- nautilus-view-component.h \
- nautilus-view.h \
- nautilus-view-standard-main.h \
- nautilus-undo.h \
- nautilus-undo-private.h \
- $(NULL)
-
-libnautilus_la_SOURCES= \
- $(nautilus_view_component_idl_sources) \
- $(nautilus_distributed_undo_idl_sources) \
- nautilus-clipboard.c \
- nautilus-idle-queue.c \
- nautilus-scroll-positionable.c \
- nautilus-undo-transaction.c \
- nautilus-undo-transaction.h \
- nautilus-undo.c \
- nautilus-view.c \
- nautilus-view-standard-main.c \
- $(NULL)
-
-$(nautilus_view_component_idl_sources): nautilus_view_component_idl_stamp
-nautilus_view_component_idl_stamp: nautilus-view-component.idl $(ORBIT_IDL)
- $(ORBIT_IDL) $(LIBNAUTILUS_IDL_INCLUDES) --define=__nautilus_view_component_COMPILATION $<
- touch $@
-
-$(nautilus_distributed_undo_idl_sources): nautilus_distributed_undo_idl_stamp
-nautilus_distributed_undo_idl_stamp: nautilus-distributed-undo.idl $(ORBIT_IDL)
- $(ORBIT_IDL) $(LIBNAUTILUS_IDL_INCLUDES) $<
- touch $@
-
-$(libnautilus_la_OBJECTS): nautilus_view_component_idl_stamp nautilus_distributed_undo_idl_stamp
-
-uidir = $(datadir)/gnome-2.0/ui
-ui_DATA = \
- nautilus-clipboard-ui.xml \
- $(NULL)
-
-idldir = $(datadir)/idl
-idl_DATA = \
- nautilus-view-component.idl \
- nautilus-distributed-undo.idl \
- $(NULL)
-
-pkgconfigdir=$(libdir)/pkgconfig
-pkgconfig_DATA=libnautilus.pc
-
-EXTRA_DIST = \
- $(ui_DATA) \
- $(idl_DATA) \
- libnautilus.pc.in \
- $(NULL)
-
-BUILT_SOURCES = \
- $(nautilus_view_component_idl_sources) \
- $(nautilus_distributed_undo_idl_sources) \
- $(NULL)
-
-CLEANFILES = \
- $(nautilus_view_component_idl_sources) \
- nautilus_view_component_idl_stamp \
- $(nautilus_distributed_undo_idl_sources) \
- nautilus_distributed_undo_idl_stamp \
- $(NULL)
-
-dist-hook:
- cd $(distdir); rm -f $(CLEANFILES)
diff --git a/libnautilus/README b/libnautilus/README
deleted file mode 100644
index 992cf548e..000000000
--- a/libnautilus/README
+++ /dev/null
@@ -1,5 +0,0 @@
-README for nautilus/libnautilus
-
-This library, libnautilus, is ALL you need to link with to create
-a nautilus component.
-
diff --git a/libnautilus/libnautilus.h b/libnautilus/libnautilus.h
deleted file mode 100644
index ed3acf202..000000000
--- a/libnautilus/libnautilus.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
-
-/*
- * libnautilus: A library for nautilus view components.
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Elliot Lee <sopwith@redhat.com>
- *
- */
-
-/* libnautilus.h: Main library header file */
-
-#ifndef LIBNAUTILUS_H
-#define LIBNAUTILUS_H
-
-#include <libnautilus/nautilus-view-component.h>
-#include <libnautilus/nautilus-view.h>
-
-#endif /* LIBNAUTILUS_H */
diff --git a/libnautilus/libnautilus.pc.in b/libnautilus/libnautilus.pc.in
deleted file mode 100644
index 3bfd6c1a1..000000000
--- a/libnautilus/libnautilus.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: libnautilus
-Description: A library to create Nautilus components
-Version: @VERSION@
-Requires: eel-2.0 bonobo-activation-2.0 libbonobo-2.0 libbonoboui-2.0
-Libs: -L${libdir} -lnautilus
-Cflags: -I${includedir}
diff --git a/libnautilus/nautilus-bonobo-ui.h b/libnautilus/nautilus-bonobo-ui.h
deleted file mode 100644
index 41fa3747d..000000000
--- a/libnautilus/nautilus-bonobo-ui.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- *
- */
-
-/* nautilus-bonobo-ui.h: bonobo UI paths usable by Nautilus components
- * for merging menus and toolbars.
- */
-
-#ifndef NAUTILUS_BONOBO_UI_H
-#define NAUTILUS_BONOBO_UI_H
-
-/**
- * Components can use these menu paths with BonoboUIContainer calls to
- * place entire new menus.
- */
-
-#define NAUTILUS_MENU_PATH_FILE_MENU "/menu/File"
-#define NAUTILUS_MENU_PATH_EDIT_MENU "/menu/Edit"
-#define NAUTILUS_MENU_PATH_VIEW_MENU "/menu/View"
-#define NAUTILUS_MENU_PATH_GO_MENU "/menu/Go"
-#define NAUTILUS_MENU_PATH_BOOKMARKS_MENU "/menu/Bookmarks"
-#define NAUTILUS_MENU_PATH_PROFILER "/menu/Profiler"
-#define NAUTILUS_MENU_PATH_HELP_MENU "/menu/Help"
-
-/**
- * Components can use these menu item paths with BonoboUIContainer calls to
- * merge over certain existing items. Only items that we expect to be
- * merged over are listed here, to avoid making public details that might
- * change later.
- */
-
-#define NAUTILUS_MENU_PATH_CUT_ITEM "/menu/Edit/Cut"
-#define NAUTILUS_MENU_PATH_COPY_ITEM "/menu/Edit/Copy"
-#define NAUTILUS_MENU_PATH_PASTE_ITEM "/menu/Edit/Paste"
-#define NAUTILUS_MENU_PATH_CLEAR_ITEM "/menu/Edit/Clear"
-#define NAUTILUS_MENU_PATH_SELECT_ALL_ITEM "/menu/Edit/Select All"
-
-#define NAUTILUS_COMMAND_CUT "/commands/Cut"
-#define NAUTILUS_COMMAND_COPY "/commands/Copy"
-#define NAUTILUS_COMMAND_PASTE "/commands/Paste"
-#define NAUTILUS_COMMAND_CLEAR "/commands/Clear"
-#define NAUTILUS_COMMAND_SELECT_ALL "/commands/Select All"
-
-/**
- * Components can use these placeholder paths with BonoboUIContainer calls to
- * insert new items in well-defined positions.
- */
-
-/* Use the "new items" placeholder to insert menu items like "New xxx" */
-#define NAUTILUS_MENU_PATH_NEW_ITEMS_PLACEHOLDER "/menu/File/New Items Placeholder"
-
-/**
- * Use the "open" placeholder to insert menu items dealing with opening the
- * selected item, like "Open", "Open in New Window", etc.
- */
-#define NAUTILUS_MENU_PATH_OPEN_PLACEHOLDER "/menu/File/Open Placeholder"
-
-/**
- * Use the "file items" placeholder to insert other File menu items dealing with
- * individual files, such as "Show Properties" and "Rename"
- */
-#define NAUTILUS_MENU_PATH_FILE_ITEMS_PLACEHOLDER "/menu/File/File Items Placeholder"
-
-/**
- * Use the "global file items" placeholder to insert other File menu items
- * dealing with nautilus as a whole, such as "Empty Trash".
- */
-#define NAUTILUS_MENU_PATH_GLOBAL_FILE_ITEMS_PLACEHOLDER "/menu/File/Global File Items Placeholder"
-
-/**
- * Use the "global edit items" placeholder to insert other Edit menu items
- * dealing with nautilus as a whole, such as "Icon Captions...".
- */
-#define NAUTILUS_MENU_PATH_GLOBAL_EDIT_ITEMS_PLACEHOLDER "/menu/Edit/Global Edit Items Placeholder"
-
-/**
- * Use the "edit items" placeholder to insert other Edit menu items dealing with
- * individual files, such as "Remove Custom Image"
- */
-#define NAUTILUS_MENU_PATH_EDIT_ITEMS_PLACEHOLDER "/menu/Edit/Edit Items Placeholder"
-
-/**
- * Use the "show/hide" placeholder to insert other View menu items that
- * control the visibility of some piece of the UI, such as "Show/Hide Status Bar".
- */
-#define NAUTILUS_MENU_PATH_SHOW_HIDE_PLACEHOLDER "/menu/View/Show Hide Placeholder"
-
-/**
- * Use the "view items" placeholder to insert other View menu items that
- * are specific to a component, such as the Icon View's layout options.
- */
-#define NAUTILUS_MENU_PATH_VIEW_ITEMS_PLACEHOLDER "/menu/View/View Items Placeholder"
-
-/* Use the "extra help items" placeholder to add help-related items */
-#define NAUTILUS_MENU_PATH_EXTRA_HELP_ITEMS_PLACEHOLDER "/menu/Help/Extra Help Items"
-
-/* This holds the zooming-related items in the context menu */
-#define NAUTILUS_POPUP_PATH_ZOOM_ITEMS_PLACEHOLDER "/popups/background/Zoom Items"
-
-/* Components can use these paths with BonoboUIHandler calls to
- * locate toolbars and toolbar items for the purpose of merging.
- * Note: Not all Nautilus toolbars or toolbar items are necessarily published
- * here; these are the ones whose existence components can count on.
- */
-
-/* Main toolbar */
-#define NAUTILUS_TOOLBAR_PATH_MAIN_TOOLBAR "/Main"
-
-#endif /* NAUTILUS_BONOBO_UI_H */
diff --git a/libnautilus/nautilus-clipboard-ui.xml b/libnautilus/nautilus-clipboard-ui.xml
deleted file mode 100644
index a6f4ebfed..000000000
--- a/libnautilus/nautilus-clipboard-ui.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<Root>
-
-<commands>
- <cmd name="Cut"
- _label="Cut Text"
- accel="*Control*x"
- _tip="Cut the selected text to the clipboard"/>
- <cmd name="Copy"
- _label="_Copy Text"
- accel="*Control*c"
- _tip="Copy the selected text to the clipboard"/>
- <cmd name="Paste"
- _label="_Paste Text"
- _tip="Paste the text stored on the clipboard"
- accel="*Control*v"/>
- <cmd name="Clear"
- _tip="Remove the selected text without putting it on the clipboard"
- _label="C_lear Text"/>
- <cmd name="Select All"
- _label="Select _All"
- _tip="Select all the text in a text field"
- accel="*Control*a"/>
-</commands>
-
-<menu>
- <submenu name="Edit">
- <menuitem name="Cut"
- _label="Cut _Text"
- pixtype="stock" pixname="gtk-cut"
- verb="Cut"/>
- <menuitem name="Copy"
- _label="_Copy Text"
- pixtype="stock" pixname="gtk-copy"
- verb="Copy"/>
- <menuitem name="Paste"
- _label="_Paste Text"
- pixtype="stock" pixname="gtk-paste"
- verb="Paste"/>
- <menuitem name="Clear"
- _label="C_lear Text"
- pixtype="stock" pixname="gtk-clear"
- verb="Clear"/>
- <menuitem name="Select All"
- _label="Select _All"
- verb="Select All"/>
- </submenu>
-</menu>
-
-</Root>
diff --git a/libnautilus/nautilus-distributed-undo.idl b/libnautilus/nautilus-distributed-undo.idl
deleted file mode 100644
index 5a68056e0..000000000
--- a/libnautilus/nautilus-distributed-undo.idl
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
-
-/* nautilus-undo.idl - Interface for view components that
- * support undo, used internally by the
- * undo support classes.
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef NAUTILUS_UNDO_IDL_INCLUDED
-#define NAUTILUS_UNDO_IDL_INCLUDED
-
-#include <Bonobo.idl>
-
-module Nautilus {
-
- module Undo {
-
- /* The specifications for a menu item. */
- struct MenuItem {
- string label;
- string hint;
- };
-
- /* A single undoable operation is represented by a
- * transaction. This is the interface a transaction
- * must supply for use by an undo manager.
- */
- interface Transaction : ::Bonobo::Unknown {
- /* These menu items are used to display undo
- * or redo menu items for this transaction.
- * The operation name is for lists of undoable
- * operations that are listed somewhere other
- * than an undo or redo object.
- */
- readonly attribute MenuItem undo_menu_item;
- readonly attribute MenuItem redo_menu_item;
- readonly attribute string operation_name;
-
- /* Here's how you actually perform an undo.
- * Once it's performed, calling this again is
- * safe; it's guaranteed to do nothing.
- */
- void undo ();
- };
-
- /* An undo manager deals with a list of transactions
- * for a particular application or window. This is the
- * interface of the manager from the transaction's
- * point of view only.
- */
- interface Manager : ::Bonobo::Unknown {
- /* Add a new transaction. This is normally called
- * by the code that creates the transaction.
- */
- void append (in Transaction transaction);
-
- /* Forget a transaction. This is typically called
- * when the operation that the transaction does
- * undo for no longer makes sense.
- */
- void forget (in Transaction transaction);
-
- /* Sometimes an undo has to be "forced" from the
- * client side when it recognizes an undo key
- * equivalent.
- */
- void undo ();
-
- /* FIXME bugzilla.gnome.org 41292:
- * We may need additional interface so the
- * client can include an appropriate undo item in
- * a contextual menu.
- */
- };
-
- /* To locate the appropriate manager, a view component
- * can query for this interface on its Bonobo control
- * frame. This is done automatically by functions in
- * the undo manager.
- */
- interface Context : ::Bonobo::Unknown {
- readonly attribute Manager undo_manager;
- };
- };
-};
-
-#endif /* NAUTILUS_UNDO_IDL_INCLUDED */
diff --git a/libnautilus/nautilus-scroll-positionable.c b/libnautilus/nautilus-scroll-positionable.c
deleted file mode 100644
index 7ad9eb9c8..000000000
--- a/libnautilus/nautilus-scroll-positionable.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-scroll-positionable.c - public interface for objects that implement
- * scroll positioning
- *
- * Copyright (C) 2003 Red Hat, Inc.
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Alexander Larsson <alexl@redhat.com>
- */
-
-#include "nautilus-scroll-positionable.h"
-
-#include <config.h>
-#include <string.h>
-#include <bonobo/bonobo-i18n.h>
-#include <bonobo/bonobo-exception.h>
-#include <eel/eel-marshal.h>
-
-enum {
- GET_FIRST_VISIBLE_FILE,
- SCROLL_TO_FILE,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL];
-
-BONOBO_CLASS_BOILERPLATE_FULL (NautilusScrollPositionable, nautilus_scroll_positionable, Nautilus_ScrollPositionable,
- BonoboObject, BONOBO_OBJECT_TYPE)
-
-
-static Nautilus_URI
-impl_Nautilus_Scroll_Positionable_get_first_visible_file (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- NautilusScrollPositionable *positionable;
- char *uri;
- char *ret;
-
- positionable = NAUTILUS_SCROLL_POSITIONABLE (bonobo_object_from_servant (servant));
-
- uri = NULL;
- g_signal_emit (G_OBJECT (positionable), signals [GET_FIRST_VISIBLE_FILE],
- 0, &uri);
- if (uri) {
- ret = CORBA_string_dup (uri);
- g_free (uri);
- } else {
- ret = CORBA_string_dup ("");
- }
-
- return ret;
-}
-
-static void
-impl_Nautilus_Scroll_Positionable_scroll_to_file (PortableServer_Servant servant,
- const CORBA_char *uri,
- CORBA_Environment *ev)
-{
- NautilusScrollPositionable *positionable;
-
- positionable = NAUTILUS_SCROLL_POSITIONABLE (bonobo_object_from_servant (servant));
-
- g_signal_emit (G_OBJECT (positionable),
- signals [SCROLL_TO_FILE], 0,
- uri);
-}
-
-
-
-static char *
-nautilus_scroll_positionable_get_first_visible_file (NautilusScrollPositionable *positionable)
-{
- return NULL;
-}
-
-static void
-nautilus_scroll_positionable_instance_init (NautilusScrollPositionable *positionable)
-{
-}
-
-static void
-nautilus_scroll_positionable_finalize (GObject *object)
-{
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gboolean
-single_string_accumulator (GSignalInvocationHint *ihint,
- GValue *return_accu,
- const GValue *handler_return,
- gpointer dummy)
-{
- gboolean continue_emission;
- const gchar *str;
-
- str = g_value_get_string (handler_return);
- g_value_set_string (return_accu, str);
- continue_emission = str == NULL;
-
- return continue_emission;
-}
-
-static void
-nautilus_scroll_positionable_class_init (NautilusScrollPositionableClass *klass)
-{
- POA_Nautilus_ScrollPositionable__epv *epv = &klass->epv;
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) klass;
-
- klass->get_first_visible_file = nautilus_scroll_positionable_get_first_visible_file;
-
- object_class->finalize = nautilus_scroll_positionable_finalize;
-
- signals [GET_FIRST_VISIBLE_FILE] =
- g_signal_new ("get_first_visible_file",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusScrollPositionableClass, get_first_visible_file),
- single_string_accumulator, NULL,
- eel_marshal_STRING__VOID,
- G_TYPE_STRING, 0);
- signals [SCROLL_TO_FILE] =
- g_signal_new ("scroll_to_file",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusScrollPositionableClass, scroll_to_file),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- epv->scroll_to_file = impl_Nautilus_Scroll_Positionable_scroll_to_file;
- epv->get_first_visible_file = impl_Nautilus_Scroll_Positionable_get_first_visible_file;
-}
-
-NautilusScrollPositionable *
-nautilus_scroll_positionable_new (void)
-{
- return g_object_new (nautilus_scroll_positionable_get_type (), NULL);
-}
diff --git a/libnautilus/nautilus-scroll-positionable.h b/libnautilus/nautilus-scroll-positionable.h
deleted file mode 100644
index 75b494a33..000000000
--- a/libnautilus/nautilus-scroll-positionable.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-scroll-positionable.h - public interface for objects that implement
- * scroll positioning
- *
- * Copyright (C) 2003 Red Hat, Inc.
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Alexander Larsson <alexl@redhat.com>
- */
-
-#ifndef NAUTILUS_SCROLL_POSITIONABLE_H
-#define NAUTILUS_SCROLL_POSITIONABLE_H
-
-#include <libnautilus/nautilus-view-component.h>
-#include <bonobo/bonobo-object.h>
-
-G_BEGIN_DECLS
-
-#define NAUTILUS_TYPE_SCROLL_POSITIONABLE (nautilus_scroll_positionable_get_type ())
-#define NAUTILUS_SCROLL_POSITIONABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NAUTILUS_TYPE_SCROLL_POSITIONABLE, NautilusScrollPositionable))
-#define NAUTILUS_SCROLL_POSITIONABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NAUTILUS_TYPE_SCROLL_POSITIONABLE, NautilusScrollPositionableClass))
-#define BONOBO_IS_POSITIONABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NAUTILUS_TYPE_SCROLL_POSITIONABLE))
-#define BONOBO_IS_POSITIONABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NAUTILUS_TYPE_SCROLL_POSITIONABLE))
-#define NAUTILUS_SCROLL_POSITIONABLE_GET_CLASS(o)(G_TYPE_INSTANCE_GET_CLASS ((o), NAUTILUS_TYPE_SCROLL_POSITIONABLE, NautilusScrollPositionableClass))
-
-typedef struct _NautilusScrollPositionablePrivate NautilusScrollPositionablePrivate;
-
-typedef struct {
- BonoboObject object;
-} NautilusScrollPositionable;
-
-typedef struct {
- BonoboObjectClass parent;
- POA_Nautilus_ScrollPositionable__epv epv;
-
- char * (*get_first_visible_file) (NautilusScrollPositionable *positionable);
- void (*scroll_to_file) (NautilusScrollPositionable *positionable,
- const char *uri);
-
- gpointer dummy[4];
-} NautilusScrollPositionableClass;
-
-GType nautilus_scroll_positionable_get_type (void) G_GNUC_CONST;
-
-NautilusScrollPositionable *nautilus_scroll_positionable_new (void);
-
-G_END_DECLS
-
-#endif /* NAUTILUS_SCROLL_POSITIONABLE_H */
diff --git a/libnautilus/nautilus-view-component.idl b/libnautilus/nautilus-view-component.idl
deleted file mode 100644
index f40e76339..000000000
--- a/libnautilus/nautilus-view-component.idl
+++ /dev/null
@@ -1,190 +0,0 @@
-/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000, 2001 Eazel, Inc.
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Elliot Lee <sopwith@redhat.com>
- * Darin Adler <darin@bentspoon.com>
- * Maciej Stachowiak <mjs@eazel.com>
- *
- */
-
-
-#ifndef NAUTILUS_VIEW_COMPONENT_IDL
-#define NAUTILUS_VIEW_COMPONENT_IDL
-
-#if !defined(__nautilus_view_component_COMPILATION) && defined(__ORBIT_IDL__)
-%{
-#pragma include_defs libnautilus/nautilus-view-component.h
-%}
-#pragma inhibit push
-#endif
-
-#include <Bonobo.idl>
-
-module Nautilus {
-
- /* URIs are just plain strings, but we use a typedef to make
- * the interface definitions clearer.
- */
- typedef string URI;
- typedef sequence<URI> URIList;
-
- struct HistoryItem {
- string title;
- URI location;
- };
- typedef sequence<HistoryItem> History;
-
- enum WindowType {
- WINDOW_SPATIAL,
- WINDOW_NAVIGATION,
- WINDOW_DESKTOP
- };
-
- enum ShowHiddenFilesMode {
- SHOW_HIDDEN_FILES_DEFAULT,
- SHOW_HIDDEN_FILES_ENABLE,
- SHOW_HIDDEN_FILES_DISABLE
- };
-
- /* The View interface is used by the Nautilus shell to control
- * the view. A view that is a Bonobo::Control can choose to
- * implement the View interface for additional finer control
- * by Nautilus.
- */
- interface View : ::Bonobo::Unknown {
- /* Called to tell the view about location changes.
- * Called again with the same location again to request a
- * reload.
- */
- oneway void load_location (in URI location);
- oneway void stop_loading ();
- };
-
-
- /* An interface that allows the shell to query the current
- * scrolled position of views, and later return to that
- * position. Typically used when going back/forward.
- */
- interface ScrollPositionable : ::Bonobo::Unknown {
- URI get_first_visible_file ();
- void scroll_to_file (in URI position);
- };
-
- /* The ViewFrame interface is used by the view to communicate
- * with the Nautilus shell. It's implemented as an interface
- * on the Bonobo::ControlFrame for the view.
- *
- * The Ambient properties on the ControlFrame are:
- * 'title' - ro - string - the title
- * 'history' - ro - Nautilus::History - the history list
- * 'selection' - ro - URIList - the selection
- * 'show-hidden-files-mode' -ro - Nautilus::ShowHiddenFilesMode - show hidden files setting
- * 'window-type' - ro - Nautilus::WindowType - the window type
- */
- interface ViewFrame : ::Bonobo::Unknown {
- enum OpenMode {
- OPEN_ACCORDING_TO_MODE,
- OPEN_IN_SPATIAL,
- OPEN_IN_NAVIGATION
- };
-
- typedef long OpenFlags;
- const OpenFlags OPEN_FLAG_CLOSE_BEHIND = 1;
-
- oneway void open_location (in URI location,
- in OpenMode mode,
- in OpenFlags flags,
- in URIList selection);
-
- /* Called by a view component when the location
- * changes, but the view component is handling it
- * directly. This differs from
- * "open_location_in_this_window" in that it
- * understands that the same component is reused, and
- * also it treats the load as "already underway" and
- * does not send a "load_location",
- * "selection_changed", or "title_changed" to the view
- * that initiates this. The redirect version should be
- * used when the location change does not deserve its
- * own element in history.
- */
- oneway void report_location_change (in URI location,
- in URIList selection,
- in string title);
- oneway void report_redirect (in URI from_location,
- in URI to_location,
- in URIList selection,
- in string title);
-
- /* Called by a view component to announce a change in the
- * selection. This selection change will be reported back
- * to the original view along with the others.
- */
- oneway void report_selection_change (in URIList selection);
-
- /* Called by a view component to change the contents
- * of the status bar.
- */
- oneway void report_status (in string status);
-
- /* Called by a view component to give an update about
- * progress loading the view for the current
- * location. Calling underway repeatedly tells the
- * shell that the view is making progress. For views
- * that know how far along they are, calling
- * report_load_progress (instead of
- * report_load_underway) with a number from 0.0 to 1.0
- * expresses how much of the total is done. When the
- * load is complete or has failed, either
- * report_load_failed or report_load_complete
- * indicates that.
- */
- oneway void report_load_underway ();
- oneway void report_load_progress (in float fraction_done);
- oneway void report_load_complete ();
- oneway void report_load_failed ();
-
- /* Called by a view component to change the title. */
- oneway void set_title (in string new_title);
-
- /* Called by a view component to change the show hidden files mode. */
- oneway void set_show_hidden_files_mode (in ShowHiddenFilesMode new_mode);
-
- /* Called when a view component wants to make the
- * window it's in "go back". At some point we may add a more
- * complete set of operations. This one is very useful for
- * components that do something and then return.
- * If there's nowhere to go back to, it goes home, which
- * is not quite the same as the "back" button in the UI,
- * which does nothing if there's nowhere to go.
- */
- oneway void go_back ();
- oneway void close_window ();
- };
-
-};
-
-#if !defined(__nautilus_view_component_COMPILATION) && defined(__ORBIT_IDL__)
-#pragma inhibit pop
-#endif
-
-#endif /* NAUTILUS_VIEW_COMPONENT_IDL */
diff --git a/libnautilus/nautilus-view-standard-main.c b/libnautilus/nautilus-view-standard-main.c
deleted file mode 100644
index d0ddd3e47..000000000
--- a/libnautilus/nautilus-view-standard-main.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Maciej Stachowiak <mjs@eazel.com>
- *
- */
-
-/* nautilus-view-standard-main.c: Standard main functions for Nautilus
- views, to reduce boilerplate code. */
-
-#include <config.h>
-#include "nautilus-view-standard-main.h"
-
-#include <X11/Xlib.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-ui-main.h>
-#include <gdk/gdkx.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtksignal.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-client.h>
-#include <libgnomeui/gnome-ui-init.h>
-#include <libgnomevfs/gnome-vfs-init.h>
-#include <eel/eel-gnome-extensions.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define N_IDLE_SECONDS_BEFORE_QUIT 5
-
-typedef struct {
- int object_count;
- GList *view_iids;
- NautilusViewCreateFunction create_function;
- void *user_data;
- guint delayed_quit_timeout_id;
-} CallbackData;
-
-static gboolean
-delayed_quit_timeout_callback (gpointer data)
-{
- CallbackData *callback_data;
-
- callback_data = (CallbackData *) data;
- callback_data->delayed_quit_timeout_id = 0;
- gtk_main_quit ();
-
- return FALSE;
-}
-
-static void
-view_object_destroy (GObject *object,
- CallbackData *callback_data)
-{
- g_assert (G_IS_OBJECT (object));
-
- if (!g_object_get_data (object, "standard_main_destroy_accounted")) {
- g_object_set_data (object, "standard_main_destroy_accounted",
- GUINT_TO_POINTER (TRUE));
-
- callback_data->object_count--;
-
- if (callback_data->object_count <= 0 &&
- callback_data->delayed_quit_timeout_id == 0) {
- /* Connect a handler that will get us out of the
- * main loop when there are no more objects outstanding.
- */
- callback_data->delayed_quit_timeout_id =
- g_timeout_add (N_IDLE_SECONDS_BEFORE_QUIT * 1000,
- delayed_quit_timeout_callback,
- callback_data);
- }
- }
-}
-
-/*
- * Time we're prepared to wait without a ControlFrame
- * before terminating the Control. This can happen if the
- * container activates us but crashes before the set_frame.
- *
- * NB. if we don't get a frame in 30 seconds, something
- * is badly wrong, or Gnome performance needs improving
- * markedly !
- */
-#define NAUTILUS_VIEW_NEVER_GOT_FRAME_TIMEOUT (30 * 1000)
-#define CALLBACK_DATA_KEY "standard_main_callback_data_key"
-
-static void
-nautilus_view_cnx_broken_callback (GObject *control)
-{
- view_object_destroy (control,
- g_object_get_data (G_OBJECT (control),
- CALLBACK_DATA_KEY));
-}
-
-static gboolean
-nautilus_view_never_got_frame_timeout (gpointer user_data)
-{
- g_warning ("Never got frame, container died - abnormal exit condition");
-
- nautilus_view_cnx_broken_callback (user_data);
-
- return FALSE;
-}
-
-static void
-nautilus_view_set_frame_callback (BonoboControl *control,
- gpointer user_data)
-{
- Bonobo_ControlFrame remote_frame;
-
- remote_frame = bonobo_control_get_control_frame (control, NULL);
-
- if (remote_frame != CORBA_OBJECT_NIL) {
- ORBitConnectionStatus status;
-
- g_source_remove (GPOINTER_TO_UINT (user_data));
-
- status = ORBit_small_get_connection_status (remote_frame);
-
- /* Only track out of proc controls */
- if (status != ORBIT_CONNECTION_IN_PROC) {
- g_signal_connect_closure (
- ORBit_small_get_connection (remote_frame),
- "broken",
- g_cclosure_new_object_swap (
- G_CALLBACK (nautilus_view_cnx_broken_callback),
- G_OBJECT (control)),
- FALSE);
- g_signal_connect (
- control, "destroy",
- G_CALLBACK (nautilus_view_cnx_broken_callback),
- NULL);
- }
- }
-}
-
-/*
- * This code is somewhat duplicated in gnome-panel/libpanel-applet
- * and is ripe for abstracting in an intermediate library.
- */
-static void
-nautilus_view_instrument_for_failure (BonoboObject *control,
- CallbackData *callback_data)
-{
- guint no_frame_timeout_id;
-
- g_object_set_data (G_OBJECT (control),
- CALLBACK_DATA_KEY, callback_data);
-
- no_frame_timeout_id = g_timeout_add (
- NAUTILUS_VIEW_NEVER_GOT_FRAME_TIMEOUT,
- nautilus_view_never_got_frame_timeout,
- control);
- g_signal_connect_closure (
- control, "destroy",
- g_cclosure_new_swap (
- G_CALLBACK (g_source_remove),
- GUINT_TO_POINTER (no_frame_timeout_id), NULL),
- 0);
- g_signal_connect (
- control, "set_frame",
- G_CALLBACK (nautilus_view_set_frame_callback),
- GUINT_TO_POINTER (no_frame_timeout_id));
-}
-
-static BonoboObject *
-make_object (BonoboGenericFactory *factory,
- const char *iid,
- gpointer data)
-{
- BonoboObject *view;
- BonoboObject *control;
- CallbackData *callback_data;
-
- callback_data = (CallbackData *) data;
-
- g_assert (BONOBO_IS_GENERIC_FACTORY (factory));
- g_assert (iid != NULL);
- g_assert (callback_data != NULL);
-
- /* Check that this is one of the types of object we know how to create. */
- if (g_list_find_custom (callback_data->view_iids,
- (gpointer) iid, (GCompareFunc) strcmp) == NULL) {
- return NULL;
- }
-
- view = callback_data->create_function (iid, callback_data->user_data);
-
- callback_data->object_count++;
- if (callback_data->delayed_quit_timeout_id != 0) {
- g_source_remove (callback_data->delayed_quit_timeout_id);
- callback_data->delayed_quit_timeout_id = 0;
- }
- g_signal_connect (view, "destroy",
- G_CALLBACK (view_object_destroy),
- callback_data);
-
- /* We can do some more agressive tracking of controls */
- if ((control = bonobo_object_query_local_interface
- (view, "IDL:Bonobo/Control:1.0"))) {
- nautilus_view_instrument_for_failure (control, callback_data);
- bonobo_object_unref (control);
- }
-
- return BONOBO_OBJECT (view);
-}
-
-/**
- * nautilus_view_standard_main_multi
- *
- * A version of nautilus_view_standard_main that accepts multiple view
- * IIDs.
- *
- * @executable_name: The name of the executable binary.
- * @version: Component version. Usually VERSION.
- * @gettext_package_name: Package name for gettext support. Usually PACKAGE.
- * Can be NULL, in which case the component will not
- * have gettext support and translations might not
- * work
- * @gettext_locale_directory: Locale directory for gettext support. Usually
- * GNOMELOCALEDIR. Must not be NULL if
- * @gettext_package_name is not NULL.
- * @argc: Command line argument count.
- * @argv: Command line argument vector.
- * @factory_iid: The components's factory IID.
- * @view_iids: A GList of NautilusView IIDs.
- * @create_function: Function called to create the NautilusView instance.
- * @post_initialize_callback: An optional callback which is invoked after
- * all modules have been initialized (gtk, bonobo,
- * gnome-vfs, etc.) but before the execution of
- * the main event loop or the creation of the
- * component's factory.
- * @user_data: User data for @create_function.
- **/
-int
-nautilus_view_standard_main_multi (const char *executable_name,
- const char *version,
- const char *gettext_package_name,
- const char *gettext_locale_directory,
- int argc,
- char **argv,
- const char *factory_iid,
- GList *view_iids,
- NautilusViewCreateFunction create_function,
- GVoidFunc post_initialize_callback,
- void *user_data)
-{
- BonoboGenericFactory *factory;
- CallbackData callback_data;
- char *registration_id;
-
- g_return_val_if_fail (executable_name != NULL, EXIT_FAILURE);
- g_return_val_if_fail (version != NULL, EXIT_FAILURE);
- g_return_val_if_fail (argc > 0, EXIT_FAILURE);
- g_return_val_if_fail (argv != NULL, EXIT_FAILURE);
- g_return_val_if_fail (argv[0] != NULL, EXIT_FAILURE);
- g_return_val_if_fail (factory_iid != NULL, EXIT_FAILURE);
- g_return_val_if_fail (g_list_length (view_iids) > 0, EXIT_FAILURE);
- g_return_val_if_fail (create_function != NULL, EXIT_FAILURE);
-
- if (gettext_package_name != NULL) {
- g_return_val_if_fail (gettext_locale_directory != NULL, EXIT_FAILURE);
- }
- if (gettext_locale_directory != NULL) {
- g_return_val_if_fail (gettext_package_name != NULL, EXIT_FAILURE);
- }
-
- /* Initialize gettext support if needed */
- if (gettext_package_name != NULL
- && gettext_locale_directory != NULL) {
- bindtextdomain (gettext_package_name, gettext_locale_directory);
- bind_textdomain_codeset (gettext_package_name, "UTF-8");
- textdomain (gettext_package_name);
- }
-
- /* Initialize libraries. */
- gnome_program_init (executable_name, version,
- LIBGNOMEUI_MODULE,
- argc, argv,
- /* Disable session manager connection */
- GNOME_CLIENT_PARAM_SM_CONNECT, FALSE,
- NULL);
-
- bonobo_ui_init (executable_name, version, &argc, argv);
-
- if (post_initialize_callback != NULL) {
- (* post_initialize_callback) ();
- }
-
- /* Fill in the callback data */
- callback_data.object_count = 0;
- callback_data.view_iids = view_iids;
- callback_data.create_function = create_function;
- callback_data.user_data = user_data;
- callback_data.delayed_quit_timeout_id = 0;
-
- /* Create the factory. */
- registration_id = eel_bonobo_make_registration_id (factory_iid);
- factory = bonobo_generic_factory_new (registration_id,
- make_object,
- &callback_data);
- g_free (registration_id);
-
- if (factory != NULL) {
- /* Loop until we have no more objects. */
- bonobo_activate ();
- do {
- gtk_main ();
- } while (callback_data.object_count > 0 ||
- callback_data.delayed_quit_timeout_id != 0);
- bonobo_object_unref (factory);
- }
-
- gnome_vfs_shutdown ();
-
- return EXIT_SUCCESS;
-}
-
-/**
- * nautilus_view_standard_main
- *
- * An implementation of most of a typical main.c file for Nautilus views.
- * Just call the function from main and pass it the right arguments. This
- * should make writing Nautilus views simpler.
- *
- * @executable_name: The name of the executable binary.
- * @version: Component version. Usually VERSION.
- * @gettext_package_name: Package name for gettext support. Usually PACKAGE.
- * Can be NULL, in which case the component will not
- * have gettext support and translations might not
- * work
- * @gettext_locale_directory: Locale directory for gettext support. Usually
- * GNOMELOCALEDIR. Must not be NULL if
- * @gettext_package_name is not NULL.
- * @argc: Command line argument count.
- * @argv: Command line argument vector.
- * @factory_iid: The components's factory IID.
- * @view_iid: The component's NautilusView IID.
- * @create_function: Function called to create the NautilusView instance.
- * @post_initialize_callback: An optional callback which is invoked after
- * all modules have been initialized (gtk, bonobo,
- * gnome-vfs, etc.) but before the execution of
- * the main event loop or the creation of the
- * component's factory.
- * @user_data: User data for @create_function.
- **/
-int
-nautilus_view_standard_main (const char *executable_name,
- const char *version,
- const char *gettext_package_name,
- const char *gettext_locale_directory,
- int argc,
- char **argv,
- const char *factory_iid,
- const char *view_iid,
- NautilusViewCreateFunction create_function,
- GVoidFunc post_initialize_callback,
- void *user_data)
-{
- GList node;
-
- g_return_val_if_fail (executable_name != NULL, EXIT_FAILURE);
- g_return_val_if_fail (version != NULL, EXIT_FAILURE);
- g_return_val_if_fail (argc > 0, EXIT_FAILURE);
- g_return_val_if_fail (argv != NULL, EXIT_FAILURE);
- g_return_val_if_fail (argv[0] != NULL, EXIT_FAILURE);
- g_return_val_if_fail (factory_iid != NULL, EXIT_FAILURE);
- g_return_val_if_fail (view_iid != NULL, EXIT_FAILURE);
- g_return_val_if_fail (create_function != NULL, EXIT_FAILURE);
-
- if (gettext_package_name != NULL) {
- g_return_val_if_fail (gettext_locale_directory != NULL, EXIT_FAILURE);
- }
- if (gettext_locale_directory != NULL) {
- g_return_val_if_fail (gettext_package_name != NULL, EXIT_FAILURE);
- }
-
- node.data = (gpointer) view_iid;
- node.next = NULL;
- node.prev = NULL;
-
- return nautilus_view_standard_main_multi (executable_name,
- version,
- gettext_package_name,
- gettext_locale_directory,
- argc,
- argv,
- factory_iid,
- &node,
- create_function,
- post_initialize_callback,
- user_data);
-}
-
-typedef GType (* TypeFunc) (void);
-
-BonoboObject *
-nautilus_view_create_from_get_type_function (const char *iid, void *user_data)
-{
- return BONOBO_OBJECT (g_object_new (((TypeFunc) (user_data)) (), NULL));
-}
diff --git a/libnautilus/nautilus-view-standard-main.h b/libnautilus/nautilus-view-standard-main.h
deleted file mode 100644
index 99fc88f47..000000000
--- a/libnautilus/nautilus-view-standard-main.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- *
- */
-
-/* nautilus-view-standard-main.h - An implementation of most of a
- * typical main.c file for Nautilus views. Just call the function from
- * main and pass it the right arguments. This should make writing
- * Nautilus views simpler.
- */
-
-#ifndef NAUTILUS_VIEW_STANDARD_MAIN_H
-#define NAUTILUS_VIEW_STANDARD_MAIN_H
-
-#include <bonobo/bonobo-object.h>
-
-G_BEGIN_DECLS
-
-typedef BonoboObject * (*NautilusViewCreateFunction) (const char *iid, void *user_data);
-
-int nautilus_view_standard_main (const char *executable_name,
- const char *version,
- const char *gettext_package_name,
- const char *gettext_locale_directory,
- int argc,
- char **argv,
- const char *factory_iid,
- const char *view_iid,
- NautilusViewCreateFunction create_function,
- GVoidFunc post_initialize_callback,
- void *user_data);
-
-int nautilus_view_standard_main_multi (const char *executable_name,
- const char *version,
- const char *gettext_package_name,
- const char *gettext_locale_directory,
- int argc,
- char **argv,
- const char *factory_iid,
- GList *view_iids, /* GList<const char *> */
- NautilusViewCreateFunction create_function,
- GVoidFunc post_initialize_callback,
- void *user_data);
-
-/* standard handy create function (pass the _get_type function for the
- * class as the user_data)
- */
-BonoboObject *nautilus_view_create_from_get_type_function (const char *iid, void *user_data);
-
-G_END_DECLS
-
-#endif /* NAUTILUS_VIEW_STANDARD_MAIN_H */
diff --git a/libnautilus/nautilus-view.c b/libnautilus/nautilus-view.c
deleted file mode 100644
index 363678ef7..000000000
--- a/libnautilus/nautilus-view.c
+++ /dev/null
@@ -1,1152 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000, 2001 Eazel, Inc.
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Elliot Lee <sopwith@redhat.com>
- * Maciej Stachowiak <mjs@eazel.com>
- * Darin Adler <darin@bentspoon.com>
- *
- */
-
-/* nautilus-view.c: Implementation for object that represents a
- nautilus view implementation. */
-
-#include <config.h>
-#include "nautilus-view.h"
-
-#include "nautilus-idle-queue.h"
-#include "nautilus-undo.h"
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-event-source.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-listener.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <libgnome/gnome-macros.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <string.h>
-
-enum {
- HISTORY_CHANGED,
- LOAD_LOCATION,
- SELECTION_CHANGED,
- STOP_LOADING,
- TITLE_CHANGED,
- SHOW_HIDDEN_FILES_MODE_CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-struct NautilusViewDetails {
- BonoboControl *control;
-
- Nautilus_ViewFrame cached_view_frame;
-
- NautilusViewListenerMask listener_mask;
- BonoboListener *listener;
- Bonobo_EventSource listener_event_source;
-
- NautilusIdleQueue *incoming_queue;
- NautilusIdleQueue *outgoing_queue;
-
- gboolean have_window_type;
- Nautilus_WindowType window_type;
-
- gboolean have_show_hidden_files_mode;
- Nautilus_ShowHiddenFilesMode show_hidden_files_mode;
-};
-
-typedef void (* ViewFunction) (NautilusView *view,
- gpointer callback_data);
-
-typedef struct {
- char *from_location;
- char *location;
- GList *selection;
- char *title;
- Nautilus_ViewFrame_OpenMode mode;
- Nautilus_ViewFrame_OpenFlags flags;
-} LocationPlus;
-
-BONOBO_CLASS_BOILERPLATE_FULL (NautilusView, nautilus_view, Nautilus_View,
- BonoboObject, BONOBO_OBJECT_TYPE)
-
-static void
-queue_incoming_call (PortableServer_Servant servant,
- ViewFunction call,
- gpointer callback_data,
- GDestroyNotify destroy_callback_data)
-{
- NautilusView *view;
-
- view = NAUTILUS_VIEW (bonobo_object_from_servant (servant));
- nautilus_idle_queue_add (view->details->incoming_queue,
- (GFunc) call,
- view,
- callback_data,
- destroy_callback_data);
-}
-
-static void
-queue_outgoing_call (NautilusView *view,
- ViewFunction call,
- gpointer callback_data,
- GDestroyNotify destroy_callback_data)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW (view));
-
- nautilus_idle_queue_add (view->details->outgoing_queue,
- (GFunc) call,
- view,
- callback_data,
- destroy_callback_data);
-}
-
-GList *
-nautilus_g_list_from_uri_list (const Nautilus_URIList *uri_list)
-{
- GList *list;
- guint i;
-
- list = NULL;
- for (i = 0; i < uri_list->_length; i++) {
- list = g_list_prepend
- (list, g_strdup (uri_list->_buffer[i]));
- }
- return g_list_reverse (list);
-}
-
-/* Must CORBA_free this list before destroying the URI's in
- * the source list.
- */
-Nautilus_URIList *
-nautilus_uri_list_from_g_list (GList *list)
-{
- int length;
- Nautilus_URIList *uri_list;
- int i;
- GList *p;
-
- length = g_list_length (list);
-
- uri_list = Nautilus_URIList__alloc ();
- uri_list->_maximum = length;
- uri_list->_length = length;
- uri_list->_buffer = CORBA_sequence_Nautilus_URI_allocbuf (length);
- for (i = 0, p = list; i < length; i++, p = p->next) {
- g_assert (p != NULL);
- uri_list->_buffer[i] = CORBA_string_dup (p->data);
- }
- CORBA_sequence_set_release (uri_list, CORBA_TRUE);
-
- return uri_list;
-}
-
-static void
-call_load_location (NautilusView *view,
- gpointer callback_data)
-{
- g_signal_emit (view,
- signals[LOAD_LOCATION], 0,
- callback_data);
-}
-
-static void
-call_stop_loading (NautilusView *view,
- gpointer callback_data)
-{
- g_signal_emit (view,
- signals[STOP_LOADING], 0);
-}
-
-static void
-call_selection_changed (NautilusView *view,
- gpointer callback_data)
-{
- g_signal_emit (view,
- signals[SELECTION_CHANGED], 0,
- callback_data);
-}
-
-static void
-call_title_changed (NautilusView *view,
- gpointer callback_data)
-{
- g_signal_emit (view,
- signals[TITLE_CHANGED], 0,
- callback_data);
-}
-
-static void
-call_history_changed (NautilusView *view,
- gpointer callback_data)
-{
- g_signal_emit (view,
- signals[HISTORY_CHANGED], 0,
- callback_data);
-}
-
-static void
-call_show_hidden_files_mode_changed (NautilusView *view,
- gpointer callback_data)
-{
- view->details->have_show_hidden_files_mode = FALSE;
- g_signal_emit (view,
- signals[SHOW_HIDDEN_FILES_MODE_CHANGED], 0,
- callback_data);
-}
-
-
-static void
-list_deep_free_cover (gpointer callback_data)
-{
- gnome_vfs_list_deep_free (callback_data);
-}
-
-static Nautilus_History *
-history_dup (const Nautilus_History *history)
-{
- Nautilus_History *dup;
- int length, i;
-
- length = history->_length;
-
- dup = Nautilus_History__alloc ();
- dup->_maximum = length;
- dup->_length = length;
- dup->_buffer = CORBA_sequence_Nautilus_HistoryItem_allocbuf (length);
- for (i = 0; i < length; i++) {
- dup->_buffer[i].title = CORBA_string_dup (history->_buffer[i].title);
- dup->_buffer[i].location = CORBA_string_dup (history->_buffer[i].location);
- }
- CORBA_sequence_set_release (dup, CORBA_TRUE);
-
- return dup;
-}
-
-static void
-impl_Nautilus_View_load_location (PortableServer_Servant servant,
- const CORBA_char *location,
- CORBA_Environment *ev)
-{
- queue_incoming_call (servant,
- call_load_location,
- g_strdup (location),
- g_free);
-}
-
-static void
-impl_Nautilus_View_stop_loading (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- queue_incoming_call (servant,
- call_stop_loading,
- NULL,
- NULL);
-}
-
-static void
-nautilus_view_frame_property_changed_callback (BonoboListener *listener,
- const char *event_name,
- const CORBA_any *any,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- NautilusView *view;
- ViewFunction callback;
- gpointer callback_data;
- GDestroyNotify destroy_callback_data;
-
- view = NAUTILUS_VIEW (user_data);
-
- if (strcmp (event_name, "Bonobo/Property:change:title") == 0) {
- callback = call_title_changed;
- callback_data = g_strdup (BONOBO_ARG_GET_STRING (any));
- destroy_callback_data = g_free;
- } else if (strcmp (event_name, "Bonobo/Property:change:history") == 0) {
- callback = call_history_changed;
- callback_data = history_dup (any->_value);
- destroy_callback_data = CORBA_free;
- } else if (strcmp (event_name, "Bonobo/Property:change:selection") == 0) {
- callback = call_selection_changed;
- callback_data = nautilus_g_list_from_uri_list (any->_value);
- destroy_callback_data = list_deep_free_cover;
- } else if (strcmp (event_name, "Bonobo/Property:change:show-hidden-files-mode") == 0) {
- callback = call_show_hidden_files_mode_changed;
- callback_data = NULL;
- destroy_callback_data = NULL;
- } else {
- g_warning ("Unknown event '%s'", event_name);
- return;
- }
-
- nautilus_idle_queue_add (view->details->incoming_queue,
- (GFunc) callback,
- view,
- callback_data,
- destroy_callback_data);
-}
-
-static void
-remove_listener (NautilusView *view)
-{
- BonoboListener *listener;
- Bonobo_EventSource es;
- CORBA_Environment ev;
-
- listener = view->details->listener;
- if (listener == NULL) {
- g_assert (view->details->listener_event_source == CORBA_OBJECT_NIL);
- return;
- }
-
- es = view->details->listener_event_source;
-
- view->details->listener = NULL;
- view->details->listener_event_source = CORBA_OBJECT_NIL;
-
- CORBA_exception_init (&ev);
-
- bonobo_event_source_client_remove_listener (es, BONOBO_OBJREF (listener), &ev);
-
- CORBA_Object_release (es, &ev);
- bonobo_object_unref (listener);
-
- CORBA_exception_free (&ev);
-}
-
-static void
-append_mask (GString *str, const char *mask_element)
-{
- if (str->len != 0) {
- g_string_append_c (str, ',');
- }
- g_string_append (str, mask_element);
-}
-
-static void
-update_listener (NautilusView *view)
-{
- BonoboListener *listener;
- CORBA_Environment ev;
- Bonobo_EventSource es;
- Bonobo_PropertyBag pbag;
- GString *mask;
-
- remove_listener (view);
-
- if (view->details->listener_mask == 0) {
- return;
- }
-
- pbag = nautilus_view_get_ambient_properties (view, NULL);
- if (pbag == CORBA_OBJECT_NIL) {
- return;
- }
-
- CORBA_exception_init (&ev);
-
- es = Bonobo_Unknown_queryInterface (pbag, "IDL:Bonobo/EventSource:1.0", &ev);
- if (BONOBO_EX (&ev)) {
- es = CORBA_OBJECT_NIL;
- }
- if (es == CORBA_OBJECT_NIL) {
- g_warning ("Contractual breakage - NautilusViewFrame's "
- "ambient property bag has no event source");
- goto failed;
- }
-
- listener = bonobo_listener_new (nautilus_view_frame_property_changed_callback, view);
-
- mask = g_string_sized_new (128);
- if (view->details->listener_mask & NAUTILUS_VIEW_LISTEN_TITLE) {
- append_mask (mask, "Bonobo/Property:change:title");
- }
- if (view->details->listener_mask & NAUTILUS_VIEW_LISTEN_HISTORY) {
- append_mask (mask, "Bonobo/Property:change:history");
- }
- if (view->details->listener_mask & NAUTILUS_VIEW_LISTEN_SELECTION) {
- append_mask (mask, "Bonobo/Property:change:selection");
- }
- if (view->details->listener_mask & NAUTILUS_VIEW_LISTEN_SHOW_HIDDEN_FILES_MODE) {
- append_mask (mask, "Bonobo/Property:change:show-hidden-files-mode");
- }
-
- Bonobo_EventSource_addListenerWithMask (es, BONOBO_OBJREF (listener), mask->str, &ev);
-
- g_string_free (mask, TRUE);
-
- view->details->listener = listener;
- view->details->listener_event_source = es;
-
- Bonobo_Unknown_unref (es, &ev);
-
- failed:
- bonobo_object_release_unref (pbag, NULL);
- CORBA_exception_free (&ev);
-}
-
-static void
-forget_cached_view_frame (NautilusView *view)
-{
- CORBA_Object_release (view->details->cached_view_frame, NULL);
- view->details->cached_view_frame = CORBA_OBJECT_NIL;
-}
-
-static void
-nautilus_view_set_frame_callback (BonoboControl *control,
- NautilusView *view)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW (view));
-
- forget_cached_view_frame (view);
- update_listener (view);
-}
-
-static void
-nautilus_view_instance_init (NautilusView *view)
-{
- view->details = g_new0 (NautilusViewDetails, 1);
-
- view->details->incoming_queue = nautilus_idle_queue_new ();
- view->details->outgoing_queue = nautilus_idle_queue_new ();
-}
-
-NautilusView *
-nautilus_view_new (GtkWidget *widget)
-{
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- return nautilus_view_new_from_bonobo_control (bonobo_control_new (widget));
-}
-
-NautilusView *
-nautilus_view_new_from_bonobo_control (BonoboControl *control)
-{
- g_return_val_if_fail (BONOBO_IS_CONTROL (control), NULL);
-
- return nautilus_view_construct_from_bonobo_control
- (NAUTILUS_VIEW (g_object_new (NAUTILUS_TYPE_VIEW, NULL)), control);
-}
-
-NautilusView *
-nautilus_view_construct (NautilusView *view,
- GtkWidget *widget)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW (view), view);
- g_return_val_if_fail (GTK_IS_WIDGET (widget), view);
-
- return nautilus_view_construct_from_bonobo_control
- (view, bonobo_control_new (widget));
-}
-
-NautilusView *
-nautilus_view_construct_from_bonobo_control (NautilusView *view,
- BonoboControl *control)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW (view), view);
- g_return_val_if_fail (BONOBO_IS_CONTROL (control), view);
-
- view->details->control = control;
- bonobo_object_add_interface (BONOBO_OBJECT (view), BONOBO_OBJECT (control));
- nautilus_undo_set_up_bonobo_control (control);
-
- g_signal_connect_object (control, "set_frame",
- G_CALLBACK (nautilus_view_set_frame_callback), view, 0);
-
- return view;
-}
-
-static void
-nautilus_view_finalize (GObject *object)
-{
- NautilusView *view;
-
- view = NAUTILUS_VIEW (object);
-
- forget_cached_view_frame (view);
- remove_listener (view);
-
- nautilus_idle_queue_destroy (view->details->incoming_queue);
- nautilus_idle_queue_destroy (view->details->outgoing_queue);
-
- g_free (view->details);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-nautilus_view_dispose (GObject *object)
-{
- NautilusView *view;
-
- view = NAUTILUS_VIEW (object);
-
- forget_cached_view_frame (view);
- remove_listener (view);
-
- GNOME_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
-}
-
-static Nautilus_ViewFrame
-nautilus_view_get_view_frame (NautilusView *view, CORBA_Environment *ev)
-{
- Nautilus_ViewFrame view_frame;
- Bonobo_ControlFrame control_frame;
-
- g_return_val_if_fail (NAUTILUS_IS_VIEW (view), CORBA_OBJECT_NIL);
-
- if (view->details->cached_view_frame == CORBA_OBJECT_NIL) {
- control_frame = bonobo_control_get_control_frame (view->details->control, ev);
- if (! BONOBO_EX (ev) && control_frame != CORBA_OBJECT_NIL) {
- view_frame = Bonobo_Unknown_queryInterface
- (control_frame, "IDL:Nautilus/ViewFrame:1.0", ev);
- if (! BONOBO_EX (ev) && view_frame != CORBA_OBJECT_NIL) {
- Bonobo_Unknown_unref (view_frame, ev);
- view->details->cached_view_frame = view_frame;
- }
-
- CORBA_Object_release (control_frame, ev);
- }
- }
-
- return CORBA_Object_duplicate (view->details->cached_view_frame, ev);
-}
-
-static Nautilus_ViewFrame
-view_frame_call_begin (NautilusView *view, CORBA_Environment *ev)
-{
- CORBA_exception_init (ev);
-
- return nautilus_view_get_view_frame (view, ev);
-}
-
-static void
-view_frame_call_end (Nautilus_ViewFrame frame, CORBA_Environment *ev)
-{
- if (frame != CORBA_OBJECT_NIL) {
- CORBA_Object_release (frame, NULL);
- }
-
- CORBA_exception_free (ev);
-}
-
-/* don't use the one in eel to avoid creating a dependency on eel */
-static GList *
-str_list_copy (GList *original)
-{
- GList *copy, *node;
-
- copy = NULL;
- for (node = original; node != NULL; node = node->next) {
- copy = g_list_prepend (copy, g_strdup (node->data));
- }
- return g_list_reverse (copy);
-}
-
-static void
-list_free_deep_callback (gpointer callback_data)
-{
- gnome_vfs_list_deep_free (callback_data);
-}
-
-static void
-free_location_plus_callback (gpointer callback_data)
-{
- LocationPlus *location_plus;
-
- location_plus = callback_data;
- g_free (location_plus->from_location);
- g_free (location_plus->location);
- gnome_vfs_list_deep_free (location_plus->selection);
- g_free (location_plus->title);
- g_free (location_plus);
-}
-
-static void
-call_open_location (NautilusView *view,
- gpointer callback_data)
-{
- LocationPlus *location_plus;
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
- Nautilus_URIList *uri_list;
-
- location_plus = callback_data;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- uri_list = nautilus_uri_list_from_g_list (location_plus->selection);
- Nautilus_ViewFrame_open_location
- (view_frame, location_plus->location, location_plus->mode, location_plus->flags, uri_list, &ev);
- CORBA_free (uri_list);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-
-static void
-call_report_location_change (NautilusView *view,
- gpointer callback_data)
-{
- LocationPlus *location_plus;
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
- Nautilus_URIList *uri_list;
-
- location_plus = callback_data;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- uri_list = nautilus_uri_list_from_g_list (location_plus->selection);
- Nautilus_ViewFrame_report_location_change
- (view_frame,
- location_plus->location,
- uri_list,
- location_plus->title,
- &ev);
- CORBA_free (uri_list);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-static void
-call_report_redirect (NautilusView *view,
- gpointer callback_data)
-{
- LocationPlus *location_plus;
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
- Nautilus_URIList *uri_list;
-
- location_plus = callback_data;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- uri_list = nautilus_uri_list_from_g_list (location_plus->selection);
- Nautilus_ViewFrame_report_redirect
- (view_frame,
- location_plus->from_location,
- location_plus->location,
- uri_list,
- location_plus->title,
- &ev);
- CORBA_free (uri_list);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-static void
-call_report_selection_change (NautilusView *view,
- gpointer callback_data)
-{
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
- Nautilus_URIList *uri_list;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- uri_list = nautilus_uri_list_from_g_list (callback_data);
- Nautilus_ViewFrame_report_selection_change (view_frame, uri_list, &ev);
- CORBA_free (uri_list);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-static void
-call_report_status (NautilusView *view,
- gpointer callback_data)
-{
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- Nautilus_ViewFrame_report_status (view_frame, callback_data, &ev);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-static void
-call_report_load_underway (NautilusView *view,
- gpointer callback_data)
-{
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- Nautilus_ViewFrame_report_load_underway (view_frame, &ev);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-static void
-call_report_load_progress (NautilusView *view,
- gpointer callback_data)
-{
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- Nautilus_ViewFrame_report_load_progress
- (view_frame, * (double *) callback_data, &ev);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-static void
-call_report_load_complete (NautilusView *view,
- gpointer callback_data)
-{
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- Nautilus_ViewFrame_report_load_complete (view_frame, &ev);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-static void
-call_report_load_failed (NautilusView *view,
- gpointer callback_data)
-{
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- Nautilus_ViewFrame_report_load_failed (view_frame, &ev);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-static void
-call_set_title (NautilusView *view,
- gpointer callback_data)
-{
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- Nautilus_ViewFrame_set_title (view_frame, callback_data, &ev);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-static void
-call_set_show_hidden_files_mode (NautilusView *view,
- gpointer callback_data)
-{
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- Nautilus_ViewFrame_set_show_hidden_files_mode (view_frame, * (Nautilus_ShowHiddenFilesMode *) callback_data, &ev);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-static void
-call_go_back (NautilusView *view,
- gpointer callback_data)
-{
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- Nautilus_ViewFrame_go_back (view_frame, &ev);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-
-static void
-call_close_window (NautilusView *view,
- gpointer callback_data)
-{
- CORBA_Environment ev;
- Nautilus_ViewFrame view_frame;
-
- view_frame = view_frame_call_begin (view, &ev);
- if (view_frame != CORBA_OBJECT_NIL) {
- Nautilus_ViewFrame_close_window (view_frame, &ev);
- }
- view_frame_call_end (view_frame, &ev);
-}
-
-void
-nautilus_view_open_location (NautilusView *view,
- const char *location,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags,
- GList *selection)
-{
- LocationPlus *location_plus;
-
- location_plus = g_new0 (LocationPlus, 1);
- location_plus->location = g_strdup (location);
- location_plus->selection = str_list_copy (selection);
- location_plus->mode = mode;
- location_plus->flags = flags;
-
- queue_outgoing_call (view,
- call_open_location,
- location_plus,
- free_location_plus_callback);
-}
-
-void
-nautilus_view_report_location_change (NautilusView *view,
- const char *location,
- GList *selection,
- const char *title)
-{
- LocationPlus *location_plus;
-
- location_plus = g_new0 (LocationPlus, 1);
- location_plus->location = g_strdup (location);
- location_plus->selection = str_list_copy (selection);
- location_plus->title = g_strdup (title);
-
- queue_outgoing_call (view,
- call_report_location_change,
- location_plus,
- free_location_plus_callback);
-}
-
-void
-nautilus_view_report_redirect (NautilusView *view,
- const char *from_location,
- const char *to_location,
- GList *selection,
- const char *title)
-{
- LocationPlus *location_plus;
-
- location_plus = g_new0 (LocationPlus, 1);
- location_plus->from_location = g_strdup (from_location);
- location_plus->location = g_strdup (to_location);
- location_plus->selection = str_list_copy (selection);
- location_plus->title = g_strdup (title);
-
- queue_outgoing_call (view,
- call_report_redirect,
- location_plus,
- free_location_plus_callback);
-}
-
-void
-nautilus_view_report_selection_change (NautilusView *view,
- GList *selection)
-{
- queue_outgoing_call (view,
- call_report_selection_change,
- str_list_copy (selection),
- list_free_deep_callback);
-}
-
-void
-nautilus_view_report_status (NautilusView *view,
- const char *status)
-{
- queue_outgoing_call (view,
- call_report_status,
- g_strdup (status),
- g_free);
-}
-
-void
-nautilus_view_report_load_underway (NautilusView *view)
-{
- queue_outgoing_call (view,
- call_report_load_underway,
- NULL,
- NULL);
-}
-
-void
-nautilus_view_report_load_progress (NautilusView *view,
- double fraction_done)
-{
- queue_outgoing_call (view,
- call_report_load_progress,
- g_memdup (&fraction_done, sizeof (double)),
- g_free);
-}
-
-void
-nautilus_view_report_load_complete (NautilusView *view)
-{
- queue_outgoing_call (view,
- call_report_load_complete,
- NULL,
- NULL);
-}
-
-void
-nautilus_view_report_load_failed (NautilusView *view)
-{
- queue_outgoing_call (view,
- call_report_load_failed,
- NULL,
- NULL);
-}
-
-void
-nautilus_view_set_title (NautilusView *view,
- const char *title)
-{
- queue_outgoing_call (view,
- call_set_title,
- g_strdup (title),
- g_free);
-}
-
-void
-nautilus_view_set_show_hidden_files_mode (NautilusView *view,
- Nautilus_ShowHiddenFilesMode mode)
-{
- view->details->have_show_hidden_files_mode = TRUE;
- view->details->show_hidden_files_mode = mode;
-
- queue_outgoing_call (view,
- call_set_show_hidden_files_mode,
- g_memdup (&mode, sizeof (Nautilus_ShowHiddenFilesMode)),
- g_free);
-}
-
-void
-nautilus_view_go_back (NautilusView *view)
-{
- queue_outgoing_call (view,
- call_go_back,
- NULL,
- NULL);
-}
-
-void
-nautilus_view_close_window (NautilusView *view)
-{
- queue_outgoing_call (view,
- call_close_window,
- NULL,
- NULL);
-}
-
-BonoboControl *
-nautilus_view_get_bonobo_control (NautilusView *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW (view), NULL);
-
- return view->details->control;
-}
-
-BonoboUIComponent *
-nautilus_view_set_up_ui (NautilusView *view,
- const char *datadir,
- const char *ui_file_name,
- const char *application_name)
-{
- BonoboUIComponent *ui_component;
- Bonobo_UIContainer ui_container;
-
- /* Get the UI component that's pre-made by the control. */
- ui_component = bonobo_control_get_ui_component (view->details->control);
-
- /* Connect the UI component to the control frame's UI container. */
- ui_container = bonobo_control_get_remote_ui_container (view->details->control, NULL);
- bonobo_ui_component_set_container (ui_component, ui_container, NULL);
- bonobo_object_release_unref (ui_container, NULL);
-
- /* Set up the UI from an XML file. */
- bonobo_ui_util_set_ui (ui_component, datadir, ui_file_name, application_name, NULL);
-
- return ui_component;
-}
-
-static void
-nautilus_view_class_init (NautilusViewClass *class)
-{
- G_OBJECT_CLASS (class)->finalize = nautilus_view_finalize;
- G_OBJECT_CLASS (class)->dispose = nautilus_view_dispose;
-
- signals[LOAD_LOCATION] =
- g_signal_new ("load_location",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewClass, load_location),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
- signals[STOP_LOADING] =
- g_signal_new ("stop_loading",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewClass, stop_loading),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[SELECTION_CHANGED] =
- g_signal_new ("selection_changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewClass, selection_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals[TITLE_CHANGED] =
- g_signal_new ("title_changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewClass, title_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
- signals[HISTORY_CHANGED] =
- g_signal_new ("history_changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewClass, history_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals[SHOW_HIDDEN_FILES_MODE_CHANGED] =
- g_signal_new ("show_hidden_files_mode_changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- 0, /* No offset to keep binary compat */
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- class->epv.load_location = impl_Nautilus_View_load_location;
- class->epv.stop_loading = impl_Nautilus_View_stop_loading;
-}
-
-Bonobo_PropertyBag
-nautilus_view_get_ambient_properties (NautilusView *view,
- CORBA_Environment *opt_ev)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW (view), NULL);
-
- return bonobo_control_get_ambient_properties (view->details->control, opt_ev);
-}
-
-void
-nautilus_view_set_listener_mask (NautilusView *view,
- NautilusViewListenerMask mask)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW (view));
-
- view->details->listener_mask = mask;
- update_listener (view);
-}
-
-Nautilus_WindowType
-nautilus_view_get_window_type (NautilusView *view)
-{
- Bonobo_PropertyBag bag;
- BonoboArg *arg;
- CORBA_Environment ev;
-
- if (view->details->have_window_type) {
- return view->details->window_type;
- }
-
- view->details->have_window_type = TRUE;
-
- CORBA_exception_init (&ev);
-
- bag = nautilus_view_get_ambient_properties (view, &ev);
-
- view->details->window_type = Nautilus_WINDOW_SPATIAL;
-
- if (!BONOBO_EX (&ev)) {
- arg = Bonobo_PropertyBag_getValue (bag, "window-type", &ev);
-
- if (!BONOBO_EX (&ev)) {
- view->details->window_type = BONOBO_ARG_GET_GENERAL (arg,
- TC_Nautilus_WindowType,
- Nautilus_WindowType,
- NULL);
- CORBA_free (arg);
- } else {
- g_warning ("Window type not found in view frame properties.");
- }
-
- bonobo_object_release_unref (bag, &ev);
- } else {
- g_warning ("Couldn't get ambient properties for the view frame.");
- }
- CORBA_exception_free (&ev);
-
- return view->details->window_type;
-}
-
-Nautilus_ShowHiddenFilesMode
-nautilus_view_get_show_hidden_files_mode (NautilusView *view)
-{
- Bonobo_PropertyBag bag;
- BonoboArg *arg;
- CORBA_Environment ev;
-
- if (view->details->have_show_hidden_files_mode) {
- return view->details->show_hidden_files_mode;
- }
-
-
- CORBA_exception_init (&ev);
-
- bag = nautilus_view_get_ambient_properties (view, &ev);
-
- view->details->show_hidden_files_mode = Nautilus_SHOW_HIDDEN_FILES_DEFAULT;
-
- if (!BONOBO_EX (&ev)) {
- arg = Bonobo_PropertyBag_getValue (bag, "show-hidden-files-mode", &ev);
-
- if (!BONOBO_EX (&ev)) {
- view->details->show_hidden_files_mode = BONOBO_ARG_GET_GENERAL
- (arg,
- TC_Nautilus_ShowHiddenFilesMode,
- Nautilus_ShowHiddenFilesMode,
- NULL);
- CORBA_free (arg);
- } else {
- g_warning ("Show Hidden Files Mode not found in view frame properties.");
- }
-
- bonobo_object_release_unref (bag, &ev);
- } else {
- g_warning ("Couldn't get ambient properties for the view frame.");
- }
- CORBA_exception_free (&ev);
-
- view->details->have_show_hidden_files_mode = TRUE;
- return view->details->show_hidden_files_mode;
-}
diff --git a/libnautilus/nautilus-view.h b/libnautilus/nautilus-view.h
deleted file mode 100644
index 5e6818759..000000000
--- a/libnautilus/nautilus-view.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
-
-/*
- * libnautilus: A library for nautilus view implementations.
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000 Eazel, Inc.
- *
- * This 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.
- *
- * 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 Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Elliot Lee <sopwith@redhat.com>
- * Maciej Stachowiak <mjs@eazel.com>
- * Darin Adler <darin@bentspoon.com>
- *
- */
-
-#ifndef NAUTILUS_VIEW_H
-#define NAUTILUS_VIEW_H
-
-#include <libnautilus/nautilus-view-component.h>
-#include <bonobo/bonobo-control.h>
-
-G_BEGIN_DECLS
-
-#define NAUTILUS_TYPE_VIEW (nautilus_view_get_type ())
-#define NAUTILUS_VIEW(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VIEW, NautilusView))
-#define NAUTILUS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_VIEW, NautilusViewClass))
-#define NAUTILUS_IS_VIEW(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VIEW))
-#define NAUTILUS_IS_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_VIEW))
-
-typedef struct NautilusViewDetails NautilusViewDetails;
-
-typedef struct {
- BonoboObject parent_spot;
- NautilusViewDetails *details;
-} NautilusView;
-
-typedef struct {
- BonoboObjectClass parent_spot;
- POA_Nautilus_View__epv epv;
-
- void (* load_location) (NautilusView *view,
- const char *location_uri);
- void (* stop_loading) (NautilusView *view);
-
- /* These signals need to be enabled with nautilus_view_set_listener_mask */
- void (* title_changed) (NautilusView *view,
- const char *title);
- void (* history_changed) (NautilusView *view,
- const Nautilus_History *history);
- void (* selection_changed) (NautilusView *view,
- GList *selection);
-} NautilusViewClass;
-
-GType nautilus_view_get_type (void);
-NautilusView * nautilus_view_new (GtkWidget *widget);
-NautilusView * nautilus_view_new_from_bonobo_control (BonoboControl *bonobo_control);
-BonoboControl * nautilus_view_get_bonobo_control (NautilusView *view);
-
-/* Calls to the Nautilus shell via the view frame. See the IDL for detailed comments. */
-void nautilus_view_open_location (NautilusView *view,
- const char *location_uri,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags,
- GList *selection);
-void nautilus_view_report_location_change (NautilusView *view,
- const char *location_uri,
- GList *selection, /* list of URI char *s */
- const char *title);
-void nautilus_view_report_redirect (NautilusView *view,
- const char *from_location_uri,
- const char *to_location_uri,
- GList *selection, /* list of URI char *s */
- const char *title);
-void nautilus_view_report_selection_change (NautilusView *view,
- GList *selection); /* list of URI char *s */
-void nautilus_view_report_status (NautilusView *view,
- const char *status);
-void nautilus_view_report_load_underway (NautilusView *view);
-void nautilus_view_report_load_progress (NautilusView *view,
- double fraction_done);
-void nautilus_view_report_load_complete (NautilusView *view);
-void nautilus_view_report_load_failed (NautilusView *view);
-void nautilus_view_set_title (NautilusView *view,
- const char *title);
-void nautilus_view_go_back (NautilusView *view);
-void nautilus_view_close_window (NautilusView *view);
-
-/* call from the view component to indicate a change in this setting has occured*/
-void nautilus_view_set_show_hidden_files_mode (NautilusView *view,
- Nautilus_ShowHiddenFilesMode mode);
-
-/* Some utility functions useful for doing the CORBA work directly.
- * Not needed by most components, but shared with the view frame code,
- * which is why they are public.
- */
-Nautilus_URIList * nautilus_uri_list_from_g_list (GList *list);
-GList * nautilus_g_list_from_uri_list (const Nautilus_URIList *uri_list);
-
-/* Simpler API for setting up and getting the UI component. */
-BonoboUIComponent *nautilus_view_set_up_ui (NautilusView *view,
- const char *datadir,
- const char *ui_xml_file_name,
- const char *application_name);
-
-
-typedef enum {
- NAUTILUS_VIEW_LISTEN_TITLE = 1<<0,
- NAUTILUS_VIEW_LISTEN_HISTORY = 1<<1,
- NAUTILUS_VIEW_LISTEN_SELECTION = 1<<2,
- NAUTILUS_VIEW_LISTEN_SHOW_HIDDEN_FILES_MODE = 1<<3
-} NautilusViewListenerMask;
-
-Bonobo_PropertyBag nautilus_view_get_ambient_properties (NautilusView *view,
- CORBA_Environment *opt_ev);
-void nautilus_view_set_listener_mask (NautilusView *view,
- NautilusViewListenerMask mask);
-Nautilus_WindowType nautilus_view_get_window_type (NautilusView *view);
-Nautilus_ShowHiddenFilesMode nautilus_view_get_show_hidden_files_mode (NautilusView *view);
-
-/* `protected' functions for use by subclasses only. */
-NautilusView * nautilus_view_construct (NautilusView *view,
- GtkWidget *widget);
-NautilusView * nautilus_view_construct_from_bonobo_control (NautilusView *view,
- BonoboControl *bonobo_control);
-
-G_END_DECLS
-
-#endif /* NAUTILUS_VIEW_H */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b41dc4501..18bbfb756 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,18 +1,18 @@
# List of source files containing translatable strings.
# Please keep this file sorted alphabetically.
-components/adapter/main.c
components/adapter/Nautilus_ComponentAdapterFactory_std.server.in.in
-components/emblem/nautilus-emblem-view.c
+components/adapter/main.c
components/emblem/Nautilus_View_emblem.server.in.in
-components/history/nautilus-history-view.c
+components/emblem/nautilus-emblem-view.c
components/history/Nautilus_View_history.server.in.in
-components/image_properties/nautilus-image-properties-view.c
+components/history/nautilus-history-view.c
components/image_properties/Nautilus_View_image_properties.server.in.in
-components/notes/nautilus-notes.c
+components/image_properties/nautilus-image-properties-view.c
components/notes/Nautilus_View_notes.server.in.in
-components/text/nautilus-text-view.c
-components/text/nautilus-text-view-ui.xml
+components/notes/nautilus-notes.c
components/text/Nautilus_View_text.server.in.in
+components/text/nautilus-text-view-ui.xml
+components/text/nautilus-text-view.c
components/throbber/Nautilus_Control_throbber.server.in.in
components/throbber/nautilus-throbber.c
data/applications.desktop.in
@@ -28,23 +28,21 @@ icons/tahoe/tahoe.xml
libnautilus-extension/nautilus-column.c
libnautilus-extension/nautilus-menu-item.c
libnautilus-extension/nautilus-property-page.c
-libnautilus/nautilus-clipboard.c
-libnautilus/nautilus-clipboard-ui.xml
libnautilus-private/apps_nautilus_preferences.schemas.in
libnautilus-private/nautilus-column-chooser.c
libnautilus-private/nautilus-column-utilities.c
libnautilus-private/nautilus-customization-data.c
libnautilus-private/nautilus-desktop-directory-file.c
libnautilus-private/nautilus-desktop-icon-file.c
-libnautilus-private/nautilus-desktop-link.c
libnautilus-private/nautilus-desktop-link-monitor.c
+libnautilus-private/nautilus-desktop-link.c
libnautilus-private/nautilus-dnd.c
libnautilus-private/nautilus-emblem-utils.c
libnautilus-private/nautilus-entry.c
-libnautilus-private/nautilus-file.c
-libnautilus-private/nautilus-file-operations.c
libnautilus-private/nautilus-file-operations-progress.c
+libnautilus-private/nautilus-file-operations.c
libnautilus-private/nautilus-file-utilities.c
+libnautilus-private/nautilus-file.c
libnautilus-private/nautilus-global-preferences.c
libnautilus-private/nautilus-icon-canvas-item.c
libnautilus-private/nautilus-icon-container.c
@@ -56,12 +54,13 @@ libnautilus-private/nautilus-trash-directory.c
libnautilus-private/nautilus-trash-file.c
libnautilus-private/nautilus-tree-view-drag-dest.c
libnautilus-private/nautilus-undo-signal-handlers.c
-libnautilus-private/nautilus-view-identifier.c
+libnautilus/nautilus-clipboard-ui.xml
+libnautilus/nautilus-clipboard.c
nautilus-computer.desktop.in
-nautilus.desktop.in
nautilus-file-management-properties.desktop.in
nautilus-home.desktop.in
-src/file-manager/fm-bonobo-provider.c
+nautilus.desktop.in
+src/Nautilus_shell.server.in
src/file-manager/fm-desktop-icon-view.c
src/file-manager/fm-directory-view.c
src/file-manager/fm-ditem-page.c
@@ -81,32 +80,33 @@ src/nautilus-bookmarks-window.c
src/nautilus-bookmarks-window.glade
src/nautilus-connect-server-dialog.c
src/nautilus-desktop-window.c
+src/nautilus-emblem-sidebar.c
+src/nautilus-file-management-properties-main.c
src/nautilus-file-management-properties.c
src/nautilus-file-management-properties.glade
-src/nautilus-file-management-properties-main.c
src/nautilus-first-time-druid.c
+src/nautilus-history-sidebar.c
+src/nautilus-image-properties-page.c
src/nautilus-information-panel.c
src/nautilus-location-bar.c
src/nautilus-location-dialog.c
src/nautilus-location-entry.c
src/nautilus-main.c
-src/nautilus-navigation-window.c
src/nautilus-navigation-window-menus.c
src/nautilus-navigation-window-ui.xml
-src/nautilus-profiler.c
+src/nautilus-navigation-window.c
+src/nautilus-notes-viewer.c
src/nautilus-property-browser.c
-src/nautilus-shell.c
-src/Nautilus_shell.server.in
src/nautilus-shell-ui.xml
-src/nautilus-sidebar-title.c
+src/nautilus-shell.c
src/nautilus-side-pane.c
-src/nautilus-spatial-window.c
+src/nautilus-sidebar-title.c
src/nautilus-spatial-window-ui.xml
-src/nautilus-view-frame.c
-src/nautilus-window.c
+src/nautilus-spatial-window.c
src/nautilus-window-manage-views.c
src/nautilus-window-menus.c
src/nautilus-window-private.h
src/nautilus-window-toolbars.c
+src/nautilus-window.c
src/nautilus-zoom-control.c
src/network-scheme.desktop.in
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index e73e8f9f0..c75319ac9 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -13,13 +13,3 @@ components/news/Nautilus_View_news.server.in
components/news/nautilus-cell-renderer-news.c
components/news/nautilus-news.c
libbackground/applier.c
-# Medusa/search-related files.
-libnautilus-private/nautilus-medusa-support.c
-libnautilus-private/nautilus-search-uri.c
-src/file-manager/fm-search-list-view.c
-src/file-manager/nautilus-indexing-info.c
-src/file-manager/nautilus-search-list-view-ui.xml
-src/nautilus-complex-search-bar.c
-src/nautilus-search-bar-criterion.c
-src/nautilus-simple-search-bar.c
-src/nautilus-switchable-search-bar.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 2d741fcaf..9de870f97 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,6 +13,7 @@ INCLUDES = \
-I$(top_srcdir)/cut-n-paste-code \
-I$(top_builddir)/libnautilus-private \
$(CORE_CFLAGS) \
+ $(EXIF_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
-DGNOMELOCALEDIR=\""$(prefix)/${DATADIRNAME}/locale"\" \
-DLIBDIR=\""$(libdir)"\" \
@@ -27,11 +28,10 @@ INCLUDES = \
LDADD =\
$(top_builddir)/src/file-manager/libnautilus-file-manager.la \
- $(top_builddir)/libnautilus/libnautilus.la \
- $(top_builddir)/libnautilus-adapter/libnautilus-adapter.la \
$(top_builddir)/libnautilus-private/libnautilus-private.la \
$(top_builddir)/cut-n-paste-code/gsequence/libgsequence.la \
$(CORE_LIBS) \
+ $(EXIF_LIBS) \
$(POPT_LIBS) \
$(NULL)
@@ -52,84 +52,73 @@ nautilus_shell_interface_idl_sources = \
nautilus_SOURCES = \
$(nautilus_shell_interface_idl_sources) \
- nautilus-applicable-views.c \
+ nautilus-actions.h \
nautilus-application.c \
- nautilus-bookmark-list.c \
- nautilus-bookmark-parsing.c \
- nautilus-bookmarks-window.c \
- nautilus-complex-search-bar.c \
- nautilus-component-adapter-factory.c \
- nautilus-connect-server-dialog.c \
- nautilus-desktop-window.c \
- nautilus-first-time-druid.c \
- nautilus-information-panel.c \
- nautilus-location-bar.c \
- nautilus-location-dialog.c \
- nautilus-location-entry.c \
- nautilus-main.c \
- nautilus-navigation-bar.c \
- nautilus-navigation-window.c \
- nautilus-navigation-window-menus.c \
- nautilus-profiler.c \
- nautilus-property-browser.c \
- nautilus-search-bar-criterion.c \
- nautilus-search-bar.c \
- nautilus-self-check-functions.c \
- nautilus-shell.c \
- nautilus-side-pane.c \
- nautilus-sidebar-title.c \
- nautilus-signaller.c \
- nautilus-simple-search-bar.c \
- nautilus-spatial-window.c \
- nautilus-switchable-navigation-bar.c \
- nautilus-switchable-search-bar.c \
- nautilus-window-toolbars.c \
- nautilus-view-frame-corba.c \
- nautilus-view-frame.c \
- nautilus-window-manage-views.c \
- nautilus-window-menus.c \
- nautilus-window.c \
- nautilus-zoom-control.c \
- nautilus-applicable-views.h \
nautilus-application.h \
+ nautilus-bookmark-list.c \
nautilus-bookmark-list.h \
+ nautilus-bookmark-parsing.c \
nautilus-bookmark-parsing.h \
+ nautilus-bookmarks-window.c \
nautilus-bookmarks-window.h \
- nautilus-complex-search-bar.h \
- nautilus-component-adapter-factory.h \
+ nautilus-connect-server-dialog.c \
nautilus-connect-server-dialog.h \
+ nautilus-desktop-window.c \
nautilus-desktop-window.h \
+ nautilus-emblem-sidebar.c \
+ nautilus-emblem-sidebar.h \
+ nautilus-file-management-properties.c \
+ nautilus-file-management-properties.h \
+ nautilus-first-time-druid.c \
nautilus-first-time-druid.h \
+ nautilus-history-sidebar.c \
+ nautilus-history-sidebar.h \
+ nautilus-image-properties-page.c \
+ nautilus-image-properties-page.h \
+ nautilus-information-panel.c \
nautilus-information-panel.h \
+ nautilus-location-bar.c \
nautilus-location-bar.h \
+ nautilus-location-dialog.c \
nautilus-location-dialog.h \
+ nautilus-location-entry.c \
nautilus-location-entry.h \
+ nautilus-main.c \
nautilus-main.h \
+ nautilus-navigation-action.c \
+ nautilus-navigation-action.h \
+ nautilus-navigation-bar.c \
nautilus-navigation-bar.h \
+ nautilus-navigation-window-menus.c \
+ nautilus-navigation-window.c \
nautilus-navigation-window.h \
- nautilus-profiler.h \
+ nautilus-notes-viewer.c \
+ nautilus-notes-viewer.h \
+ nautilus-property-browser.c \
nautilus-property-browser.h \
- nautilus-search-bar-criterion-private.h \
- nautilus-search-bar-criterion.h \
- nautilus-search-bar-private.h \
- nautilus-search-bar.h \
+ nautilus-self-check-functions.c \
nautilus-self-check-functions.h \
+ nautilus-shell.c \
nautilus-shell.h \
+ nautilus-side-pane.c \
nautilus-side-pane.h \
+ nautilus-sidebar-title.c \
nautilus-sidebar-title.h \
+ nautilus-signaller.c \
nautilus-signaller.h \
- nautilus-simple-search-bar.h \
+ nautilus-spatial-window.c \
nautilus-spatial-window.h \
- nautilus-switchable-navigation-bar.h \
- nautilus-switchable-search-bar.h \
- nautilus-view-frame-private.h \
- nautilus-view-frame.h \
+ nautilus-throbber.c \
+ nautilus-throbber.h \
+ nautilus-window-manage-views.c \
nautilus-window-manage-views.h \
+ nautilus-window-menus.c \
nautilus-window-private.h \
+ nautilus-window-toolbars.c \
+ nautilus-window.c \
nautilus-window.h \
+ nautilus-zoom-control.c \
nautilus-zoom-control.h \
- nautilus-file-management-properties.c \
- nautilus-file-management-properties.h \
$(NULL)
nautilus_file_management_properties_SOURCES= \
@@ -139,7 +128,7 @@ nautilus_file_management_properties_SOURCES= \
$(NULL)
$(nautilus_shell_interface_idl_sources): nautilus_shell_interface_idl_stamp
-nautilus_shell_interface_idl_stamp: nautilus-shell-interface.idl $(ORBIT_IDL) $(top_srcdir)/libnautilus/nautilus-view-component.idl
+nautilus_shell_interface_idl_stamp: nautilus-shell-interface.idl $(ORBIT_IDL)
$(ORBIT_IDL) $(CORE_IDL_INCLUDES) -I$(top_srcdir) $<
touch $@
@@ -153,7 +142,7 @@ server_DATA = $(server_in_files:.server.in=.server)
@INTLTOOL_SERVER_RULE@
-uidir = $(datadir)/gnome-2.0/ui
+uidir = $(datadir)/nautilus/ui
ui_DATA = \
nautilus-shell-ui.xml \
nautilus-navigation-window-ui.xml \
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>
diff --git a/src/nautilus-actions.h b/src/nautilus-actions.h
new file mode 100644
index 000000000..8d5f69982
--- /dev/null
+++ b/src/nautilus-actions.h
@@ -0,0 +1,44 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * Nautilus
+ *
+ * Copyright (C) 2004 Red Hat, Inc.
+ *
+ * Nautilus 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.
+ *
+ * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Authors: Alexander Larsson <alexl@redhat.com>
+ *
+ */
+
+#ifndef NAUTILUS_ACTIONS_H
+#define NAUTILUS_ACTIONS_H
+
+#define NAUTILUS_ACTION_STOP "Stop"
+#define NAUTILUS_ACTION_RELOAD "Reload"
+#define NAUTILUS_ACTION_BACK "Back"
+#define NAUTILUS_ACTION_UP "Up"
+#define NAUTILUS_ACTION_UP_ACCEL "UpAccel"
+#define NAUTILUS_ACTION_UP_ACCEL "UpAccel"
+#define NAUTILUS_ACTION_FORWARD "Forward"
+#define NAUTILUS_ACTION_SHOW_HIDE_SIDEBAR "Show Hide Sidebar"
+#define NAUTILUS_ACTION_SHOW_HIDE_STATUSBAR "Show Hide Statusbar"
+#define NAUTILUS_ACTION_SHOW_HIDE_LOCATION_BAR "Show Hide Location Bar"
+#define NAUTILUS_ACTION_GO_TO_BURN_CD "Go to Burn CD"
+#define NAUTILUS_ACTION_ZOOM_IN "Zoom In"
+#define NAUTILUS_ACTION_ZOOM_OUT "Zoom Out"
+#define NAUTILUS_ACTION_ZOOM_NORMAL "Zoom Normal"
+
+#endif /* NAUTILUS_ACTIONS_H */
diff --git a/src/nautilus-applicable-views.c b/src/nautilus-applicable-views.c
deleted file mode 100644
index 38accd6e8..000000000
--- a/src/nautilus-applicable-views.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 2000, 2001 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Elliot Lee <sopwith@redhat.com>
- * Maciej Stachowiak <mjs@eazel.com>
- * Darin Adler <darin@bentspoon.com>
- *
- */
-
-/* nautilus-applicable-views.c: Implementation of routines for mapping a location
- change request to a set of views and actual URL to be loaded. */
-
-#include <config.h>
-#include "nautilus-applicable-views.h"
-
-#include <libgnomevfs/gnome-vfs-result.h>
-#include <libnautilus-private/nautilus-file.h>
-#include <libnautilus-private/nautilus-mime-actions.h>
-#include <libnautilus-private/nautilus-view-query.h>
-#include <libnautilus-private/nautilus-view-identifier.h>
-
-struct NautilusDetermineViewHandle {
- NautilusDetermineViewHandle **early_completion_hook;
- NautilusDetermineViewCallback callback;
- gpointer callback_data;
- NautilusFile *file;
- gboolean fallback;
-};
-
-static NautilusDetermineViewResult
-get_view_result_from_gnome_vfs_result (GnomeVFSResult gnome_vfs_result)
-{
- switch (gnome_vfs_result) {
- case GNOME_VFS_OK:
- return NAUTILUS_DETERMINE_VIEW_OK;
- case GNOME_VFS_ERROR_NOT_FOUND:
- return NAUTILUS_DETERMINE_VIEW_NOT_FOUND;
- case GNOME_VFS_ERROR_INVALID_URI:
- return NAUTILUS_DETERMINE_VIEW_INVALID_URI;
- case GNOME_VFS_ERROR_NOT_SUPPORTED:
- return NAUTILUS_DETERMINE_VIEW_UNSUPPORTED_SCHEME;
- case GNOME_VFS_ERROR_LOGIN_FAILED:
- return NAUTILUS_DETERMINE_VIEW_LOGIN_FAILED;
- case GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE:
- return NAUTILUS_DETERMINE_VIEW_SERVICE_NOT_AVAILABLE;
- case GNOME_VFS_ERROR_ACCESS_DENIED:
- return NAUTILUS_DETERMINE_VIEW_ACCESS_DENIED;
- case GNOME_VFS_ERROR_HOST_NOT_FOUND:
- return NAUTILUS_DETERMINE_VIEW_HOST_NOT_FOUND;
- case GNOME_VFS_ERROR_HOST_HAS_NO_ADDRESS:
- return NAUTILUS_DETERMINE_VIEW_HOST_HAS_NO_ADDRESS;
- case GNOME_VFS_ERROR_NO_MASTER_BROWSER:
- return NAUTILUS_DETERMINE_VIEW_NO_MASTER_BROWSER;
- case GNOME_VFS_ERROR_GENERIC:
- case GNOME_VFS_ERROR_INTERNAL:
- /* These two have occurred at least once in the web browser component */
- return NAUTILUS_DETERMINE_VIEW_UNSPECIFIC_ERROR;
- default:
- /* Whenever this message fires, we should consider adding a specific case
- * to make the error as comprehensible as possible to the user. Please
- * bug me (sullivan@eazel.com) if you see this fire and don't have the
- * inclination to immediately make a good message yourself (tell me
- * what GnomeVFSResult code the message reported, and what caused it to
- * fire).
- */
- g_warning ("in nautilus-applicable-views.c, got unhandled GnomeVFSResult %d (%s). "
- "If this is a legitimate get_file_info result, please tell "
- "sullivan@eazel.com so he can "
- "write a decent user-level error message for it.",
- gnome_vfs_result,
- gnome_vfs_result_to_string (gnome_vfs_result));
- return NAUTILUS_DETERMINE_VIEW_UNSPECIFIC_ERROR;
- }
-}
-
-static void
-got_file_info_callback (NautilusFile *file,
- gpointer callback_data)
-{
- NautilusDetermineViewHandle *handle;
- GnomeVFSResult vfs_result_code;
- NautilusDetermineViewResult result_code;
- NautilusViewIdentifier *default_id;
- Bonobo_ServerInfo *default_component;
-
- handle = (NautilusDetermineViewHandle *) callback_data;
-
- g_assert (handle->file == file);
- default_id = NULL;
-
- vfs_result_code = nautilus_file_get_file_info_result (file);
- if (vfs_result_code == GNOME_VFS_OK
- || vfs_result_code == GNOME_VFS_ERROR_NOT_SUPPORTED
- || vfs_result_code == GNOME_VFS_ERROR_INVALID_URI) {
- if (handle->fallback) {
- default_component = nautilus_view_query_get_fallback_component_for_file (handle->file);
- } else {
- default_component = nautilus_view_query_get_default_component_for_file (handle->file);
- }
- if (default_component != NULL) {
- default_id = nautilus_view_identifier_new_from_content_view (default_component);
- CORBA_free (default_component);
- if (default_id != NULL) {
- vfs_result_code = GNOME_VFS_OK;
- }
- }
- }
-
- if (vfs_result_code == GNOME_VFS_OK && default_id == NULL) {
- result_code = NAUTILUS_DETERMINE_VIEW_NO_HANDLER_FOR_TYPE;
- } else {
- result_code = get_view_result_from_gnome_vfs_result (vfs_result_code);
- }
-
- (* handle->callback) (handle,
- result_code,
- default_id,
- handle->callback_data);
-
- nautilus_view_identifier_free (default_id);
-
- nautilus_determine_initial_view_cancel (handle);
-}
-
-NautilusDetermineViewHandle *
-nautilus_determine_initial_view (const char *location,
- gboolean fallback,
- NautilusDetermineViewCallback callback,
- gpointer callback_data)
-{
- NautilusDetermineViewHandle *handle;
- NautilusFileAttributes attributes;
-
- g_return_val_if_fail (location != NULL, NULL);
- g_return_val_if_fail (callback != NULL, NULL);
-
- handle = g_new0 (NautilusDetermineViewHandle, 1);
-
- handle->early_completion_hook = &handle;
-
- handle->callback = callback;
- handle->callback_data = callback_data;
- handle->fallback = fallback;
-
- handle->file = nautilus_file_get (location);
-
- attributes = nautilus_mime_actions_get_minimum_file_attributes ();
- nautilus_file_call_when_ready (handle->file, attributes,
- got_file_info_callback, handle);
-
- if (handle != NULL) {
- handle->early_completion_hook = NULL;
- }
-
- return handle;
-}
-
-void
-nautilus_determine_initial_view_cancel (NautilusDetermineViewHandle *handle)
-{
- g_return_if_fail (handle != NULL);
- g_return_if_fail (handle->early_completion_hook == NULL
- || *handle->early_completion_hook == handle);
- g_return_if_fail (handle->callback != NULL);
-
- if (handle->early_completion_hook != NULL) {
- *handle->early_completion_hook = NULL;
- }
-
- nautilus_file_cancel_call_when_ready
- (handle->file, got_file_info_callback, handle);
-
- nautilus_file_unref (handle->file);
-
- g_free (handle);
-}
diff --git a/src/nautilus-applicable-views.h b/src/nautilus-applicable-views.h
deleted file mode 100644
index da85cc0a3..000000000
--- a/src/nautilus-applicable-views.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Coypright (C) 2000, 2001 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Elliot Lee <sopwith@redhat.com>
- * Darin Adler <darin@bentspoon.com>
- * Maciej Stachowiak <mjs@eazel.com>
- *
- */
-
-/* nautilus-applicable-views.h: Interface for mapping a location
- change request to a set of views and actual URL to be loaded. */
-
-#ifndef NAUTILUS_APPLICABLE_VIEWS_H
-#define NAUTILUS_APPLICABLE_VIEWS_H
-
-#include <libnautilus-private/nautilus-view-identifier.h>
-
-typedef struct NautilusDetermineViewHandle NautilusDetermineViewHandle;
-
-/* These are the different ways that Nautilus can fail to locate an
- * initial view for a given location NAUTILUS_DETERMINE_VIEW_OK means
- * the uri was displayed successfully. These are similar to
- * GnomeVFSResults but there are Nautilus-specific codes and many of
- * the GnomeVFSResults are treated the same here.
- */
-typedef enum {
- NAUTILUS_DETERMINE_VIEW_OK,
- NAUTILUS_DETERMINE_VIEW_UNSPECIFIC_ERROR,
- NAUTILUS_DETERMINE_VIEW_NO_HANDLER_FOR_TYPE,
- NAUTILUS_DETERMINE_VIEW_NOT_FOUND,
- NAUTILUS_DETERMINE_VIEW_UNSUPPORTED_SCHEME,
- NAUTILUS_DETERMINE_VIEW_INVALID_URI,
- NAUTILUS_DETERMINE_VIEW_LOGIN_FAILED,
- NAUTILUS_DETERMINE_VIEW_SERVICE_NOT_AVAILABLE,
- NAUTILUS_DETERMINE_VIEW_ACCESS_DENIED,
- NAUTILUS_DETERMINE_VIEW_HOST_NOT_FOUND,
- NAUTILUS_DETERMINE_VIEW_HOST_HAS_NO_ADDRESS,
- NAUTILUS_DETERMINE_VIEW_NO_MASTER_BROWSER
-} NautilusDetermineViewResult;
-
-typedef void (* NautilusDetermineViewCallback) (NautilusDetermineViewHandle *handle,
- NautilusDetermineViewResult result,
- const NautilusViewIdentifier *initial_view,
- gpointer callback_data);
-
-NautilusDetermineViewHandle *nautilus_determine_initial_view (const char *location,
- gboolean fallback,
- NautilusDetermineViewCallback callback,
- gpointer callback_data);
-void nautilus_determine_initial_view_cancel (NautilusDetermineViewHandle *handle);
-
-#endif /* NAUTILUS_APPLICABLE_VIEWS_H */
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index af4ad6d88..5358b7422 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -29,13 +29,16 @@
#include "nautilus-application.h"
-#include "file-manager/fm-bonobo-provider.h"
#include "file-manager/fm-ditem-page.h"
#include "file-manager/fm-desktop-icon-view.h"
#include "file-manager/fm-icon-view.h"
#include "file-manager/fm-list-view.h"
-#include "file-manager/fm-search-list-view.h"
#include "file-manager/fm-tree-view.h"
+#include "nautilus-information-panel.h"
+#include "nautilus-history-sidebar.h"
+#include "nautilus-notes-viewer.h"
+#include "nautilus-emblem-sidebar.h"
+#include "nautilus-image-properties-page.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -76,7 +79,6 @@
#include <libnautilus-private/nautilus-metafile-factory.h>
#include <libnautilus-private/nautilus-module.h>
#include <libnautilus-private/nautilus-sound.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
#include <libnautilus-private/nautilus-undo-manager.h>
#include <libnautilus-private/nautilus-desktop-link-monitor.h>
#include <libnautilus-private/nautilus-directory-private.h>
@@ -121,28 +123,13 @@ create_object (PortableServer_Servant servant,
CORBA_Environment *ev)
{
BonoboObject *object;
- FMDirectoryView *directory_view;
NautilusApplication *application;
- if (strcmp (iid, NAUTILUS_ICON_VIEW_IID) == 0) {
- directory_view = FM_DIRECTORY_VIEW (g_object_new (fm_icon_view_get_type (), NULL));
- object = BONOBO_OBJECT (fm_directory_view_get_nautilus_view (directory_view));
- } else if (strcmp (iid, NAUTILUS_DESKTOP_ICON_VIEW_IID) == 0) {
- directory_view = FM_DIRECTORY_VIEW (g_object_new (fm_desktop_icon_view_get_type (), NULL));
- object = BONOBO_OBJECT (fm_directory_view_get_nautilus_view (directory_view));
- } else if (strcmp (iid, NAUTILUS_LIST_VIEW_IID) == 0) {
- directory_view = FM_DIRECTORY_VIEW (g_object_new (fm_list_view_get_type (), NULL));
- object = BONOBO_OBJECT (fm_directory_view_get_nautilus_view (directory_view));
- } else if (strcmp (iid, SEARCH_LIST_VIEW_IID) == 0) {
- directory_view = FM_DIRECTORY_VIEW (g_object_new (fm_search_list_view_get_type (), NULL));
- object = BONOBO_OBJECT (fm_directory_view_get_nautilus_view (directory_view));
- } else if (strcmp (iid, SHELL_IID) == 0) {
+ if (strcmp (iid, SHELL_IID) == 0) {
application = NAUTILUS_APPLICATION (bonobo_object_from_servant (servant));
object = BONOBO_OBJECT (nautilus_shell_new (application));
} else if (strcmp (iid, METAFILE_FACTORY_IID) == 0) {
object = BONOBO_OBJECT (nautilus_metafile_factory_get_instance ());
- } else if (strcmp (iid, TREE_VIEW_IID) == 0) {
- object = BONOBO_OBJECT (g_object_new (fm_tree_view_get_type (), NULL));
} else {
object = CORBA_OBJECT_NIL;
}
@@ -162,12 +149,6 @@ nautilus_application_get_spatial_window_list (void)
return nautilus_application_spatial_window_list;
}
-static CORBA_Object
-create_object_shortcut (const char *iid,
- gpointer callback_data)
-{
- return create_object (BONOBO_OBJREF (callback_data), iid, NULL);
-}
static void
nautilus_application_instance_init (NautilusApplication *application)
@@ -187,11 +168,20 @@ nautilus_application_instance_init (NautilusApplication *application)
g_signal_connect_object (gnome_vfs_get_volume_monitor (), "volume_mounted",
G_CALLBACK (volume_mounted_callback), application, 0);
- nautilus_bonobo_register_activation_shortcut (NAUTILUS_ICON_VIEW_IID, create_object_shortcut, application);
- nautilus_bonobo_register_activation_shortcut (NAUTILUS_DESKTOP_ICON_VIEW_IID, create_object_shortcut, application);
- nautilus_bonobo_register_activation_shortcut (NAUTILUS_LIST_VIEW_IID, create_object_shortcut, application);
- nautilus_bonobo_register_activation_shortcut (SEARCH_LIST_VIEW_IID, create_object_shortcut, application);
- nautilus_bonobo_register_activation_shortcut (TREE_VIEW_IID, create_object_shortcut, application);
+ /* register views */
+ fm_icon_view_register ();
+ fm_desktop_icon_view_register ();
+ fm_list_view_register ();
+
+ /* register sidebars */
+ nautilus_information_panel_register ();
+ fm_tree_view_register ();
+ nautilus_history_sidebar_register ();
+ nautilus_notes_viewer_register (); /* also property page */
+ nautilus_emblem_sidebar_register ();
+
+ /* register property pages */
+ nautilus_image_properties_page_register ();
}
NautilusApplication *
@@ -215,15 +205,9 @@ nautilus_application_destroy (BonoboObject *object)
application = NAUTILUS_APPLICATION (object);
- nautilus_bonobo_unregister_activation_shortcut (NAUTILUS_ICON_VIEW_IID);
- nautilus_bonobo_unregister_activation_shortcut (NAUTILUS_DESKTOP_ICON_VIEW_IID);
- nautilus_bonobo_unregister_activation_shortcut (NAUTILUS_LIST_VIEW_IID);
- nautilus_bonobo_unregister_activation_shortcut (SEARCH_LIST_VIEW_IID);
- nautilus_bonobo_unregister_activation_shortcut (TREE_VIEW_IID);
-
nautilus_bookmarks_exiting ();
- bonobo_object_unref (application->undo_manager);
+ g_object_unref (application->undo_manager);
EEL_CALL_PARENT (BONOBO_OBJECT_CLASS, destroy, (object));
}
@@ -373,7 +357,6 @@ finish_startup (NautilusApplication *application)
/* initialize nautilus modules */
nautilus_module_init ();
- nautilus_module_add_type (FM_TYPE_BONOBO_PROVIDER);
nautilus_module_add_type (FM_TYPE_DITEM_PAGE);
/* initialize the sound machinery */
@@ -444,6 +427,23 @@ initialize_kde_trash_hack (void)
g_free (desktop_dir);
}
+
+static Bonobo_RegistrationResult
+nautilus_bonobo_activation_register_for_display (const char *iid,
+ Bonobo_Unknown ref)
+{
+ const char *display_name;
+ GSList *reg_env ;
+ Bonobo_RegistrationResult result;
+
+ display_name = gdk_display_get_name (gdk_display_get_default());
+ reg_env = bonobo_activation_registration_env_set (NULL,
+ "DISPLAY", display_name);
+ result = bonobo_activation_register_active_server (iid, ref, reg_env);
+ bonobo_activation_registration_env_free (reg_env);
+ return result;
+}
+
void
nautilus_application_startup (NautilusApplication *application,
gboolean kill_shell,
@@ -822,6 +822,9 @@ find_parent_spatial_window (NautilusSpatialWindow *window)
char *desktop_directory;
location = nautilus_window_get_location (NAUTILUS_WINDOW (window));
+ if (location == NULL) {
+ return NULL;
+ }
file = nautilus_file_get (location);
g_free (location);
@@ -931,9 +934,10 @@ create_window (NautilusApplication *application,
window = NAUTILUS_WINDOW (gtk_widget_new (window_type,
"app", application,
- "app_id", "nautilus",
"screen", screen,
NULL));
+ /* Must be called after construction finished */
+ nautilus_window_constructed (window);
g_signal_connect_data (window, "delete_event",
G_CALLBACK (nautilus_window_delete_event_callback), NULL, NULL,
@@ -974,10 +978,10 @@ nautilus_application_present_spatial_window (NautilusApplication *application,
NautilusWindow *
nautilus_application_present_spatial_window_with_selection (NautilusApplication *application,
- NautilusWindow *requesting_window,
- const char *location,
- GList *new_selection,
- GdkScreen *screen)
+ NautilusWindow *requesting_window,
+ const char *location,
+ GList *new_selection,
+ GdkScreen *screen)
{
NautilusWindow *window;
GList *l;
@@ -991,7 +995,7 @@ nautilus_application_present_spatial_window_with_selection (NautilusApplication
existing_window = NAUTILUS_WINDOW (l->data);
existing_location = existing_window->details->pending_location;
-
+
if (existing_location == NULL) {
existing_location = existing_window->details->location;
}
@@ -999,7 +1003,7 @@ nautilus_application_present_spatial_window_with_selection (NautilusApplication
if (eel_uris_match (existing_location, location)) {
gtk_window_present (GTK_WINDOW (existing_window));
if (new_selection) {
- nautilus_view_frame_selection_changed (existing_window->content_view, new_selection);
+ nautilus_view_set_selection (existing_window->content_view, new_selection);
}
return existing_window;
}
diff --git a/src/nautilus-bookmarks-window.c b/src/nautilus-bookmarks-window.c
index 0776a0b01..3012704b7 100644
--- a/src/nautilus-bookmarks-window.c
+++ b/src/nautilus-bookmarks-window.c
@@ -28,7 +28,7 @@
#include <config.h>
#include "nautilus-bookmarks-window.h"
#include "nautilus-window.h"
-#include <libnautilus/nautilus-undo.h>
+#include <libnautilus-private/nautilus-undo.h>
#include <libnautilus-private/nautilus-global-preferences.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-gnome-extensions.h>
diff --git a/src/nautilus-complex-search-bar.c b/src/nautilus-complex-search-bar.c
deleted file mode 100644
index 061e01a56..000000000
--- a/src/nautilus-complex-search-bar.c
+++ /dev/null
@@ -1,608 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Rebecca Schulman <rebecka@eazel.com>
- */
-
-/* nautilus-complex-search-bar.c - Search bar containing many attributes
- */
-
-#include <config.h>
-#include "nautilus-complex-search-bar.h"
-
-#include "gtkhwrapbox.h"
-#include "nautilus-search-bar-criterion-private.h"
-#include "nautilus-search-bar-criterion.h"
-#include "nautilus-window-private.h"
-#include <bonobo/bonobo-dock.h>
-#include <eel/eel-gdk-pixbuf-extensions.h>
-#include <eel/eel-gtk-extensions.h>
-#include <eel/eel-gtk-macros.h>
-#include <eel/eel-string.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <glib.h>
-#include <gtk/gtkeventbox.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkvbox.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libnautilus-private/nautilus-global-preferences.h>
-#include <libnautilus-private/nautilus-undo-signal-handlers.h>
-#include <libnautilus/nautilus-clipboard.h>
-
-struct NautilusComplexSearchBarDetails {
- GtkVBox *bar_container;
- GtkWidget *criteria_container;
-
- GtkWidget *more_options;
- GtkWidget *fewer_options;
- GtkWidget *find_them;
-
- /* For use in setting up clipboard */
- NautilusWindow *window;
-
- GSList *search_criteria;
-};
-
-static void nautilus_complex_search_bar_class_init (NautilusComplexSearchBarClass *class);
-static void nautilus_complex_search_bar_init (NautilusComplexSearchBar *bar);
-static void attach_criterion_to_search_bar (NautilusComplexSearchBar *bar,
- NautilusSearchBarCriterion *criterion,
- int position);
-static void unattach_criterion_from_search_bar (NautilusComplexSearchBar *bar,
- NautilusSearchBarCriterion *criterion);
-static void more_options_callback (GtkObject *object,
- gpointer data);
-static void fewer_options_callback (GtkObject *object,
- gpointer data);
-static GtkWidget *load_find_them_pixmap_widget (void);
-static void update_options_buttons_state (NautilusComplexSearchBar *bar);
-static void update_find_button_state (NautilusComplexSearchBar *bar);
-static void update_dynamic_buttons_state (NautilusComplexSearchBar *bar);
-static void update_criteria_choices (gpointer list_item,
- gpointer data);
-
-EEL_CLASS_BOILERPLATE (NautilusComplexSearchBar, nautilus_complex_search_bar, NAUTILUS_TYPE_SEARCH_BAR)
-
-/* called by the criterion when the user chooses
- a new criterion type */
-static void
-search_bar_criterion_type_changed_callback (GObject *old_criterion_object,
- gpointer data)
-{
- NautilusSearchBarCriterionType new_type;
- NautilusSearchBarCriterion *criterion, *new_criterion;
- GSList *old_criterion_location;
- NautilusComplexSearchBar *bar;
-
- g_return_if_fail (NAUTILUS_IS_SEARCH_BAR_CRITERION (old_criterion_object));
- g_return_if_fail (NAUTILUS_IS_COMPLEX_SEARCH_BAR (data));
-
- criterion = NAUTILUS_SEARCH_BAR_CRITERION (old_criterion_object);
- bar = NAUTILUS_COMPLEX_SEARCH_BAR (data);
-
- /* First create the new criterion with the type that was activated */
- new_type = GPOINTER_TO_INT (g_object_get_data (old_criterion_object, "type"));
- new_criterion = nautilus_search_bar_criterion_new_with_type (new_type,
- bar);
- g_signal_connect_object (new_criterion, "criterion_type_changed",
- G_CALLBACK (search_bar_criterion_type_changed_callback), bar, 0);
- old_criterion_location = g_slist_find (bar->details->search_criteria,
- criterion);
- old_criterion_location->data = new_criterion;
- unattach_criterion_from_search_bar (bar, criterion);
- gtk_object_sink (GTK_OBJECT (criterion));
- nautilus_search_bar_criterion_show (new_criterion);
- attach_criterion_to_search_bar (bar,
- new_criterion,
- g_slist_position (bar->details->search_criteria,
- old_criterion_location));
-
- /* Then tell the other criteria to take update their
- menus to reflect the other criteria you can really choose now */
- g_slist_foreach (bar->details->search_criteria,
- update_criteria_choices,
- bar);
-
- update_dynamic_buttons_state (bar);
-}
-
-
-static void
-update_criteria_choices (gpointer list_item,
- gpointer data)
-{
- NautilusSearchBarCriterion *criterion;
- NautilusComplexSearchBar *bar;
-
- g_return_if_fail (NAUTILUS_IS_SEARCH_BAR_CRITERION (list_item));
- g_return_if_fail (NAUTILUS_IS_COMPLEX_SEARCH_BAR (data));
- criterion = NAUTILUS_SEARCH_BAR_CRITERION (list_item);
- bar = NAUTILUS_COMPLEX_SEARCH_BAR (data);
-
- nautilus_search_bar_criterion_update_valid_criteria_choices (criterion,
- bar->details->search_criteria);
-
-}
-
-static void
-queue_search_bar_resize_callback (GtkObject *search_bar,
- gpointer data)
-{
- NautilusComplexSearchBar *bar;
-
- bar = NAUTILUS_COMPLEX_SEARCH_BAR (data);
- if (GTK_WIDGET_VISIBLE (search_bar)) {
- nautilus_complex_search_bar_queue_resize (bar);
- }
-}
-
-static void
-nautilus_complex_search_bar_init (NautilusComplexSearchBar *bar)
-{
- NautilusSearchBarCriterion *file_name_criterion;
- GtkWidget *hbox;
- GtkWidget *find_them_box, *find_them_pixmap_widget, *find_them_label;
-
- bar->details = g_new0 (NautilusComplexSearchBarDetails, 1);
-
- bar->details->bar_container = GTK_VBOX (gtk_vbox_new (FALSE, 1));
-
- bar->details->criteria_container = gtk_vbox_new (FALSE, 1);
-
- gtk_container_set_resize_mode (GTK_CONTAINER (bar->details->criteria_container),
- GTK_RESIZE_IMMEDIATE);
-
- /* Create button before criterion so we text fields can hook to criterion's signal */
- bar->details->find_them = gtk_button_new ();
-
- file_name_criterion = nautilus_search_bar_criterion_first_new (bar);
-
- g_signal_connect_object (file_name_criterion, "criterion_type_changed",
- G_CALLBACK (search_bar_criterion_type_changed_callback), bar, 0);
- bar->details->search_criteria = g_slist_prepend (NULL,
- file_name_criterion);
-
- nautilus_search_bar_criterion_show (file_name_criterion);
- attach_criterion_to_search_bar (bar, file_name_criterion, 1);
-
- gtk_box_pack_start (GTK_BOX (bar->details->bar_container),
- GTK_WIDGET (bar->details->criteria_container),
- TRUE,
- FALSE,
- 0);
- gtk_widget_show (GTK_WIDGET (bar->details->criteria_container));
-
- hbox = gtk_hwrap_box_new (FALSE);
-
- g_signal_connect_object (hbox, "need_reallocation",
- G_CALLBACK (queue_search_bar_resize_callback), bar, 0);
-
- bar->details->more_options = gtk_button_new_with_label (_("More Options"));
- g_signal_connect_object (bar->details->more_options, "clicked",
- G_CALLBACK (more_options_callback), bar, 0);
-
- gtk_wrap_box_pack (GTK_WRAP_BOX (hbox),
- bar->details->more_options,
- FALSE, FALSE, FALSE, FALSE);
- gtk_widget_show (bar->details->more_options);
-
- bar->details->fewer_options = gtk_button_new_with_label (_("Fewer Options"));
- g_signal_connect_object (bar->details->fewer_options, "clicked",
- G_CALLBACK (fewer_options_callback), bar, 0);
-
- gtk_wrap_box_pack (GTK_WRAP_BOX (hbox),
- bar->details->fewer_options,
- FALSE, FALSE, FALSE, FALSE);
-
- gtk_widget_show (bar->details->fewer_options);
-
- find_them_box = gtk_hbox_new (FALSE, 1);
- find_them_pixmap_widget = load_find_them_pixmap_widget ();
- if (find_them_pixmap_widget != NULL)
- gtk_box_pack_start (GTK_BOX (find_them_box),
- find_them_pixmap_widget,
- TRUE,
- FALSE,
- 1);
- find_them_label = gtk_label_new (_("Find Them!"));
- gtk_box_pack_start (GTK_BOX (find_them_box),
- find_them_label,
- TRUE,
- FALSE,
- 1);
-
- gtk_container_add (GTK_CONTAINER (bar->details->find_them), find_them_box);
- g_signal_connect_object (bar->details->find_them, "clicked",
- G_CALLBACK (nautilus_navigation_bar_location_changed),
- bar, G_CONNECT_SWAPPED);
-
- gtk_wrap_box_pack (GTK_WRAP_BOX (hbox),
- bar->details->find_them,
- FALSE, FALSE,
- FALSE, FALSE);
- gtk_widget_show (bar->details->find_them);
- gtk_box_pack_start (GTK_BOX (bar->details->bar_container),
- hbox,
- TRUE,
- FALSE,
- 0);
- gtk_widget_show (hbox);
- gtk_widget_show (GTK_WIDGET (bar->details->bar_container));
- gtk_container_add (GTK_CONTAINER (bar), GTK_WIDGET (bar->details->bar_container));
-
- update_dynamic_buttons_state (bar);
-}
-
-static void
-nautilus_complex_search_bar_destroy (GtkObject *object)
-{
- g_free (NAUTILUS_COMPLEX_SEARCH_BAR (object)->details);
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-static GtkWidget *
-get_first_text_field (NautilusComplexSearchBar *bar)
-{
- GSList *node;
- NautilusSearchBarCriterion *criterion;
-
- for (node = bar->details->search_criteria; node != NULL; node = node->next) {
- criterion = NAUTILUS_SEARCH_BAR_CRITERION (node->data);
- if (criterion->details->use_value_entry) {
- return GTK_WIDGET (criterion->details->value_entry);
- }
- }
-
- return NULL;
-}
-
-static void
-real_activate (NautilusNavigationBar *navigation_bar)
-{
- NautilusComplexSearchBar *bar;
- GtkWidget *initial_focus_widget;
-
- bar = NAUTILUS_COMPLEX_SEARCH_BAR (navigation_bar);
-
- /* Put the keyboard focus in a text field when switching to search mode */
- initial_focus_widget = get_first_text_field (bar);
- if (initial_focus_widget != NULL) {
- gtk_widget_grab_focus (initial_focus_widget);
- }
- nautilus_complex_search_bar_queue_resize (bar);
-}
-
-/* returned string should be g_freed by the caller */
-static char *
-nautilus_complex_search_bar_get_location (NautilusNavigationBar *navigation_bar)
-{
- NautilusComplexSearchBar *bar;
- char *criteria_text, *trimmed_fragment, *escaped_fragment;
- char *search_uri;
- GSList *list;
-
- bar = NAUTILUS_COMPLEX_SEARCH_BAR (navigation_bar);
-
- criteria_text = g_strdup ("[file:///]");
-
- for (list = bar->details->search_criteria; list != NULL; list = list->next) {
- char *temp_criterion, *criterion_text;
- NautilusSearchBarCriterion *criterion;
- criterion = (NautilusSearchBarCriterion *) list->data;
- criterion_text = nautilus_search_bar_criterion_get_location (criterion);
- temp_criterion = g_strconcat (criteria_text, criterion_text, " & ", NULL);
- g_free (criteria_text);
- g_free (criterion_text);
- criteria_text = temp_criterion;
- }
-
- trimmed_fragment = eel_str_strip_trailing_str (criteria_text, " & ");
- g_free (criteria_text);
-
- escaped_fragment = gnome_vfs_escape_string (trimmed_fragment);
- g_free (trimmed_fragment);
-
- search_uri = g_strconcat ("search:index-if-available", escaped_fragment, NULL);
-
- g_free (escaped_fragment);
-
- return search_uri;
-}
-
-static void
-nautilus_complex_search_bar_set_location (NautilusNavigationBar *navigation_bar,
- const char *location)
-{
- NautilusComplexSearchBar *bar;
-
- bar = NAUTILUS_COMPLEX_SEARCH_BAR (navigation_bar);
-
- /* FIXME bugzilla.gnome.org 42517: Not implemented. */
-}
-
-void
-nautilus_complex_search_bar_queue_resize (NautilusComplexSearchBar *bar)
-{
- GtkWidget *dock;
-
- gtk_widget_queue_resize (bar->details->criteria_container);
- /* FIXME bugzilla.gnome.org 43171:
- * (It is possible this comment is no longer correct due to
- * a change in the layout code)
- * We don't know why this line is needed here, but if it's removed
- * then the bar sometimes won't shrink when we press the fewer options
- * button. Specifically, if the window is very wide, then it won't
- * shrink when pressing the fewer options button, but it will if the
- * window is fairly narrow.
- */
- dock = gtk_widget_get_ancestor (GTK_WIDGET (bar), BONOBO_TYPE_DOCK);
- if (dock != NULL) {
- gtk_widget_queue_resize (dock);
- }
-}
-
-static void
-attach_criterion_to_search_bar (NautilusComplexSearchBar *bar,
- NautilusSearchBarCriterion *criterion,
- int position)
-{
- g_return_if_fail (NAUTILUS_IS_COMPLEX_SEARCH_BAR (bar));
-
- gtk_box_pack_start (GTK_BOX (bar->details->criteria_container),
- GTK_WIDGET (criterion->details->box),
- FALSE,
- FALSE,
- 1);
- gtk_box_reorder_child (GTK_BOX (bar->details->criteria_container),
- GTK_WIDGET (criterion->details->box),
- position);
-
- g_assert (criterion->details->use_value_entry +
- criterion->details->use_value_menu == 1 ||
- criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION);
-
- if (criterion->details->use_value_entry) {
- /* We want to track whether the entry text is empty or not. */
- g_signal_connect_object (criterion->details->value_entry, "changed",
- G_CALLBACK (update_find_button_state), bar, G_CONNECT_SWAPPED);
-
- /* We want to activate the "Find" button when any entry text is not empty */
- g_assert (GTK_IS_BUTTON (bar->details->find_them));
- g_signal_connect_object (criterion->details->value_entry, "activate",
- G_CALLBACK (gtk_widget_activate),
- bar->details->find_them, G_CONNECT_SWAPPED);
- }
- nautilus_complex_search_bar_queue_resize (bar);
-}
-
-static void
-unattach_criterion_from_search_bar (NautilusComplexSearchBar *bar,
- NautilusSearchBarCriterion *criterion)
-{
-
- gtk_container_remove (GTK_CONTAINER (bar->details->criteria_container),
- GTK_WIDGET (criterion->details->box));
-
- g_assert ((criterion->details->use_value_entry +
- criterion->details->use_value_menu == 1) ||
- criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION);
- nautilus_complex_search_bar_queue_resize (bar);
-}
-
-static GtkWidget *
-load_find_them_pixmap_widget (void)
-{
- return gtk_image_new_from_file (NAUTILUS_PIXMAPDIR "/search.png");
-}
-
-
-GtkWidget *
-nautilus_complex_search_bar_new (NautilusWindow *window)
-{
- GtkWidget *bar;
- NautilusSearchBarCriterion *first_criterion;
-
- g_return_val_if_fail (NAUTILUS_IS_WINDOW (window), NULL);
-
- bar = gtk_widget_new (NAUTILUS_TYPE_COMPLEX_SEARCH_BAR, NULL);
- g_object_set_data (G_OBJECT (bar), "associated_window", window);
-
- /* Set up the first criterion's entry for the clipboard */
- first_criterion = NAUTILUS_COMPLEX_SEARCH_BAR (bar)->details->search_criteria->data;
- g_assert (first_criterion != NULL);
- g_assert (first_criterion->details->use_value_entry);
-
- nautilus_clipboard_set_up_editable
- (GTK_EDITABLE (first_criterion->details->value_entry),
- nautilus_window_get_ui_container (window),
- TRUE);
-
- return bar;
-}
-
-void
-nautilus_complex_search_bar_set_up_enclosed_entry_for_clipboard (NautilusComplexSearchBar *bar,
- NautilusEntry *entry)
-{
- NautilusWindow *associated_window;
-
- associated_window = g_object_get_data (G_OBJECT (bar),
- "associated_window");
-
- g_assert (associated_window != NULL);
- nautilus_clipboard_set_up_editable (GTK_EDITABLE (entry),
- nautilus_window_get_ui_container (associated_window),
- TRUE);
-}
-
-static void
-more_options_callback (GtkObject *object,
- gpointer data)
-{
- NautilusSearchBarCriterion *criterion, *last_criterion;
- NautilusComplexSearchBar *bar;
- GSList *list;
-
- g_return_if_fail (GTK_IS_BUTTON (object));
- g_return_if_fail (NAUTILUS_IS_COMPLEX_SEARCH_BAR (data));
-
- bar = NAUTILUS_COMPLEX_SEARCH_BAR (data);
-
- list = bar->details->search_criteria;
- last_criterion = (NautilusSearchBarCriterion *)((g_slist_last (list))->data);
- criterion = nautilus_search_bar_criterion_next_new (last_criterion->details->type,
- bar);
- g_signal_connect_object (criterion, "criterion_type_changed",
- G_CALLBACK (search_bar_criterion_type_changed_callback), bar, 0);
- bar->details->search_criteria = g_slist_append (list, criterion);
-
- nautilus_search_bar_criterion_show (criterion);
- attach_criterion_to_search_bar (bar, criterion,
- g_slist_length (bar->details->search_criteria));
-
- update_dynamic_buttons_state (bar);
- g_slist_foreach (bar->details->search_criteria,
- update_criteria_choices,
- bar);
-}
-
-
-static void
-fewer_options_callback (GtkObject *object,
- gpointer data)
-{
- NautilusSearchBarCriterion *criterion;
- NautilusComplexSearchBar *bar;
- GSList *last;
- int old_length, new_length;
-
- g_return_if_fail (GTK_IS_BUTTON (object));
- g_return_if_fail (NAUTILUS_IS_COMPLEX_SEARCH_BAR (data));
-
- bar = NAUTILUS_COMPLEX_SEARCH_BAR (data);
-
- old_length = g_slist_length (bar->details->search_criteria);
- if (old_length == 1) {
- return;
- }
-
- last = g_slist_last (bar->details->search_criteria);
- criterion = (NautilusSearchBarCriterion *) last->data;
- unattach_criterion_from_search_bar (bar, criterion);
- bar->details->search_criteria = g_slist_remove (bar->details->search_criteria,
- criterion);
-
- /* Assert that the old criteria got removed from the criteria list */
- new_length = g_slist_length (bar->details->search_criteria);
- g_assert (new_length + 1 == old_length);
-
- update_dynamic_buttons_state (bar);
- g_slist_foreach (bar->details->search_criteria,
- update_criteria_choices,
- bar);
-
-}
-
-static void
-update_options_buttons_state (NautilusComplexSearchBar *bar)
-{
- /* "Fewer Options" is enabled unless there's only one criterion */
- gtk_widget_set_sensitive (GTK_WIDGET (bar->details->fewer_options), g_slist_length (bar->details->search_criteria) > 1);
- gtk_widget_set_sensitive (GTK_WIDGET (bar->details->more_options), g_slist_length (bar->details->search_criteria) < NAUTILUS_NUMBER_OF_SEARCH_CRITERIA);
-
-}
-
-static gboolean
-criteria_invalid (NautilusComplexSearchBar *bar)
-{
- GSList *node;
- NautilusSearchBarCriterion *criterion;
- char *text;
- gboolean text_is_empty;
- int size;
-
- g_assert (NAUTILUS_IS_COMPLEX_SEARCH_BAR (bar));
-
- /* Walk through all value fields, checking whether any of them are empty. */
- /* Also check the value of the size entry, if it's open to make sure
- it's actually a valid number */
- for (node = bar->details->search_criteria; node != NULL; node = node->next) {
- criterion = NAUTILUS_SEARCH_BAR_CRITERION (node->data);
- if (criterion->details->use_value_entry) {
- text = gtk_editable_get_chars
- (GTK_EDITABLE (criterion->details->value_entry),
- 0, -1);
- text_is_empty = eel_str_is_empty (text);
- if (criterion->details->type == NAUTILUS_SIZE_SEARCH_CRITERION) {
- if (!eel_str_to_int (text, &size)) {
- g_free (text);
- return TRUE;
- }
- }
-
- g_free (text);
- if (text_is_empty) {
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-
-static void
-update_find_button_state (NautilusComplexSearchBar *bar)
-{
- /* "Find" button is enabled only if the criteria are valid. */
- gtk_widget_set_sensitive (GTK_WIDGET (bar->details->find_them), !criteria_invalid (bar));
-}
-
-static void
-update_dynamic_buttons_state (NautilusComplexSearchBar *bar)
-{
- update_options_buttons_state (bar);
- update_find_button_state (bar);
-}
-
-
-GSList *
-nautilus_complex_search_bar_get_search_criteria (NautilusComplexSearchBar *bar)
-{
- return bar->details->search_criteria;
-}
-
-static void
-nautilus_complex_search_bar_class_init (NautilusComplexSearchBarClass *klass)
-{
- GtkObjectClass *object_class;
- NautilusNavigationBarClass *navigation_bar_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
- object_class->destroy = nautilus_complex_search_bar_destroy;
-
- navigation_bar_class = NAUTILUS_NAVIGATION_BAR_CLASS (klass);
- navigation_bar_class->activate = real_activate;
- navigation_bar_class->get_location = nautilus_complex_search_bar_get_location;
- navigation_bar_class->set_location = nautilus_complex_search_bar_set_location;
-
-}
diff --git a/src/nautilus-complex-search-bar.h b/src/nautilus-complex-search-bar.h
deleted file mode 100644
index 01bcbaf37..000000000
--- a/src/nautilus-complex-search-bar.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Rebecca Schulman <rebecka@eazel.com>
- */
-
-/* nautilus-complex-search-bar.h - Search object
- *containing multiple choosable attributes
- */
-
-#ifndef NAUTILUS_COMPLEX_SEARCH_BAR_H
-#define NAUTILUS_COMPLEX_SEARCH_BAR_H
-
-#include <libnautilus-private/nautilus-entry.h>
-
-#include "nautilus-search-bar.h"
-#include "nautilus-window.h"
-
-#define NAUTILUS_TYPE_COMPLEX_SEARCH_BAR (nautilus_complex_search_bar_get_type ())
-#define NAUTILUS_COMPLEX_SEARCH_BAR(obj) \
- GTK_CHECK_CAST (obj, NAUTILUS_TYPE_COMPLEX_SEARCH_BAR, NautilusComplexSearchBar)
-#define NAUTILUS_COMPLEX_SEARCH_BAR_CLASS(klass) \
- GTK_CHECK_CLASS_CAST (klass, NAUTILUS_TYPE_COMPLEX_SEARCH_BAR, NautilusComplexSearchBarClass)
-#define NAUTILUS_IS_COMPLEX_SEARCH_BAR(obj) \
- GTK_CHECK_TYPE (obj, NAUTILUS_TYPE_COMPLEX_SEARCH_BAR)
-
-typedef struct NautilusComplexSearchBarDetails NautilusComplexSearchBarDetails;
-
-typedef struct {
- NautilusSearchBar parent_slot;
- NautilusComplexSearchBarDetails *details;
-} NautilusComplexSearchBar;
-
-typedef struct {
- NautilusSearchBarClass parent_slot;
-} NautilusComplexSearchBarClass;
-
-GType nautilus_complex_search_bar_get_type (void);
-GtkWidget *nautilus_complex_search_bar_new (NautilusWindow *window);
-
-GSList * nautilus_complex_search_bar_get_search_criteria (NautilusComplexSearchBar *bar);
-void nautilus_complex_search_bar_queue_resize (NautilusComplexSearchBar *bar);
-void nautilus_complex_search_bar_set_up_enclosed_entry_for_clipboard (NautilusComplexSearchBar *bar,
- NautilusEntry *entry);
-#endif /* NAUTILUS_COMPLEX_SEARCH_BAR_H */
-
diff --git a/src/nautilus-component-adapter-factory.c b/src/nautilus-component-adapter-factory.c
deleted file mode 100644
index 7cef35d19..000000000
--- a/src/nautilus-component-adapter-factory.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* nautilus-component-adapter-factory.c - client wrapper for the
- * special adapter component, which wraps Bonobo components as
- * Nautilus Views and in the process keeps evil synchronous I/O out of
- * the Nautilus process itself.
- */
-
-#include <config.h>
-#include "nautilus-component-adapter-factory.h"
-
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-moniker-util.h>
-#include <bonobo/bonobo-object.h>
-#include <eel/eel-debug.h>
-#include <libgnome/gnome-macros.h>
-#include <libnautilus-adapter/nautilus-adapter-factory.h>
-
-#define NAUTILUS_COMPONENT_ADAPTER_FACTORY_IID "OAFIID:Nautilus_Adapter_Factory"
-
-struct NautilusComponentAdapterFactoryDetails {
- Nautilus_ComponentAdapterFactory corba_factory;
-};
-
-static NautilusComponentAdapterFactory *global_component_adapter_factory = NULL;
-
-GNOME_CLASS_BOILERPLATE (NautilusComponentAdapterFactory, nautilus_component_adapter_factory,
- GtkObject, GTK_TYPE_OBJECT)
-
-static void
-activate_factory (NautilusComponentAdapterFactory *factory)
-{
- factory->details->corba_factory = bonobo_get_object
- (NAUTILUS_COMPONENT_ADAPTER_FACTORY_IID,
- "IDL:Nautilus/ComponentAdapterFactory:1.0", NULL);
-}
-
-static void
-unref_factory (NautilusComponentAdapterFactory *factory)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- Bonobo_Unknown_unref (factory->details->corba_factory, &ev);
- CORBA_exception_free (&ev);
-}
-
-static void
-release_factory (NautilusComponentAdapterFactory *factory)
-{
- CORBA_Object_release (factory->details->corba_factory, NULL);
- factory->details->corba_factory = CORBA_OBJECT_NIL;
-}
-
-static Nautilus_ComponentAdapterFactory
-get_corba_factory (NautilusComponentAdapterFactory *factory)
-{
- CORBA_Environment ev;
- Nautilus_ComponentAdapterFactory result;
- gboolean need_unref;
-
- CORBA_exception_init (&ev);
-
- need_unref = FALSE;
- if (CORBA_Object_is_nil (factory->details->corba_factory, &ev)
- || BONOBO_EX (&ev)
- || CORBA_Object_non_existent (factory->details->corba_factory, &ev)
- || BONOBO_EX (&ev)) {
- release_factory (factory);
- activate_factory (factory);
- need_unref = TRUE;
- }
-
- CORBA_exception_free (&ev);
-
- result = bonobo_object_dup_ref (factory->details->corba_factory, NULL);
-
- if (need_unref) {
- unref_factory (factory);
- }
-
- return result;
-}
-
-static void
-nautilus_component_adapter_factory_instance_init (NautilusComponentAdapterFactory *factory)
-{
- factory->details = g_new0 (NautilusComponentAdapterFactoryDetails, 1);
-}
-
-static void
-nautilus_component_adapter_factory_destroy (GtkObject *object)
-{
- NautilusComponentAdapterFactory *factory;
-
- factory = NAUTILUS_COMPONENT_ADAPTER_FACTORY (object);
-
- release_factory (factory);
- g_free (factory->details);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static void
-nautilus_component_adapter_factory_class_init (NautilusComponentAdapterFactoryClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) klass;
- object_class->destroy = nautilus_component_adapter_factory_destroy;
-}
-
-static void
-component_adapter_factory_at_exit_destructor (void)
-{
- if (global_component_adapter_factory != NULL) {
- g_object_unref (global_component_adapter_factory);
- }
-}
-
-NautilusComponentAdapterFactory *
-nautilus_component_adapter_factory_get (void)
-{
- NautilusComponentAdapterFactory *factory;
-
- if (global_component_adapter_factory == NULL) {
- factory = NAUTILUS_COMPONENT_ADAPTER_FACTORY
- (g_object_new (NAUTILUS_TYPE_COMPONENT_ADAPTER_FACTORY, NULL));
-
- g_object_ref (factory);
- gtk_object_sink (GTK_OBJECT (factory));
-
- global_component_adapter_factory = factory;
- eel_debug_call_at_shutdown (component_adapter_factory_at_exit_destructor);
- }
-
- return global_component_adapter_factory;
-}
-
-Nautilus_View
-nautilus_component_adapter_factory_create_adapter (NautilusComponentAdapterFactory *factory,
- Bonobo_Unknown component)
-{
- Nautilus_View nautilus_view;
- Bonobo_Control bonobo_control;
- Nautilus_ComponentAdapterFactory corba_factory;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- nautilus_view = Bonobo_Unknown_queryInterface
- (component, "IDL:Nautilus/View:1.0", &ev);
- if (BONOBO_EX (&ev)) {
- nautilus_view = CORBA_OBJECT_NIL;
- }
-
- if (nautilus_view != CORBA_OBJECT_NIL) {
- /* Object has the View interface, great! We might not
- * need to adapt it.
- */
- bonobo_control = Bonobo_Unknown_queryInterface
- (component, "IDL:Bonobo/Control:1.0", &ev);
- if (BONOBO_EX (&ev)) {
- bonobo_control = CORBA_OBJECT_NIL;
- }
- if (bonobo_control != CORBA_OBJECT_NIL) {
- /* It has the control interface too, so all is peachy. */
- bonobo_object_release_unref (bonobo_control, NULL);
- } else {
- /* No control interface; we have no way to
- * support a View that doesn't also support
- * the Control interface, so fail.
- */
- bonobo_object_release_unref (nautilus_view, NULL);
- nautilus_view = CORBA_OBJECT_NIL;
- }
- } else {
- /* No View interface, we must adapt the object */
- corba_factory = get_corba_factory (factory);
- nautilus_view = Nautilus_ComponentAdapterFactory_create_adapter
- (corba_factory, component, &ev);
- if (BONOBO_EX (&ev)) {
- nautilus_view = CORBA_OBJECT_NIL;
- }
- bonobo_object_release_unref (corba_factory, NULL);
- }
-
- CORBA_exception_free (&ev);
-
- return nautilus_view;
-}
diff --git a/src/nautilus-component-adapter-factory.h b/src/nautilus-component-adapter-factory.h
deleted file mode 100644
index 0931ac511..000000000
--- a/src/nautilus-component-adapter-factory.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* nautilus-component-adapter-factory.h - client wrapper for the
- * special adapter component, which wraps Bonobo components as
- * Nautilus Views and in the process keeps evil syncrhonous I/O out of
- * the Nautilus process itself.
- */
-
-#ifndef NAUTILUS_COMPONENT_ADAPTER_FACTORY_H
-#define NAUTILUS_COMPONENT_ADAPTER_FACTORY_H
-
-#include <gtk/gtkobject.h>
-#include <libnautilus/nautilus-view-component.h>
-
-typedef struct NautilusComponentAdapterFactory NautilusComponentAdapterFactory;
-typedef struct NautilusComponentAdapterFactoryClass NautilusComponentAdapterFactoryClass;
-
-typedef struct NautilusComponentAdapterFactoryDetails NautilusComponentAdapterFactoryDetails;
-
-#define NAUTILUS_TYPE_COMPONENT_ADAPTER_FACTORY \
- (nautilus_component_adapter_factory_get_type ())
-#define NAUTILUS_COMPONENT_ADAPTER_FACTORY(obj) \
- (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_COMPONENT_ADAPTER_FACTORY, NautilusComponentAdapterFactory))
-#define NAUTILUS_COMPONENT_ADAPTER_FACTORY_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_COMPONENT_ADAPTER_FACTORY, NautilusComponentAdapterFactoryClass))
-#define NAUTILUS_IS_COMPONENT_ADAPTER_FACTORY(obj) \
- (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_COMPONENT_ADAPTER_FACTORY))
-#define NAUTILUS_IS_COMPONENT_ADAPTER_FACTORY_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_COMPONENT_ADAPTER_FACTORY))
-
-struct NautilusComponentAdapterFactory
-{
- GtkObject object;
- NautilusComponentAdapterFactoryDetails *details;
-};
-
-struct NautilusComponentAdapterFactoryClass
-{
- GtkObjectClass parent_class;
-};
-
-GType nautilus_component_adapter_factory_get_type (void);
-NautilusComponentAdapterFactory *nautilus_component_adapter_factory_get (void);
-Nautilus_View nautilus_component_adapter_factory_create_adapter (NautilusComponentAdapterFactory *factory,
- Bonobo_Unknown component);
-
-#endif /* NAUTILUS_COMPONENT_ADAPTER_FACTORY_H */
diff --git a/src/nautilus-desktop-window.c b/src/nautilus-desktop-window.c
index 9d921ceed..e340b15f0 100644
--- a/src/nautilus-desktop-window.c
+++ b/src/nautilus-desktop-window.c
@@ -34,10 +34,6 @@
#include <libgnome/gnome-macros.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libnautilus-private/nautilus-file-utilities.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
-
-#define STATUS_BAR_PATH "/status"
-#define MENU_BAR_PATH "/menu"
struct NautilusDesktopWindowDetails {
int dummy;
@@ -63,6 +59,9 @@ nautilus_desktop_window_instance_init (NautilusDesktopWindow *window)
g_object_set_data (G_OBJECT (window), "is_desktop_window",
GINT_TO_POINTER (1));
+
+ gtk_widget_hide (NAUTILUS_WINDOW (window)->details->statusbar);
+ gtk_widget_hide (NAUTILUS_WINDOW (window)->details->menubar);
}
static gint
@@ -109,7 +108,6 @@ nautilus_desktop_window_new (NautilusApplication *application,
window = NAUTILUS_DESKTOP_WINDOW
(gtk_widget_new (nautilus_desktop_window_get_type(),
"app", application,
- "app_id", "nautilus",
"width_request", width_request,
"height_request", height_request,
"screen", screen,
@@ -360,17 +358,6 @@ real_get_title (NautilusWindow *window)
}
static void
-real_merge_menus (NautilusWindow *window)
-{
- EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS, merge_menus, (window));
-
- nautilus_bonobo_set_hidden (window->details->shell_ui,
- STATUS_BAR_PATH, TRUE);
- nautilus_bonobo_set_hidden (window->details->shell_ui,
- MENU_BAR_PATH, TRUE);
-}
-
-static void
nautilus_desktop_window_class_init (NautilusDesktopWindowClass *class)
{
G_OBJECT_CLASS (class)->finalize = finalize;
@@ -380,12 +367,10 @@ nautilus_desktop_window_class_init (NautilusDesktopWindowClass *class)
GTK_WIDGET_CLASS (class)->map = map;
- NAUTILUS_WINDOW_CLASS (class)->window_type = Nautilus_WINDOW_DESKTOP;
+ NAUTILUS_WINDOW_CLASS (class)->window_type = NAUTILUS_WINDOW_DESKTOP;
NAUTILUS_WINDOW_CLASS (class)->add_current_location_to_history_list
= real_add_current_location_to_history_list;
- NAUTILUS_WINDOW_CLASS (class)->merge_menus
- = real_merge_menus;
NAUTILUS_WINDOW_CLASS (class)->get_title
= real_get_title;
}
diff --git a/components/emblem/nautilus-emblem-view.c b/src/nautilus-emblem-sidebar.c
index e572677a7..ec6179030 100644
--- a/components/emblem/nautilus-emblem-view.c
+++ b/src/nautilus-emblem-sidebar.c
@@ -4,6 +4,7 @@
* Nautilus
*
* Copyright (C) 1999, 2000, 2001 Eazel, Inc.
+ * Copyright (C) 2001 Red Hat, Inc.
*
* Nautilus is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,7 +20,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: James Willcox <jwillcox@gnome.org>
+ * Authors: James Willcox <jwillcox@gnome.org>
+ * Alexander Larsson <alexl@redhat.com>
*
* This is a sidebar displaying emblems which can be dragged onto files to
* set/unset the chosen emblem.
@@ -27,7 +29,8 @@
*/
#include <config.h>
-#include "nautilus-emblem-view.h"
+#include "nautilus-emblem-sidebar.h"
+#include "nautilus-signaller.h"
#include <stdio.h>
#include <eel/eel-gtk-macros.h>
@@ -63,8 +66,11 @@
#include <libnautilus-private/nautilus-icon-dnd.h>
#include <libnautilus-private/nautilus-emblem-utils.h>
#include <libnautilus-private/nautilus-file-utilities.h>
+#include <libnautilus-private/nautilus-sidebar-provider.h>
+#include <libnautilus-private/nautilus-module.h>
-struct NautilusEmblemViewDetails {
+struct NautilusEmblemSidebarDetails {
+ NautilusWindowInfo *window;
GConfClient *client;
GtkWidget *emblems_table;
GtkWidget *popup;
@@ -80,11 +86,13 @@ struct NautilusEmblemViewDetails {
#define STANDARD_EMBLEM_HEIGHT 52
#define EMBLEM_LABEL_SPACING 2
-static void nautilus_emblem_view_class_init (NautilusEmblemViewClass *object_klass);
-static void nautilus_emblem_view_instance_init (NautilusEmblemView *object);
-static void nautilus_emblem_view_finalize (GObject *object);
-static void nautilus_emblem_view_populate (NautilusEmblemView *emblem_view);
-static void nautilus_emblem_view_refresh (NautilusEmblemView *emblem_view);
+static void nautilus_emblem_sidebar_iface_init (NautilusSidebarIface *iface);
+static void nautilus_emblem_sidebar_finalize (GObject *object);
+static void nautilus_emblem_sidebar_populate (NautilusEmblemSidebar *emblem_sidebar);
+static void nautilus_emblem_sidebar_refresh (NautilusEmblemSidebar *emblem_sidebar);
+static void nautilus_emblem_sidebar_iface_init (NautilusSidebarIface *iface);
+static void sidebar_provider_iface_init (NautilusSidebarProviderIface *iface);
+static GType nautilus_emblem_sidebar_provider_get_type (void);
static GtkTargetEntry drag_types[] = {
{"property/keyword", 0, 0 }
@@ -109,16 +117,32 @@ typedef struct _Emblem {
char *keyword;
} Emblem;
-BONOBO_CLASS_BOILERPLATE (NautilusEmblemView, nautilus_emblem_view,
- NautilusView, NAUTILUS_TYPE_VIEW)
+typedef struct {
+ GObject parent;
+} NautilusEmblemSidebarProvider;
+
+typedef struct {
+ GObjectClass parent;
+} NautilusEmblemSidebarProviderClass;
+
+
+
+
+G_DEFINE_TYPE_WITH_CODE (NautilusEmblemSidebar, nautilus_emblem_sidebar, GTK_TYPE_VBOX,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_SIDEBAR,
+ nautilus_emblem_sidebar_iface_init));
+
+G_DEFINE_TYPE_WITH_CODE (NautilusEmblemSidebarProvider, nautilus_emblem_sidebar_provider, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_SIDEBAR_PROVIDER,
+ sidebar_provider_iface_init));
static void
-nautilus_emblem_view_drag_data_get_cb (GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *data,
- guint info,
- guint time,
- NautilusEmblemView *emblem_view)
+nautilus_emblem_sidebar_drag_data_get_cb (GtkWidget *widget,
+ GdkDragContext *context,
+ GtkSelectionData *data,
+ guint info,
+ guint time,
+ NautilusEmblemSidebar *emblem_sidebar)
{
char *keyword;
@@ -132,8 +156,8 @@ nautilus_emblem_view_drag_data_get_cb (GtkWidget *widget,
}
static void
-nautilus_emblem_view_enter_notify_cb (GtkWidget *widget,
- NautilusEmblemView *emblem_view)
+nautilus_emblem_sidebar_enter_notify_cb (GtkWidget *widget,
+ NautilusEmblemSidebar *emblem_sidebar)
{
GdkPixbuf *pixbuf;
EelLabeledImage *image;
@@ -145,8 +169,8 @@ nautilus_emblem_view_enter_notify_cb (GtkWidget *widget,
}
static void
-nautilus_emblem_view_leave_notify_cb (GtkWidget *widget,
- NautilusEmblemView *emblem_view)
+nautilus_emblem_sidebar_leave_notify_cb (GtkWidget *widget,
+ NautilusEmblemSidebar *emblem_sidebar)
{
GdkPixbuf *pixbuf;
EelLabeledImage *image;
@@ -158,9 +182,9 @@ nautilus_emblem_view_leave_notify_cb (GtkWidget *widget,
}
static gboolean
-nautilus_emblem_view_button_press_cb (GtkWidget *widget,
- GdkEventButton *event,
- NautilusEmblemView *emblem_view)
+nautilus_emblem_sidebar_button_press_cb (GtkWidget *widget,
+ GdkEventButton *event,
+ NautilusEmblemSidebar *emblem_sidebar)
{
char *keyword, *name;
GdkPixbuf *pixbuf;
@@ -173,17 +197,17 @@ nautilus_emblem_view_button_press_cb (GtkWidget *widget,
pixbuf = g_object_get_data (G_OBJECT (widget),
"original-pixbuf");
- emblem_view->details->popup_emblem_keyword = keyword;
- emblem_view->details->popup_emblem_display_name = name;
- emblem_view->details->popup_emblem_pixbuf = pixbuf;
+ emblem_sidebar->details->popup_emblem_keyword = keyword;
+ emblem_sidebar->details->popup_emblem_display_name = name;
+ emblem_sidebar->details->popup_emblem_pixbuf = pixbuf;
- gtk_widget_set_sensitive (emblem_view->details->popup_remove,
+ gtk_widget_set_sensitive (emblem_sidebar->details->popup_remove,
nautilus_emblem_can_remove_emblem (keyword));
- gtk_widget_set_sensitive (emblem_view->details->popup_rename,
+ gtk_widget_set_sensitive (emblem_sidebar->details->popup_rename,
nautilus_emblem_can_rename_emblem (keyword));
- gnome_popup_menu_do_popup_modal (emblem_view->details->popup,
+ gnome_popup_menu_do_popup_modal (emblem_sidebar->details->popup,
NULL, NULL, event, NULL,
widget);
}
@@ -192,15 +216,29 @@ nautilus_emblem_view_button_press_cb (GtkWidget *widget,
}
static void
-nautilus_emblem_view_delete_cb (GtkWidget *menu_item,
- NautilusEmblemView *emblem_view)
+send_emblems_changed (void)
+{
+ g_signal_emit_by_name (nautilus_signaller_get_current (),
+ "emblems_changed");
+}
+
+static void
+emblems_changed_callback (GObject *signaller,
+ NautilusEmblemSidebar *emblem_sidebar)
+{
+ nautilus_emblem_sidebar_refresh (emblem_sidebar);
+}
+
+static void
+nautilus_emblem_sidebar_delete_cb (GtkWidget *menu_item,
+ NautilusEmblemSidebar *emblem_sidebar)
{
char *error;
- if (nautilus_emblem_remove_emblem (emblem_view->details->popup_emblem_keyword)) {
- nautilus_emblem_view_refresh (emblem_view);
+ if (nautilus_emblem_remove_emblem (emblem_sidebar->details->popup_emblem_keyword)) {
+ send_emblems_changed ();
} else {
- error = g_strdup_printf (_("Couldn't remove emblem with name '%s'."), emblem_view->details->popup_emblem_display_name);
+ error = g_strdup_printf (_("Couldn't remove emblem with name '%s'."), emblem_sidebar->details->popup_emblem_display_name);
eel_show_error_dialog (error, _("This is probably because the emblem is a permanent one, and not one you added yourself."),
_("Couldn't Remove Emblem"),
NULL);
@@ -210,7 +248,7 @@ nautilus_emblem_view_delete_cb (GtkWidget *menu_item,
static void
rename_dialog_response_cb (GtkWidget *dialog, int response,
- NautilusEmblemView *emblem_view)
+ NautilusEmblemSidebar *emblem_sidebar)
{
GtkWidget *entry;
char *keyword, *name, *error;
@@ -225,7 +263,6 @@ rename_dialog_response_cb (GtkWidget *dialog, int response,
g_message ("Implement me!");
return;
}
-
entry = g_object_get_data (G_OBJECT (dialog), "entry");
@@ -234,7 +271,7 @@ rename_dialog_response_cb (GtkWidget *dialog, int response,
gtk_widget_destroy (dialog);
if (nautilus_emblem_rename_emblem (keyword, name)) {
- nautilus_emblem_view_refresh (emblem_view);
+ send_emblems_changed ();
} else {
error = g_strdup_printf (_("Couldn't rename emblem with name '%s'."), name);
eel_show_error_dialog (error, _("This is probably because the emblem is a permanent one, and not one that you added yourself."),
@@ -248,7 +285,7 @@ rename_dialog_response_cb (GtkWidget *dialog, int response,
}
static GtkWidget *
-create_rename_emblem_dialog (NautilusEmblemView *emblem_view,
+create_rename_emblem_dialog (NautilusEmblemSidebar *emblem_sidebar,
const char *keyword, const char *orig_name,
GdkPixbuf *pixbuf)
{
@@ -304,23 +341,23 @@ create_rename_emblem_dialog (NautilusEmblemView *emblem_view,
}
static void
-nautilus_emblem_view_rename_cb (GtkWidget *menu_item,
- NautilusEmblemView *emblem_view)
+nautilus_emblem_sidebar_rename_cb (GtkWidget *menu_item,
+ NautilusEmblemSidebar *emblem_sidebar)
{
GtkWidget *dialog;
- dialog = create_rename_emblem_dialog (emblem_view,
- emblem_view->details->popup_emblem_keyword,
- emblem_view->details->popup_emblem_display_name,
- emblem_view->details->popup_emblem_pixbuf);
+ dialog = create_rename_emblem_dialog (emblem_sidebar,
+ emblem_sidebar->details->popup_emblem_keyword,
+ emblem_sidebar->details->popup_emblem_display_name,
+ emblem_sidebar->details->popup_emblem_pixbuf);
g_signal_connect (dialog, "response",
G_CALLBACK (rename_dialog_response_cb),
- emblem_view);
+ emblem_sidebar);
gtk_widget_show (dialog);
}
static void
-create_popup_menu (NautilusEmblemView *emblem_view)
+create_popup_menu (NautilusEmblemSidebar *emblem_sidebar)
{
GtkWidget *popup, *menu_item, *menu_image;
@@ -335,27 +372,27 @@ create_popup_menu (NautilusEmblemView *emblem_view)
menu_image);
g_signal_connect (menu_item, "activate",
- G_CALLBACK (nautilus_emblem_view_rename_cb),
- emblem_view);
+ G_CALLBACK (nautilus_emblem_sidebar_rename_cb),
+ emblem_sidebar);
gtk_widget_show (menu_item);
gtk_menu_shell_append (GTK_MENU_SHELL (popup), menu_item);
- emblem_view->details->popup_rename = menu_item;
+ emblem_sidebar->details->popup_rename = menu_item;
/* add "delete" menu item */
menu_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_DELETE,
NULL);
g_signal_connect (menu_item, "activate",
- G_CALLBACK (nautilus_emblem_view_delete_cb),
- emblem_view);
+ G_CALLBACK (nautilus_emblem_sidebar_delete_cb),
+ emblem_sidebar);
gtk_widget_show (menu_item);
gtk_menu_shell_append (GTK_MENU_SHELL (popup), menu_item);
- emblem_view->details->popup_remove = menu_item;
+ emblem_sidebar->details->popup_remove = menu_item;
- emblem_view->details->popup = popup;
+ emblem_sidebar->details->popup = popup;
}
static GtkWidget *
-create_emblem_widget_with_pixbuf (NautilusEmblemView *emblem_view,
+create_emblem_widget_with_pixbuf (NautilusEmblemSidebar *emblem_sidebar,
const char *keyword,
const char *display_name,
GdkPixbuf *pixbuf)
@@ -385,17 +422,17 @@ create_emblem_widget_with_pixbuf (NautilusEmblemView *emblem_view,
g_signal_connect (event_box, "button_press_event",
- G_CALLBACK (nautilus_emblem_view_button_press_cb),
- emblem_view);
+ G_CALLBACK (nautilus_emblem_sidebar_button_press_cb),
+ emblem_sidebar);
g_signal_connect (event_box, "drag-data-get",
- G_CALLBACK (nautilus_emblem_view_drag_data_get_cb),
- emblem_view);
+ G_CALLBACK (nautilus_emblem_sidebar_drag_data_get_cb),
+ emblem_sidebar);
g_signal_connect (event_box, "enter-notify-event",
- G_CALLBACK (nautilus_emblem_view_enter_notify_cb),
- emblem_view);
+ G_CALLBACK (nautilus_emblem_sidebar_enter_notify_cb),
+ emblem_sidebar);
g_signal_connect (event_box, "leave-notify-event",
- G_CALLBACK (nautilus_emblem_view_leave_notify_cb),
- emblem_view);
+ G_CALLBACK (nautilus_emblem_sidebar_leave_notify_cb),
+ emblem_sidebar);
g_object_set_data_full (G_OBJECT (event_box),
"emblem-keyword",
@@ -417,7 +454,7 @@ create_emblem_widget_with_pixbuf (NautilusEmblemView *emblem_view,
}
static GtkWidget *
-create_emblem_widget (NautilusEmblemView *emblem_view,
+create_emblem_widget (NautilusEmblemSidebar *emblem_sidebar,
const char *name)
{
GtkWidget *ret;
@@ -433,7 +470,7 @@ create_emblem_widget (NautilusEmblemView *emblem_view,
display_name = g_strdup (keyword);
}
- ret = create_emblem_widget_with_pixbuf (emblem_view, keyword,
+ ret = create_emblem_widget_with_pixbuf (emblem_sidebar, keyword,
display_name, pixbuf);
g_free (keyword);
g_free (display_name);
@@ -491,7 +528,7 @@ destroy_emblem_list (GSList *list)
}
static GtkWidget *
-create_add_emblems_dialog (NautilusEmblemView *emblem_view,
+create_add_emblems_dialog (NautilusEmblemSidebar *emblem_sidebar,
GSList *emblems)
{
GtkWidget *dialog, *label, *table, *image;
@@ -589,20 +626,20 @@ remove_widget (GtkWidget *widget, GtkContainer *container)
}
static void
-nautilus_emblem_view_refresh (NautilusEmblemView *emblem_view)
+nautilus_emblem_sidebar_refresh (NautilusEmblemSidebar *emblem_sidebar)
{
nautilus_emblem_refresh_list ();
- gtk_container_foreach (GTK_CONTAINER (emblem_view->details->emblems_table),
+ gtk_container_foreach (GTK_CONTAINER (emblem_sidebar->details->emblems_table),
(GtkCallback)remove_widget,
- emblem_view->details->emblems_table);
+ emblem_sidebar->details->emblems_table);
- nautilus_emblem_view_populate (emblem_view);
+ nautilus_emblem_sidebar_populate (emblem_sidebar);
}
static void
add_emblems_dialog_response_cb (GtkWidget *dialog, int response,
- NautilusEmblemView *emblem_view)
+ NautilusEmblemSidebar *emblem_sidebar)
{
Emblem *emblem;
GSList *emblems;
@@ -652,20 +689,20 @@ add_emblems_dialog_response_cb (GtkWidget *dialog, int response,
gtk_widget_destroy (dialog);
- nautilus_emblem_view_refresh (emblem_view);
+ send_emblems_changed ();
break;
}
}
static void
-show_add_emblems_dialog (NautilusEmblemView *emblem_view,
+show_add_emblems_dialog (NautilusEmblemSidebar *emblem_sidebar,
GSList *emblems)
{
GtkWidget *dialog;
g_return_if_fail (emblems != NULL);
- dialog = create_add_emblems_dialog (emblem_view, emblems);
+ dialog = create_add_emblems_dialog (emblem_sidebar, emblems);
if (dialog == NULL) {
return;
@@ -673,20 +710,20 @@ show_add_emblems_dialog (NautilusEmblemView *emblem_view,
g_signal_connect (dialog, "response",
G_CALLBACK (add_emblems_dialog_response_cb),
- emblem_view);
+ emblem_sidebar);
gtk_window_present (GTK_WINDOW (dialog));
}
static void
-nautilus_emblem_view_drag_received_cb (GtkWidget *widget,
- GdkDragContext *drag_context,
- gint x,
- gint y,
- GtkSelectionData *data,
- guint info,
- guint time,
- NautilusEmblemView *emblem_view)
+nautilus_emblem_sidebar_drag_received_cb (GtkWidget *widget,
+ GdkDragContext *drag_context,
+ gint x,
+ gint y,
+ GtkSelectionData *data,
+ guint info,
+ guint time,
+ NautilusEmblemSidebar *emblem_sidebar)
{
GSList *emblems;
Emblem *emblem;
@@ -746,7 +783,7 @@ nautilus_emblem_view_drag_received_cb (GtkWidget *widget,
}
if (emblems != NULL) {
- show_add_emblems_dialog (emblem_view, emblems);
+ show_add_emblems_dialog (emblem_sidebar, emblems);
}
break;
@@ -777,7 +814,7 @@ nautilus_emblem_view_drag_received_cb (GtkWidget *widget,
emblems = g_slist_prepend (NULL, emblem);
- show_add_emblems_dialog (emblem_view, emblems);
+ show_add_emblems_dialog (emblem_sidebar, emblems);
} else {
uri_utf8 = eel_format_uri_for_display (uri);
@@ -832,7 +869,7 @@ nautilus_emblem_view_drag_received_cb (GtkWidget *widget,
emblems = g_slist_prepend (NULL, emblem);
- show_add_emblems_dialog (emblem_view, emblems);
+ show_add_emblems_dialog (emblem_sidebar, emblems);
} else {
g_warning ("Tried to load '%s', but failed.\n",
uri);
@@ -846,7 +883,7 @@ nautilus_emblem_view_drag_received_cb (GtkWidget *widget,
}
static GtkWidget *
-nautilus_emblem_view_create_container (NautilusEmblemView *emblem_view)
+nautilus_emblem_sidebar_create_container (NautilusEmblemSidebar *emblem_sidebar)
{
GtkWidget *emblems_table, *scroller;
@@ -862,12 +899,12 @@ nautilus_emblem_view_create_container (NautilusEmblemView *emblem_view)
GDK_ACTION_COPY | GDK_ACTION_MOVE);
g_signal_connect (scroller, "drag-data-received",
- G_CALLBACK (nautilus_emblem_view_drag_received_cb),
- emblem_view);
+ G_CALLBACK (nautilus_emblem_sidebar_drag_received_cb),
+ emblem_sidebar);
gtk_widget_show (scroller);
- emblem_view->details->emblems_table = emblems_table;
+ emblem_sidebar->details->emblems_table = emblems_table;
return scroller;
}
@@ -885,7 +922,7 @@ emblem_widget_sort_func (gconstpointer a, gconstpointer b)
}
static void
-nautilus_emblem_view_populate (NautilusEmblemView *emblem_view)
+nautilus_emblem_sidebar_populate (NautilusEmblemSidebar *emblem_sidebar)
{
GList *icons, *l, *widgets;
GtkWidget *emblem_widget;
@@ -899,12 +936,12 @@ nautilus_emblem_view_populate (NautilusEmblemView *emblem_view)
g_free (path);
if (erase_pixbuf != NULL) {
- emblem_widget = create_emblem_widget_with_pixbuf (emblem_view,
+ emblem_widget = create_emblem_widget_with_pixbuf (emblem_sidebar,
ERASE_EMBLEM_KEYWORD,
_("Erase"),
erase_pixbuf);
gtk_container_add (GTK_CONTAINER
- (emblem_view->details->emblems_table),
+ (emblem_sidebar->details->emblems_table),
emblem_widget);
}
@@ -921,7 +958,7 @@ nautilus_emblem_view_populate (NautilusEmblemView *emblem_view)
continue;
}
- emblem_widget = create_emblem_widget (emblem_view, name);
+ emblem_widget = create_emblem_widget (emblem_sidebar, name);
widgets = g_list_prepend (widgets, emblem_widget);
}
@@ -933,65 +970,143 @@ nautilus_emblem_view_populate (NautilusEmblemView *emblem_view)
l = widgets;
while (l != NULL) {
gtk_container_add
- (GTK_CONTAINER (emblem_view->details->emblems_table),
+ (GTK_CONTAINER (emblem_sidebar->details->emblems_table),
l->data);
l = l->next;
}
g_list_free (widgets);
- gtk_widget_show_all (emblem_view->details->emblems_table);
+ gtk_widget_show_all (emblem_sidebar->details->emblems_table);
}
static void
-nautilus_emblem_view_instance_init (NautilusEmblemView *emblem_view)
+nautilus_emblem_sidebar_init (NautilusEmblemSidebar *emblem_sidebar)
{
- BonoboControl *control;
GtkWidget *widget;
- emblem_view->details = g_new0 (NautilusEmblemViewDetails, 1);
+ emblem_sidebar->details = g_new0 (NautilusEmblemSidebarDetails, 1);
- emblem_view->details->client = gconf_client_get_default ();
+ emblem_sidebar->details->client = gconf_client_get_default ();
- create_popup_menu (emblem_view);
+ create_popup_menu (emblem_sidebar);
- widget = nautilus_emblem_view_create_container (emblem_view);
- nautilus_emblem_view_populate (emblem_view);
-
- control = bonobo_control_new (widget);
- nautilus_view_construct_from_bonobo_control
- (NAUTILUS_VIEW (emblem_view), control);
+ widget = nautilus_emblem_sidebar_create_container (emblem_sidebar);
+ nautilus_emblem_sidebar_populate (emblem_sidebar);
+ g_signal_connect_object (nautilus_signaller_get_current (),
+ "emblems_changed",
+ G_CALLBACK (emblems_changed_callback), emblem_sidebar, 0);
+
+ gtk_box_pack_start (GTK_BOX (emblem_sidebar), widget,
+ TRUE, TRUE, 0);
}
static void
-nautilus_emblem_view_finalize (GObject *object)
+nautilus_emblem_sidebar_finalize (GObject *object)
{
- NautilusEmblemView *emblem_view;
+ NautilusEmblemSidebar *emblem_sidebar;
- g_return_if_fail (NAUTILUS_IS_EMBLEM_VIEW (object));
- emblem_view = NAUTILUS_EMBLEM_VIEW (object);
+ g_return_if_fail (NAUTILUS_IS_EMBLEM_SIDEBAR (object));
+ emblem_sidebar = NAUTILUS_EMBLEM_SIDEBAR (object);
- if (emblem_view->details != NULL) {
- if (emblem_view->details->client != NULL) {
- g_object_unref (emblem_view->details->client);
+ if (emblem_sidebar->details != NULL) {
+ if (emblem_sidebar->details->client != NULL) {
+ g_object_unref (emblem_sidebar->details->client);
}
- g_free (emblem_view->details);
+ g_free (emblem_sidebar->details);
}
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (nautilus_emblem_sidebar_parent_class)->finalize (object);
}
static void
-nautilus_emblem_view_class_init (NautilusEmblemViewClass *object_klass)
+nautilus_emblem_sidebar_class_init (NautilusEmblemSidebarClass *object_klass)
{
GObjectClass *gobject_class;
- NautilusEmblemViewClass *klass;
+ NautilusEmblemSidebarClass *klass;
- klass = NAUTILUS_EMBLEM_VIEW_CLASS (object_klass);
+ klass = NAUTILUS_EMBLEM_SIDEBAR_CLASS (object_klass);
gobject_class = G_OBJECT_CLASS (object_klass);
- gobject_class->finalize = nautilus_emblem_view_finalize;
+ gobject_class->finalize = nautilus_emblem_sidebar_finalize;
+}
+
+static const char *
+nautilus_emblem_sidebar_get_sidebar_id (NautilusSidebar *sidebar)
+{
+ return NAUTILUS_EMBLEM_SIDEBAR_ID;
+}
+
+static char *
+nautilus_emblem_sidebar_get_tab_label (NautilusSidebar *sidebar)
+{
+ return g_strdup (_("Emblems"));
+}
+
+static GdkPixbuf *
+nautilus_emblem_sidebar_get_tab_icon (NautilusSidebar *sidebar)
+{
+ return NULL;
+}
+
+static void
+nautilus_emblem_sidebar_is_visible_changed (NautilusSidebar *sidebar,
+ gboolean is_visible)
+{
+ /* Do nothing */
+}
+
+static void
+nautilus_emblem_sidebar_iface_init (NautilusSidebarIface *iface)
+{
+ iface->get_sidebar_id = nautilus_emblem_sidebar_get_sidebar_id;
+ iface->get_tab_label = nautilus_emblem_sidebar_get_tab_label;
+ iface->get_tab_icon = nautilus_emblem_sidebar_get_tab_icon;
+ iface->is_visible_changed = nautilus_emblem_sidebar_is_visible_changed;
+}
+
+static void
+nautilus_emblem_sidebar_set_parent_window (NautilusEmblemSidebar *sidebar,
+ NautilusWindowInfo *window)
+{
+ sidebar->details->window = window;
+}
+
+static NautilusSidebar *
+nautilus_emblem_sidebar_create (NautilusSidebarProvider *provider,
+ NautilusWindowInfo *window)
+{
+ NautilusEmblemSidebar *sidebar;
+
+ sidebar = g_object_new (nautilus_emblem_sidebar_get_type (), NULL);
+ nautilus_emblem_sidebar_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 = nautilus_emblem_sidebar_create;
+}
+
+static void
+nautilus_emblem_sidebar_provider_init (NautilusEmblemSidebarProvider *sidebar)
+{
+}
+
+static void
+nautilus_emblem_sidebar_provider_class_init (NautilusEmblemSidebarProviderClass *class)
+{
+}
+
+void
+nautilus_emblem_sidebar_register (void)
+{
+ nautilus_module_add_type (nautilus_emblem_sidebar_provider_get_type ());
}
diff --git a/src/nautilus-emblem-sidebar.h b/src/nautilus-emblem-sidebar.h
new file mode 100644
index 000000000..afe47b0a0
--- /dev/null
+++ b/src/nautilus-emblem-sidebar.h
@@ -0,0 +1,60 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/*
+ * Nautilus
+ *
+ * Copyright (C) 1999, 2000 Eazel, Inc.
+ *
+ * Nautilus 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.
+ *
+ * Nautilus 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
+ *
+ *
+ * This is the header file for the index panel widget, which displays oversidebar information
+ * in a vertical panel and hosts the meta-sidebars.
+ */
+
+#ifndef NAUTILUS_EMBLEM_SIDEBAR_H
+#define NAUTILUS_EMBLEM_SIDEBAR_H
+
+#include <gtk/gtkvbox.h>
+
+#define NAUTILUS_TYPE_EMBLEM_SIDEBAR \
+ (nautilus_emblem_sidebar_get_type ())
+#define NAUTILUS_EMBLEM_SIDEBAR(obj) \
+ (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_EMBLEM_SIDEBAR, NautilusEmblemSidebar))
+#define NAUTILUS_EMBLEM_SIDEBAR_CLASS(klass) \
+ (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_EMBLEM_SIDEBAR, NautilusEmblemSidebarClass))
+#define NAUTILUS_IS_EMBLEM_SIDEBAR(obj) \
+ (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_EMBLEM_SIDEBAR))
+#define NAUTILUS_IS_EMBLEM_SIDEBAR_CLASS(klass) \
+ (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_EMBLEM_SIDEBAR))
+
+#define NAUTILUS_EMBLEM_SIDEBAR_ID "NautilusEmblemSidebar"
+
+typedef struct NautilusEmblemSidebarDetails NautilusEmblemSidebarDetails;
+
+typedef struct {
+ GtkVBox parent_slot;
+ NautilusEmblemSidebarDetails *details;
+} NautilusEmblemSidebar;
+
+typedef struct {
+ GtkVBoxClass parent_slot;
+
+} NautilusEmblemSidebarClass;
+
+GType nautilus_emblem_sidebar_get_type (void);
+void nautilus_emblem_sidebar_register (void);
+
+#endif /* NAUTILUS_EMBLEM_SIDEBAR_H */
diff --git a/src/nautilus-history-sidebar.c b/src/nautilus-history-sidebar.c
new file mode 100644
index 000000000..52351b002
--- /dev/null
+++ b/src/nautilus-history-sidebar.c
@@ -0,0 +1,346 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/*
+ * Nautilus
+ *
+ * Copyright (C) 1999, 2000 Red Hat, Inc.
+ * Copyright (C) 2000, 2001 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: Elliot Lee <sopwith@redhat.com>
+ * Darin Adler <darin@bentspoon.com>
+ *
+ */
+
+#include <config.h>
+
+#include <eel/eel-debug.h>
+#include <eel/eel-gtk-extensions.h>
+#include <eel/eel-glib-extensions.h>
+#include <eel/eel-preferences.h>
+#include <gtk/gtkcellrendererpixbuf.h>
+#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtkliststore.h>
+#include <gtk/gtktreemodel.h>
+#include <gtk/gtktreeselection.h>
+#include <libgnome/gnome-macros.h>
+#include <libgnome/gnome-i18n.h>
+#include <libnautilus-private/nautilus-bookmark.h>
+#include <libnautilus-private/nautilus-global-preferences.h>
+#include <libnautilus-private/nautilus-sidebar-provider.h>
+#include <libnautilus-private/nautilus-module.h>
+
+#include "nautilus-signaller.h"
+#include "nautilus-history-sidebar.h"
+
+#define NAUTILUS_HISTORY_SIDEBAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_HISTORY_SIDEBAR, NautilusHistorySidebarClass))
+#define NAUTILUS_IS_HISTORY_SIDEBAR(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_HISTORY_SIDEBAR))
+#define NAUTILUS_IS_HISTORY_SIDEBAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_HISTORY_SIDEBAR))
+
+typedef struct {
+ GtkScrolledWindowClass parent;
+} NautilusHistorySidebarClass;
+
+typedef struct {
+ GObject parent;
+} NautilusHistorySidebarProvider;
+
+typedef struct {
+ GObjectClass parent;
+} NautilusHistorySidebarProviderClass;
+
+
+enum {
+ HISTORY_SIDEBAR_COLUMN_ICON,
+ HISTORY_SIDEBAR_COLUMN_NAME,
+ HISTORY_SIDEBAR_COLUMN_BOOKMARK,
+ HISTORY_SIDEBAR_COLUMN_COUNT
+};
+
+static void nautilus_history_sidebar_iface_init (NautilusSidebarIface *iface);
+static void sidebar_provider_iface_init (NautilusSidebarProviderIface *iface);
+static GType nautilus_history_sidebar_provider_get_type (void);
+
+G_DEFINE_TYPE_WITH_CODE (NautilusHistorySidebar, nautilus_history_sidebar, GTK_TYPE_SCROLLED_WINDOW,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_SIDEBAR,
+ nautilus_history_sidebar_iface_init));
+
+G_DEFINE_TYPE_WITH_CODE (NautilusHistorySidebarProvider, nautilus_history_sidebar_provider, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_SIDEBAR_PROVIDER,
+ sidebar_provider_iface_init));
+
+static void
+update_history (NautilusHistorySidebar *sidebar)
+{
+ GtkListStore *store;
+ GtkTreeSelection *selection;
+ NautilusBookmark *bookmark;
+ GdkPixbuf *pixbuf;
+ GtkTreeIter iter;
+ char *name;
+ GList *l, *history;
+
+ store = GTK_LIST_STORE (gtk_tree_view_get_model (sidebar->tree_view));
+
+ gtk_list_store_clear (store);
+
+ history = nautilus_window_info_get_history (sidebar->window);
+ for (l = history; l != NULL; l = l->next) {
+ bookmark = nautilus_bookmark_copy (l->data);
+
+ pixbuf = nautilus_bookmark_get_pixbuf (bookmark, NAUTILUS_ICON_SIZE_FOR_MENUS, FALSE);
+ name = nautilus_bookmark_get_name (bookmark);
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ HISTORY_SIDEBAR_COLUMN_ICON, pixbuf,
+ HISTORY_SIDEBAR_COLUMN_NAME, name,
+ HISTORY_SIDEBAR_COLUMN_BOOKMARK, bookmark,
+ -1);
+
+ if (pixbuf != NULL) {
+ g_object_unref (pixbuf);
+ }
+ g_free (name);
+ }
+ eel_g_object_list_free (history);
+
+ selection = GTK_TREE_SELECTION (gtk_tree_view_get_selection (sidebar->tree_view));
+
+ if (gtk_tree_model_get_iter_root (GTK_TREE_MODEL (store), &iter)) {
+ gtk_tree_selection_select_iter (selection, &iter);
+ }
+}
+
+static void
+history_changed_callback (GObject *signaller,
+ NautilusHistorySidebar *sidebar)
+{
+ update_history (sidebar);
+}
+
+static void
+row_activated_callback (GtkTreeView *tree_view,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ gpointer user_data)
+{
+ NautilusHistorySidebar *sidebar;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ NautilusBookmark *bookmark;
+ char *uri;
+
+ sidebar = NAUTILUS_HISTORY_SIDEBAR (user_data);
+ model = gtk_tree_view_get_model (tree_view);
+
+ if (!gtk_tree_model_get_iter (model, &iter, path)) {
+ return;
+ }
+
+ gtk_tree_model_get
+ (model, &iter, HISTORY_SIDEBAR_COLUMN_BOOKMARK, &bookmark, -1);
+
+ /* Navigate to the clicked location. */
+ uri = nautilus_bookmark_get_uri (NAUTILUS_BOOKMARK (bookmark));
+ nautilus_window_info_open_location
+ (sidebar->window,
+ uri, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, 0, NULL);
+ g_free (uri);
+}
+
+static void
+update_click_policy (NautilusHistorySidebar *sidebar)
+{
+ int policy;
+
+ policy = eel_preferences_get_enum (NAUTILUS_PREFERENCES_CLICK_POLICY);
+
+ eel_gtk_tree_view_set_activate_on_single_click
+ (sidebar->tree_view, policy == NAUTILUS_CLICK_POLICY_SINGLE);
+}
+
+static void
+click_policy_changed_callback (gpointer user_data)
+{
+ NautilusHistorySidebar *sidebar;
+
+ sidebar = NAUTILUS_HISTORY_SIDEBAR (user_data);
+
+ update_click_policy (sidebar);
+}
+
+static void
+nautilus_history_sidebar_init (NautilusHistorySidebar *sidebar)
+{
+ GtkTreeView *tree_view;
+ GtkTreeViewColumn *col;
+ GtkCellRenderer *cell;
+ GtkListStore *store;
+ GtkTreeSelection *selection;
+
+ tree_view = GTK_TREE_VIEW (gtk_tree_view_new ());
+ gtk_tree_view_set_headers_visible (tree_view, FALSE);
+ gtk_widget_show (GTK_WIDGET (tree_view));
+
+ col = GTK_TREE_VIEW_COLUMN (gtk_tree_view_column_new ());
+
+ cell = gtk_cell_renderer_pixbuf_new ();
+ gtk_tree_view_column_pack_start (col, cell, FALSE);
+ gtk_tree_view_column_set_attributes (col, cell,
+ "pixbuf", HISTORY_SIDEBAR_COLUMN_ICON,
+ NULL);
+
+ cell = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start (col, cell, TRUE);
+ gtk_tree_view_column_set_attributes (col, cell,
+ "text", HISTORY_SIDEBAR_COLUMN_NAME,
+ NULL);
+
+ gtk_tree_view_column_set_fixed_width (col, NAUTILUS_ICON_SIZE_SMALLER);
+ gtk_tree_view_append_column (tree_view, col);
+
+ store = gtk_list_store_new (HISTORY_SIDEBAR_COLUMN_COUNT,
+ GDK_TYPE_PIXBUF,
+ G_TYPE_STRING,
+ NAUTILUS_TYPE_BOOKMARK);
+
+ gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (store));
+
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sidebar),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (sidebar), NULL);
+ gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (sidebar), NULL);
+ gtk_container_add (GTK_CONTAINER (sidebar), GTK_WIDGET (tree_view));
+ gtk_widget_show (GTK_WIDGET (sidebar));
+
+ sidebar->tree_view = tree_view;
+
+ selection = gtk_tree_view_get_selection (tree_view);
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+
+ g_signal_connect_object
+ (tree_view, "row_activated",
+ G_CALLBACK (row_activated_callback), sidebar, 0);
+
+ g_signal_connect_object (nautilus_signaller_get_current (),
+ "history_list_changed",
+ G_CALLBACK (history_changed_callback), sidebar, 0);
+
+ eel_preferences_add_callback (NAUTILUS_PREFERENCES_CLICK_POLICY,
+ click_policy_changed_callback,
+ sidebar);
+ update_click_policy (sidebar);
+}
+
+static void
+nautilus_history_sidebar_finalize (GObject *object)
+{
+ NautilusHistorySidebar *sidebar;
+
+ sidebar = NAUTILUS_HISTORY_SIDEBAR (object);
+
+ eel_preferences_remove_callback (NAUTILUS_PREFERENCES_CLICK_POLICY,
+ click_policy_changed_callback,
+ sidebar);
+
+ G_OBJECT_CLASS (nautilus_history_sidebar_parent_class)->finalize (object);
+}
+
+static void
+nautilus_history_sidebar_class_init (NautilusHistorySidebarClass *class)
+{
+ G_OBJECT_CLASS (class)->finalize = nautilus_history_sidebar_finalize;
+}
+
+static const char *
+nautilus_history_sidebar_get_sidebar_id (NautilusSidebar *sidebar)
+{
+ return NAUTILUS_HISTORY_SIDEBAR_ID;
+}
+
+static char *
+nautilus_history_sidebar_get_tab_label (NautilusSidebar *sidebar)
+{
+ return g_strdup (_("History"));
+}
+
+static GdkPixbuf *
+nautilus_history_sidebar_get_tab_icon (NautilusSidebar *sidebar)
+{
+ return NULL;
+}
+
+static void
+nautilus_history_sidebar_is_visible_changed (NautilusSidebar *sidebar,
+ gboolean is_visible)
+{
+ /* Do nothing */
+}
+
+static void
+nautilus_history_sidebar_iface_init (NautilusSidebarIface *iface)
+{
+ iface->get_sidebar_id = nautilus_history_sidebar_get_sidebar_id;
+ iface->get_tab_label = nautilus_history_sidebar_get_tab_label;
+ iface->get_tab_icon = nautilus_history_sidebar_get_tab_icon;
+ iface->is_visible_changed = nautilus_history_sidebar_is_visible_changed;
+}
+
+static void
+nautilus_history_sidebar_set_parent_window (NautilusHistorySidebar *sidebar,
+ NautilusWindowInfo *window)
+{
+ sidebar->window = window;
+ update_history (sidebar);
+}
+
+static NautilusSidebar *
+nautilus_history_sidebar_create (NautilusSidebarProvider *provider,
+ NautilusWindowInfo *window)
+{
+ NautilusHistorySidebar *sidebar;
+
+ sidebar = g_object_new (nautilus_history_sidebar_get_type (), NULL);
+ nautilus_history_sidebar_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 = nautilus_history_sidebar_create;
+}
+
+static void
+nautilus_history_sidebar_provider_init (NautilusHistorySidebarProvider *sidebar)
+{
+}
+
+static void
+nautilus_history_sidebar_provider_class_init (NautilusHistorySidebarProviderClass *class)
+{
+}
+
+void
+nautilus_history_sidebar_register (void)
+{
+ nautilus_module_add_type (nautilus_history_sidebar_provider_get_type ());
+}
+
diff --git a/components/history/nautilus-history-view.h b/src/nautilus-history-sidebar.h
index 685665e83..dc4ef7955 100644
--- a/components/history/nautilus-history-view.h
+++ b/src/nautilus-history-sidebar.h
@@ -24,24 +24,26 @@
* Darin Adler <darin@bentspoon.com>
*
*/
-#ifndef _NAUTILUS_HISTORY_VIEW_H
-#define _NAUTILUS_HISTORY_VIEW_H
+#ifndef _NAUTILUS_HISTORY_SIDEBAR_H
+#define _NAUTILUS_HISTORY_SIDEBAR_H
#include <gtk/gtktreeview.h>
-#include <libnautilus/nautilus-view.h>
-#include <libnautilus/nautilus-view-standard-main.h>
+#include <libnautilus-private/nautilus-view.h>
+#include <libnautilus-private/nautilus-window-info.h>
+#include <gtk/gtkscrolledwindow.h>
-#define VIEW_IID "OAFIID:Nautilus_History_View"
+#define NAUTILUS_HISTORY_SIDEBAR_ID "NautilusHistorySidebar"
-#define NAUTILUS_TYPE_HISTORY_VIEW (nautilus_history_view_get_type ())
-#define NAUTILUS_HISTORY_VIEW(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_HISTORY_VIEW, NautilusHistoryView))
+#define NAUTILUS_TYPE_HISTORY_SIDEBAR (nautilus_history_sidebar_get_type ())
+#define NAUTILUS_HISTORY_SIDEBAR(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_HISTORY_SIDEBAR, NautilusHistorySidebar))
typedef struct {
- NautilusView parent;
- GtkTreeView *tree_view;
- gboolean *stop_updating_history;
-} NautilusHistoryView;
+ GtkScrolledWindow parent;
+ GtkTreeView *tree_view;
+ NautilusWindowInfo *window;
+} NautilusHistorySidebar;
-GType nautilus_history_view_get_type (void);
+GType nautilus_history_sidebar_get_type (void);
+void nautilus_history_sidebar_register (void);
#endif
diff --git a/components/image_properties/nautilus-image-properties-view.c b/src/nautilus-image-properties-page.c
index b2405da0a..3feeff274 100644
--- a/components/image_properties/nautilus-image-properties-view.c
+++ b/src/nautilus-image-properties-page.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
- * Copyright (C) 2002 James Willcox
+ * 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
@@ -18,11 +18,11 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * Author: James Willcox <jwillcox@gnome.org>
+ * Author: Alexander Larsson <alexl@redhat.com>
*/
#include <config.h>
-#include "nautilus-image-properties-view.h"
+#include "nautilus-image-properties-page.h"
#include <gtk/gtkvbox.h>
#include <gtk/gtklabel.h>
@@ -30,6 +30,8 @@
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
#include <eel/eel-gnome-extensions.h>
+#include <libnautilus-extension/nautilus-property-page-provider.h>
+#include <libnautilus-private/nautilus-module.h>
#include <string.h>
#ifdef HAVE_EXIF
@@ -46,9 +48,8 @@
#define LOAD_BUFFER_SIZE 8192
-struct NautilusImagePropertiesViewDetails {
+struct NautilusImagePropertiesPageDetails {
char *location;
- GtkWidget *vbox;
GtkWidget *resolution;
GnomeVFSAsyncHandle *vfs_handle;
GdkPixbufLoader *loader;
@@ -74,23 +75,42 @@ enum {
PROP_URI
};
+typedef struct {
+ GObject parent;
+} NautilusImagePropertiesPageProvider;
+
+typedef struct {
+ GObjectClass parent;
+} NautilusImagePropertiesPageProviderClass;
+
+
static GObjectClass *parent_class = NULL;
+static GType nautilus_image_properties_page_provider_get_type (void);
+static void property_page_provider_iface_init (NautilusPropertyPageProviderIface *iface);
+
+
+G_DEFINE_TYPE (NautilusImagePropertiesPage, nautilus_image_properties_page, GTK_TYPE_VBOX);
+
+G_DEFINE_TYPE_WITH_CODE (NautilusImagePropertiesPageProvider, nautilus_image_properties_page_provider, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER,
+ property_page_provider_iface_init));
+
static void
-nautilus_image_properties_view_finalize (GObject *object)
+nautilus_image_properties_page_finalize (GObject *object)
{
- NautilusImagePropertiesView *view;
+ NautilusImagePropertiesPage *page;
- view = NAUTILUS_IMAGE_PROPERTIES_VIEW (object);
+ page = NAUTILUS_IMAGE_PROPERTIES_PAGE (object);
- if (view->details->vfs_handle != NULL) {
- gnome_vfs_async_cancel (view->details->vfs_handle);
+ if (page->details->vfs_handle != NULL) {
+ gnome_vfs_async_cancel (page->details->vfs_handle);
}
- view->details->vfs_handle = NULL;
- g_free (view->details->location);
+ page->details->vfs_handle = NULL;
+ g_free (page->details->location);
- g_free (view->details);
+ g_free (page->details);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -207,51 +227,51 @@ append_exifdata_string (ExifData *exifdata, GString *string)
#endif /*HAVE_EXIF*/
static void
-load_finished (NautilusImagePropertiesView *view)
+load_finished (NautilusImagePropertiesPage *page)
{
GdkPixbufFormat *format;
char *name, *desc;
GString *str;
- if (view->details->got_size) {
+ if (page->details->got_size) {
str = g_string_new (NULL);
- format = gdk_pixbuf_loader_get_format (view->details->loader);
+ format = gdk_pixbuf_loader_get_format (page->details->loader);
name = gdk_pixbuf_format_get_name (format);
desc = gdk_pixbuf_format_get_description (format);
g_string_append_printf (str, ngettext ("<b>Image Type:</b> %s (%s)\n<b>Resolution:</b> %dx%d pixels\n",
"<b>Image Type:</b> %s (%s)\n<b>Resolution:</b> %dx%d pixels\n",
- view->details->height),
- name, desc, view->details->width, view->details->height);
+ page->details->height),
+ name, desc, page->details->width, page->details->height);
g_free (name);
g_free (desc);
#ifdef HAVE_EXIF
- append_exifdata_string (exif_loader_get_data (view->details->exifldr), str);
+ append_exifdata_string (exif_loader_get_data (page->details->exifldr), str);
#endif /*HAVE_EXIF*/
- gtk_label_set_markup (GTK_LABEL (view->details->resolution), str->str);
- gtk_label_set_selectable (GTK_LABEL (view->details->resolution), TRUE);
+ gtk_label_set_markup (GTK_LABEL (page->details->resolution), str->str);
+ gtk_label_set_selectable (GTK_LABEL (page->details->resolution), TRUE);
g_string_free (str, TRUE);
} else {
- gtk_label_set_text (GTK_LABEL (view->details->resolution), _("Failed to load image information"));
+ gtk_label_set_text (GTK_LABEL (page->details->resolution), _("Failed to load image information"));
}
- if (view->details->loader != NULL) {
- gdk_pixbuf_loader_close (view->details->loader, NULL);
- g_object_unref (view->details->loader);
- view->details->loader = NULL;
+ if (page->details->loader != NULL) {
+ gdk_pixbuf_loader_close (page->details->loader, NULL);
+ g_object_unref (page->details->loader);
+ page->details->loader = NULL;
}
#ifdef HAVE_EXIF
- if (view->details->exifldr != NULL) {
- exif_loader_unref (view->details->exifldr);
- view->details->exifldr = NULL;
+ if (page->details->exifldr != NULL) {
+ exif_loader_unref (page->details->exifldr);
+ page->details->exifldr = NULL;
}
#endif /*HAVE_EXIF*/
- if (view->details->vfs_handle != NULL) {
- gnome_vfs_async_close (view->details->vfs_handle, file_closed_callback, NULL);
- view->details->vfs_handle = NULL;
+ if (page->details->vfs_handle != NULL) {
+ gnome_vfs_async_close (page->details->vfs_handle, file_closed_callback, NULL);
+ page->details->vfs_handle = NULL;
}
}
@@ -263,41 +283,41 @@ file_read_callback (GnomeVFSAsyncHandle *vfs_handle,
GnomeVFSFileSize bytes_read,
gpointer callback_data)
{
- NautilusImagePropertiesView *view;
+ NautilusImagePropertiesPage *page;
#ifdef HAVE_EXIF
int exif_still_loading;
#endif
- view = NAUTILUS_IMAGE_PROPERTIES_VIEW (callback_data);
+ page = NAUTILUS_IMAGE_PROPERTIES_PAGE (callback_data);
if (result == GNOME_VFS_OK && bytes_read != 0) {
#ifdef HAVE_EXIF
- exif_still_loading = exif_loader_write (view->details->exifldr,
+ exif_still_loading = exif_loader_write (page->details->exifldr,
buffer,
bytes_read);
#endif
- if (view->details->pixbuf_still_loading) {
- if (!gdk_pixbuf_loader_write (view->details->loader,
+ if (page->details->pixbuf_still_loading) {
+ if (!gdk_pixbuf_loader_write (page->details->loader,
buffer,
bytes_read,
NULL)) {
- view->details->pixbuf_still_loading = FALSE;
+ page->details->pixbuf_still_loading = FALSE;
}
}
- if (view->details->pixbuf_still_loading
+ if (page->details->pixbuf_still_loading
#ifdef HAVE_EXIF
&& (exif_still_loading == 1)
#endif
) {
- gnome_vfs_async_read (view->details->vfs_handle,
- view->details->buffer,
- sizeof (view->details->buffer),
+ gnome_vfs_async_read (page->details->vfs_handle,
+ page->details->buffer,
+ sizeof (page->details->buffer),
file_read_callback,
- view);
+ page);
return;
}
}
- load_finished (view);
+ load_finished (page);
}
static void
@@ -306,14 +326,14 @@ size_prepared_callback (GdkPixbufLoader *loader,
int height,
gpointer callback_data)
{
- NautilusImagePropertiesView *view;
+ NautilusImagePropertiesPage *page;
- view = NAUTILUS_IMAGE_PROPERTIES_VIEW (callback_data);
+ page = NAUTILUS_IMAGE_PROPERTIES_PAGE (callback_data);
- view->details->height = height;
- view->details->width = width;
- view->details->got_size = TRUE;
- view->details->pixbuf_still_loading = FALSE;
+ page->details->height = height;
+ page->details->width = width;
+ page->details->got_size = TRUE;
+ page->details->pixbuf_still_loading = FALSE;
}
static void
@@ -321,127 +341,162 @@ file_opened_callback (GnomeVFSAsyncHandle *vfs_handle,
GnomeVFSResult result,
gpointer callback_data)
{
- NautilusImagePropertiesView *view;
+ NautilusImagePropertiesPage *page;
- view = NAUTILUS_IMAGE_PROPERTIES_VIEW (callback_data);
+ page = NAUTILUS_IMAGE_PROPERTIES_PAGE (callback_data);
if (result != GNOME_VFS_OK) {
- view->details->vfs_handle = NULL;
+ page->details->vfs_handle = NULL;
return;
}
- view->details->loader = gdk_pixbuf_loader_new ();
- view->details->pixbuf_still_loading = TRUE;
- view->details->width = 0;
- view->details->height = 0;
+ page->details->loader = gdk_pixbuf_loader_new ();
+ page->details->pixbuf_still_loading = TRUE;
+ page->details->width = 0;
+ page->details->height = 0;
#ifdef HAVE_EXIF
- view->details->exifldr = exif_loader_new ();
+ page->details->exifldr = exif_loader_new ();
#endif /*HAVE_EXIF*/
- g_signal_connect (view->details->loader, "size_prepared",
- G_CALLBACK (size_prepared_callback), view);
+ g_signal_connect (page->details->loader, "size_prepared",
+ G_CALLBACK (size_prepared_callback), page);
gnome_vfs_async_read (vfs_handle,
- view->details->buffer,
- sizeof (view->details->buffer),
+ page->details->buffer,
+ sizeof (page->details->buffer),
file_read_callback,
- view);
+ page);
}
static void
-load_location (NautilusImagePropertiesView *view,
+load_location (NautilusImagePropertiesPage *page,
const char *location)
{
- g_assert (NAUTILUS_IS_IMAGE_PROPERTIES_VIEW (view));
+ g_assert (NAUTILUS_IS_IMAGE_PROPERTIES_PAGE (page));
g_assert (location != NULL);
- if (view->details->vfs_handle != NULL)
- gnome_vfs_async_cancel (view->details->vfs_handle);
+ if (page->details->vfs_handle != NULL)
+ gnome_vfs_async_cancel (page->details->vfs_handle);
- gnome_vfs_async_open (&view->details->vfs_handle,
+ gnome_vfs_async_open (&page->details->vfs_handle,
location,
GNOME_VFS_OPEN_READ,
-2,
file_opened_callback,
- view);
+ page);
}
static void
-get_property (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
+nautilus_image_properties_page_class_init (NautilusImagePropertiesPageClass *class)
{
- NautilusImagePropertiesView *view = user_data;
-
- if (arg_id == PROP_URI) {
- CORBA_sequence_CORBA_string *uris;
-
- uris = CORBA_sequence_CORBA_string__alloc ();
- uris->_maximum = uris->_length = 1;
- uris->_buffer = CORBA_sequence_CORBA_string_allocbuf (uris->_length);
- uris->_buffer[0] = CORBA_string_dup (view->details->location);
- arg->_type = TC_CORBA_sequence_CORBA_string;
- arg->_value = uris;
- }
+ parent_class = g_type_class_peek_parent (class);
+
+ G_OBJECT_CLASS (class)->finalize = nautilus_image_properties_page_finalize;
}
static void
-set_property (BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
+nautilus_image_properties_page_init (NautilusImagePropertiesPage *page)
{
- NautilusImagePropertiesView *view = user_data;
-
- if (arg_id == PROP_URI) {
- CORBA_sequence_CORBA_string *uris;
-
- uris = arg->_value;
- view->details->location = g_strdup (uris->_buffer[0]);
- load_location (view, view->details->location);
- }
+ page->details = g_new0 (NautilusImagePropertiesPageDetails, 1);
+
+ gtk_box_set_homogeneous (GTK_BOX (page), FALSE);
+ gtk_box_set_spacing (GTK_BOX (page), 2);
+ gtk_container_set_border_width (GTK_CONTAINER (page), 6);
+
+ page->details->resolution = gtk_label_new (_("loading..."));
+ gtk_misc_set_alignment (GTK_MISC (page->details->resolution),
+ 0,
+ 0);
+
+ gtk_box_pack_start (GTK_BOX (page),
+ page->details->resolution,
+ FALSE, TRUE, 2);
+
+ gtk_widget_show_all (GTK_WIDGET (page));
}
-static void
-nautilus_image_properties_view_class_init (NautilusImagePropertiesViewClass *class)
+/* nautilus_property_page_provider_get_pages
+ *
+ * This function is called by Nautilus when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated NautilusPropertyPage
+ * items.
+ */
+static GList *
+get_property_pages (NautilusPropertyPageProvider *provider,
+ GList *files)
{
- parent_class = g_type_class_peek_parent (class);
+ GList *pages;
+ NautilusPropertyPage *real_page;
+ NautilusFileInfo *file;
+ char *uri;
+ NautilusImagePropertiesPage *page;
+
+ /* Only show the property page if 1 file is selected */
+ if (!files || files->next != NULL) {
+ return NULL;
+ }
+
+ file = NAUTILUS_FILE_INFO (files->data);
+
+ if (!
+ (nautilus_file_info_is_mime_type (file, "image/x-bmp") ||
+ nautilus_file_info_is_mime_type (file, "image/x-ico") ||
+ nautilus_file_info_is_mime_type (file, "image/jpeg") ||
+ nautilus_file_info_is_mime_type (file, "image/gif") ||
+ nautilus_file_info_is_mime_type (file, "image/png") ||
+ nautilus_file_info_is_mime_type (file, "image/pnm") ||
+ nautilus_file_info_is_mime_type (file, "image/ras") ||
+ nautilus_file_info_is_mime_type (file, "image/tga") ||
+ nautilus_file_info_is_mime_type (file, "image/tiff") ||
+ nautilus_file_info_is_mime_type (file, "image/wbmp") ||
+ nautilus_file_info_is_mime_type (file, "image/x-xbitmap") ||
+ nautilus_file_info_is_mime_type (file, "image/x-xpixmap"))) {
+ return NULL;
+ }
- G_OBJECT_CLASS (class)->finalize = nautilus_image_properties_view_finalize;
+ pages = NULL;
+
+ uri = nautilus_file_info_get_uri (file);
+
+ page = g_object_new (nautilus_image_properties_page_get_type (), NULL);
+ page->details->location = uri;
+ load_location (page, page->details->location);
+
+ real_page = nautilus_property_page_new
+ ("NautilusImagePropertiesPage::property_page",
+ gtk_label_new (_("Image")),
+ GTK_WIDGET (page));
+ pages = g_list_append (pages, real_page);
+
+ return pages;
}
-static void
-nautilus_image_properties_view_init (NautilusImagePropertiesView *view)
+static void
+property_page_provider_iface_init (NautilusPropertyPageProviderIface *iface)
{
- BonoboPropertyBag *pb;
+ iface->get_pages = get_property_pages;
+}
- view->details = g_new0 (NautilusImagePropertiesViewDetails, 1);
- view->details->vbox = gtk_vbox_new (FALSE, 2);
- view->details->resolution = gtk_label_new (_("loading..."));
- gtk_misc_set_alignment (GTK_MISC (view->details->resolution),
- 0,
- 0);
+static void
+nautilus_image_properties_page_provider_init (NautilusImagePropertiesPageProvider *sidebar)
+{
+}
- gtk_box_pack_start (GTK_BOX (view->details->vbox),
- view->details->resolution,
- FALSE, TRUE, 2);
+static void
+nautilus_image_properties_page_provider_class_init (NautilusImagePropertiesPageProviderClass *class)
+{
+}
- gtk_widget_show_all (view->details->vbox);
-
- bonobo_control_construct (BONOBO_CONTROL (view), view->details->vbox);
-
- pb = bonobo_property_bag_new (get_property, set_property,
- view);
- bonobo_property_bag_add (pb, "uris", 0, TC_CORBA_sequence_CORBA_string,
- NULL, _("URI currently displayed"), 0);
- bonobo_control_set_properties (BONOBO_CONTROL (view),
- BONOBO_OBJREF (pb), NULL);
- bonobo_object_release_unref (BONOBO_OBJREF (pb), NULL);
+void
+nautilus_image_properties_page_register (void)
+{
+ nautilus_module_add_type (nautilus_image_properties_page_provider_get_type ());
}
-BONOBO_TYPE_FUNC (NautilusImagePropertiesView, BONOBO_TYPE_CONTROL, nautilus_image_properties_view);
diff --git a/src/nautilus-image-properties-page.h b/src/nautilus-image-properties-page.h
new file mode 100644
index 000000000..ded7d2830
--- /dev/null
+++ b/src/nautilus-image-properties-page.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/*
+ * 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.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ */
+
+#ifndef NAUTILUS_IMAGE_PROPERTIES_PAGE_H
+#define NAUTILUS_IMAGE_PROPERTIES_PAGE_H
+
+#include <gtk/gtkvbox.h>
+
+#define NAUTILUS_TYPE_IMAGE_PROPERTIES_PAGE (nautilus_image_properties_page_get_type ())
+#define NAUTILUS_IMAGE_PROPERTIES_PAGE(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_IMAGE_PROPERTIES_PAGE, NautilusImagePropertiesPage))
+#define NAUTILUS_IMAGE_PROPERTIES_PAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_IMAGE_PROPERTIES_PAGE, NautilusImagePropertiesPageClass))
+#define NAUTILUS_IS_IMAGE_PROPERTIES_PAGE(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_IMAGE_PROPERTIES_PAGE))
+#define NAUTILUS_IS_IMAGE_PROPERTIES_PAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_IMAGE_PROPERTIES_PAGE))
+
+typedef struct NautilusImagePropertiesPageDetails NautilusImagePropertiesPageDetails;
+
+typedef struct {
+ GtkVBox parent;
+ NautilusImagePropertiesPageDetails *details;
+} NautilusImagePropertiesPage;
+
+typedef struct {
+ GtkVBoxClass parent;
+} NautilusImagePropertiesPageClass;
+
+GType nautilus_image_properties_page_get_type (void);
+void nautilus_image_properties_page_register (void);
+
+#endif /* NAUTILUS_IMAGE_PROPERTIES_PAGE_H */
diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c
index da68ba52b..0dbc59857 100644
--- a/src/nautilus-information-panel.c
+++ b/src/nautilus-information-panel.c
@@ -28,10 +28,6 @@
#include "nautilus-sidebar-title.h"
-#include <bonobo/bonobo-property-bag-client.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-exception.h>
-
#include <eel/eel-background.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-extensions.h>
@@ -64,12 +60,14 @@
#include <libnautilus-private/nautilus-metadata.h>
#include <libnautilus-private/nautilus-mime-actions.h>
#include <libnautilus-private/nautilus-program-choosing.h>
-#include <libnautilus-private/nautilus-sidebar-functions.h>
#include <libnautilus-private/nautilus-trash-monitor.h>
+#include <libnautilus-private/nautilus-sidebar-provider.h>
+#include <libnautilus-private/nautilus-module.h>
#include <math.h>
struct NautilusInformationPanelDetails {
GtkVBox *container;
+ NautilusWindowInfo *window;
NautilusSidebarTitle *title;
GtkHBox *button_box_centerer;
GtkVBox *button_box;
@@ -88,29 +86,31 @@ struct NautilusInformationPanelDetails {
/* button assignments */
#define CONTEXTUAL_MENU_BUTTON 3
-static void nautilus_information_panel_class_init (GtkObjectClass *object_klass);
-static void nautilus_information_panel_init (GtkObject *object);
-static gboolean nautilus_information_panel_press_event (GtkWidget *widget,
- GdkEventButton *event);
-static void nautilus_information_panel_destroy (GtkObject *object);
-static void nautilus_information_panel_finalize (GObject *object);
-static void nautilus_information_panel_drag_data_received (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- GtkSelectionData *selection_data,
- guint info,
- guint time);
-static void nautilus_information_panel_read_defaults (NautilusInformationPanel *information_panel);
-static void nautilus_information_panel_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-static void nautilus_information_panel_theme_changed (gpointer user_data);
-static void nautilus_information_panel_confirm_trash_changed (gpointer user_data);
-static void nautilus_information_panel_update_appearance (NautilusInformationPanel *information_panel);
-static void nautilus_information_panel_update_buttons (NautilusInformationPanel *information_panel);
-static void add_command_buttons (NautilusInformationPanel *information_panel,
- GList *application_list);
-static void background_metadata_changed_callback (NautilusInformationPanel *information_panel);
+static gboolean nautilus_information_panel_press_event (GtkWidget *widget,
+ GdkEventButton *event);
+static void nautilus_information_panel_destroy (GtkObject *object);
+static void nautilus_information_panel_finalize (GObject *object);
+static void nautilus_information_panel_drag_data_received (GtkWidget *widget,
+ GdkDragContext *context,
+ int x,
+ int y,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time);
+static void nautilus_information_panel_read_defaults (NautilusInformationPanel *information_panel);
+static void nautilus_information_panel_style_set (GtkWidget *widget,
+ GtkStyle *previous_style);
+static void nautilus_information_panel_theme_changed (gpointer user_data);
+static void nautilus_information_panel_confirm_trash_changed (gpointer user_data);
+static void nautilus_information_panel_update_appearance (NautilusInformationPanel *information_panel);
+static void nautilus_information_panel_update_buttons (NautilusInformationPanel *information_panel);
+static void add_command_buttons (NautilusInformationPanel *information_panel,
+ GList *application_list);
+static void background_metadata_changed_callback (NautilusInformationPanel *information_panel);
+static void nautilus_information_panel_iface_init (NautilusSidebarIface *iface);
+static void nautilus_information_panel_iface_init (NautilusSidebarIface *iface);
+static void sidebar_provider_iface_init (NautilusSidebarProviderIface *iface);
+static GType nautilus_information_panel_provider_get_type (void);
static gboolean confirm_trash_auto_value = TRUE;
@@ -147,24 +147,75 @@ typedef enum {
ICON_PART
} InformationPanelPart;
-EEL_CLASS_BOILERPLATE (NautilusInformationPanel, nautilus_information_panel, EEL_TYPE_BACKGROUND_BOX)
+typedef struct {
+ GObject parent;
+} NautilusInformationPanelProvider;
+
+typedef struct {
+ GObjectClass parent;
+} NautilusInformationPanelProviderClass;
+
+
+G_DEFINE_TYPE_WITH_CODE (NautilusInformationPanel, nautilus_information_panel, EEL_TYPE_BACKGROUND_BOX,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_SIDEBAR,
+ nautilus_information_panel_iface_init));
+/* for EEL_CALL_PARENT */
+#define parent_class nautilus_information_panel_parent_class
+
+G_DEFINE_TYPE_WITH_CODE (NautilusInformationPanelProvider, nautilus_information_panel_provider, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_SIDEBAR_PROVIDER,
+ sidebar_provider_iface_init));
+
+
+static const char *
+nautilus_information_panel_get_sidebar_id (NautilusSidebar *sidebar)
+{
+ return NAUTILUS_INFORMATION_PANEL_ID;
+}
+
+static char *
+nautilus_information_panel_get_tab_label (NautilusSidebar *sidebar)
+{
+ return g_strdup (_("Information"));
+}
+
+static GdkPixbuf *
+nautilus_information_panel_get_tab_icon (NautilusSidebar *sidebar)
+{
+ return NULL;
+}
+
+static void
+nautilus_information_panel_is_visible_changed (NautilusSidebar *sidebar,
+ gboolean is_visible)
+{
+ /* Do nothing */
+}
+
+static void
+nautilus_information_panel_iface_init (NautilusSidebarIface *iface)
+{
+ iface->get_sidebar_id = nautilus_information_panel_get_sidebar_id;
+ iface->get_tab_label = nautilus_information_panel_get_tab_label;
+ iface->get_tab_icon = nautilus_information_panel_get_tab_icon;
+ iface->is_visible_changed = nautilus_information_panel_is_visible_changed;
+}
/* initializing the class object by installing the operations we override */
static void
-nautilus_information_panel_class_init (GtkObjectClass *object_klass)
+nautilus_information_panel_class_init (NautilusInformationPanelClass *klass)
{
GtkWidgetClass *widget_class;
GObjectClass *gobject_class;
+ GtkObjectClass *object_class;
- NautilusInformationPanelClass *klass;
-
- widget_class = GTK_WIDGET_CLASS (object_klass);
- klass = NAUTILUS_INFORMATION_PANEL_CLASS (object_klass);
- gobject_class = G_OBJECT_CLASS (object_klass);
+ gobject_class = G_OBJECT_CLASS (klass);
+ object_class = GTK_OBJECT_CLASS (klass);
+ widget_class = GTK_WIDGET_CLASS (klass);
gobject_class->finalize = nautilus_information_panel_finalize;
- object_klass->destroy = nautilus_information_panel_destroy;
+ object_class->destroy = nautilus_information_panel_destroy;
widget_class->drag_data_received = nautilus_information_panel_drag_data_received;
widget_class->button_press_event = nautilus_information_panel_press_event;
@@ -173,7 +224,7 @@ nautilus_information_panel_class_init (GtkObjectClass *object_klass)
/* add the "location changed" signal */
signals[LOCATION_CHANGED] = g_signal_new
("location_changed",
- G_TYPE_FROM_CLASS (object_klass),
+ G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (NautilusInformationPanelClass,
location_changed),
@@ -202,14 +253,12 @@ make_button_box (NautilusInformationPanel *information_panel)
/* initialize the instance's fields, create the necessary subviews, etc. */
static void
-nautilus_information_panel_init (GtkObject *object)
+nautilus_information_panel_init (NautilusInformationPanel *information_panel)
{
GtkWidget *widget;
static gboolean setup_autos = FALSE;
- NautilusInformationPanel *information_panel;
-
- information_panel = NAUTILUS_INFORMATION_PANEL (object);
- widget = GTK_WIDGET (object);
+
+ widget = GTK_WIDGET (information_panel);
information_panel->details = g_new0 (NautilusInformationPanelDetails, 1);
@@ -356,13 +405,6 @@ nautilus_information_panel_create_context_menu (NautilusInformationPanel *inform
return menu;
}
-/* create a new instance */
-NautilusInformationPanel *
-nautilus_information_panel_new (void)
-{
- return NAUTILUS_INFORMATION_PANEL (gtk_widget_new (nautilus_information_panel_get_type (), NULL));
-}
-
/* set up the default backgrounds and images */
static void
nautilus_information_panel_read_defaults (NautilusInformationPanel *information_panel)
@@ -598,9 +640,9 @@ receive_dropped_keyword (NautilusInformationPanel *information_panel,
static void
nautilus_information_panel_drag_data_received (GtkWidget *widget, GdkDragContext *context,
- int x, int y,
- GtkSelectionData *selection_data,
- guint info, guint time)
+ int x, int y,
+ GtkSelectionData *selection_data,
+ guint info, guint time)
{
NautilusInformationPanel *information_panel;
EelBackground *background;
@@ -1162,10 +1204,10 @@ background_metadata_changed_callback (NautilusInformationPanel *information_pane
/* here is the key routine that populates the information_panel with the appropriate information when the uri changes */
-void
+static void
nautilus_information_panel_set_uri (NautilusInformationPanel *information_panel,
- const char* new_uri,
- const char* initial_title)
+ const char* new_uri,
+ const char* initial_title)
{
NautilusFile *file;
NautilusFileAttributes attributes;
@@ -1211,10 +1253,12 @@ nautilus_information_panel_set_uri (NautilusInformationPanel *information_panel,
initial_title);
}
-void
-nautilus_information_panel_set_title (NautilusInformationPanel *information_panel, const char* new_title)
+static void
+title_changed_callback (NautilusWindowInfo *window,
+ char *new_title,
+ NautilusInformationPanel *panel)
{
- nautilus_sidebar_title_set_text (information_panel->details->title,
+ nautilus_sidebar_title_set_text (panel->details->title,
new_title);
}
@@ -1228,3 +1272,79 @@ nautilus_information_panel_style_set (GtkWidget *widget, GtkStyle *previous_styl
nautilus_information_panel_theme_changed (information_panel);
}
+
+static void
+loading_uri_callback (NautilusWindowInfo *window,
+ char *uri,
+ NautilusInformationPanel *panel)
+{
+ char *title;
+
+ title = nautilus_window_info_get_title (window);
+ nautilus_information_panel_set_uri (panel,
+ uri,
+ title);
+ g_free (title);
+}
+
+static void
+nautilus_information_panel_set_parent_window (NautilusInformationPanel *panel,
+ NautilusWindowInfo *window)
+{
+ char *title, *location;
+
+ panel->details->window = window;
+
+ g_signal_connect_object (window, "loading_uri",
+ G_CALLBACK (loading_uri_callback), panel, 0);
+ g_signal_connect_object (window, "title_changed",
+ G_CALLBACK (title_changed_callback), panel, 0);
+
+ title = nautilus_window_info_get_title (window);
+ location = nautilus_window_info_get_current_location (window);
+ nautilus_information_panel_set_uri (panel,
+ location,
+ title);
+ g_free (location);
+ g_free (title);
+
+
+}
+
+static NautilusSidebar *
+nautilus_information_panel_create (NautilusSidebarProvider *provider,
+ NautilusWindowInfo *window)
+{
+ NautilusInformationPanel *panel;
+
+ panel = g_object_new (nautilus_information_panel_get_type (), NULL);
+ nautilus_information_panel_set_parent_window (panel, window);
+ g_object_ref (panel);
+ gtk_object_sink (GTK_OBJECT (panel));
+
+ return NAUTILUS_SIDEBAR (panel);
+}
+
+static void
+sidebar_provider_iface_init (NautilusSidebarProviderIface *iface)
+{
+ iface->create = nautilus_information_panel_create;
+}
+
+static void
+nautilus_information_panel_provider_init (NautilusInformationPanelProvider *sidebar)
+{
+}
+
+static void
+nautilus_information_panel_provider_class_init (NautilusInformationPanelProviderClass *class)
+{
+}
+
+
+void
+nautilus_information_panel_register (void)
+{
+ nautilus_module_add_type (nautilus_information_panel_provider_get_type ());
+}
+
diff --git a/src/nautilus-information-panel.h b/src/nautilus-information-panel.h
index 360458094..d3385fb83 100644
--- a/src/nautilus-information-panel.h
+++ b/src/nautilus-information-panel.h
@@ -30,8 +30,6 @@
#include <eel/eel-background-box.h>
-#include "nautilus-view-frame.h"
-
#define NAUTILUS_TYPE_INFORMATION_PANEL \
(nautilus_information_panel_get_type ())
#define NAUTILUS_INFORMATION_PANEL(obj) \
@@ -45,6 +43,8 @@
typedef struct NautilusInformationPanelDetails NautilusInformationPanelDetails;
+#define NAUTILUS_INFORMATION_PANEL_ID "NautilusInformationPanel"
+
typedef struct {
EelBackgroundBox parent_slot;
NautilusInformationPanelDetails *details;
@@ -58,12 +58,6 @@ typedef struct {
} NautilusInformationPanelClass;
GType nautilus_information_panel_get_type (void);
-NautilusInformationPanel *nautilus_information_panel_new (void);
-void nautilus_information_panel_set_uri (NautilusInformationPanel *information_panel,
- const char *new_uri,
- const char *initial_title);
-void nautilus_information_panel_set_title (NautilusInformationPanel *information_panel,
- const char *new_title);
-void nautilus_information_panel_setup_width (NautilusInformationPanel *information_panel);
+void nautilus_information_panel_register (void);
#endif /* NAUTILUS_INFORMATION_PANEL_H */
diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c
index 54ee30457..6140b2d0f 100644
--- a/src/nautilus-location-bar.c
+++ b/src/nautilus-location-bar.c
@@ -49,7 +49,7 @@
#include <libgnomeui/gnome-uidefs.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libnautilus-private/nautilus-icon-dnd.h>
-#include <libnautilus/nautilus-clipboard.h>
+#include <libnautilus-private/nautilus-clipboard.h>
#include <stdio.h>
#include <string.h>
@@ -436,7 +436,7 @@ nautilus_location_bar_new (NautilusNavigationWindow *window)
/* Clipboard */
nautilus_clipboard_set_up_editable
(GTK_EDITABLE (location_bar->details->entry),
- nautilus_window_get_ui_container (NAUTILUS_WINDOW (window)),
+ nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window)),
TRUE);
return bar;
diff --git a/src/nautilus-location-dialog.c b/src/nautilus-location-dialog.c
index 0b3b8cb80..843832234 100644
--- a/src/nautilus-location-dialog.c
+++ b/src/nautilus-location-dialog.c
@@ -197,12 +197,14 @@ nautilus_location_dialog_new (NautilusWindow *window)
location = nautilus_window_get_location (window);
- formatted_location = eel_format_uri_for_display (location);
- nautilus_entry_set_text (NAUTILUS_ENTRY (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry), formatted_location);
- gtk_editable_select_region (GTK_EDITABLE (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry), 0, -1);
- gtk_editable_set_position (GTK_EDITABLE (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry), -1);
- g_free (formatted_location);
- g_free (location);
+ if (location != NULL) {
+ formatted_location = eel_format_uri_for_display (location);
+ nautilus_entry_set_text (NAUTILUS_ENTRY (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry), formatted_location);
+ gtk_editable_select_region (GTK_EDITABLE (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry), 0, -1);
+ gtk_editable_set_position (GTK_EDITABLE (NAUTILUS_LOCATION_DIALOG (dialog)->details->entry), -1);
+ g_free (formatted_location);
+ g_free (location);
+ }
return dialog;
}
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c
index b9b344942..a2c8f504b 100644
--- a/src/nautilus-location-entry.c
+++ b/src/nautilus-location-entry.c
@@ -49,7 +49,7 @@
#include <libnautilus-private/nautilus-file-utilities.h>
#include <libnautilus-private/nautilus-entry.h>
#include <libnautilus-private/nautilus-icon-dnd.h>
-#include <libnautilus/nautilus-clipboard.h>
+#include <libnautilus-private/nautilus-clipboard.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/nautilus-main.c b/src/nautilus-main.c
index 4dc524e9e..63040110d 100644
--- a/src/nautilus-main.c
+++ b/src/nautilus-main.c
@@ -36,7 +36,6 @@
#include "nautilus-window.h"
#include <bonobo-activation/bonobo-activation.h>
#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-ui-main.h>
#include <dlfcn.h>
#include <eel/eel-debug.h>
#include <eel/eel-glib-extensions.h>
@@ -283,10 +282,6 @@ main (int argc, char *argv[])
/* Initialize the services that we use. */
LIBXML_TEST_VERSION
- if (g_getenv ("NAUTILUS_ENABLE_TEST_COMPONENTS") != NULL) {
- bonobo_activation_set_test_components_enabled (TRUE);
- }
-
/* Initialize preferences. This is needed so that proper
* defaults are available before any preference peeking
* happens.
@@ -345,7 +340,6 @@ main (int argc, char *argv[])
}
eel_debug_shut_down ();
- bonobo_ui_debug_shutdown ();
/* If told to restart, exec() myself again. This is used when
* the program is told to restart with CORBA, for example when
diff --git a/src/nautilus-navigation-action.c b/src/nautilus-navigation-action.c
new file mode 100644
index 000000000..9eae30f7f
--- /dev/null
+++ b/src/nautilus-navigation-action.c
@@ -0,0 +1,302 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * Nautilus
+ *
+ * Copyright (C) 2004 Red Hat, Inc.
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ *
+ * Nautilus 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.
+ *
+ * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Based on ephy-navigation-action.h from Epiphany
+ *
+ * Authors: Alexander Larsson <alexl@redhat.com>
+ * Marco Pesenti Gritti
+ *
+ */
+
+#include <config.h>
+
+#include "nautilus-navigation-action.h"
+#include "nautilus-navigation-window.h"
+
+#include <gtk/gtkimage.h>
+#include <gtk/gtkimagemenuitem.h>
+#include <gtk/gtktoolbar.h>
+#include <gtk/gtkmenutoolbutton.h>
+
+static void nautilus_navigation_action_init (NautilusNavigationAction *action);
+static void nautilus_navigation_action_class_init (NautilusNavigationActionClass *class);
+
+static GObjectClass *parent_class = NULL;
+
+#define NAUTILUS_NAVIGATION_ACTION_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), NAUTILUS_TYPE_NAVIGATION_ACTION, NautilusNavigationActionPrivate))
+
+struct NautilusNavigationActionPrivate
+{
+ NautilusNavigationWindow *window;
+ NautilusNavigationDirection direction;
+};
+
+enum
+{
+ PROP_0,
+ PROP_DIRECTION,
+ PROP_WINDOW
+};
+
+GType
+nautilus_navigation_action_get_type (void)
+{
+ static GType type = 0;
+
+ if (type == 0) {
+ static const GTypeInfo type_info = {
+ sizeof (NautilusNavigationActionClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) nautilus_navigation_action_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (NautilusNavigationAction),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) nautilus_navigation_action_init,
+ };
+
+ type = g_type_register_static (GTK_TYPE_ACTION,
+ "NautilusNavigationAction",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+static void
+activate_back_or_forward_menu_item (GtkMenuItem *menu_item,
+ NautilusNavigationWindow *window,
+ gboolean back)
+{
+ int index;
+
+ g_assert (GTK_IS_MENU_ITEM (menu_item));
+ g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+
+ index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "user_data"));
+
+ nautilus_navigation_window_back_or_forward (window, back, index);
+}
+
+static void
+activate_back_menu_item_callback (GtkMenuItem *menu_item, NautilusNavigationWindow *window)
+{
+ activate_back_or_forward_menu_item (menu_item, window, TRUE);
+}
+
+static void
+activate_forward_menu_item_callback (GtkMenuItem *menu_item, NautilusNavigationWindow *window)
+{
+ activate_back_or_forward_menu_item (menu_item, window, FALSE);
+}
+
+static void
+fill_menu (NautilusNavigationWindow *window,
+ GtkWidget *menu,
+ gboolean back)
+{
+ GtkWidget *menu_item;
+ int index;
+ GList *list;
+
+ g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+
+ list = back ? window->back_list : window->forward_list;
+ index = 0;
+ while (list != NULL) {
+ menu_item = nautilus_bookmark_menu_item_new (NAUTILUS_BOOKMARK (list->data));
+ g_object_set_data (G_OBJECT (menu_item), "user_data", GINT_TO_POINTER (index));
+ gtk_widget_show (GTK_WIDGET (menu_item));
+ g_signal_connect_object (menu_item, "activate",
+ back
+ ? G_CALLBACK (activate_back_menu_item_callback)
+ : G_CALLBACK (activate_forward_menu_item_callback),
+ window, 0);
+
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+ list = g_list_next (list);
+ ++index;
+ }
+}
+
+
+static void
+show_menu_callback (GtkMenuToolButton *button,
+ NautilusNavigationAction *action)
+{
+ NautilusNavigationActionPrivate *p;
+ NautilusNavigationWindow *window;
+ GtkWidget *menu;
+ GList *children;
+ GList *li;
+
+ p = action->priv;
+ window = action->priv->window;
+
+ menu = gtk_menu_tool_button_get_menu (button);
+
+ children = gtk_container_get_children (GTK_CONTAINER (menu));
+ for (li = children; li; li = li->next) {
+ gtk_container_remove (GTK_CONTAINER (menu), li->data);
+ }
+ g_list_free (children);
+
+ switch (p->direction) {
+ case NAUTILUS_NAVIGATION_DIRECTION_FORWARD:
+ fill_menu (window, menu, FALSE);
+ break;
+ case NAUTILUS_NAVIGATION_DIRECTION_BACK:
+ fill_menu (window, menu, TRUE);
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+}
+
+static void
+nautilus_navigation_action_sync_tooltip (GtkAction *action,
+ GParamSpec *pspec,
+ GtkWidget *proxy)
+{
+ char *tooltip;
+
+ g_return_if_fail (GTK_IS_TOOL_ITEM (proxy));
+
+ if (GTK_IS_TOOLBAR (gtk_widget_get_parent (proxy))) {
+ GtkToolbar *toolbar = GTK_TOOLBAR (gtk_widget_get_parent (proxy));
+
+ g_object_get (action, "tooltip", &tooltip, NULL);
+
+ gtk_menu_tool_button_set_arrow_tooltip (GTK_MENU_TOOL_BUTTON (proxy),
+ toolbar->tooltips,
+ tooltip,
+ NULL);
+ g_free (tooltip);
+ }
+}
+
+
+static void
+connect_proxy (GtkAction *action, GtkWidget *proxy)
+{
+ GtkWidget *menu;
+
+ if (GTK_IS_MENU_TOOL_BUTTON (proxy)) {
+ menu = gtk_menu_new ();
+ gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (proxy),
+ menu);
+ g_signal_connect_object (action, "notify::tooltip",
+ G_CALLBACK (nautilus_navigation_action_sync_tooltip),
+ proxy, 0);
+
+ g_signal_connect (proxy, "show-menu",
+ G_CALLBACK (show_menu_callback), action);
+ }
+
+ (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+}
+
+static void
+nautilus_navigation_action_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusNavigationAction *nav;
+
+ nav = NAUTILUS_NAVIGATION_ACTION (object);
+
+ switch (prop_id)
+ {
+ case PROP_DIRECTION:
+ nav->priv->direction = g_value_get_int (value);
+ break;
+ case PROP_WINDOW:
+ nav->priv->window = NAUTILUS_NAVIGATION_WINDOW (g_value_get_object (value));
+ break;
+ }
+}
+
+static void
+nautilus_navigation_action_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusNavigationAction *nav;
+
+ nav = NAUTILUS_NAVIGATION_ACTION (object);
+
+ switch (prop_id)
+ {
+ case PROP_DIRECTION:
+ g_value_set_int (value, nav->priv->direction);
+ break;
+ case PROP_WINDOW:
+ g_value_set_object (value, nav->priv->window);
+ break;
+ }
+}
+
+static void
+nautilus_navigation_action_class_init (NautilusNavigationActionClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+
+ object_class->set_property = nautilus_navigation_action_set_property;
+ object_class->get_property = nautilus_navigation_action_get_property;
+
+ parent_class = g_type_class_peek_parent (class);
+
+ action_class->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON;
+ action_class->connect_proxy = connect_proxy;
+
+ g_object_class_install_property (object_class,
+ PROP_DIRECTION,
+ g_param_spec_int ("direction",
+ "Direction",
+ "Direction",
+ 0,
+ G_MAXINT,
+ 0,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_WINDOW,
+ g_param_spec_object ("window",
+ "Window",
+ "The navigation window",
+ G_TYPE_OBJECT,
+ G_PARAM_READWRITE));
+
+ g_type_class_add_private (object_class, sizeof(NautilusNavigationActionPrivate));
+}
+
+static void
+nautilus_navigation_action_init (NautilusNavigationAction *action)
+{
+ action->priv = NAUTILUS_NAVIGATION_ACTION_GET_PRIVATE (action);
+}
+
+
diff --git a/src/nautilus-navigation-action.h b/src/nautilus-navigation-action.h
new file mode 100644
index 000000000..90b132ab1
--- /dev/null
+++ b/src/nautilus-navigation-action.h
@@ -0,0 +1,68 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * Nautilus
+ *
+ * Copyright (C) 2004 Red Hat, Inc.
+ * Copyright (C) 2003 Marco Pesenti Gritti
+ *
+ * Nautilus 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.
+ *
+ * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *
+ * Based on ephy-navigation-action.h from Epiphany
+ *
+ * Authors: Alexander Larsson <alexl@redhat.com>
+ * Marco Pesenti Gritti
+ *
+ */
+
+#ifndef NAUTILUS_NAVIGATION_ACTION_H
+#define NAUTILUS_NAVIGATION_ACTION_H
+
+#include <gtk/gtkaction.h>
+
+#define NAUTILUS_TYPE_NAVIGATION_ACTION (nautilus_navigation_action_get_type ())
+#define NAUTILUS_NAVIGATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_NAVIGATION_ACTION, NautilusNavigationAction))
+#define NAUTILUS_NAVIGATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_NAVIGATION_ACTION, NautilusNavigationActionClass))
+#define NAUTILUS_IS_NAVIGATION_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_NAVIGATION_ACTION))
+#define NAUTILUS_IS_NAVIGATION_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_NAVIGATION_ACTION))
+#define NAUTILUS_NAVIGATION_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), NAUTILUS_TYPE_NAVIGATION_ACTION, NautilusNavigationActionClass))
+
+typedef struct _NautilusNavigationAction NautilusNavigationAction;
+typedef struct _NautilusNavigationActionClass NautilusNavigationActionClass;
+typedef struct NautilusNavigationActionPrivate NautilusNavigationActionPrivate;
+
+typedef enum
+{
+ NAUTILUS_NAVIGATION_DIRECTION_BACK,
+ NAUTILUS_NAVIGATION_DIRECTION_FORWARD
+} NautilusNavigationDirection;
+
+struct _NautilusNavigationAction
+{
+ GtkAction parent;
+
+ /*< private >*/
+ NautilusNavigationActionPrivate *priv;
+};
+
+struct _NautilusNavigationActionClass
+{
+ GtkActionClass parent_class;
+};
+
+GType nautilus_navigation_action_get_type (void);
+
+#endif
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index d225c1f46..2753a084a 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -29,6 +29,8 @@
#include <locale.h>
+#include "nautilus-actions.h"
+#include "nautilus-navigation-action.h"
#include "nautilus-application.h"
#include "nautilus-bookmark-list.h"
#include "nautilus-bookmark-parsing.h"
@@ -36,10 +38,8 @@
#include "nautilus-file-management-properties.h"
#include "nautilus-property-browser.h"
#include "nautilus-signaller.h"
-#include "nautilus-switchable-navigation-bar.h"
#include "nautilus-window-manage-views.h"
#include "nautilus-window-private.h"
-#include <bonobo/bonobo-ui-util.h>
#include <eel/eel-debug.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gnome-extensions.h>
@@ -58,103 +58,44 @@
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
#include <libnautilus-private/nautilus-file-utilities.h>
+#include <libnautilus-private/nautilus-ui-utilities.h>
#include <libnautilus-private/nautilus-icon-factory.h>
#include <libnautilus-private/nautilus-undo-manager.h>
-#include <libnautilus/nautilus-bonobo-ui.h>
-#ifdef ENABLE_PROFILER
-#include "nautilus-profiler.h"
-#endif
-
-#define STATIC_BOOKMARKS_FILE_NAME "static_bookmarks.xml"
-
-/* Private menu definitions; others are in <libnautilus/nautilus-bonobo-ui.h>.
- * These are not part of the published set, either because they are
- * development-only or because we expect to change them and
- * don't want other code relying on their existence.
- */
-
-#define MENU_PATH_SHOW_HIDE_SIDEBAR "/menu/View/Show Hide Placeholder/Show Hide Sidebar"
-#define MENU_PATH_SHOW_HIDE_LOCATION_BAR "/menu/View/Show Hide Placeholder/Show Hide Location Bar"
-
-#define MENU_PATH_HISTORY_PLACEHOLDER "/menu/Go/History Placeholder"
-#define MENU_PATH_BUILT_IN_BOOKMARKS_PLACEHOLDER "/menu/Bookmarks/Built-in Bookmarks Placeholder"
-#define MENU_PATH_BOOKMARKS_PLACEHOLDER "/menu/Bookmarks/Bookmarks Placeholder"
-
-#define COMMAND_SHOW_HIDE_SIDEBAR "/commands/Show Hide Sidebar"
-#define COMMAND_SHOW_HIDE_LOCATION_BAR "/commands/Show Hide Location Bar"
-#define COMMAND_SHOW_HIDE_STATUS_BAR "/commands/Show Hide Statusbar"
-
-#define ID_SHOW_HIDE_SIDEBAR "Show Hide Sidebar"
-#define ID_SHOW_HIDE_LOCATION_BAR "Show Hide Location Bar"
+#define MENU_PATH_HISTORY_PLACEHOLDER "/MenuBar/Other Menus/Go/History Placeholder"
+#define MENU_PATH_BOOKMARKS_PLACEHOLDER "/MenuBar/Other Menus/Bookmarks/Bookmarks Placeholder"
#define RESPONSE_FORGET 1000
static GtkWindow *bookmarks_window = NULL;
static NautilusBookmarkList *bookmarks = NULL;
+static void schedule_refresh_go_menu (NautilusNavigationWindow *window);
static void append_dynamic_bookmarks (NautilusNavigationWindow *window);
-static NautilusBookmarkList *get_bookmark_list (void);
-static void refresh_bookmarks_menu (NautilusNavigationWindow *window);
static void schedule_refresh_bookmarks_menu (NautilusNavigationWindow *window);
-static void edit_bookmarks (NautilusNavigationWindow *window);
+static void refresh_bookmarks_menu (NautilusNavigationWindow *window);
static void add_bookmark_for_current_location (NautilusNavigationWindow *window);
-static void schedule_refresh_go_menu (NautilusWindow *window);
-
-#ifdef HAVE_MEDUSA
-static void
-file_menu_find_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- NautilusWindow *window;
-
- window = NAUTILUS_WINDOW (user_data);
-
- if (!window->details->updating_bonobo_state) {
- nautilus_window_show_location_bar_temporarily
- (window, TRUE);
- }
-}
-
-static void
-toolbar_toggle_find_mode_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- NautilusWindow *window;
-
- window = NAUTILUS_WINDOW (user_data);
-
- if (!window->details->updating_bonobo_state) {
- nautilus_window_show_location_bar_temporarily
- (window, !nautilus_window_get_search_mode (window));
- }
-}
-#endif
+static void edit_bookmarks (NautilusNavigationWindow *window);
+static NautilusBookmarkList *get_bookmark_list (void);
static void
-file_menu_close_all_windows_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_close_all_windows_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_application_close_all_navigation_windows ();
}
static void
-go_menu_back_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_back_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_navigation_window_go_back (NAUTILUS_NAVIGATION_WINDOW (user_data));
}
static void
-go_menu_forward_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_forward_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_navigation_window_go_forward (NAUTILUS_NAVIGATION_WINDOW (user_data));
}
@@ -208,30 +149,21 @@ forget_history_if_confirmed (NautilusWindow *window)
}
static void
-go_menu_forget_history_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_clear_history_callback (GtkAction *action,
+ gpointer user_data)
{
forget_history_if_confirmed (NAUTILUS_WINDOW (user_data));
}
static void
-view_menu_show_hide_sidebar_state_changed_callback (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+action_show_hide_sidebar_callback (GtkAction *action,
+ gpointer user_data)
{
NautilusNavigationWindow *window;
window = NAUTILUS_NAVIGATION_WINDOW (user_data);
- if (strcmp (state, "") == 0) {
- /* State goes blank when component is removed; ignore this. */
- return;
- }
-
- if (!strcmp (state, "1")) {
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
nautilus_navigation_window_show_sidebar (window);
} else {
nautilus_navigation_window_hide_sidebar (window);
@@ -239,143 +171,72 @@ view_menu_show_hide_sidebar_state_changed_callback (BonoboUIComponent *component
}
static void
-view_menu_show_hide_location_bar_state_changed_callback (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
+action_show_hide_location_bar_callback (GtkAction *action,
+ gpointer user_data)
{
NautilusNavigationWindow *window;
window = NAUTILUS_NAVIGATION_WINDOW (user_data);
- if (strcmp (state, "") == 0) {
- /* State goes blank when component is removed; ignore this. */
- return;
- }
-
- if (!strcmp (state, "1")) {
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
nautilus_navigation_window_show_location_bar (window, TRUE);
} else {
nautilus_navigation_window_hide_location_bar (window, TRUE);
}
}
+static void
+action_show_hide_statusbar_callback (GtkAction *action,
+ gpointer user_data)
+{
+ NautilusNavigationWindow *window;
+
+ window = NAUTILUS_NAVIGATION_WINDOW (user_data);
+
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
+ nautilus_navigation_window_show_status_bar (window);
+ } else {
+ nautilus_navigation_window_hide_status_bar (window);
+ }
+}
+
void
nautilus_navigation_window_update_show_hide_menu_items (NautilusNavigationWindow *window)
{
- g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
-
- nautilus_window_ui_freeze (NAUTILUS_WINDOW (window));
+ GtkAction *action;
- bonobo_ui_component_freeze (NAUTILUS_WINDOW (window)->details->shell_ui, NULL);
-
- nautilus_bonobo_set_toggle_state (NAUTILUS_WINDOW (window)->details->shell_ui,
- COMMAND_SHOW_HIDE_SIDEBAR,
- nautilus_navigation_window_sidebar_showing (window));
- nautilus_bonobo_set_toggle_state (NAUTILUS_WINDOW (window)->details->shell_ui,
- COMMAND_SHOW_HIDE_LOCATION_BAR,
- nautilus_navigation_window_location_bar_showing (window));
+ g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
- bonobo_ui_component_thaw (NAUTILUS_WINDOW (window)->details->shell_ui,
- NULL);
+ action = gtk_action_group_get_action (window->details->navigation_action_group,
+ NAUTILUS_ACTION_SHOW_HIDE_SIDEBAR);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ nautilus_navigation_window_sidebar_showing (window));
+
+ action = gtk_action_group_get_action (window->details->navigation_action_group,
+ NAUTILUS_ACTION_SHOW_HIDE_LOCATION_BAR);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ nautilus_navigation_window_location_bar_showing (window));
- nautilus_window_ui_thaw (NAUTILUS_WINDOW (window));
+ action = gtk_action_group_get_action (window->details->navigation_action_group,
+ NAUTILUS_ACTION_SHOW_HIDE_STATUSBAR);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ nautilus_navigation_window_status_bar_showing (window));
}
static void
-bookmarks_menu_add_bookmark_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_add_bookmark_callback (GtkAction *action,
+ gpointer user_data)
{
add_bookmark_for_current_location (NAUTILUS_NAVIGATION_WINDOW (user_data));
}
static void
-bookmarks_menu_edit_bookmarks_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_edit_bookmarks_callback (GtkAction *action,
+ gpointer user_data)
{
edit_bookmarks (NAUTILUS_NAVIGATION_WINDOW (user_data));
}
-#ifdef WEB_NAVIGATION_ENABLED
-static char *
-get_static_bookmarks_file_path (void)
-{
- char *update_xml_file_path, *built_in_xml_file_path;
- char *update_uri, *built_in_uri;
- char *user_directory_path;
- gboolean update_exists, built_in_exists;
- GnomeVFSFileInfo *update_info, *built_in_info;
- char *result;
-
- /* see if there is a static bookmarks file in the updates directory and get its mod-date */
- user_directory_path = nautilus_get_user_directory ();
- update_xml_file_path = g_strdup_printf ("%s/updates/%s", user_directory_path, STATIC_BOOKMARKS_FILE_NAME);
- update_exists = g_file_test (update_xml_file_path, G_FILE_TEST_EXISTS);
- g_free (user_directory_path);
-
- /* get the mod date of the built-in static bookmarks file */
- built_in_xml_file_path = g_build_filename (NAUTILUS_DATADIR, STATIC_BOOKMARKS_FILE_NAME, NULL);
- built_in_exists = g_file_test (built_in_xml_file_path, G_FILE_TEST_EXISTS);
-
- /* if we only have one file, return its path as the one to use */
- if (built_in_exists && !update_exists) {
- g_free (update_xml_file_path);
- return built_in_xml_file_path;
- }
-
- if (!built_in_exists && update_exists) {
- g_free (built_in_xml_file_path);
- return update_xml_file_path;
- }
-
- /* if we have neither file, return NULL */
- if (!built_in_exists && !update_exists) {
- g_free (built_in_xml_file_path);
- g_free (update_xml_file_path);
- return NULL;
- }
-
- /* both files exist, so use the one with the most recent mod-date */
- update_uri = gnome_vfs_get_uri_from_local_path (update_xml_file_path);
- update_info = gnome_vfs_file_info_new ();
- gnome_vfs_get_file_info (update_uri, update_info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- g_free (update_uri);
-
- built_in_uri = gnome_vfs_get_uri_from_local_path (built_in_xml_file_path);
- built_in_info = gnome_vfs_file_info_new ();
- gnome_vfs_get_file_info (built_in_uri, built_in_info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- g_free (built_in_uri);
-
- /* see which is most recent */
- if (update_info->mtime <= built_in_info->mtime) {
- result = built_in_xml_file_path;
- g_free (update_xml_file_path);
- } else {
- result = update_xml_file_path;
- g_free (built_in_xml_file_path);
- }
-
- gnome_vfs_file_info_unref (update_info);
- gnome_vfs_file_info_unref (built_in_info);
-
- return result;
-}
-#endif
-
-static void
-append_separator (NautilusNavigationWindow *window, const char *path)
-{
- nautilus_window_ui_freeze (NAUTILUS_WINDOW (window));
-
- nautilus_bonobo_add_menu_separator
- (NAUTILUS_WINDOW (window)->details->shell_ui, path);
-
- nautilus_window_ui_thaw (NAUTILUS_WINDOW (window));
-}
-
static void
free_bookmark_list (void)
{
@@ -445,93 +306,6 @@ show_bogus_bookmark_window (NautilusWindow *window,
g_free (detail);
}
-static void
-create_menu_item_from_node (NautilusNavigationWindow *window,
- xmlNodePtr node,
- const char *menu_path,
- int *index)
-{
- NautilusBookmark *bookmark;
- xmlChar *xml_folder_name;
- int sub_index;
- char *sub_menu_path, *escaped_name;
-
- g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
-
- if (node->type != XML_ELEMENT_NODE) {
- return;
- }
-
- nautilus_window_ui_freeze (NAUTILUS_WINDOW (window));
-
- if (strcmp (node->name, "bookmark") == 0) {
- bookmark = nautilus_bookmark_new_from_node (node);
- nautilus_menus_append_bookmark_to_menu
- (NAUTILUS_WINDOW (window),
- NAUTILUS_WINDOW (window)->details->shell_ui,
- bookmark,
- menu_path,
- *index,
- G_CALLBACK (schedule_refresh_bookmarks_menu),
- show_bogus_bookmark_window);
- g_object_unref (bookmark);
- } else if (strcmp (node->name, "separator") == 0) {
- append_separator (window, menu_path);
- } else if (strcmp (node->name, "folder") == 0) {
- xml_folder_name = eel_xml_get_property_translated (node, "name");
- nautilus_bonobo_add_submenu (NAUTILUS_WINDOW (window)->details->shell_ui, menu_path, xml_folder_name, NULL);
-
- /* Construct path and make sure it is escaped properly */
- escaped_name = gnome_vfs_escape_string (xml_folder_name);
- sub_menu_path = g_strdup_printf ("%s/%s", menu_path, escaped_name);
- g_free (escaped_name);
-
- for (node = eel_xml_get_children (node), sub_index = 0;
- node != NULL;
- node = node->next) {
- create_menu_item_from_node (window, node, sub_menu_path, &sub_index);
- }
- g_free (sub_menu_path);
- xmlFree (xml_folder_name);
- } else {
- g_warning ("found unknown node '%s', ignoring", node->name);
- }
-
- (*index)++;
-
- nautilus_window_ui_thaw (NAUTILUS_WINDOW (window));
-}
-
-#ifdef WEB_NAVIGATION_ENABLED
-static void
-append_static_bookmarks (NautilusWindow *window, const char *menu_path)
-{
- xmlDocPtr doc;
- xmlNodePtr node;
- char *file_path;
- int index;
-
- /* Walk through XML tree creating bookmarks, folders, and separators. */
- file_path = get_static_bookmarks_file_path ();
-
- if (file_path == NULL) {
- return;
- }
-
- doc = xmlParseFile (file_path);
- g_free (file_path);
-
- node = eel_xml_get_root_children (doc);
- index = 0;
-
- for (index = 0; node != NULL; node = node->next) {
- create_menu_item_from_node (window, node, menu_path, &index);
- }
-
- xmlFreeDoc(doc);
-}
-#endif
-
static GtkWindow *
get_or_create_bookmarks_window (GObject *undo_manager_source)
{
@@ -582,12 +356,6 @@ edit_bookmarks (NautilusNavigationWindow *window)
gtk_window_present (dialog);
}
-void
-nautilus_window_bookmarks_preference_changed_callback (gpointer user_data)
-{
- refresh_bookmarks_menu (NAUTILUS_NAVIGATION_WINDOW (user_data));
-}
-
static void
refresh_bookmarks_menu (NautilusNavigationWindow *window)
{
@@ -596,22 +364,8 @@ refresh_bookmarks_menu (NautilusNavigationWindow *window)
/* Unregister any pending call to this function. */
nautilus_navigation_window_remove_bookmarks_menu_callback (window);
- g_object_ref (G_OBJECT (window));
- bonobo_ui_component_freeze
- (NAUTILUS_WINDOW (window)->details->shell_ui, NULL);
-
nautilus_navigation_window_remove_bookmarks_menu_items (window);
-
-#ifdef WEB_NAVIGATION_ENABLED
- if (!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_HIDE_BUILT_IN_BOOKMARKS)) {
- append_static_bookmarks (window, MENU_PATH_BUILT_IN_BOOKMARKS_PLACEHOLDER);
- }
-#endif
-
append_dynamic_bookmarks (window);
-
- bonobo_ui_component_thaw (NAUTILUS_WINDOW (window)->details->shell_ui, NULL);
- g_object_unref (G_OBJECT (window));
}
/**
@@ -628,14 +382,6 @@ nautilus_navigation_window_initialize_bookmarks_menu (NautilusNavigationWindow *
/* Construct the initial set of bookmarks. */
refresh_bookmarks_menu (window);
- /* Recreate static & dynamic part of menu if preference about
- * showing static bookmarks changes.
- */
- eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_HIDE_BUILT_IN_BOOKMARKS,
- nautilus_window_bookmarks_preference_changed_callback,
- window,
- G_OBJECT (window));
-
/* Recreate dynamic part of menu if bookmark list changes */
g_signal_connect_object (get_bookmark_list (), "contents_changed",
G_CALLBACK (schedule_refresh_bookmarks_menu),
@@ -648,7 +394,7 @@ nautilus_navigation_window_initialize_bookmarks_menu (NautilusNavigationWindow *
}
void
-nautilus_window_remove_go_menu_callback (NautilusWindow *window)
+nautilus_navigation_window_remove_go_menu_callback (NautilusNavigationWindow *window)
{
if (window->details->refresh_go_menu_idle_id != 0) {
g_source_remove (window->details->refresh_go_menu_idle_id);
@@ -657,15 +403,21 @@ nautilus_window_remove_go_menu_callback (NautilusWindow *window)
}
void
-nautilus_window_remove_go_menu_items (NautilusWindow *window)
+nautilus_navigation_window_remove_go_menu_items (NautilusNavigationWindow *window)
{
- nautilus_window_ui_freeze (window);
-
- nautilus_bonobo_remove_menu_items_and_commands
- (window->details->shell_ui,
- MENU_PATH_HISTORY_PLACEHOLDER);
-
- nautilus_window_ui_thaw (window);
+ GtkUIManager *ui_manager;
+
+ ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
+ if (window->details->go_menu_merge_id != 0) {
+ gtk_ui_manager_remove_ui (ui_manager,
+ window->details->go_menu_merge_id);
+ window->details->go_menu_merge_id = 0;
+ }
+ if (window->details->go_menu_action_group != NULL) {
+ gtk_ui_manager_remove_action_group (ui_manager,
+ window->details->go_menu_action_group);
+ window->details->go_menu_action_group = NULL;
+ }
}
/**
@@ -675,53 +427,61 @@ nautilus_window_remove_go_menu_items (NautilusWindow *window)
* @window: The NautilusWindow whose Go menu will be refreshed.
**/
static void
-refresh_go_menu (NautilusWindow *window)
+refresh_go_menu (NautilusNavigationWindow *window)
{
+ GtkUIManager *ui_manager;
GList *node;
int index;
- g_assert (NAUTILUS_IS_WINDOW (window));
+ g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
/* Unregister any pending call to this function. */
- nautilus_window_remove_go_menu_callback (window);
-
- bonobo_ui_component_freeze (window->details->shell_ui, NULL);
+ nautilus_navigation_window_remove_go_menu_callback (window);
/* Remove old set of history items. */
- nautilus_window_remove_go_menu_items (window);
+ nautilus_navigation_window_remove_go_menu_items (window);
+
+ ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
+
+ window->details->go_menu_merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ window->details->go_menu_action_group = gtk_action_group_new ("GoMenuGroup");
+
+ gtk_ui_manager_insert_action_group (ui_manager,
+ window->details->go_menu_action_group,
+ -1);
+
/* Add in a new set of history items. */
for (node = nautilus_get_history_list (), index = 0;
node != NULL && index < 10;
node = node->next, index++) {
nautilus_menus_append_bookmark_to_menu
- (window,
- window->details->shell_ui,
+ (NAUTILUS_WINDOW (window),
NAUTILUS_BOOKMARK (node->data),
MENU_PATH_HISTORY_PLACEHOLDER,
index,
+ window->details->go_menu_action_group,
+ window->details->go_menu_merge_id,
G_CALLBACK (schedule_refresh_go_menu),
show_bogus_bookmark_window);
}
-
- bonobo_ui_component_thaw (window->details->shell_ui, NULL);
}
static gboolean
refresh_go_menu_idle_callback (gpointer data)
{
- g_assert (NAUTILUS_IS_WINDOW (data));
+ g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (data));
- refresh_go_menu (NAUTILUS_WINDOW (data));
+ refresh_go_menu (NAUTILUS_NAVIGATION_WINDOW (data));
/* Don't call this again (unless rescheduled) */
return FALSE;
}
static void
-schedule_refresh_go_menu (NautilusWindow *window)
+schedule_refresh_go_menu (NautilusNavigationWindow *window)
{
- g_assert (NAUTILUS_IS_WINDOW (window));
+ g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
if (window->details->refresh_go_menu_idle_id == 0) {
window->details->refresh_go_menu_idle_id
@@ -747,67 +507,150 @@ nautilus_navigation_window_initialize_go_menu (NautilusNavigationWindow *window)
G_CALLBACK (schedule_refresh_go_menu), window, G_CONNECT_SWAPPED);
}
-/**
- * nautilus_window_initialize_menus
- *
- * Create and install the set of menus for this window.
- * @window: A recently-created NautilusWindow.
- */
-void
-nautilus_navigation_window_initialize_menus_part_1 (NautilusNavigationWindow *navigation_window)
+static void
+action_new_window_callback (GtkAction *action,
+ gpointer user_data)
{
- NautilusWindow *window;
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("Close All Windows", file_menu_close_all_windows_callback),
-#ifdef HAVE_MEDUSA
- BONOBO_UI_VERB ("Find", file_menu_find_callback),
- BONOBO_UI_VERB ("Toggle Find Mode", toolbar_toggle_find_mode_callback),
-#endif
- BONOBO_UI_VERB ("Back", go_menu_back_callback),
- BONOBO_UI_VERB ("Forward", go_menu_forward_callback),
- BONOBO_UI_VERB ("Clear History", go_menu_forget_history_callback),
- BONOBO_UI_VERB ("Add Bookmark", bookmarks_menu_add_bookmark_callback),
- BONOBO_UI_VERB ("Edit Bookmarks", bookmarks_menu_edit_bookmarks_callback),
-
- BONOBO_UI_VERB_END
- };
-
- window = NAUTILUS_WINDOW (navigation_window);
-
- nautilus_window_ui_freeze (window);
+ NautilusWindow *current_window;
+ NautilusWindow *new_window;
- bonobo_ui_component_freeze (window->details->shell_ui, NULL);
-
- nautilus_navigation_window_update_show_hide_menu_items (navigation_window);
+ current_window = NAUTILUS_WINDOW (user_data);
+ new_window = nautilus_application_create_navigation_window (
+ current_window->application,
+ gtk_window_get_screen (GTK_WINDOW (current_window)));
+ nautilus_window_go_home (new_window);
+}
- bonobo_ui_component_add_verb_list_with_data (window->details->shell_ui,
- verbs, window);
+static void
+action_go_to_location_callback (GtkAction *action,
+ gpointer user_data)
+{
+ NautilusWindow *window;
- bonobo_ui_component_add_listener
- (window->details->shell_ui,
- ID_SHOW_HIDE_SIDEBAR,
- view_menu_show_hide_sidebar_state_changed_callback,
- window);
- bonobo_ui_component_add_listener
- (window->details->shell_ui,
- ID_SHOW_HIDE_LOCATION_BAR,
- view_menu_show_hide_location_bar_state_changed_callback,
- window);
+ window = NAUTILUS_WINDOW (user_data);
- bonobo_ui_component_thaw (window->details->shell_ui, NULL);
+ nautilus_window_prompt_for_location (window);
+}
+
+static GtkActionEntry navigation_entries[] = {
+ { "Go", NULL, N_("_Go") }, /* name, stock id, label */
+ { "Bookmarks", NULL, N_("_Bookmarks") }, /* name, stock id, label */
+ { "New Window", NULL, N_("Open New _Window"), /* name, stock id, label */
+ "<control>N", N_("Open another Nautilus window for the displayed location"),
+ G_CALLBACK (action_new_window_callback) },
+ { "Close All Windows", NULL, N_("Close _All Windows"), /* name, stock id, label */
+ "<control><shift>W", N_("Close all Navigation windows"),
+ G_CALLBACK (action_close_all_windows_callback) },
+ { "Go to Location", NULL, N_("_Location..."), /* name, stock id, label */
+ "<control>L", N_("Specify a location to open"),
+ G_CALLBACK (action_go_to_location_callback) },
+ { "Clear History", NULL, N_("_Clear History"), /* name, stock id, label */
+ NULL, N_("Clear contents of Go menu and Back/Forward lists"),
+ G_CALLBACK (action_clear_history_callback) },
+ { "Add Bookmark", GTK_STOCK_ADD, N_("_Add Bookmark"), /* name, stock id, label */
+ "<control>d", N_("Add a bookmark for the current location to this menu"),
+ G_CALLBACK (action_add_bookmark_callback) },
+ { "Edit Bookmarks", NULL, N_("_Edit Bookmarks"), /* name, stock id, label */
+ "<control>b", N_("Display a window that allows editing the bookmarks in this menu"),
+ G_CALLBACK (action_edit_bookmarks_callback) },
+};
+
+static GtkToggleActionEntry navigation_toggle_entries[] = {
+ { "Show Hide Sidebar", NULL, /* name, stock id */
+ N_("_Side Pane"), "F9", /* label, accelerator */
+ N_("Change the visibility of this window's sidebar"), /* tooltip */
+ G_CALLBACK (action_show_hide_sidebar_callback),
+ TRUE}, /* is_active */
+ { "Show Hide Location Bar", NULL, /* name, stock id */
+ N_("Location _Bar"), NULL, /* label, accelerator */
+ N_("Change the visibility of this window's location bar"), /* tooltip */
+ G_CALLBACK (action_show_hide_location_bar_callback),
+ TRUE }, /* is_active */
+ { "Show Hide Statusbar", NULL, /* name, stock id */
+ N_("St_atusbar"), NULL, /* label, accelerator */
+ N_("Change the visibility of this window's statusbar"), /* tooltip */
+ G_CALLBACK (action_show_hide_statusbar_callback),
+ TRUE }, /* is_active */
+};
- nautilus_window_ui_thaw (window);
+void
+nautilus_navigation_window_initialize_actions (NautilusNavigationWindow *window)
+{
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+ GtkAction *action;
+
+ action_group = gtk_action_group_new ("NavigationActions");
+ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+ window->details->navigation_action_group = action_group;
+ gtk_action_group_add_actions (action_group,
+ navigation_entries, G_N_ELEMENTS (navigation_entries),
+ window);
+ gtk_action_group_add_toggle_actions (action_group,
+ navigation_toggle_entries, G_N_ELEMENTS (navigation_toggle_entries),
+ window);
+
+ action = g_object_new (NAUTILUS_TYPE_NAVIGATION_ACTION,
+ "name", "Back",
+ "label", _("_Back"),
+ "stock_id", GTK_STOCK_GO_BACK,
+ "tooltip", _("Go to the previous visited location"),
+ "window", window,
+ "direction", NAUTILUS_NAVIGATION_DIRECTION_BACK,
+ "is_important", TRUE,
+ NULL);
+ g_signal_connect (action, "activate",
+ G_CALLBACK (action_back_callback), window);
+ gtk_action_group_add_action_with_accel (action_group,
+ action,
+ "<alt>Left");
+ g_object_unref (action);
+
+ action = g_object_new (NAUTILUS_TYPE_NAVIGATION_ACTION,
+ "name", "Forward",
+ "label", _("_Forward"),
+ "stock_id", GTK_STOCK_GO_FORWARD,
+ "tooltip", _("Go to the next visited location"),
+ "window", window,
+ "direction", NAUTILUS_NAVIGATION_DIRECTION_FORWARD,
+ "is_important", TRUE,
+ NULL);
+ g_signal_connect (action, "activate",
+ G_CALLBACK (action_forward_callback), window);
+ gtk_action_group_add_action_with_accel (action_group,
+ action,
+ "<alt>Right");
+ g_object_unref (action);
+
+ ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
+
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ g_object_unref (action_group); /* owned by ui_manager */
}
+
+/**
+ * nautilus_window_initialize_menus
+ *
+ * Create and install the set of menus for this window.
+ * @window: A recently-created NautilusWindow.
+ */
void
-nautilus_navigation_window_initialize_menus_part_2 (NautilusNavigationWindow *window)
+nautilus_navigation_window_initialize_menus (NautilusNavigationWindow *window)
{
- nautilus_window_ui_freeze (NAUTILUS_WINDOW (window));
+ GtkUIManager *ui_manager;
+ const char *ui;
+
+ ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
+
+ ui = nautilus_ui_string_get ("nautilus-navigation-window-ui.xml");
+ gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
+
+ nautilus_navigation_window_update_show_hide_menu_items (window);
nautilus_navigation_window_initialize_go_menu (window);
nautilus_navigation_window_initialize_bookmarks_menu (window);
- nautilus_window_ui_thaw (NAUTILUS_WINDOW (window));
}
void
@@ -822,16 +665,19 @@ nautilus_navigation_window_remove_bookmarks_menu_callback (NautilusNavigationWin
void
nautilus_navigation_window_remove_bookmarks_menu_items (NautilusNavigationWindow *window)
{
- nautilus_window_ui_freeze (NAUTILUS_WINDOW (window));
-
- nautilus_bonobo_remove_menu_items_and_commands
- (NAUTILUS_WINDOW (window)->details->shell_ui,
- MENU_PATH_BUILT_IN_BOOKMARKS_PLACEHOLDER);
- nautilus_bonobo_remove_menu_items_and_commands
- (NAUTILUS_WINDOW (window)->details->shell_ui,
- MENU_PATH_BOOKMARKS_PLACEHOLDER);
-
- nautilus_window_ui_thaw (NAUTILUS_WINDOW (window));
+ GtkUIManager *ui_manager;
+
+ ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
+ if (window->details->bookmarks_merge_id != 0) {
+ gtk_ui_manager_remove_ui (ui_manager,
+ window->details->bookmarks_merge_id);
+ window->details->bookmarks_merge_id = 0;
+ }
+ if (window->details->bookmarks_action_group != NULL) {
+ gtk_ui_manager_remove_action_group (ui_manager,
+ window->details->bookmarks_action_group);
+ window->details->bookmarks_action_group = NULL;
+ }
}
static void
@@ -840,20 +686,33 @@ append_dynamic_bookmarks (NautilusNavigationWindow *window)
NautilusBookmarkList *bookmarks;
guint bookmark_count;
guint index;
-
+ GtkUIManager *ui_manager;
+
g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+ g_assert (window->details->bookmarks_merge_id == 0);
+ g_assert (window->details->bookmarks_action_group == NULL);
bookmarks = get_bookmark_list ();
+ ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
+
+ window->details->bookmarks_merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ window->details->bookmarks_action_group = gtk_action_group_new ("BookmarksGroup");
+
+ gtk_ui_manager_insert_action_group (ui_manager,
+ window->details->bookmarks_action_group,
+ -1);
+
/* append new set of bookmarks */
bookmark_count = nautilus_bookmark_list_length (bookmarks);
for (index = 0; index < bookmark_count; ++index) {
nautilus_menus_append_bookmark_to_menu
(NAUTILUS_WINDOW (window),
- NAUTILUS_WINDOW (window)->details->shell_ui,
nautilus_bookmark_list_item_at (bookmarks, index),
MENU_PATH_BOOKMARKS_PLACEHOLDER,
index,
+ window->details->bookmarks_action_group,
+ window->details->bookmarks_merge_id,
G_CALLBACK (schedule_refresh_bookmarks_menu),
show_bogus_bookmark_window);
}
@@ -881,3 +740,5 @@ schedule_refresh_bookmarks_menu (NautilusNavigationWindow *window)
window);
}
}
+
+
diff --git a/src/nautilus-navigation-window-ui.xml b/src/nautilus-navigation-window-ui.xml
index 5a453b14f..9cbf9099c 100644
--- a/src/nautilus-navigation-window-ui.xml
+++ b/src/nautilus-navigation-window-ui.xml
@@ -1,189 +1,61 @@
-<Root>
-
-<!-- A description of each placeholder's purpose is in libnautilus/nautilus-bonobo-ui.h -->
-
-<commands>
- <!-- We define commands here for (at least) all the items
- for which we share tip or sensitivity state between more
- than one item (usually 1 menuitem and 1 toolitem.
- -->
-
- <cmd name="Back" accel="*Alt*Left"
- _tip="Go to the previous visited location"/>
- <cmd name="Forward" accel="*Alt*Right"
- _tip="Go to the next visited location"/>
- <cmd name="Find"
- _tip="Search this computer for files"/>
- <cmd name="Toggle Find Mode"
- _label="Find"
- _tip="Search this computer for files"/>
-</commands>
-
-<menu>
- <submenu name="File">
+<ui>
+<menubar name="MenuBar">
+ <menu action="File">
<placeholder name="New Items Placeholder">
- <menuitem name="New Window"
- _label="Open New _Window"
- _tip="Open another Nautilus window for the displayed location"
- accel="*Control*N"
- verb="New Window"/>
+ <menuitem name="New Window" action="New Window"/>
</placeholder>
- <placeholder name="Location Placeholder">
- <menuitem name="Connect to Server"
- _label="Connect to _Server..."
- verb="Connect to Server"/>
- </placeholder>
<placeholder name="Close Items Placeholder">
- <menuitem name="Close All Windows"
- _label="Close _All Windows"
- _tip="Close all Navigation windows"
- accel="*Control**Shift*w"
- verb="Close All Windows"/>
+ <menuitem name="Close All Windows" action="Close All Windows"/>
</placeholder>
- </submenu>
- <submenu name="View" _label="_View">
- <placeholder name="Show Hide Placeholder" delimit="top">
- <menuitem name="Show Hide Sidebar"
- type="toggle"
- _label="_Side Pane"
- _tip="Change the visibility of this window's sidebar"
- accel="F9"
- id="Show Hide Sidebar"/>
- <menuitem name="Show Hide Location Bar"
- type="toggle"
- _label="Location _Bar"
- _tip="Change the visibility of this window's location bar"
- id="Show Hide Location Bar"/>
- <menuitem name="Show Hide Statusbar"
- type="toggle"
- _label="St_atusbar"
- _tip="Change the visibility of this window's statusbar"
- id="Show Hide Statusbar"/>
+ </menu>
+ <menu action="View">
+ <placeholder name="Show Hide Placeholder">
+ <menuitem name="Show Hide Sidebar" action="Show Hide Sidebar"/>
+ <menuitem name="Show Hide Location Bar" action="Show Hide Location Bar"/>
+ <menuitem name="Show Hide Statusbar" action="Show Hide Statusbar"/>
</placeholder>
- </submenu>
-
- <submenu name="Go" _label="_Go">
- <placeholder name="Navigation Items">
- <menuitem name="Up"
- _label="_Up"
- accel="*Alt*Up"
- pixtype="stock" pixname="gtk-go-up"
- verb="Up"/>
- <menuitem name="Back"
- _label="_Back"
- pixtype="stock" pixname="gtk-go-back"
- verb="Back"/>
- <menuitem name="Forward"
- _label="_Forward"
- pixtype="stock" pixname="gtk-go-forward"
- verb="Forward"/>
- </placeholder>
- <separator/>
- <menuitem name="Home"
- _label="_Home"
- accel="*Alt*Home"
- pixtype="stock" pixname="gtk-home"
- verb="Home"/>
- <menuitem name="Computer"
- _label="_Computer"
- pixtype="stock" pixname="gnome-fs-client"
- verb="Go to Computer"/>
- <menuitem name="Go to Templates"
- _label="_Templates"
- _tip="Go to templates folder"
- verb="Go to Templates"/>
- <menuitem name="Go to Trash"
- _label="_Trash"
- _tip="Go to the trash folder"
- verb="Go to Trash"/>
- <menuitem name="Go to Burn CD"
- _label="CD _Creator"
- _tip="Go to the CD/DVD Creator"
- verb="Go to Burn CD"/>
- <menuitem name="Go to Location"
- _label="_Location..."
- accel="*Control*l"
- verb="Go to Location"/>
-
- <separator/>
-
- <menuitem name="Clear History"
- _label="_Clear History"
- _tip="Clear contents of Go menu and Back/Forward lists"
- verb="Clear History"/>
-
- <placeholder name="History Placeholder" delimit="top"/>
- </submenu>
-
- <submenu name="Bookmarks" _label="_Bookmarks">
- <menuitem name="Add Bookmark"
- _label="_Add Bookmark"
- _tip="Add a bookmark for the current location to this menu"
- accel="*Control*d"
- pixtype="stock" pixname="gtk-add"
- verb="Add Bookmark"/>
- <menuitem name="Edit Bookmarks"
- _label="_Edit Bookmarks"
- _tip="Display a window that allows editing the bookmarks in this menu"
- accel="*Control*b"
- verb="Edit Bookmarks"/>
-
- <placeholder name="Built-in Bookmarks Placeholder" delimit="top"/>
- <placeholder name="Bookmarks Placeholder" delimit="top"/>
- </submenu>
-</menu>
-
-<dockitem name="Location Bar" behavior="exclusive,never vertical">
- <control name="Wrapper" behavior="expandable"/>
-</dockitem>
-
-<dockitem name="Toolbar" behavior="exclusive">
-
- <toolitem name="Back"
- _label="Back"
- priority="1"
- pixtype="stock" pixname="gtk-go-back"
- verb="Back"/>
- <control name="BackMenu"/>
- <toolitem name="Forward"
- _label="Forward"
- pixtype="stock" pixname="gtk-go-forward"
- verb="Forward"/>
- <control name="ForwardMenu"/>
- <toolitem name="Up"
- _label="Up"
- pixtype="stock" pixname="gtk-go-up"
- verb="Up"/>
- <toolitem name="Stop" _label="Stop"
- pixtype="stock" pixname="gtk-stop"
- verb="Stop"/>
- <toolitem name="Reload"
- _label="Reload"
- pixtype="stock" pixname="gtk-refresh"
- verb="Reload"/>
+ </menu>
+ <placeholder name="Other Menus">
+ <menu action="Go">
+ <placeholder name="Navigation Items">
+ <menuitem name="Up" action="Up"/>
+ <menuitem name="Back" action="Back"/>
+ <menuitem name="Forward" action="Forward"/>
+ </placeholder>
+ <separator/>
+ <menuitem name="Home" action="Home"/>
+ <menuitem name="Computer" action="Go to Computer"/>
+ <menuitem name="Go to Templates" action="Go to Templates"/>
+ <menuitem name="Go to Trash" action="Go to Trash"/>
+ <menuitem name="Go to Burn CD" action="Go to Burn CD"/>
+ <menuitem name="Go to Location" action="Go to Location"/>
+ <separator/>
+ <menuitem name="Clear History" action="Clear History"/>
+ <separator/>
+ <placeholder name="History Placeholder"/>
+ </menu>
+ <menu action="Bookmarks">
+ <menuitem name="Add Bookmark" action="Add Bookmark"/>
+ <menuitem name="Edit Bookmark" action="Edit Bookmarks"/>
+ <separator/>
+ <placeholder name="Bookmarks Placeholder"/>
+ </menu>
+ </placeholder>
+</menubar>
+<toolbar name="Toolbar">
+ <toolitem name="Back" action="Back"/>
+ <toolitem name="Forward" action="Forward"/>
+
+ <toolitem name="Up" action="Up"/>
+ <toolitem name="Stop" action="Stop"/>
+ <toolitem name="Reload" action="Reload"/>
<separator/>
+ <toolitem name="Home" action="Home"/>
+ <toolitem name="Computer" action="Go to Computer"/>
- <toolitem name="Home"
- _label="Home"
- priority="1"
- pixtype="stock" pixname="gtk-home"
- verb="Home"/>
- <toolitem name="Computer"
- _label="Computer"
- priority="1"
- pixtype="stock" pixname="gnome-fs-client"
- verb="Go to Computer"/>
- <toolitem name="Toggle Find Mode"
- priority="1"
- type="toggle"
- pixtype="stock" pixname="Search"
- verb="Toggle Find Mode"/>
-
- <placeholder name="Extra Buttons Placeholder" delimit="top">
+ <placeholder name="Extra Buttons Placeholder">
<placeholder name="Extension Actions"/>
</placeholder>
- <control name="SpaceWrapper" behavior="expandable"/>
- <control name="ThrobberWrapper" behavior="pack-end"/>
-</dockitem>
-</Root>
+</toolbar>
+</ui>
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index 7d3fc26b3..96a931ce2 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -31,17 +31,14 @@
#include <config.h>
#include "nautilus-window-private.h"
+#include "nautilus-actions.h"
#include "nautilus-application.h"
#include "nautilus-bookmarks-window.h"
-#include "nautilus-information-panel.h"
#include "nautilus-main.h"
#include "nautilus-signaller.h"
-#include "nautilus-switchable-navigation-bar.h"
+#include "nautilus-location-bar.h"
#include "nautilus-window-manage-views.h"
#include "nautilus-zoom-control.h"
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-property-bag-client.h>
-#include <bonobo/bonobo-ui-util.h>
#include <eel/eel-accessibility.h>
#include <eel/eel-debug.h>
#include <eel/eel-gdk-extensions.h>
@@ -56,6 +53,7 @@
#include <gtk/gtkmenubar.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkoptionmenu.h>
+#include <gtk/gtktoolbar.h>
#include <gtk/gtktogglebutton.h>
#include <gtk/gtkvbox.h>
#include <libgnome/gnome-i18n.h>
@@ -66,8 +64,6 @@
#include <libgnomeui/gnome-window-icon.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
-#include <libnautilus-private/nautilus-drag-window.h>
#include <libnautilus-private/nautilus-file-utilities.h>
#include <libnautilus-private/nautilus-file-attributes.h>
#include <libnautilus-private/nautilus-global-preferences.h>
@@ -76,11 +72,13 @@
#include <libnautilus-private/nautilus-metadata.h>
#include <libnautilus-private/nautilus-mime-actions.h>
#include <libnautilus-private/nautilus-program-choosing.h>
-#include <libnautilus-private/nautilus-sidebar-functions.h>
+#include <libnautilus-private/nautilus-sidebar.h>
#include <libnautilus-private/nautilus-theme.h>
-#include <libnautilus/nautilus-bonobo-ui.h>
-#include <libnautilus/nautilus-clipboard.h>
-#include <libnautilus/nautilus-undo.h>
+#include <libnautilus-private/nautilus-view-factory.h>
+#include <libnautilus-private/nautilus-clipboard.h>
+#include <libnautilus-private/nautilus-undo.h>
+#include <libnautilus-private/nautilus-module.h>
+#include <libnautilus-private/nautilus-sidebar-provider.h>
#include <math.h>
#include <sys/time.h>
@@ -96,16 +94,6 @@
#define MAX_TITLE_LENGTH 180
-/* dock items */
-#define LOCATION_BAR_PATH "/Location Bar"
-#define TOOLBAR_PATH "/Toolbar"
-#define MENU_BAR_PATH "/menu"
-
-#define NAUTILUS_COMMAND_TOGGLE_FIND_MODE "/commands/Toggle Find Mode"
-
-#define COMMAND_PATH_TOGGLE_FIND_MODE "/commands/Find"
-#define COMMAND_PATH_TOGGLE_FIND_MODE_WITH_STATE "/commands/Toggle Find Mode"
-
enum {
ARG_0,
ARG_APP_ID,
@@ -114,12 +102,14 @@ enum {
static int side_pane_width_auto_value = SIDE_PANE_MINIMUM_WIDTH;
-static void add_sidebar_panels (NautilusNavigationWindow *window);
-static void load_view_as_menu (NautilusWindow *window);
-static void side_panel_view_loaded_callback (NautilusViewFrame *view,
- gpointer user_data);
-static void side_panel_view_failed_callback (NautilusViewFrame *view,
- gpointer user_data);
+static void add_sidebar_panels (NautilusNavigationWindow *window);
+static void load_view_as_menu (NautilusWindow *window);
+static void side_panel_image_changed_callback (NautilusSidebar *side_panel,
+ gpointer callback_data);
+static void navigation_bar_location_changed_callback (GtkWidget *widget,
+ const char *uri,
+ NautilusNavigationWindow *window);
+
GNOME_CLASS_BOILERPLATE (NautilusNavigationWindow, nautilus_navigation_window,
NautilusWindow, NAUTILUS_TYPE_WINDOW)
@@ -127,6 +117,12 @@ GNOME_CLASS_BOILERPLATE (NautilusNavigationWindow, nautilus_navigation_window,
static void
nautilus_navigation_window_instance_init (NautilusNavigationWindow *window)
{
+ GtkUIManager *ui_manager;
+ GtkWidget *toolbar;
+ GtkWidget *location_bar;
+ GtkWidget *view_as_menu_vbox;
+ GtkToolItem *item;
+
window->details = g_new0 (NautilusNavigationWindowDetails, 1);
window->details->tooltips = gtk_tooltips_new ();
@@ -134,33 +130,106 @@ nautilus_navigation_window_instance_init (NautilusNavigationWindow *window)
gtk_object_sink (GTK_OBJECT (window->details->tooltips));
window->details->content_paned = nautilus_horizontal_splitter_new ();
+ gtk_table_attach (GTK_TABLE (NAUTILUS_WINDOW (window)->details->table),
+ window->details->content_paned,
+ /* X direction */ /* Y direction */
+ 0, 1, 3, 4,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
+ 0, 0);
gtk_widget_show (window->details->content_paned);
- bonobo_window_set_contents (BONOBO_WINDOW (window), window->details->content_paned);
-}
-static void
-file_menu_new_window_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- NautilusWindow *window = NAUTILUS_WINDOW (user_data);
+ nautilus_navigation_window_initialize_actions (window);
+ nautilus_navigation_window_initialize_menus (window);
- const gchar *uri = nautilus_window_get_location (window);
+ ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
+ toolbar = gtk_ui_manager_get_widget (ui_manager, "/Toolbar");
+ window->details->toolbar = toolbar;
+ gtk_table_attach (GTK_TABLE (NAUTILUS_WINDOW (window)->details->table),
+ toolbar,
+ /* X direction */ /* Y direction */
+ 0, 1, 1, 2,
+ GTK_EXPAND | GTK_FILL, 0,
+ 0, 0);
+ gtk_widget_show (toolbar);
- window = nautilus_application_create_navigation_window (window->application,
- gtk_window_get_screen (GTK_WINDOW (window)));
+ nautilus_navigation_window_initialize_toolbars (window);
- nautilus_window_open_location (window, uri, FALSE);
-}
+ /* Set initial sensitivity of some buttons & menu items
+ * now that they're all created.
+ */
+ nautilus_navigation_window_allow_back (window, FALSE);
+ nautilus_navigation_window_allow_forward (window, FALSE);
-static void
-go_to_callback (GtkWidget *widget,
- const char *uri,
- NautilusNavigationWindow *window)
-{
- g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
+ /* set up location bar */
+ location_bar = gtk_toolbar_new ();
+ window->details->location_bar = location_bar;
+
+ window->navigation_bar = nautilus_location_bar_new (window);
+ gtk_widget_show (GTK_WIDGET (window->navigation_bar));
- nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
+ g_signal_connect_object (window->navigation_bar, "location_changed",
+ G_CALLBACK (navigation_bar_location_changed_callback), window, 0);
+
+
+ item = gtk_tool_item_new ();
+ gtk_container_set_border_width (GTK_CONTAINER (item), GNOME_PAD_SMALL);
+ gtk_widget_show (GTK_WIDGET (item));
+ gtk_tool_item_set_expand (item, TRUE);
+ gtk_container_add (GTK_CONTAINER (item), window->navigation_bar);
+ gtk_toolbar_insert (GTK_TOOLBAR (location_bar),
+ item, -1);
+
+ /* Option menu for content view types; it's empty here, filled in when a uri is set.
+ * Pack it into vbox so it doesn't grow vertically when location bar does.
+ */
+ view_as_menu_vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
+ gtk_widget_show (view_as_menu_vbox);
+
+ item = gtk_tool_item_new ();
+ gtk_container_set_border_width (GTK_CONTAINER (item), GNOME_PAD_SMALL);
+ gtk_widget_show (GTK_WIDGET (item));
+ gtk_container_add (GTK_CONTAINER (item), view_as_menu_vbox);
+ gtk_toolbar_insert (GTK_TOOLBAR (location_bar),
+ item, -1);
+
+ window->view_as_option_menu = gtk_option_menu_new ();
+ gtk_box_pack_end (GTK_BOX (view_as_menu_vbox), window->view_as_option_menu, TRUE, FALSE, 0);
+ gtk_widget_show (window->view_as_option_menu);
+
+ /* Allocate the zoom control and place on the right next to the menu.
+ * It gets shown later, if the view-frame contains something zoomable.
+ */
+ window->zoom_control = nautilus_zoom_control_new ();
+ g_signal_connect_object (window->zoom_control, "zoom_in",
+ G_CALLBACK (nautilus_window_zoom_in),
+ window, G_CONNECT_SWAPPED);
+ g_signal_connect_object (window->zoom_control, "zoom_out",
+ G_CALLBACK (nautilus_window_zoom_out),
+ window, G_CONNECT_SWAPPED);
+ g_signal_connect_object (window->zoom_control, "zoom_to_level",
+ G_CALLBACK (nautilus_window_zoom_to_level),
+ window, G_CONNECT_SWAPPED);
+ g_signal_connect_object (window->zoom_control, "zoom_to_default",
+ G_CALLBACK (nautilus_window_zoom_to_default),
+ window, G_CONNECT_SWAPPED);
+
+ item = gtk_tool_item_new ();
+ gtk_container_set_border_width (GTK_CONTAINER (item), GNOME_PAD_SMALL);
+ gtk_widget_show (GTK_WIDGET (item));
+ gtk_container_add (GTK_CONTAINER (item), window->zoom_control);
+ gtk_toolbar_insert (GTK_TOOLBAR (location_bar),
+ item, 1);
+
+ gtk_widget_show (location_bar);
+
+ gtk_table_attach (GTK_TABLE (NAUTILUS_WINDOW (window)->details->table),
+ location_bar,
+ /* X direction */ /* Y direction */
+ 0, 1, 2, 3,
+ GTK_EXPAND | GTK_FILL, 0,
+ 0, 0);
+
+
}
static void
@@ -181,27 +250,6 @@ navigation_bar_location_changed_callback (GtkWidget *widget,
}
static void
-navigation_bar_mode_changed_callback (GtkWidget *widget,
- NautilusSwitchableNavigationBarMode mode,
- NautilusNavigationWindow *window)
-{
- NAUTILUS_WINDOW (window)->details->updating_bonobo_state = TRUE;
-
- g_assert (mode == NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION
- || mode == NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH);
-
- nautilus_window_ui_freeze (NAUTILUS_WINDOW (window));
-
- nautilus_bonobo_set_toggle_state (NAUTILUS_WINDOW (window)->details->shell_ui,
- NAUTILUS_COMMAND_TOGGLE_FIND_MODE,
- mode == NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH);
-
- NAUTILUS_WINDOW (window)->details->updating_bonobo_state = FALSE;
-
- nautilus_window_ui_thaw (NAUTILUS_WINDOW (window));
-}
-
-static void
side_pane_close_requested_callback (GtkWidget *widget,
gpointer user_data)
{
@@ -255,67 +303,41 @@ setup_side_pane_width (NautilusNavigationWindow *window)
}
static void
-side_panel_set_open (GtkWidget *view,
- gboolean open)
-{
- CORBA_Environment ev;
- Bonobo_PropertyBag property_bag;
- Bonobo_Control control;
-
- if (!view || !NAUTILUS_IS_VIEW_FRAME (view)) {
- return;
- }
-
- control = nautilus_view_frame_get_control (NAUTILUS_VIEW_FRAME (view));
-
- if (control != CORBA_OBJECT_NIL) {
- CORBA_exception_init (&ev);
- property_bag = Bonobo_Control_getProperties (control, &ev);
- if (!BONOBO_EX (&ev) && property_bag != CORBA_OBJECT_NIL) {
- /* For some reason this was implemented as 'close'
- * before, but open seems more natural */
- bonobo_property_bag_client_set_value_gboolean
- (property_bag, "close", !open, &ev);
- bonobo_object_release_unref (property_bag, NULL);
- }
- }
-}
-
-static void
set_current_side_panel (NautilusNavigationWindow *window,
- GtkWidget *panel)
+ NautilusSidebar *panel)
{
if (window->details->current_side_panel) {
- side_panel_set_open (window->details->current_side_panel,
- FALSE);
+ nautilus_sidebar_is_visible_changed (window->details->current_side_panel,
+ FALSE);
eel_remove_weak_pointer (&window->details->current_side_panel);
}
- side_panel_set_open (panel, TRUE);
+ if (panel != NULL) {
+ nautilus_sidebar_is_visible_changed (panel, TRUE);
+ }
window->details->current_side_panel = panel;
eel_add_weak_pointer (&window->details->current_side_panel);
}
static void
side_pane_switch_page_callback (NautilusSidePane *side_pane,
- GtkWidget *panel,
+ GtkWidget *widget,
NautilusNavigationWindow *window)
{
- const char *view_iid;
+ const char *id;
+ NautilusSidebar *sidebar;
- set_current_side_panel (window, panel);
+ sidebar = NAUTILUS_SIDEBAR (widget);
- if (NAUTILUS_IS_VIEW_FRAME (panel)) {
- view_iid = nautilus_view_frame_get_view_iid (NAUTILUS_VIEW_FRAME (panel));
- if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_SIDE_PANE_VIEW)) {
- eel_preferences_set (NAUTILUS_PREFERENCES_SIDE_PANE_VIEW,
- view_iid);
- }
+ if (sidebar == NULL) {
+ return;
+ }
- } else {
- if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_SIDE_PANE_VIEW)) {
- eel_preferences_set (NAUTILUS_PREFERENCES_SIDE_PANE_VIEW, "");
- }
+ set_current_side_panel (window, sidebar);
+
+ id = nautilus_sidebar_get_sidebar_id (sidebar);
+ if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_SIDE_PANE_VIEW)) {
+ eel_preferences_set (NAUTILUS_PREFERENCES_SIDE_PANE_VIEW, id);
}
}
@@ -334,23 +356,6 @@ nautilus_navigation_window_set_up_sidebar (NautilusNavigationWindow *window)
G_CALLBACK (side_pane_size_allocate_callback),
window);
- window->information_panel = nautilus_information_panel_new ();
-
- if (NAUTILUS_WINDOW (window)->details->location != NULL &&
- NAUTILUS_WINDOW (window)->details->title != NULL) {
- nautilus_information_panel_set_uri (window->information_panel,
- NAUTILUS_WINDOW (window)->details->location,
- NAUTILUS_WINDOW (window)->details->title);
- }
-
- g_signal_connect_object (window->information_panel, "location_changed",
- G_CALLBACK (go_to_callback), window, 0);
-
- /* Set up the sidebar panels. */
- nautilus_side_pane_add_panel (NAUTILUS_SIDE_PANE (window->sidebar),
- GTK_WIDGET (window->information_panel),
- _("Information"));
-
add_sidebar_panels (window);
g_signal_connect (window->sidebar,
@@ -363,22 +368,30 @@ nautilus_navigation_window_set_up_sidebar (NautilusNavigationWindow *window)
G_CALLBACK (side_pane_switch_page_callback),
window);
- gtk_widget_show (GTK_WIDGET (window->information_panel));
-
gtk_widget_show (GTK_WIDGET (window->sidebar));
}
static void
nautilus_navigation_window_tear_down_sidebar (NautilusNavigationWindow *window)
{
+ GList *node, *next;
+ NautilusSidebar *sidebar_panel;
+
g_signal_handlers_disconnect_by_func (window->sidebar,
side_pane_switch_page_callback,
window);
-
- nautilus_navigation_window_set_sidebar_panels (window, NULL);
+
+ for (node = window->sidebar_panels; node != NULL; node = next) {
+ next = node->next;
+
+ sidebar_panel = NAUTILUS_SIDEBAR (node->data);
+
+ nautilus_navigation_window_remove_sidebar_panel (window,
+ sidebar_panel);
+ }
+
gtk_widget_destroy (GTK_WIDGET (window->sidebar));
window->sidebar = NULL;
- window->information_panel = NULL;
}
static void
@@ -388,11 +401,6 @@ nautilus_navigation_window_unrealize (GtkWidget *widget)
window = NAUTILUS_NAVIGATION_WINDOW (widget);
- if (window->details->throbber_property_bag != CORBA_OBJECT_NIL) {
- bonobo_object_release_unref (window->details->throbber_property_bag, NULL);
- window->details->throbber_property_bag = CORBA_OBJECT_NIL;
- }
-
GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
}
@@ -404,7 +412,7 @@ nautilus_navigation_window_destroy (GtkObject *object)
window = NAUTILUS_NAVIGATION_WINDOW (object);
window->sidebar = NULL;
- eel_g_object_list_free (window->sidebar_panels);
+ g_list_foreach (window->sidebar_panels, (GFunc)g_object_unref, NULL);
window->sidebar_panels = NULL;
window->view_as_option_menu = NULL;
@@ -429,6 +437,7 @@ nautilus_navigation_window_finalize (GObject *object)
window = NAUTILUS_NAVIGATION_WINDOW (object);
nautilus_navigation_window_remove_bookmarks_menu_callback (window);
+ nautilus_navigation_window_remove_go_menu_callback (window);
nautilus_navigation_window_clear_back_list (window);
nautilus_navigation_window_clear_forward_list (window);
@@ -443,47 +452,62 @@ nautilus_navigation_window_finalize (GObject *object)
void
nautilus_navigation_window_add_sidebar_panel (NautilusNavigationWindow *window,
- NautilusViewFrame *sidebar_panel)
+ NautilusSidebar *sidebar_panel)
{
+ const char *sidebar_id;
char *label;
- const char *view_iid;
- char *default_iid;
+ char *default_id;
+ GdkPixbuf *icon;
g_return_if_fail (NAUTILUS_IS_NAVIGATION_WINDOW (window));
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (sidebar_panel));
+ g_return_if_fail (NAUTILUS_IS_SIDEBAR (sidebar_panel));
g_return_if_fail (NAUTILUS_IS_SIDE_PANE (window->sidebar));
g_return_if_fail (g_list_find (window->sidebar_panels, sidebar_panel) == NULL);
- label = nautilus_view_frame_get_label (sidebar_panel);
-
+ label = nautilus_sidebar_get_tab_label (sidebar_panel);
nautilus_side_pane_add_panel (window->sidebar,
GTK_WIDGET (sidebar_panel),
label);
g_free (label);
+ icon = nautilus_sidebar_get_tab_icon (sidebar_panel);
+ nautilus_side_pane_set_panel_image (NAUTILUS_NAVIGATION_WINDOW (window)->sidebar,
+ GTK_WIDGET (sidebar_panel),
+ icon);
+ if (icon) {
+ g_object_unref (icon);
+ }
+
+ g_signal_connect (sidebar_panel, "tab_icon_changed",
+ (GCallback)side_panel_image_changed_callback, window);
+
+
g_object_ref (sidebar_panel);
window->sidebar_panels = g_list_prepend (window->sidebar_panels, sidebar_panel);
- view_iid = nautilus_view_frame_get_view_iid (sidebar_panel);
- default_iid = eel_preferences_get (NAUTILUS_PREFERENCES_SIDE_PANE_VIEW);
- if (view_iid && default_iid && !strcmp (view_iid, default_iid)) {
+ /* Show if default */
+ sidebar_id = nautilus_sidebar_get_sidebar_id (sidebar_panel);
+ default_id = eel_preferences_get (NAUTILUS_PREFERENCES_SIDE_PANE_VIEW);
+ if (sidebar_id && default_id && !strcmp (sidebar_id, default_id)) {
nautilus_side_pane_show_panel (window->sidebar,
GTK_WIDGET (sidebar_panel));
}
-
- g_free (default_iid);
+ g_free (default_id);
}
void
-nautilus_navigation_window_remove_sidebar_panel (NautilusNavigationWindow *window, NautilusViewFrame *sidebar_panel)
+nautilus_navigation_window_remove_sidebar_panel (NautilusNavigationWindow *window,
+ NautilusSidebar *sidebar_panel)
{
g_return_if_fail (NAUTILUS_IS_NAVIGATION_WINDOW (window));
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (sidebar_panel));
+ g_return_if_fail (NAUTILUS_IS_SIDEBAR (sidebar_panel));
if (g_list_find (window->sidebar_panels, sidebar_panel) == NULL) {
return;
}
+
+ g_signal_handlers_disconnect_by_func (sidebar_panel, side_panel_image_changed_callback, window);
nautilus_side_pane_remove_panel (window->sidebar,
GTK_WIDGET (sidebar_panel));
@@ -504,36 +528,11 @@ nautilus_navigation_window_go_forward (NautilusNavigationWindow *window)
}
void
-nautilus_navigation_window_set_search_mode (NautilusNavigationWindow *window,
- gboolean search_mode)
-{
- nautilus_switchable_navigation_bar_set_mode
- (NAUTILUS_SWITCHABLE_NAVIGATION_BAR (window->navigation_bar),
- search_mode
- ? NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH
- : NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION);
-}
-
-gboolean
-nautilus_navigation_window_get_search_mode (NautilusNavigationWindow *window)
-{
- return nautilus_switchable_navigation_bar_get_mode
- (NAUTILUS_SWITCHABLE_NAVIGATION_BAR (window->navigation_bar))
- == NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH;
-}
-
-void
nautilus_navigation_window_go_home (NautilusNavigationWindow *window)
{
char *home_uri;
- nautilus_navigation_window_set_search_mode (window, FALSE);
-
-#ifdef WEB_NAVIGATION_ENABLED
- home_uri = eel_preferences_get (NAUTILUS_PREFERENCES_HOME_URI);
-#else
home_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
-#endif
g_assert (home_uri != NULL);
nautilus_window_go_to (NAUTILUS_WINDOW (window), home_uri);
@@ -543,34 +542,23 @@ nautilus_navigation_window_go_home (NautilusNavigationWindow *window)
void
nautilus_navigation_window_allow_back (NautilusNavigationWindow *window, gboolean allow)
{
- nautilus_window_ui_freeze (NAUTILUS_WINDOW (window));
+ GtkAction *action;
- nautilus_bonobo_set_sensitive (NAUTILUS_WINDOW (window)->details->shell_ui,
- NAUTILUS_COMMAND_BACK, allow);
- /* Have to handle non-standard Back button explicitly (it's
- * non-standard to support right-click menu).
- */
- gtk_widget_set_sensitive
- (GTK_WIDGET (window->details->back_button_item), allow);
-
- nautilus_window_ui_thaw (NAUTILUS_WINDOW (window));
+ action = gtk_action_group_get_action (window->details->navigation_action_group,
+ NAUTILUS_ACTION_BACK);
+
+ gtk_action_set_sensitive (action, allow);
}
void
nautilus_navigation_window_allow_forward (NautilusNavigationWindow *window, gboolean allow)
{
- nautilus_window_ui_freeze (NAUTILUS_WINDOW (window));
+ GtkAction *action;
- nautilus_bonobo_set_sensitive (NAUTILUS_WINDOW (window)->details->shell_ui,
- NAUTILUS_COMMAND_FORWARD, allow);
-
- /* Have to handle non-standard Forward button explicitly (it's
- * non-standard to support right-click menu).
- */
- gtk_widget_set_sensitive
- (GTK_WIDGET (window->details->forward_button_item), allow);
-
- nautilus_window_ui_thaw (NAUTILUS_WINDOW (window));
+ action = gtk_action_group_get_action (window->details->navigation_action_group,
+ NAUTILUS_ACTION_FORWARD);
+
+ gtk_action_set_sensitive (action, allow);
}
static void
@@ -613,13 +601,16 @@ view_as_menu_switch_views_callback (GtkWidget *widget, gpointer data)
static GtkWidget *
create_view_as_menu_item (NautilusWindow *window,
- NautilusViewIdentifier *identifier,
+ const char *identifier,
guint index)
{
GtkWidget *menu_item;
char *menu_label;
+ const NautilusViewInfo *info;
+
+ info = nautilus_view_factory_lookup (identifier);
- menu_label = g_strdup (_(identifier->view_as_label));
+ menu_label = g_strdup_printf (_("View as %s"), _(info->label));
menu_item = gtk_menu_item_new_with_mnemonic (menu_label);
g_free (menu_label);
@@ -649,24 +640,20 @@ load_view_as_menu (NautilusWindow *window)
for (node = window->details->short_list_viewers, index = 0;
node != NULL;
node = node->next, ++index) {
- /* Menu item in option menu. This doesn't use Bonobo, for various
- * historical and technical reasons.
- */
menu_item = create_view_as_menu_item (window, node->data, index);
gtk_menu_shell_append (GTK_MENU_SHELL (new_menu), menu_item);
- if (nautilus_window_content_view_matches_iid (NAUTILUS_WINDOW (window), ((NautilusViewIdentifier *)node->data)->iid)) {
+ if (nautilus_window_content_view_matches_iid (NAUTILUS_WINDOW (window), (char *)node->data)) {
selected_index = index;
}
}
if (selected_index == -1) {
- NautilusViewIdentifier *id;
+ const char *id;
/* We're using an extra viewer, add a menu item for it */
id = nautilus_window_get_content_view_id (window);
menu_item = create_view_as_menu_item (window, id, index);
- nautilus_view_identifier_free (id);
gtk_menu_shell_append (GTK_MENU_SHELL (new_menu), menu_item);
selected_index = index;
@@ -698,149 +685,17 @@ real_set_title (NautilusWindow *window, const char *title)
EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
set_title, (window, title));
+
full_title = g_strdup_printf (_("File Browser: %s"), title);
window_title = eel_str_middle_truncate (full_title, MAX_TITLE_LENGTH);
gtk_window_set_title (GTK_WINDOW (window), window_title);
g_free (window_title);
g_free (full_title);
-
- if (NAUTILUS_NAVIGATION_WINDOW (window)->information_panel) {
- nautilus_information_panel_set_title
- (NAUTILUS_NAVIGATION_WINDOW (window)->information_panel, title);
- }
}
static void
-real_merge_menus (NautilusWindow *nautilus_window)
-{
- NautilusNavigationWindow *window;
- GtkWidget *location_bar_box;
- GtkWidget *view_as_menu_vbox;
- BonoboControl *location_bar_wrapper;
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("New Window", file_menu_new_window_callback),
- BONOBO_UI_VERB_END
- };
-
- EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
- merge_menus, (nautilus_window));
-
- window = NAUTILUS_NAVIGATION_WINDOW (nautilus_window);
-
- bonobo_ui_util_set_ui (NAUTILUS_WINDOW (window)->details->shell_ui,
- DATADIR,
- "nautilus-navigation-window-ui.xml",
- "nautilus", NULL);
-
- bonobo_ui_component_freeze
- (NAUTILUS_WINDOW (window)->details->shell_ui, NULL);
-
- bonobo_ui_component_add_verb_list_with_data (nautilus_window->details->shell_ui,
- verbs, window);
-
- nautilus_navigation_window_initialize_menus_part_1 (window);
- nautilus_navigation_window_initialize_toolbars (window);
-
- /* Set initial sensitivity of some buttons & menu items
- * now that they're all created.
- */
- nautilus_navigation_window_allow_back (window, FALSE);
- nautilus_navigation_window_allow_forward (window, FALSE);
-
- /* set up location bar */
- location_bar_box = gtk_hbox_new (FALSE, GNOME_PAD);
- gtk_container_set_border_width (GTK_CONTAINER (location_bar_box), GNOME_PAD_SMALL);
-
- window->navigation_bar = nautilus_switchable_navigation_bar_new (window);
- gtk_widget_show (GTK_WIDGET (window->navigation_bar));
-
- g_signal_connect_object (window->navigation_bar, "location_changed",
- G_CALLBACK (navigation_bar_location_changed_callback), window, 0);
- g_signal_connect_object (window->navigation_bar, "mode_changed",
- G_CALLBACK (navigation_bar_mode_changed_callback), window, 0);
-
- gtk_box_pack_start (GTK_BOX (location_bar_box), window->navigation_bar,
- TRUE, TRUE, GNOME_PAD_SMALL);
-
- /* Option menu for content view types; it's empty here, filled in when a uri is set.
- * Pack it into vbox so it doesn't grow vertically when location bar does.
- */
- view_as_menu_vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
- gtk_widget_show (view_as_menu_vbox);
- gtk_box_pack_end (GTK_BOX (location_bar_box), view_as_menu_vbox, FALSE, FALSE, 0);
-
- window->view_as_option_menu = gtk_option_menu_new ();
- gtk_box_pack_end (GTK_BOX (view_as_menu_vbox), window->view_as_option_menu, TRUE, FALSE, 0);
- gtk_widget_show (window->view_as_option_menu);
-
- /* Allocate the zoom control and place on the right next to the menu.
- * It gets shown later, if the view-frame contains something zoomable.
- */
- window->zoom_control = nautilus_zoom_control_new ();
- g_signal_connect_object (window->zoom_control, "zoom_in",
- G_CALLBACK (nautilus_window_zoom_in),
- window, G_CONNECT_SWAPPED);
- g_signal_connect_object (window->zoom_control, "zoom_out",
- G_CALLBACK (nautilus_window_zoom_out),
- window, G_CONNECT_SWAPPED);
- g_signal_connect_object (window->zoom_control, "zoom_to_level",
- G_CALLBACK (nautilus_window_zoom_to_level),
- window, G_CONNECT_SWAPPED);
- g_signal_connect_object (window->zoom_control, "zoom_to_fit",
- G_CALLBACK (nautilus_window_zoom_to_fit),
- window, G_CONNECT_SWAPPED);
- gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0);
-
- gtk_widget_show (location_bar_box);
-
- /* Wrap the location bar in a control and set it up. */
- location_bar_wrapper = bonobo_control_new (location_bar_box);
- bonobo_ui_component_object_set (NAUTILUS_WINDOW (window)->details->shell_ui,
- "/Location Bar/Wrapper",
- BONOBO_OBJREF (location_bar_wrapper),
- NULL);
-
- bonobo_object_unref (location_bar_wrapper);
-
-
-#ifndef HAVE_MEDUSA
- /* Hide medusa menu items if medusa is not installed */
- nautilus_bonobo_set_hidden (NAUTILUS_WINDOW (window)->details->shell_ui,
- COMMAND_PATH_TOGGLE_FIND_MODE,
- TRUE);
- nautilus_bonobo_set_hidden (NAUTILUS_WINDOW (window)->details->shell_ui,
- COMMAND_PATH_TOGGLE_FIND_MODE_WITH_STATE,
- TRUE);
- /* Also set these items insensitive so that keyboard shortcuts do not trigger
- warnings */
- nautilus_bonobo_set_sensitive (NAUTILUS_WINDOW (window)->details->shell_ui,
- COMMAND_PATH_TOGGLE_FIND_MODE,
- FALSE);
- nautilus_bonobo_set_sensitive (NAUTILUS_WINDOW (window)->details->shell_ui,
- COMMAND_PATH_TOGGLE_FIND_MODE_WITH_STATE,
- FALSE);
-#endif
-
- bonobo_ui_component_thaw (NAUTILUS_WINDOW (window)->details->shell_ui,
- NULL);
-}
-
-static void
-real_merge_menus_2 (NautilusWindow *nautilus_window)
-{
- NautilusNavigationWindow *window;
-
- EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
- merge_menus_2, (nautilus_window));
-
- window = NAUTILUS_NAVIGATION_WINDOW (nautilus_window);
-
- nautilus_navigation_window_initialize_menus_part_2 (window);
-}
-
-static void
-zoom_level_changed_callback (NautilusViewFrame *view,
+zoom_level_changed_callback (NautilusView *view,
NautilusNavigationWindow *window)
{
g_assert (NAUTILUS_IS_WINDOW (window));
@@ -849,72 +704,24 @@ zoom_level_changed_callback (NautilusViewFrame *view,
* a zooming operation.
*/
nautilus_zoom_control_set_zoom_level (NAUTILUS_ZOOM_CONTROL (window->zoom_control),
- nautilus_view_frame_get_zoom_level (view));
-}
-
-static void
-zoom_parameters_changed_callback (NautilusViewFrame *view,
- NautilusNavigationWindow *window)
-{
- g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
-
- /* This callback is invoked via the "zoom_parameters_changed"
- * signal of the BonoboZoomableFrame.
- *
- * You can rely upon this callback being called in the following
- * situations:
- *
- * - a zoomable component has been set in the NautilusViewFrame;
- * in this case nautilus_view_frame_set_to_component() emits the
- * "zoom_parameters_changed" signal after creating the
- * BonoboZoomableFrame and binding it to the Bonobo::Zoomable.
- *
- * This means that we can use the following call to
- * nautilus_zoom_control_set_parameters() to display the zoom
- * control when a new zoomable component has been loaded.
- *
- * - a new file has been loaded by the zoomable component; this is
- * not 100% guaranteed since it's up to the component to emit this
- * signal, but I consider it "good behaviour" of a component to
- * emit this signal after loading a new file.
- */
-
- nautilus_zoom_control_set_parameters
- (NAUTILUS_ZOOM_CONTROL (window->zoom_control),
- nautilus_view_frame_get_min_zoom_level (view),
- nautilus_view_frame_get_max_zoom_level (view),
- nautilus_view_frame_get_has_min_zoom_level (view),
- nautilus_view_frame_get_has_max_zoom_level (view),
- nautilus_view_frame_get_preferred_zoom_levels (view));
-
- /* "zoom_parameters_changed" always implies "zoom_level_changed",
- * but you won't get both signals, so we need to pass it down.
- */
- zoom_level_changed_callback (view, window);
+ nautilus_view_get_zoom_level (view));
}
static void
-connect_view (NautilusNavigationWindow *window, NautilusViewFrame *view)
+connect_view (NautilusNavigationWindow *window, NautilusView *view)
{
- g_signal_connect (view, "zoom_parameters_changed",
- G_CALLBACK (zoom_parameters_changed_callback),
- window);
g_signal_connect (view, "zoom_level_changed",
G_CALLBACK (zoom_level_changed_callback),
window);
}
static void
-disconnect_view (NautilusNavigationWindow *window, NautilusViewFrame *view)
+disconnect_view (NautilusNavigationWindow *window, NautilusView *view)
{
if (!view) {
return;
}
- g_signal_handlers_disconnect_by_func
- (G_OBJECT (view),
- G_CALLBACK (zoom_parameters_changed_callback),
- window);
g_signal_handlers_disconnect_by_func
(view,
G_CALLBACK (zoom_level_changed_callback),
@@ -923,7 +730,7 @@ disconnect_view (NautilusNavigationWindow *window, NautilusViewFrame *view)
static void
real_set_content_view_widget (NautilusWindow *nautilus_window,
- NautilusViewFrame *new_view)
+ NautilusView *new_view)
{
NautilusNavigationWindow *window;
@@ -946,7 +753,7 @@ real_set_content_view_widget (NautilusWindow *nautilus_window,
NAUTILUS_HORIZONTAL_SPLITTER (window->details->content_paned),
GTK_WIDGET (new_view));
- if (new_view != NULL && nautilus_view_frame_get_is_zoomable (new_view)) {
+ if (new_view != NULL && nautilus_view_supports_zooming (new_view)) {
gtk_widget_show (window->zoom_control);
} else {
gtk_widget_hide (window->zoom_control);
@@ -977,18 +784,14 @@ nautilus_navigation_window_show_location_bar_temporarily (NautilusNavigationWind
nautilus_navigation_window_show_location_bar (window, FALSE);
window->details->temporary_navigation_bar = TRUE;
}
- nautilus_navigation_window_set_search_mode
- (window, in_search_mode);
- nautilus_switchable_navigation_bar_activate
- (NAUTILUS_SWITCHABLE_NAVIGATION_BAR (window->navigation_bar));
+ nautilus_navigation_bar_activate
+ (NAUTILUS_NAVIGATION_BAR (window->navigation_bar));
}
static void
real_prompt_for_location (NautilusWindow *window)
{
- if (!window->details->updating_bonobo_state) {
- nautilus_navigation_window_show_location_bar_temporarily (NAUTILUS_NAVIGATION_WINDOW (window), FALSE);
- }
+ nautilus_navigation_window_show_location_bar_temporarily (NAUTILUS_NAVIGATION_WINDOW (window), FALSE);
}
void
@@ -1005,252 +808,22 @@ nautilus_navigation_window_clear_back_list (NautilusNavigationWindow *window)
window->back_list = NULL;
}
-static int
-compare_view_identifier_with_iid (gconstpointer passed_view_identifier,
- gconstpointer passed_iid)
-{
- return strcmp (((NautilusViewIdentifier *) passed_view_identifier)->iid,
- (char *) passed_iid);
-}
-
-static void
-disconnect_and_destroy_sidebar_panel (NautilusNavigationWindow *window,
- NautilusViewFrame *view)
-{
- g_object_ref (view);
-
- g_signal_handlers_disconnect_by_func
- (view,
- G_CALLBACK (side_panel_view_failed_callback),
- window);
- g_signal_handlers_disconnect_by_func
- (view,
- G_CALLBACK (side_panel_view_loaded_callback),
- window);
-
- nautilus_window_disconnect_extra_view (NAUTILUS_WINDOW (window), view);
- nautilus_navigation_window_remove_sidebar_panel (window, view);
- gtk_object_destroy (GTK_OBJECT (view));
- g_object_unref (view);
-}
-
static void
-set_side_panel_image (NautilusWindow *window,
- NautilusViewFrame *side_panel,
- const char *image_name)
-{
- GdkPixbuf *pixbuf;
- char *image_path;
-
- pixbuf = NULL;
-
- if (image_name && image_name[0]) {
- image_path = nautilus_theme_get_image_path (image_name);
- if (image_path) {
- pixbuf = gdk_pixbuf_new_from_file (image_path, NULL);
- g_free (image_path);
- }
- }
-
- nautilus_side_pane_set_panel_image (NAUTILUS_NAVIGATION_WINDOW (window)->sidebar,
- GTK_WIDGET (side_panel),
- pixbuf);
-
- if (pixbuf) {
- g_object_unref (pixbuf);
- }
-}
-
-static void
-side_panel_image_changed_callback (BonoboListener *listener,
- const char *event_name,
- const CORBA_any *arg,
- CORBA_Environment *ev,
+side_panel_image_changed_callback (NautilusSidebar *side_panel,
gpointer callback_data)
{
- NautilusViewFrame *side_panel;
NautilusWindow *window;
+ GdkPixbuf *icon;
- side_panel = NAUTILUS_VIEW_FRAME (callback_data);
- window = NAUTILUS_WINDOW (g_object_get_data (G_OBJECT (side_panel),
- "nautilus-window"));
-
- set_side_panel_image (window, side_panel, BONOBO_ARG_GET_STRING (arg));
-}
-
-static void
-report_side_panel_failure_to_user (NautilusWindow *window, NautilusViewFrame *view_frame)
-{
- char *message;
- char *detail;
- char *label;
-
- label = nautilus_window_get_view_frame_label (view_frame);
-
- if (label == NULL) {
- message = g_strdup
- (_("One of the side panels encountered an error and can't continue."));
- detail = _("Unfortunately I couldn't tell which one.");
- } else {
- message = g_strdup_printf
- (_("The %s side panel encountered an error and can't continue."), label);
- detail = _("If this keeps happening, you might want to turn this panel off.");
- }
-
- eel_show_error_dialog (message, detail, _("Side Panel Failed"), GTK_WINDOW (window));
-
- g_free (label);
- g_free (message);
-}
-
-static void
-side_panel_view_failed_callback (NautilusViewFrame *view,
- gpointer user_data)
-{
- NautilusWindow *window;
- const char *current_iid;
-
- g_warning ("A view failed. The UI will handle this with a dialog but this should be debugged.");
-
- window = NAUTILUS_WINDOW (user_data);
-
- report_side_panel_failure_to_user (window, view);
- current_iid = nautilus_view_frame_get_view_iid (view);
- disconnect_and_destroy_sidebar_panel (NAUTILUS_NAVIGATION_WINDOW (window), view);
-}
-
-static void
-connect_side_panel (NautilusWindow *window,
- NautilusViewFrame *side_panel)
-{
- Bonobo_Control control;
- Bonobo_PropertyBag property_bag;
- CORBA_Environment ev;
- char *image_name;
-
- g_object_set_data (G_OBJECT (side_panel),
- "nautilus-window",
- window);
-
- control = nautilus_view_frame_get_control (side_panel);
-
- g_signal_connect_object (side_panel,
- "failed",
- G_CALLBACK (side_panel_view_failed_callback),
- window, 0);
+ window = NAUTILUS_WINDOW (callback_data);
- if (control != CORBA_OBJECT_NIL) {
- CORBA_exception_init (&ev);
- property_bag = Bonobo_Control_getProperties (control, &ev);
- if (property_bag != CORBA_OBJECT_NIL) {
- bonobo_event_source_client_add_listener
- (property_bag,
- side_panel_image_changed_callback,
- "Bonobo/Property:change:tab_image",
- NULL,
- side_panel);
-
- /* Set the initial tab image */
- image_name = bonobo_property_bag_client_get_value_string
- (property_bag,
- "tab_image",
- NULL);
- set_side_panel_image (window, side_panel, image_name);
- g_free (image_name);
-
- bonobo_object_release_unref (property_bag, NULL);
- }
- CORBA_exception_free (&ev);
- }
-}
-
-static void
-side_panel_view_loaded_callback (NautilusViewFrame *view,
- gpointer user_data)
-{
- NautilusWindow *window;
-
- window = NAUTILUS_WINDOW (user_data);
-
- connect_side_panel (window, view);
-}
-
-void
-nautilus_navigation_window_set_sidebar_panels (NautilusNavigationWindow *window,
- GList *passed_identifier_list)
-{
- GList *identifier_list;
- GList *node, *next, *found_node;
- NautilusViewFrame *sidebar_panel;
- NautilusViewIdentifier *identifier;
- const char *current_iid;
-
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
- /* Make a copy of the list so we can remove items from it. */
- identifier_list = g_list_copy (passed_identifier_list);
-
- /* Remove panels from the window that don't appear in the list. */
- for (node = window->sidebar_panels; node != NULL; node = next) {
- next = node->next;
-
- sidebar_panel = NAUTILUS_VIEW_FRAME (node->data);
-
- found_node = g_list_find_custom (identifier_list,
- (char *) nautilus_view_frame_get_view_iid (sidebar_panel),
- compare_view_identifier_with_iid);
- if (found_node == NULL) {
- current_iid = nautilus_view_frame_get_view_iid (sidebar_panel);
- disconnect_and_destroy_sidebar_panel (window, sidebar_panel);
- } else {
- identifier = (NautilusViewIdentifier *) found_node->data;
-
- /* Right panel, make sure it has the right name. */
- /* FIXME: Is this set_label necessary? Shouldn't it already
- * have the right label here?
- */
- nautilus_view_frame_set_label (sidebar_panel, identifier->name);
-
- /* Since this was found, there's no need to add it in the loop below. */
- identifier_list = g_list_remove_link (identifier_list, found_node);
- g_list_free_1 (found_node);
- }
- }
-
- /* Add panels to the window that were in the list, but not the window. */
- for (node = identifier_list; node != NULL; node = node->next) {
- g_assert (node->data != NULL);
-
- identifier = (NautilusViewIdentifier *) node->data;
-
- /* Create and load the panel. */
- sidebar_panel = nautilus_view_frame_new (NAUTILUS_WINDOW (window)->details->ui_container,
- NAUTILUS_WINDOW (window)->application->undo_manager,
- NAUTILUS_WINDOW_GET_CLASS (window)->window_type);
-
- eel_accessibility_set_name (sidebar_panel, _("Side Pane"));
- eel_accessibility_set_description
- (sidebar_panel, _("Contains a side pane view"));
-
-
- nautilus_view_frame_set_label (sidebar_panel, identifier->name);
- nautilus_window_connect_extra_view (NAUTILUS_WINDOW (window),
- sidebar_panel,
- identifier);
- g_signal_connect_object (sidebar_panel,
- "view_loaded",
- G_CALLBACK (side_panel_view_loaded_callback),
- G_OBJECT (window), 0);
-
- nautilus_view_frame_load_view (sidebar_panel, identifier->iid);
-
- connect_side_panel (NAUTILUS_WINDOW (window), sidebar_panel);
-
- nautilus_navigation_window_add_sidebar_panel (window, sidebar_panel);
- gtk_object_sink (GTK_OBJECT (sidebar_panel));
+ icon = nautilus_sidebar_get_tab_icon (side_panel);
+ nautilus_side_pane_set_panel_image (NAUTILUS_NAVIGATION_WINDOW (window)->sidebar,
+ GTK_WIDGET (side_panel),
+ icon);
+ if (icon != NULL) {
+ g_object_unref (icon);
}
-
- g_list_free (identifier_list);
}
/**
@@ -1263,7 +836,11 @@ nautilus_navigation_window_set_sidebar_panels (NautilusNavigationWindow *window,
static void
add_sidebar_panels (NautilusNavigationWindow *window)
{
- GList *identifier_list;
+ GtkWidget *current;
+ GList *providers;
+ GList *p;
+ NautilusSidebar *sidebar_panel;
+ NautilusSidebarProvider *provider;
g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
@@ -1271,53 +848,31 @@ add_sidebar_panels (NautilusNavigationWindow *window)
return;
}
- identifier_list = nautilus_sidebar_get_all_sidebar_panel_view_identifiers ();
- nautilus_navigation_window_set_sidebar_panels (window, identifier_list);
- nautilus_view_identifier_list_free (identifier_list);
-
+ providers = nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_SIDEBAR_PROVIDER);
+
+ for (p = providers; p != NULL; p = p->next) {
+ provider = NAUTILUS_SIDEBAR_PROVIDER (p->data);
+
+ sidebar_panel = nautilus_sidebar_provider_create (provider,
+ NAUTILUS_WINDOW_INFO (window));
+ nautilus_navigation_window_add_sidebar_panel (window,
+ sidebar_panel);
+
+ g_object_unref (sidebar_panel);
+ }
+
+ current = nautilus_side_pane_get_current_panel (window->sidebar);
set_current_side_panel
(window,
- nautilus_side_pane_get_current_panel (window->sidebar));
-}
-
-static void
-show_dock_item (NautilusNavigationWindow *window, const char *dock_item_path)
-{
- nautilus_window_ui_freeze (NAUTILUS_WINDOW (window));
-
- nautilus_bonobo_set_hidden (NAUTILUS_WINDOW (window)->details->shell_ui,
- dock_item_path,
- FALSE);
- nautilus_navigation_window_update_show_hide_menu_items (window);
-
- nautilus_window_ui_thaw (NAUTILUS_WINDOW (window));
-}
-
-static void
-hide_dock_item (NautilusNavigationWindow *window, const char *dock_item_path)
-{
- nautilus_window_ui_freeze (NAUTILUS_WINDOW (window));
-
- nautilus_bonobo_set_hidden (NAUTILUS_WINDOW (window)->details->shell_ui,
- dock_item_path,
- TRUE);
- nautilus_navigation_window_update_show_hide_menu_items (window);
-
- nautilus_window_ui_thaw (NAUTILUS_WINDOW (window));
-}
-
-static gboolean
-dock_item_showing (NautilusNavigationWindow *window, const char *dock_item_path)
-{
- return !nautilus_bonobo_get_hidden (NAUTILUS_WINDOW (window)->details->shell_ui,
- dock_item_path);
+ NAUTILUS_SIDEBAR (current));
}
void
nautilus_navigation_window_hide_location_bar (NautilusNavigationWindow *window, gboolean save_preference)
{
window->details->temporary_navigation_bar = FALSE;
- hide_dock_item (window, LOCATION_BAR_PATH);
+ gtk_widget_hide (window->details->location_bar);
+ nautilus_navigation_window_update_show_hide_menu_items (window);
if (save_preference &&
eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR)) {
eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR, FALSE);
@@ -1327,7 +882,8 @@ nautilus_navigation_window_hide_location_bar (NautilusNavigationWindow *window,
void
nautilus_navigation_window_show_location_bar (NautilusNavigationWindow *window, gboolean save_preference)
{
- show_dock_item (window, LOCATION_BAR_PATH);
+ gtk_widget_show (window->details->location_bar);
+ nautilus_navigation_window_update_show_hide_menu_items (window);
if (save_preference &&
eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR)) {
eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR, TRUE);
@@ -1337,19 +893,61 @@ nautilus_navigation_window_show_location_bar (NautilusNavigationWindow *window,
gboolean
nautilus_navigation_window_location_bar_showing (NautilusNavigationWindow *window)
{
- return dock_item_showing (window, LOCATION_BAR_PATH);
+ if (window->details->location_bar != NULL) {
+ return GTK_WIDGET_VISIBLE (window->details->location_bar);
+ }
+ /* If we're not visible yet we haven't changed visibility, so its TRUE */
+ return TRUE;
}
gboolean
nautilus_navigation_window_toolbar_showing (NautilusNavigationWindow *window)
{
- return dock_item_showing (window, TOOLBAR_PATH);
+ if (window->details->toolbar != NULL) {
+ return GTK_WIDGET_VISIBLE (window->details->toolbar);
+ }
+ /* If we're not visible yet we haven't changed visibility, so its TRUE */
+ return TRUE;
+}
+
+void
+nautilus_navigation_window_hide_status_bar (NautilusNavigationWindow *window)
+{
+ gtk_widget_hide (NAUTILUS_WINDOW (window)->details->statusbar);
+
+ nautilus_navigation_window_update_show_hide_menu_items (window);
+ if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR) &&
+ eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR)) {
+ eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR, FALSE);
+ }
+}
+
+void
+nautilus_navigation_window_show_status_bar (NautilusNavigationWindow *window)
+{
+ gtk_widget_show (NAUTILUS_WINDOW (window)->details->statusbar);
+
+ nautilus_navigation_window_update_show_hide_menu_items (window);
+ if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR) &&
+ !eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR)) {
+ eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR, TRUE);
+ }
+}
+
+gboolean
+nautilus_navigation_window_status_bar_showing (NautilusNavigationWindow *window)
+{
+ if (NAUTILUS_WINDOW (window)->details->statusbar != NULL) {
+ return GTK_WIDGET_VISIBLE (NAUTILUS_WINDOW (window)->details->statusbar);
+ }
+ /* If we're not visible yet we haven't changed visibility, so its TRUE */
+ return TRUE;
}
void
nautilus_navigation_window_hide_sidebar (NautilusNavigationWindow *window)
{
- if (NAUTILUS_IS_DESKTOP_WINDOW (window) || window->sidebar == NULL) {
+ if (window->sidebar == NULL) {
return;
}
@@ -1365,7 +963,7 @@ nautilus_navigation_window_hide_sidebar (NautilusNavigationWindow *window)
void
nautilus_navigation_window_show_sidebar (NautilusNavigationWindow *window)
{
- if (NAUTILUS_IS_DESKTOP_WINDOW (window) || window->sidebar != NULL) {
+ if (window->sidebar != NULL) {
return;
}
@@ -1443,9 +1041,9 @@ nautilus_navigation_window_show (GtkWidget *widget)
}
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR)) {
- nautilus_window_show_status_bar (NAUTILUS_WINDOW (window));
+ nautilus_navigation_window_show_status_bar (window);
} else {
- nautilus_window_hide_status_bar (NAUTILUS_WINDOW (window));
+ nautilus_navigation_window_hide_status_bar (window);
}
GTK_WIDGET_CLASS (parent_class)->show (widget);
@@ -1480,29 +1078,27 @@ real_window_close (NautilusWindow *window)
}
static void
-real_get_default_size(NautilusWindow *window, guint *default_width, guint *default_height)
+real_get_default_size (NautilusWindow *window,
+ guint *default_width, guint *default_height)
{
-
- if(default_width) {
- *default_width = NAUTILUS_NAVIGATION_WINDOW_DEFAULT_WIDTH;
+ if (default_width) {
+ *default_width = NAUTILUS_NAVIGATION_WINDOW_DEFAULT_WIDTH;
}
- if(default_height) {
- *default_height = NAUTILUS_NAVIGATION_WINDOW_DEFAULT_HEIGHT;
+ if (default_height) {
+ *default_height = NAUTILUS_NAVIGATION_WINDOW_DEFAULT_HEIGHT;
}
}
static void
nautilus_navigation_window_class_init (NautilusNavigationWindowClass *class)
{
- NAUTILUS_WINDOW_CLASS (class)->window_type = Nautilus_WINDOW_NAVIGATION;
+ NAUTILUS_WINDOW_CLASS (class)->window_type = NAUTILUS_WINDOW_NAVIGATION;
G_OBJECT_CLASS (class)->finalize = nautilus_navigation_window_finalize;
GTK_OBJECT_CLASS (class)->destroy = nautilus_navigation_window_destroy;
GTK_WIDGET_CLASS (class)->show = nautilus_navigation_window_show;
GTK_WIDGET_CLASS (class)->unrealize = nautilus_navigation_window_unrealize;
- NAUTILUS_WINDOW_CLASS (class)->merge_menus = real_merge_menus;
- NAUTILUS_WINDOW_CLASS (class)->merge_menus_2 = real_merge_menus_2;
NAUTILUS_WINDOW_CLASS (class)->load_view_as_menu = real_load_view_as_menu;
NAUTILUS_WINDOW_CLASS (class)->set_content_view_widget = real_set_content_view_widget;
NAUTILUS_WINDOW_CLASS (class)->set_throbber_active = real_set_throbber_active;
diff --git a/src/nautilus-navigation-window.h b/src/nautilus-navigation-window.h
index 5888ac28f..9a822dd2f 100644
--- a/src/nautilus-navigation-window.h
+++ b/src/nautilus-navigation-window.h
@@ -33,9 +33,7 @@
#include <bonobo/bonobo-window.h>
#include <eel/eel-glib-extensions.h>
#include <libnautilus-private/nautilus-bookmark.h>
-#include <libnautilus-private/nautilus-view-identifier.h>
-#include "nautilus-applicable-views.h"
-#include "nautilus-view-frame.h"
+#include <libnautilus-private/nautilus-sidebar.h>
#include "nautilus-application.h"
#include "nautilus-information-panel.h"
#include "nautilus-side-pane.h"
@@ -58,7 +56,6 @@ struct _NautilusNavigationWindow {
/** UI stuff **/
NautilusSidePane *sidebar;
- NautilusInformationPanel *information_panel;
GtkWidget *view_as_option_menu;
GtkWidget *navigation_bar;
@@ -79,40 +76,37 @@ struct _NautilusNavigationWindowClass {
NautilusWindowClass parent_spot;
};
-GType nautilus_navigation_window_get_type (void);
-gboolean nautilus_navigation_window_get_search_mode (NautilusNavigationWindow *window);
-void nautilus_navigation_window_set_search_mode (NautilusNavigationWindow *window,
- gboolean search_mode);
-void nautilus_navigation_window_go_home (NautilusNavigationWindow *window);
-void nautilus_navigation_window_allow_back (NautilusNavigationWindow *window,
- gboolean allow);
-void nautilus_navigation_window_allow_forward (NautilusNavigationWindow *window,
- gboolean allow);
-void nautilus_navigation_window_clear_back_list (NautilusNavigationWindow *window);
-void nautilus_navigation_window_clear_forward_list (NautilusNavigationWindow *window);
-
-void nautilus_forget_history (void);
-void nautilus_bookmarks_exiting (void);
-
-gint nautilus_navigation_window_get_base_page_index (NautilusNavigationWindow *window);
-
-void nautilus_navigation_window_hide_location_bar (NautilusNavigationWindow *window,
- gboolean save_preference);
-void nautilus_navigation_window_show_location_bar (NautilusNavigationWindow *window,
- gboolean save_preference);
-gboolean nautilus_navigation_window_location_bar_showing (NautilusNavigationWindow *window);
-
-void nautilus_navigation_window_hide_toolbar (NautilusNavigationWindow *window);
-void nautilus_navigation_window_show_toolbar (NautilusNavigationWindow *window);
-gboolean nautilus_navigation_window_toolbar_showing (NautilusNavigationWindow *window);
-
-void nautilus_navigation_window_hide_sidebar (NautilusNavigationWindow *window);
-void nautilus_navigation_window_show_sidebar (NautilusNavigationWindow *window);
-gboolean nautilus_navigation_window_sidebar_showing (NautilusNavigationWindow *window);
-
-void nautilus_navigation_window_add_sidebar_panel (NautilusNavigationWindow *window,
- NautilusViewFrame *sidebar_panel);
-void nautilus_navigation_window_remove_sidebar_panel (NautilusNavigationWindow *window,
- NautilusViewFrame *sidebar_panel);
+GType nautilus_navigation_window_get_type (void);
+void nautilus_navigation_window_go_home (NautilusNavigationWindow *window);
+void nautilus_navigation_window_allow_back (NautilusNavigationWindow *window,
+ gboolean allow);
+void nautilus_navigation_window_allow_forward (NautilusNavigationWindow *window,
+ gboolean allow);
+void nautilus_navigation_window_clear_back_list (NautilusNavigationWindow *window);
+void nautilus_navigation_window_clear_forward_list (NautilusNavigationWindow *window);
+void nautilus_forget_history (void);
+void nautilus_bookmarks_exiting (void);
+gint nautilus_navigation_window_get_base_page_index (NautilusNavigationWindow *window);
+void nautilus_navigation_window_hide_location_bar (NautilusNavigationWindow *window,
+ gboolean save_preference);
+void nautilus_navigation_window_show_location_bar (NautilusNavigationWindow *window,
+ gboolean save_preference);
+gboolean nautilus_navigation_window_location_bar_showing (NautilusNavigationWindow *window);
+void nautilus_navigation_window_hide_toolbar (NautilusNavigationWindow *window);
+void nautilus_navigation_window_show_toolbar (NautilusNavigationWindow *window);
+gboolean nautilus_navigation_window_toolbar_showing (NautilusNavigationWindow *window);
+void nautilus_navigation_window_hide_sidebar (NautilusNavigationWindow *window);
+void nautilus_navigation_window_show_sidebar (NautilusNavigationWindow *window);
+gboolean nautilus_navigation_window_sidebar_showing (NautilusNavigationWindow *window);
+void nautilus_navigation_window_add_sidebar_panel (NautilusNavigationWindow *window,
+ NautilusSidebar *sidebar_panel);
+void nautilus_navigation_window_remove_sidebar_panel (NautilusNavigationWindow *window,
+ NautilusSidebar *sidebar_panel);
+void nautilus_navigation_window_hide_status_bar (NautilusNavigationWindow *window);
+void nautilus_navigation_window_show_status_bar (NautilusNavigationWindow *window);
+gboolean nautilus_navigation_window_status_bar_showing (NautilusNavigationWindow *window);
+void nautilus_navigation_window_back_or_forward (NautilusNavigationWindow *window,
+ gboolean back,
+ guint distance);
#endif
diff --git a/src/nautilus-notes-viewer.c b/src/nautilus-notes-viewer.c
new file mode 100644
index 000000000..4ff211996
--- /dev/null
+++ b/src/nautilus-notes-viewer.c
@@ -0,0 +1,529 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * Nautilus
+ *
+ * Copyright (C) 2000, 2001 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: Andy Hertzfeld <andy@eazel.com>
+ *
+ */
+
+/* notes sidebar panel -- allows editing per-directory notes */
+
+#include <config.h>
+
+#include "nautilus-notes-viewer.h"
+
+#include <eel/eel-debug.h>
+#include <eel/eel-gtk-extensions.h>
+#include <eel/eel-string.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtksignal.h>
+#include <gtk/gtktextbuffer.h>
+#include <gtk/gtktextview.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtkscrolledwindow.h>
+#include <libgnome/gnome-i18n.h>
+#include <libnautilus-private/nautilus-file-attributes.h>
+#include <libnautilus-private/nautilus-file.h>
+#include <libnautilus-private/nautilus-global-preferences.h>
+#include <libnautilus-private/nautilus-metadata.h>
+#include <libnautilus-private/nautilus-clipboard.h>
+#include <libnautilus-private/nautilus-theme.h>
+#include <libnautilus-private/nautilus-module.h>
+#include <libnautilus-private/nautilus-sidebar-provider.h>
+#include <libnautilus-extension/nautilus-property-page-provider.h>
+
+#define SAVE_TIMEOUT (3 * 1000)
+
+static void load_note_text_from_metadata (NautilusFile *file,
+ NautilusNotesViewer *notes);
+static void notes_save_metainfo (NautilusNotesViewer *notes);
+static void nautilus_notes_viewer_sidebar_iface_init (NautilusSidebarIface *iface);
+static void on_changed (GtkEditable *editable,
+ NautilusNotesViewer *notes);
+static void property_page_provider_iface_init (NautilusPropertyPageProviderIface *iface);
+static void sidebar_provider_iface_init (NautilusSidebarProviderIface *iface);
+
+typedef struct {
+ GtkScrolledWindowClass parent;
+} NautilusNotesViewerClass;
+
+typedef struct {
+ GObject parent;
+} NautilusNotesViewerProvider;
+
+typedef struct {
+ GObjectClass parent;
+} NautilusNotesViewerProviderClass;
+
+
+G_DEFINE_TYPE_WITH_CODE (NautilusNotesViewer, nautilus_notes_viewer, GTK_TYPE_SCROLLED_WINDOW,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_SIDEBAR,
+ nautilus_notes_viewer_sidebar_iface_init));
+
+static GType nautilus_notes_viewer_provider_get_type (void);
+
+G_DEFINE_TYPE_WITH_CODE (NautilusNotesViewerProvider, nautilus_notes_viewer_provider, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER,
+ property_page_provider_iface_init);
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_SIDEBAR_PROVIDER,
+ sidebar_provider_iface_init));
+
+
+struct _NautilusNotesViewerDetails {
+ GtkWidget *note_text_field;
+ GtkTextBuffer *text_buffer;
+ char *uri;
+ NautilusFile *file;
+ guint save_timeout_id;
+ char *previous_saved_text;
+ GdkPixbuf *icon;
+};
+
+static gboolean
+schedule_save_callback (gpointer data)
+{
+ NautilusNotesViewer *notes;
+
+ notes = data;
+
+ /* Zero out save_timeout_id so no one will try to cancel our
+ * in-progress timeout callback.
+ */
+ notes->details->save_timeout_id = 0;
+
+ notes_save_metainfo (notes);
+
+ return FALSE;
+}
+
+static void
+cancel_pending_save (NautilusNotesViewer *notes)
+{
+ if (notes->details->save_timeout_id != 0) {
+ g_source_remove (notes->details->save_timeout_id);
+ notes->details->save_timeout_id = 0;
+ }
+}
+
+static void
+schedule_save (NautilusNotesViewer *notes)
+{
+ cancel_pending_save (notes);
+
+ notes->details->save_timeout_id = g_timeout_add (SAVE_TIMEOUT, schedule_save_callback, notes);
+}
+
+/* notifies event listeners if the notes data actually changed */
+static void
+set_saved_text (NautilusNotesViewer *notes, char *new_notes)
+{
+ char *old_text;
+
+ old_text = notes->details->previous_saved_text;
+ notes->details->previous_saved_text = new_notes;
+
+ if (eel_strcmp (old_text, new_notes) != 0) {
+ g_signal_emit_by_name (NAUTILUS_SIDEBAR (notes),
+ "tab_icon_changed");
+ }
+
+ g_free (old_text);
+}
+
+/* save the metainfo corresponding to the current uri, if any, into the text field */
+static void
+notes_save_metainfo (NautilusNotesViewer *notes)
+{
+ char *notes_text;
+ GtkTextIter start_iter;
+ GtkTextIter end_iter;
+
+ if (notes->details->file == NULL) {
+ return;
+ }
+
+ cancel_pending_save (notes);
+
+ /* Block the handler, so we don't respond to our own change.
+ */
+ g_signal_handlers_block_matched (notes->details->file,
+ G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL,
+ G_CALLBACK (load_note_text_from_metadata),
+ notes);
+
+ gtk_text_buffer_get_start_iter (notes->details->text_buffer, &start_iter);
+ gtk_text_buffer_get_end_iter (notes->details->text_buffer, &end_iter);
+ notes_text = gtk_text_buffer_get_text (notes->details->text_buffer,
+ &start_iter,
+ &end_iter,
+ FALSE);
+
+ nautilus_file_set_metadata (notes->details->file,
+ NAUTILUS_METADATA_KEY_ANNOTATION,
+ NULL, notes_text);
+
+ g_signal_handlers_unblock_matched (notes->details->file,
+ G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL,
+ G_CALLBACK (load_note_text_from_metadata),
+ notes);
+
+ set_saved_text (notes, notes_text);
+}
+
+static void
+load_note_text_from_metadata (NautilusFile *file,
+ NautilusNotesViewer *notes)
+{
+ char *saved_text;
+
+ g_assert (NAUTILUS_IS_FILE (file));
+ g_assert (notes->details->file == file);
+
+ saved_text = nautilus_file_get_metadata (file, NAUTILUS_METADATA_KEY_ANNOTATION, "");
+
+ /* This fn is called for any change signal on the file, so make sure that the
+ * metadata has actually changed.
+ */
+ if (eel_strcmp (saved_text, notes->details->previous_saved_text) != 0) {
+ set_saved_text (notes, saved_text);
+ cancel_pending_save (notes);
+
+ /* Block the handler, so we don't respond to our own change.
+ */
+ g_signal_handlers_block_matched (notes->details->text_buffer,
+ G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL,
+ G_CALLBACK (on_changed),
+ notes);
+ gtk_text_buffer_set_text (notes->details->text_buffer, saved_text, -1);
+ g_signal_handlers_unblock_matched (notes->details->text_buffer,
+ G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL,
+ G_CALLBACK (on_changed),
+ notes);
+ } else {
+ g_free (saved_text);
+ }
+}
+
+static void
+done_with_file (NautilusNotesViewer *notes)
+{
+ cancel_pending_save (notes);
+
+ if (notes->details->file != NULL) {
+ nautilus_file_monitor_remove (notes->details->file, notes);
+ g_signal_handlers_disconnect_matched (notes->details->file,
+ G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL,
+ G_CALLBACK (load_note_text_from_metadata),
+ notes);
+ nautilus_file_unref (notes->details->file);
+ }
+}
+
+static void
+notes_load_metainfo (NautilusNotesViewer *notes)
+{
+ NautilusFileAttributes attributes;
+
+ done_with_file (notes);
+ notes->details->file = nautilus_file_get (notes->details->uri);
+
+ /* Block the handler, so we don't respond to our own change.
+ */
+ g_signal_handlers_block_matched (notes->details->text_buffer,
+ G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL,
+ G_CALLBACK (on_changed),
+ notes);
+ gtk_text_buffer_set_text (notes->details->text_buffer, "", -1);
+ g_signal_handlers_unblock_matched (notes->details->text_buffer,
+ G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL,
+ G_CALLBACK (on_changed),
+ notes);
+
+ if (notes->details->file == NULL) {
+ return;
+ }
+
+ attributes = NAUTILUS_FILE_ATTRIBUTE_METADATA;
+ nautilus_file_monitor_add (notes->details->file, notes, attributes);
+
+ if (nautilus_file_check_if_ready (notes->details->file, attributes)) {
+ load_note_text_from_metadata (notes->details->file, notes);
+ }
+
+ g_signal_connect (notes->details->file, "changed",
+ G_CALLBACK (load_note_text_from_metadata), notes);
+}
+
+static void
+loading_uri_callback (NautilusSidebar *sidebar,
+ const char *location,
+ NautilusNotesViewer *notes)
+{
+ if (strcmp (notes->details->uri, location) != 0) {
+ notes_save_metainfo (notes);
+ g_free (notes->details->uri);
+ notes->details->uri = g_strdup (location);
+ notes_load_metainfo (notes);
+ }
+}
+
+static gboolean
+on_text_field_focus_out_event (GtkWidget *widget,
+ GdkEventFocus *event,
+ gpointer callback_data)
+{
+ NautilusNotesViewer *notes;
+
+ notes = callback_data;
+ notes_save_metainfo (notes);
+ return FALSE;
+}
+
+static void
+on_changed (GtkEditable *editable, NautilusNotesViewer *notes)
+{
+ schedule_save (notes);
+}
+
+static void
+nautilus_notes_viewer_init (NautilusNotesViewer *sidebar)
+{
+ char *image_path;
+ NautilusNotesViewerDetails *details;
+
+ details = g_new0 (NautilusNotesViewerDetails, 1);
+ sidebar->details = details;
+
+ details->uri = g_strdup ("");
+
+ image_path = nautilus_theme_get_image_path ("note-indicator.png");
+ if (image_path) {
+ details->icon = gdk_pixbuf_new_from_file (image_path, NULL);
+ g_free (image_path);
+ }
+
+ /* create the text container */
+ details->text_buffer = gtk_text_buffer_new (NULL);
+ details->note_text_field = gtk_text_view_new_with_buffer (details->text_buffer);
+
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (details->note_text_field), TRUE);
+ gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (details->note_text_field),
+ GTK_WRAP_WORD);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sidebar),
+ GTK_POLICY_NEVER,
+ GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sidebar),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (sidebar), NULL);
+ gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (sidebar), NULL);
+ gtk_container_add (GTK_CONTAINER (sidebar), details->note_text_field);
+
+ g_signal_connect (details->note_text_field, "focus_out_event",
+ G_CALLBACK (on_text_field_focus_out_event), sidebar);
+ g_signal_connect (details->text_buffer, "changed",
+ G_CALLBACK (on_changed), sidebar);
+
+ gtk_widget_show_all (GTK_WIDGET (sidebar));
+
+}
+
+static void
+nautilus_notes_viewer_finalize (GObject *object)
+{
+ NautilusNotesViewer *sidebar;
+
+ sidebar = NAUTILUS_NOTES_VIEWER (object);
+
+ done_with_file (sidebar);
+ if (sidebar->details->icon != NULL) {
+ g_object_unref (sidebar->details->icon);
+ }
+ g_free (sidebar->details->uri);
+ g_free (sidebar->details->previous_saved_text);
+ g_free (sidebar->details);
+
+ G_OBJECT_CLASS (nautilus_notes_viewer_parent_class)->finalize (object);
+}
+
+
+static void
+nautilus_notes_viewer_class_init (NautilusNotesViewerClass *class)
+{
+ G_OBJECT_CLASS (class)->finalize = nautilus_notes_viewer_finalize;
+}
+
+static const char *
+nautilus_notes_viewer_get_sidebar_id (NautilusSidebar *sidebar)
+{
+ return NAUTILUS_NOTES_SIDEBAR_ID;
+}
+
+static char *
+nautilus_notes_viewer_get_tab_label (NautilusSidebar *sidebar)
+{
+ return g_strdup (_("Notes"));
+}
+
+static GdkPixbuf *
+nautilus_notes_viewer_get_tab_icon (NautilusSidebar *sidebar)
+{
+ NautilusNotesViewer *notes;
+
+ notes = NAUTILUS_NOTES_VIEWER (sidebar);
+
+ if (notes->details->previous_saved_text != NULL &&
+ notes->details->previous_saved_text[0] != '\0') {
+ return g_object_ref (notes->details->icon);
+ }
+
+ return NULL;
+}
+
+static void
+nautilus_notes_viewer_is_visible_changed (NautilusSidebar *sidebar,
+ gboolean is_visible)
+{
+ /* Do nothing */
+}
+
+static void
+nautilus_notes_viewer_sidebar_iface_init (NautilusSidebarIface *iface)
+{
+ iface->get_sidebar_id = nautilus_notes_viewer_get_sidebar_id;
+ iface->get_tab_label = nautilus_notes_viewer_get_tab_label;
+ iface->get_tab_icon = nautilus_notes_viewer_get_tab_icon;
+ iface->is_visible_changed = nautilus_notes_viewer_is_visible_changed;
+}
+
+static void
+nautilus_notes_viewer_set_parent_window (NautilusNotesViewer *sidebar,
+ NautilusWindowInfo *window)
+{
+ g_signal_connect_object (window, "loading_uri",
+ G_CALLBACK (loading_uri_callback), sidebar, 0);
+
+ g_free (sidebar->details->uri);
+ sidebar->details->uri = nautilus_window_info_get_current_location (window);
+ notes_load_metainfo (sidebar);
+
+ /* handle selections */
+#ifdef GNOME2_CONVERSION_COMPLETE
+ /* note_text_field is a text-view, not a GtkEditable */
+ nautilus_clipboard_set_up_editable
+ (GTK_EDITABLE (sidebar->details->note_text_field),
+ nautilus_window_info_get_ui_manager (window),
+ FALSE);
+#endif
+}
+
+static NautilusSidebar *
+nautilus_notes_viewer_create_sidebar (NautilusSidebarProvider *provider,
+ NautilusWindowInfo *window)
+{
+ NautilusNotesViewer *sidebar;
+
+ sidebar = g_object_new (nautilus_notes_viewer_get_type (), NULL);
+ nautilus_notes_viewer_set_parent_window (sidebar, window);
+ g_object_ref (sidebar);
+ gtk_object_sink (GTK_OBJECT (sidebar));
+
+ return NAUTILUS_SIDEBAR (sidebar);
+}
+
+/* nautilus_property_page_provider_get_pages
+ *
+ * This function is called by Nautilus when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * The function should return a GList of allocated NautilusPropertyPage
+ * items.
+ */
+static GList *
+get_property_pages (NautilusPropertyPageProvider *provider,
+ GList *files)
+{
+ GList *pages;
+ NautilusPropertyPage *page;
+ NautilusFileInfo *file;
+ char *uri;
+ NautilusNotesViewer *viewer;
+
+
+ /* Only show the property page if 1 file is selected */
+ if (!files || files->next != NULL) {
+ return NULL;
+ }
+
+ pages = NULL;
+
+ file = NAUTILUS_FILE_INFO (files->data);
+ uri = nautilus_file_info_get_uri (file);
+
+ viewer = g_object_new (nautilus_notes_viewer_get_type (), NULL);
+ viewer->details->uri = uri;
+ notes_load_metainfo (viewer);
+
+ page = nautilus_property_page_new
+ ("NautilusNotesViewer::property_page",
+ gtk_label_new (_("Notes")),
+ GTK_WIDGET (viewer));
+ pages = g_list_append (pages, page);
+
+ return pages;
+}
+
+static void
+property_page_provider_iface_init (NautilusPropertyPageProviderIface *iface)
+{
+ iface->get_pages = get_property_pages;
+}
+
+static void
+sidebar_provider_iface_init (NautilusSidebarProviderIface *iface)
+{
+ iface->create = nautilus_notes_viewer_create_sidebar;
+}
+
+static void
+nautilus_notes_viewer_provider_init (NautilusNotesViewerProvider *sidebar)
+{
+}
+
+static void
+nautilus_notes_viewer_provider_class_init (NautilusNotesViewerProviderClass *class)
+{
+}
+
+void
+nautilus_notes_viewer_register (void)
+{
+ nautilus_module_add_type (nautilus_notes_viewer_provider_get_type ());
+}
+
diff --git a/src/nautilus-notes-viewer.h b/src/nautilus-notes-viewer.h
new file mode 100644
index 000000000..da5374be8
--- /dev/null
+++ b/src/nautilus-notes-viewer.h
@@ -0,0 +1,49 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/*
+ * Nautilus
+ *
+ * Copyright (C) 1999, 2000, 2004 Red Hat, Inc.
+ * Copyright (C) 2000, 2001 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: Andy Hertzfeld <andy@eazel.com>
+ * Alexander Larsson <alexl@redhat.com>
+ */
+#ifndef _NAUTILUS_NOTES_VIEWER_H
+#define _NAUTILUS_NOTES_VIEWER_H
+
+#include <gtk/gtktreeview.h>
+#include <libnautilus-private/nautilus-view.h>
+#include <libnautilus-private/nautilus-window-info.h>
+#include <gtk/gtkscrolledwindow.h>
+
+#define NAUTILUS_NOTES_SIDEBAR_ID "NautilusNotesSidebar"
+
+#define NAUTILUS_TYPE_NOTES_VIEWER (nautilus_notes_viewer_get_type ())
+#define NAUTILUS_NOTES_VIEWER(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_NOTES_VIEWER, NautilusNotesViewer))
+
+typedef struct _NautilusNotesViewerDetails NautilusNotesViewerDetails;
+
+typedef struct {
+ GtkScrolledWindow parent;
+ NautilusNotesViewerDetails *details;
+} NautilusNotesViewer;
+
+GType nautilus_notes_viewer_get_type (void);
+void nautilus_notes_viewer_register (void);
+
+#endif
diff --git a/src/nautilus-profiler.c b/src/nautilus-profiler.c
deleted file mode 100644
index 852667437..000000000
--- a/src/nautilus-profiler.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Ramiro Estrugo <ramiro@eazel.com>
- */
-
-/* nautilus-profiler.c: Nautilus profiler hooks and reporting.
- */
-
-#include <config.h>
-#include "nautilus-profiler.h"
-
-#ifdef ENABLE_PROFILER
-
-#include <eel/eel-gtk-extensions.h>
-#include <eel/eel-vfs-extensions.h>
-#include <glib.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtktextbuffer.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkvscrollbar.h>
-#include <gtk/gtkwindow.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-/* These are defined in eazel-tools/profiler/profiler.C */
-extern void profile_on (void);
-extern void profile_off (void);
-extern void profile_reset (void);
-extern void profile_dump (const char *file_name, gboolean);
-
-void
-nautilus_profiler_bonobo_ui_reset_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- profile_reset ();
-}
-
-void
-nautilus_profiler_bonobo_ui_start_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- profile_on ();
-}
-
-void
-nautilus_profiler_bonobo_ui_stop_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- profile_off ();
-}
-
-static void
-widget_set_busy_cursor (GtkWidget *widget)
-{
- GdkCursor *cursor;
-
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (widget)));
-
- cursor = gdk_cursor_new (GDK_WATCH);
-
- gdk_window_set_cursor (GTK_WIDGET (widget)->window, cursor);
-
- gdk_flush ();
-
- gdk_cursor_unref (cursor);
-}
-
-static void
-widget_clear_busy_cursor (GtkWidget *widget)
-{
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (widget)));
-
- gdk_window_set_cursor (GTK_WIDGET (widget)->window, NULL);
-
- gdk_flush ();
-}
-
-typedef struct
-{
- GtkWidget *main_box;
- GtkWidget *text;
- GtkTextBuffer *text_buffer;
-} ScrolledText;
-
-static ScrolledText *
-scrolled_text_new (void)
-{
- ScrolledText *scrolled_text;
- GtkWidget *scrolled_window;
-
- scrolled_text = g_new (ScrolledText, 1);
-
- scrolled_text->main_box = gtk_hbox_new (FALSE, 0);
- scrolled_text->text_buffer = gtk_text_buffer_new (NULL);
-
- gtk_text_buffer_create_tag (scrolled_text->text_buffer, "fixed_font",
- "family", "monospace",
- "wrap_mode", GTK_WRAP_NONE,
- NULL);
-
-
- scrolled_text->text = gtk_text_view_new_with_buffer (scrolled_text->text_buffer);
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (scrolled_window),
- scrolled_text->text);
-
- gtk_box_pack_start (GTK_BOX (scrolled_text->main_box), scrolled_window, TRUE, TRUE, 0);
-
- gtk_widget_show_all (scrolled_window);
-
- return scrolled_text;
-}
-
-typedef struct
-{
- GtkWidget *window;
- ScrolledText *scrolled_text;
-} DumpDialog;
-
-static void
-window_delete_event (GtkWidget *widget, GdkEvent *event, gpointer callback_data)
-{
- g_return_if_fail (GTK_IS_WINDOW (widget));
-
- gtk_widget_hide (widget);
-}
-
-static void
-window_print_button_callback (GtkWidget *widget, gpointer callback_data)
-{
- DumpDialog *dump_dialog = (DumpDialog *) callback_data;
-
- g_return_if_fail (dump_dialog != NULL);
-
- /* Implement me */
- g_assert_not_reached ();
-}
-
-static void
-window_save_button_callback (GtkWidget *widget, gpointer callback_data)
-{
- DumpDialog *dump_dialog = (DumpDialog *) callback_data;
-
- g_return_if_fail (dump_dialog != NULL);
-
- /* Implement me */
- g_assert_not_reached ();
-}
-
-static DumpDialog *
-dump_dialog_new (const char *title)
-{
- DumpDialog *dump_dialog;
- GtkWidget *print_button;
- GtkWidget *save_button;
- GtkWidget *main_box;
- GtkWidget *button_box;
-
- dump_dialog = g_new (DumpDialog, 1);
-
- dump_dialog->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- eel_gtk_window_set_up_close_accelerator
- (GTK_WINDOW (dump_dialog->window));
- g_signal_connect (dump_dialog->window, "delete_event",
- G_CALLBACK (window_delete_event), dump_dialog->window);
-
- gtk_widget_set_size_request (dump_dialog->window, 700, 700);
-
- main_box = gtk_vbox_new (FALSE, 0);
- dump_dialog->scrolled_text = scrolled_text_new ();
- gtk_text_view_set_editable (GTK_TEXT_VIEW (dump_dialog->scrolled_text->text), FALSE);
-
- print_button = gtk_button_new_with_label (_("Print"));
- save_button = gtk_button_new_with_label (_("Save"));
-
- gtk_widget_set_sensitive (print_button, FALSE);
- gtk_widget_set_sensitive (save_button, FALSE);
-
- g_signal_connect_object (print_button, "clicked",
- G_CALLBACK (window_print_button_callback), dump_dialog, 0);
- g_signal_connect_object (save_button, "clicked",
- G_CALLBACK (window_save_button_callback), dump_dialog, 0);
-
- gtk_container_add (GTK_CONTAINER (dump_dialog->window), main_box);
-
- button_box = gtk_hbox_new (FALSE, 4);
- gtk_container_set_border_width (GTK_CONTAINER (button_box), 4);
-
- gtk_box_pack_start (GTK_BOX (main_box), dump_dialog->scrolled_text->main_box, TRUE, TRUE, 0);
- gtk_box_pack_end (GTK_BOX (main_box), button_box, FALSE, FALSE, 0);
-
- gtk_box_pack_end (GTK_BOX (button_box), print_button, FALSE, FALSE, 0);
- gtk_box_pack_end (GTK_BOX (button_box), save_button, FALSE, FALSE, 0);
-
- gtk_widget_show_all (dump_dialog->window);
-
- return dump_dialog;
-}
-
-static void
-dump_dialog_show (const char *dump_data, const char *title)
-{
- static DumpDialog *dump_dialog = NULL;
- GtkTextBuffer *buffer;
- GtkTextIter start_iter, end_iter;
-
- g_return_if_fail (dump_data != NULL);
-
- if (dump_dialog == NULL) {
- dump_dialog = dump_dialog_new (_("Profile Dump"));
- }
-
- buffer = dump_dialog->scrolled_text->text_buffer;
-
- /* delete existing text in buffer */
- gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
- gtk_text_buffer_delete (buffer, &start_iter, &end_iter);
-
- gtk_text_buffer_get_start_iter (buffer, &start_iter);
-
- gtk_text_buffer_insert_with_tags_by_name (buffer, &start_iter,
- dump_data, -1,
- "fixed_font",
- NULL);
-
- if (title != NULL) {
- gtk_window_set_title (GTK_WINDOW (dump_dialog->window), title);
- }
-
- gtk_widget_show (dump_dialog->window);
-}
-
-
-void
-nautilus_profiler_bonobo_ui_report_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *path)
-{
- char *dump_file_name;
- char *uri;
- int fd;
-
- int dump_size = 0;
- char *dump_contents = NULL;
-
- GtkWidget *window = NULL;
-
- g_return_if_fail (component != NULL);
- g_return_if_fail (GTK_IS_WINDOW (user_data));
-
- dump_file_name = g_strdup ("/tmp/nautilus-profile-log-XXXXXX");
-
- fd = mkstemp (dump_file_name);
-
- if (fd != -1) {
- close (fd);
- } else {
- g_free (dump_file_name);
- dump_file_name = g_strdup_printf ("/tmp/nautilus-profile-log.%d", getpid ());
- }
-
- window = GTK_WIDGET (user_data);
-
- widget_set_busy_cursor (window);
-
- profile_dump (dump_file_name, TRUE);
-
- uri = gnome_vfs_get_uri_from_local_path (dump_file_name);
-
- if (eel_read_entire_file (uri, &dump_size, &dump_contents) == GNOME_VFS_OK) {
- dump_dialog_show (dump_contents, uri);
- }
-
- widget_clear_busy_cursor (window);
-
- remove (dump_file_name);
-
- g_free (dump_file_name);
-}
-
-#endif
diff --git a/src/nautilus-profiler.h b/src/nautilus-profiler.h
deleted file mode 100644
index fd5384433..000000000
--- a/src/nautilus-profiler.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, 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.
- *
- * Author: Ramiro Estrugo <ramiro@eazel.com>
- */
-
-/* nautilus-profiler.h: Nautilus profiler hooks and reporting. */
-
-#ifndef NAUTILUS_PROFILER_H
-#define NAUTILUS_PROFILER_H
-
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
-
-void nautilus_profiler_bonobo_ui_reset_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb);
-void nautilus_profiler_bonobo_ui_start_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb);
-void nautilus_profiler_bonobo_ui_stop_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb);
-void nautilus_profiler_bonobo_ui_report_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb);
-
-#endif /* NAUTILUS_PROFILER_H */
diff --git a/src/nautilus-property-browser.c b/src/nautilus-property-browser.c
index 72c04a049..e880488be 100644
--- a/src/nautilus-property-browser.c
+++ b/src/nautilus-property-browser.c
@@ -78,7 +78,6 @@
#include <libgnomevfs/gnome-vfs.h>
#include <libnautilus-private/nautilus-customization-data.h>
#include <libnautilus-private/nautilus-directory.h>
-#include <libnautilus-private/nautilus-drag-window.h>
#include <libnautilus-private/nautilus-emblem-utils.h>
#include <libnautilus-private/nautilus-file-utilities.h>
#include <libnautilus-private/nautilus-icon-factory.h>
@@ -183,6 +182,8 @@ static void nautilus_property_browser_drag_data_get (GtkWidget
guint32 time);
static void nautilus_property_browser_theme_changed (gpointer user_data);
static void emit_emblems_changed_signal (void);
+static void emblems_changed_callback (GObject *signaller,
+ NautilusPropertyBrowser *property_browser);
/* misc utilities */
static char * strip_extension (const char *string_to_strip);
@@ -430,11 +431,12 @@ nautilus_property_browser_init (GtkObject *object)
g_signal_connect (property_browser, "hide",
G_CALLBACK (nautilus_property_browser_hide_callback), NULL);
+ g_signal_connect_object (nautilus_signaller_get_current (),
+ "emblems_changed",
+ G_CALLBACK (emblems_changed_callback), property_browser, 0);
+
/* initially, display the top level */
nautilus_property_browser_set_path(property_browser, BROWSER_CATEGORIES_FILE_NAME);
-
- /* Register that things may be dragged from this window */
- nautilus_drag_window_register (GTK_WINDOW (property_browser));
}
/* Destroy the three dialogs for adding patterns/colors/emblems if any of them
@@ -1350,7 +1352,6 @@ emblem_dialog_clicked (GtkWidget *dialog, int which_button, NautilusPropertyBrow
nautilus_emblem_refresh_list ();
emit_emblems_changed_signal ();
- nautilus_property_browser_update_contents (property_browser);
g_free (stripped_keyword);
}
@@ -2195,6 +2196,14 @@ nautilus_property_browser_set_path (NautilusPropertyBrowser *property_browser,
}
static void
+emblems_changed_callback (GObject *signaller,
+ NautilusPropertyBrowser *property_browser)
+{
+ nautilus_property_browser_update_contents (property_browser);
+}
+
+
+static void
emit_emblems_changed_signal (void)
{
g_signal_emit_by_name (nautilus_signaller_get_current (), "emblems_changed");
diff --git a/src/nautilus-search-bar-criterion-private.h b/src/nautilus-search-bar-criterion-private.h
deleted file mode 100644
index 3df72ff86..000000000
--- a/src/nautilus-search-bar-criterion-private.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-search-bar-criterion-private.h - Code to bring up
- the various kinds of criterion supported in the nautilus search
- bar
-
- Copyright (C) 2000 Eazel, 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; see the file COPYING. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Rebecca Schulman <rebecka@eazel.com>
-*/
-
-#ifndef NAUTILUS_SEARCH_BAR_CRITERION_PRIVATE_H
-#define NAUTILUS_SEARCH_BAR_CRITERION_PRIVATE_H
-
-#include "nautilus-complex-search-bar.h"
-#include "nautilus-search-bar-criterion.h"
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkoptionmenu.h>
-#include <time.h>
-#include <libgnomeui/gnome-dateedit.h>
-
-struct NautilusSearchBarCriterionDetails {
- NautilusSearchBarCriterionType type;
-
- /* The container for the widgets */
- GtkWidget *box;
-
- /* various widgets held by the criterion */
- GtkOptionMenu *available_criteria;
- GtkOptionMenu *relation_menu;
- gboolean use_value_entry;
- NautilusEntry *value_entry;
- gboolean use_value_menu;
- GtkOptionMenu *value_menu;
- gboolean use_value_suffix;
- GtkLabel *value_suffix;
- GnomeDateEdit *date;
-
- /* Keep a pointer to the whole bar, so we know what other
- criteria are currently chosen, and therefore what types are
- valid to change to */
- NautilusComplexSearchBar *bar;
-
-};
-
-#endif /* NAUTILUS_SEARCH_BAR_CRITERION_PRIVATE_H */
diff --git a/src/nautilus-search-bar-criterion.c b/src/nautilus-search-bar-criterion.c
deleted file mode 100644
index f1db7fccd..000000000
--- a/src/nautilus-search-bar-criterion.c
+++ /dev/null
@@ -1,1105 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-search-bar-criterion.c - Code to bring up
- the various kinds of criterion supported in the nautilus search
- bar
-
- Copyright (C) 2000 Eazel, 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; see the file COPYING. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Rebecca Schulman <rebecka@eazel.com>
-*/
-
-#include <config.h>
-#include "nautilus-search-bar-criterion.h"
-
-#include "nautilus-search-bar-criterion-private.h"
-#include "nautilus-signaller.h"
-#include <eel/eel-dateedit-extensions.h>
-#include <eel/eel-gtk-macros.h>
-#include <eel/eel-labeled-image.h>
-#include <eel/eel-string.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkeventbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtksignal.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dateedit.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libnautilus-private/nautilus-customization-data.h>
-#include <libnautilus-private/nautilus-entry.h>
-#include <libnautilus-private/nautilus-file-utilities.h>
-#include <libnautilus-private/nautilus-icon-factory.h>
-#include <libnautilus-private/nautilus-search-uri.h>
-#include <libnautilus-private/nautilus-undo-signal-handlers.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include "gtkhwrapbox.h"
-
-enum {
- CRITERION_TYPE_CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-static char * criteria_titles [] = {
- /* Menu item in the search bar.
- Bracketed items are context, and are message
- strings elsewhere. You don't have to translate the whole
- string, and only the translation for "containing '%s' will
- be used. If you do translate the whole string, leave the
- translations of the rest of the text in brackets, so it
- will not be used. */
- N_("[Search for] Name [contains \"fish\"]"),
- N_("[Search for] Content [includes all of \"fish tree\"]"),
- N_("[Search for] Type [is regular file]"),
- N_("[Search for] Size [larger than 400K]"),
- N_("[Search for] With Emblem [includes \"Important\"]"),
- N_("[Search for] Last Modified [before yesterday]"),
- N_("[Search for] Owner [is not root]"),
- NULL
-};
-
-
-static char *name_relations [] = {
- N_("[File name] contains [help]"),
- N_("[File name] starts with [nautilus]"),
- N_("[File name] ends with [.c]"),
- N_("[File name] matches glob [*.c]"),
- N_("[File name] matches regexp [\"e??l.$\"]"),
- NULL
-};
-
-static char *content_relations [] = {
- N_("[File content] includes all of [apple orange]"),
- N_("[File content] includes any of [apply orange]"),
- N_("[File content] does not include all of [apple orange]"),
- N_("[File content] includes none of [apple orange]"),
- NULL
-
-};
-
-static char *type_relations [] = {
- N_("[File type] is [folder]"),
- N_("[File type] is not [folder]"),
- NULL
-};
-
-static char *type_objects [] = {
- N_("[File type is] regular file"),
- N_("[File type is] text file"),
- N_("[File type is] application"),
- N_("[File type is] folder"),
- N_("[File type is] music"),
- NULL
-};
-
-static char *size_relations [] = {
- N_("[File size is] larger than [400K]"),
- N_("[File size is] smaller than [300K]"),
- NULL
-};
-
-static char *emblem_relations [] = {
- N_("[With emblem] marked with [Important]"),
- N_("[With emblem] not marked with [Important]"),
- NULL
-};
-
-static char *modified_relations [] = {
- N_("[Last modified date] is [1/24/00]"),
- N_("[Last modified date] is not [1/24/00]"),
- N_("[Last modified date] is after [1/24/00]"),
- N_("[Last modified date] is before [1/24/00]"),
- "",
- N_("[Last modified date] is today"),
- N_("[Last modified date] is yesterday"),
- "",
- N_("[Last modified date] is within a week of [1/24/00]"),
- N_("[Last modified date] is within a month of [1/24/00]"),
- NULL
-};
-
-static gboolean modified_relation_shows_date [] = {
- TRUE,
- TRUE,
- TRUE,
- TRUE,
- TRUE, /* Separator */
- FALSE, /* is today */
- FALSE, /* is yesterday */
- TRUE, /* Separator */
- TRUE,
- TRUE,
- /* NULL */
-};
-
-static char *owner_relations [] = {
- N_("[File owner] is [root]"),
- N_("[File owner] is not [root]"),
- NULL
-};
-
-
-static GtkWidget * nautilus_search_bar_criterion_new (void);
-static NautilusSearchBarCriterion * nautilus_search_bar_criterion_new_from_values (NautilusSearchBarCriterionType type,
- char *operator_options[],
- gboolean use_value_entry,
- gboolean use_value_menu,
- char *value_options[],
- gboolean use_value_suffix,
- char *value_suffix,
- NautilusComplexSearchBar *bar);
-NautilusSearchBarCriterionType get_next_default_search_criterion_type (NautilusSearchBarCriterionType type);
-static void nautilus_search_bar_criterion_class_init (NautilusSearchBarCriterionClass *klass);
-static void nautilus_search_bar_criterion_init (NautilusSearchBarCriterion *criterion);
-static gboolean modified_relation_should_show_value (int relation_index);
-static void hide_date_widget (GtkObject *object,
- gpointer data);
-static void show_date_widget (GtkObject *object,
- gpointer data);
-static char * get_name_location_for (int relation_number,
- const char *name_text);
-static char * get_content_location_for (int relation_number,
- const char *name_text);
-static char * get_file_type_location_for (int relation_number,
- int value_number);
-static char * get_size_location_for (int relation_number,
- const char *size_text);
-static char * get_emblem_location_for (int relation_number,
- GtkWidget *menu_item);
-static char * get_date_modified_location_for (int relation_number,
- const char *date);
-static char * get_owner_location_for (int relation_number,
- const char *owner_number);
-static void make_emblem_value_menu (NautilusSearchBarCriterion *criterion);
-static void criterion_type_changed_callback (GtkObject *object,
- gpointer data);
-static void emblems_changed_callback (GObject *signaller,
- gpointer data);
-static gboolean criterion_type_already_is_displayed (GSList *criteria,
- NautilusSearchBarCriterionType criterion_number);
-static NautilusSearchBarCriterionType get_next_criterion_type (NautilusSearchBarCriterionType current_type,
- GSList *displayed_criteria);
-static void nautilus_search_bar_criterion_destroy (GtkObject *object);
-
-EEL_CLASS_BOILERPLATE (NautilusSearchBarCriterion, nautilus_search_bar_criterion, GTK_TYPE_EVENT_BOX)
-
- static void
-nautilus_search_bar_criterion_class_init (NautilusSearchBarCriterionClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
- object_class->destroy = nautilus_search_bar_criterion_destroy;
-
- signals[CRITERION_TYPE_CHANGED] = g_signal_new
- ("criterion_type_changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-}
-
-void
-nautilus_search_bar_criterion_destroy (GtkObject *object)
-{
- NautilusSearchBarCriterion *criterion;
-
- g_return_if_fail (NAUTILUS_IS_SEARCH_BAR_CRITERION (object));
- criterion = NAUTILUS_SEARCH_BAR_CRITERION (object);
-
- /* FIXME bugzilla.gnome.org 42437: need more freeage */
- /* nautilus_undo_editable_set_undo_key (GTK_EDITABLE (criterion->details->value_entry), FALSE);
- nautilus_undo_tear_down_nautilus_entry_for_undo (criterion->details->value_entry);
- */
- g_free (criterion->details);
-
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-
-static GtkWidget *
-nautilus_search_bar_criterion_new (void)
-{
- return gtk_widget_new (NAUTILUS_TYPE_SEARCH_BAR_CRITERION, NULL);
-}
-
-
-static void
-nautilus_search_bar_criterion_init (NautilusSearchBarCriterion *criterion)
-{
- criterion->details = g_new0 (NautilusSearchBarCriterionDetails, 1);
-}
-
-static void
-queue_bar_resize_callback (GtkObject *wrap_box,
- gpointer bar)
-{
- NautilusComplexSearchBar *complex_bar;
-
- complex_bar = NAUTILUS_COMPLEX_SEARCH_BAR (bar);
- if (GTK_WIDGET_VISIBLE (wrap_box)) {
- nautilus_complex_search_bar_queue_resize (complex_bar);
- }
-}
-
-static NautilusSearchBarCriterion *
-nautilus_search_bar_criterion_new_from_values (NautilusSearchBarCriterionType type,
- char *relation_options[],
- gboolean use_value_entry,
- gboolean use_value_menu,
- char *value_options[],
- gboolean use_value_suffix,
- char *value_suffix,
- NautilusComplexSearchBar *bar)
-{
- NautilusSearchBarCriterion *criterion;
- NautilusSearchBarCriterionDetails *details;
- GtkWidget *search_criteria_option_menu, *search_criteria_menu;
- GtkWidget *relation_option_menu, *relation_menu;
- GtkWidget *value_option_menu, *value_menu;
- char *context_stripped_criteria_title;
- char *context_stripped_relation, *context_stripped_value;
- int i;
-
- g_return_val_if_fail (NAUTILUS_IS_COMPLEX_SEARCH_BAR (bar), NULL);
-
- criterion = NAUTILUS_SEARCH_BAR_CRITERION (nautilus_search_bar_criterion_new ());
- details = criterion->details;
-
- details->type = type;
- details->bar = bar;
- details->box = gtk_hwrap_box_new (FALSE);
-
- g_signal_connect_object (details->box, "need_reallocation",
- G_CALLBACK (queue_bar_resize_callback), bar, 0);
- g_signal_connect_object (nautilus_signaller_get_current (), "emblems_changed",
- G_CALLBACK (emblems_changed_callback), criterion, 0);
-
-
- search_criteria_option_menu = gtk_option_menu_new ();
- search_criteria_menu = gtk_menu_new ();
-
- for (i = 0; criteria_titles[i] != NULL; i++) {
- GtkWidget *item;
- context_stripped_criteria_title = eel_str_remove_bracketed_text (_(criteria_titles[i]));
- item = gtk_menu_item_new_with_label (context_stripped_criteria_title);
- g_free (context_stripped_criteria_title);
-
- g_object_set_data (G_OBJECT(item), "type", GINT_TO_POINTER(i));
- g_signal_connect_object (item, "activate",
- G_CALLBACK (criterion_type_changed_callback), criterion, 0);
- gtk_menu_shell_append (GTK_MENU_SHELL (search_criteria_menu),
- item);
- gtk_widget_show (item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (search_criteria_option_menu),
- search_criteria_menu);
- details->available_criteria = GTK_OPTION_MENU (search_criteria_option_menu);
- gtk_widget_show_all (GTK_WIDGET (search_criteria_option_menu));
- gtk_wrap_box_pack (GTK_WRAP_BOX (details->box),
- GTK_WIDGET (details->available_criteria),
- FALSE,
- FALSE,
- FALSE,
- FALSE);
-
- relation_option_menu = gtk_option_menu_new ();
- relation_menu = gtk_menu_new ();
- for (i = 0; relation_options[i] != NULL; i++) {
- GtkWidget *item;
- if (eel_str_is_empty (relation_options[i])) {
- /* Empty text; make unselectable separator */
- item = gtk_menu_item_new ();
- gtk_widget_set_sensitive (item, FALSE);
- } else {
- context_stripped_relation = eel_str_remove_bracketed_text (_(relation_options[i]));
- item = gtk_menu_item_new_with_label (context_stripped_relation);
- g_free (context_stripped_relation);
- }
- gtk_widget_show (item);
- g_object_set_data (G_OBJECT(item), "type", GINT_TO_POINTER(i));
- /* Callback to desensitize the date widget for menu items that
- don't need a date, like "yesterday" */
- if (details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION) {
- if (modified_relation_should_show_value (i)) {
- g_signal_connect_object (item, "activate",
- G_CALLBACK (show_date_widget), criterion, 0);
- }
- else {
- g_signal_connect_object (item, "activate",
- G_CALLBACK (hide_date_widget), criterion, 0);
- }
- }
- gtk_menu_shell_append (GTK_MENU_SHELL (relation_menu),
- item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (relation_option_menu),
- relation_menu);
- details->relation_menu = GTK_OPTION_MENU (relation_option_menu);
- gtk_widget_show_all (GTK_WIDGET(relation_option_menu));
- gtk_wrap_box_pack (GTK_WRAP_BOX (details->box),
- GTK_WIDGET (details->relation_menu),
- FALSE,
- FALSE,
- FALSE,
- FALSE);
-
- g_assert (! (use_value_entry && use_value_menu));
- details->use_value_entry = use_value_entry;
- if (use_value_entry) {
- details->value_entry = NAUTILUS_ENTRY (nautilus_entry_new ());
- gtk_widget_show_all(GTK_WIDGET(details->value_entry));
- gtk_wrap_box_pack (GTK_WRAP_BOX (details->box),
- GTK_WIDGET (details->value_entry),
- FALSE,
- FALSE,
- FALSE,
- FALSE);
-
- nautilus_undo_set_up_nautilus_entry_for_undo (details->value_entry);
- nautilus_undo_editable_set_undo_key (GTK_EDITABLE (details->value_entry), TRUE);
- }
- details->use_value_menu = use_value_menu;
- if (use_value_menu && details->type != NAUTILUS_EMBLEM_SEARCH_CRITERION) {
- g_return_val_if_fail (value_options != NULL, NULL);
- value_option_menu = gtk_option_menu_new ();
- value_menu = gtk_menu_new ();
- for (i = 0; value_options[i] != NULL; i++) {
- GtkWidget *item;
- context_stripped_value = eel_str_remove_bracketed_text (_(value_options[i]));
- item = gtk_menu_item_new_with_label (context_stripped_value);
- g_free (context_stripped_value);
- gtk_widget_show (item);
- g_object_set_data (G_OBJECT(item), "type", GINT_TO_POINTER(i));
- gtk_menu_shell_append (GTK_MENU_SHELL (value_menu),
- item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (value_option_menu),
- value_menu);
- details->value_menu = GTK_OPTION_MENU (value_option_menu);
- gtk_widget_show_all (GTK_WIDGET(details->value_menu));
- gtk_wrap_box_pack (GTK_WRAP_BOX (details->box),
- GTK_WIDGET (details->value_menu),
- FALSE,
- FALSE,
- FALSE,
- FALSE);
- }
- details->use_value_suffix = use_value_suffix;
- if (use_value_suffix) {
- g_return_val_if_fail (value_suffix != NULL, NULL);
- details->value_suffix = GTK_LABEL (gtk_label_new (value_suffix));
- gtk_widget_show_all (GTK_WIDGET (details->value_suffix));
- gtk_wrap_box_pack (GTK_WRAP_BOX (details->box),
- GTK_WIDGET (details->value_suffix),
- FALSE,
- FALSE,
- FALSE,
- FALSE);
- }
- /* Special case widgets here */
- if (details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION) {
- details->date = GNOME_DATE_EDIT (gnome_date_edit_new (time (NULL), FALSE, FALSE));
- gtk_widget_show_all (GTK_WIDGET (details->date));
- gtk_wrap_box_pack (GTK_WRAP_BOX (details->box),
- GTK_WIDGET (details->date),
- FALSE,
- FALSE,
- FALSE,
- FALSE);
- }
- if (details->type == NAUTILUS_EMBLEM_SEARCH_CRITERION) {
- value_option_menu = gtk_option_menu_new ();
- details->value_menu = GTK_OPTION_MENU (value_option_menu);
- make_emblem_value_menu (criterion);
- gtk_wrap_box_pack (GTK_WRAP_BOX (details->box),
- GTK_WIDGET (details->value_menu),
- FALSE,
- FALSE,
- FALSE,
- FALSE);
-
- }
-
- return criterion;
-}
-
-
-NautilusSearchBarCriterion *
-nautilus_search_bar_criterion_next_new (NautilusSearchBarCriterionType criterion_type,
- NautilusComplexSearchBar *bar)
-{
- NautilusSearchBarCriterionType next_type;
-
- next_type = get_next_criterion_type (criterion_type,
- nautilus_complex_search_bar_get_search_criteria (bar));
-
- return nautilus_search_bar_criterion_new_with_type (next_type, bar);
-
-}
-
-NautilusSearchBarCriterion *
-nautilus_search_bar_criterion_new_with_type (NautilusSearchBarCriterionType criterion_type,
- NautilusComplexSearchBar *bar)
-{
- NautilusSearchBarCriterion *new_criterion;
-
- switch(criterion_type) {
- case NAUTILUS_FILE_NAME_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_FILE_NAME_SEARCH_CRITERION,
- name_relations,
- TRUE,
- FALSE,
- NULL,
- FALSE,
- NULL,
- bar);
- break;
- case NAUTILUS_CONTENT_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_CONTENT_SEARCH_CRITERION,
- content_relations,
- TRUE,
- FALSE,
- NULL,
- FALSE,
- NULL,
- bar);
- break;
- case NAUTILUS_FILE_TYPE_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_FILE_TYPE_SEARCH_CRITERION,
- type_relations,
- FALSE,
- TRUE,
- type_objects,
- FALSE,
- NULL,
- bar);
- break;
- case NAUTILUS_SIZE_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_SIZE_SEARCH_CRITERION,
- size_relations,
- TRUE,
- FALSE,
- NULL,
- TRUE,
- "K",
- bar);
- break;
- case NAUTILUS_EMBLEM_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_EMBLEM_SEARCH_CRITERION,
- emblem_relations,
- FALSE,
- FALSE,
- NULL,
- FALSE,
- NULL,
- bar);
-
- break;
- case NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION,
- modified_relations,
- FALSE,
- FALSE,
- NULL,
- FALSE,
- NULL,
- bar);
- break;
- case NAUTILUS_OWNER_SEARCH_CRITERION:
- new_criterion = nautilus_search_bar_criterion_new_from_values (NAUTILUS_OWNER_SEARCH_CRITERION,
- owner_relations,
- TRUE,
- FALSE,
- NULL,
- FALSE,
- NULL,
- bar);
- break;
- default:
- new_criterion = NULL;
- g_assert_not_reached ();
- }
- if (new_criterion->details->value_entry) {
- nautilus_complex_search_bar_set_up_enclosed_entry_for_clipboard
- (bar, new_criterion->details->value_entry);
- }
- return new_criterion;
-}
-
-
-NautilusSearchBarCriterion *
-nautilus_search_bar_criterion_first_new (NautilusComplexSearchBar *bar)
-{
- return nautilus_search_bar_criterion_new_from_values (NAUTILUS_FILE_NAME_SEARCH_CRITERION,
- name_relations,
- TRUE,
- FALSE,
- NULL,
- FALSE,
- NULL,
- bar);
-}
-
-/* returns a newly allocated string: needs to be freed by the caller. */
-char *
-nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterion)
-{
- GtkWidget *menu;
- GtkWidget *menu_item;
- int name_number, relation_number, value_number;
- const char *value_text;
-
- value_number = 0;
- value_text = NULL;
- /* There is ONE thing you should be aware of while implementing this function.
- You have to make sure you use non-translated strings for building the uri.
- So, to implement this, you are supposed to:
- - build various tables which contain the strings corresponding to a search type.
- - call
- option_menu = gtk_option_menu_get_menu (criterion->details->some_menu)
- menu_item = gtk_menu_get_active (option_menu)
- number = g_object_get_data (menu_item, "type")
- */
- menu = gtk_option_menu_get_menu (criterion->details->available_criteria);
- menu_item = gtk_menu_get_active (GTK_MENU (menu));
- name_number = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "type"));
-
- menu = gtk_option_menu_get_menu (criterion->details->relation_menu);
- menu_item = gtk_menu_get_active (GTK_MENU (menu));
- relation_number = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "type"));
-
- if (criterion->details->use_value_menu) {
- menu = gtk_option_menu_get_menu (criterion->details->value_menu);
- menu_item = gtk_menu_get_active (GTK_MENU (menu));
- value_number = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "type"));
- } else if (criterion->details->use_value_entry) {
- value_text = gtk_entry_get_text (GTK_ENTRY (criterion->details->value_entry));
- } else if (criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION) {
- value_text = eel_gnome_date_edit_get_date_as_string (criterion->details->date);
- }
-
- switch (name_number) {
- case NAUTILUS_FILE_NAME_SEARCH_CRITERION:
- g_assert (criterion->details->use_value_entry
- || criterion->details->type == NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION);
- return get_name_location_for (relation_number, value_text);
- case NAUTILUS_CONTENT_SEARCH_CRITERION:
- return get_content_location_for (relation_number, value_text);
- case NAUTILUS_FILE_TYPE_SEARCH_CRITERION:
- g_assert (criterion->details->use_value_menu);
- return get_file_type_location_for (relation_number, value_number);
- case NAUTILUS_SIZE_SEARCH_CRITERION:
- return get_size_location_for (relation_number, value_text);
- case NAUTILUS_EMBLEM_SEARCH_CRITERION:
- return get_emblem_location_for (relation_number, menu_item);
- case NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION:
- return get_date_modified_location_for (relation_number, value_text);
- case NAUTILUS_OWNER_SEARCH_CRITERION:
- return get_owner_location_for (relation_number, value_text);
- default:
- break;
- }
-
- g_assert_not_reached ();
- return NULL;
-}
-
-
-NautilusSearchBarCriterionType
-get_next_default_search_criterion_type (NautilusSearchBarCriterionType type)
-{
- switch (type) {
- case NAUTILUS_FILE_NAME_SEARCH_CRITERION:
- return NAUTILUS_CONTENT_SEARCH_CRITERION;
- case NAUTILUS_CONTENT_SEARCH_CRITERION:
- return NAUTILUS_FILE_TYPE_SEARCH_CRITERION;
- case NAUTILUS_FILE_TYPE_SEARCH_CRITERION:
- return NAUTILUS_SIZE_SEARCH_CRITERION;
- case NAUTILUS_SIZE_SEARCH_CRITERION:
- return NAUTILUS_SIZE_SEARCH_CRITERION;
- case NAUTILUS_EMBLEM_SEARCH_CRITERION:
- return NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION;
- case NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION:
- return NAUTILUS_OWNER_SEARCH_CRITERION;
- case NAUTILUS_OWNER_SEARCH_CRITERION:
- return NAUTILUS_FILE_NAME_SEARCH_CRITERION;
- default:
- g_assert_not_reached ();
- return NAUTILUS_NUMBER_OF_SEARCH_CRITERIA;
- }
- return NAUTILUS_NUMBER_OF_SEARCH_CRITERIA;
-}
-
-void
-nautilus_search_bar_criterion_show (NautilusSearchBarCriterion *criterion)
-{
-
- gtk_widget_show (GTK_WIDGET (criterion->details->available_criteria));
- gtk_widget_show (GTK_WIDGET (criterion->details->relation_menu));
-
- if (criterion->details->use_value_entry) {
- gtk_widget_show (GTK_WIDGET (criterion->details->value_entry));
- }
- if (criterion->details->use_value_menu) {
- gtk_widget_show (GTK_WIDGET (criterion->details->value_menu));
- }
- gtk_widget_show (criterion->details->box);
-}
-
-
-
-void
-nautilus_search_bar_criterion_hide (NautilusSearchBarCriterion *criterion)
-{
-
- gtk_widget_hide (GTK_WIDGET (criterion->details->available_criteria));
- gtk_widget_hide (GTK_WIDGET (criterion->details->relation_menu));
-
- if (criterion->details->use_value_entry) {
- gtk_widget_hide (GTK_WIDGET (criterion->details->value_entry));
- }
- if (criterion->details->use_value_menu) {
- gtk_widget_hide (GTK_WIDGET (criterion->details->value_menu));
- }
- gtk_widget_hide (criterion->details->box);
-}
-
-void
-nautilus_search_bar_criterion_update_valid_criteria_choices (NautilusSearchBarCriterion *criterion,
- GSList *current_criteria)
-{
- GtkWidget *old_menu, *new_menu;
- GtkWidget *item;
- char *context_stripped_criteria_title;
- guint i;
-
- /* We remove the whole menu and put in a new one. */
- new_menu = gtk_menu_new ();
- for (i = 0; criteria_titles[i] != NULL; i++) {
- context_stripped_criteria_title = eel_str_remove_bracketed_text (_(criteria_titles[i]));
- item = gtk_menu_item_new_with_label (context_stripped_criteria_title);
- g_free (context_stripped_criteria_title);
-
- g_object_set_data (G_OBJECT(item), "type", GINT_TO_POINTER(i));
-
- g_signal_connect_object (item, "activate",
- G_CALLBACK (criterion_type_changed_callback), criterion, 0);
- gtk_menu_shell_append (GTK_MENU_SHELL (new_menu),
- item);
- gtk_widget_show (item);
- if (i == criterion->details->type) {
- gtk_menu_set_active (GTK_MENU (new_menu), i);
- }
- if (i != criterion->details->type &&
- criterion_type_already_is_displayed (current_criteria, i)) {
- gtk_widget_set_sensitive (item, FALSE);
- continue;
- }
- }
-
- old_menu = gtk_option_menu_get_menu (criterion->details->available_criteria);
-
- gtk_object_destroy (GTK_OBJECT (old_menu));
- gtk_option_menu_set_menu (criterion->details->available_criteria,
- new_menu);
-
- gtk_widget_show_all (GTK_WIDGET (criterion->details->available_criteria));
-
-}
-
-char *
-nautilus_search_bar_criterion_human_from_uri (const char *location_uri)
-{
- return g_strdup (location_uri);
-}
-
-char *
-nautilus_search_uri_get_first_criterion (const char *search_uri)
-{
- char *unescaped_uri;
- char *first_criterion;
- int matches;
-
- unescaped_uri = gnome_vfs_unescape_string (search_uri, NULL);
-
- /* Start with a string as long as the URI, since
- * we don't necessarily trust the search_uri to have
- * the pattern we're looking for.
- */
- first_criterion = g_strdup (unescaped_uri);
-
- matches = sscanf (unescaped_uri, "search:[file:///]%s", first_criterion);
- g_free (unescaped_uri);
-
- if (matches == 0) {
- g_free (first_criterion);
- return NULL;
- }
-
- return first_criterion;
-}
-
-static gboolean
-modified_relation_should_show_value (int relation_index)
-{
- return modified_relation_shows_date[relation_index];
-}
-
-static void
-hide_date_widget (GtkObject *object,
- gpointer data)
-{
- NautilusSearchBarCriterion *criterion;
- NautilusSearchBarCriterionDetails *details;
-
- criterion = NAUTILUS_SEARCH_BAR_CRITERION (data);
- details = criterion->details;
-
- gtk_widget_hide (GTK_WIDGET (details->date));
- nautilus_complex_search_bar_queue_resize (details->bar);
-}
-
-static void
-show_date_widget (GtkObject *object,
- gpointer data)
-{
- NautilusSearchBarCriterion *criterion;
- NautilusSearchBarCriterionDetails *details;
-
- criterion = NAUTILUS_SEARCH_BAR_CRITERION (data);
- details = criterion->details;
-
- gtk_widget_show (GTK_WIDGET (details->date));
- nautilus_complex_search_bar_queue_resize (details->bar);
-}
-
-
-static char *
-get_name_location_for (int relation_number, const char *name_text)
-{
- const char *possible_relations[] = { "contains",
- "begins_with",
- "ends_with",
- "matches",
- "matches_regexp" };
-
- g_assert (relation_number >= 0);
- g_assert (relation_number < 5);
-
- return g_strdup_printf ("%s %s %s",
- NAUTILUS_SEARCH_URI_TEXT_NAME,
- possible_relations[relation_number],
- name_text);
-
-}
-
-static char *
-get_content_location_for (int relation_number, const char *name_text)
-{
- const char *possible_relations[] = { "includes_all_of",
- "includes_any_of",
- "does_not_include_all_of",
- "does_not_include_any_of" };
-
- g_assert (relation_number>= 0);
- g_assert (relation_number < 4);
-
- return g_strdup_printf ("%s %s %s",
- NAUTILUS_SEARCH_URI_TEXT_CONTENT,
- possible_relations[relation_number],
- name_text);
-}
-
-static char *
-get_file_type_location_for (int relation_number,
- int value_number)
-{
- const char *possible_relations[] = { "is", "is_not" };
- const char *possible_values[] = {"file", "text_file", "application", "directory", "music" };
-
- g_assert (relation_number == 0 || relation_number == 1);
- g_assert (value_number >= 0);
- g_assert (value_number < 5);
-
- return g_strdup_printf ("%s %s %s",
- NAUTILUS_SEARCH_URI_TEXT_TYPE,
- possible_relations[relation_number],
- possible_values[value_number]);
-}
-
-
-static char *
-get_size_location_for (int relation_number,
- const char *size_text)
-{
- const char *possible_relations[] = { "larger_than", "smaller_than" };
- int entered_size;
- gboolean int_conversion_success;
-
- g_assert (relation_number == 0 || relation_number == 1);
- /* We put a 'K' after the size, so multiply what the user
- entered by 1000 */
- int_conversion_success = eel_str_to_int (size_text,
- &entered_size);
-
- if (int_conversion_success) {
- return g_strdup_printf ("%s %s %d", NAUTILUS_SEARCH_URI_TEXT_SIZE,
- possible_relations[relation_number],
- entered_size * 1024);
- }
- else {
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_SIZE,
- possible_relations[relation_number],
- size_text);
- }
-
-}
-
-static char *
-get_emblem_location_for (int relation_number,
- GtkWidget *menu_item)
-{
- const char *possible_relations[] = {"include", "do_not_include" };
- char *emblem_text;
-
- g_assert (relation_number == 0 ||
- relation_number == 1);
- emblem_text = g_object_get_data (G_OBJECT (menu_item),
- "emblem name");
- printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_EMBLEMS, possible_relations[relation_number], emblem_text);
- return g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_EMBLEMS,
- possible_relations[relation_number],
- emblem_text);
-}
-
-static char *
-get_date_modified_location_for (int relation_number,
- const char *date_string)
-{
- const char *possible_relations[] = { "is",
- "is_not",
- "is_after",
- "is_before",
- "",
- "is_today",
- "is_yesterday",
- "",
- "is_within_a_week_of",
- "is_within_a_month_of" };
- char *result;
-
- g_assert (relation_number >= 0);
- g_assert (relation_number < 10);
- g_return_val_if_fail (relation_number != 4 && relation_number != 7, g_strdup (""));
-
- /* Handle "is today" and "is yesterday" separately */
- if (relation_number == 5) {
- result = g_strdup_printf ("%s is today", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED);
- } else if (relation_number == 6) {
- result = g_strdup_printf ("%s is yesterday", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED);
- } else if (date_string != NULL) {
- result = g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED,
- possible_relations[relation_number],
- date_string);
- } else {
- result = g_strdup ("");
- }
- if (relation_number != 5 && relation_number != 6) {
- if (date_string == NULL) {
- return g_strdup ("");
- }
- else {
- result = g_strdup_printf ("%s %s %s", NAUTILUS_SEARCH_URI_TEXT_DATE_MODIFIED,
- possible_relations[relation_number],
- date_string);
- }
- }
- return result;
-
-}
-
-static char *
-get_owner_location_for (int relation_number,
- const char *owner_text)
-{
- const char *possible_relations[] = { "is", "is_not" };
- g_assert (relation_number == 0 || relation_number == 1);
- return g_strdup_printf ("%s %s %s",
- NAUTILUS_SEARCH_URI_TEXT_OWNER,
- possible_relations[relation_number],
- owner_text);
-}
-
-static void
-make_emblem_value_menu (NautilusSearchBarCriterion *criterion)
-{
- NautilusCustomizationData *customization_data;
- GtkWidget *menu_item;
- char *emblem_name, *dot_pos;
- GtkWidget *value_menu;
- GdkPixbuf *pixbuf;
- char *label;
-
- /* Add the items to the emblems menu here */
- value_menu = gtk_menu_new ();
- customization_data = nautilus_customization_data_new ("emblems",
- TRUE,
- TRUE,
- NAUTILUS_ICON_SIZE_FOR_MENUS,
- NAUTILUS_ICON_SIZE_FOR_MENUS);
- while (nautilus_customization_data_get_next_element_for_display (customization_data,
- &emblem_name,
- &pixbuf,
- &label) == GNOME_VFS_OK) {
- GtkWidget *image;
-
- /* remove the suffix, if any, to make the emblem name */
- dot_pos = strrchr (emblem_name, '.');
- if (dot_pos) {
- *dot_pos = '\0';
- }
-
- if (strcmp (emblem_name, "erase") == 0) {
- g_object_unref (pixbuf);
- g_free (label);
- g_free (emblem_name);
- continue;
- }
- menu_item = gtk_menu_item_new ();
-
- g_object_set_data_full (G_OBJECT (menu_item), "emblem name",
- g_strdup (emblem_name), g_free);
-
-
- image = eel_labeled_image_new (label, pixbuf);
- eel_labeled_image_set_label_position (EEL_LABELED_IMAGE (image), GTK_POS_RIGHT);
- eel_labeled_image_set_x_alignment (EEL_LABELED_IMAGE (image), 0.0);
- eel_labeled_image_set_spacing (EEL_LABELED_IMAGE (image), 4);
-
- gtk_container_add (GTK_CONTAINER (menu_item), image);
- gtk_widget_show_all (menu_item);
- gtk_menu_shell_append (GTK_MENU_SHELL (value_menu), menu_item);
-
- g_object_unref (pixbuf);
- g_free (label);
- g_free (emblem_name);
- }
-
- gtk_widget_show_all (GTK_WIDGET (criterion->details->value_menu));
- gtk_option_menu_set_menu (criterion->details->value_menu,
- value_menu);
- criterion->details->use_value_menu = TRUE;
-}
-
-
-
-static void
-criterion_type_changed_callback (GtkObject *object,
- gpointer data)
-{
- NautilusSearchBarCriterion *criterion;
- GtkWidget *menu_item;
-
- g_return_if_fail (NAUTILUS_IS_SEARCH_BAR_CRITERION (data));
- g_return_if_fail (GTK_IS_MENU_ITEM (object));
- criterion = NAUTILUS_SEARCH_BAR_CRITERION (data);
- menu_item = GTK_WIDGET (object);
-
- g_return_if_fail (NAUTILUS_IS_COMPLEX_SEARCH_BAR (criterion->details->bar));
- g_object_set_data (G_OBJECT (criterion), "type",
- g_object_get_data (G_OBJECT (menu_item), "type"));
- g_signal_emit (criterion,
- signals[CRITERION_TYPE_CHANGED], 0);
-
-}
-
-static void
-emblems_changed_callback (GObject *signaller,
- gpointer data)
-{
- NautilusSearchBarCriterion *criterion;
- GtkWidget *menu_widget;
-
- criterion = NAUTILUS_SEARCH_BAR_CRITERION (data);
-
- if (criterion->details->type == NAUTILUS_EMBLEM_SEARCH_CRITERION) {
- /* Get rid of the old menu */
- menu_widget = gtk_option_menu_get_menu (criterion->details->value_menu);
- gtk_option_menu_remove_menu (criterion->details->value_menu);
- gtk_widget_destroy (menu_widget);
- make_emblem_value_menu (criterion);
- }
-}
-
-static gint
-criterion_is_of_type (gconstpointer a,
- gconstpointer b)
-{
- NautilusSearchBarCriterion *criterion;
- NautilusSearchBarCriterionType type;
-
- criterion = NAUTILUS_SEARCH_BAR_CRITERION (a);
- type = (NautilusSearchBarCriterionType) b;
-
- return (criterion->details->type - type);
-}
-
-static gboolean
-criterion_type_already_is_displayed (GSList *criteria,
- NautilusSearchBarCriterionType criterion_number)
-{
- if (g_slist_find_custom (criteria,
- GINT_TO_POINTER (criterion_number),
- criterion_is_of_type)) {
- return TRUE;
- }
- else {
- return FALSE;
- }
-}
-
-
-
-static NautilusSearchBarCriterionType
-get_next_criterion_type (NautilusSearchBarCriterionType current_type,
- GSList *displayed_criteria)
-{
- NautilusSearchBarCriterionType new_type;
-
- g_assert (g_slist_length (displayed_criteria) < NAUTILUS_NUMBER_OF_SEARCH_CRITERIA);
-
- new_type = (current_type + 1) % NAUTILUS_NUMBER_OF_SEARCH_CRITERIA;
- while (criterion_type_already_is_displayed (displayed_criteria,
- new_type)) {
- new_type = (new_type + 1) % NAUTILUS_NUMBER_OF_SEARCH_CRITERIA;
- }
-
- return new_type;
-}
-
diff --git a/src/nautilus-search-bar-criterion.h b/src/nautilus-search-bar-criterion.h
deleted file mode 100644
index 12a9387ac..000000000
--- a/src/nautilus-search-bar-criterion.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* nautilus-search-bar-criterion.h - Types that will
- bring up the various search criteria
-
- Copyright (C) 2000 Eazel, 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; see the file COPYING. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Rebecca Schulman <rebecka@eazel.com>
-*/
-
-
-#ifndef NAUTILUS_SEARCH_BAR_CRITERION_H
-#define NAUTILUS_SEARCH_BAR_CRITERION_H
-
-#include "nautilus-complex-search-bar.h"
-#include <gtk/gtkeventbox.h>
-#include <libnautilus-private/nautilus-entry.h>
-
-
-typedef enum {
- NAUTILUS_FILE_NAME_SEARCH_CRITERION,
- NAUTILUS_CONTENT_SEARCH_CRITERION,
- NAUTILUS_FILE_TYPE_SEARCH_CRITERION,
- NAUTILUS_SIZE_SEARCH_CRITERION,
- NAUTILUS_EMBLEM_SEARCH_CRITERION,
- NAUTILUS_DATE_MODIFIED_SEARCH_CRITERION,
- NAUTILUS_OWNER_SEARCH_CRITERION,
- NAUTILUS_NUMBER_OF_SEARCH_CRITERIA
-} NautilusSearchBarCriterionType;
-
-
-#define NAUTILUS_TYPE_SEARCH_BAR_CRITERION \
- (nautilus_search_bar_criterion_get_type ())
-#define NAUTILUS_SEARCH_BAR_CRITERION(obj) \
- (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_SEARCH_BAR_CRITERION, NautilusSearchBarCriterion))
-#define NAUTILUS_SEARCH_BAR_CRITERION_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_SEARCH_BAR_CRITERION, NautilusSearchBarCriterionClass))
-#define NAUTILUS_IS_SEARCH_BAR_CRITERION(obj) \
- (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_SEARCH_BAR_CRITERION))
-#define NAUTILUS_IS_SEARCH_BAR_CRITERION_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_SEARCH_BAR_CRITERION))
-
-
-typedef struct NautilusSearchBarCriterionDetails NautilusSearchBarCriterionDetails;
-
-typedef struct NautilusSearchBarCriterion {
- GtkEventBox parent_slot;
- NautilusSearchBarCriterionDetails *details;
-} NautilusSearchBarCriterion;
-
-
-typedef struct {
- GtkEventBoxClass parent_slot;
-} NautilusSearchBarCriterionClass;
-
-
-typedef void (* NautilusSearchBarCriterionCallback) (NautilusSearchBarCriterion *old_criterion,
- gpointer data);
-
-GType nautilus_search_bar_criterion_get_type (void);
-
-/* Three new procedures, each with a separate purpose:
- create the initial search option with first_new,
- create a new subsequent one automatically with next_new,
- and change to a particular type at a user's request with new_with_type */
-NautilusSearchBarCriterion * nautilus_search_bar_criterion_first_new (NautilusComplexSearchBar *bar);
-
-NautilusSearchBarCriterion * nautilus_search_bar_criterion_next_new (NautilusSearchBarCriterionType criterion_type,
- NautilusComplexSearchBar *bar);
-NautilusSearchBarCriterion * nautilus_search_bar_criterion_new_with_type (NautilusSearchBarCriterionType criteiron_type,
- NautilusComplexSearchBar *bar);
-
-
-char * nautilus_search_bar_criterion_get_location (NautilusSearchBarCriterion *criterion);
-
-void nautilus_search_bar_criterion_show (NautilusSearchBarCriterion *criterion);
-void nautilus_search_bar_criterion_hide (NautilusSearchBarCriterion *criterion);
-
-/* Run when a criteria changes so that we can be sure we give only valid criteria choices to the user,
- (like whether you can select name, type, etc. */
-void nautilus_search_bar_criterion_update_valid_criteria_choices (NautilusSearchBarCriterion *criterion,
- GSList *current_criteria);
-
-
-/* Search URI utilities. Maybe these should go in a separate file? */
-char * nautilus_search_bar_criterion_human_from_uri (const char *location_uri);
-
-char * nautilus_search_uri_get_first_criterion (const char *search_uri);
-
-#endif /* NAUTILUS_SEARCH_BAR_CRITERION_H */
diff --git a/src/nautilus-search-bar-private.h b/src/nautilus-search-bar-private.h
deleted file mode 100644
index e228c059d..000000000
--- a/src/nautilus-search-bar-private.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Rebecca Schulman <rebecka@eazel.com>
- */
-
-/* nautilus-search-bar-criterion.c - Code to bring up
- * the various kinds of criterion supported in the nautilus search
- * bar
- */
-
-/* Functions to differentiate between using a complex search mode
- and simple search mode */
-
-gboolean nautilus_search_bar_mode_is_useable_with_uri (NautilusSearchBar *bar,
- const char *location,
- NautilusSearchBarMode mode);
-
-
-
diff --git a/src/nautilus-search-bar.c b/src/nautilus-search-bar.c
deleted file mode 100644
index c9b1e9b3d..000000000
--- a/src/nautilus-search-bar.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Maciej Stachowiak <mjs@eazel.com>
- * Rebecca Schulman <rebecka@eazel.com>
- */
-
-/* nautilus-search-bar.c - Search bar for Nautilus
- */
-
-#include <config.h>
-#include "nautilus-search-bar.h"
-
-#include <eel/eel-gtk-macros.h>
-
-/* FIXME bugzilla.gnome.org 42516: This adds nothing to NautilusNavigationBar.
- * Perhaps we can remove it.
- */
-
-static void nautilus_search_bar_class_init (NautilusSearchBarClass *class);
-static void nautilus_search_bar_init (NautilusSearchBar *bar);
-
-EEL_CLASS_BOILERPLATE (NautilusSearchBar, nautilus_search_bar, NAUTILUS_TYPE_NAVIGATION_BAR)
-
-static void
-nautilus_search_bar_class_init (NautilusSearchBarClass *klass)
-{
-}
-
-static void
-nautilus_search_bar_init (NautilusSearchBar *bar)
-{
-}
diff --git a/src/nautilus-search-bar.h b/src/nautilus-search-bar.h
deleted file mode 100644
index 7d58625e7..000000000
--- a/src/nautilus-search-bar.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Maciej Stachowiak <mjs@eazel.com>
- * Rebecca Schulman <rebecka@eazel.com>
- */
-
-/* nautilus-search-bar.h - Search bar for Nautilus
- */
-
-#ifndef NAUTILUS_SEARCH_BAR_H
-#define NAUTILUS_SEARCH_BAR_H
-
-#include "nautilus-navigation-bar.h"
-
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-
-#include <libnautilus-private/nautilus-global-preferences.h>
-
-#define NAUTILUS_TYPE_SEARCH_BAR (nautilus_search_bar_get_type ())
-#define NAUTILUS_SEARCH_BAR(obj) \
- GTK_CHECK_CAST (obj, NAUTILUS_TYPE_SEARCH_BAR, NautilusSearchBar)
-#define NAUTILUS_SEARCH_BAR_CLASS(klass) \
- GTK_CHECK_CLASS_CAST (klass, NAUTILUS_TYPE_SEARCH_BAR, NautilusSearchBarClass)
-#define NAUTILUS_IS_SEARCH_BAR(obj) \
- GTK_CHECK_TYPE (obj, NAUTILUS_TYPE_SEARCH_BAR)
-
-typedef struct {
- NautilusNavigationBar parent;
-} NautilusSearchBar;
-
-typedef struct {
- NautilusNavigationBarClass parent_class;
-} NautilusSearchBarClass;
-
-GType nautilus_search_bar_get_type (void);
-
-#endif /* NAUTILUS_SEARCH_BAR_H */
diff --git a/src/nautilus-shell-interface.idl b/src/nautilus-shell-interface.idl
index 9427e59a5..3b4649a92 100644
--- a/src/nautilus-shell-interface.idl
+++ b/src/nautilus-shell-interface.idl
@@ -4,9 +4,10 @@
#define NAUTILUS_SHELL_INTERFACE_IDL
#include <Bonobo.idl>
-#include <libnautilus/nautilus-view-component.idl>
module Nautilus {
+ typedef string URI;
+ typedef sequence<URI> URIList;
interface Shell : ::Bonobo::Unknown {
void open_windows (in URIList uris, in string geometry, in boolean browser_window);
diff --git a/src/nautilus-shell-ui.xml b/src/nautilus-shell-ui.xml
index aff8e3d35..ed4770e85 100644
--- a/src/nautilus-shell-ui.xml
+++ b/src/nautilus-shell-ui.xml
@@ -1,237 +1,82 @@
-<Root>
-
-<!-- A description of each placeholder's purpose is in libnautilus/nautilus-bonobo-ui.h -->
-
-<commands>
- <!-- We define commands here for (at least) all the items
- for which we share tip or sensitivity state between more
- than one item (usually 1 menuitem and 1 toolitem.
- -->
- <cmd name="Up"
- _tip="Go up one level"/>
- <cmd name="Find"
- _tip="Search this computer for files"/>
- <cmd name="Toggle Find Mode"
- _label="Find"
- _tip="Search this computer for files"/>
- <cmd name="Home"
- _tip="Go to the home location"/>
- <cmd name="Stop"
- _tip="Stop loading this location"/>
- <cmd name="Select All" accel="*Control*a" sensitive="0"/>
- <cmd name="Cut" accel="*Control*x" sensitive="0"/>
- <cmd name="Copy" accel="*Control*c" sensitive="0"/>
- <cmd name="Paste" accel="*Control*v" sensitive="0"/>
- <cmd name="Clear" sensitive="0"/>
- <cmd name="Reload"
- _tip="Display the latest contents of the current location"/>
- <cmd name="Go to Burn CD"
- _label="_CD/DVD Creator"
- _tip="Go to Empty CD folder"/>
- <cmd name="Zoom In" _label="Zoom _In"
- _tip="Show the contents in more detail"/>
- <cmd name="Zoom Out" _label="Zoom _Out"
- _tip="Show the contents in less detail"/>
- <cmd name="Zoom Normal" _label="Normal Si_ze"
- _tip="Show the contents at the normal size"/>
-</commands>
-
-<keybindings>
- <accel name="*Control*equal" verb="Zoom In"/>
- <accel name="*Control**Shift*plus" verb="Zoom In"/>
- <accel name="BackSpace" verb="Up"/>
- <accel name="*Control*r" verb="Reload"/>
-</keybindings>
-
-<menu>
- <submenu name="File" _label="_File">
-
- <placeholder name="New Items Placeholder" delimit="none">
- </placeholder>
-
- <placeholder name="Open Placeholder" delimit="top"/>
- <placeholder name="Location Placeholder" delimit="top"/>
-
- <placeholder name="General Status Placeholder" delimit="top"/>
- <placeholder name="File Items Placeholder" delimit="top"/>
- <placeholder name="Global File Items Placeholder" delimit="top"/>
- <placeholder name="Extension Actions" delimit="top"/>
- <separator/>
-
+<ui>
+<menubar name="MenuBar">
+ <menu action="File">
+ <placeholder name="New Items Placeholder"/>
+ <separator/>
+ <placeholder name="Open Placeholder"/>
+ <separator/>
+ <placeholder name="Location Placeholder"/>
+ <menuitem name="Connect to Server" action="Connect to Server"/>
+ <separator/>
+ <placeholder name="File Items Placeholder"/>
+ <separator/>
+ <placeholder name="Global File Items Placeholder"/>
+ <separator/>
+ <placeholder name="Extension Actions"/>
+ <separator/>
<placeholder name="Close Items Placeholder"/>
-
- <menuitem name="Close"
- _label="_Close"
- _tip="Close this folder"
- accel="*Control*w"
- pixtype="stock" pixname="gtk-close"
- verb="Close"/>
- </submenu>
-
- <submenu name="Edit" _label="_Edit">
-
-<!-- FIXME bugzilla.gnome.org 43515
-
- Undo is disabled until we have a better implementation.
- Both here and in nautilus-undo-signal-handlers.c.
-
- <menuitem name="Undo"
- _label="_Undo"
- _tip="Undo the last text change"
- pixtype="stock" pixname="gtk-undo"
- accel="*Control*z"
- verb="Undo"/>
-
- <separator/>
--->
-
- <menuitem name="Cut"
- _label="Cut _Text"
- pixtype="stock" pixname="gtk-cut"
- verb="Cut"/>
- <menuitem name="Copy"
- _label="_Copy Text"
- pixtype="stock" pixname="gtk-copy"
- verb="Copy"/>
- <menuitem name="Paste"
- _label="_Paste Text"
- pixtype="stock" pixname="gtk-paste"
- verb="Paste"/>
- <menuitem name="Clear"
- _label="C_lear Text"
- pixtype="stock" pixname="gtk-clear"
- verb="Clear"/>
-
- <separator/>
-
- <placeholder name="Select Items">
- <menuitem name="Select All"
- _label="Select _All"
- verb="Select All"/>
- </placeholder>
-
-
- <placeholder name="File Items Placeholder" delimit="top"/>
- <placeholder name="Dangerous File Items Placeholder" delimit="top"/>
- <placeholder name="Edit Items Placeholder" delimit="top"/>
- <placeholder name="Global Edit Items Placeholder" delimit="none"/>
-
- <placeholder name="Extension Actions" delimit="top"/>
- <separator/>
-
- <menuitem name="Backgrounds and Emblems"
- _label="_Backgrounds and Emblems..."
- _tip="Display patterns, colors, and emblems that can be used to customize appearance"
- verb="Backgrounds and Emblems"/>
-
- <menuitem name="Preferences"
- _label="Prefere_nces"
- _tip="Edit Nautilus preferences"
- pixtype="stock" pixname="gtk-preferences"
- verb="Preferences"/>
- </submenu>
-
- <submenu name="View" _label="_View">
- <menuitem name="Stop"
- _label="_Stop"
- pixtype="stock" pixname="gtk-stop"
- verb="Stop"/>
- <menuitem name="Reload"
- _label="_Reload"
- accel="*Control*r"
- pixtype="stock" pixname="refresh"
- verb="Reload"/>
-
- <placeholder name="Show Hide Placeholder" delimit="top">
- </placeholder>
-
- <placeholder name="View Preferences Placeholder" delimit = "top"/>
- <placeholder name="View Items Placeholder" delimit="top"/>
-
- <placeholder name="Zoom Items Placeholder" delimit="top">
- <menuitem name="Zoom In"
- accel="*Control*plus"
- pixtype="stock" pixname="zoom-in"
- verb="Zoom In"/>
- <menuitem name="Zoom Out"
- accel="*Control*minus"
- pixtype="stock" pixname="zoom-out"
- verb="Zoom Out"/>
- <menuitem name="Zoom Normal"
- pixtype="stock" pixname="zoom-100"
- verb="Zoom Normal"/>
+ <menuitem name="Close" action="Close"/>
+ </menu>
+ <menu action="Edit">
+ <placeholder name="Clipboard Actions">
+ </placeholder>
+ <separator/>
+ <placeholder name="Select Items"/>
+ <separator/>
+ <placeholder name="File Items Placeholder"/>
+ <separator/>
+ <placeholder name="Dangerous File Items Placeholder"/>
+ <separator/>
+ <placeholder name="Edit Items Placeholder"/>
+ <placeholder name="Global Edit Items Placeholder"/>
+ <separator/>
+ <placeholder name="Extension Actions"/>
+ <separator/>
+ <menuitem name="Backgrounds and Emblems" action="Backgrounds and Emblems"/>
+ <menuitem name="Preferences" action="Preferences"/>
+ </menu>
+ <menu action="View">
+ <menuitem name="Stop" action="Stop"/>
+ <menuitem name="Reload" action="Reload"/>
+ <separator/>
+ <placeholder name="Show Hide Placeholder"/>
+ <separator/>
+ <placeholder name="View Preferences Placeholder"/>
+ <separator/>
+ <placeholder name="View Items Placeholder"/>
+ <separator/>
+ <placeholder name="Zoom Items Placeholder">
+ <menuitem name="Zoom In" action="Zoom In"/>
+ <menuitem name="Zoom Out" action="Zoom Out"/>
+ <menuitem name="Zoom Normal" action="Zoom Normal"/>
</placeholder>
<placeholder name="View Choices">
- <placeholder name="Extra Viewer" delimit="top"/>
+ <separator/>
+ <placeholder name="Extra Viewer"/>
<separator name="Before Short List"/>
<placeholder name="Short List"/>
</placeholder>
- </submenu>
-
- <placeholder/>
-
- <submenu name="Profiler" _label="_Profiler">
- <menuitem name="Start Profiling"
- _label="_Start Profiling"
- _tip="Start Profiling"
- verb="Start Profiling"/>
- <menuitem name="Stop Profiling"
- _label="_Stop Profiling"
- _tip="Stop Profiling"
- verb="Stop Profiling"/>
- <menuitem name="Reset Profiling"
- _label="_Reset Profiling"
- _tip="Reset Profiling"
- verb="Reset Profiling"/>
- <menuitem name="Report Profiling"
- _label="_Report Profiling"
- _tip="Report Profiling"
- verb="Report Profiling"/>
- </submenu>
-
- <submenu name="Help" _label="_Help">
- <menuitem name="Nautilus Manual"
- _label="_Contents"
- _tip="Display Nautilus help"
- accel="F1"
- pixtype="stock" pixname="gtk-help"
- verb="Nautilus Manual"/>
- <menuitem name="About Nautilus"
- _label="_About"
- _tip="Display credits for the creators of Nautilus"
- pixtype="stock" pixname="about"
- verb="About Nautilus"/>
- </submenu>
-</menu>
-
-<status>
- <control name="StatusButton" behavior="pack-start"/>
- <!-- the name "main" is required by Bonobo -->
- <item name="main"/>
-</status>
-
-<popups>
- <popup name="background" tearoff="0">
- <placeholder name="Before Zoom Items" delimit="none">
- <placeholder name="New Window Items" delimit="none">
- </placeholder>
- <placeholder name="New Object Items" delimit="none">
- </placeholder>
- <placeholder name="Extension Actions" delimit="top"/>
- </placeholder>
- <placeholder name="Zoom Items" delimit="top">
- <menuitem name="Zoom In"
- pixtype="stock" pixname="zoom-in"
- verb="Zoom In"/>
- <menuitem name="Zoom Out"
- pixtype="stock" pixname="zoom-out"
- verb="Zoom Out"/>
- <menuitem name="Zoom Normal"
- pixtype="stock" pixname="zoom-100"
- verb="Zoom Normal"/>
- </placeholder>
- <placeholder name="After Zoom Items" delimit="top"/>
- </popup>
-</popups>
-
-</Root>
+ </menu>
+ <placeholder name="Other Menus"/>
+ <menu action="Help">
+ <menuitem name="Nautilus Manual" action="Nautilus Manual"/>
+ <menuitem name="About Nautilus" action="About Nautilus"/>
+ </menu>
+</menubar>
+<popup name="background">
+ <placeholder name="Before Zoom Items">
+ <placeholder name="New Window Items"/>
+ <placeholder name="New Object Items"/>
+ <separator/>
+ <placeholder name="Extension Actions"/>
+ </placeholder>
+ <separator/>
+ <placeholder name="Zoom Items">
+ <menuitem name="Zoom In" action="Zoom In"/>
+ <menuitem name="Zoom Out" action="Zoom Out"/>
+ <menuitem name="Zoom Normal" action="Zoom Normal"/>
+ </placeholder>
+ <separator/>
+ <placeholder name="After Zoom Items"/>
+</popup>
+</ui>
diff --git a/src/nautilus-shell.c b/src/nautilus-shell.c
index 1fbbc5e87..1967c7ff7 100644
--- a/src/nautilus-shell.c
+++ b/src/nautilus-shell.c
@@ -143,11 +143,7 @@ open_window (NautilusShell *shell, const char *uri, const char *geometry,
} else {
home_uri = NULL;
if (uri == NULL) {
-#ifdef WEB_NAVIGATION_ENABLED
- home_uri = eel_preferences_get (NAUTILUS_PREFERENCES_HOME_URI);
-#else
home_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
-#endif
uri = home_uri;
}
diff --git a/src/nautilus-side-pane.c b/src/nautilus-side-pane.c
index 3f3153141..436930482 100644
--- a/src/nautilus-side-pane.c
+++ b/src/nautilus-side-pane.c
@@ -395,7 +395,6 @@ nautilus_side_pane_init (GtkObject *object)
FALSE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (side_pane->details->notebook),
FALSE);
-
g_signal_connect_object (side_pane->details->notebook,
"switch_page",
G_CALLBACK (switch_page_callback),
diff --git a/src/nautilus-side-pane.h b/src/nautilus-side-pane.h
index a4792e59e..9b39fccf8 100644
--- a/src/nautilus-side-pane.h
+++ b/src/nautilus-side-pane.h
@@ -28,11 +28,11 @@
G_BEGIN_DECLS
-#define NAUTILUS_TYPE_SIDEBAR (nautilus_side_pane_get_type ())
-#define NAUTILUS_SIDE_PANE(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_SIDEBAR, NautilusSidePane))
-#define NAUTILUS_SIDE_PANE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_SIDEBAR, NautilusSidePaneClass))
-#define NAUTILUS_IS_SIDE_PANE(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_SIDEBAR))
-#define NAUTILUS_IS_SIDE_PANE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_SIDEBAR))
+#define NAUTILUS_TYPE_SIDE_PANE (nautilus_side_pane_get_type ())
+#define NAUTILUS_SIDE_PANE(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_SIDE_PANE, NautilusSidePane))
+#define NAUTILUS_SIDE_PANE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_SIDE_PANE, NautilusSidePaneClass))
+#define NAUTILUS_IS_SIDE_PANE(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_SIDE_PANE))
+#define NAUTILUS_IS_SIDE_PANE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_SIDE_PANE))
typedef struct _NautilusSidePaneDetails NautilusSidePaneDetails;
diff --git a/src/nautilus-sidebar-title.c b/src/nautilus-sidebar-title.c
index db4561a2e..90ce30825 100644
--- a/src/nautilus-sidebar-title.c
+++ b/src/nautilus-sidebar-title.c
@@ -30,8 +30,6 @@
#include "nautilus-window.h"
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-property-bag-client.h>
#include <eel/eel-background.h>
#include <eel/eel-gdk-extensions.h>
#include <eel/eel-gdk-pixbuf-extensions.h>
@@ -52,8 +50,8 @@
#include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-icon-factory.h>
#include <libnautilus-private/nautilus-metadata.h>
-#include <libnautilus-private/nautilus-search-uri.h>
#include <libnautilus-private/nautilus-theme.h>
+#include <libnautilus-private/nautilus-sidebar.h>
#include <string.h>
#include <stdlib.h>
@@ -313,44 +311,13 @@ nautilus_sidebar_title_theme_changed (gpointer user_data)
}
}
-/* get a property from the current content view's property bag if we can */
static char*
get_property_from_component (NautilusSidebarTitle *sidebar_title, const char *property)
{
- GtkWidget *window;
- Bonobo_Control control;
- CORBA_Environment ev;
- Bonobo_PropertyBag property_bag;
- char* icon_name;
-
- window = gtk_widget_get_ancestor (GTK_WIDGET (sidebar_title), NAUTILUS_TYPE_WINDOW);
-
- if (window == NULL || NAUTILUS_WINDOW (window)->content_view == NULL) {
- return NULL;
- }
-
-
- control = nautilus_view_frame_get_control (NAUTILUS_VIEW_FRAME (NAUTILUS_WINDOW (window)->content_view));
- if (control == NULL) {
- return NULL;
- }
-
- CORBA_exception_init (&ev);
- property_bag = Bonobo_Control_getProperties (control, &ev);
- if (BONOBO_EX (&ev)) {
- property_bag = CORBA_OBJECT_NIL;
- }
- CORBA_exception_free (&ev);
-
- if (property_bag == CORBA_OBJECT_NIL) {
- return NULL;
- }
-
- icon_name = bonobo_property_bag_client_get_value_string
- (property_bag, property, NULL);
- bonobo_object_release_unref (property_bag, NULL);
-
- return icon_name;
+ /* There used to be a way to get icon and summary_text from main view,
+ * but its not used right now, so this sas stubbed out for now
+ */
+ return NULL;
}
/* set up the icon image */
@@ -468,19 +435,6 @@ append_and_eat (GString *string, const char *separator, char *new_string)
g_free (new_string);
}
-static gboolean
-file_is_search_location (NautilusFile *file)
-{
- char *uri;
- gboolean is_search_uri;
-
- uri = nautilus_file_get_uri (file);
- is_search_uri = nautilus_is_search_uri (uri);
- g_free (uri);
-
- return is_search_uri;
-}
-
static int
measure_width_callback (const char *string, gpointer callback_data)
{
@@ -499,7 +453,6 @@ update_more_info (NautilusSidebarTitle *sidebar_title)
NautilusFile *file;
GString *info_string;
char *type_string, *component_info;
- char *search_string, *search_uri;
char *date_modified_str;
int sidebar_width;
PangoLayout *layout;
@@ -512,37 +465,25 @@ update_more_info (NautilusSidebarTitle *sidebar_title)
info_string = g_string_new (component_info);
g_free (component_info);
} else {
- /* Adding this special case for search results to
- correspond to the fix for bug 2341. */
- if (file != NULL && file_is_search_location (file)) {
- search_uri = nautilus_file_get_uri (file);
- search_string = nautilus_search_uri_to_human (search_uri);
- g_free (search_uri);
- info_string = g_string_new (search_string);
- g_free (search_string);
- append_and_eat (info_string, "\n ",
+ info_string = g_string_new (NULL);
+ type_string = nautilus_file_get_string_attribute (file, "type");
+ if (type_string != NULL) {
+ append_and_eat (info_string, NULL, type_string);
+ append_and_eat (info_string, ", ",
nautilus_file_get_string_attribute (file, "size"));
} else {
- info_string = g_string_new (NULL);
- type_string = nautilus_file_get_string_attribute (file, "type");
- if (type_string != NULL) {
- append_and_eat (info_string, NULL, type_string);
- append_and_eat (info_string, ", ",
- nautilus_file_get_string_attribute (file, "size"));
- } else {
- append_and_eat (info_string, NULL,
- nautilus_file_get_string_attribute (file, "size"));
- }
-
- sidebar_width = GTK_WIDGET (sidebar_title)->allocation.width - 2 * SIDEBAR_INFO_MARGIN;
- if (sidebar_width > MINIMUM_INFO_WIDTH) {
- layout = pango_layout_copy (gtk_label_get_layout (GTK_LABEL (sidebar_title->details->more_info_label)));
- pango_layout_set_width (layout, -1);
- date_modified_str = nautilus_file_fit_modified_date_as_string
- (file, sidebar_width, measure_width_callback, NULL, layout);
- g_object_unref (layout);
+ append_and_eat (info_string, NULL,
+ nautilus_file_get_string_attribute (file, "size"));
+ }
+
+ sidebar_width = GTK_WIDGET (sidebar_title)->allocation.width - 2 * SIDEBAR_INFO_MARGIN;
+ if (sidebar_width > MINIMUM_INFO_WIDTH) {
+ layout = pango_layout_copy (gtk_label_get_layout (GTK_LABEL (sidebar_title->details->more_info_label)));
+ pango_layout_set_width (layout, -1);
+ date_modified_str = nautilus_file_fit_modified_date_as_string
+ (file, sidebar_width, measure_width_callback, NULL, layout);
+ g_object_unref (layout);
append_and_eat (info_string, "\n", date_modified_str);
- }
}
}
gtk_label_set_text (GTK_LABEL (sidebar_title->details->more_info_label),
diff --git a/src/nautilus-simple-search-bar.c b/src/nautilus-simple-search-bar.c
deleted file mode 100644
index 7efef4218..000000000
--- a/src/nautilus-simple-search-bar.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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
- *
- * Author: Rebecca Schulman <rebecka@eazel.com>
- */
-
-/* nautilus-simple-search-bar.c - One box Search bar for Nautilus
- */
-
-#include <config.h>
-#include "nautilus-simple-search-bar.h"
-
-#include "nautilus-search-bar-criterion.h"
-#include "nautilus-window-private.h"
-#include <libgnome/gnome-i18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libnautilus/nautilus-clipboard.h>
-#include <libnautilus-private/nautilus-entry.h>
-#include <eel/eel-gtk-extensions.h>
-#include <eel/eel-gtk-macros.h>
-#include <libnautilus-private/nautilus-search-uri.h>
-#include <eel/eel-string.h>
-#include <libnautilus-private/nautilus-undo-signal-handlers.h>
-#include <stdio.h>
-
-struct NautilusSimpleSearchBarDetails {
- NautilusEntry *entry;
- GtkWidget *find_button;
-};
-
-static void real_activate (NautilusNavigationBar *bar);
-static char * nautilus_simple_search_bar_get_location (NautilusNavigationBar *bar);
-static void nautilus_simple_search_bar_set_location (NautilusNavigationBar *bar,
- const char *location);
-
-static char * nautilus_search_uri_to_simple_search_criteria (const char *location);
-static char * nautilus_simple_search_criteria_to_search_uri (const char *search_criteria);
-
-static void nautilus_simple_search_bar_class_init (NautilusSimpleSearchBarClass *class);
-static void nautilus_simple_search_bar_init (NautilusSimpleSearchBar *bar);
-static void nautilus_simple_search_bar_finalize (GObject *object);
-
-EEL_CLASS_BOILERPLATE (NautilusSimpleSearchBar,
- nautilus_simple_search_bar,
- NAUTILUS_TYPE_SEARCH_BAR)
-
-static void
-nautilus_simple_search_bar_class_init (NautilusSimpleSearchBarClass *klass)
-{
- G_OBJECT_CLASS (klass)->finalize = nautilus_simple_search_bar_finalize;
- NAUTILUS_NAVIGATION_BAR_CLASS (klass)->activate = real_activate;
- NAUTILUS_NAVIGATION_BAR_CLASS (klass)->get_location = nautilus_simple_search_bar_get_location;
- NAUTILUS_NAVIGATION_BAR_CLASS (klass)->set_location = nautilus_simple_search_bar_set_location;
-}
-
-static gboolean
-search_text_is_invalid (NautilusSimpleSearchBar *bar)
-{
- char *user_text;
- gboolean is_empty;
-
- user_text = gtk_editable_get_chars (GTK_EDITABLE (bar->details->entry), 0, -1);
- is_empty = eel_str_is_empty (user_text);
- g_free (user_text);
-
- return is_empty;
-}
-
-static void
-update_simple_find_button_state (NautilusSimpleSearchBar *bar)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (bar->details->find_button),
- !search_text_is_invalid (bar));
-}
-
-static void
-nautilus_simple_search_bar_init (NautilusSimpleSearchBar *bar)
-{
- bar->details = g_new0 (NautilusSimpleSearchBarDetails, 1);
-}
-
-static void
-nautilus_simple_search_bar_finalize (GObject *object)
-{
- NautilusSimpleSearchBar *bar;
-
- bar = NAUTILUS_SIMPLE_SEARCH_BAR (object);
-
- g_free (bar->details);
-
- EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-GtkWidget *
-nautilus_simple_search_bar_new (NautilusWindow *window)
-{
- GtkWidget *simple_search_bar;
- NautilusSimpleSearchBar *bar;
-
- GtkWidget *hbox;
-
- simple_search_bar = gtk_widget_new (NAUTILUS_TYPE_SIMPLE_SEARCH_BAR, NULL);
- bar = NAUTILUS_SIMPLE_SEARCH_BAR (simple_search_bar);
- hbox = gtk_hbox_new (0, FALSE);
-
- /* Create button first so we can use it for auto_click */
- bar->details->find_button = gtk_button_new_with_label (_("Find Them!"));
-
- bar->details->entry = NAUTILUS_ENTRY (nautilus_entry_new ());
- nautilus_undo_set_up_nautilus_entry_for_undo (bar->details->entry);
- nautilus_undo_editable_set_undo_key (GTK_EDITABLE (bar->details->entry), TRUE);
- nautilus_clipboard_set_up_editable
- (GTK_EDITABLE (bar->details->entry),
- nautilus_window_get_ui_container (window),
- TRUE);
-
- g_signal_connect_object (bar->details->entry, "activate",
- G_CALLBACK (gtk_widget_activate), bar->details->find_button, G_CONNECT_SWAPPED);
- g_signal_connect_object (bar->details->entry, "changed",
- G_CALLBACK (update_simple_find_button_state), bar, G_CONNECT_SWAPPED);
-
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (bar->details->entry), TRUE, TRUE, 0);
-
- g_signal_connect_object (bar->details->find_button, "clicked",
- G_CALLBACK (nautilus_navigation_bar_location_changed), bar, G_CONNECT_SWAPPED);
- gtk_box_pack_start (GTK_BOX (hbox), bar->details->find_button, FALSE, TRUE, 1);
- update_simple_find_button_state (bar);
-
- gtk_container_add (GTK_CONTAINER (bar), hbox);
-
- gtk_widget_show_all (hbox);
-
- return simple_search_bar;
-}
-
-static void
-real_activate (NautilusNavigationBar *navigation_bar)
-{
- NautilusSimpleSearchBar *bar;
-
- bar = NAUTILUS_SIMPLE_SEARCH_BAR (navigation_bar);
-
- /* Put the keyboard focus in the text field when switching to search mode */
- gtk_widget_grab_focus (GTK_WIDGET (bar->details->entry));
-}
-
-static void
-nautilus_simple_search_bar_set_location (NautilusNavigationBar *navigation_bar,
- const char *location)
-{
- NautilusSimpleSearchBar *bar;
- char *criteria;
-
- /* We shouldn't have gotten here if the uri can't be displayed
- * using a simple search bar
- */
- bar = NAUTILUS_SIMPLE_SEARCH_BAR (navigation_bar);
-
- /* Set the words in the box to be the words originally done in the search */
- criteria = nautilus_search_uri_to_simple_search_criteria (location);
- nautilus_entry_set_text (bar->details->entry, criteria);
- g_free (criteria);
-}
-
-static char *
-nautilus_simple_search_bar_get_location (NautilusNavigationBar *navigation_bar)
-{
- NautilusSimpleSearchBar *bar;
- const char *search_entry_text;
-
- bar = NAUTILUS_SIMPLE_SEARCH_BAR (navigation_bar);
- search_entry_text = gtk_entry_get_text (GTK_ENTRY (bar->details->entry));
- return nautilus_simple_search_criteria_to_search_uri (search_entry_text);
-}
-
-
-
-char *
-nautilus_search_uri_to_simple_search_criteria (const char *uri)
-{
- /* FIXME bugzilla.gnome.org 42511: Not yet implemented. */
- return g_strdup ("");
-}
-
-char *
-nautilus_simple_search_criteria_to_search_uri (const char *search_criteria)
-{
- char **words;
- char *search_uri;
- char *fragment;
- char *escaped_fragment;
- int length, i;
-
- /* FIXME bugzilla.gnome.org 42512:
- * The logic here should be exactly the same as the logic for
- * a complex search-by-file-name. Currently the complex search doesn't
- * do the multi-word handling that this function does. They should use
- * the same code.
- */
- g_return_val_if_fail (search_criteria != NULL, NULL);
-
- words = g_strsplit (search_criteria, " ", strlen (search_criteria));
- /* FIXME bugzilla.gnome.org 42513: this should eventually be: length = strlen ("[file%3A%2F%2F%2F]"); */
- length = strlen ("[file:///]");
- /* Count total length */
- for (i = 0; words[i] != NULL; i++) {
- length += strlen (NAUTILUS_SEARCH_URI_TEXT_NAME) + strlen (" contains ") + strlen (words[i]) + strlen (" & ");
- }
- fragment = g_new0 (char, length + 1);
- /* FIXME bugzilla.gnome.org 42513: this should eventually be: sprintf (fragment, "[file%%3A%%2F%%2F%%2F]"); */
- sprintf (fragment, "[file:///]");
- if (words[0] != NULL) {
- for (i = 0; words[i+1] != NULL; i++) {
- strcat (fragment, NAUTILUS_SEARCH_URI_TEXT_NAME);
- strcat (fragment, " contains ");
- strcat (fragment, words[i]);
- strcat (fragment, " & ");
- }
- strcat (fragment, NAUTILUS_SEARCH_URI_TEXT_NAME);
- strcat (fragment, " contains ");
- strcat (fragment, words[i]);
- }
- g_strfreev (words);
- escaped_fragment = gnome_vfs_escape_string (fragment);
- g_free (fragment);
- search_uri = g_strconcat ("search:", escaped_fragment, NULL);
- g_free (escaped_fragment);
-#ifdef SEARCH_URI_DEBUG
- printf ("Made uri %s from simple search criteria %s\n",
- search_uri, search_criteria);
-#endif
- return search_uri;
-}
diff --git a/src/nautilus-simple-search-bar.h b/src/nautilus-simple-search-bar.h
deleted file mode 100644
index de751e5ac..000000000
--- a/src/nautilus-simple-search-bar.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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
- *
- * Author: Rebecca Schulman <rebecka@eazel.com>
- */
-
-/* nautilus-simple-search-bar.h - search input containing
- * a single text entry box
- */
-
-#ifndef NAUTILUS_SIMPLE_SEARCH_BAR_H
-#define NAUTILUS_SIMPLE_SEARCH_BAR_H
-
-#include "nautilus-search-bar.h"
-#include "nautilus-window.h"
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkentry.h>
-
-
-#define NAUTILUS_TYPE_SIMPLE_SEARCH_BAR (nautilus_simple_search_bar_get_type ())
-#define NAUTILUS_SIMPLE_SEARCH_BAR(obj) \
- GTK_CHECK_CAST (obj, NAUTILUS_TYPE_SIMPLE_SEARCH_BAR, NautilusSimpleSearchBar)
-#define NAUTILUS_SIMPLE_SEARCH_BAR_CLASS(klass) \
- GTK_CHECK_CLASS_CAST (klass, NAUTILUS_TYPE_SIMPLE_SEARCH_BAR, NautilusSimpleSearchBarClass)
-#define NAUTILUS_IS_SIMPLE_SEARCH_BAR(obj) \
- GTK_CHECK_TYPE (obj, NAUTILUS_TYPE_SIMPLE_SEARCH_BAR)
-
-typedef struct NautilusSimpleSearchBarDetails NautilusSimpleSearchBarDetails;
-
-typedef struct NautilusSimpleSearchBar {
- NautilusSearchBar parent;
- NautilusSimpleSearchBarDetails *details;
-} NautilusSimpleSearchBar;
-
-typedef struct {
- NautilusSearchBarClass parent_class;
-} NautilusSimpleSearchBarClass;
-
-GType nautilus_simple_search_bar_get_type (void);
-GtkWidget* nautilus_simple_search_bar_new (NautilusWindow *window);
-
-#endif /* NAUTILUS_SIMPLE_SEARCH_BAR_H */
diff --git a/src/nautilus-spatial-window-ui.xml b/src/nautilus-spatial-window-ui.xml
index 06d94de48..5b3d9178f 100644
--- a/src/nautilus-spatial-window-ui.xml
+++ b/src/nautilus-spatial-window-ui.xml
@@ -1,69 +1,23 @@
-<Root>
-
-<!-- A description of each placeholder's purpose is in libnautilus/nautilus-bonobo-ui.h -->
-
-<commands>
-</commands>
-
-<keybindings>
- <accel name="*Alt**Shift*Up" verb="UpCloseCurrent"/>
- <accel name="*Shift*BackSpace" verb="UpCloseCurrent"/>
- <accel name="*Alt*Home" verb="Home"/>
-</keybindings>
-<menu>
- <submenu name="File">
+<ui>
+<menubar name="MenuBar">
+ <menu action="File">
<placeholder name="Location Placeholder">
- <menuitem name="Up"
- _label="Open _Parent"
- _tip="Open the parent folder"
- accel="*Alt*Up"
- verb="Up"/>
- <menuitem name="Go to Location"
- _label="Open _Location..."
- accel="*Control*l"
- verb="Go to Location"/>
- <menuitem name="Connect to Server"
- _label="Connect to _Server..."
- verb="Connect to Server"/>
+ <menuitem name="Up" action="Up"/>
+ <menuitem name="Go to Location" action="Go to Location"/>
</placeholder>
<placeholder name="Close Items Placeholder">
- <menuitem name="Close With Parents"
- _label="Close P_arent Folders"
- _tip="Close this folder's parents"
- accel="*Control**Shift*w"
- verb="Close Parent Folders"/>
- <menuitem name="Close All Folders"
- _label="Clos_e All Folders"
- _tip="Close all folder windows"
- accel="*Control*q"
- verb="Close All Folders"/>
+ <menuitem name="Close Parent Folders" action="Close Parent Folders"/>
+ <menuitem name="Close All Folders" action="Close All Folders"/>
</placeholder>
- </submenu>
-
- <submenu name="Places" _label="_Places">
- <menuitem name="Home"
- _label="_Home"
- accel="*Alt*Home"
- pixtype="stock" pixname="gtk-home"
- verb="Home"/>
- <menuitem name="Go to Computer"
- _label="_Computer"
- _tip="Go to Computer"
- pixtype="stock" pixname="gnome-fs-client"
- verb="Go to Computer"/>
- <menuitem name="Go to Templates"
- _label="_Templates"
- _tip="Go to templates folder"
- verb="Go to Templates"/>
- <menuitem name="Go to Trash"
- _label="_Trash"
- _tip="Go to the trash folder"
- verb="Go to Trash"/>
- <menuitem name="Go to Burn CD"
- _label="CD _Creator"
- _tip="Go to the CD/DVD Creator"
- verb="Go to Burn CD"/>
- </submenu>
-</menu>
-
-</Root>
+ </menu>
+ <placeholder name="Other Menus">
+ <menu action="Places">
+ <menuitem name="Home" action="Home"/>
+ <menuitem name="Go to Computer" action="Go to Computer"/>
+ <menuitem name="Go to Templates" action="Go to Templates"/>
+ <menuitem name="Go to Trash" action="Go to Trash"/>
+ <menuitem name="Go to Burn CD" action="Go to Burn CD"/>
+ </menu>
+ </placeholder>
+</menubar>
+</ui>
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index 7a2419f1f..cb0b625fe 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -31,18 +31,15 @@
#include "nautilus-spatial-window.h"
#include "nautilus-window-private.h"
+#include "nautilus-actions.h"
#include "nautilus-application.h"
#include "nautilus-desktop-window.h"
#include "nautilus-bookmarks-window.h"
#include "nautilus-location-dialog.h"
#include "nautilus-main.h"
#include "nautilus-signaller.h"
-#include "nautilus-switchable-navigation-bar.h"
#include "nautilus-window-manage-views.h"
#include "nautilus-zoom-control.h"
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-property-bag-client.h>
-#include <bonobo/bonobo-ui-util.h>
#include <eel/eel-debug.h>
#include <eel/eel-gdk-extensions.h>
#include <eel/eel-gdk-pixbuf-extensions.h>
@@ -57,6 +54,7 @@
#include <gtk/gtkoptionmenu.h>
#include <gtk/gtktogglebutton.h>
#include <gtk/gtkvbox.h>
+#include <gtk/gtkuimanager.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-macros.h>
#include <libgnome/gnome-util.h>
@@ -65,9 +63,8 @@
#include <libgnomeui/gnome-window-icon.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
-#include <libnautilus-private/nautilus-drag-window.h>
#include <libnautilus-private/nautilus-file-utilities.h>
+#include <libnautilus-private/nautilus-ui-utilities.h>
#include <libnautilus-private/nautilus-file-attributes.h>
#include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-horizontal-splitter.h>
@@ -75,23 +72,21 @@
#include <libnautilus-private/nautilus-metadata.h>
#include <libnautilus-private/nautilus-mime-actions.h>
#include <libnautilus-private/nautilus-program-choosing.h>
-#include <libnautilus-private/nautilus-sidebar-functions.h>
-#include <libnautilus/nautilus-bonobo-ui.h>
-#include <libnautilus/nautilus-clipboard.h>
-#include <libnautilus/nautilus-undo.h>
+#include <libnautilus-private/nautilus-clipboard.h>
+#include <libnautilus-private/nautilus-undo.h>
#include <math.h>
#include <sys/time.h>
#define MAX_TITLE_LENGTH 180
-struct _NautilusSpatialWindowDetails {
+struct _NautilusSpatialWindowDetails {
+ GtkActionGroup *spatial_action_group; /* owned by ui_manager */
char *last_geometry;
guint save_geometry_timeout_id;
GtkWidget *content_box;
GtkWidget *location_button;
GtkWidget *location_label;
- GtkWidget *location_statusbar;
GnomeVFSURI *location;
};
@@ -219,6 +214,9 @@ nautilus_spatial_window_finalize (GObject *object)
if (window->details->location != NULL) {
gnome_vfs_uri_unref (window->details->location);
}
+
+ g_free (window->details);
+ window->details = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -255,7 +253,12 @@ nautilus_spatial_window_save_scroll_position (NautilusSpatialWindow *window)
char *scroll_string;
parent = NAUTILUS_WINDOW(window);
- scroll_string = nautilus_view_frame_get_first_visible_file (parent->content_view);
+
+ if (parent->content_view == NULL) {
+ return;
+ }
+
+ scroll_string = nautilus_view_get_first_visible_file (parent->content_view);
nautilus_file_set_metadata (parent->details->viewed_file,
NAUTILUS_METADATA_KEY_WINDOW_SCROLL_POSITION,
NULL,
@@ -267,11 +270,11 @@ void
nautilus_spatial_window_save_show_hidden_files_mode (NautilusSpatialWindow *window)
{
char *show_hidden_file_setting;
- Nautilus_ShowHiddenFilesMode mode;
+ NautilusWindowShowHiddenFilesMode mode;
mode = NAUTILUS_WINDOW (window)->details->show_hidden_files_mode;
- if (mode != Nautilus_SHOW_HIDDEN_FILES_DEFAULT) {
- if (mode == Nautilus_SHOW_HIDDEN_FILES_ENABLE) {
+ if (mode != NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) {
+ if (mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_ENABLE) {
show_hidden_file_setting = "1";
} else {
show_hidden_file_setting = "0";
@@ -294,31 +297,20 @@ nautilus_spatial_window_show (GtkWidget *widget)
}
static void
-file_menu_close_parent_windows_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_close_parent_folders_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_application_close_parent_windows (NAUTILUS_SPATIAL_WINDOW (user_data));
}
static void
-file_menu_close_all_windows_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_close_all_folders_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_application_close_all_spatial_windows ();
}
static void
-go_up_close_current_window_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- nautilus_window_go_up (NAUTILUS_WINDOW (user_data), TRUE);
-}
-
-
-static void
real_prompt_for_location (NautilusWindow *window)
{
GtkWidget *dialog;
@@ -331,6 +323,9 @@ static void
real_set_title (NautilusWindow *window, const char *title)
{
+ EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
+ set_title, (window, title));
+
if (title[0] == '\0') {
gtk_window_set_title (GTK_WINDOW (window), _("Nautilus"));
} else {
@@ -343,46 +338,18 @@ real_set_title (NautilusWindow *window, const char *title)
}
static void
-real_merge_menus (NautilusWindow *nautilus_window)
-{
- NautilusSpatialWindow *window;
- BonoboControl *control;
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("Close Parent Folders", file_menu_close_parent_windows_callback),
- BONOBO_UI_VERB ("Close All Folders", file_menu_close_all_windows_callback),
- BONOBO_UI_VERB ("UpCloseCurrent", go_up_close_current_window_callback),
- BONOBO_UI_VERB_END
- };
-
- EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
- merge_menus, (nautilus_window));
-
- window = NAUTILUS_SPATIAL_WINDOW (nautilus_window);
-
- bonobo_ui_util_set_ui (NAUTILUS_WINDOW (window)->details->shell_ui,
- DATADIR,
- "nautilus-spatial-window-ui.xml",
- "nautilus", NULL);
-
- bonobo_ui_component_add_verb_list_with_data (nautilus_window->details->shell_ui,
- verbs, window);
-
- control = bonobo_control_new (window->details->location_statusbar);
- bonobo_ui_component_object_set (nautilus_window->details->shell_ui,
- "/status/StatusButton",
- BONOBO_OBJREF (control),
- NULL);
-}
-
-static void
real_set_content_view_widget (NautilusWindow *window,
- NautilusViewFrame *new_view)
+ NautilusView *new_view)
{
+ GtkWidget *widget;
+
EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS, set_content_view_widget,
(window, new_view));
+
+ widget = nautilus_view_get_widget (new_view);
gtk_container_add (GTK_CONTAINER (NAUTILUS_SPATIAL_WINDOW (window)->details->content_box),
- GTK_WIDGET (new_view));
+ widget);
}
static void
@@ -394,14 +361,15 @@ real_window_close (NautilusWindow *window)
}
static void
-real_get_default_size(NautilusWindow *window, guint *default_width, guint *default_height)
+real_get_default_size (NautilusWindow *window,
+ guint *default_width, guint *default_height)
{
- if(default_width) {
- *default_width = NAUTILUS_SPATIAL_WINDOW_DEFAULT_WIDTH;
- }
- if(default_height) {
- *default_height = NAUTILUS_SPATIAL_WINDOW_DEFAULT_HEIGHT;
- }
+ if (default_width) {
+ *default_width = NAUTILUS_SPATIAL_WINDOW_DEFAULT_WIDTH;
+ }
+ if (default_height) {
+ *default_height = NAUTILUS_SPATIAL_WINDOW_DEFAULT_HEIGHT;
+ }
}
@@ -503,7 +471,9 @@ menu_popup_pos (GtkMenu *menu,
gtk_widget_size_request (widget, &button_requisition);
gdk_window_get_origin (widget->window, x, y);
-
+ *x += widget->allocation.x;
+ *y += widget->allocation.y;
+
*y -= menu_requisition.height - button_requisition.height;
*push_in = TRUE;
@@ -592,28 +562,51 @@ nautilus_spatial_window_set_location_button (NautilusSpatialWindow *window,
}
static void
+action_go_to_location_callback (GtkAction *action,
+ gpointer user_data)
+{
+ NautilusWindow *window;
+
+ window = NAUTILUS_WINDOW (user_data);
+
+ nautilus_window_prompt_for_location (window);
+}
+
+static GtkActionEntry spatial_entries[] = {
+ { "Places", NULL, N_("_Places") }, /* name, stock id, label */
+ { "Go to Location", NULL, N_("Open _Location..."), /* name, stock id, label */
+ "<control>L", N_("Specify a location to open"),
+ G_CALLBACK (action_go_to_location_callback) },
+ { "Close Parent Folders", NULL, N_("Close P_arent Folders"), /* name, stock id, label */
+ "<control><shift>W", N_("Close this folder's parents"),
+ G_CALLBACK (action_close_parent_folders_callback) },
+ { "Close All Folders", NULL, N_("Clos_e All Folders"), /* name, stock id, label */
+ "<control>Q", N_("Close all folder windows"),
+ G_CALLBACK (action_close_all_folders_callback) },
+};
+
+static void
nautilus_spatial_window_instance_init (NautilusSpatialWindow *window)
{
- GtkShadowType shadow_type;
- GtkWidget *frame;
GtkRcStyle *rc_style;
GtkWidget *arrow;
GtkWidget *hbox;
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+ const char *ui;
window->details = g_new0 (NautilusSpatialWindowDetails, 1);
window->affect_spatial_window_on_next_location_change = TRUE;
window->details->content_box =
gtk_hbox_new (FALSE, 0);
+ gtk_table_attach (GTK_TABLE (NAUTILUS_WINDOW (window)->details->table),
+ window->details->content_box,
+ /* X direction */ /* Y direction */
+ 0, 1, 1, 4,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
+ 0, 0);
gtk_widget_show (window->details->content_box);
- bonobo_window_set_contents (BONOBO_WINDOW (window),
- window->details->content_box);
-
- window->details->location_statusbar = gtk_statusbar_new ();
- gtk_widget_show (window->details->location_statusbar);
- gtk_widget_hide (GTK_STATUSBAR (window->details->location_statusbar)->frame);
- gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (window->details->location_statusbar),
- FALSE);
window->details->location_button = gtk_button_new ();
gtk_button_set_relief (GTK_BUTTON (window->details->location_button),
@@ -640,28 +633,41 @@ nautilus_spatial_window_instance_init (NautilusSpatialWindow *window)
gtk_box_pack_start (GTK_BOX (hbox), arrow, FALSE, FALSE, 0);
gtk_widget_show (arrow);
- frame = gtk_frame_new (NULL);
- gtk_widget_style_get (GTK_WIDGET (window->details->location_statusbar),
- "shadow_type", &shadow_type, NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), shadow_type);
- gtk_box_pack_start (GTK_BOX (window->details->location_statusbar),
- frame, TRUE, TRUE, 0);
- gtk_widget_show (frame);
-
- gtk_container_add (GTK_CONTAINER (frame),
- window->details->location_button);
gtk_widget_set_sensitive (window->details->location_button, FALSE);
g_signal_connect (window->details->location_button,
"clicked",
G_CALLBACK (location_button_clicked_callback), window);
- gtk_widget_show (window->details->location_statusbar);
+ gtk_box_pack_start (GTK_BOX (NAUTILUS_WINDOW (window)->details->statusbar),
+ window->details->location_button,
+ FALSE, TRUE, 0);
+
+ gtk_box_reorder_child (GTK_BOX (NAUTILUS_WINDOW (window)->details->statusbar),
+ window->details->location_button, 0);
+
+ action_group = gtk_action_group_new ("SpatialActions");
+ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+ window->details->spatial_action_group = action_group;
+ gtk_action_group_add_actions (action_group,
+ spatial_entries, G_N_ELEMENTS (spatial_entries),
+ window);
+
+ ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
+ 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-spatial-window-ui.xml");
+ gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
+
+ return;
}
static void
nautilus_spatial_window_class_init (NautilusSpatialWindowClass *class)
{
- NAUTILUS_WINDOW_CLASS (class)->window_type = Nautilus_WINDOW_SPATIAL;
+ GtkBindingSet *binding_set;
+
+ NAUTILUS_WINDOW_CLASS (class)->window_type = NAUTILUS_WINDOW_SPATIAL;
G_OBJECT_CLASS (class)->finalize = nautilus_spatial_window_finalize;
GTK_OBJECT_CLASS (class)->destroy = nautilus_spatial_window_destroy;
@@ -674,8 +680,6 @@ nautilus_spatial_window_class_init (NautilusSpatialWindowClass *class)
real_prompt_for_location;
NAUTILUS_WINDOW_CLASS (class)->set_title =
real_set_title;
- NAUTILUS_WINDOW_CLASS (class)->merge_menus =
- real_merge_menus;
NAUTILUS_WINDOW_CLASS (class)->set_content_view_widget =
real_set_content_view_widget;
NAUTILUS_WINDOW_CLASS (class)->close =
@@ -684,4 +688,14 @@ nautilus_spatial_window_class_init (NautilusSpatialWindowClass *class)
NAUTILUS_WINDOW_CLASS(class)->set_throbber_active =
real_set_throbber_active;
+
+
+ binding_set = gtk_binding_set_by_class (class);
+ gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, GDK_SHIFT_MASK,
+ "go_up", 1,
+ G_TYPE_BOOLEAN, TRUE);
+ gtk_binding_entry_add_signal (binding_set, GDK_Up, GDK_SHIFT_MASK | GDK_MOD1_MASK,
+ "go_up", 1,
+ G_TYPE_BOOLEAN, TRUE);
+
}
diff --git a/src/nautilus-switchable-navigation-bar.c b/src/nautilus-switchable-navigation-bar.c
deleted file mode 100644
index 99fcb8ae6..000000000
--- a/src/nautilus-switchable-navigation-bar.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-switchable-navigation-bar.c - Navigation bar for nautilus
- * that can switch between the location bar and the search bar.
- */
-
-#include <config.h>
-#include "nautilus-switchable-navigation-bar.h"
-
-#include "nautilus-switchable-search-bar.h"
-#include <bonobo/bonobo-dock.h>
-#include <eel/eel-gtk-macros.h>
-#include <eel/eel-string.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkvbox.h>
-#include <libgnome/gnome-i18n.h>
-#include <libnautilus-private/nautilus-directory.h>
-#include <libnautilus-private/nautilus-search-uri.h>
-#include <stdio.h>
-
-struct NautilusSwitchableNavigationBarDetails {
- NautilusSwitchableNavigationBarMode mode;
-
- NautilusLocationBar *location_bar;
- NautilusSwitchableSearchBar *search_bar;
-
- NautilusNavigationWindow *window;
- GtkWidget *hbox;
-};
-
-enum {
- MODE_CHANGED,
- LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL];
-
-
-static char *nautilus_switchable_navigation_bar_get_location (NautilusNavigationBar *bar);
-static void nautilus_switchable_navigation_bar_set_location (NautilusNavigationBar *bar,
- const char *location);
-static void nautilus_switchable_navigation_bar_class_init (NautilusSwitchableNavigationBarClass *class);
-static void nautilus_switchable_navigation_bar_init (NautilusSwitchableNavigationBar *bar);
-static void nautilus_switchable_navigation_bar_finalize (GObject *object);
-
-EEL_CLASS_BOILERPLATE (NautilusSwitchableNavigationBar,
- nautilus_switchable_navigation_bar,
- NAUTILUS_TYPE_NAVIGATION_BAR)
-
-static void
-nautilus_switchable_navigation_bar_class_init (NautilusSwitchableNavigationBarClass *klass)
-{
-
- GObjectClass *gobject_class;
- NautilusNavigationBarClass *navigation_bar_class;
-
- gobject_class = G_OBJECT_CLASS (klass);
- navigation_bar_class = NAUTILUS_NAVIGATION_BAR_CLASS (klass);
-
- signals[MODE_CHANGED] = g_signal_new
- ("mode_changed",
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusSwitchableNavigationBarClass,
- mode_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- gobject_class->finalize = nautilus_switchable_navigation_bar_finalize;
-
- navigation_bar_class->get_location = nautilus_switchable_navigation_bar_get_location;
- navigation_bar_class->set_location = nautilus_switchable_navigation_bar_set_location;
-}
-
-static void
-nautilus_switchable_navigation_bar_init (NautilusSwitchableNavigationBar *bar)
-{
-
- bar->details = g_new0 (NautilusSwitchableNavigationBarDetails, 1);
-
-}
-
-static void
-nautilus_switchable_navigation_bar_finalize (GObject *object)
-{
- g_free (NAUTILUS_SWITCHABLE_NAVIGATION_BAR (object)->details);
-
- EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-static void
-create_search_bar_if_non_existant (NautilusSwitchableNavigationBar *bar)
-{
- if (bar->details->search_bar != NULL) {
- return;
- }
-
- bar->details->search_bar = NAUTILUS_SWITCHABLE_SEARCH_BAR (nautilus_switchable_search_bar_new (NAUTILUS_WINDOW (bar->details->window)));
-
- g_signal_connect_object (bar->details->search_bar, "location_changed",
- G_CALLBACK (nautilus_navigation_bar_location_changed), bar, G_CONNECT_SWAPPED);
-
- gtk_box_pack_start (GTK_BOX (bar->details->hbox), GTK_WIDGET (bar->details->search_bar), TRUE, TRUE, 0);
-}
-
-
-GtkWidget *
-nautilus_switchable_navigation_bar_new (NautilusNavigationWindow *window)
-{
- GtkWidget *bar;
- NautilusSwitchableNavigationBar *switchable_navigation_bar;
-
- bar = gtk_widget_new (NAUTILUS_TYPE_SWITCHABLE_NAVIGATION_BAR, NULL);
-
- switchable_navigation_bar = NAUTILUS_SWITCHABLE_NAVIGATION_BAR (bar);
-
- switchable_navigation_bar->details->hbox = gtk_hbox_new (FALSE, 0);
- switchable_navigation_bar->details->window = window;
- switchable_navigation_bar->details->location_bar = NAUTILUS_LOCATION_BAR (nautilus_location_bar_new (window));
-
- g_signal_connect_object (switchable_navigation_bar->details->location_bar, "location_changed",
- G_CALLBACK (nautilus_navigation_bar_location_changed), bar, G_CONNECT_SWAPPED);
-
- gtk_box_pack_start (GTK_BOX (switchable_navigation_bar->details->hbox),
- GTK_WIDGET (switchable_navigation_bar->details->location_bar), TRUE, TRUE, 0);
-
- gtk_widget_show (GTK_WIDGET (switchable_navigation_bar->details->location_bar));
- gtk_widget_show (GTK_WIDGET (switchable_navigation_bar->details->hbox));
- gtk_container_add (GTK_CONTAINER (bar), switchable_navigation_bar->details->hbox);
-
- return bar;
-}
-
-NautilusSwitchableNavigationBarMode
-nautilus_switchable_navigation_bar_get_mode (NautilusSwitchableNavigationBar *bar)
-{
- return bar->details->mode;
-}
-
-void
-nautilus_switchable_navigation_bar_activate (NautilusSwitchableNavigationBar *bar)
-{
- NautilusNavigationBar *bar_to_activate;
-
- switch (bar->details->mode) {
- case NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION:
- bar_to_activate = NAUTILUS_NAVIGATION_BAR (bar->details->location_bar);
- break;
- case NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH:
- bar_to_activate = NAUTILUS_NAVIGATION_BAR (bar->details->search_bar);
- break;
- default:
- g_return_if_fail (FALSE);
- }
-
- nautilus_navigation_bar_activate (bar_to_activate);
-}
-
-
-void
-nautilus_switchable_navigation_bar_set_mode (NautilusSwitchableNavigationBar *bar,
- NautilusSwitchableNavigationBarMode mode)
-{
- GtkWidget *widget_to_hide, *widget_to_show;
- GtkWidget *dock;
-
- if (bar->details->mode == mode) {
- return;
- }
-
- bar->details->mode = mode;
-
- switch (mode) {
- case NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION:
- widget_to_show = GTK_WIDGET (bar->details->location_bar);
- widget_to_hide = GTK_WIDGET (bar->details->search_bar);
- break;
- case NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH:
-
- /* If the search bar hasn't been created, create it */
- create_search_bar_if_non_existant (bar);
-
- widget_to_show = GTK_WIDGET (bar->details->search_bar);
- widget_to_hide = GTK_WIDGET (bar->details->location_bar);
- break;
- default:
- g_return_if_fail (mode && 0);
- }
-
- gtk_widget_show (widget_to_show);
-
- if (widget_to_hide != NULL) {
- gtk_widget_hide (widget_to_hide);
- }
-
- nautilus_switchable_navigation_bar_activate (bar);
-
- /* FIXME bugzilla.gnome.org 43171:
- * We don't know why this line is needed here, but if it's removed
- * then the bar won't shrink when we switch from the complex search
- * bar to the location bar (though it does grow when switching in
- * the other direction)
- */
- dock = gtk_widget_get_ancestor (GTK_WIDGET (bar), BONOBO_TYPE_DOCK);
- if (dock != NULL) {
- gtk_widget_queue_resize (dock);
- }
-
- g_signal_emit (bar, signals[MODE_CHANGED], 0, mode);
-}
-
-static char *
-nautilus_switchable_navigation_bar_get_location (NautilusNavigationBar *navigation_bar)
-{
- NautilusSwitchableNavigationBar *bar;
-
- bar = NAUTILUS_SWITCHABLE_NAVIGATION_BAR (navigation_bar);
-
- switch (bar->details->mode) {
- case NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION:
- return nautilus_navigation_bar_get_location (NAUTILUS_NAVIGATION_BAR (bar->details->location_bar));
- case NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH:
- return nautilus_navigation_bar_get_location (NAUTILUS_NAVIGATION_BAR (bar->details->search_bar));
- default:
- g_assert_not_reached ();
- return NULL;
- }
-}
-
-static void
-nautilus_switchable_navigation_bar_set_location (NautilusNavigationBar *navigation_bar,
- const char *location)
-{
- NautilusSwitchableNavigationBar *bar;
-
- bar = NAUTILUS_SWITCHABLE_NAVIGATION_BAR (navigation_bar);
-
- /* Set location for both bars so if we switch things will
- * still look OK.
- */
- nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (bar->details->location_bar),
- location);
-
- if (bar->details->search_bar != NULL) {
- nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (bar->details->search_bar),
- location);
- }
-
- /* Toggle the search button on and off appropriately */
- if (nautilus_is_search_uri (location)) {
- nautilus_switchable_navigation_bar_set_mode
- (bar, NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH);
- } else {
- nautilus_switchable_navigation_bar_set_mode
- (bar, NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION);
- }
-}
diff --git a/src/nautilus-switchable-navigation-bar.h b/src/nautilus-switchable-navigation-bar.h
deleted file mode 100644
index 51d875687..000000000
--- a/src/nautilus-switchable-navigation-bar.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Maciej Stachowiak <mjs@eazel.com>
- */
-
-/* nautilus-switchable-navigation-bar.h - Navigation bar for Nautilus
- * that allows switching between the location bar and the search bar
- */
-
-#ifndef NAUTILUS_SWITCHABLE_NAVIGATION_BAR_H
-#define NAUTILUS_SWITCHABLE_NAVIGATION_BAR_H
-
-#include "nautilus-navigation-bar.h"
-#include <gtk/gtkhbox.h>
-#include "nautilus-location-bar.h"
-#include "nautilus-search-bar.h"
-
-#define NAUTILUS_TYPE_SWITCHABLE_NAVIGATION_BAR (nautilus_switchable_navigation_bar_get_type ())
-#define NAUTILUS_SWITCHABLE_NAVIGATION_BAR(obj) \
- GTK_CHECK_CAST (obj, NAUTILUS_TYPE_SWITCHABLE_NAVIGATION_BAR, NautilusSwitchableNavigationBar)
-#define NAUTILUS_SWITCHABLE_NAVIGATION_BAR_CLASS(klass) \
- GTK_CHECK_CLASS_CAST (klass, NAUTILUS_TYPE_SWITCHABLE_NAVIGATION_BAR, NautilusSwitchableNavigationBarClass)
-#define NAUTILUS_IS_SWITCHABLE_NAVIGATION_BAR(obj) \
- GTK_CHECK_TYPE (obj, NAUTILUS_TYPE_SWITCHABLE_NAVIGATION_BAR)
-
-typedef struct NautilusSwitchableNavigationBarDetails NautilusSwitchableNavigationBarDetails;
-
-typedef enum {
- NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION,
- NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH
-} NautilusSwitchableNavigationBarMode;
-
-
-typedef struct NautilusSwitchableNavigationBar {
- NautilusNavigationBar parent;
- NautilusSwitchableNavigationBarDetails *details;
-} NautilusSwitchableNavigationBar;
-
-typedef struct {
- NautilusNavigationBarClass parent_class;
-
- void (*mode_changed) (NautilusSwitchableNavigationBar *switchable_navigation_bar,
- NautilusSwitchableNavigationBarMode mode);
-} NautilusSwitchableNavigationBarClass;
-
-GType nautilus_switchable_navigation_bar_get_type (void);
-GtkWidget* nautilus_switchable_navigation_bar_new (NautilusNavigationWindow *window);
-NautilusSwitchableNavigationBarMode nautilus_switchable_navigation_bar_get_mode (NautilusSwitchableNavigationBar *switchable_navigation_bar);
-void nautilus_switchable_navigation_bar_set_mode (NautilusSwitchableNavigationBar *switchable_navigation_bar,
- NautilusSwitchableNavigationBarMode mode);
-void nautilus_switchable_navigation_bar_activate (NautilusSwitchableNavigationBar *switchable_navigation_bar);
-
-#endif /* NAUTILUS_SWITCHABLE_NAVIGATION_BAR_H */
diff --git a/src/nautilus-switchable-search-bar.c b/src/nautilus-switchable-search-bar.c
deleted file mode 100644
index 962957ab3..000000000
--- a/src/nautilus-switchable-search-bar.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Rebecca Schulman <rebecka@eazel.com>
- */
-
-/* nautilus-switchable-search-bar.c - multimodal search bar
- */
-
-#include <config.h>
-#include "nautilus-switchable-search-bar.h"
-
-#include "nautilus-complex-search-bar.h"
-#include "nautilus-simple-search-bar.h"
-#include <bonobo/bonobo-dock.h>
-#include <gtk/gtkeventbox.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkvbox.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include <libnautilus-private/nautilus-directory.h>
-#include <libnautilus-private/nautilus-global-preferences.h>
-#include <eel/eel-gtk-macros.h>
-
-static void real_activate (NautilusNavigationBar *bar);
-static void nautilus_switchable_search_bar_set_location (NautilusNavigationBar *bar,
- const char *location);
-static char * nautilus_switchable_search_bar_get_location (NautilusNavigationBar *bar);
-static void nautilus_switchable_search_bar_class_init (NautilusSwitchableSearchBarClass *class);
-static void nautilus_switchable_search_bar_init (NautilusSwitchableSearchBar *bar);
-static void nautilus_switchable_search_bar_finalize (GObject *object);
-
-static NautilusSearchBarMode other_search_mode (NautilusSearchBarMode mode);
-static NautilusSearchBarMode nautilus_search_uri_to_search_bar_mode (const char *uri);
-static gboolean nautilus_search_uri_is_displayable_by_mode (const char *uri,
- NautilusSearchBarMode mode);
-
-EEL_CLASS_BOILERPLATE (NautilusSwitchableSearchBar,
- nautilus_switchable_search_bar,
- NAUTILUS_TYPE_SEARCH_BAR)
-
-static void
-nautilus_switchable_search_bar_class_init (NautilusSwitchableSearchBarClass *klass)
-{
- NAUTILUS_NAVIGATION_BAR_CLASS (klass)->activate = real_activate;
- NAUTILUS_NAVIGATION_BAR_CLASS (klass)->get_location = nautilus_switchable_search_bar_get_location;
- NAUTILUS_NAVIGATION_BAR_CLASS (klass)->set_location = nautilus_switchable_search_bar_set_location;
-
- G_OBJECT_CLASS (klass)->finalize = nautilus_switchable_search_bar_finalize;
-}
-
-static void
-search_bar_preference_changed_callback (gpointer user_data)
-{
- char *location;
-
- g_assert (NAUTILUS_IS_SWITCHABLE_SEARCH_BAR (user_data));
-
- /* Switch immediately as long as the current search_uri doesn't veto the switch.
- * FIXME bugzilla.gnome.org 42515:
- * Perhaps switch immediately anyway and blow away partially-formed
- * search criteria?
- */
- location = nautilus_switchable_search_bar_get_location
- (NAUTILUS_NAVIGATION_BAR (user_data));
- nautilus_switchable_search_bar_set_mode
- (NAUTILUS_SWITCHABLE_SEARCH_BAR (user_data),
- nautilus_search_uri_to_search_bar_mode (location));
- g_free (location);
-}
-
-static void
-nautilus_switchable_search_bar_init (NautilusSwitchableSearchBar *bar)
-{
-
-}
-
-
-static void
-nautilus_switchable_search_bar_finalize (GObject *object)
-{
- NautilusSwitchableSearchBar *bar;
-
- bar = NAUTILUS_SWITCHABLE_SEARCH_BAR (object);
-
- eel_preferences_remove_callback (NAUTILUS_PREFERENCES_SEARCH_BAR_TYPE,
- search_bar_preference_changed_callback,
- bar);
-
- EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-GtkWidget *
-nautilus_switchable_search_bar_new (NautilusWindow *window)
-{
- GtkWidget *label;
- GtkWidget *event_box;
- GtkWidget *hbox;
- GtkWidget *switchable_search_bar;
- NautilusSwitchableSearchBar *bar;
-
- switchable_search_bar = gtk_widget_new (nautilus_switchable_search_bar_get_type (), NULL);
- bar = NAUTILUS_SWITCHABLE_SEARCH_BAR (switchable_search_bar);
-
- hbox = gtk_hbox_new (0, FALSE);
- event_box = gtk_event_box_new ();
- gtk_container_set_border_width (GTK_CONTAINER (event_box),
- GNOME_PAD_SMALL);
-
- label = gtk_label_new (_("Find:"));
- gtk_container_add (GTK_CONTAINER (event_box), label);
-
- gtk_box_pack_start (GTK_BOX (hbox), event_box, FALSE, TRUE, GNOME_PAD_SMALL);
- bar->complex_search_bar = nautilus_complex_search_bar_new (window);
- bar->simple_search_bar = nautilus_simple_search_bar_new (window);
-
- g_signal_connect_object (bar->complex_search_bar, "location_changed",
- G_CALLBACK (nautilus_navigation_bar_location_changed),
- bar, G_CONNECT_SWAPPED);
- g_signal_connect_object (bar->simple_search_bar, "location_changed",
- G_CALLBACK (nautilus_navigation_bar_location_changed),
- bar, G_CONNECT_SWAPPED);
-
-
- gtk_box_pack_start (GTK_BOX (hbox), bar->complex_search_bar, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), bar->simple_search_bar, TRUE, TRUE, 0);
-
- gtk_container_add (GTK_CONTAINER (bar), hbox);
-
- gtk_widget_show_all (hbox);
- nautilus_switchable_search_bar_set_mode
- (bar,
- eel_preferences_get_enum (NAUTILUS_PREFERENCES_SEARCH_BAR_TYPE));
-
- /* React to future preference changes. */
- eel_preferences_add_callback (NAUTILUS_PREFERENCES_SEARCH_BAR_TYPE,
- search_bar_preference_changed_callback,
- bar);
-
- return switchable_search_bar;
-
-}
-
-static void
-real_activate (NautilusNavigationBar *navigation_bar)
-{
- NautilusSwitchableSearchBar *bar;
- NautilusNavigationBar *bar_to_activate;
-
- bar = NAUTILUS_SWITCHABLE_SEARCH_BAR (navigation_bar);
-
- switch (bar->mode) {
- default:
- g_assert_not_reached();
- case NAUTILUS_SIMPLE_SEARCH_BAR:
- bar_to_activate = NAUTILUS_NAVIGATION_BAR (bar->simple_search_bar);
- break;
- case NAUTILUS_COMPLEX_SEARCH_BAR:
- bar_to_activate = NAUTILUS_NAVIGATION_BAR (bar->complex_search_bar);
- break;
- }
-
- g_assert (bar_to_activate != NULL);
- nautilus_navigation_bar_activate (bar_to_activate);
-}
-
-void
-nautilus_switchable_search_bar_set_mode (NautilusSwitchableSearchBar *bar,
- NautilusSearchBarMode mode)
-{
- char *location;
- GtkWidget *dock;
-
- g_return_if_fail (NAUTILUS_IS_SWITCHABLE_SEARCH_BAR (bar));
- g_return_if_fail (mode == NAUTILUS_SIMPLE_SEARCH_BAR
- || mode == NAUTILUS_COMPLEX_SEARCH_BAR);
-
- /* Ignore requests for impossible modes for now */
- location = nautilus_navigation_bar_get_location (NAUTILUS_NAVIGATION_BAR (bar));
- if (!nautilus_search_uri_is_displayable_by_mode (location, mode)) {
- g_free (location);
- return;
- }
- g_free (location);
-
- switch (mode) {
- case NAUTILUS_SIMPLE_SEARCH_BAR:
- gtk_widget_show (bar->simple_search_bar);
- gtk_widget_hide (bar->complex_search_bar);
- bar->mode = mode;
- break;
- case NAUTILUS_COMPLEX_SEARCH_BAR:
- gtk_widget_show (bar->complex_search_bar);
- gtk_widget_hide (bar->simple_search_bar);
- bar->mode = mode;
- break;
- default:
- g_assert_not_reached();
- break;
- }
-
- /* FIXME bugzilla.gnome.org 43171:
- * We don't know why this line is needed here, but if it's removed
- * then the bar won't shrink when we switch to the simple search bar
- * (though it does grow when switching to the complex one).
- */
- dock = gtk_widget_get_ancestor (GTK_WIDGET (bar), BONOBO_TYPE_DOCK);
- if (dock != NULL) {
- gtk_widget_queue_resize (dock);
- }
-}
-
-static char *
-nautilus_switchable_search_bar_get_location (NautilusNavigationBar *navigation_bar)
-{
- NautilusSwitchableSearchBar *bar;
-
- bar = NAUTILUS_SWITCHABLE_SEARCH_BAR (navigation_bar);
-
- switch (bar->mode) {
- case NAUTILUS_SIMPLE_SEARCH_BAR:
- return nautilus_navigation_bar_get_location (NAUTILUS_NAVIGATION_BAR (bar->simple_search_bar));
- case NAUTILUS_COMPLEX_SEARCH_BAR:
- return nautilus_navigation_bar_get_location (NAUTILUS_NAVIGATION_BAR (bar->complex_search_bar));
- default:
- g_assert_not_reached();
- return NULL;
- }
-}
-
-static void
-nautilus_switchable_search_bar_set_location (NautilusNavigationBar *navigation_bar,
- const char *location)
-{
- NautilusSwitchableSearchBar *bar;
- NautilusSearchBarMode mode;
-
- bar = NAUTILUS_SWITCHABLE_SEARCH_BAR (navigation_bar);
-
- /* Set the mode of the search bar,
- in case preferences have changed
- */
- /* FIXME bugzilla.gnome.org 42514: This doesn't work yet. */
- mode = nautilus_search_uri_to_search_bar_mode (location);
- nautilus_switchable_search_bar_set_mode (bar, mode);
-
- nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (bar->simple_search_bar),
- location);
- nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (bar->complex_search_bar),
- location);
-}
-
-
-
-NautilusSearchBarMode
-nautilus_search_uri_to_search_bar_mode (const char *uri)
-{
- NautilusSearchBarMode preferred_mode;
-
- preferred_mode = eel_preferences_get_enum (NAUTILUS_PREFERENCES_SEARCH_BAR_TYPE);
- if (nautilus_search_uri_is_displayable_by_mode (uri, preferred_mode)) {
- return preferred_mode;
- } else {
- return other_search_mode (preferred_mode);
- }
-}
-
-
-
-gboolean
-nautilus_search_uri_is_displayable_by_mode (const char *uri,
- NautilusSearchBarMode mode)
-{
- /* FIXME bugzilla.gnome.org 42514 */
- return TRUE;
-}
-
-
-static NautilusSearchBarMode
-other_search_mode (NautilusSearchBarMode mode)
-{
- switch (mode) {
- case NAUTILUS_SIMPLE_SEARCH_BAR:
- return NAUTILUS_COMPLEX_SEARCH_BAR;
- break;
- case NAUTILUS_COMPLEX_SEARCH_BAR:
- return NAUTILUS_SIMPLE_SEARCH_BAR;
- break;
- default:
- g_assert_not_reached ();
- }
- return NAUTILUS_COMPLEX_SEARCH_BAR;
-}
-
-
diff --git a/src/nautilus-switchable-search-bar.h b/src/nautilus-switchable-search-bar.h
deleted file mode 100644
index 2fb4c1bb6..000000000
--- a/src/nautilus-switchable-search-bar.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 2000 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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; see the file COPYING. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Rebecca Schulman <rebecka@eazel.com>
- */
-
-/* nautilus-switchable-navigation-bar.h - Navigation bar for Nautilus
- * that allows switching between the location bar and the search bar
- */
-
-
-#ifndef NAUTILUS_SWITCHABLE_SEARCH_BAR_H
-#define NAUTILUS_SWITCHABLE_SEARCH_BAR_H
-
-#include "nautilus-search-bar.h"
-#include "nautilus-window.h"
-#include <gtk/gtkhbox.h>
-
-#define NAUTILUS_TYPE_SWITCHABLE_SEARCH_BAR (nautilus_switchable_search_bar_get_type ())
-#define NAUTILUS_SWITCHABLE_SEARCH_BAR(obj) \
- GTK_CHECK_CAST (obj, NAUTILUS_TYPE_SWITCHABLE_SEARCH_BAR, NautilusSwitchableSearchBar)
-#define NAUTILUS_SWITCHABLE_SEARCH_BAR_CLASS(klass) \
- GTK_CHECK_CLASS_CAST (klass, NAUTILUS_TYPE_SWITCHABLE_SEARCH_BAR, NautilusSwitchableSearchBarClass)
-#define NAUTILUS_IS_SWITCHABLE_SEARCH_BAR(obj) \
- GTK_CHECK_TYPE (obj, NAUTILUS_TYPE_SWITCHABLE_SEARCH_BAR)
-
-typedef struct {
- NautilusSearchBar parent_slot;
-
- NautilusSearchBarMode mode;
- GtkHBox *container;
- GtkWidget *complex_search_bar;
- GtkWidget *simple_search_bar;
-} NautilusSwitchableSearchBar;
-
-typedef struct {
- NautilusSearchBarClass parent_slot;
-
- void (* mode_changed) (NautilusSwitchableSearchBar *search_bar,
- NautilusSearchBarMode mode);
-} NautilusSwitchableSearchBarClass;
-
-GType nautilus_switchable_search_bar_get_type (void);
-GtkWidget *nautilus_switchable_search_bar_new (NautilusWindow *window);
-void nautilus_switchable_search_bar_set_mode (NautilusSwitchableSearchBar *search_bar,
- NautilusSearchBarMode mode);
-
-#endif /* NAUTILUS_SWITCHABLE_SEARCH_BAR_H */
diff --git a/components/throbber/nautilus-throbber.c b/src/nautilus-throbber.c
index 540d4236b..0dbbbd689 100644
--- a/components/throbber/nautilus-throbber.c
+++ b/src/nautilus-throbber.c
@@ -36,17 +36,15 @@
#include <eel/eel-accessibility.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtksignal.h>
+#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-macros.h>
#include <libgnome/gnome-util.h>
-#include <libgnomeui/gnome-icon-theme.h>
+#include <gtk/gtkicontheme.h>
#define THROBBER_DEFAULT_TIMEOUT 100 /* Milliseconds Per Frame */
struct NautilusThrobberDetails {
- BonoboObject *control;
- BonoboPropertyBag *property_bag;
GList *image_list;
- GnomeIconTheme *icon_theme;
GdkPixbuf *quiescent_pixbuf;
@@ -62,7 +60,7 @@ struct NautilusThrobberDetails {
static void nautilus_throbber_load_images (NautilusThrobber *throbber);
static void nautilus_throbber_unload_images (NautilusThrobber *throbber);
-static void nautilus_throbber_theme_changed (GnomeIconTheme *icon_theme,
+static void nautilus_throbber_theme_changed (GtkIconTheme *icon_theme,
NautilusThrobber *throbber);
static void nautilus_throbber_remove_update_callback (NautilusThrobber *throbber);
static AtkObject *nautilus_throbber_get_accessible (GtkWidget *widget);
@@ -72,86 +70,12 @@ GNOME_CLASS_BOILERPLATE (NautilusThrobber, nautilus_throbber,
-/* routines to handle setting and getting the configuration properties of the Bonobo control */
-
-enum {
- STYLE,
- THROBBING,
- LOCATION
-} MyArgs;
-
-
static gboolean
is_throbbing (NautilusThrobber *throbber)
{
return throbber->details->timer_task != 0;
}
-static void
-get_bonobo_properties (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- NautilusThrobber *throbber = NAUTILUS_THROBBER (user_data);
-
- switch (arg_id) {
- case THROBBING:
- {
- BONOBO_ARG_SET_BOOLEAN (arg, throbber->details->timer_task != 0);
- break;
- }
-
- default:
- g_warning ("Unhandled arg %d", arg_id);
- break;
- }
-}
-
-static void
-set_bonobo_properties (BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- NautilusThrobber *throbber = NAUTILUS_THROBBER (user_data);
- switch (arg_id) {
- case THROBBING:
- {
- gboolean throbbing;
-
- throbbing = BONOBO_ARG_GET_BOOLEAN (arg);
-
- if (throbbing != is_throbbing (throbber)) {
- if (throbbing) {
- nautilus_throbber_start (throbber);
- } else {
- nautilus_throbber_stop (throbber);
- }
- }
-
- break;
- }
- case STYLE:
- {
- nautilus_throbber_set_small_mode (throbber, BONOBO_ARG_GET_INT (arg) !=
- BONOBO_UI_TOOLBAR_ITEM_STYLE_ICON_AND_TEXT_VERTICAL);
- break;
- }
- default:
- g_warning ("Unhandled arg %d", arg_id);
- break;
- }
-}
-
-BonoboObject *
-nautilus_throbber_get_control (NautilusThrobber *throbber)
-{
- return throbber->details->control;
-}
-
/* loop through all the images taking their union to compute the width and height of the throbber */
static void
get_throbber_dimensions (NautilusThrobber *throbber, int *throbber_width, int* throbber_height)
@@ -208,33 +132,19 @@ nautilus_throbber_instance_init (NautilusThrobber *throbber)
throbber->details->delay = THROBBER_DEFAULT_TIMEOUT;
- throbber->details->icon_theme = gnome_icon_theme_new ();
- g_signal_connect (throbber->details->icon_theme,
+ g_signal_connect (gtk_icon_theme_get_default (),
"changed",
G_CALLBACK (nautilus_throbber_theme_changed),
throbber);
- /* make the bonobo control */
- throbber->details->control = BONOBO_OBJECT (bonobo_control_new (widget));
- eel_add_weak_pointer (&throbber->details->control);
-
- /* attach a property bag with the configure property */
- throbber->details->property_bag = bonobo_property_bag_new (get_bonobo_properties,
- set_bonobo_properties, throbber);
- bonobo_control_set_properties (BONOBO_CONTROL (throbber->details->control),
- BONOBO_OBJREF (throbber->details->property_bag), NULL);
-
- bonobo_property_bag_add (throbber->details->property_bag, "throbbing", THROBBING, BONOBO_ARG_BOOLEAN, NULL,
- "Throbber active", 0);
- bonobo_property_bag_add (throbber->details->property_bag, "style", STYLE, BONOBO_ARG_INT, NULL, NULL,
- Bonobo_PROPERTY_WRITEABLE);
+
nautilus_throbber_load_images (throbber);
gtk_widget_show (widget);
}
/* handler for handling theme changes */
static void
-nautilus_throbber_theme_changed (GnomeIconTheme *icon_theme, NautilusThrobber *throbber)
+nautilus_throbber_theme_changed (GtkIconTheme *icon_theme, NautilusThrobber *throbber)
{
gtk_widget_hide (GTK_WIDGET (throbber));
nautilus_throbber_load_images (throbber);
@@ -260,7 +170,7 @@ select_throbber_image (NautilusThrobber *throbber)
if (throbber->details->image_list == NULL) {
return NULL;
}
-
+
element = g_list_nth (throbber->details->image_list, throbber->details->current_frame);
return g_object_ref (element->data);
@@ -275,7 +185,7 @@ nautilus_throbber_expose (GtkWidget *widget, GdkEventExpose *event)
GdkPixbuf *pixbuf;
int x_offset, y_offset, width, height;
GdkRectangle pix_area, dest;
-
+
g_return_val_if_fail (NAUTILUS_IS_THROBBER (widget), FALSE);
throbber = NAUTILUS_THROBBER (widget);
@@ -292,8 +202,8 @@ nautilus_throbber_expose (GtkWidget *widget, GdkEventExpose *event)
height = gdk_pixbuf_get_height (pixbuf);
/* Compute the offsets for the image centered on our allocation */
- x_offset = widget->allocation.x + (widget->allocation.width - width) / 2;
- y_offset = widget->allocation.y + (widget->allocation.height - height) / 2;
+ x_offset = (widget->allocation.width - width) / 2;
+ y_offset = (widget->allocation.height - height) / 2;
pix_area.x = x_offset;
pix_area.y = y_offset;
@@ -304,7 +214,7 @@ nautilus_throbber_expose (GtkWidget *widget, GdkEventExpose *event)
g_object_unref (pixbuf);
return FALSE;
}
-
+
gdk_draw_pixbuf (widget->window, NULL, pixbuf,
dest.x - x_offset, dest.y - y_offset,
dest.x, dest.y,
@@ -344,7 +254,7 @@ bump_throbber_frame (gpointer callback_data)
throbber->details->current_frame = 0;
}
- gtk_widget_queue_draw (GTK_WIDGET (throbber));
+ gtk_widget_draw (GTK_WIDGET (throbber), NULL);
return TRUE;
}
@@ -364,9 +274,11 @@ nautilus_throbber_start (NautilusThrobber *throbber)
/* reset the frame count */
throbber->details->current_frame = 0;
- throbber->details->timer_task = g_timeout_add (throbber->details->delay,
- bump_throbber_frame,
- throbber);
+ throbber->details->timer_task = g_timeout_add_full (G_PRIORITY_HIGH,
+ throbber->details->delay,
+ bump_throbber_frame,
+ throbber,
+ NULL);
}
static void
@@ -462,21 +374,32 @@ static void
nautilus_throbber_load_images (NautilusThrobber *throbber)
{
int grid_width, grid_height, x, y, size;
- char *icon;
+ GtkIconInfo *icon_info;
+ const char *icon;
GdkPixbuf *icon_pixbuf, *pixbuf;
GList *image_list;
nautilus_throbber_unload_images (throbber);
/* Load the animation */
- icon = gnome_icon_theme_lookup_icon (throbber->details->icon_theme,
- "gnome-spinner", -1, NULL, &size);
- if (icon == NULL) {
+ icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (),
+ "gnome-spinner", -1, 0);
+ if (icon_info == NULL) {
g_warning ("Throbber animation not found");
return;
}
+ size = gtk_icon_info_get_base_size (icon_info);
+ icon = gtk_icon_info_get_filename (icon_info);
+ g_return_if_fail (icon != NULL);
+
icon_pixbuf = gdk_pixbuf_new_from_file (icon, NULL);
+ if (icon_pixbuf == NULL) {
+ g_warning ("Could not load the spinner file\n");
+ gtk_icon_info_free (icon_info);
+ return;
+ }
+
grid_width = gdk_pixbuf_get_width (icon_pixbuf);
grid_height = gdk_pixbuf_get_height (icon_pixbuf);
@@ -485,12 +408,9 @@ nautilus_throbber_load_images (NautilusThrobber *throbber)
for (x = 0; x < grid_width ; x += size) {
pixbuf = extract_frame (throbber, icon_pixbuf, x, y, size);
- if (pixbuf)
- {
+ if (pixbuf) {
image_list = g_list_prepend (image_list, pixbuf);
- }
- else
- {
+ } else {
g_warning ("Cannot extract frame from the grid");
}
}
@@ -498,22 +418,26 @@ nautilus_throbber_load_images (NautilusThrobber *throbber)
throbber->details->image_list = g_list_reverse (image_list);
throbber->details->max_frame = g_list_length (throbber->details->image_list);
- g_free (icon);
+ gtk_icon_info_free (icon_info);
g_object_unref (icon_pixbuf);
/* Load the rest icon */
- icon = gnome_icon_theme_lookup_icon (throbber->details->icon_theme,
- "gnome-spinner-rest", -1, NULL, &size);
- if (icon == NULL) {
- g_warning ("Throbber rest icon not found");
+ icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (),
+ "gnome-spinner-rest", -1, 0);
+ if (icon_info == NULL) {
+ g_warning ("Throbber rest icon not found\n");
return;
}
+ size = gtk_icon_info_get_base_size (icon_info);
+ icon = gtk_icon_info_get_filename (icon_info);
+ g_return_if_fail (icon != NULL);
+
icon_pixbuf = gdk_pixbuf_new_from_file (icon, NULL);
throbber->details->quiescent_pixbuf = scale_to_real_size (throbber, icon_pixbuf);
g_object_unref (icon_pixbuf);
- g_free (icon);
+ gtk_icon_info_free (icon_info);
}
void
@@ -552,12 +476,6 @@ nautilus_throbber_finalize (GObject *object)
nautilus_throbber_remove_update_callback (throbber);
nautilus_throbber_unload_images (throbber);
- bonobo_object_unref (throbber->details->property_bag);
-
- eel_remove_weak_pointer (&throbber->details->control);
-
- g_object_unref (throbber->details->icon_theme);
-
g_free (throbber->details);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -660,3 +578,9 @@ nautilus_throbber_get_accessible (GtkWidget *widget)
return eel_accessibility_set_atk_object_return (widget, accessible);
}
+
+GtkWidget *
+nautilus_throbber_new (void)
+{
+ return g_object_new (NAUTILUS_TYPE_THROBBER, NULL);
+}
diff --git a/components/throbber/nautilus-throbber.h b/src/nautilus-throbber.h
index 0961749fc..120db4a0c 100644
--- a/components/throbber/nautilus-throbber.h
+++ b/src/nautilus-throbber.h
@@ -29,7 +29,6 @@
#define NAUTILUS_THROBBER_H
#include <gtk/gtkeventbox.h>
-#include <bonobo.h>
G_BEGIN_DECLS
@@ -58,7 +57,6 @@ struct NautilusThrobberClass {
GType nautilus_throbber_get_type (void);
GtkWidget *nautilus_throbber_new (void);
-BonoboObject *nautilus_throbber_get_control (NautilusThrobber *throbber);
void nautilus_throbber_start (NautilusThrobber *throbber);
void nautilus_throbber_stop (NautilusThrobber *throbber);
void nautilus_throbber_set_small_mode (NautilusThrobber *throbber,
diff --git a/src/nautilus-view-frame-corba.c b/src/nautilus-view-frame-corba.c
deleted file mode 100644
index f2aee1e8a..000000000
--- a/src/nautilus-view-frame-corba.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 1999, 2000, 2001 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Elliot Lee <sopwith@redhat.com>
- * Darin Adler <darin@bentspoon.com>
- *
- */
-
-/* nautilus-view-frame-corba.c: CORBA server implementation of the object
- representing a data view frame. */
-
-#include <config.h>
-#include "nautilus-view-frame-private.h"
-
-#include "nautilus-window.h"
-#include <bonobo/bonobo-main.h>
-#include <eel/eel-gtk-extensions.h>
-#include <eel/eel-gtk-macros.h>
-#include <gtk/gtksignal.h>
-#include <libnautilus/nautilus-view.h>
-
-typedef struct {
- BonoboObject parent;
- NautilusViewFrame *widget;
-} NautilusViewFrameCorbaPart;
-
-typedef struct {
- BonoboObjectClass parent;
- POA_Nautilus_ViewFrame__epv epv;
-} NautilusViewFrameCorbaPartClass;
-
-typedef struct {
- char *from_location;
- char *location;
- GList *selection;
- char *title;
- Nautilus_ViewFrame_OpenMode mode;
- Nautilus_ViewFrame_OpenFlags flags;
-} LocationPlus;
-
-static void
-list_free_deep_callback (gpointer callback_data)
-{
- eel_g_list_free_deep (callback_data);
-}
-
-static void
-free_location_plus_callback (gpointer callback_data)
-{
- LocationPlus *location_plus;
-
- location_plus = callback_data;
- g_free (location_plus->from_location);
- g_free (location_plus->location);
- eel_g_list_free_deep (location_plus->selection);
- g_free (location_plus->title);
- g_free (location_plus);
-}
-
-static void
-open_location (NautilusViewFrame *view,
- gpointer callback_data)
-{
- LocationPlus *location_plus;
-
- location_plus = callback_data;
- nautilus_view_frame_open_location
- (view,
- location_plus->location,
- location_plus->mode,
- location_plus->flags,
- location_plus->selection);
-}
-
-static void
-report_location_change (NautilusViewFrame *view,
- gpointer callback_data)
-{
- LocationPlus *location_plus;
-
- location_plus = callback_data;
- nautilus_view_frame_report_location_change
- (view,
- location_plus->location,
- location_plus->selection,
- location_plus->title);
-}
-
-static void
-report_redirect (NautilusViewFrame *view,
- gpointer callback_data)
-{
- LocationPlus *location_plus;
-
- location_plus = callback_data;
- nautilus_view_frame_report_redirect
- (view,
- location_plus->from_location,
- location_plus->location,
- location_plus->selection,
- location_plus->title);
-}
-
-static void
-report_selection_change (NautilusViewFrame *view,
- gpointer callback_data)
-{
- nautilus_view_frame_report_selection_change (view, callback_data);
-}
-
-static void
-report_status (NautilusViewFrame *view,
- gpointer callback_data)
-{
- nautilus_view_frame_report_status (view, callback_data);
-}
-
-static void
-report_load_underway (NautilusViewFrame *view,
- gpointer callback_data)
-{
- nautilus_view_frame_report_load_underway (view);
-}
-
-static void
-report_load_progress (NautilusViewFrame *view,
- gpointer callback_data)
-{
- nautilus_view_frame_report_load_progress (view, * (float *) callback_data);
-}
-
-static void
-report_load_complete (NautilusViewFrame *view,
- gpointer callback_data)
-{
- nautilus_view_frame_report_load_complete (view);
-}
-
-static void
-report_load_failed (NautilusViewFrame *view,
- gpointer callback_data)
-{
- nautilus_view_frame_report_load_failed (view);
-}
-
-static void
-set_show_hidden_files_mode (NautilusViewFrame *view, gpointer callback_data)
-{
- nautilus_view_frame_set_show_hidden_files_mode (view,
- * (Nautilus_ShowHiddenFilesMode *) callback_data,
- TRUE);
-}
-
-
-static void
-set_title (NautilusViewFrame *view,
- gpointer callback_data)
-{
- nautilus_view_frame_set_title (view, callback_data);
-}
-
-static void
-go_back (NautilusViewFrame *view,
- gpointer callback_data)
-{
- nautilus_view_frame_go_back (view);
-}
-
-static void
-close_window (NautilusViewFrame *view,
- gpointer callback_data)
-{
- nautilus_view_frame_close_window (view);
-}
-static void
-impl_Nautilus_ViewFrame_open_location (PortableServer_Servant servant,
- const CORBA_char *location,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags,
- const Nautilus_URIList *selection,
- CORBA_Environment *ev)
-{
- LocationPlus *location_plus;
-
- location_plus = g_new0 (LocationPlus, 1);
- location_plus->location = g_strdup (location);
- location_plus->selection = nautilus_g_list_from_uri_list (selection);
- location_plus->mode = mode;
- location_plus->flags = flags;
-
- nautilus_view_frame_queue_incoming_call
- (servant,
- open_location,
- location_plus,
- free_location_plus_callback);
-}
-
-static void
-impl_Nautilus_ViewFrame_report_location_change (PortableServer_Servant servant,
- const CORBA_char *location,
- const Nautilus_URIList *selection,
- const CORBA_char *title,
- CORBA_Environment *ev)
-{
- LocationPlus *location_plus;
-
- location_plus = g_new0 (LocationPlus, 1);
- location_plus->location = g_strdup (location);
- location_plus->selection = nautilus_g_list_from_uri_list (selection);
- location_plus->title = g_strdup (title);
-
- nautilus_view_frame_queue_incoming_call
- (servant,
- report_location_change,
- location_plus,
- free_location_plus_callback);
-}
-
-static void
-impl_Nautilus_ViewFrame_report_redirect (PortableServer_Servant servant,
- const CORBA_char *from_location,
- const CORBA_char *to_location,
- const Nautilus_URIList *selection,
- const CORBA_char *title,
- CORBA_Environment *ev)
-{
- LocationPlus *location_plus;
-
- location_plus = g_new0 (LocationPlus, 1);
- location_plus->from_location = g_strdup (from_location);
- location_plus->location = g_strdup (to_location);
- location_plus->selection = nautilus_g_list_from_uri_list (selection);
- location_plus->title = g_strdup (title);
-
- nautilus_view_frame_queue_incoming_call
- (servant,
- report_redirect,
- location_plus,
- free_location_plus_callback);
-}
-
-static void
-impl_Nautilus_ViewFrame_report_selection_change (PortableServer_Servant servant,
- const Nautilus_URIList *selection,
- CORBA_Environment *ev)
-{
- nautilus_view_frame_queue_incoming_call
- (servant,
- report_selection_change,
- nautilus_g_list_from_uri_list (selection),
- list_free_deep_callback);
-}
-
-static void
-impl_Nautilus_ViewFrame_report_status (PortableServer_Servant servant,
- const CORBA_char *status,
- CORBA_Environment *ev)
-{
- nautilus_view_frame_queue_incoming_call
- (servant,
- report_status,
- g_strdup (status),
- g_free);
-}
-
-static void
-impl_Nautilus_ViewFrame_report_load_underway (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- nautilus_view_frame_queue_incoming_call
- (servant,
- report_load_underway,
- NULL,
- NULL);
-}
-
-static void
-impl_Nautilus_ViewFrame_report_load_progress (PortableServer_Servant servant,
- CORBA_float fraction_done,
- CORBA_Environment *ev)
-{
- float *copy;
-
- copy = g_new (float, 1);
- *copy = fraction_done;
- nautilus_view_frame_queue_incoming_call
- (servant,
- report_load_progress,
- copy,
- g_free);
-}
-
-static void
-impl_Nautilus_ViewFrame_report_load_complete (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- nautilus_view_frame_queue_incoming_call
- (servant,
- report_load_complete,
- NULL,
- NULL);
-}
-
-static void
-impl_Nautilus_ViewFrame_report_load_failed (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- nautilus_view_frame_queue_incoming_call
- (servant,
- report_load_failed,
- NULL,
- NULL);
-}
-
-static void
-impl_Nautilus_ViewFrame_set_show_hidden_files_mode (PortableServer_Servant servant,
- const Nautilus_ShowHiddenFilesMode mode,
- CORBA_Environment *ev)
-{
- nautilus_view_frame_queue_incoming_call
- (servant,
- set_show_hidden_files_mode,
- g_memdup (&mode, sizeof (Nautilus_ShowHiddenFilesMode)),
- g_free);
-}
-
-static void
-impl_Nautilus_ViewFrame_set_title (PortableServer_Servant servant,
- const CORBA_char *title,
- CORBA_Environment *ev)
-{
- nautilus_view_frame_queue_incoming_call
- (servant,
- set_title,
- g_strdup (title),
- g_free);
-}
-
-static void
-impl_Nautilus_ViewFrame_go_back (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- nautilus_view_frame_queue_incoming_call
- (servant, go_back, NULL, NULL);
-}
-
-static void
-impl_Nautilus_ViewFrame_close_window (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- nautilus_view_frame_queue_incoming_call
- (servant, close_window, NULL, NULL);
-}
-
-static GType nautilus_view_frame_corba_part_get_type (void);
-
-BONOBO_CLASS_BOILERPLATE_FULL (NautilusViewFrameCorbaPart, nautilus_view_frame_corba_part,
- Nautilus_ViewFrame,
- BonoboObject, BONOBO_OBJECT_TYPE)
-
-#define NAUTILUS_TYPE_VIEW_FRAME_CORBA_PART nautilus_view_frame_corba_part_get_type ()
-#define NAUTILUS_VIEW_FRAME_CORBA_PART(object) G_TYPE_CHECK_INSTANCE_CAST ((object), NAUTILUS_TYPE_VIEW_FRAME_CORBA_PART, NautilusViewFrameCorbaPart)
-
-static void
-nautilus_view_frame_corba_part_class_init (NautilusViewFrameCorbaPartClass *class)
-{
- class->epv.open_location = impl_Nautilus_ViewFrame_open_location;
- class->epv.report_location_change = impl_Nautilus_ViewFrame_report_location_change;
- class->epv.report_redirect = impl_Nautilus_ViewFrame_report_redirect;
- class->epv.report_selection_change = impl_Nautilus_ViewFrame_report_selection_change;
- class->epv.report_status = impl_Nautilus_ViewFrame_report_status;
- class->epv.report_load_underway = impl_Nautilus_ViewFrame_report_load_underway;
- class->epv.report_load_progress = impl_Nautilus_ViewFrame_report_load_progress;
- class->epv.report_load_complete = impl_Nautilus_ViewFrame_report_load_complete;
- class->epv.report_load_failed = impl_Nautilus_ViewFrame_report_load_failed;
- class->epv.set_show_hidden_files_mode = impl_Nautilus_ViewFrame_set_show_hidden_files_mode;
- class->epv.set_title = impl_Nautilus_ViewFrame_set_title;
- class->epv.go_back = impl_Nautilus_ViewFrame_go_back;
- class->epv.close_window = impl_Nautilus_ViewFrame_close_window;
-}
-
-static void
-nautilus_view_frame_corba_part_instance_init (NautilusViewFrameCorbaPart *frame)
-{
-}
-
-BonoboObject *
-nautilus_view_frame_create_corba_part (NautilusViewFrame *widget)
-{
- NautilusViewFrameCorbaPart *part;
-
- part = NAUTILUS_VIEW_FRAME_CORBA_PART (g_object_new (NAUTILUS_TYPE_VIEW_FRAME_CORBA_PART, NULL));
- part->widget = widget;
- return BONOBO_OBJECT (part);
-}
-
-NautilusViewFrame *
-nautilus_view_frame_from_servant (PortableServer_Servant servant)
-{
- return NAUTILUS_VIEW_FRAME_CORBA_PART (bonobo_object_from_servant (servant))->widget;
-}
diff --git a/src/nautilus-view-frame-private.h b/src/nautilus-view-frame-private.h
deleted file mode 100644
index 914602f56..000000000
--- a/src/nautilus-view-frame-private.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 1999, 2000, 2001 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Elliot Lee <sopwith@redhat.com>
- * Darin Adler <darin@bentspoon.com>
- *
- */
-
-/* nautilus-view-frame-private.h: Internals of the view proxy that are shared between different implementation files */
-
-#ifndef NAUTILUS_VIEW_FRAME_PRIVATE_H
-#define NAUTILUS_VIEW_FRAME_PRIVATE_H
-
-#include "nautilus-view-frame.h"
-
-typedef void (* NautilusViewFrameFunction) (NautilusViewFrame *view_frame,
- gpointer callback_data);
-
-void nautilus_view_frame_queue_incoming_call (PortableServer_Servant servant,
- NautilusViewFrameFunction call,
- gpointer callback_data,
- GDestroyNotify destroy_callback_data);
-
-BonoboObject *nautilus_view_frame_create_corba_part (NautilusViewFrame *widget);
-NautilusViewFrame *nautilus_view_frame_from_servant (PortableServer_Servant servant);
-
-void nautilus_view_frame_open_location (NautilusViewFrame *view,
- const char *location,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags,
- GList *selection);
-void nautilus_view_frame_report_location_change (NautilusViewFrame *view,
- const char *location,
- GList *selection,
- const char *title);
-void nautilus_view_frame_report_redirect (NautilusViewFrame *view,
- const char *from_location,
- const char *to_location,
- GList *selection,
- const char *title);
-void nautilus_view_frame_report_selection_change (NautilusViewFrame *view,
- GList *selection);
-void nautilus_view_frame_report_status (NautilusViewFrame *view,
- const char *status);
-void nautilus_view_frame_report_load_underway (NautilusViewFrame *view);
-void nautilus_view_frame_report_load_progress (NautilusViewFrame *view,
- double fraction_done);
-void nautilus_view_frame_report_load_complete (NautilusViewFrame *view);
-void nautilus_view_frame_report_load_failed (NautilusViewFrame *view);
-void nautilus_view_frame_set_title (NautilusViewFrame *view,
- const char *title);
-void nautilus_view_frame_go_back (NautilusViewFrame *view);
-void nautilus_view_frame_close_window (NautilusViewFrame *view);
-void nautilus_view_frame_quit_nautilus (NautilusViewFrame *view);
-void nautilus_view_frame_close_desktop (NautilusViewFrame *view);
-
-/* Zoomable */
-void nautilus_view_frame_zoom_level_changed (NautilusViewFrame *view,
- double zoom_level);
-void nautilus_view_frame_zoom_parameters_changed (NautilusViewFrame *view,
- double zoom_level,
- double min_zoom_level,
- double max_zoom_level);
-
-#endif /* NAUTILUS_VIEW_FRAME_PRIVATE_H */
diff --git a/src/nautilus-view-frame.c b/src/nautilus-view-frame.c
deleted file mode 100644
index c53f1a57a..000000000
--- a/src/nautilus-view-frame.c
+++ /dev/null
@@ -1,1708 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 1999, 2000, 2001 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Elliot Lee <sopwith@redhat.com>
- * Darin Adler <darin@bentspoon.com>
- *
- */
-
-/* nautilus-view-frame.c: Widget and CORBA machinery for hosting a NautilusView */
-
-#include <config.h>
-#include "nautilus-view-frame.h"
-
-#include "nautilus-application.h"
-#include "nautilus-component-adapter-factory.h"
-#include "nautilus-signaller.h"
-#include "nautilus-view-frame-private.h"
-#include "nautilus-window.h"
-#include <bonobo/bonobo-control-frame.h>
-#include <bonobo/bonobo-event-source.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-zoomable-frame.h>
-#include <bonobo/bonobo-zoomable.h>
-#include <eel/eel-gtk-extensions.h>
-#include <eel/eel-gtk-macros.h>
-#include <eel/eel-marshal.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtksignal.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
-#include <libnautilus-private/nautilus-marshal.h>
-#include <libnautilus-private/nautilus-undo-manager.h>
-#include <libnautilus/nautilus-idle-queue.h>
-#include <libnautilus/nautilus-view.h>
-#include <nautilus-marshal.h>
-#include <string.h>
-
-enum {
- CHANGE_SELECTION,
- CHANGE_STATUS,
- FAILED,
- GET_HISTORY_LIST,
- GO_BACK,
- CLOSE_WINDOW,
- LOAD_COMPLETE,
- LOAD_PROGRESS_CHANGED,
- LOAD_UNDERWAY,
- OPEN_LOCATION,
- REPORT_LOCATION_CHANGE,
- REPORT_REDIRECT,
- TITLE_CHANGED,
- VIEW_LOADED,
- ZOOM_LEVEL_CHANGED,
- ZOOM_PARAMETERS_CHANGED,
- SHOW_HIDDEN_FILES_MODE_CHANGED,
- LAST_SIGNAL
-};
-
-typedef enum {
- VIEW_FRAME_EMPTY,
- VIEW_FRAME_NO_LOCATION,
- VIEW_FRAME_WAITING,
- VIEW_FRAME_UNDERWAY,
- VIEW_FRAME_LOADED,
- VIEW_FRAME_FAILED
-} NautilusViewFrameState;
-
-struct NautilusViewFrameDetails {
- NautilusViewFrameState state;
- char *title;
- char *label;
- char *view_iid;
-
- /* The view frame Bonobo objects. */
- BonoboObject *view_frame;
- BonoboEventSource *event_source;
- BonoboControlFrame *control_frame;
- BonoboZoomableFrame *zoomable_frame;
-
- /* The view CORBA object. */
- Nautilus_View view;
-
- /* The positionable CORBA object. */
- Nautilus_ScrollPositionable positionable;
-
- /* A container to connect our clients to. */
- BonoboUIContainer *ui_container;
- NautilusUndoManager *undo_manager;
-
- NautilusBonoboActivationHandle *activation_handle;
-
- NautilusIdleQueue *idle_queue;
-
- guint failed_idle_id;
- guint socket_gone_idle_id;
-
- /* zoom data */
- float zoom_level;
- float min_zoom_level;
- float max_zoom_level;
- gboolean has_min_zoom_level;
- gboolean has_max_zoom_level;
- GList *zoom_levels;
-
- Nautilus_WindowType window_type;
- Nautilus_ShowHiddenFilesMode show_hidden_files_mode;
-};
-
-static void nautilus_view_frame_init (NautilusViewFrame *view);
-static void nautilus_view_frame_class_init (NautilusViewFrameClass *klass);
-static void send_history (NautilusViewFrame *view);
-
-static guint signals[LAST_SIGNAL];
-
-EEL_CLASS_BOILERPLATE (NautilusViewFrame,
- nautilus_view_frame,
- GTK_TYPE_HBOX)
-
-void
-nautilus_view_frame_queue_incoming_call (PortableServer_Servant servant,
- NautilusViewFrameFunction call,
- gpointer callback_data,
- GDestroyNotify destroy_callback_data)
-{
- NautilusViewFrame *view;
-
- view = nautilus_view_frame_from_servant (servant);
- if (view == NULL) {
- if (destroy_callback_data != NULL) {
- (* destroy_callback_data) (callback_data);
- }
- return;
- }
-
- nautilus_idle_queue_add (view->details->idle_queue,
- (GFunc) call,
- view,
- callback_data,
- destroy_callback_data);
-}
-
-static void
-nautilus_view_frame_init (NautilusViewFrame *view)
-{
- GTK_WIDGET_SET_FLAGS (view, GTK_NO_WINDOW);
-
- view->details = g_new0 (NautilusViewFrameDetails, 1);
-
- view->details->idle_queue = nautilus_idle_queue_new ();
-
- g_signal_connect_object (nautilus_signaller_get_current (),
- "history_list_changed",
- G_CALLBACK (send_history),
- view, G_CONNECT_SWAPPED);
- g_signal_connect_object (nautilus_icon_factory_get (),
- "icons_changed",
- G_CALLBACK (send_history),
- view, G_CONNECT_SWAPPED);
-}
-
-static void
-stop_activation (NautilusViewFrame *view)
-{
- nautilus_bonobo_activate_cancel (view->details->activation_handle);
- view->details->activation_handle = NULL;
-}
-
-static void
-destroy_view (NautilusViewFrame *view)
-{
- BonoboUIEngine *engine;
-
- if (view->details->view == CORBA_OBJECT_NIL) {
- return;
- }
-
- g_free (view->details->view_iid);
- view->details->view_iid = NULL;
-
- if (view->details->positionable != CORBA_OBJECT_NIL) {
- bonobo_object_release_unref (view->details->positionable, NULL);
- view->details->positionable = CORBA_OBJECT_NIL;
- }
-
- CORBA_Object_release (view->details->view, NULL);
- view->details->view = CORBA_OBJECT_NIL;
-
- bonobo_object_unref (view->details->view_frame);
- view->details->view_frame = NULL;
- view->details->control_frame = NULL;
- view->details->zoomable_frame = NULL;
-
- engine = bonobo_ui_container_get_engine (view->details->ui_container);
- if (engine != NULL) {
- bonobo_ui_engine_deregister_dead_components (engine);
- }
- bonobo_object_unref (view->details->ui_container);
- view->details->ui_container = NULL;
-}
-
-static void
-shut_down (NautilusViewFrame *view)
-{
- /* It's good to be in "failed" state while shutting down
- * (makes operations all be quiet no-ops). But we don't want
- * to send out a "failed" signal.
- */
- view->details->state = VIEW_FRAME_FAILED;
-
- stop_activation (view);
- destroy_view (view);
-
- if (view->details->idle_queue != NULL) {
- nautilus_idle_queue_destroy (view->details->idle_queue);
- view->details->idle_queue = NULL;
- }
-
- if (view->details->failed_idle_id != 0) {
- g_source_remove (view->details->failed_idle_id);
- view->details->failed_idle_id = 0;
- }
- if (view->details->socket_gone_idle_id != 0) {
- g_source_remove (view->details->socket_gone_idle_id);
- view->details->socket_gone_idle_id = 0;
- }
-}
-
-static void
-nautilus_view_frame_unrealize (GtkWidget *widget)
-{
- shut_down (NAUTILUS_VIEW_FRAME (widget));
- EEL_CALL_PARENT (GTK_WIDGET_CLASS, unrealize, (widget));
-}
-
-static void
-nautilus_view_frame_destroy (GtkObject *object)
-{
- shut_down (NAUTILUS_VIEW_FRAME (object));
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
-}
-
-static void
-nautilus_view_frame_finalize (GObject *object)
-{
- NautilusViewFrame *view;
-
- view = NAUTILUS_VIEW_FRAME (object);
-
- shut_down (view);
-
- g_free (view->details->title);
- g_free (view->details->label);
- g_free (view->details);
-
- EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
-}
-
-static void
-emit_zoom_parameters_changed (NautilusViewFrame *view)
-{
- eel_g_list_free_deep (view->details->zoom_levels);
-
- if (view->details->zoomable_frame) {
- view->details->min_zoom_level = bonobo_zoomable_frame_get_min_zoom_level (view->details->zoomable_frame);
- view->details->max_zoom_level = bonobo_zoomable_frame_get_max_zoom_level (view->details->zoomable_frame);
- view->details->has_min_zoom_level = bonobo_zoomable_frame_has_min_zoom_level (view->details->zoomable_frame);
- view->details->has_max_zoom_level = bonobo_zoomable_frame_has_max_zoom_level (view->details->zoomable_frame);
- view->details->zoom_levels = bonobo_zoomable_frame_get_preferred_zoom_levels (view->details->zoomable_frame);
-
- g_signal_emit (view, signals[ZOOM_PARAMETERS_CHANGED], 0);
- } else {
- view->details->min_zoom_level = 0.0;
- view->details->max_zoom_level = 0.0;
- view->details->has_min_zoom_level = FALSE;
- view->details->has_max_zoom_level = FALSE;
- view->details->zoom_levels = NULL;
- }
-}
-
-/* stimulus: successful activated_component call */
-static void
-view_frame_activated (NautilusViewFrame *view)
-{
- g_assert (NAUTILUS_IS_VIEW_FRAME (view));
-
- switch (view->details->state) {
- case VIEW_FRAME_EMPTY:
- view->details->state = VIEW_FRAME_NO_LOCATION;
- g_signal_emit (view, signals[VIEW_LOADED], 0);
- emit_zoom_parameters_changed (view);
- send_history (view);
- return;
- case VIEW_FRAME_NO_LOCATION:
- case VIEW_FRAME_UNDERWAY:
- case VIEW_FRAME_LOADED:
- case VIEW_FRAME_WAITING:
- case VIEW_FRAME_FAILED:
- g_assert_not_reached ();
- return;
- }
-
- g_assert_not_reached ();
-}
-
-/* this corresponds to the load_location call stimulus */
-static void
-view_frame_wait (NautilusViewFrame *view)
-{
- g_assert (NAUTILUS_IS_VIEW_FRAME (view));
-
- switch (view->details->state) {
- case VIEW_FRAME_EMPTY:
- g_warning ("tried to load location in an empty view frame");
- break;
- case VIEW_FRAME_NO_LOCATION:
- case VIEW_FRAME_UNDERWAY:
- case VIEW_FRAME_LOADED:
- view->details->state = VIEW_FRAME_WAITING;
- return;
- case VIEW_FRAME_WAITING:
- return;
- case VIEW_FRAME_FAILED:
- g_assert_not_reached ();
- return;
- }
-
- g_assert_not_reached ();
-}
-
-/* this corresponds to the load_underway and load_progress stimulus */
-static void
-view_frame_underway (NautilusViewFrame *view)
-{
- g_assert (NAUTILUS_IS_VIEW_FRAME (view));
-
- switch (view->details->state) {
- case VIEW_FRAME_EMPTY:
- g_assert_not_reached ();
- return;
- case VIEW_FRAME_NO_LOCATION:
- g_warning ("got signal from a view frame with no location");
- return;
- case VIEW_FRAME_WAITING:
- case VIEW_FRAME_LOADED:
- view->details->state = VIEW_FRAME_UNDERWAY;
- g_signal_emit (view, signals[LOAD_UNDERWAY], 0);
- return;
- case VIEW_FRAME_UNDERWAY:
- case VIEW_FRAME_FAILED:
- return;
- }
-
- g_assert_not_reached ();
-}
-
-/* stimulus
- - open_location call from component
- - report_selection_change
- - report_status
- - set_title
-*/
-static void
-view_frame_wait_is_over (NautilusViewFrame *view)
-{
- g_assert (NAUTILUS_IS_VIEW_FRAME (view));
-
- switch (view->details->state) {
- case VIEW_FRAME_EMPTY:
- case VIEW_FRAME_FAILED:
- g_assert_not_reached ();
- return;
- case VIEW_FRAME_NO_LOCATION:
- g_warning ("got signal from a view frame with no location");
- return;
- case VIEW_FRAME_WAITING:
- view_frame_underway (view);
- return;
- case VIEW_FRAME_UNDERWAY:
- case VIEW_FRAME_LOADED:
- return;
- }
-
- g_assert_not_reached ();
-}
-
-/* stimulus: report_load_complete */
-static void
-view_frame_loaded (NautilusViewFrame *view)
-{
- g_assert (NAUTILUS_IS_VIEW_FRAME (view));
-
- switch (view->details->state) {
- case VIEW_FRAME_EMPTY:
- g_assert_not_reached ();
- return;
- case VIEW_FRAME_NO_LOCATION:
- g_warning ("got signal from a view frame with no location");
- return;
- case VIEW_FRAME_WAITING:
- view_frame_underway (view);
- /* fall through */
- case VIEW_FRAME_UNDERWAY:
- view->details->state = VIEW_FRAME_LOADED;
- g_signal_emit (view, signals[LOAD_COMPLETE], 0);
- return;
- case VIEW_FRAME_LOADED:
- case VIEW_FRAME_FAILED:
- return;
- }
-
- g_assert_not_reached ();
-}
-
-/* stimulus: report_load_failed */
-static void
-view_frame_failed (NautilusViewFrame *view)
-{
- g_assert (NAUTILUS_IS_VIEW_FRAME (view));
-
- switch (view->details->state) {
- case VIEW_FRAME_EMPTY:
- case VIEW_FRAME_LOADED:
- case VIEW_FRAME_NO_LOCATION:
- case VIEW_FRAME_UNDERWAY:
- case VIEW_FRAME_WAITING:
- view->details->state = VIEW_FRAME_FAILED;
- stop_activation (view);
- destroy_view (view);
- g_signal_emit (view, signals[FAILED], 0);
- return;
- case VIEW_FRAME_FAILED:
- return;
- }
-
- g_assert_not_reached ();
-}
-
-NautilusViewFrame *
-nautilus_view_frame_new (BonoboUIContainer *ui_container,
- NautilusUndoManager *undo_manager,
- Nautilus_WindowType window_type)
-{
- NautilusViewFrame *view_frame;
-
- view_frame = NAUTILUS_VIEW_FRAME (gtk_widget_new (nautilus_view_frame_get_type (), NULL));
-
- bonobo_object_ref (ui_container);
- view_frame->details->ui_container = ui_container;
- view_frame->details->undo_manager = undo_manager;
- view_frame->details->window_type = window_type;
- view_frame->details->show_hidden_files_mode = Nautilus_SHOW_HIDDEN_FILES_DEFAULT;
- return view_frame;
-}
-
-static void
-emit_zoom_parameters_changed_callback (gpointer data,
- gpointer callback_data)
-{
-
-
- emit_zoom_parameters_changed (NAUTILUS_VIEW_FRAME (data));
-}
-
-static void
-zoom_parameters_changed_callback (BonoboZoomableFrame *zframe,
- NautilusViewFrame *view)
-{
- g_assert (NAUTILUS_IS_VIEW_FRAME (view));
-
- nautilus_idle_queue_add (view->details->idle_queue,
- emit_zoom_parameters_changed_callback,
- view,
- NULL,
- NULL);
-}
-
-static void
-emit_zoom_level_changed_callback (gpointer data,
- gpointer callback_data)
-{
- NautilusViewFrame *view;
-
- view = NAUTILUS_VIEW_FRAME (data);
-
- view->details->zoom_level = bonobo_zoomable_frame_get_zoom_level (view->details->zoomable_frame);
-
- g_signal_emit (view,
- signals[ZOOM_LEVEL_CHANGED], 0,
- * (float *) callback_data);
-}
-
-static void
-zoom_level_changed_callback (BonoboZoomableFrame *zframe,
- float zoom_level,
- NautilusViewFrame *view)
-{
- float *copy;
-
- g_assert (NAUTILUS_IS_VIEW_FRAME (view));
-
- copy = g_new (float, 1);
- *copy = zoom_level;
- nautilus_idle_queue_add (view->details->idle_queue,
- emit_zoom_level_changed_callback,
- view,
- copy,
- g_free);
-}
-
-enum {
- BONOBO_PROPERTY_TITLE,
- BONOBO_PROPERTY_HISTORY,
- BONOBO_PROPERTY_SELECTION,
- BONOBO_PROPERTY_WINDOW_TYPE,
- BONOBO_PROPERTY_SHOW_HIDDEN_FILES_MODE
-};
-
-static Nautilus_History *
-get_history_list (NautilusViewFrame *view)
-{
- Nautilus_History *history_list;
-
- history_list = NULL;
- g_signal_emit (view,
- signals[GET_HISTORY_LIST], 0,
- &history_list);
- return history_list;
-}
-
-static void
-nautilus_view_frame_get_prop (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- NautilusViewFrame *view = user_data;
-
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (user_data));
-
- switch (arg_id) {
- case BONOBO_PROPERTY_TITLE:
- BONOBO_ARG_SET_STRING (arg, view->details->title);
- break;
-
- case BONOBO_PROPERTY_HISTORY:
- CORBA_free (arg->_value);
- arg->_value = get_history_list (view);
- break;
-
- case BONOBO_PROPERTY_SELECTION:
- g_warning ("NautilusViewFrame: selection fetch not yet implemented");
- break;
-
- case BONOBO_PROPERTY_WINDOW_TYPE :
- BONOBO_ARG_SET_GENERAL (arg, view->details->window_type,
- TC_Nautilus_WindowType,
- Nautilus_WindowType,
- NULL);
- break;
-
- case BONOBO_PROPERTY_SHOW_HIDDEN_FILES_MODE :
- BONOBO_ARG_SET_GENERAL (arg, view->details->show_hidden_files_mode,
- TC_Nautilus_ShowHiddenFilesMode,
- Nautilus_ShowHiddenFilesMode,
- NULL);
- break;
- default:
- g_warning ("NautilusViewFrame: Unknown property idx %d", arg_id);
- break;
- }
-}
-
-static BonoboPropertyBag *
-create_ambient_properties (NautilusViewFrame *view)
-{
- BonoboPropertyBag *bag;
-
- bag = bonobo_property_bag_new (nautilus_view_frame_get_prop, NULL, view);
-
- bonobo_property_bag_add
- (bag,
- "title",
- BONOBO_PROPERTY_TITLE,
- TC_CORBA_string,
- NULL,
- _("a title"),
- BONOBO_PROPERTY_READABLE);
-
- bonobo_property_bag_add
- (bag,
- "history",
- BONOBO_PROPERTY_HISTORY,
- TC_Nautilus_History,
- NULL,
- _("the browse history"),
- BONOBO_PROPERTY_READABLE);
-
- bonobo_property_bag_add
- (bag,
- "selection",
- BONOBO_PROPERTY_SELECTION,
- TC_Nautilus_URIList,
- NULL,
- _("the current selection"),
- BONOBO_PROPERTY_READABLE);
-
- bonobo_property_bag_add
- (bag,
- "window-type",
- BONOBO_PROPERTY_WINDOW_TYPE,
- TC_Nautilus_WindowType,
- NULL,
- _("the type of window the view is embedded in"),
- BONOBO_PROPERTY_READABLE);
-
- bonobo_property_bag_add
- (bag,
- "show-hidden-files-mode",
- BONOBO_PROPERTY_SHOW_HIDDEN_FILES_MODE,
- TC_Nautilus_ShowHiddenFilesMode,
- NULL,
- _("whether to show hidden files in the view"),
- BONOBO_PROPERTY_READABLE);
-
- view->details->event_source = bag->es;
-
- return bag;
-}
-
-static void
-create_corba_objects (NautilusViewFrame *view)
-{
- CORBA_Environment ev;
- Bonobo_Control control;
- Bonobo_Zoomable zoomable;
- Nautilus_ScrollPositionable positionable;
- BonoboPropertyBag *bag;
-
- CORBA_exception_init (&ev);
-
- /* Create a view frame. */
- view->details->view_frame = nautilus_view_frame_create_corba_part (view);
-
- /* Create a control frame. */
- control = Bonobo_Unknown_queryInterface
- (view->details->view, "IDL:Bonobo/Control:1.0", &ev);
- g_assert (! BONOBO_EX (&ev));
-
- view->details->control_frame = bonobo_control_frame_new
- (BONOBO_OBJREF (view->details->ui_container));
-
- bag = create_ambient_properties (view);
- bonobo_control_frame_set_propbag (view->details->control_frame, bag);
- bonobo_object_unref (bag);
-
- bonobo_control_frame_bind_to_control (view->details->control_frame, control, NULL);
-
- bonobo_object_release_unref (control, NULL);
-
- /* Create a zoomable frame. */
- zoomable = Bonobo_Unknown_queryInterface
- (view->details->view, "IDL:Bonobo/Zoomable:1.0", &ev);
- if (!BONOBO_EX (&ev)
- && !CORBA_Object_is_nil (zoomable, &ev)
- && !BONOBO_EX (&ev)) {
- view->details->zoomable_frame = bonobo_zoomable_frame_new ();
- bonobo_zoomable_frame_bind_to_zoomable
- (view->details->zoomable_frame, zoomable, NULL);
- bonobo_object_release_unref (zoomable, NULL);
- }
-
- CORBA_exception_free (&ev);
-
- CORBA_exception_init (&ev);
-
- positionable = Bonobo_Unknown_queryInterface
- (view->details->view, "IDL:Nautilus/ScrollPositionable:1.0", &ev);
- if (!BONOBO_EX (&ev)
- && !CORBA_Object_is_nil (positionable, &ev)
- && !BONOBO_EX (&ev)) {
- view->details->positionable = positionable;
- }
-
- CORBA_exception_free (&ev);
-
- /* Aggregate all the interfaces into one object. */
- bonobo_object_add_interface (BONOBO_OBJECT (view->details->view_frame),
- BONOBO_OBJECT (view->details->control_frame));
- if (view->details->zoomable_frame != NULL) {
- bonobo_object_add_interface (BONOBO_OBJECT (view->details->view_frame),
- BONOBO_OBJECT (view->details->zoomable_frame));
- }
- nautilus_undo_manager_add_interface (view->details->undo_manager,
- BONOBO_OBJECT (view->details->view_frame));
-}
-
-
-static gboolean
-view_frame_failed_callback (gpointer callback_data)
-{
- NautilusViewFrame *view;
-
- view = NAUTILUS_VIEW_FRAME (callback_data);
- view->details->failed_idle_id = 0;
- view_frame_failed (view);
- return FALSE;
-}
-
-static void
-queue_view_frame_failed (NautilusViewFrame *view)
-{
- g_assert (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->failed_idle_id == 0) {
- view->details->failed_idle_id =
- g_idle_add (view_frame_failed_callback, view);
- }
-}
-
-static gboolean
-check_socket_gone_idle_callback (gpointer callback_data)
-{
- NautilusViewFrame *frame;
- GtkWidget *widget;
- GList *children;
-
- frame = NAUTILUS_VIEW_FRAME (callback_data);
-
- frame->details->socket_gone_idle_id = 0;
-
- widget = bonobo_control_frame_get_widget (frame->details->control_frame);
-
- /* This relies on details of the BonoboControlFrame
- * implementation, specifically that's there's one level of
- * hierarchy between the widget returned by get_widget and the
- * actual plug.
- */
- children = gtk_container_get_children (GTK_CONTAINER (widget));
- g_list_free (children);
-
- /* If there's nothing inside the widget at all, that means
- * that the socket went away because the remote plug went away.
- */
- if (children == NULL) {
- view_frame_failed (frame);
- }
-
- return FALSE;
-}
-
-static void
-check_socket_gone_callback (GtkContainer *container,
- GtkWidget *widget,
- gpointer callback_data)
-{
- NautilusViewFrame *frame;
-
- frame = NAUTILUS_VIEW_FRAME (callback_data);
-
- /* There are two times the socket will be destroyed in Bonobo.
- * One is when a local control decides to not use the socket.
- * The other is when the remote plug goes away. The way to
- * tell these apart is to wait until idle time. At idle time,
- * if there's nothing in the container, then that means the
- * real socket went away. If it was just the local control
- * deciding not to use the socket, there will be another
- * widget in there.
- */
- if (frame->details->socket_gone_idle_id == 0) {
- frame->details->socket_gone_idle_id = g_idle_add
- (check_socket_gone_idle_callback, callback_data);
- }
-}
-
-static void
-attach_view (NautilusViewFrame *view,
- Bonobo_Unknown component)
-{
- CORBA_Environment ev;
- GtkWidget *widget;
-
- /* Either create an adapter or query for the Nautilus:View
- * interface. Either way, we don't need to keep the original
- * reference around once that happens.
- */
- view->details->view = nautilus_component_adapter_factory_create_adapter
- (nautilus_component_adapter_factory_get (), component);
-
- /* Handle case where we don't know how to host this component. */
- if (view->details->view == CORBA_OBJECT_NIL) {
- view_frame_failed (view);
- return;
- }
-
- create_corba_objects (view);
-
- CORBA_exception_init (&ev);
- Bonobo_Unknown_unref (view->details->view, &ev);
- CORBA_exception_free (&ev);
-
- widget = bonobo_control_frame_get_widget (view->details->control_frame);
-
- g_signal_connect_object (view->details->view_frame, "destroy",
- G_CALLBACK (view_frame_failed), view, G_CONNECT_SWAPPED);
- g_signal_connect_object (view->details->view_frame, "system_exception",
- G_CALLBACK (queue_view_frame_failed), view, G_CONNECT_SWAPPED);
- g_signal_connect_object (view->details->control_frame, "system_exception",
- G_CALLBACK (queue_view_frame_failed), view, G_CONNECT_SWAPPED);
- g_signal_connect_object (widget, "remove",
- G_CALLBACK (check_socket_gone_callback), view, 0);
-
- if (view->details->zoomable_frame != NULL) {
- g_signal_connect_object (view->details->zoomable_frame, "system_exception",
- G_CALLBACK (queue_view_frame_failed), view, G_CONNECT_SWAPPED);
- g_signal_connect_object (view->details->zoomable_frame, "zoom_parameters_changed",
- G_CALLBACK (zoom_parameters_changed_callback), view, 0);
- g_signal_connect_object (view->details->zoomable_frame, "zoom_level_changed",
- G_CALLBACK (zoom_level_changed_callback), view, 0);
- }
-
- gtk_widget_show (widget);
- gtk_container_add (GTK_CONTAINER (view), widget);
-
- view_frame_activated (view);
-
- /* The frame might already be mapped when the view is activated.
- * This means we won't get the mapped signal while its active, so
- * activate it now.
- */
- if (GTK_WIDGET_MAPPED (GTK_WIDGET (view))) {
- bonobo_control_frame_control_activate (view->details->control_frame);
- }
-}
-
-static void
-activation_callback (NautilusBonoboActivationHandle *handle,
- Bonobo_Unknown activated_object,
- gpointer callback_data)
-{
- NautilusViewFrame *view;
-
- view = NAUTILUS_VIEW_FRAME (callback_data);
- g_assert (view->details->activation_handle == handle);
-
- view->details->activation_handle = NULL;
-
- if (activated_object == CORBA_OBJECT_NIL) {
- view_frame_failed (view);
- } else {
- attach_view (view, activated_object);
- }
-}
-
-void
-nautilus_view_frame_load_view (NautilusViewFrame *view,
- const char *view_iid)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
- g_return_if_fail (view_iid != NULL);
-
- if (view->details->state == VIEW_FRAME_FAILED) {
- return;
- }
-
- g_return_if_fail (view->details->state == VIEW_FRAME_EMPTY);
- g_assert (view->details->view_iid == NULL);
- g_assert (view->details->activation_handle == NULL);
-
- view->details->view_iid = g_strdup (view_iid);
- view->details->activation_handle = nautilus_bonobo_activate_from_id
- (view_iid, activation_callback, view);
-}
-
-void
-nautilus_view_frame_load_location (NautilusViewFrame *view,
- const char *location)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->state == VIEW_FRAME_FAILED) {
- return;
- }
-
- g_free (view->details->title);
- view->details->title = NULL;
- g_signal_emit (view, signals[TITLE_CHANGED], 0);
-
- view_frame_wait (view);
-
- CORBA_exception_init (&ev);
- Nautilus_View_load_location (view->details->view, location, &ev);
- if (BONOBO_EX (&ev)) {
- view_frame_failed (view);
- }
- CORBA_exception_free (&ev);
-}
-
-void
-nautilus_view_frame_stop (NautilusViewFrame *view)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->state == VIEW_FRAME_FAILED) {
- return;
- }
-
- stop_activation (view);
-
- if (view->details->view != CORBA_OBJECT_NIL) {
- CORBA_exception_init (&ev);
- Nautilus_View_stop_loading (view->details->view, &ev);
- if (BONOBO_EX (&ev)) {
- view_frame_failed (view);
- }
- CORBA_exception_free (&ev);
- }
-}
-
-void
-nautilus_view_frame_selection_changed (NautilusViewFrame *view,
- GList *selection)
-{
- BonoboArg *arg;
- CORBA_Environment ev;
- Nautilus_URIList *uri_list;
-
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->view == CORBA_OBJECT_NIL) {
- return;
- }
-
- if (!bonobo_event_source_has_listener
- (view->details->event_source,
- "Bonobo/Property:change:selection")) {
- return;
- }
-
- uri_list = nautilus_uri_list_from_g_list (selection);
-
- CORBA_exception_init (&ev);
-
- arg = bonobo_arg_new_from (TC_Nautilus_URIList, uri_list);
- CORBA_free (uri_list);
-
- bonobo_event_source_notify_listeners
- (view->details->event_source,
- "Bonobo/Property:change:selection", arg, &ev);
-
- CORBA_free (arg);
-
- if (BONOBO_EX (&ev)) {
- view_frame_failed (view);
- }
-
- CORBA_exception_free (&ev);
-}
-
-void
-nautilus_view_frame_title_changed (NautilusViewFrame *view,
- const char *title)
-{
- BonoboArg arg;
- CORBA_Environment ev;
-
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->view == CORBA_OBJECT_NIL) {
- return;
- }
-
- CORBA_exception_init (&ev);
-
- arg._type = TC_CORBA_string;
- arg._value = &title;
-
- bonobo_event_source_notify_listeners
- (view->details->event_source,
- "Bonobo/Property:change:title", &arg, &ev);
-
- if (BONOBO_EX (&ev)) {
- view_frame_failed (view);
- }
-
- CORBA_exception_free (&ev);
-}
-
-gboolean
-nautilus_view_frame_get_is_zoomable (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), FALSE);
-
- return view->details->zoomable_frame != NULL;
-}
-
-float
-nautilus_view_frame_get_zoom_level (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), 0.0);
-
- if (view->details->zoomable_frame == NULL) {
- return 0.0;
- }
-
- return view->details->zoom_level;
-}
-
-void
-nautilus_view_frame_set_zoom_level (NautilusViewFrame *view,
- float zoom_level)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->zoomable_frame == NULL) {
- return;
- }
-
- bonobo_zoomable_frame_set_zoom_level (view->details->zoomable_frame, zoom_level);
-}
-
-float
-nautilus_view_frame_get_min_zoom_level (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), 0.0);
-
- if (view->details->zoomable_frame == NULL) {
- return 0.0;
- }
-
- return view->details->min_zoom_level;
-}
-
-float
-nautilus_view_frame_get_max_zoom_level (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), 0.0);
-
- if (view->details->zoomable_frame == NULL) {
- return 0.0;
- }
-
- return view->details->max_zoom_level;
-}
-
-gboolean
-nautilus_view_frame_get_has_min_zoom_level (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), FALSE);
-
- if (view->details->zoomable_frame == NULL) {
- return FALSE;
- }
-
- return view->details->has_min_zoom_level;
-}
-
-gboolean
-nautilus_view_frame_get_has_max_zoom_level (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), FALSE);
-
- if (view->details->zoomable_frame == NULL) {
- return FALSE;
- }
-
- return view->details->has_max_zoom_level;
-}
-
-gboolean
-nautilus_view_frame_get_is_continuous (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), FALSE);
-
- if (view->details->zoomable_frame == NULL) {
- return FALSE;
- }
-
- return bonobo_zoomable_frame_is_continuous (view->details->zoomable_frame);
-}
-
-gboolean
-nautilus_view_frame_get_can_zoom_in (NautilusViewFrame *view)
-{
- return !view->details->has_max_zoom_level ||
- (view->details->zoom_level
- < view->details->max_zoom_level);
-
-}
-
-gboolean
-nautilus_view_frame_get_can_zoom_out (NautilusViewFrame *view)
-{
- return !view->details->has_min_zoom_level ||
- (view->details->zoom_level
- > view->details->min_zoom_level);
-}
-
-
-GList *
-nautilus_view_frame_get_preferred_zoom_levels (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), NULL);
-
- if (view->details->zoomable_frame == NULL) {
- return NULL;
- }
-
- return bonobo_zoomable_frame_get_preferred_zoom_levels (view->details->zoomable_frame);
-}
-
-void
-nautilus_view_frame_zoom_in (NautilusViewFrame *view)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->zoomable_frame == NULL) {
- return;
- }
-
- bonobo_zoomable_frame_zoom_in (view->details->zoomable_frame);
-}
-
-void
-nautilus_view_frame_zoom_out (NautilusViewFrame *view)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->zoomable_frame == NULL) {
- return;
- }
-
- bonobo_zoomable_frame_zoom_out (view->details->zoomable_frame);
-}
-
-void
-nautilus_view_frame_zoom_to_fit (NautilusViewFrame *view)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->zoomable_frame == NULL) {
- return;
- }
-
- bonobo_zoomable_frame_zoom_to_fit (view->details->zoomable_frame);
-}
-
-char *
-nautilus_view_frame_get_first_visible_file (NautilusViewFrame *view)
-{
- Nautilus_URI uri;
- char *ret;
-
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), NULL);
-
- ret = NULL;
- if (view->details->positionable) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- uri = Nautilus_ScrollPositionable_get_first_visible_file (view->details->positionable, &ev);
- ret = g_strdup (uri);
- CORBA_free (uri);
- CORBA_exception_free (&ev);
- }
-
- return ret;
-}
-
-void
-nautilus_view_frame_scroll_to_file (NautilusViewFrame *view,
- const char *uri)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->positionable) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- Nautilus_ScrollPositionable_scroll_to_file (view->details->positionable,
- uri,
- &ev);
- CORBA_exception_free (&ev);
- }
-}
-
-
-const char *
-nautilus_view_frame_get_view_iid (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), NULL);
-
- return view->details->view_iid;
-}
-
-void
-nautilus_view_frame_open_location (NautilusViewFrame *view,
- const char *location,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags,
- GList *selection)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->state == VIEW_FRAME_FAILED) {
- return;
- }
-
- view_frame_wait_is_over (view);
- g_signal_emit (view,
- signals[OPEN_LOCATION], 0,
- location, mode, flags, selection);
-}
-
-void
-nautilus_view_frame_report_location_change (NautilusViewFrame *view,
- const char *location,
- GList *selection,
- const char *title)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->state == VIEW_FRAME_FAILED) {
- return;
- }
-
- g_free (view->details->title);
- view->details->title = g_strdup (title);
-
- view_frame_wait_is_over (view);
- g_signal_emit (view,
- signals[REPORT_LOCATION_CHANGE], 0,
- location, selection, title);
-}
-
-void
-nautilus_view_frame_report_redirect (NautilusViewFrame *view,
- const char *from_location,
- const char *to_location,
- GList *selection,
- const char *title)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->state == VIEW_FRAME_FAILED) {
- return;
- }
-
- g_free (view->details->title);
- view->details->title = g_strdup (title);
-
- view_frame_wait_is_over (view);
- g_signal_emit (view,
- signals[REPORT_REDIRECT], 0,
- from_location, to_location, selection, title);
-}
-
-void
-nautilus_view_frame_report_selection_change (NautilusViewFrame *view,
- GList *selection)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->state == VIEW_FRAME_FAILED) {
- return;
- }
-
- view_frame_wait_is_over (view);
- g_signal_emit (view,
- signals[CHANGE_SELECTION], 0, selection);
-}
-
-void
-nautilus_view_frame_report_status (NautilusViewFrame *view,
- const char *status)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->state == VIEW_FRAME_FAILED) {
- return;
- }
-
- view_frame_wait_is_over (view);
- g_signal_emit (view,
- signals[CHANGE_STATUS], 0, status);
-}
-
-void
-nautilus_view_frame_report_load_underway (NautilusViewFrame *view)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- view_frame_underway (view);
-}
-
-void
-nautilus_view_frame_report_load_progress (NautilusViewFrame *view,
- double fraction_done)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->state == VIEW_FRAME_FAILED) {
- return;
- }
-
- view_frame_underway (view);
- g_signal_emit (view,
- signals[LOAD_PROGRESS_CHANGED], 0);
-}
-
-void
-nautilus_view_frame_report_load_complete (NautilusViewFrame *view)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- view_frame_loaded (view);
-}
-
-void
-nautilus_view_frame_report_load_failed (NautilusViewFrame *view)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- view_frame_failed (view);
-}
-
-/* return the Bonobo_Control CORBA object associated with the view frame */
-Bonobo_Control
-nautilus_view_frame_get_control (NautilusViewFrame *view)
-{
- if (view->details->control_frame == NULL) {
- return CORBA_OBJECT_NIL;
- }
- return bonobo_control_frame_get_control (view->details->control_frame);
-}
-
-void
-nautilus_view_frame_go_back (NautilusViewFrame *view)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- g_signal_emit (view, signals[GO_BACK], 0);
-}
-
-void
-nautilus_view_frame_close_window (NautilusViewFrame *view)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- g_signal_emit (view, signals[CLOSE_WINDOW], 0);
-}
-
-Nautilus_ShowHiddenFilesMode
-nautilus_view_frame_get_show_hidden_files_mode (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), 0);
-
- return view->details->show_hidden_files_mode;
-}
-
-
-void
-nautilus_view_frame_set_show_hidden_files_mode (NautilusViewFrame *view,
- Nautilus_ShowHiddenFilesMode mode,
- gboolean from_view)
-{
- CORBA_Environment ev;
-
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
- view->details->show_hidden_files_mode = mode;
- if (from_view) {
- /* The call was from the the view, propagate to the window */
- g_signal_emit (view, signals[SHOW_HIDDEN_FILES_MODE_CHANGED], 0);
- } else if (view->details->event_source) {
- /* The call was from the window, propagate to all views */
- CORBA_exception_init (&ev);
-
- bonobo_event_source_notify_listeners
- (view->details->event_source,
- "Bonobo/Property:change:show-hidden-files-mode", NULL, &ev);
-
- if (BONOBO_EX (&ev)) {
- g_warning ("show hidden mode notification failed");
- }
-
- CORBA_exception_free (&ev);
- }
-}
-
-void
-nautilus_view_frame_set_title (NautilusViewFrame *view,
- const char *title)
-{
- gboolean changed;
-
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
- g_return_if_fail (title != NULL);
-
- if (view->details->state == VIEW_FRAME_FAILED) {
- return;
- }
-
- /* Only do work if the title actually changed. */
- changed = view->details->title == NULL
- || strcmp (view->details->title, title) != 0;
-
- g_free (view->details->title);
- view->details->title = g_strdup (title);
-
- view_frame_wait_is_over (view);
- if (changed) {
- g_signal_emit (view, signals[TITLE_CHANGED], 0);
- }
-}
-
-char *
-nautilus_view_frame_get_title (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), NULL);
-
- return g_strdup (view->details->title);
-}
-
-char *
-nautilus_view_frame_get_label (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), NULL);
-
- return g_strdup (view->details->label);
-}
-
-void
-nautilus_view_frame_set_label (NautilusViewFrame *view,
- const char *label)
-{
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- g_free (view->details->label);
- view->details->label = g_strdup (label);
-}
-
-/* Activate the underlying control frame whenever the view is mapped.
- * This causes the view to merge its menu items, for example. For
- * sidebar panels, it might be a little late to merge them at map
- * time. What's a better time?
- */
-static void
-nautilus_view_frame_map (GtkWidget *view_as_widget)
-{
- NautilusViewFrame *view;
-
- view = NAUTILUS_VIEW_FRAME (view_as_widget);
-
- EEL_CALL_PARENT (GTK_WIDGET_CLASS, map, (view_as_widget));
-
- if (view->details->control_frame != NULL) {
- bonobo_control_frame_control_activate (view->details->control_frame);
- }
-}
-
-static void
-send_history (NautilusViewFrame *view)
-{
- Nautilus_History *history;
- CORBA_Environment ev;
- BonoboArg *arg;
-
- g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
-
- if (view->details->view == CORBA_OBJECT_NIL) {
- return;
- }
-
- if (!bonobo_event_source_has_listener
- (view->details->event_source,
- "Bonobo/Property:change:history")) {
- return;
- }
-
- history = get_history_list (view);
- if (history == CORBA_OBJECT_NIL) {
- return;
- }
-
- CORBA_exception_init (&ev);
-
- arg = bonobo_arg_new_from (TC_Nautilus_History, history);
-
- CORBA_free (history);
-
- bonobo_event_source_notify_listeners
- (view->details->event_source,
- "Bonobo/Property:change:history", arg, &ev);
-
- CORBA_free (arg);
-
- if (BONOBO_EX (&ev)) {
- view_frame_failed (view);
- }
-
- CORBA_exception_free (&ev);
-}
-
-gboolean
-nautilus_view_frame_get_is_view_loaded (NautilusViewFrame *view)
-{
- g_return_val_if_fail (NAUTILUS_IS_VIEW_FRAME (view), FALSE);
-
- switch (view->details->state) {
- case VIEW_FRAME_EMPTY:
- case VIEW_FRAME_FAILED:
- return FALSE;
- case VIEW_FRAME_NO_LOCATION:
- case VIEW_FRAME_WAITING:
- case VIEW_FRAME_UNDERWAY:
- case VIEW_FRAME_LOADED:
- return TRUE;
- }
-
- g_assert_not_reached ();
- return FALSE;
-}
-
-static void
-nautilus_view_frame_class_init (NautilusViewFrameClass *class)
-{
- G_OBJECT_CLASS (class)->finalize = nautilus_view_frame_finalize;
- GTK_OBJECT_CLASS (class)->destroy = nautilus_view_frame_destroy;
- GTK_WIDGET_CLASS (class)->unrealize = nautilus_view_frame_unrealize;
- GTK_WIDGET_CLASS (class)->map = nautilus_view_frame_map;
-
- signals[CHANGE_SELECTION] = g_signal_new
- ("change_selection",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- change_selection),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
- signals[CHANGE_STATUS] = g_signal_new
- ("change_status",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- change_status),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
- signals[FAILED] = g_signal_new
- ("failed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- failed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[GET_HISTORY_LIST] = g_signal_new
- ("get_history_list",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- get_history_list),
- NULL, NULL,
- nautilus_marshal_POINTER__VOID,
- G_TYPE_POINTER, 0);
- signals[GO_BACK] = g_signal_new
- ("go_back",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- go_back),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[CLOSE_WINDOW] = g_signal_new
- ("close_window",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- close_window),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[LOAD_COMPLETE] = g_signal_new
- ("load_complete",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- load_complete),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[LOAD_PROGRESS_CHANGED] = g_signal_new
- ("load_progress_changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- load_progress_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[LOAD_UNDERWAY] = g_signal_new
- ("load_underway",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- load_underway),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[OPEN_LOCATION] = g_signal_new
- ("open_location",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- open_location),
- NULL, NULL,
- eel_marshal_VOID__STRING_LONG_LONG_POINTER,
- G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_LONG, G_TYPE_LONG, G_TYPE_POINTER);
- signals[REPORT_LOCATION_CHANGE] = g_signal_new
- ("report_location_change",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- report_location_change),
- NULL, NULL,
- eel_marshal_VOID__STRING_POINTER_STRING,
- G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_STRING);
- signals[REPORT_REDIRECT] = g_signal_new
- ("report_redirect",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- report_redirect),
- NULL, NULL,
- eel_marshal_VOID__STRING_STRING_POINTER_STRING,
- G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_STRING);
- signals[SHOW_HIDDEN_FILES_MODE_CHANGED] = g_signal_new
- ("show_hidden_files_mode_changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- show_hidden_files_mode_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[TITLE_CHANGED] = g_signal_new
- ("title_changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- title_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[VIEW_LOADED] = g_signal_new
- ("view_loaded",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- view_loaded),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[ZOOM_LEVEL_CHANGED] = g_signal_new
- ("zoom_level_changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- zoom_level_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[ZOOM_PARAMETERS_CHANGED] = g_signal_new
- ("zoom_parameters_changed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (NautilusViewFrameClass,
- zoom_parameters_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
diff --git a/src/nautilus-view-frame.h b/src/nautilus-view-frame.h
deleted file mode 100644
index de1d4bb26..000000000
--- a/src/nautilus-view-frame.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- * Nautilus
- *
- * Copyright (C) 1999, 2000 Red Hat, Inc.
- * Copyright (C) 1999, 2000, 2001 Eazel, Inc.
- *
- * Nautilus 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.
- *
- * Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Authors: Elliot Lee <sopwith@redhat.com>
- * Darin Adler <darin@bentspoon.com>
- *
- */
-
-/* nautilus-view-frame.h: Interface of the object representing a data
- * view. This is actually the widget for the view frame rather than
- * the view frame itself.
- */
-
-#ifndef NAUTILUS_VIEW_FRAME_H
-#define NAUTILUS_VIEW_FRAME_H
-
-#include <bonobo/bonobo-ui-container.h>
-#include <bonobo/bonobo-zoomable-frame.h>
-#include <gtk/gtkhbox.h>
-#include <libnautilus-private/nautilus-undo-manager.h>
-#include <libnautilus/nautilus-view-component.h>
-
-#define NAUTILUS_TYPE_VIEW_FRAME (nautilus_view_frame_get_type ())
-#define NAUTILUS_VIEW_FRAME(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_VIEW_FRAME, NautilusViewFrame))
-#define NAUTILUS_VIEW_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_VIEW_FRAME, NautilusViewFrameClass))
-#define NAUTILUS_IS_VIEW_FRAME(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_VIEW_FRAME))
-#define NAUTILUS_IS_VIEW_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_VIEW_FRAME))
-
-typedef struct NautilusViewFrameDetails NautilusViewFrameDetails;
-
-typedef struct {
- GtkHBox parent;
- NautilusViewFrameDetails *details;
-} NautilusViewFrame;
-
-typedef struct {
- GtkHBoxClass parent_spot;
-
- /* These roughly correspond to CORBA calls, but in some cases they are higher level. */
-
- /* This happens only just after load_view. */
- void (* view_loaded) (NautilusViewFrame *view);
-
- /* These can happen pretty much any time. */
- void (* load_underway) (NautilusViewFrame *view);
- void (* failed) (NautilusViewFrame *view);
-
- /* These will only happen after load_underway (guaranteed). */
- void (* open_location) (NautilusViewFrame *view,
- const char *location,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags,
- GList *selection); /* list of char * */
- void (* report_location_change) (NautilusViewFrame *view,
- const char *location,
- GList *selection, /* list of char * */
- const char *title);
- void (* report_redirect) (NautilusViewFrame *view,
- const char *from_location,
- const char *to_location,
- GList *selection, /* list of char * */
- const char *title);
- void (* change_selection) (NautilusViewFrame *view,
- GList *selection); /* list of char * */
- void (* change_status) (NautilusViewFrame *view,
- const char *status);
- void (* load_progress_changed) (NautilusViewFrame *view);
- void (* load_complete) (NautilusViewFrame *view);
- void (* title_changed) (NautilusViewFrame *view);
- void (* zoom_level_changed) (NautilusViewFrame *view);
- void (* zoom_parameters_changed) (NautilusViewFrame *view);
- Nautilus_History * (* get_history_list) (NautilusViewFrame *view);
- void (* go_back) (NautilusViewFrame *view);
- void (* close_window) (NautilusViewFrame *view);
- void (* show_hidden_files_mode_changed) (NautilusViewFrame *view);
-} NautilusViewFrameClass;
-
-/* basic view management */
-GType nautilus_view_frame_get_type (void);
-NautilusViewFrame *nautilus_view_frame_new (BonoboUIContainer *ui_container,
- NautilusUndoManager *undo_manager,
- Nautilus_WindowType window_type);
-Bonobo_Control nautilus_view_frame_get_control (NautilusViewFrame *view);
-
-/* connecting to a Nautilus:View */
-void nautilus_view_frame_load_view (NautilusViewFrame *view,
- const char *view_iid);
-void nautilus_view_frame_stop (NautilusViewFrame *view);
-
-/* calls to Nautilus:View functions */
-void nautilus_view_frame_load_location (NautilusViewFrame *view,
- const char *location);
-void nautilus_view_frame_selection_changed (NautilusViewFrame *view,
- GList *selection);
-void nautilus_view_frame_title_changed (NautilusViewFrame *view,
- const char *title);
-
-/* calls to Bonobo:Zoomable functions */
-float nautilus_view_frame_get_zoom_level (NautilusViewFrame *view);
-void nautilus_view_frame_set_zoom_level (NautilusViewFrame *view,
- float zoom_level);
-float nautilus_view_frame_get_min_zoom_level (NautilusViewFrame *view);
-float nautilus_view_frame_get_max_zoom_level (NautilusViewFrame *view);
-gboolean nautilus_view_frame_get_has_min_zoom_level (NautilusViewFrame *view);
-gboolean nautilus_view_frame_get_has_max_zoom_level (NautilusViewFrame *view);
-gboolean nautilus_view_frame_get_is_continuous (NautilusViewFrame *view);
-gboolean nautilus_view_frame_get_can_zoom_in (NautilusViewFrame *view);
-gboolean nautilus_view_frame_get_can_zoom_out (NautilusViewFrame *view);
-
-GList * nautilus_view_frame_get_preferred_zoom_levels (NautilusViewFrame *view);
-void nautilus_view_frame_zoom_in (NautilusViewFrame *view);
-void nautilus_view_frame_zoom_out (NautilusViewFrame *view);
-void nautilus_view_frame_zoom_to_fit (NautilusViewFrame *view);
-
-/* calls to Nautilus::ScrollPositionable */
-char * nautilus_view_frame_get_first_visible_file (NautilusViewFrame *view);
-void nautilus_view_frame_scroll_to_file (NautilusViewFrame *view,
- const char *uri);
-
-/* Other. */
-gboolean nautilus_view_frame_get_is_view_loaded (NautilusViewFrame *view);
-const char * nautilus_view_frame_get_view_iid (NautilusViewFrame *view);
-gboolean nautilus_view_frame_get_is_zoomable (NautilusViewFrame *view);
-Nautilus_ShowHiddenFilesMode nautilus_view_frame_get_show_hidden_files_mode (NautilusViewFrame *view);
-void nautilus_view_frame_set_show_hidden_files_mode (NautilusViewFrame *viev,
- Nautilus_ShowHiddenFilesMode mode,
- gboolean signal);
-char * nautilus_view_frame_get_title (NautilusViewFrame *view);
-char * nautilus_view_frame_get_label (NautilusViewFrame *view);
-void nautilus_view_frame_set_label (NautilusViewFrame *view,
- const char *label);
-
-#endif /* NAUTILUS_VIEW_FRAME_H */
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index c2257f4f6..a8419e34b 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -28,16 +28,12 @@
#include <config.h>
#include "nautilus-window-manage-views.h"
-#include "nautilus-applicable-views.h"
+#include "nautilus-actions.h"
#include "nautilus-application.h"
-#include "nautilus-information-panel.h"
#include "nautilus-location-bar.h"
#include "nautilus-main.h"
#include "nautilus-window-private.h"
#include "nautilus-zoom-control.h"
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-property-bag-client.h>
#include <eel/eel-accessibility.h>
#include <eel/eel-debug.h>
#include <eel/eel-gdk-extensions.h>
@@ -55,7 +51,6 @@
#include <libgnomevfs/gnome-vfs-async-ops.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
-#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-file.h>
@@ -63,9 +58,9 @@
#include <libnautilus-private/nautilus-metadata.h>
#include <libnautilus-private/nautilus-mime-actions.h>
#include <libnautilus-private/nautilus-monitor.h>
-#include <libnautilus-private/nautilus-search-uri.h>
#include <libnautilus-private/nautilus-theme.h>
-#include <libnautilus-private/nautilus-view-query.h>
+#include <libnautilus-private/nautilus-view-factory.h>
+#include <libnautilus-private/nautilus-window-info.h>
/* FIXME bugzilla.gnome.org 41243:
* We should use inheritance instead of these special cases
@@ -80,139 +75,43 @@
*/
#define MAX_URI_IN_DIALOG_LENGTH 60
-typedef struct {
- gboolean is_sidebar_panel;
- NautilusViewIdentifier *id;
-} ViewFrameInfo;
+static void connect_view (NautilusWindow *window,
+ NautilusView *view);
+static void disconnect_view (NautilusWindow *window,
+ NautilusView *view);
+static void begin_location_change (NautilusWindow *window,
+ const char *location,
+ GList *new_selection,
+ NautilusLocationChangeType type,
+ guint distance,
+ const char *scroll_pos);
+static void free_location_change (NautilusWindow *window);
+static void end_location_change (NautilusWindow *window);
+static void cancel_location_change (NautilusWindow *window);
+static void got_file_info_for_view_selection_callback (NautilusFile *file,
+ gpointer callback_data);
+static void create_content_view (NautilusWindow *window,
+ const char *view_id);
+static void display_view_selection_failure (NautilusWindow *window,
+ NautilusFile *file,
+ const char *location);
+static void load_new_location (NautilusWindow *window,
+ const char *location,
+ GList *selection,
+ gboolean tell_current_content_view,
+ gboolean tell_new_content_view);
+static void location_has_really_changed (NautilusWindow *window);
+static void update_for_new_location (NautilusWindow *window);
+static void zoom_parameters_changed_callback (NautilusView *view,
+ NautilusWindow *window);
-typedef struct {
- NautilusWindow *window;
- NautilusViewIdentifier *id;
-} ViewFrameWindowInfo;
-
-static void connect_view (NautilusWindow *window,
- NautilusViewFrame *view,
- gboolean content_view);
-static void disconnect_view (NautilusWindow *window,
- NautilusViewFrame *view);
-static void begin_location_change (NautilusWindow *window,
- const char *location,
- NautilusLocationChangeType type,
- guint distance,
- const char *scroll_pos);
-static void free_location_change (NautilusWindow *window);
-static void end_location_change (NautilusWindow *window);
-static void cancel_location_change (NautilusWindow *window);
-static void load_directory_metadata_callback (NautilusFile *file,
- gpointer callback_data);
-
-static void
-change_selection (NautilusWindow *window,
- GList *selection,
- NautilusViewFrame *requesting_view)
-{
- GList *sorted;
- GList *views;
- GList *node;
- NautilusViewFrame *view;
-
- /* Sort list into canonical order and check if it's the same as
- * the selection we already have.
- */
- sorted = eel_g_str_list_alphabetize (eel_g_str_list_copy (selection));
- if (eel_g_str_list_equal (sorted, window->details->selection)) {
- eel_g_list_free_deep (sorted);
- return;
- }
-
- /* Store the new selection. */
- eel_g_list_free_deep (window->details->selection);
- window->details->selection = sorted;
-
- /* Tell all the view frames about it, except the one that changed it.
- * Copy the list before traversing it, because during a failure in
- * selection_changed, list could be modified and bad things would
- * happen
- */
- views = g_list_copy (window->views);
- for (node = views; node != NULL; node = node->next) {
- view = NAUTILUS_VIEW_FRAME (node->data);
- if (view != requesting_view) {
- nautilus_view_frame_selection_changed (view, sorted);
- }
- }
- g_list_free (views);
-}
-
-/* update_title:
- *
- * Update the non-NautilusViewFrame objects that use the location's user-displayable
- * title in some way. Called when the location or title has changed.
- * @window: The NautilusWindow in question.
- * @title: The new user-displayable title.
- *
- */
-static void
-update_title (NautilusWindow *window)
-{
- GList *views;
- GList *node;
-
- nautilus_window_update_title (window);
-
- /* Copy the list before traversing it, because during a failure in
- * title_change, list could be modified and bad things would happen
- */
- views = g_list_copy (window->views);
- for (node = views; node != NULL; node = node->next) {
- nautilus_view_frame_title_changed (node->data,
- window->details->title);
- }
-
- g_list_free (views);
-}
-
-/* nautilus_window_update_icon:
- *
- * Update the non-NautilusViewFrame objects that use the location's user-displayable
- * icon in some way. Called when the location or icon-theme has changed.
- * @window: The NautilusWindow in question.
- *
- */
void
-nautilus_window_update_icon (NautilusWindow *window)
+nautilus_window_report_selection_changed (NautilusWindowInfo *window)
{
- GdkPixbuf *pixbuf;
- GtkIconTheme *icon_theme;
-
- pixbuf = NULL;
-
- /* Desktop window special icon */
- if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
- icon_theme = nautilus_icon_factory_get_icon_theme ();
- pixbuf = gtk_icon_theme_load_icon (icon_theme,
- "gnome-fs-desktop", 48,
- 0, NULL);
- g_object_unref(icon_theme);
-
- } else {
- pixbuf = nautilus_icon_factory_get_pixbuf_for_file (window->details->viewed_file,
- "open",
- NAUTILUS_ICON_SIZE_STANDARD);
- }
-
- if (pixbuf != NULL) {
- gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
- g_object_unref (pixbuf);
- }
+ g_signal_emit_by_name (window, "selection_changed");
}
/* set_displayed_location:
- *
- * Update the non-NautilusViewFrame objects that use the location's user-displayable
- * title in some way. Called when the location or title has changed.
- * @window: The NautilusWindow in question.
- * @title: The new user-displayable title.
*/
static void
set_displayed_location (NautilusWindow *window, const char *location)
@@ -234,10 +133,10 @@ set_displayed_location (NautilusWindow *window, const char *location)
g_object_unref (window->last_location_bookmark);
}
window->last_location_bookmark = window->current_location_bookmark;
- window->current_location_bookmark = location == NULL ? NULL
+ window->current_location_bookmark = (location == NULL) ? NULL
: nautilus_bookmark_new (location, location);
}
- update_title (window);
+ nautilus_window_update_title (window);
nautilus_window_update_icon (window);
}
@@ -466,26 +365,12 @@ viewed_file_changed_callback (NautilusFile *file,
g_free (new_location);
}
- update_title (window);
+ nautilus_window_update_title (window);
nautilus_window_update_icon (window);
}
}
static void
-cancel_viewed_file_changed_callback (NautilusWindow *window)
-{
- NautilusFile *file;
-
- file = window->details->viewed_file;
- if (file != NULL) {
- g_signal_handlers_disconnect_by_func (G_OBJECT (file),
- G_CALLBACK (viewed_file_changed_callback),
- window);
- nautilus_file_monitor_remove (file, &window->details->viewed_file);
- }
-}
-
-static void
update_history (NautilusWindow *window,
NautilusLocationChangeType type,
const char *new_location)
@@ -516,125 +401,18 @@ update_history (NautilusWindow *window,
g_return_if_fail (FALSE);
}
-/* Handle the changes for the NautilusWindow itself. */
static void
-update_for_new_location (NautilusWindow *window)
+cancel_viewed_file_changed_callback (NautilusWindow *window)
{
- char *new_location;
NautilusFile *file;
-
- new_location = window->details->pending_location;
- window->details->pending_location = NULL;
-
- update_history (window, window->details->location_change_type, new_location);
-
- /* Set the new location. */
- g_free (window->details->location);
- window->details->location = new_location;
-
- /* Create a NautilusFile for this location, so we can catch it
- * if it goes away.
- */
- cancel_viewed_file_changed_callback (window);
- file = nautilus_file_get (window->details->location);
- nautilus_window_set_viewed_file (window, file);
- window->details->viewed_file_seen = !nautilus_file_is_not_yet_confirmed (file);
- nautilus_file_monitor_add (file, &window->details->viewed_file, 0);
- g_signal_connect_object (file, "changed",
- G_CALLBACK (viewed_file_changed_callback), window, 0);
- nautilus_file_unref (file);
-
- /* Check if we can go up. */
- update_up_button (window);
-
- /* Set up the content view menu for this new location. */
- nautilus_window_load_view_as_menus (window);
-
- /* Load menus from nautilus extensions for this location */
- nautilus_window_load_extension_menus (window);
-
-#if !NEW_UI_COMPLETE
- if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
- /* Check if the back and forward buttons need enabling or disabling. */
- nautilus_navigation_window_allow_back (NAUTILUS_NAVIGATION_WINDOW (window), NAUTILUS_NAVIGATION_WINDOW (window)->back_list != NULL);
- nautilus_navigation_window_allow_forward (NAUTILUS_NAVIGATION_WINDOW (window), NAUTILUS_NAVIGATION_WINDOW (window)->forward_list != NULL);
- /* Change the location bar to match the current location. */
- nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->navigation_bar),
- window->details->location);
-
- nautilus_navigation_window_load_extension_toolbar_items (NAUTILUS_NAVIGATION_WINDOW (window));
- }
-
- /* Notify the information panel of the location change. */
- /* FIXME bugzilla.gnome.org 40211:
- * Eventually, this will not be necessary when we restructure the
- * sidebar itself to be a NautilusViewFrame.
- */
- if (NAUTILUS_IS_NAVIGATION_WINDOW (window)
- && NAUTILUS_NAVIGATION_WINDOW (window)->information_panel) {
- nautilus_information_panel_set_uri (NAUTILUS_NAVIGATION_WINDOW (window)->information_panel,
- window->details->location,
- window->details->title);
- }
-
- if (NAUTILUS_IS_SPATIAL_WINDOW (window)) {
- /* Change the location button to match the current location. */
- nautilus_spatial_window_set_location_button
- (NAUTILUS_SPATIAL_WINDOW (window),
- window->details->location);
- }
-#endif
-}
-
-static gboolean
-unref_callback (gpointer callback_data)
-{
- g_object_unref (callback_data);
- return FALSE;
-}
-
-static void
-ref_now_unref_at_idle_time (GObject *object)
-{
- g_object_ref (object);
- g_idle_add (unref_callback, object);
-}
-
-/* This is called when we have decided we can actually change to the new view/location situation. */
-static void
-location_has_really_changed (NautilusWindow *window)
-{
- /* Switch to the new content view. */
- if (GTK_WIDGET (window->new_content_view)->parent == NULL) {
- /* If we don't unref the old view until idle
- * time, we avoid certain kinds of problems in
- * in-process components, since they won't
- * lose their ViewFrame in the middle of some
- * operation. This still doesn't necessarily
- * help for out of process components.
- */
- if (window->content_view != NULL) {
- ref_now_unref_at_idle_time (G_OBJECT (window->content_view));
- }
-
- disconnect_view (window, window->content_view);
- nautilus_window_set_content_view_widget (window, window->new_content_view);
- }
- g_object_unref (window->new_content_view);
- window->new_content_view = NULL;
-
- if (window->details->pending_location != NULL) {
- /* Tell the window we are finished. */
- update_for_new_location (window);
+ file = window->details->viewed_file;
+ if (file != NULL) {
+ g_signal_handlers_disconnect_by_func (G_OBJECT (file),
+ G_CALLBACK (viewed_file_changed_callback),
+ window);
+ nautilus_file_monitor_remove (file, &window->details->viewed_file);
}
-
- free_location_change (window);
-
- update_title (window);
- nautilus_window_update_icon (window);
-
- gtk_widget_show (GTK_WIDGET (window));
}
static void
@@ -653,12 +431,12 @@ new_window_show_callback (GtkWidget *widget,
}
-static void
-open_location (NautilusWindow *window,
- const char *location,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags,
- GList *new_selection)
+void
+nautilus_window_open_location_full (NautilusWindow *window,
+ const char *location,
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags,
+ GList *new_selection)
{
NautilusWindow *target_window;
gboolean do_load_location = TRUE;
@@ -666,7 +444,7 @@ open_location (NautilusWindow *window,
target_window = NULL;
switch (mode) {
- case Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE :
+ case NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE :
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
target_window = window;
if (NAUTILUS_IS_SPATIAL_WINDOW (window)) {
@@ -695,14 +473,14 @@ open_location (NautilusWindow *window,
target_window = window;
}
break;
- case Nautilus_ViewFrame_OPEN_IN_SPATIAL :
+ case NAUTILUS_WINDOW_OPEN_IN_SPATIAL :
target_window = nautilus_application_present_spatial_window (
window->application,
window,
location,
gtk_window_get_screen (GTK_WINDOW (window)));
break;
- case Nautilus_ViewFrame_OPEN_IN_NAVIGATION :
+ case NAUTILUS_WINDOW_OPEN_IN_NAVIGATION :
target_window = nautilus_application_create_navigation_window
(window->application,
gtk_window_get_screen (GTK_WINDOW (window)));
@@ -714,7 +492,7 @@ open_location (NautilusWindow *window,
g_assert (target_window != NULL);
- if ((flags & Nautilus_ViewFrame_OPEN_FLAG_CLOSE_BEHIND) != 0) {
+ if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0) {
if (NAUTILUS_IS_SPATIAL_WINDOW (window) && !NAUTILUS_IS_DESKTOP_WINDOW (window)) {
if (GTK_WIDGET_VISIBLE (target_window)) {
nautilus_window_close (window);
@@ -732,14 +510,11 @@ open_location (NautilusWindow *window,
return;
}
- eel_g_list_free_deep (target_window->details->pending_selection);
- target_window->details->pending_selection = eel_g_str_list_copy (new_selection);
-
if (!eel_is_valid_uri (location))
g_warning ("Possibly invalid new URI '%s'\n"
"This can cause subtle evils like #48423", location);
- begin_location_change (target_window, location,
+ begin_location_change (target_window, location, new_selection,
NAUTILUS_LOCATION_CHANGE_STANDARD, 0, NULL);
}
@@ -748,16 +523,16 @@ nautilus_window_open_location (NautilusWindow *window,
const char *location,
gboolean close_behind)
{
- Nautilus_ViewFrame_OpenFlags flags;
+ NautilusWindowOpenFlags flags;
flags = 0;
if (close_behind) {
- flags = Nautilus_ViewFrame_OPEN_FLAG_CLOSE_BEHIND;
+ flags = NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND;
}
- open_location (window, location,
- Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE,
- flags, NULL);
+ nautilus_window_open_location_full (window, location,
+ NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
+ flags, NULL);
}
void
@@ -766,80 +541,36 @@ nautilus_window_open_location_with_selection (NautilusWindow *window,
GList *selection,
gboolean close_behind)
{
- Nautilus_ViewFrame_OpenFlags flags;
+ NautilusWindowOpenFlags flags;
flags = 0;
if (close_behind) {
- flags = Nautilus_ViewFrame_OPEN_FLAG_CLOSE_BEHIND;
+ flags = NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND;
}
- open_location (window, location,
- Nautilus_ViewFrame_OPEN_ACCORDING_TO_MODE,
- flags, selection);
+ nautilus_window_open_location_full (window, location,
+ NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
+ flags, selection);
}
-
-static ViewFrameInfo *
-view_frame_info_new (const NautilusViewIdentifier *id)
-{
- ViewFrameInfo *new_info;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- new_info = g_new (ViewFrameInfo, 1);
- new_info->id = nautilus_view_identifier_copy (id);
-
- return new_info;
-}
-
-static void
-view_frame_info_free (ViewFrameInfo *info)
-{
- if (info != NULL) {
- nautilus_view_identifier_free (info->id);
- g_free (info);
- }
-}
-
-static void
-set_view_frame_info (NautilusViewFrame *view_frame,
- const NautilusViewIdentifier *id)
-{
- g_object_set_data_full (G_OBJECT (view_frame),
- "info",
- view_frame_info_new (id),
- (GtkDestroyNotify) view_frame_info_free);
-}
-
char *
-nautilus_window_get_view_frame_label (NautilusViewFrame *view_frame)
+nautilus_window_get_view_label (NautilusWindow *window)
{
- ViewFrameInfo *info;
+ const NautilusViewInfo *info;
- info = (ViewFrameInfo *) g_object_get_data
- (G_OBJECT (view_frame), "info");
- return g_strdup (info->id->name);
-}
-
-
-static NautilusViewIdentifier *
-view_frame_get_id (NautilusViewFrame *view_frame)
-{
- ViewFrameInfo *info;
+ info = nautilus_view_factory_lookup (nautilus_window_get_content_view_id (window));
- info = (ViewFrameInfo *) g_object_get_data
- (G_OBJECT (view_frame), "info");
- return nautilus_view_identifier_copy (info->id);
+ return g_strdup (info->label);
}
static void
report_content_view_failure_to_user_internal (NautilusWindow *window,
- NautilusViewFrame *view_frame,
+ NautilusView *view,
const char *message,
const char *detail)
{
char *label;
- label = nautilus_window_get_view_frame_label (view_frame);
+ label = nautilus_window_get_view_label (window);
message = g_strdup_printf (message, label);
eel_show_error_dialog (message, detail, _("View Failed"), GTK_WINDOW (window));
g_free (label);
@@ -847,108 +578,34 @@ report_content_view_failure_to_user_internal (NautilusWindow *window,
static void
report_current_content_view_failure_to_user (NautilusWindow *window,
- NautilusViewFrame *view_frame)
+ NautilusView *view)
{
report_content_view_failure_to_user_internal
(window,
- view_frame,
+ view,
_("The %s view encountered an error and can't continue."),
_("You can choose another view or go to a different location."));
}
static void
report_nascent_content_view_failure_to_user (NautilusWindow *window,
- NautilusViewFrame *view_frame)
+ NautilusView *view)
{
report_content_view_failure_to_user_internal
(window,
- view_frame,
+ view,
_("The %s view encountered an error while starting up."),
_("The location cannot be displayed with this viewer."));
}
-static void
-load_new_location_in_one_view (NautilusViewFrame *view,
- const char *new_location,
- GList *new_selection)
-{
- nautilus_view_frame_load_location (view, new_location);
- nautilus_view_frame_selection_changed (view, new_selection);
-}
-
-static void
-load_new_location_in_all_views (NautilusWindow *window,
- const char *location,
- GList *selection,
- NautilusViewFrame *view_to_skip)
-{
- GList *views;
- GList *l;
- NautilusViewFrame *view;
-
- g_assert (NAUTILUS_IS_WINDOW (window));
- g_assert (location != NULL);
-
- set_displayed_location (window, location);
-
- if (window->new_content_view != view_to_skip
- && window->new_content_view != NULL) {
- load_new_location_in_one_view (window->new_content_view,
- location,
- selection);
- }
-
- /* Copy the list before traversing it, because during a failure in
- * load_new..., list could be modified and bad things would happen
- * also reference each object in case of re-enterency eg. window close.
- */
- views = NULL;
- for (l = window->views; l; l = l->next) {
- if (l->data != view_to_skip &&
- l->data != window->content_view &&
- l->data != window->new_content_view) {
- views = g_list_prepend (views, g_object_ref (l->data));
- }
- }
-
- for (l = views; l != NULL; l = l->next) {
- view = l->data;
- load_new_location_in_one_view (view, location, selection);
- }
-
- for (l = views; l; l = l->next) {
- g_object_unref (l->data);
- }
-
- g_list_free (views);
-}
-static void
-set_to_pending_location_and_selection (NautilusWindow *window)
-{
- g_assert (window->new_content_view != NULL);
-
- if (window->details->pending_location == NULL) {
- g_assert (window->details->pending_selection == NULL);
- return;
- }
-
- load_new_location_in_all_views (window,
- window->details->pending_location,
- window->details->pending_selection,
- NULL);
-
- eel_g_list_free_deep (window->details->pending_selection);
- window->details->pending_selection = NULL;
-}
-
-NautilusViewIdentifier *
+const char *
nautilus_window_get_content_view_id (NautilusWindow *window)
{
if (window->content_view == NULL) {
return NULL;
}
- return view_frame_get_id (window->content_view);
+ return nautilus_view_get_view_id (window->content_view);
}
gboolean
@@ -958,292 +615,168 @@ nautilus_window_content_view_matches_iid (NautilusWindow *window,
if (window->content_view == NULL) {
return FALSE;
}
- return eel_strcmp (nautilus_view_frame_get_view_iid (window->content_view),
+ return eel_strcmp (nautilus_view_get_view_id (window->content_view),
iid) == 0;
}
-static void
-load_content_view (NautilusWindow *window,
- const NautilusViewIdentifier *id)
-{
- const char *iid;
- NautilusViewFrame *view;
-
- /* FIXME bugzilla.gnome.org 41243:
- * We should use inheritance instead of these special cases
- * for the desktop window.
- */
- if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
- /* We force the desktop to use a desktop_icon_view. It's simpler
- * to fix it here than trying to make it pick the right view in
- * the first place.
- */
- iid = NAUTILUS_DESKTOP_ICON_VIEW_IID;
- } else {
- g_return_if_fail (id != NULL);
- iid = id->iid;
- }
-
- nautilus_window_ui_freeze (window);
-
- bonobo_ui_component_freeze (window->details->shell_ui, NULL);
- nautilus_bonobo_set_sensitive (window->details->shell_ui,
- NAUTILUS_COMMAND_ZOOM_IN,
- FALSE);
- nautilus_bonobo_set_sensitive (window->details->shell_ui,
- NAUTILUS_COMMAND_ZOOM_OUT,
- FALSE);
- nautilus_bonobo_set_sensitive (window->details->shell_ui,
- NAUTILUS_COMMAND_ZOOM_NORMAL,
- FALSE);
-
- bonobo_ui_component_thaw (window->details->shell_ui, NULL);
-
- if (nautilus_window_content_view_matches_iid (window, iid)) {
- /* reuse existing content view */
- view = window->content_view;
- window->new_content_view = view;
- g_object_ref (view);
- set_to_pending_location_and_selection (window);
- } else {
- /* create a new content view */
- view = nautilus_view_frame_new (window->details->ui_container,
- window->application->undo_manager,
- NAUTILUS_WINDOW_GET_CLASS (window)->window_type);
- eel_accessibility_set_name (view, _("Content View"));
- eel_accessibility_set_description (view, _("View of the current file or folder"));
-
- window->new_content_view = view;
- g_object_ref (view);
- gtk_object_sink (GTK_OBJECT (view));
- set_view_frame_info (view, id);
- nautilus_view_frame_set_show_hidden_files_mode (view, NAUTILUS_WINDOW (window)->details->show_hidden_files_mode, FALSE);
- connect_view (window, view, TRUE);
- nautilus_view_frame_load_view (view, iid);
- }
-
- nautilus_window_ui_thaw (window);
-}
-
-static void
-handle_view_failure (NautilusWindow *window,
- NautilusViewFrame *view)
+static gboolean
+another_navigation_window_already_showing (NautilusWindow *the_window)
{
- gboolean do_close_window;
- char *fallback_load_location;
- g_warning ("A view failed. The UI will handle this with a dialog but this should be debugged.");
-
-
- do_close_window = FALSE;
- fallback_load_location = NULL;
+ GList *list, *item;
- if (view == window->content_view) {
- disconnect_view(window, window->content_view);
- nautilus_window_set_content_view_widget (window, NULL);
-
- /* FIXME bugzilla.gnome.org 45039: We need a
- * way to report the specific error that
- * happens in this case - adapter factory not
- * found, component failed to load, etc.
- */
- report_current_content_view_failure_to_user (window, view);
- } else {
- /* Only report error on first try */
- if (window->details->location_change_type != NAUTILUS_LOCATION_CHANGE_FALLBACK) {
- /* FIXME bugzilla.gnome.org 45039: We need a
- * way to report the specific error that
- * happens in this case - adapter factory not
- * found, component failed to load, etc.
- */
- report_nascent_content_view_failure_to_user (window, view);
-
- fallback_load_location = g_strdup (window->details->pending_location);
- } else {
- if (!GTK_WIDGET_VISIBLE (window)) {
- do_close_window = TRUE;
- }
+ list = nautilus_application_get_window_list ();
+ for (item = list; item != NULL; item = item->next) {
+ if (item->data != the_window &&
+ NAUTILUS_IS_NAVIGATION_WINDOW (item->data)) {
+ return TRUE;
}
- }
-
- cancel_location_change (window);
-
- if (fallback_load_location != NULL) {
- begin_location_change (window, fallback_load_location,
- NAUTILUS_LOCATION_CHANGE_FALLBACK, 0, NULL);
- g_free (fallback_load_location);
}
+
+ return FALSE;
+}
- if (do_close_window) {
- NautilusFile *file;
-
- if (window->details->pending_file_for_position != NULL) {
- file = window->details->pending_file_for_position;
- window->details->pending_file_for_position = NULL;
-
- nautilus_file_cancel_call_when_ready (file,
- load_directory_metadata_callback,
- window);
- nautilus_file_unref (file);
- }
-
- gtk_widget_destroy (GTK_WIDGET (window));
- }
+/* utility routine that returns true if there's one or fewer windows in the window list */
+static gboolean
+just_one_window (void)
+{
+ return !eel_g_list_more_than_one_item
+ (nautilus_application_get_window_list ());
}
+
+/*
+ * begin_location_change
+ *
+ * Change a window's location.
+ * @window: The NautilusWindow whose location should be changed.
+ * @location: A url specifying the location to load
+ * @new_selection: The initial selection to present after loading the location
+ * @type: Which type of location change is this? Standard, back, forward, or reload?
+ * @distance: If type is back or forward, the index into the back or forward chain. If
+ * type is standard or reload, this is ignored, and must be 0.
+ * @scroll_pos: The file to scroll to when the location is loaded.
+ *
+ * This is the core function for changing the location of a window. Every change to the
+ * location begins here.
+ */
static void
-free_location_change (NautilusWindow *window)
+begin_location_change (NautilusWindow *window,
+ const char *location,
+ GList *new_selection,
+ NautilusLocationChangeType type,
+ guint distance,
+ const char *scroll_pos)
{
- g_free (window->details->pending_location);
- window->details->pending_location = NULL;
+ NautilusDirectory *directory;
+ NautilusFile *file;
+ gboolean force_reload;
+ char *current_pos;
- /* Don't free pending_scroll_to, since thats needed until
- * the load_complete callback.
- */
+ g_assert (NAUTILUS_IS_WINDOW (window));
+ g_assert (location != NULL);
+ g_assert (type == NAUTILUS_LOCATION_CHANGE_BACK
+ || type == NAUTILUS_LOCATION_CHANGE_FORWARD
+ || distance == 0);
- if (window->details->determine_view_handle != NULL) {
- nautilus_determine_initial_view_cancel (window->details->determine_view_handle);
- window->details->determine_view_handle = NULL;
- }
+ g_object_ref (window);
- if (window->new_content_view != NULL) {
- if (window->new_content_view != window->content_view) {
- disconnect_view (window, window->new_content_view);
- gtk_widget_destroy (GTK_WIDGET (window->new_content_view));
- }
- g_object_unref (window->new_content_view);
- window->new_content_view = NULL;
- }
-}
+ end_location_change (window);
+
+ nautilus_window_allow_stop (window, TRUE);
+ nautilus_window_set_status (window, " ");
-static void
-end_location_change (NautilusWindow *window)
-{
- nautilus_window_allow_stop (window, FALSE);
+ g_assert (window->details->pending_location == NULL);
+ g_assert (window->details->pending_selection == NULL);
+
+ window->details->pending_location = g_strdup (location);
+ window->details->location_change_type = type;
+ window->details->location_change_distance = distance;
+ window->details->pending_selection = eel_g_str_list_copy (new_selection);
- /* Now we can free pending_scroll_to, since the load_complete
- * callback already has been emitted.
- */
- g_free (window->details->pending_scroll_to);
- window->details->pending_scroll_to = NULL;
+
+ window->details->pending_scroll_to = g_strdup (scroll_pos);
+
+ directory = nautilus_directory_get (location);
- free_location_change (window);
-}
+ /* The code to force a reload is here because if we do it
+ * after determining an initial view (in the components), then
+ * we end up fetching things twice.
+ */
+ if (type == NAUTILUS_LOCATION_CHANGE_RELOAD) {
+ force_reload = TRUE;
+ } else if (!nautilus_monitor_active ()) {
+ force_reload = TRUE;
+ } else {
+ force_reload = !nautilus_directory_is_local (directory);
+ }
-static void
-cancel_location_change (NautilusWindow *window)
-{
- if (window->details->pending_location != NULL
- && window->details->location != NULL
- && window->content_view != NULL
- && nautilus_view_frame_get_is_view_loaded (window->content_view)) {
+ if (force_reload) {
+ nautilus_directory_force_reload (directory);
+ file = nautilus_directory_get_corresponding_file (directory);
+ nautilus_file_invalidate_all_attributes (file);
+ nautilus_file_unref (file);
+ }
- /* No need to tell the new view - either it is the
- * same as the old view, in which case it will already
- * be told, or it is the very pending change we wish
- * to cancel.
- */
+ nautilus_directory_unref (directory);
- load_new_location_in_all_views (window,
- window->details->location,
- window->details->selection,
- window->new_content_view);
+ /* Set current_bookmark scroll pos */
+ if (window->current_location_bookmark != NULL &&
+ window->content_view != NULL) {
+ current_pos = nautilus_view_get_first_visible_file (window->content_view);
+ nautilus_bookmark_set_scroll_pos (window->current_location_bookmark, current_pos);
+ g_free (current_pos);
}
- end_location_change (window);
-}
-
-static gboolean
-pending_location_already_showing (NautilusWindow *window)
-{
- char *temp;
- char *location;
- GList *list, *item;
+ /* Get the info needed for view selection */
- temp = window->details->pending_location;
- list = nautilus_application_get_window_list ();
- for (item = list; item != NULL; item = item->next) {
- location = nautilus_window_get_location (NAUTILUS_WINDOW (item->data));
+ window->details->determine_view_file = nautilus_file_get (location);
- if (!NAUTILUS_IS_DESKTOP_WINDOW (item->data)
- && location != NULL
- && item->data != window
- && !strcmp (temp, location)) {
- g_free (location);
- return TRUE;
- }
-
- g_free (location);
- }
+ g_assert (window->details->determine_view_file != NULL);
- return FALSE;
-}
+ nautilus_file_call_when_ready (window->details->determine_view_file,
+ NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY |
+ NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE |
+ NAUTILUS_FILE_ATTRIBUTE_METADATA,
+ got_file_info_for_view_selection_callback,
+ window);
-static gboolean
-another_navigation_window_already_showing (NautilusWindow *the_window)
-{
- GList *list, *item;
-
- list = nautilus_application_get_window_list ();
- for (item = list; item != NULL; item = item->next) {
- if (item->data != the_window &&
- NAUTILUS_IS_NAVIGATION_WINDOW (item->data)) {
- return TRUE;
- }
- }
-
- return FALSE;
+ g_object_unref (window);
}
-
static void
-load_directory_metadata_callback (NautilusFile *file,
- gpointer callback_data)
+setup_new_window (NautilusWindow *window, NautilusFile *file)
{
- NautilusWindow *window;
+ char *show_hidden_file_setting;
char *geometry_string;
char *scroll_string;
- char *show_hidden_file_setting;
- ViewFrameWindowInfo *new_info;
- NautilusViewIdentifier *initial_view;
-
- new_info = callback_data;
- window = NAUTILUS_WINDOW (new_info->window);
- initial_view = new_info->id;
- g_assert (window->details->pending_file_for_position == file);
-#if !NEW_UI_COMPLETE
- if (NAUTILUS_IS_SPATIAL_WINDOW (window) && !NAUTILUS_IS_DESKTOP_WINDOW (window)) {
-
+ if (NAUTILUS_IS_SPATIAL_WINDOW (window) && !NAUTILUS_IS_DESKTOP_WINDOW (window)) {
/* load show hidden state */
show_hidden_file_setting = nautilus_file_get_metadata
(file, NAUTILUS_METADATA_KEY_WINDOW_SHOW_HIDDEN_FILES,
- NULL);
+ NULL);
if (show_hidden_file_setting != NULL) {
if (strcmp (show_hidden_file_setting, "1") == 0) {
- NAUTILUS_WINDOW (window)->details->show_hidden_files_mode = Nautilus_SHOW_HIDDEN_FILES_ENABLE;
+ NAUTILUS_WINDOW (window)->details->show_hidden_files_mode = NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_ENABLE;
} else {
- NAUTILUS_WINDOW (window)->details->show_hidden_files_mode = Nautilus_SHOW_HIDDEN_FILES_DISABLE;
+ NAUTILUS_WINDOW (window)->details->show_hidden_files_mode = NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DISABLE;
}
} else {
- NAUTILUS_WINDOW (window)->details->show_hidden_files_mode = Nautilus_SHOW_HIDDEN_FILES_DEFAULT;
+ NAUTILUS_WINDOW (window)->details->show_hidden_files_mode = NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT;
}
g_free (show_hidden_file_setting);
-
+
/* load the saved window geometry */
geometry_string = nautilus_file_get_metadata
(file, NAUTILUS_METADATA_KEY_WINDOW_GEOMETRY, NULL);
if (geometry_string != NULL) {
- /* Ignore saved window position if a window with the same
- * location is already showing. That way the two windows
- * wont appear at the exact same location on the screen.
- */
eel_gtk_window_set_initial_geometry_from_string
(GTK_WINDOW (window),
geometry_string,
NAUTILUS_SPATIAL_WINDOW_MIN_WIDTH,
NAUTILUS_SPATIAL_WINDOW_MIN_HEIGHT,
- pending_location_already_showing (window));
+ FALSE);
}
g_free (geometry_string);
@@ -1263,7 +796,7 @@ load_directory_metadata_callback (NautilusFile *file,
window->details->pending_scroll_to = scroll_string;
}
}
-#endif
+
if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
geometry_string = eel_preferences_get
(NAUTILUS_PREFERENCES_NAVIGATION_WINDOW_SAVED_GEOMETRY);
@@ -1282,851 +815,800 @@ load_directory_metadata_callback (NautilusFile *file,
}
g_free (geometry_string);
}
+}
+
+static void
+got_file_info_for_view_selection_callback (NautilusFile *file,
+ gpointer callback_data)
+{
+ GnomeVFSResult vfs_result_code;
+ char *view_id;
+ char *mimetype;
+ NautilusWindow *window;
+ char *location;
+ char *home_uri;
+ window = callback_data;
- /* finish loading the view */
- load_content_view (window, initial_view);
+ g_assert (window->details->determine_view_file == file);
+ window->details->determine_view_file = NULL;
- nautilus_view_identifier_free (initial_view);
- g_free (new_info);
+ location = window->details->pending_location;
- /* This object was ref'd when starting the callback. */
- nautilus_file_unref (file);
- window->details->pending_file_for_position = NULL;
-}
+ view_id = NULL;
+
+ vfs_result_code = nautilus_file_get_file_info_result (file);
+ if (vfs_result_code == GNOME_VFS_OK
+ || vfs_result_code == GNOME_VFS_ERROR_NOT_SUPPORTED
+ || vfs_result_code == GNOME_VFS_ERROR_INVALID_URI) {
+ /* We got the information we need, now pick what view to use: */
-/* utility routine that returns true if there's one or fewer windows in the window list */
-static gboolean
-just_one_window (void)
-{
- return !eel_g_list_more_than_one_item
- (nautilus_application_get_window_list ());
-}
+ mimetype = nautilus_file_get_mime_type (file);
-static void
-determined_initial_view_callback (NautilusDetermineViewHandle *handle,
- NautilusDetermineViewResult result_code,
- const NautilusViewIdentifier *initial_view,
- gpointer data)
-{
- NautilusWindow *window;
- NautilusFile *file;
- char *full_uri_for_display;
- char *uri_for_display;
- char *error_message;
- char *detail_message;
- char *scheme_string;
- char *type_string;
- char *dialog_title;
- char *home_uri;
- const char *host_name;
- const char *location;
- GtkDialog *dialog;
- NautilusFileAttributes attributes;
- GnomeVFSURI *vfs_uri;
- ViewFrameWindowInfo *new_info;
-
- window = NAUTILUS_WINDOW (data);
+ /* If fallback, don't use view from metadata */
+ if (window->details->location_change_type != NAUTILUS_LOCATION_CHANGE_FALLBACK) {
+ /* Look in metadata for view */
+ view_id = nautilus_file_get_metadata
+ (file, NAUTILUS_METADATA_KEY_DEFAULT_COMPONENT, NULL);
+ if (view_id != NULL &&
+ !nautilus_view_factory_view_supports_uri (view_id,
+ location,
+ nautilus_file_get_file_type (file),
+ mimetype)) {
+ g_free (view_id);
+ view_id = NULL;
+ }
+ }
- g_assert (window->details->determine_view_handle == handle
- || window->details->determine_view_handle == NULL);
- window->details->determine_view_handle = NULL;
+ /* Otherwise, use default */
+ if (view_id == NULL) {
+ view_id = nautilus_global_preferences_get_default_folder_viewer_preference_as_iid ();
+
+ if (view_id != NULL &&
+ !nautilus_view_factory_view_supports_uri (view_id,
+ location,
+ nautilus_file_get_file_type (file),
+ mimetype)) {
+ g_free (view_id);
+ view_id = NULL;
+ }
+ }
+
+ g_free (mimetype);
+ }
- location = window->details->pending_location;
+ if (view_id != NULL) {
+ if (!GTK_WIDGET_VISIBLE (window)) {
+ /* We now have the metadata to set up the window position, etc */
+ setup_new_window (window, file);
+ }
+ create_content_view (window, view_id);
+ g_free (view_id);
+ } else {
+ display_view_selection_failure (window, file,
+ location);
- if (result_code == NAUTILUS_DETERMINE_VIEW_OK) {
- /* If the window is not yet showing (as is the case for nascent
- * windows), position and show it only after we've got the
- * metadata (since position info is stored there).
- */
- if (!GTK_WIDGET_VISIBLE (window)) {
- file = nautilus_file_get (location);
- window->details->pending_file_for_position = file;
- new_info = g_new (ViewFrameWindowInfo, 1);
- new_info->window = window;
- new_info->id = nautilus_view_identifier_copy (initial_view);
- attributes = NAUTILUS_FILE_ATTRIBUTE_METADATA;
- nautilus_file_call_when_ready (file,
- attributes,
- load_directory_metadata_callback,
- new_info);
+ if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (window))) {
+ /* Destroy never-had-a-chance-to-be-seen window. This case
+ * happens when a new window cannot display its initial URI.
+ */
+ /* if this is the only window, we don't want to quit, so we redirect it to home */
+ if (just_one_window ()) {
+ /* Make sure we re-use this window */
+ if (NAUTILUS_IS_SPATIAL_WINDOW (window)) {
+ NAUTILUS_SPATIAL_WINDOW (window)->affect_spatial_window_on_next_location_change = TRUE;
+ }
+ /* the user could have typed in a home directory that doesn't exist,
+ in which case going home would cause an infinite loop, so we
+ better test for that */
+
+ if (!eel_uris_match (location, "file:///")) {
+ home_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
+ if (!eel_uris_match (home_uri, location)) {
+ nautilus_window_go_home (NAUTILUS_WINDOW (window));
+ } else {
+ /* the last fallback is to go to a known place that can't be deleted! */
+ nautilus_window_go_to (NAUTILUS_WINDOW (window), "file:///");
+ }
+ g_free (home_uri);
+ } else {
+ gtk_object_destroy (GTK_OBJECT (window));
+ }
+ } else {
+ /* Since this is a window, destroying it will also unref it. */
+ gtk_object_destroy (GTK_OBJECT (window));
+ }
} else {
- load_content_view (window, initial_view);
+ /* Clean up state of already-showing window */
+ end_location_change (window);
+
+ /* Leave the location bar showing the bad location that the user
+ * typed (or maybe achieved by dragging or something). Many times
+ * the mistake will just be an easily-correctable typo. The user
+ * can choose "Refresh" to get the original URI back in the location bar.
+ */
}
+ }
+
+ nautilus_file_unref (file);
+}
- return;
- }
-
- /* Some sort of failure occurred. How 'bout we tell the user? */
- full_uri_for_display = eel_format_uri_for_display (location);
- /* Truncate the URI so it doesn't get insanely wide. Note that even
- * though the dialog uses wrapped text, if the URI doesn't contain
- * white space then the text-wrapping code is too stupid to wrap it.
- */
- uri_for_display = eel_str_middle_truncate
- (full_uri_for_display, MAX_URI_IN_DIALOG_LENGTH);
- g_free (full_uri_for_display);
+/* Load a view into the window, either reusing the old one or creating
+ * a new one. This happens when you want to load a new location, or just
+ * switch to a different view.
+ * If pending_location is set we're loading a new location and
+ * pending_location/selection will be used. If not, we're just switching
+ * view, and the current location will be used.
+ */
+static void
+create_content_view (NautilusWindow *window,
+ const char *view_id)
+{
+ NautilusView *view;
+ GList *selection;
+ GtkAction *action;
- dialog_title = NULL;
+ /* FIXME bugzilla.gnome.org 41243:
+ * We should use inheritance instead of these special cases
+ * for the desktop window.
+ */
+ if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
+ /* We force the desktop to use a desktop_icon_view. It's simpler
+ * to fix it here than trying to make it pick the right view in
+ * the first place.
+ */
+ view_id = NAUTILUS_DESKTOP_ICON_VIEW_IID;
+ }
+
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_ZOOM_IN);
+ gtk_action_set_sensitive (action, FALSE);
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_ZOOM_OUT);
+ gtk_action_set_sensitive (action, FALSE);
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_ZOOM_NORMAL);
+ gtk_action_set_sensitive (action, FALSE);
- switch (result_code) {
-
- case NAUTILUS_DETERMINE_VIEW_NOT_FOUND:
- error_message = g_strdup_printf
- (_("Couldn't find \"%s\"."),
- uri_for_display);
- detail_message = g_strdup
- (_("Please check the spelling and try again."));
- break;
-
- case NAUTILUS_DETERMINE_VIEW_INVALID_URI:
- error_message = g_strdup_printf
- (_("\"%s\" is not a valid location."),
- uri_for_display);
- detail_message = g_strdup
- (_("Please check the spelling and try again."));
- break;
-
- case NAUTILUS_DETERMINE_VIEW_NO_HANDLER_FOR_TYPE:
- /* FIXME bugzilla.gnome.org 40866: Can't expect to read the
- * permissions instantly here. We might need to wait for
- * a stat first.
- */
- file = nautilus_file_get (location);
- type_string = nautilus_file_get_string_attribute (file, "type");
- nautilus_file_unref (file);
- if (type_string == NULL) {
- error_message = g_strdup_printf
- (_("Couldn't display \"%s\"."),
- uri_for_display);
- detail_message = g_strdup
- (_("Nautilus cannot determine what type of file it is."));
- } else {
- /* FIXME bugzilla.gnome.org 44932:
- * Should distinguish URIs with no handlers at all from remote URIs
- * with local-only handlers.
- */
- error_message = g_strdup_printf
- (_("Couldn't display \"%s\"."),
- uri_for_display);
- detail_message = g_strdup
- (_("Nautilus has no installed viewer capable of displaying the file."));
- g_free (type_string);
- }
- break;
+ if (window->content_view != NULL &&
+ eel_strcmp (nautilus_view_get_view_id (window->content_view),
+ view_id) == 0) {
+ /* reuse existing content view */
+ view = window->content_view;
+ window->new_content_view = view;
+ g_object_ref (view);
+ } else {
+ /* create a new content view */
+ view = nautilus_view_factory_create (view_id,
+ NAUTILUS_WINDOW_INFO (window));
- case NAUTILUS_DETERMINE_VIEW_UNSUPPORTED_SCHEME:
- /* Can't create a vfs_uri and get the method from that, because
- * gnome_vfs_uri_new might return NULL.
- */
- scheme_string = eel_str_get_prefix (location, ":");
- g_assert (scheme_string != NULL); /* Shouldn't have gotten this error unless there's a : separator. */
- error_message = g_strdup_printf (_("Couldn't display \"%s\"."),
- uri_for_display);
- detail_message = g_strdup_printf (_("Nautilus cannot handle %s: locations."),
- scheme_string);
- g_free (scheme_string);
- break;
+ eel_accessibility_set_name (view, _("Content View"));
+ eel_accessibility_set_description (view, _("View of the current folder"));
+
+ connect_view (window, view);
+
+ window->new_content_view = view;
+ }
- case NAUTILUS_DETERMINE_VIEW_LOGIN_FAILED:
- error_message = g_strdup_printf (_("Couldn't display \"%s\"."),
- uri_for_display);
- detail_message = g_strdup (_("The attempt to log in failed."));
- break;
+ /* Actually load the pending location and selection: */
- case NAUTILUS_DETERMINE_VIEW_ACCESS_DENIED:
- error_message = g_strdup_printf (_("Couldn't display \"%s\"."),
- uri_for_display);
- detail_message = g_strdup (_("Access was denied."));
- break;
+ if (window->details->pending_location != NULL) {
+ load_new_location (window,
+ window->details->pending_location,
+ window->details->pending_selection,
+ FALSE,
+ TRUE);
+
+ eel_g_list_free_deep (window->details->pending_selection);
+ window->details->pending_selection = NULL;
+ } else if (window->details->location != NULL) {
+ selection = nautilus_view_get_selection (window->content_view);
+ load_new_location (window,
+ window->details->location,
+ selection,
+ FALSE,
+ TRUE);
+ eel_g_list_free_deep (selection);
+ } else {
+ /* Something is busted, there was no location to load.
+ Just load the homedir. */
+ nautilus_window_go_home (NAUTILUS_WINDOW (window));
+
+ }
+}
- case NAUTILUS_DETERMINE_VIEW_HOST_NOT_FOUND:
- /* This case can be hit for user-typed strings like "foo" due to
- * the code that guesses web addresses when there's no initial "/".
- * But this case is also hit for legitimate web addresses when
- * the proxy is set up wrong.
- */
- vfs_uri = gnome_vfs_uri_new (location);
- host_name = gnome_vfs_uri_get_host_name (vfs_uri);
- error_message = g_strdup_printf (_("Couldn't display \"%s\", because no host \"%s\" could be found."),
- uri_for_display,
- host_name ? host_name : "");
- detail_message = g_strdup (_("Check that the spelling is correct and that your proxy settings are correct."));
- gnome_vfs_uri_unref (vfs_uri);
- break;
+static void
+load_new_location (NautilusWindow *window,
+ const char *location,
+ GList *selection,
+ gboolean tell_current_content_view,
+ gboolean tell_new_content_view)
+{
+ GList *selection_copy;
+ NautilusView *view;
+
+ g_assert (NAUTILUS_IS_WINDOW (window));
+ g_assert (location != NULL);
- case NAUTILUS_DETERMINE_VIEW_HOST_HAS_NO_ADDRESS:
- error_message = g_strdup_printf (_("Couldn't display \"%s\"."),
- uri_for_display);
- detail_message = g_strdup (_("Check that your proxy settings are correct."));
- break;
+ set_displayed_location (window, location);
- case NAUTILUS_DETERMINE_VIEW_NO_MASTER_BROWSER:
- error_message = g_strdup_printf
- (_("Couldn't display \"%s\", because Nautilus cannot contact the SMB master browser."),
- uri_for_display);
- detail_message = g_strdup
- (_("Check that an SMB server is running in the local network."));
- break;
+ selection_copy = eel_g_str_list_copy (selection);
- case NAUTILUS_DETERMINE_VIEW_SERVICE_NOT_AVAILABLE:
- if (nautilus_is_search_uri (location)) {
- /* FIXME bugzilla.gnome.org 42458: Need to give
- * the user better advice about what to do
- * here.
- */
- error_message = g_strdup_printf
- (_("Searching is unavailable right now, because you either have no index, "
- "or the search service isn't running."));
- detail_message = g_strdup
- (_("Be sure that you have started the Medusa search service, and if you "
- "don't have an index, that the Medusa indexer is running."));
- dialog_title = g_strdup (_("Searching Unavailable"));
- break;
- }
- /* else fall through */
- default:
- error_message = g_strdup_printf (_("Nautilus cannot display \"%s\"."),
- uri_for_display);
- detail_message = g_strdup (_("Please select another viewer and try again."));
- }
-
- if (dialog_title == NULL) {
- dialog_title = g_strdup (_("Can't Display Location"));
+ view = NULL;
+
+ /* Note, these may recurse into report_load_underway */
+ if (window->content_view != NULL && tell_current_content_view) {
+ view = window->content_view;
+ nautilus_view_load_location (window->content_view, location);
}
-
- if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (window))) {
- /* Destroy never-had-a-chance-to-be-seen window. This case
- * happens when a new window cannot display its initial URI.
- */
-
- dialog = eel_show_error_dialog (error_message, detail_message, dialog_title, NULL);
-
- /* if this is the only window, we don't want to quit, so we redirect it to home */
- if (just_one_window ()) {
- /* the user could have typed in a home directory that doesn't exist,
- in which case going home would cause an infinite loop, so we
- better test for that */
-
- if (!eel_uris_match (location, "file:///")) {
-#ifdef WEB_NAVIGATION_ENABLED
- home_uri = eel_preferences_get (NAUTILUS_PREFERENCES_HOME_URI);
-#else
- home_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
-#endif
- if (!eel_uris_match (home_uri, location)) {
- nautilus_window_go_home (NAUTILUS_WINDOW (window));
- } else {
- /* the last fallback is to go to a known place that can't be deleted! */
- nautilus_window_go_to (NAUTILUS_WINDOW (window), "file:///");
- }
- g_free (home_uri);
- }
- } else {
- /* Since this is a window, destroying it will also unref it. */
- gtk_object_destroy (GTK_OBJECT (window));
- }
- } else {
- /* Clean up state of already-showing window */
- nautilus_window_allow_stop (window, FALSE);
- eel_show_error_dialog (error_message, detail_message, dialog_title, GTK_WINDOW (window));
-
- /* Leave the location bar showing the bad location that the user
- * typed (or maybe achieved by dragging or something). Many times
- * the mistake will just be an easily-correctable typo. The user
- * can choose "Refresh" to get the original URI back in the location bar.
- */
+
+ if (window->new_content_view != NULL && tell_new_content_view &&
+ (!tell_current_content_view ||
+ window->new_content_view != window->content_view) ) {
+ view = window->new_content_view;
+ nautilus_view_load_location (window->new_content_view, location);
}
-
- g_free (dialog_title);
- g_free (uri_for_display);
- g_free (error_message);
- g_free (detail_message);
+ if (view != NULL) {
+ /* window->new_content_view might have changed here if
+ report_load_underway was called from load_location */
+ nautilus_view_set_selection (view, selection_copy);
+ }
+
+ eel_g_list_free_deep (selection_copy);
}
-/*
- * begin_location_change
- *
- * Change a window's location.
- * @window: The NautilusWindow whose location should be changed.
- * @loc: A Nautilus_NavigationRequestInfo specifying info about this transition.
- * @type: Which type of location change is this? Standard, back, forward, or reload?
- * @distance: If type is back or forward, the index into the back or forward chain. If
- * type is standard or reload, this is ignored, and must be 0.
- * @scroll_pos: The file to scroll to when the location is loaded.
+/* A view started to load the location its viewing, either due to
+ * a load_location request, or some internal reason. Expect
+ * a matching load_compete later
*/
-static void
-begin_location_change (NautilusWindow *window,
- const char *location,
- NautilusLocationChangeType type,
- guint distance,
- const char *scroll_pos)
+void
+nautilus_window_report_load_underway (NautilusWindow *window,
+ NautilusView *view)
{
- NautilusDirectory *directory;
- NautilusFile *file;
- gboolean force_reload;
- char *current_pos;
-
g_assert (NAUTILUS_IS_WINDOW (window));
- g_assert (location != NULL);
- g_assert (type == NAUTILUS_LOCATION_CHANGE_BACK
- || type == NAUTILUS_LOCATION_CHANGE_FORWARD
- || distance == 0);
- g_object_ref (window);
-
- end_location_change (window);
-
- nautilus_window_allow_stop (window, TRUE);
- nautilus_window_set_status (window, " ");
+ if (view == window->new_content_view) {
+ location_has_really_changed (window);
+ } else if (view == window->content_view) {
+ nautilus_window_allow_stop (window, TRUE);
+ } else {
+ g_warning ("Got load_underway report from unknown view");
+ }
+}
- window->details->pending_location = g_strdup (location);
- window->details->location_change_type = type;
- window->details->location_change_distance = distance;
-
- window->details->pending_scroll_to = g_strdup (scroll_pos);
-
- directory = nautilus_directory_get (location);
+/* This is called when we have decided we can actually change to the new view/location situation. */
+static void
+location_has_really_changed (NautilusWindow *window)
+{
+ GtkWidget *widget;
+ char *location_copy;
- /* The code to force a reload is here because if we do it
- * after determining an initial view (in the components), then
- * we end up fetching things twice.
- */
- if (type == NAUTILUS_LOCATION_CHANGE_RELOAD) {
- force_reload = TRUE;
- } else if (!nautilus_monitor_active ()) {
- force_reload = TRUE;
- } else {
- force_reload = !nautilus_directory_is_local (directory);
+ if (window->new_content_view != NULL) {
+ widget = nautilus_view_get_widget (window->new_content_view);
+ /* Switch to the new content view. */
+ if (widget->parent == NULL) {
+ disconnect_view (window, window->content_view);
+ nautilus_window_set_content_view_widget (window, window->new_content_view);
+ }
+ g_object_unref (window->new_content_view);
+ window->new_content_view = NULL;
}
- if (force_reload) {
- nautilus_directory_force_reload (directory);
- file = nautilus_directory_get_corresponding_file (directory);
- nautilus_file_invalidate_all_attributes (file);
- nautilus_file_unref (file);
+ location_copy = g_strdup (window->details->pending_location);
+ if (window->details->pending_location != NULL) {
+ /* Tell the window we are finished. */
+ update_for_new_location (window);
}
- nautilus_directory_unref (directory);
+ free_location_change (window);
- /* Set current_bookmark scroll pos */
- if (window->current_location_bookmark != NULL &&
- window->content_view != NULL) {
- current_pos = nautilus_view_frame_get_first_visible_file (window->content_view);
- nautilus_bookmark_set_scroll_pos (window->current_location_bookmark, current_pos);
- g_free (current_pos);
- }
-
- window->details->determine_view_handle = nautilus_determine_initial_view
- (location, type == NAUTILUS_LOCATION_CHANGE_FALLBACK,
- determined_initial_view_callback, window);
+ nautilus_window_update_title (window);
+ nautilus_window_update_icon (window);
- g_object_unref (window);
-}
+ gtk_widget_show (GTK_WIDGET (window));
-static void
-stop_loading (NautilusViewFrame *view)
-{
- if (view != NULL) {
- nautilus_view_frame_stop (view);
- }
+ if (location_copy != NULL) {
+ g_signal_emit_by_name (window, "loading_uri",
+ location_copy);
+ g_free (location_copy);
+ }
}
+/* Handle the changes for the NautilusWindow itself. */
static void
-stop_loading_cover (gpointer data, gpointer callback_data)
-{
- g_assert (callback_data == NULL);
- stop_loading (NAUTILUS_VIEW_FRAME (data));
-}
-
-void
-nautilus_window_stop_loading (NautilusWindow *window)
+update_for_new_location (NautilusWindow *window)
{
- GList *views;
+ char *new_location;
+ NautilusFile *file;
- /* Copy the list before traversing it, because during a failure in
- * stop_loading_cover, list could be modified and bad things would
- * happen
- */
- views = g_list_copy (window->views);
- g_list_foreach (views, stop_loading_cover, NULL);
- g_list_free (views);
-
- cancel_location_change (window);
-}
-
-void
-nautilus_window_set_content_view (NautilusWindow *window,
- NautilusViewIdentifier *id)
-{
- NautilusFile *file;
-
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- g_return_if_fail (window->details->location != NULL);
- g_return_if_fail (id != NULL);
+ new_location = window->details->pending_location;
+ window->details->pending_location = NULL;
+
+ update_history (window, window->details->location_change_type, new_location);
+
+ /* Set the new location. */
+ g_free (window->details->location);
+ window->details->location = new_location;
+
+ /* Create a NautilusFile for this location, so we can catch it
+ * if it goes away.
+ */
+ cancel_viewed_file_changed_callback (window);
+ file = nautilus_file_get (window->details->location);
+ nautilus_window_set_viewed_file (window, file);
+ window->details->viewed_file_seen = !nautilus_file_is_not_yet_confirmed (file);
+ nautilus_file_monitor_add (file, &window->details->viewed_file, 0);
+ g_signal_connect_object (file, "changed",
+ G_CALLBACK (viewed_file_changed_callback), window, 0);
+ nautilus_file_unref (file);
+
+ /* Check if we can go up. */
+ update_up_button (window);
+
+ /* Set up the initial zoom levels */
+ zoom_parameters_changed_callback (window->content_view,
+ window);
- if (nautilus_window_content_view_matches_iid (window, id->iid)) {
- return;
- }
+ /* Set up the content view menu for this new location. */
+ nautilus_window_load_view_as_menus (window);
+
+ /* Load menus from nautilus extensions for this location */
+ nautilus_window_load_extension_menus (window);
- end_location_change (window);
+#if !NEW_UI_COMPLETE
+ if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
+ /* Check if the back and forward buttons need enabling or disabling. */
+ nautilus_navigation_window_allow_back (NAUTILUS_NAVIGATION_WINDOW (window), NAUTILUS_NAVIGATION_WINDOW (window)->back_list != NULL);
+ nautilus_navigation_window_allow_forward (NAUTILUS_NAVIGATION_WINDOW (window), NAUTILUS_NAVIGATION_WINDOW (window)->forward_list != NULL);
- file = nautilus_file_get (window->details->location);
- nautilus_view_query_set_default_component_for_file
- (file, id->iid);
- nautilus_file_unref (file);
-
- nautilus_window_allow_stop (window, TRUE);
+ /* Change the location bar to match the current location. */
+ nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (NAUTILUS_NAVIGATION_WINDOW (window)->navigation_bar),
+ window->details->location);
- if (window->details->selection == NULL) {
- /* If there is no selection, queue a scroll to the same icon that
- * is currently visible */
- window->details->pending_scroll_to = nautilus_view_frame_get_first_visible_file (window->content_view);
+ nautilus_navigation_window_load_extension_toolbar_items (NAUTILUS_NAVIGATION_WINDOW (window));
}
- load_content_view (window, id);
+ if (NAUTILUS_IS_SPATIAL_WINDOW (window)) {
+ /* Change the location button to match the current location. */
+ nautilus_spatial_window_set_location_button
+ (NAUTILUS_SPATIAL_WINDOW (window),
+ window->details->location);
+ }
+#endif
}
+/* A location load previously announced by load_underway
+ * has been finished */
void
-nautilus_window_connect_extra_view (NautilusWindow *window,
- NautilusViewFrame *view_frame,
- NautilusViewIdentifier *id)
+nautilus_window_report_load_complete (NautilusWindow *window,
+ NautilusView *view)
{
- connect_view (window, view_frame, FALSE);
- set_view_frame_info (view_frame, id);
- nautilus_view_frame_set_show_hidden_files_mode (view_frame, NAUTILUS_WINDOW (window)->details->show_hidden_files_mode, FALSE);
-}
+ g_assert (NAUTILUS_IS_WINDOW (window));
-void
-nautilus_window_disconnect_extra_view (NautilusWindow *window,
- NautilusViewFrame *view_frame)
-{
- disconnect_view (window, view_frame);
+ /* Only handle this if we're expecting it.
+ * Don't handle it if its from an old view we've switched from */
+ if (view == window->content_view) {
+ if (window->details->pending_scroll_to != NULL) {
+ nautilus_view_scroll_to_file (window->content_view,
+ window->details->pending_scroll_to);
+ }
+ end_location_change (window);
+ }
}
static void
-zoom_level_changed_callback (NautilusViewFrame *view,
- NautilusWindow *window)
+end_location_change (NautilusWindow *window)
{
- g_assert (NAUTILUS_IS_WINDOW (window));
+ nautilus_window_allow_stop (window, FALSE);
- /* This is called each time the component successfully completed
- * a zooming operation.
+ /* Now we can free pending_scroll_to, since the load_complete
+ * callback already has been emitted.
*/
+ g_free (window->details->pending_scroll_to);
+ window->details->pending_scroll_to = NULL;
- nautilus_window_ui_freeze (window);
-
- nautilus_bonobo_set_sensitive (window->details->shell_ui,
- NAUTILUS_COMMAND_ZOOM_IN,
- nautilus_view_frame_get_can_zoom_in (view));
- nautilus_bonobo_set_sensitive (window->details->shell_ui,
- NAUTILUS_COMMAND_ZOOM_OUT,
- nautilus_view_frame_get_can_zoom_out (view));
- nautilus_bonobo_set_sensitive (window->details->shell_ui,
- NAUTILUS_COMMAND_ZOOM_NORMAL,
- TRUE);
-
- /* FIXME bugzilla.gnome.org 43442: Desensitize "Zoom Normal"? */
-
- nautilus_window_ui_thaw (window);
+ free_location_change (window);
}
static void
-zoom_parameters_changed_callback (NautilusViewFrame *view,
- NautilusWindow *window)
+free_location_change (NautilusWindow *window)
{
- float zoom_level;
-
- g_assert (NAUTILUS_IS_WINDOW (window));
+ g_free (window->details->pending_location);
+ window->details->pending_location = NULL;
- /* The initial zoom level of a component is allowed to be 0.0 if
- * there is no file loaded yet. In this case we need to set the
- * commands insensitive but display the zoom control nevertheless
- * (the component is just temporarily unable to zoom, but the
- * zoom control will "do the right thing" here).
+ eel_g_list_free_deep (window->details->pending_selection);
+ window->details->pending_selection = NULL;
+
+ /* Don't free pending_scroll_to, since thats needed until
+ * the load_complete callback.
*/
- zoom_level = nautilus_view_frame_get_zoom_level (view);
- if (zoom_level == 0.0) {
- nautilus_window_ui_freeze (window);
-
- nautilus_bonobo_set_sensitive (window->details->shell_ui,
- NAUTILUS_COMMAND_ZOOM_IN,
- FALSE);
- nautilus_bonobo_set_sensitive (window->details->shell_ui,
- NAUTILUS_COMMAND_ZOOM_OUT,
- FALSE);
- nautilus_bonobo_set_sensitive (window->details->shell_ui,
- NAUTILUS_COMMAND_ZOOM_NORMAL,
- FALSE);
- nautilus_window_ui_thaw (window);
-
- /* Don't attempt to set 0.0 as zoom level. */
- return;
+ if (window->details->determine_view_file != NULL) {
+ nautilus_file_cancel_call_when_ready
+ (window->details->determine_view_file,
+ got_file_info_for_view_selection_callback, window);
+ window->details->determine_view_file = NULL;
}
- /* "zoom_parameters_changed" always implies "zoom_level_changed",
- * but you won't get both signals, so we need to pass it down.
- */
- zoom_level_changed_callback (view, window);
+ if (window->new_content_view != NULL) {
+ disconnect_view (window, window->new_content_view);
+ g_object_unref (window->new_content_view);
+ window->new_content_view = NULL;
+ }
}
-static Nautilus_History *
-get_history_list_callback (NautilusViewFrame *view,
- NautilusWindow *window)
+static void
+cancel_location_change (NautilusWindow *window)
{
- Nautilus_History *list;
- NautilusBookmark *bookmark;
- int length, i;
- GList *node;
- char *name, *location;
+ GList *selection;
- /* Get total number of history items */
- length = g_list_length (nautilus_get_history_list ());
-
- list = Nautilus_History__alloc ();
-
- list->_length = length;
- list->_maximum = length;
- list->_buffer = CORBA_sequence_Nautilus_HistoryItem_allocbuf (length);
- CORBA_sequence_set_release (list, CORBA_TRUE);
-
- /* Iterate through list and copy item data */
- for (i = 0, node = nautilus_get_history_list (); i < length; i++, node = node->next) {
- bookmark = node->data;
+ if (window->details->pending_location != NULL
+ && window->details->location != NULL
+ && window->content_view != NULL) {
- name = nautilus_bookmark_get_name (bookmark);
- location = nautilus_bookmark_get_uri (bookmark);
-
- list->_buffer[i].title = CORBA_string_dup (name);
- list->_buffer[i].location = CORBA_string_dup (location);
-
- g_free (name);
- g_free (location);
- }
+ /* No need to tell the new view - either it is the
+ * same as the old view, in which case it will already
+ * be told, or it is the very pending change we wish
+ * to cancel.
+ */
+ selection = nautilus_view_get_selection (window->new_content_view);
+ load_new_location (window,
+ window->details->location,
+ selection,
+ TRUE,
+ FALSE);
+ eel_g_list_free_deep (selection);
+
+ }
- return list;
+ end_location_change (window);
}
-static void
-go_back_callback (NautilusViewFrame *view,
- NautilusWindow *window)
+void
+nautilus_window_report_view_failed (NautilusWindow *window,
+ NautilusView *view)
{
-#if !NEW_UI_COMPLETE
- g_assert (NAUTILUS_IS_WINDOW (window));
+ gboolean do_close_window;
+ char *fallback_load_location;
+ g_warning ("A view failed. The UI will handle this with a dialog but this should be debugged.");
- if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
- if (NAUTILUS_NAVIGATION_WINDOW (window)->back_list != NULL) {
- nautilus_navigation_window_go_back (NAUTILUS_NAVIGATION_WINDOW (window));
- } else {
- nautilus_window_go_home (window);
- }
- }
-#endif
-}
-static void
-close_window_callback (NautilusViewFrame *view,
- NautilusWindow *window)
-{
- g_assert (NAUTILUS_IS_WINDOW (window));
+ do_close_window = FALSE;
+ fallback_load_location = NULL;
+
+ if (view == window->content_view) {
+ disconnect_view (window, window->content_view);
+ nautilus_window_set_content_view_widget (window, NULL);
+
+ report_current_content_view_failure_to_user (window, view);
+ } else {
+ /* Only report error on first try */
+ if (window->details->location_change_type != NAUTILUS_LOCATION_CHANGE_FALLBACK) {
+ report_nascent_content_view_failure_to_user (window, view);
- nautilus_window_close (window);
-}
+ fallback_load_location = g_strdup (window->details->pending_location);
+ } else {
+ if (!GTK_WIDGET_VISIBLE (window)) {
+ do_close_window = TRUE;
+ }
+ }
+ }
+
+ cancel_location_change (window);
-static void
-change_selection_callback (NautilusViewFrame *view,
- GList *selection,
- NautilusWindow *window)
-{
- g_assert (NAUTILUS_IS_WINDOW (window));
+ if (fallback_load_location != NULL) {
+ /* We loose the pending selection change here, but who cares... */
+ begin_location_change (window, fallback_load_location, NULL,
+ NAUTILUS_LOCATION_CHANGE_FALLBACK, 0, NULL);
+ g_free (fallback_load_location);
+ }
- change_selection (window, selection, view);
+ if (do_close_window) {
+ gtk_widget_destroy (GTK_WIDGET (window));
+ }
}
static void
-change_status_callback (NautilusViewFrame *view,
- const char *status,
- NautilusWindow *window)
-{
- g_assert (NAUTILUS_IS_WINDOW (window));
+display_view_selection_failure (NautilusWindow *window, NautilusFile *file,
+ const char *location)
+{
+ GnomeVFSResult result_code;
+ char *full_uri_for_display;
+ char *uri_for_display;
+ char *error_message;
+ char *detail_message;
+ char *scheme_string;
+ char *dialog_title;
+ const char *host_name;
+ GtkDialog *dialog;
+ GnomeVFSURI *vfs_uri;
- nautilus_window_set_status (window, status);
+ result_code = nautilus_file_get_file_info_result (file);
+
+ /* Some sort of failure occurred. How 'bout we tell the user? */
+ full_uri_for_display = eel_format_uri_for_display (location);
+ /* Truncate the URI so it doesn't get insanely wide. Note that even
+ * though the dialog uses wrapped text, if the URI doesn't contain
+ * white space then the text-wrapping code is too stupid to wrap it.
+ */
+ uri_for_display = eel_str_middle_truncate
+ (full_uri_for_display, MAX_URI_IN_DIALOG_LENGTH);
+ g_free (full_uri_for_display);
+
+ dialog_title = NULL;
+
+ switch (result_code) {
+ case GNOME_VFS_OK:
+ if (nautilus_file_is_directory (file)) {
+ error_message = g_strdup_printf
+ (_("Couldn't display \"%s\"."),
+ uri_for_display);
+ detail_message = g_strdup
+ (_("Nautilus has no installed viewer capable of displaying the folder."));
+ } else {
+ error_message = g_strdup_printf
+ (_("Couldn't display \"%s\"."),
+ uri_for_display);
+ detail_message = g_strdup
+ (_("The location is not a folder."));
+ }
+ break;
+ case GNOME_VFS_ERROR_NOT_FOUND:
+ error_message = g_strdup_printf
+ (_("Couldn't find \"%s\"."),
+ uri_for_display);
+ detail_message = g_strdup
+ (_("Please check the spelling and try again."));
+ break;
+
+ case GNOME_VFS_ERROR_INVALID_URI:
+ error_message = g_strdup_printf
+ (_("\"%s\" is not a valid location."),
+ uri_for_display);
+ detail_message = g_strdup
+ (_("Please check the spelling and try again."));
+ break;
+
+ case GNOME_VFS_ERROR_NOT_SUPPORTED:
+ /* Can't create a vfs_uri and get the method from that, because
+ * gnome_vfs_uri_new might return NULL.
+ */
+ scheme_string = eel_str_get_prefix (location, ":");
+ g_assert (scheme_string != NULL); /* Shouldn't have gotten this error unless there's a : separator. */
+ error_message = g_strdup_printf (_("Couldn't display \"%s\"."),
+ uri_for_display);
+ detail_message = g_strdup_printf (_("Nautilus cannot handle %s: locations."),
+ scheme_string);
+ g_free (scheme_string);
+ break;
+
+ case GNOME_VFS_ERROR_LOGIN_FAILED:
+ error_message = g_strdup_printf (_("Couldn't display \"%s\"."),
+ uri_for_display);
+ detail_message = g_strdup (_("The attempt to log in failed."));
+ break;
+
+ case GNOME_VFS_ERROR_ACCESS_DENIED:
+ error_message = g_strdup_printf (_("Couldn't display \"%s\"."),
+ uri_for_display);
+ detail_message = g_strdup (_("Access was denied."));
+ break;
+
+ case GNOME_VFS_ERROR_HOST_NOT_FOUND:
+ /* This case can be hit for user-typed strings like "foo" due to
+ * the code that guesses web addresses when there's no initial "/".
+ * But this case is also hit for legitimate web addresses when
+ * the proxy is set up wrong.
+ */
+ vfs_uri = gnome_vfs_uri_new (location);
+ host_name = gnome_vfs_uri_get_host_name (vfs_uri);
+ error_message = g_strdup_printf (_("Couldn't display \"%s\", because no host \"%s\" could be found."),
+ uri_for_display,
+ host_name ? host_name : "");
+ detail_message = g_strdup (_("Check that the spelling is correct and that your proxy settings are correct."));
+ gnome_vfs_uri_unref (vfs_uri);
+ break;
+
+ case GNOME_VFS_ERROR_HOST_HAS_NO_ADDRESS:
+ error_message = g_strdup_printf (_("Couldn't display \"%s\"."),
+ uri_for_display);
+ detail_message = g_strdup (_("Check that your proxy settings are correct."));
+ break;
+
+ case GNOME_VFS_ERROR_NO_MASTER_BROWSER:
+ error_message = g_strdup_printf
+ (_("Couldn't display \"%s\", because Nautilus cannot contact the SMB master browser."),
+ uri_for_display);
+ detail_message = g_strdup
+ (_("Check that an SMB server is running in the local network."));
+ break;
+
+ case GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE:
+ default:
+ error_message = g_strdup_printf (_("Nautilus cannot display \"%s\"."),
+ uri_for_display);
+ detail_message = g_strdup (_("Please select another viewer and try again."));
+ }
+
+ if (dialog_title == NULL) {
+ dialog_title = g_strdup (_("Can't Display Location"));
+ }
+
+ dialog = eel_show_error_dialog (error_message, detail_message, dialog_title, NULL);
+
+ g_free (dialog_title);
+ g_free (uri_for_display);
+ g_free (error_message);
+ g_free (detail_message);
}
-static void
-content_view_failed_callback (NautilusViewFrame *view,
- NautilusWindow *window)
+
+void
+nautilus_window_stop_loading (NautilusWindow *window)
{
- g_assert (NAUTILUS_IS_WINDOW (window));
+ nautilus_view_stop_loading (window->content_view);
+
+ if (window->new_content_view != NULL) {
+ nautilus_view_stop_loading (window->new_content_view);
+ }
- handle_view_failure (window, view);
+ cancel_location_change (window);
}
-static void
-load_underway_callback (NautilusViewFrame *view,
- NautilusWindow *window)
+void
+nautilus_window_set_content_view (NautilusWindow *window,
+ const char *id)
{
- g_assert (NAUTILUS_IS_WINDOW (window));
-
- /* FIXME bugzilla.gnome.org 42460: We intentionally ignore
- * progress from sidebar panels. Some sidebar panels may get
- * their own progress indicators later.
- */
+ NautilusFile *file;
+
+ g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+ g_return_if_fail (window->details->location != NULL);
+ g_return_if_fail (id != NULL);
- if (view == window->new_content_view) {
- location_has_really_changed (window);
- } else if (view == window->content_view) {
- nautilus_window_allow_stop (window, TRUE);
+ if (nautilus_window_content_view_matches_iid (window, id)) {
+ return;
}
-}
-static void
-load_complete_callback (NautilusViewFrame *view,
- NautilusWindow *window)
-{
- g_assert (NAUTILUS_IS_WINDOW (window));
+ end_location_change (window);
- /* FIXME bugzilla.gnome.org 42460: We intentionally ignore
- * progress from sidebar panels. Some sidebar panels may get
- * their own progress indicators later.
- */
+ file = nautilus_file_get (window->details->location);
+ nautilus_file_set_metadata
+ (file, NAUTILUS_METADATA_KEY_DEFAULT_COMPONENT, NULL, id);
+ nautilus_file_unref (file);
+
+ nautilus_window_allow_stop (window, TRUE);
- if (view == window->content_view) {
- if (window->details->pending_scroll_to != NULL) {
- nautilus_view_frame_scroll_to_file (window->content_view,
- window->details->pending_scroll_to);
- }
- end_location_change (window);
+ if (nautilus_view_get_selection_count (window->content_view) == 0) {
+ /* If there is no selection, queue a scroll to the same icon that
+ * is currently visible */
+ window->details->pending_scroll_to = nautilus_view_get_first_visible_file (window->content_view);
}
+ window->details->location_change_type = NAUTILUS_LOCATION_CHANGE_RELOAD;
+
+ create_content_view (window, id);
}
static void
-open_location_callback (NautilusViewFrame *view,
- const char *location,
- Nautilus_ViewFrame_OpenMode mode,
- Nautilus_ViewFrame_OpenFlags flags,
- GList *selection,
- NautilusWindow *window)
-{
- g_assert (NAUTILUS_IS_WINDOW (window));
-
- /* Open in a new navigation window */
- open_location (window, location, mode, flags, selection);
-}
-
-static void
-report_location_change_callback (NautilusViewFrame *view,
- const char *location,
- GList *selection,
- const char *title,
- NautilusWindow *window)
+zoom_level_changed_callback (NautilusView *view,
+ NautilusWindow *window)
{
+ GtkAction *action;
+ gboolean supports_zooming;
+
g_assert (NAUTILUS_IS_WINDOW (window));
- if (view != window->content_view) {
- /* Do we need to do anything in this case? */
- return;
- }
+ /* This is called each time the component successfully completed
+ * a zooming operation.
+ */
- end_location_change (window);
+ supports_zooming = nautilus_view_supports_zooming (view);
- load_new_location_in_all_views (window,
- location,
- selection,
- view);
-
- window->details->location_change_type = NAUTILUS_LOCATION_CHANGE_STANDARD;
- window->details->pending_location = g_strdup (location);
- update_for_new_location (window);
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_ZOOM_IN);
+ gtk_action_set_visible (action, supports_zooming);
+ gtk_action_set_sensitive (action,
+ nautilus_view_can_zoom_in (view));
+
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_ZOOM_OUT);
+ gtk_action_set_visible (action, supports_zooming);
+ gtk_action_set_sensitive (action,
+ nautilus_view_can_zoom_out (view));
+
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_ZOOM_NORMAL);
+ gtk_action_set_visible (action, supports_zooming);
+ gtk_action_set_sensitive (action,
+ TRUE);
+
+ /* FIXME bugzilla.gnome.org 43442: Desensitize "Zoom Normal"? */
}
static void
-report_redirect_callback (NautilusViewFrame *view,
- const char *from_location,
- const char *to_location,
- GList *selection,
- const char *title,
- NautilusWindow *window)
+zoom_parameters_changed_callback (NautilusView *view,
+ NautilusWindow *window)
{
- const char *existing_location;
+ float zoom_level;
+ GtkAction *action;
g_assert (NAUTILUS_IS_WINDOW (window));
- if (view != window->content_view) {
- /* Do we need to do anything in this case? */
- return;
- }
+ /* The initial zoom level of a component is allowed to be 0.0 if
+ * there is no file loaded yet. In this case we need to set the
+ * commands insensitive but display the zoom control nevertheless
+ * (the component is just temporarily unable to zoom, but the
+ * zoom control will "do the right thing" here).
+ */
+ zoom_level = nautilus_view_get_zoom_level (view);
+ if (zoom_level == 0.0) {
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_ZOOM_IN);
+ gtk_action_set_sensitive (action, FALSE);
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_ZOOM_OUT);
+ gtk_action_set_sensitive (action, FALSE);
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_ZOOM_NORMAL);
+ gtk_action_set_sensitive (action, FALSE);
- /* Ignore redirect if we aren't already at "from_location". */
- existing_location = window->details->pending_location;
- if (existing_location == NULL) {
- existing_location = window->details->location;
- }
- if (existing_location == NULL
- || !eel_uris_match (existing_location, from_location)) {
+ /* Don't attempt to set 0.0 as zoom level. */
return;
}
- end_location_change (window);
-
- load_new_location_in_all_views (window,
- to_location,
- selection,
- view);
-
- nautilus_remove_from_history_list_no_notify (from_location);
- nautilus_window_add_current_location_to_history_list (window);
-
- window->details->location_change_type = NAUTILUS_LOCATION_CHANGE_REDIRECT;
- window->details->pending_location = g_strdup (to_location);
- update_for_new_location (window);
-}
-
-static void
-show_hidden_files_mode_changed_callback (NautilusViewFrame *requesting_view,
- NautilusWindow *window)
-{
- Nautilus_ShowHiddenFilesMode mode;
- NautilusViewFrame *view;
- GList *views, *node;
-
- g_assert (NAUTILUS_IS_WINDOW (window));
-
- /* sync NautilusWindow and ViewFrame show hidden files modes */
- mode = nautilus_view_frame_get_show_hidden_files_mode (requesting_view);
- NAUTILUS_WINDOW (window)->details->show_hidden_files_mode = mode;
-
- views = g_list_copy (window->views);
- for (node = views; node != NULL; node = node->next) {
- view = NAUTILUS_VIEW_FRAME (node->data);
- if (view != requesting_view) {
- nautilus_view_frame_set_show_hidden_files_mode (view, mode, FALSE);
- }
- }
- g_list_free (views);
+ /* "zoom_parameters_changed" always implies "zoom_level_changed",
+ * but you won't get both signals, so we need to pass it down.
+ */
+ zoom_level_changed_callback (view, window);
}
static void
-title_changed_callback (NautilusViewFrame *view,
+title_changed_callback (NautilusView *view,
NautilusWindow *window)
{
g_assert (NAUTILUS_IS_WINDOW (window));
- update_title (window);
+ nautilus_window_update_title (window);
nautilus_window_update_icon (window);
}
static void
-view_loaded_callback (NautilusViewFrame *view,
- NautilusWindow *window)
+connect_view (NautilusWindow *window,
+ NautilusView *view)
{
- g_assert (NAUTILUS_IS_WINDOW (window));
-
- if (view == window->new_content_view
- && window->details->pending_location != NULL) {
- set_to_pending_location_and_selection (window);
- } else {
- /* It's a sidebar panel being loaded, or a content view
- * being switched (with unchanged location and selection).
- */
- if (window->details->location != NULL) {
- load_new_location_in_one_view (view,
- window->details->location,
- window->details->selection);
- }
- }
-
- if (window->details->title != NULL) {
- nautilus_view_frame_title_changed (view, window->details->title);
- }
-}
-
-#define FOR_EACH_NAUTILUS_WINDOW_SIGNAL(macro) \
- macro (change_selection) \
- macro (change_status) \
- macro (get_history_list) \
- macro (go_back) \
- macro (close_window) \
- macro (load_complete) \
- macro (load_underway) \
- macro (open_location) \
- macro (report_location_change) \
- macro (report_redirect) \
- macro (show_hidden_files_mode_changed) \
- macro (title_changed) \
- macro (view_loaded) \
- macro (zoom_level_changed) \
- macro (zoom_parameters_changed)
-
-static void
-connect_view (NautilusWindow *window,
- NautilusViewFrame *view,
- gboolean is_content_view)
-{
- window->views = g_list_prepend (window->views, view);
-
- if (is_content_view) {
- g_signal_connect (view, "failed",
- G_CALLBACK (content_view_failed_callback),
- window);
- g_object_set_data (G_OBJECT (view), "is_content_view",
- GINT_TO_POINTER (1));
- }
-
- #define CONNECT(signal) g_signal_connect \
- (view, #signal, \
- G_CALLBACK (signal##_callback), window);
- FOR_EACH_NAUTILUS_WINDOW_SIGNAL (CONNECT)
- #undef CONNECT
+ g_signal_connect (view, "title_changed",
+ G_CALLBACK (title_changed_callback), window);
+ g_signal_connect (view, "zoom_level_changed",
+ G_CALLBACK (zoom_level_changed_callback), window);
+ g_signal_connect (view, "zoom_parameters_changed",
+ G_CALLBACK (zoom_parameters_changed_callback), window);
}
static void
-disconnect_view (NautilusWindow *window, NautilusViewFrame *view)
+disconnect_view (NautilusWindow *window,
+ NautilusView *view)
{
- g_assert (NAUTILUS_IS_WINDOW (window));
-
if (view == NULL) {
return;
}
-
- g_assert (NAUTILUS_IS_VIEW_FRAME (view));
-
- window->views = g_list_remove (window->views, view);
-
- if (g_object_get_data (G_OBJECT (view), "is_content_view")) {
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (content_view_failed_callback),
- window);
- }
-
-#define DISCONNECT(signal) g_signal_handlers_disconnect_by_func \
- (view, \
- G_CALLBACK (signal##_callback), window);
- FOR_EACH_NAUTILUS_WINDOW_SIGNAL (DISCONNECT)
-#undef DISCONNECT
-}
-
-static void
-disconnect_view_callback (gpointer list_item_data, gpointer callback_data)
-{
- disconnect_view (NAUTILUS_WINDOW (callback_data),
- NAUTILUS_VIEW_FRAME (list_item_data));
+
+ g_signal_handlers_disconnect_by_func (view, title_changed_callback, window);
+ g_signal_handlers_disconnect_by_func (view, zoom_level_changed_callback, window);
+ g_signal_handlers_disconnect_by_func (view, zoom_parameters_changed_callback, window);
}
void
nautilus_window_manage_views_destroy (NautilusWindow *window)
{
- GList *views;
/* Disconnect view signals here so they don't trigger when
* views are destroyed.
*/
- views = g_list_copy (window->views);
-
- g_list_foreach (views, disconnect_view_callback, window);
-
- g_list_free (views);
+ if (window->content_view != NULL) {
+ disconnect_view (window, window->content_view);
+ }
+ if (window->new_content_view != NULL) {
+ disconnect_view (window, window->new_content_view);
+ }
}
void
@@ -2164,7 +1646,7 @@ nautilus_navigation_window_back_or_forward (NautilusNavigationWindow *window,
scroll_pos = nautilus_bookmark_get_scroll_pos (bookmark);
begin_location_change
(NAUTILUS_WINDOW (window),
- uri,
+ uri, NULL,
back ? NAUTILUS_LOCATION_CHANGE_BACK : NAUTILUS_LOCATION_CHANGE_FORWARD,
distance,
scroll_pos);
@@ -2182,13 +1664,19 @@ nautilus_window_reload (NautilusWindow *window)
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
+ if (window->details->location == NULL) {
+ return;
+ }
+
/* window->details->location can be free'd during the processing
* of begin_location_change, so make a copy
*/
location = g_strdup (window->details->location);
- current_pos = nautilus_view_frame_get_first_visible_file (window->content_view);
+ current_pos = NULL;
+ if (window->content_view != NULL)
+ current_pos = nautilus_view_get_first_visible_file (window->content_view);
begin_location_change
- (window, location,
+ (window, location, NULL,
NAUTILUS_LOCATION_CHANGE_RELOAD, 0, current_pos);
g_free (current_pos);
g_free (location);
diff --git a/src/nautilus-window-manage-views.h b/src/nautilus-window-manage-views.h
index a5874571e..22d3f0188 100644
--- a/src/nautilus-window-manage-views.h
+++ b/src/nautilus-window-manage-views.h
@@ -30,33 +30,38 @@
#include "nautilus-window.h"
#include "nautilus-navigation-window.h"
-void nautilus_window_manage_views_destroy (NautilusWindow *window);
-void nautilus_window_manage_views_finalize (NautilusWindow *window);
-void nautilus_window_open_location (NautilusWindow *window,
- const char *location,
- gboolean close_behind);
-void nautilus_window_open_location_with_selection (NautilusWindow *window,
- const char *location,
- GList *selection,
- gboolean close_behind);
-void nautilus_window_stop_loading (NautilusWindow *window);
-void nautilus_window_set_content_view (NautilusWindow *window,
- NautilusViewIdentifier *id);
+void nautilus_window_manage_views_destroy (NautilusWindow *window);
+void nautilus_window_manage_views_finalize (NautilusWindow *window);
+void nautilus_window_open_location (NautilusWindow *window,
+ const char *location,
+ gboolean close_behind);
+void nautilus_window_open_location_with_selection (NautilusWindow *window,
+ const char *location,
+ GList *selection,
+ gboolean close_behind);
+void nautilus_window_open_location_full (NautilusWindow *window,
+ const char *location,
+ NautilusWindowOpenMode mode,
+ NautilusWindowOpenFlags flags,
+ GList *new_selection);
+void nautilus_window_stop_loading (NautilusWindow *window);
+void nautilus_window_set_content_view (NautilusWindow *window,
+ const char *id);
+gboolean nautilus_window_content_view_matches_iid (NautilusWindow *window,
+ const char *iid);
+const char *nautilus_window_get_content_view_id (NautilusWindow *window);
+char *nautilus_window_get_view_label (NautilusWindow *window);
+void nautilus_navigation_window_set_sidebar_panels (NautilusNavigationWindow *window,
+ GList *view_identifier_list);
-gboolean nautilus_window_content_view_matches_iid (NautilusWindow *window,
- const char *iid);
-NautilusViewIdentifier *nautilus_window_get_content_view_id (NautilusWindow *window);
-void nautilus_window_connect_extra_view (NautilusWindow *window,
- NautilusViewFrame *view,
- NautilusViewIdentifier *id);
-void nautilus_window_disconnect_extra_view (NautilusWindow *window,
- NautilusViewFrame *view);
-char *nautilus_window_get_view_frame_label (NautilusViewFrame *view);
-
-void nautilus_navigation_window_set_sidebar_panels (NautilusNavigationWindow *window,
- GList *view_identifier_list);
-void nautilus_navigation_window_back_or_forward (NautilusNavigationWindow *window,
- gboolean back,
- guint distance);
+
+/* NautilusWindowInfo implementation: */
+void nautilus_window_report_load_underway (NautilusWindow *window,
+ NautilusView *view);
+void nautilus_window_report_selection_changed (NautilusWindowInfo *window);
+void nautilus_window_report_view_failed (NautilusWindow *window,
+ NautilusView *view);
+void nautilus_window_report_load_complete (NautilusWindow *window,
+ NautilusView *view);
#endif /* NAUTILUS_WINDOW_MANAGE_VIEWS_H */
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 568f38328..cc4edf5be 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -29,16 +29,15 @@
#include <locale.h>
+#include "nautilus-actions.h"
#include "nautilus-application.h"
#include "nautilus-connect-server-dialog.h"
#include "nautilus-file-management-properties.h"
#include "nautilus-property-browser.h"
#include "nautilus-signaller.h"
-#include "nautilus-switchable-navigation-bar.h"
#include "nautilus-window-manage-views.h"
#include "nautilus-window-private.h"
#include "nautilus-desktop-window.h"
-#include <bonobo/bonobo-ui-util.h>
#include <eel/eel-debug.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gnome-extensions.h>
@@ -59,42 +58,14 @@
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-ops.h>
#include <libnautilus-extension/nautilus-menu-provider.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
#include <libnautilus-private/nautilus-file-utilities.h>
+#include <libnautilus-private/nautilus-ui-utilities.h>
#include <libnautilus-private/nautilus-icon-factory.h>
#include <libnautilus-private/nautilus-module.h>
#include <libnautilus-private/nautilus-undo-manager.h>
-#include <libnautilus/nautilus-bonobo-ui.h>
-#ifdef ENABLE_PROFILER
-#include "nautilus-profiler.h"
-#endif
-
-/* Private menu definitions; others are in <libnautilus/nautilus-bonobo-ui.h>.
- * These are not part of the published set, either because they are
- * development-only or because we expect to change them and
- * don't want other code relying on their existence.
- */
-
-#define MENU_PATH_SHOW_HIDE_SIDEBAR "/menu/View/Show Hide Placeholder/Show Hide Sidebar"
-#define MENU_PATH_SHOW_HIDE_TOOLBAR "/menu/View/Show Hide Placeholder/Show Hide Toolbar"
-#define MENU_PATH_SHOW_HIDE_LOCATION_BAR "/menu/View/Show Hide Placeholder/Show Hide Location Bar"
-#define MENU_PATH_SHOW_HIDE_STATUS_BAR "/menu/View/Show Hide Placeholder/Show Hide Statusbar"
-
-#define MENU_PATH_EXTENSION_ACTIONS "/menu/File/Extension Actions"
-#define POPUP_PATH_EXTENSION_ACTIONS "/popups/background/Before Zoom Items/Extension Actions"
-
-#define COMMAND_PATH_CLOSE_WINDOW "/commands/Close"
-#define COMMAND_SHOW_HIDE_SIDEBAR "/commands/Show Hide Sidebar"
-#define COMMAND_SHOW_HIDE_TOOLBAR "/commands/Show Hide Toolbar"
-#define COMMAND_SHOW_HIDE_LOCATION_BAR "/commands/Show Hide Location Bar"
-#define COMMAND_SHOW_HIDE_STATUS_BAR "/commands/Show Hide Statusbar"
-#define COMMAND_GO_BURN_CD "/commands/Go to Burn CD"
-
-#define ID_SHOW_HIDE_SIDEBAR "Show Hide Sidebar"
-#define ID_SHOW_HIDE_TOOLBAR "Show Hide Toolbar"
-#define ID_SHOW_HIDE_LOCATION_BAR "Show Hide Location Bar"
-#define ID_SHOW_HIDE_STATUS_BAR "Show Hide Statusbar"
+#define MENU_PATH_EXTENSION_ACTIONS "/MenuBar/File/Extension Actions"
+#define POPUP_PATH_EXTENSION_ACTIONS "/background/Before Zoom Items/Extension Actions"
#define COMPUTER_URI "computer:"
#define BURN_CD_URI "burn:"
@@ -140,13 +111,6 @@ bookmark_holder_free (BookmarkHolder *bookmark_holder)
g_free (bookmark_holder);
}
-/* Private menu definitions; others are in <libnautilus/nautilus-bonobo-ui.h>.
- * These are not part of the published set, either because they are
- * development-only or because we expect to change them and
- * don't want other code relying on their existence.
- */
-
-
static void
bookmark_holder_free_cover (gpointer callback_data, GClosure *closure)
{
@@ -154,7 +118,7 @@ bookmark_holder_free_cover (gpointer callback_data, GClosure *closure)
}
static void
-activate_bookmark_in_menu_item (BonoboUIComponent *component, gpointer user_data, const char *path)
+activate_bookmark_in_menu_item (GtkAction *action, gpointer user_data)
{
BookmarkHolder *holder;
char *uri;
@@ -172,26 +136,25 @@ activate_bookmark_in_menu_item (BonoboUIComponent *component, gpointer user_data
void
nautilus_menus_append_bookmark_to_menu (NautilusWindow *window,
- BonoboUIComponent *uic,
NautilusBookmark *bookmark,
const char *parent_path,
guint index_in_parent,
+ GtkActionGroup *action_group,
+ guint merge_id,
GCallback refresh_callback,
NautilusBookmarkFailedCallback failed_callback)
{
BookmarkHolder *bookmark_holder;
- char *raw_name, *display_name, *truncated_name, *verb_name;
- char *ui_path;
+ char *raw_name, *display_name, *truncated_name, *action_name;
GdkPixbuf *pixbuf;
+ GtkAction *action;
g_assert (NAUTILUS_IS_WINDOW (window));
g_assert (NAUTILUS_IS_BOOKMARK (bookmark));
- nautilus_window_ui_freeze (window);
-
bookmark_holder = bookmark_holder_new (bookmark, window, refresh_callback, failed_callback);
- /* We double the underscores here to escape them so Bonobo will know they are
+ /* We double the underscores here to escape them so gtk+ will know they are
* not keyboard accelerator character prefixes. If we ever find we need to
* escape more than just the underscores, we'll add a menu helper function
* instead of a string utility. (Like maybe escaping control characters.)
@@ -204,60 +167,53 @@ nautilus_menus_append_bookmark_to_menu (NautilusWindow *window,
/* Create menu item with pixbuf */
pixbuf = nautilus_bookmark_get_pixbuf (bookmark, NAUTILUS_ICON_SIZE_FOR_MENUS, FALSE);
- nautilus_bonobo_add_numbered_menu_item
- (uic,
- parent_path,
- index_in_parent,
- display_name,
- pixbuf);
- g_object_unref (pixbuf);
- g_free (display_name);
+
+ action_name = g_strdup_printf ("bookmark_%d", index_in_parent);
+
+ action = gtk_action_new (action_name,
+ display_name,
+ _("Go to the location specified by this bookmark"),
+ NULL);
- /* Add the status tip */
- ui_path = nautilus_bonobo_get_numbered_menu_item_path
- (uic, parent_path, index_in_parent);
- nautilus_bonobo_set_tip (uic, ui_path, _("Go to the location specified by this bookmark"));
- g_free (ui_path);
-
- /* Add verb to new bookmark menu item */
- verb_name = nautilus_bonobo_get_numbered_menu_item_command
- (uic, parent_path, index_in_parent);
- bonobo_ui_component_add_verb_full (uic, verb_name,
- g_cclosure_new (G_CALLBACK (activate_bookmark_in_menu_item),
- bookmark_holder,
- bookmark_holder_free_cover));
- g_free (verb_name);
-
- nautilus_window_ui_thaw (window);
-}
+ /* TODO: This should really use themed icons and
+ nautilus_bookmark_get_icon (bookmark), but that doesn't work yet*/
+ 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 (activate_bookmark_in_menu_item),
+ bookmark_holder,
+ bookmark_holder_free_cover, 0);
-static void
-file_menu_new_window_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- NautilusWindow *current_window;
- NautilusWindow *new_window;
+ gtk_action_group_add_action (action_group,
+ GTK_ACTION (action));
+
+ g_object_unref (action);
+
+ gtk_ui_manager_add_ui (window->details->ui_manager,
+ merge_id,
+ parent_path,
+ action_name,
+ action_name,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
- current_window = NAUTILUS_WINDOW (user_data);
- new_window = nautilus_application_create_navigation_window (
- current_window->application,
- gtk_window_get_screen (GTK_WINDOW (current_window)));
- nautilus_window_go_home (new_window);
+ g_object_unref (pixbuf);
+ g_free (action_name);
+ g_free (display_name);
}
static void
-file_menu_close_window_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_close_window_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_window_close (NAUTILUS_WINDOW (user_data));
}
static void
-connect_to_server_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_connect_to_server_callback (GtkAction *action,
+ gpointer user_data)
{
GtkWidget *dialog;
@@ -283,96 +239,39 @@ have_burn_uri (void)
return res;
}
-#ifdef HAVE_MEDUSA
-static void
-file_menu_find_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- NautilusWindow *window;
-
- window = NAUTILUS_WINDOW (user_data);
-
- if (!window->details->updating_bonobo_state) {
- nautilus_window_show_location_bar_temporarily
- (window, TRUE);
- }
-}
-
static void
-toolbar_toggle_find_mode_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- NautilusWindow *window;
-
- window = NAUTILUS_WINDOW (user_data);
-
- if (!window->details->updating_bonobo_state) {
- nautilus_window_show_location_bar_temporarily
- (window, !nautilus_window_get_search_mode (window));
- }
-}
-#endif
-
-static void
-go_menu_location_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- NautilusWindow *window;
-
- window = NAUTILUS_WINDOW (user_data);
-
- nautilus_window_prompt_for_location (window);
-}
-
-static void
-stop_button_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_stop_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_window_stop_loading (NAUTILUS_WINDOW (user_data));
}
static void
-edit_menu_undo_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_undo_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_undo_manager_undo
(NAUTILUS_WINDOW (user_data)->application->undo_manager);
}
static void
-go_menu_up_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- nautilus_window_go_up (NAUTILUS_WINDOW (user_data), FALSE);
-}
-
-static void
-go_menu_home_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_home_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_window_go_home (NAUTILUS_WINDOW (user_data));
}
static void
-go_menu_go_to_computer_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_go_to_computer_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_window_go_to (NAUTILUS_WINDOW (user_data),
COMPUTER_URI);
}
static void
-go_menu_go_to_templates_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_go_to_templates_callback (GtkAction *action,
+ gpointer user_data)
{
char *uri;
@@ -384,94 +283,47 @@ go_menu_go_to_templates_callback (BonoboUIComponent *component,
}
static void
-go_menu_go_to_trash_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_go_to_trash_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_window_go_to (NAUTILUS_WINDOW (user_data),
EEL_TRASH_URI);
}
static void
-go_menu_go_to_burn_cd_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_go_to_burn_cd_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_window_go_to (NAUTILUS_WINDOW (user_data),
BURN_CD_URI);
}
static void
-view_menu_reload_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_reload_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_window_reload (NAUTILUS_WINDOW (user_data));
}
static void
-view_menu_show_hide_statusbar_state_changed_callback (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-{
- NautilusWindow *window;
-
- window = NAUTILUS_WINDOW (user_data);
-
- if (strcmp (state, "") == 0) {
- /* State goes blank when component is removed; ignore this. */
- return;
- }
-
- if (!strcmp (state, "1")) {
- nautilus_window_show_status_bar (window);
- } else {
- nautilus_window_hide_status_bar (window);
- }
-}
-
-void
-nautilus_window_update_show_hide_menu_items (NautilusWindow *window)
-{
- g_assert (NAUTILUS_IS_WINDOW (window));
-
- nautilus_window_ui_freeze (window);
-
- bonobo_ui_component_freeze (window->details->shell_ui, NULL);
-
- nautilus_bonobo_set_toggle_state (window->details->shell_ui,
- COMMAND_SHOW_HIDE_STATUS_BAR,
- nautilus_window_status_bar_showing (window));
-
- bonobo_ui_component_thaw (window->details->shell_ui, NULL);
-
- nautilus_window_ui_thaw (window);
-}
-
-static void
-view_menu_zoom_in_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_zoom_in_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_window_zoom_in (NAUTILUS_WINDOW (user_data));
}
static void
-view_menu_zoom_out_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_zoom_out_callback (GtkAction *action,
+ gpointer user_data)
{
nautilus_window_zoom_out (NAUTILUS_WINDOW (user_data));
}
static void
-view_menu_zoom_normal_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_zoom_normal_callback (GtkAction *action,
+ gpointer user_data)
{
- nautilus_window_zoom_to_level (NAUTILUS_WINDOW (user_data), 1.0);
+ nautilus_window_zoom_to_default (NAUTILUS_WINDOW (user_data));
}
static void
@@ -484,9 +336,8 @@ preferences_respond_callback (GtkDialog *dialog,
}
static void
-preferences_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_preferences_callback (GtkAction *action,
+ gpointer user_data)
{
GtkWindow *window;
@@ -496,9 +347,8 @@ preferences_callback (BonoboUIComponent *component,
}
static void
-backgrounds_and_emblems_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_backgrounds_and_emblems_callback (GtkAction *action,
+ gpointer user_data)
{
GtkWindow *window;
@@ -508,9 +358,8 @@ backgrounds_and_emblems_callback (BonoboUIComponent *component,
}
static void
-help_menu_about_nautilus_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_about_nautilus_callback (GtkAction *action,
+ gpointer user_data)
{
static GtkWidget *about = NULL;
const char *authors[] = {
@@ -600,9 +449,15 @@ help_menu_about_nautilus_callback (BonoboUIComponent *component,
}
static void
-help_menu_nautilus_manual_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
+action_up_callback (GtkAction *action,
+ gpointer user_data)
+{
+ nautilus_window_go_up (NAUTILUS_WINDOW (user_data), FALSE);
+}
+
+static void
+action_nautilus_manual_callback (GtkAction *action,
+ gpointer user_data)
{
NautilusWindow *window;
GError *error;
@@ -638,6 +493,161 @@ help_menu_nautilus_manual_callback (BonoboUIComponent *component,
}
}
+static void
+menu_item_select_cb (GtkMenuItem *proxy,
+ NautilusWindow *window)
+{
+ GtkAction *action;
+ char *message;
+
+ action = g_object_get_data (G_OBJECT (proxy), "gtk-action");
+ g_return_if_fail (action != NULL);
+
+ g_object_get (G_OBJECT (action), "tooltip", &message, NULL);
+ if (message) {
+ gtk_statusbar_push (GTK_STATUSBAR (window->details->statusbar),
+ window->details->help_message_cid, message);
+ g_free (message);
+ }
+}
+
+static void
+menu_item_deselect_cb (GtkMenuItem *proxy,
+ NautilusWindow *window)
+{
+ gtk_statusbar_pop (GTK_STATUSBAR (window->details->statusbar),
+ window->details->help_message_cid);
+}
+
+static void
+disconnect_proxy_cb (GtkUIManager *manager,
+ GtkAction *action,
+ GtkWidget *proxy,
+ NautilusWindow *window)
+{
+ if (GTK_IS_MENU_ITEM (proxy)) {
+ g_signal_handlers_disconnect_by_func
+ (proxy, G_CALLBACK (menu_item_select_cb), window);
+ g_signal_handlers_disconnect_by_func
+ (proxy, G_CALLBACK (menu_item_deselect_cb), window);
+ }
+}
+
+static void
+connect_proxy_cb (GtkUIManager *manager,
+ GtkAction *action,
+ GtkWidget *proxy,
+ NautilusWindow *window)
+{
+ GdkPixbuf *icon;
+ GtkWidget *widget;
+
+ if (GTK_IS_MENU_ITEM (proxy)) {
+ g_signal_connect (proxy, "select",
+ G_CALLBACK (menu_item_select_cb), window);
+ g_signal_connect (proxy, "deselect",
+ G_CALLBACK (menu_item_deselect_cb), window);
+
+
+ /* This is a way to easily get pixbufs into the menu items */
+ icon = g_object_get_data (G_OBJECT (action), "menu-icon");
+ if (icon != NULL) {
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy),
+ gtk_image_new_from_pixbuf (icon));
+ }
+ }
+ if (GTK_IS_TOOL_BUTTON (proxy)) {
+ icon = g_object_get_data (G_OBJECT (action), "toolbar-icon");
+ if (icon != NULL) {
+ widget = gtk_image_new_from_pixbuf (icon);
+ gtk_widget_show (widget);
+ gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (proxy),
+ widget);
+ }
+ }
+
+}
+
+static GtkActionEntry main_entries[] = {
+ { "File", NULL, N_("_File") }, /* name, stock id, label */
+ { "Edit", NULL, N_("_Edit") }, /* name, stock id, label */
+ { "View", NULL, N_("_View") }, /* name, stock id, label */
+ { "Help", NULL, N_("_Help") }, /* name, stock id, label */
+ { "Close", GTK_STOCK_CLOSE, /* name, stock id */
+ N_("_Close"), "<control>W", /* label, accelerator */
+ N_("Close this folder"), /* tooltip */
+ G_CALLBACK (action_close_window_callback) },
+ { "Backgrounds and Emblems", NULL,
+ N_("_Backgrounds and Emblems..."),
+ NULL, N_("Display patterns, colors, and emblems that can be used to customize appearance"),
+ G_CALLBACK (action_backgrounds_and_emblems_callback) },
+ { "Preferences", GTK_STOCK_PREFERENCES,
+ N_("Prefere_nces"),
+ NULL, N_("Edit Nautilus preferences"),
+ G_CALLBACK (action_preferences_callback) },
+ { "Undo", NULL, N_("_Undo"), /* name, stock id, label */
+ "<control>Z", N_("Undo the last text change"),
+ G_CALLBACK (action_undo_callback) },
+ { "Up", GTK_STOCK_GO_UP, N_("Open _Parent"), /* name, stock id, label */
+ "<alt>Up", N_("Open the parent folder"),
+ G_CALLBACK (action_up_callback) },
+ { "UpAccel", NULL, "UpAccel", /* name, stock id, label */
+ "", NULL,
+ G_CALLBACK (action_up_callback) },
+ { "Stop", GTK_STOCK_STOP, /* name, stock id */
+ N_("_Stop"), NULL, /* label, accelerator */
+ NULL, /* tooltip */
+ G_CALLBACK (action_stop_callback) },
+ { "Reload", GTK_STOCK_REFRESH, /* name, stock id */
+ N_("_Reload"), "<control>R", /* label, accelerator */
+ NULL, /* tooltip */
+ G_CALLBACK (action_reload_callback) },
+ { "Nautilus Manual", GTK_STOCK_HELP, /* name, stock id */
+ N_("_Contents"), "F1", /* label, accelerator */
+ N_("Display Nautilus help"), /* tooltip */
+ G_CALLBACK (action_nautilus_manual_callback) },
+ { "About Nautilus", GTK_STOCK_ABOUT, /* name, stock id */
+ N_("_About"), NULL, /* label, accelerator */
+ N_("Display credits for the creators of Nautilus"), /* tooltip */
+ G_CALLBACK (action_about_nautilus_callback) },
+ { "Zoom In", GTK_STOCK_ZOOM_IN, /* name, stock id */
+ N_("Zoom _In"), "<control>plus", /* label, accelerator */
+ N_("Show the contents in more detail"), /* tooltip */
+ G_CALLBACK (action_zoom_in_callback) },
+ { "Zoom Out", GTK_STOCK_ZOOM_OUT, /* name, stock id */
+ N_("Zoom _Out"), "<control>minus", /* label, accelerator */
+ N_("Show the contents in less detail"), /* tooltip */
+ G_CALLBACK (action_zoom_out_callback) },
+ { "Zoom Normal", GTK_STOCK_ZOOM_100, /* name, stock id */
+ N_("Normal Si_ze"), NULL, /* label, accelerator */
+ N_("Show the contents at the normal size"), /* tooltip */
+ G_CALLBACK (action_zoom_normal_callback) },
+ { "Connect to Server", NULL, /* name, stock id */
+ N_("Connect to _Server..."), NULL, /* label, accelerator */
+ N_("Set up a connection to a network server"), /* tooltip */
+ G_CALLBACK (action_connect_to_server_callback) },
+ { "Home", GTK_STOCK_HOME, /* name, stock id */
+ N_("_Home"), "<alt>Home", /* label, accelerator */
+ N_("Go to the home folder"), /* tooltip */
+ G_CALLBACK (action_home_callback) },
+ { "Go to Computer", "gnome-fs-client", /* name, stock id */
+ N_("_Computer"), NULL, /* label, accelerator */
+ N_("Go to the computer location"), /* tooltip */
+ G_CALLBACK (action_go_to_computer_callback) },
+ { "Go to Templates", NULL, /* name, stock id */
+ N_("T_emplates"), NULL, /* label, accelerator */
+ N_("Go to the templates folder"), /* tooltip */
+ G_CALLBACK (action_go_to_templates_callback) },
+ { "Go to Trash", NULL, /* name, stock id */
+ N_("_Trash"), NULL, /* label, accelerator */
+ N_("Go to the trash folder"), /* tooltip */
+ G_CALLBACK (action_go_to_trash_callback) },
+ { "Go to Burn CD", NULL, /* name, stock id */
+ N_("CD _Creator"), NULL, /* label, accelerator */
+ N_("Go to the CD/DVD Creator"), /* tooltip */
+ G_CALLBACK (action_go_to_burn_cd_callback) },
+};
+
/**
* nautilus_window_initialize_menus
*
@@ -645,76 +655,43 @@ help_menu_nautilus_manual_callback (BonoboUIComponent *component,
* @window: A recently-created NautilusWindow.
*/
void
-nautilus_window_initialize_menus_part_1 (NautilusWindow *window)
-{
- BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("New Window", file_menu_new_window_callback),
- BONOBO_UI_VERB ("Close", file_menu_close_window_callback),
- BONOBO_UI_VERB ("Connect to Server", connect_to_server_callback),
-#ifdef HAVE_MEDUSA
- BONOBO_UI_VERB ("Find", file_menu_find_callback),
- BONOBO_UI_VERB ("Toggle Find Mode", toolbar_toggle_find_mode_callback),
-#endif
- BONOBO_UI_VERB ("Undo", edit_menu_undo_callback),
- BONOBO_UI_VERB ("Backgrounds and Emblems", backgrounds_and_emblems_callback),
- BONOBO_UI_VERB ("Up", go_menu_up_callback),
- BONOBO_UI_VERB ("Home", go_menu_home_callback),
- BONOBO_UI_VERB ("Go to Computer", go_menu_go_to_computer_callback),
- BONOBO_UI_VERB ("Go to Templates", go_menu_go_to_templates_callback),
- BONOBO_UI_VERB ("Go to Trash", go_menu_go_to_trash_callback),
- BONOBO_UI_VERB ("Go to Burn CD", go_menu_go_to_burn_cd_callback),
- BONOBO_UI_VERB ("Go to Location", go_menu_location_callback),
- BONOBO_UI_VERB ("Reload", view_menu_reload_callback),
- BONOBO_UI_VERB ("Zoom In", view_menu_zoom_in_callback),
- BONOBO_UI_VERB ("Zoom Out", view_menu_zoom_out_callback),
- BONOBO_UI_VERB ("Zoom Normal", view_menu_zoom_normal_callback),
-
-#ifdef ENABLE_PROFILER
- BONOBO_UI_VERB ("Start Profiling", nautilus_profiler_bonobo_ui_start_callback),
- BONOBO_UI_VERB ("Stop Profiling", nautilus_profiler_bonobo_ui_stop_callback),
- BONOBO_UI_VERB ("Reset Profiling", nautilus_profiler_bonobo_ui_reset_callback),
- BONOBO_UI_VERB ("Report Profiling", nautilus_profiler_bonobo_ui_report_callback),
-#endif
-
- BONOBO_UI_VERB ("About Nautilus", help_menu_about_nautilus_callback),
- BONOBO_UI_VERB ("Nautilus Manual", help_menu_nautilus_manual_callback),
- BONOBO_UI_VERB ("Preferences", preferences_callback),
- BONOBO_UI_VERB ("Stop", stop_button_callback),
-
- BONOBO_UI_VERB_END
- };
-
- nautilus_window_ui_freeze (window);
-
- bonobo_ui_component_freeze (window->details->shell_ui, NULL);
-
- nautilus_window_update_show_hide_menu_items (window);
-
- bonobo_ui_component_add_verb_list_with_data (window->details->shell_ui, verbs, window);
-
- bonobo_ui_component_add_listener
- (window->details->shell_ui,
- ID_SHOW_HIDE_STATUS_BAR,
- view_menu_show_hide_statusbar_state_changed_callback,
- window);
+nautilus_window_initialize_menus (NautilusWindow *window)
+{
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+ GtkAction *action;
+ const char *ui;
+
+ action_group = gtk_action_group_new ("ShellActions");
+ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+ window->details->main_action_group = action_group;
+ gtk_action_group_add_actions (action_group,
+ main_entries, G_N_ELEMENTS (main_entries),
+ window);
+
+ action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_UP);
+ g_object_set (action, "short_label", _("_Up"), NULL);
+
+ window->details->ui_manager = gtk_ui_manager_new ();
+ ui_manager = window->details->ui_manager;
+ gtk_window_add_accel_group (GTK_WINDOW (window),
+ gtk_ui_manager_get_accel_group (ui_manager));
+
+ g_signal_connect (ui_manager, "connect_proxy",
+ G_CALLBACK (connect_proxy_cb), window);
+ g_signal_connect (ui_manager, "disconnect_proxy",
+ G_CALLBACK (disconnect_proxy_cb), window);
+
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ g_object_unref (action_group); /* owned by ui manager */
- /* Register to catch Bonobo UI events so we can notice View As changes */
- g_signal_connect_object (window->details->shell_ui, "ui_event",
- G_CALLBACK (nautilus_window_handle_ui_event_callback), window, 0);
+ ui = nautilus_ui_string_get ("nautilus-shell-ui.xml");
+ gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL);
- bonobo_ui_component_thaw (window->details->shell_ui, NULL);
-
if (!have_burn_uri ()) {
- nautilus_bonobo_set_hidden (window->details->shell_ui,
- COMMAND_GO_BURN_CD,
- TRUE);
+ action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_GO_TO_BURN_CD);
+ gtk_action_set_visible (action, FALSE);
}
-
-#ifndef ENABLE_PROFILER
- nautilus_bonobo_set_hidden (window->details->shell_ui, NAUTILUS_MENU_PATH_PROFILER, TRUE);
-#endif
-
- nautilus_window_ui_thaw (window);
}
static GList *
@@ -746,34 +723,61 @@ get_extension_menus (NautilusWindow *window)
void
nautilus_window_load_extension_menus (NautilusWindow *window)
{
+ NautilusMenuItem *item;
+ GtkActionGroup *action_group;
+ GtkAction *action;
GList *items;
GList *l;
+ int i;
+ guint merge_id;
+
+ if (window->details->extensions_menu_merge_id != 0) {
+ gtk_ui_manager_remove_ui (window->details->ui_manager,
+ window->details->extensions_menu_merge_id);
+ window->details->extensions_menu_merge_id = 0;
+ }
+
+ if (window->details->extensions_menu_action_group != NULL) {
+ gtk_ui_manager_remove_action_group (window->details->ui_manager,
+ window->details->extensions_menu_action_group);
+ window->details->extensions_menu_action_group = NULL;
+ }
- nautilus_bonobo_remove_menu_items_and_commands
- (window->details->shell_ui, POPUP_PATH_EXTENSION_ACTIONS);
- nautilus_bonobo_remove_menu_items_and_commands
- (window->details->shell_ui, MENU_PATH_EXTENSION_ACTIONS);
+ merge_id = gtk_ui_manager_new_merge_id (window->details->ui_manager);
+ window->details->extensions_menu_merge_id = merge_id;
+ action_group = gtk_action_group_new ("ExtensionsMenuGroup");
+ window->details->extensions_menu_action_group = action_group;
+ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+ gtk_ui_manager_insert_action_group (window->details->ui_manager, action_group, 0);
+ g_object_unref (action_group); /* owned by ui manager */
items = get_extension_menus (window);
- for (l = items; l != NULL; l = l->next) {
- NautilusMenuItem *item;
-
+ for (l = items, i = 0; l != NULL; l = l->next, i++) {
item = NAUTILUS_MENU_ITEM (l->data);
- nautilus_bonobo_add_extension_item_command
- (window->details->shell_ui, item);
+ action = nautilus_action_from_menu_item (item);
+ gtk_action_group_add_action (action_group,
+ GTK_ACTION (action));
+ g_object_unref (action);
- nautilus_bonobo_add_extension_item
- (window->details->shell_ui,
- MENU_PATH_EXTENSION_ACTIONS,
- item);
-
- nautilus_bonobo_add_extension_item
- (window->details->shell_ui,
- POPUP_PATH_EXTENSION_ACTIONS,
- item);
+ gtk_ui_manager_add_ui (window->details->ui_manager,
+ merge_id,
+ MENU_PATH_EXTENSION_ACTIONS,
+ gtk_action_get_name (action),
+ gtk_action_get_name (action),
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+
+ gtk_ui_manager_add_ui (window->details->ui_manager,
+ merge_id,
+ POPUP_PATH_EXTENSION_ACTIONS,
+ gtk_action_get_name (action),
+ gtk_action_get_name (action),
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+
g_object_unref (item);
}
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index cc23de672..8ef9acef3 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -49,23 +49,20 @@ typedef enum {
/* FIXME bugzilla.gnome.org 42575: Migrate more fields into here. */
struct NautilusWindowDetails
{
- /* Bonobo. */
- BonoboUIContainer *ui_container;
- BonoboUIComponent *shell_ui;
- BonoboUIComponent *status_ui;
- gboolean updating_bonobo_state;
-
- int ui_change_depth;
- guint ui_idle_id;
- gboolean ui_is_frozen;
- gboolean ui_pending_initialize_menus_part_2;
-
+ GtkWidget *table;
+ GtkWidget *statusbar;
+ GtkWidget *menubar;
+
+ GtkUIManager *ui_manager;
+ GtkActionGroup *main_action_group; /* owned by ui_manager */
+ guint help_message_cid;
+
/* Menus. */
- guint refresh_go_menu_idle_id;
+ guint extensions_menu_merge_id;
+ GtkActionGroup *extensions_menu_action_group;
/* Current location. */
char *location;
- GList *selection;
char *title;
NautilusFile *viewed_file;
gboolean viewed_file_seen;
@@ -76,43 +73,55 @@ struct NautilusWindowDetails
char *pending_location;
char *pending_scroll_to;
GList *pending_selection;
- NautilusDetermineViewHandle *determine_view_handle;
- NautilusFile *pending_file_for_position;
+ NautilusFile *determine_view_file;
/* View As choices */
+ GtkActionGroup *view_as_action_group; /* owned by ui_manager */
+ GtkRadioAction *view_as_radio_action;
+ GtkRadioAction *extra_viewer_radio_action;
+ guint short_list_merge_id;
+ guint extra_viewer_merge_id;
GList *short_list_viewers;
- NautilusViewIdentifier *extra_viewer;
+ char *extra_viewer;
/* Deferred location change. */
char *location_to_change_to_at_idle;
guint location_change_at_idle_id;
- Nautilus_ShowHiddenFilesMode show_hidden_files_mode;
+ NautilusWindowShowHiddenFilesMode show_hidden_files_mode;
};
struct _NautilusNavigationWindowDetails {
GtkWidget *content_paned;
-
+ GtkActionGroup *navigation_action_group; /* owned by ui_manager */
+
/* Location bar */
gboolean temporary_navigation_bar;
/* Side Pane */
int side_pane_width;
- GtkWidget *current_side_panel;
+ NautilusSidebar *current_side_panel;
/* Menus */
+ GtkActionGroup *bookmarks_action_group;
guint refresh_bookmarks_menu_idle_id;
-
+ guint bookmarks_merge_id;
+
+ GtkActionGroup *go_menu_action_group;
+ guint refresh_go_menu_idle_id;
+ guint go_menu_merge_id;
+
/* Toolbar */
+ GtkWidget *toolbar;
GtkTooltips *tooltips;
+ GtkWidget *location_bar;
- GtkWidget *back_button_item;
- GtkWidget *forward_button_item;
-
+ guint extensions_toolbar_merge_id;
+ GtkActionGroup *extensions_toolbar_action_group;
+
/* Throbber */
- gboolean throbber_active;
- gboolean throbber_activating;
- Bonobo_PropertyBag throbber_property_bag;
+ gboolean throbber_active;
+ GtkWidget *throbber;
};
#define NAUTILUS_MENU_PATH_BACK_ITEM "/menu/Go/Back"
@@ -158,37 +167,27 @@ void nautilus_window_set_status (Nautil
const char *status);
void nautilus_window_load_view_as_menus (NautilusWindow *window);
void nautilus_window_load_extension_menus (NautilusWindow *window);
-void nautilus_window_initialize_menus_part_1 (NautilusWindow *window);
-void nautilus_window_initialize_menus_part_2 (NautilusWindow *window);
+void nautilus_window_initialize_menus (NautilusWindow *window);
void nautilus_menus_append_bookmark_to_menu (NautilusWindow *window,
- BonoboUIComponent *uic,
NautilusBookmark *bookmark,
const char *parent_path,
guint index_in_parent,
+ GtkActionGroup *action_group,
+ guint merge_id,
GCallback refresh_callback,
NautilusBookmarkFailedCallback failed_callback);
-
-void nautilus_window_handle_ui_event_callback (BonoboUIComponent *ui,
- const char *id,
- Bonobo_UIComponent_EventType type,
- const char *state,
- NautilusWindow *window);
#if NEW_UI_COMPLETE
void nautilus_window_go_up (NautilusWindow *window);
#endif
void nautilus_window_update_find_menu_item (NautilusWindow *window);
-void nautilus_window_remove_go_menu_callback (NautilusWindow *window);
-void nautilus_window_remove_go_menu_items (NautilusWindow *window);
-void nautilus_window_update_show_hide_menu_items (NautilusWindow *window);
void nautilus_window_zoom_in (NautilusWindow *window);
void nautilus_window_zoom_out (NautilusWindow *window);
void nautilus_window_zoom_to_level (NautilusWindow *window,
- float level);
-void nautilus_window_zoom_to_fit (NautilusWindow *window);
+ NautilusZoomLevel level);
+void nautilus_window_zoom_to_default (NautilusWindow *window);
void nautilus_window_show_view_as_dialog (NautilusWindow *window);
void nautilus_window_set_content_view_widget (NautilusWindow *window,
- NautilusViewFrame *content_view);
-Bonobo_UIContainer nautilus_window_get_ui_container (NautilusWindow *window);
+ NautilusView *content_view);
void nautilus_window_set_viewed_file (NautilusWindow *window,
NautilusFile *file);
void nautilus_send_history_list_changed (void);
@@ -197,15 +196,17 @@ void nautilus_remove_from_history_list_no_notify (const
GList * nautilus_get_history_list (void);
void nautilus_window_bookmarks_preference_changed_callback (gpointer user_data);
void nautilus_window_update_icon (NautilusWindow *window);
-
+void nautilus_window_constructed (NautilusWindow *window);
/* Navigation window menus */
-void nautilus_navigation_window_initialize_menus_part_1 (NautilusNavigationWindow *window);
-void nautilus_navigation_window_initialize_menus_part_2 (NautilusNavigationWindow *window);
+void nautilus_navigation_window_initialize_actions (NautilusNavigationWindow *window);
+void nautilus_navigation_window_initialize_menus (NautilusNavigationWindow *window);
void nautilus_navigation_window_remove_bookmarks_menu_callback (NautilusNavigationWindow *window);
void nautilus_navigation_window_remove_bookmarks_menu_items (NautilusNavigationWindow *window);
void nautilus_navigation_window_update_show_hide_menu_items (NautilusNavigationWindow *window);
+void nautilus_navigation_window_remove_go_menu_callback (NautilusNavigationWindow *window);
+void nautilus_navigation_window_remove_go_menu_items (NautilusNavigationWindow *window);
/* Navigation window toolbar */
void nautilus_navigation_window_activate_throbber (NautilusNavigationWindow *window);
@@ -216,4 +217,5 @@ void nautilus_navigation_window_set_throbber_active
void nautilus_navigation_window_go_back (NautilusNavigationWindow *window);
void nautilus_navigation_window_go_forward (NautilusNavigationWindow *window);
+
#endif /* NAUTILUS_WINDOW_PRIVATE_H */
diff --git a/src/nautilus-window-toolbars.c b/src/nautilus-window-toolbars.c
index a86142b81..083e7068e 100644
--- a/src/nautilus-window-toolbars.c
+++ b/src/nautilus-window-toolbars.c
@@ -33,12 +33,7 @@
#include "nautilus-window-manage-views.h"
#include "nautilus-window-private.h"
#include "nautilus-window.h"
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-property-bag.h>
-#include <bonobo/bonobo-property-bag-client.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-moniker-util.h>
-#include <bonobo/bonobo-ui-util.h>
+#include "nautilus-throbber.h"
#include <eel/eel-gnome-extensions.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-string.h>
@@ -48,9 +43,9 @@
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-popup-menu.h>
#include <libnautilus-extension/nautilus-menu-provider.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
#include <libnautilus-private/nautilus-bookmark.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-module.h>
#include <libnautilus-private/nautilus-theme.h>
@@ -63,239 +58,6 @@
#define TOOLBAR_PATH_EXTENSION_ACTIONS "/Toolbar/Extra Buttons Placeholder/Extension Actions"
-enum {
- TOOLBAR_ITEM_STYLE_PROP,
- TOOLBAR_ITEM_ORIENTATION_PROP
-};
-
-static void
-activate_back_or_forward_menu_item (GtkMenuItem *menu_item,
- NautilusNavigationWindow *window,
- gboolean back)
-{
- int index;
-
- g_assert (GTK_IS_MENU_ITEM (menu_item));
- g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
-
- index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "user_data"));
-
- nautilus_navigation_window_back_or_forward (window, back, index);
-}
-
-static void
-activate_back_menu_item_callback (GtkMenuItem *menu_item, NautilusNavigationWindow *window)
-{
- activate_back_or_forward_menu_item (menu_item, window, TRUE);
-}
-
-static void
-activate_forward_menu_item_callback (GtkMenuItem *menu_item, NautilusNavigationWindow *window)
-{
- activate_back_or_forward_menu_item (menu_item, window, FALSE);
-}
-
-static GtkMenu *
-create_back_or_forward_menu (NautilusNavigationWindow *window, gboolean back)
-{
- GtkMenu *menu;
- GtkWidget *menu_item;
- GList *list_link;
- int index;
-
- g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
-
- menu = GTK_MENU (gtk_menu_new ());
-
- list_link = back ? window->back_list : window->forward_list;
- index = 0;
- while (list_link != NULL)
- {
- menu_item = nautilus_bookmark_menu_item_new (NAUTILUS_BOOKMARK (list_link->data));
- g_object_set_data (G_OBJECT (menu_item), "user_data", GINT_TO_POINTER (index));
- gtk_widget_show (GTK_WIDGET (menu_item));
- g_signal_connect_object (menu_item, "activate",
- back
- ? G_CALLBACK (activate_back_menu_item_callback)
- : G_CALLBACK (activate_forward_menu_item_callback),
- window, 0);
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
- list_link = g_list_next (list_link);
- ++index;
- }
-
- return menu;
-}
-
-static GtkWidget *
-get_back_button (NautilusNavigationWindow *window)
-{
- return window->details->back_button_item;
-}
-
-static GtkWidget *
-get_forward_button (NautilusNavigationWindow *window)
-{
- return window->details->forward_button_item;
-}
-
-static void
-menu_position_under_widget (GtkMenu *menu, int *x, int *y,
- gboolean *push_in, gpointer user_data)
-{
- GtkWidget *w;
- int screen_width, screen_height;
- GtkRequisition requisition;
-
- w = GTK_WIDGET (user_data);
-
- gdk_window_get_origin (w->window, x, y);
- *x += w->allocation.x;
- *y += w->allocation.y + w->allocation.height;
-
- gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
-
- screen_width = gdk_screen_width ();
- screen_height = gdk_screen_height ();
-
- *x = CLAMP (*x, 0, MAX (0, screen_width - requisition.width));
- *y = CLAMP (*y, 0, MAX (0, screen_height - requisition.height));
-}
-
-static gboolean
-back_or_forward_button_pressed_callback (GtkWidget *widget,
- GdkEventButton *event,
- gpointer *user_data)
-{
- NautilusNavigationWindow *window;
- gboolean back;
-
- g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE);
- g_return_val_if_fail (NAUTILUS_IS_NAVIGATION_WINDOW (user_data), FALSE);
-
- window = NAUTILUS_NAVIGATION_WINDOW (user_data);
-
- back = widget == get_back_button (window);
- g_assert (back || widget == get_forward_button (window));
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
-
- gnome_popup_menu_do_popup_modal (GTK_WIDGET (create_back_or_forward_menu (NAUTILUS_NAVIGATION_WINDOW (user_data), back)),
- menu_position_under_widget, widget, event, widget, widget);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
-
- return TRUE;
-}
-
-static gboolean
-back_or_forward_key_pressed_callback (GtkWidget *widget,
- GdkEventKey *event,
- gpointer *user_data)
-{
- if (event->keyval == GDK_space ||
- event->keyval == GDK_KP_Space ||
- event->keyval == GDK_Return ||
- event->keyval == GDK_KP_Enter) {
- back_or_forward_button_pressed_callback (widget, NULL, user_data);
- }
-
- return FALSE;
-}
-
-static GtkWidget *
-create_back_or_forward_toolbar_item (NautilusNavigationWindow *window,
- const char *tooltip,
- const char *control_path)
-{
- GtkWidget *button;
-
- button = gtk_toggle_button_new ();
-
- gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-
- gtk_container_add (GTK_CONTAINER (button),
- gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT));
-
- gtk_widget_show_all (GTK_WIDGET (button));
-
- gtk_tooltips_set_tip (window->details->tooltips,
- GTK_WIDGET (button),
- tooltip, NULL);
-
- g_signal_connect_object (button, "key_press_event",
- G_CALLBACK (back_or_forward_key_pressed_callback),
- window, 0);
- g_signal_connect_object (button, "button_press_event",
- G_CALLBACK (back_or_forward_button_pressed_callback),
- window, 0);
-
- bonobo_ui_component_widget_set (NAUTILUS_WINDOW (window)->details->shell_ui,
- control_path,
- button,
- NULL);
-
- return button;
-}
-
-static void
-throbber_set_throbbing (NautilusNavigationWindow *window,
- gboolean throbbing)
-{
- CORBA_boolean b;
- CORBA_any val;
-
- val._type = TC_CORBA_boolean;
- val._value = &b;
- b = throbbing;
-
- bonobo_pbclient_set_value_async (
- window->details->throbber_property_bag,
- "throbbing", &val, NULL);
-}
-
-static void
-throbber_created_callback (Bonobo_Unknown throbber,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- char *exception_as_text;
- NautilusNavigationWindow *window;
-
- if (BONOBO_EX (ev)) {
- exception_as_text = bonobo_exception_get_text (ev);
- g_warning ("Throbber activation exception '%s'", exception_as_text);
- g_free (exception_as_text);
- return;
- }
-
- g_return_if_fail (NAUTILUS_IS_NAVIGATION_WINDOW (user_data));
-
- window = NAUTILUS_NAVIGATION_WINDOW (user_data);
-
- window->details->throbber_activating = FALSE;
-
- bonobo_ui_component_object_set (NAUTILUS_WINDOW (window)->details->shell_ui,
- "/Toolbar/ThrobberWrapper",
- throbber, ev);
- CORBA_exception_free (ev);
-
- window->details->throbber_property_bag =
- Bonobo_Control_getProperties (throbber, ev);
-
- if (BONOBO_EX (ev)) {
- window->details->throbber_property_bag = CORBA_OBJECT_NIL;
- CORBA_exception_free (ev);
- } else {
- throbber_set_throbbing (window, window->details->throbber_active);
- }
-
- bonobo_object_release_unref (throbber, ev);
-
- g_object_unref (window);
-}
-
void
nautilus_navigation_window_set_throbber_active (NautilusNavigationWindow *window,
gboolean allow)
@@ -305,81 +67,50 @@ nautilus_navigation_window_set_throbber_active (NautilusNavigationWindow *window
return;
}
- if (allow)
- access ("nautilus-throbber: start", 0);
- else
- access ("nautilus-throbber: stop", 0);
-
- nautilus_bonobo_set_sensitive (NAUTILUS_WINDOW (window)->details->shell_ui,
- NAUTILUS_COMMAND_STOP, allow);
-
window->details->throbber_active = allow;
- if (window->details->throbber_property_bag != CORBA_OBJECT_NIL) {
- throbber_set_throbbing (window, allow);
+ if (allow) {
+ nautilus_throbber_start (NAUTILUS_THROBBER (window->details->throbber));
+ } else {
+ nautilus_throbber_stop (NAUTILUS_THROBBER (window->details->throbber));
}
}
void
nautilus_navigation_window_activate_throbber (NautilusNavigationWindow *window)
{
- CORBA_Environment ev;
- char *exception_as_text;
+ GtkToolItem *item;
+ GtkWidget *throbber;
- if (window->details->throbber_activating ||
- window->details->throbber_property_bag != CORBA_OBJECT_NIL) {
+ if (window->details->throbber != NULL) {
return;
}
- /* FIXME bugzilla.gnome.org 41243:
- * We should use inheritance instead of these special cases
- * for the desktop window.
- */
- if (!NAUTILUS_IS_DESKTOP_WINDOW (window)) {
- CORBA_exception_init (&ev);
-
- g_object_ref (window);
- bonobo_get_object_async ("OAFIID:Nautilus_Throbber",
- "IDL:Bonobo/Control:1.0",
- &ev,
- throbber_created_callback,
- window);
-
- if (BONOBO_EX (&ev)) {
- exception_as_text = bonobo_exception_get_text (&ev);
- g_warning ("Throbber activation exception '%s'", exception_as_text);
- g_free (exception_as_text);
- }
- CORBA_exception_free (&ev);
- window->details->throbber_activating = TRUE;
- }
+ item = gtk_tool_item_new ();
+ gtk_widget_show (GTK_WIDGET (item));
+ gtk_tool_item_set_expand (item, TRUE);
+ gtk_toolbar_insert (GTK_TOOLBAR (window->details->toolbar),
+ item, -1);
+
+ throbber = nautilus_throbber_new ();
+ gtk_widget_show (GTK_WIDGET (throbber));
+
+ item = gtk_tool_item_new ();
+ gtk_container_add (GTK_CONTAINER (item), throbber);
+ gtk_widget_show (GTK_WIDGET (item));
+
+ gtk_toolbar_insert (GTK_TOOLBAR (window->details->toolbar),
+ item, -1);
+
+ window->details->throbber = throbber;
}
void
nautilus_navigation_window_initialize_toolbars (NautilusNavigationWindow *window)
{
- GtkWidget *space;
-
- nautilus_window_ui_freeze (NAUTILUS_WINDOW (window));
-
nautilus_navigation_window_activate_throbber (window);
-
- window->details->back_button_item = create_back_or_forward_toolbar_item
- (window, _("Go back a few pages"),
- "/Toolbar/BackMenu");
- window->details->forward_button_item = create_back_or_forward_toolbar_item
- (window, _("Go forward a number of pages"),
- "/Toolbar/ForwardMenu");
-
- space = gtk_event_box_new ();
- gtk_event_box_set_visible_window (GTK_EVENT_BOX (space), FALSE);
- bonobo_ui_component_widget_set (NAUTILUS_WINDOW (window)->details->shell_ui,
- "/Toolbar/SpaceWrapper",
- space,
- NULL);
-
- nautilus_window_ui_thaw (NAUTILUS_WINDOW (window));
}
+
static GList *
get_extension_toolbar_items (NautilusNavigationWindow *window)
{
@@ -410,27 +141,53 @@ get_extension_toolbar_items (NautilusNavigationWindow *window)
void
nautilus_navigation_window_load_extension_toolbar_items (NautilusNavigationWindow *window)
{
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ GtkUIManager *ui_manager;
GList *items;
GList *l;
+ NautilusMenuItem *item;
+ guint merge_id;
+
+ ui_manager = nautilus_window_get_ui_manager (NAUTILUS_WINDOW (window));
+ if (window->details->extensions_toolbar_merge_id != 0) {
+ gtk_ui_manager_remove_ui (ui_manager,
+ window->details->extensions_toolbar_merge_id);
+ window->details->extensions_toolbar_merge_id = 0;
+ }
+
+ if (window->details->extensions_toolbar_action_group != NULL) {
+ gtk_ui_manager_remove_action_group (ui_manager,
+ window->details->extensions_toolbar_action_group);
+ window->details->extensions_toolbar_action_group = NULL;
+ }
- nautilus_bonobo_remove_menu_items_and_commands
- (NAUTILUS_WINDOW (window)->details->shell_ui,
- TOOLBAR_PATH_EXTENSION_ACTIONS);
+ merge_id = gtk_ui_manager_new_merge_id (ui_manager);
+ window->details->extensions_toolbar_merge_id = merge_id;
+ action_group = gtk_action_group_new ("ExtensionsMenuGroup");
+ window->details->extensions_toolbar_action_group = action_group;
+ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ g_object_unref (action_group); /* owned by ui manager */
items = get_extension_toolbar_items (window);
for (l = items; l != NULL; l = l->next) {
- NautilusMenuItem *item;
-
item = NAUTILUS_MENU_ITEM (l->data);
- nautilus_bonobo_add_extension_item_command
- (NAUTILUS_WINDOW (window)->details->shell_ui, item);
+ action = nautilus_toolbar_action_from_menu_item (item);
+
+ gtk_action_group_add_action (action_group,
+ GTK_ACTION (action));
+ g_object_unref (action);
- nautilus_bonobo_add_extension_toolbar_item
- (NAUTILUS_WINDOW (window)->details->shell_ui,
- TOOLBAR_PATH_EXTENSION_ACTIONS,
- item);
+ gtk_ui_manager_add_ui (ui_manager,
+ merge_id,
+ TOOLBAR_PATH_EXTENSION_ACTIONS,
+ gtk_action_get_name (action),
+ gtk_action_get_name (action),
+ GTK_UI_MANAGER_TOOLITEM,
+ FALSE);
g_object_unref (item);
}
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 5ea1b672f..6cd1e8d77 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -3,7 +3,7 @@
/*
* Nautilus
*
- * Copyright (C) 1999, 2000 Red Hat, Inc.
+ * Copyright (C) 1999, 2000, 2004 Red Hat, Inc.
* Copyright (C) 1999, 2000, 2001 Eazel, Inc.
*
* Nautilus is free software; you can redistribute it and/or
@@ -22,7 +22,7 @@
*
* Authors: Elliot Lee <sopwith@redhat.com>
* John Sullivan <sullivan@eazel.com>
- *
+ * Alexander Larsson <alexl@redhat.com>
*/
/* nautilus-window.c: Implementation of the main window object */
@@ -30,18 +30,16 @@
#include <config.h>
#include "nautilus-window-private.h"
+#include "nautilus-actions.h"
#include "nautilus-application.h"
#include "nautilus-bookmarks-window.h"
#include "nautilus-information-panel.h"
#include "nautilus-main.h"
#include "nautilus-signaller.h"
-#include "nautilus-switchable-navigation-bar.h"
#include "nautilus-window-manage-views.h"
#include "nautilus-zoom-control.h"
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-property-bag-client.h>
-#include <bonobo/bonobo-ui-util.h>
#include <eel/eel-debug.h>
+#include <eel/eel-marshal.h>
#include <eel/eel-gdk-extensions.h>
#include <eel/eel-gdk-pixbuf-extensions.h>
#include <eel/eel-gtk-extensions.h>
@@ -51,6 +49,7 @@
#include <eel/eel-vfs-extensions.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkmenubar.h>
#include <gtk/gtkmenuitem.h>
@@ -65,8 +64,6 @@
#include <libgnomeui/gnome-window-icon.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
-#include <libnautilus-private/nautilus-bonobo-extensions.h>
-#include <libnautilus-private/nautilus-drag-window.h>
#include <libnautilus-private/nautilus-file-utilities.h>
#include <libnautilus-private/nautilus-file-attributes.h>
#include <libnautilus-private/nautilus-global-preferences.h>
@@ -75,11 +72,9 @@
#include <libnautilus-private/nautilus-metadata.h>
#include <libnautilus-private/nautilus-mime-actions.h>
#include <libnautilus-private/nautilus-program-choosing.h>
-#include <libnautilus-private/nautilus-sidebar-functions.h>
-#include <libnautilus-private/nautilus-view-query.h>
-#include <libnautilus/nautilus-bonobo-ui.h>
-#include <libnautilus/nautilus-clipboard.h>
-#include <libnautilus/nautilus-undo.h>
+#include <libnautilus-private/nautilus-view-factory.h>
+#include <libnautilus-private/nautilus-clipboard.h>
+#include <libnautilus-private/nautilus-undo.h>
#include <math.h>
#include <sys/time.h>
@@ -96,32 +91,39 @@
#define SIDE_PANE_MINIMUM_HEIGHT 400
/* dock items */
-#define LOCATION_BAR_PATH "/Location Bar"
-#define TOOLBAR_PATH "/Toolbar"
-#define STATUS_BAR_PATH "/status"
-#define MENU_BAR_PATH "/menu"
-
-#define COMMAND_PREFIX "/commands/"
-#define NAUTILUS_COMMAND_TOGGLE_FIND_MODE "/commands/Toggle Find Mode"
-#define NAUTILUS_COMMAND_VIEW_AS "/commands/View as"
-#define NAUTILUS_MENU_PATH_EXTRA_VIEWER_PLACEHOLDER "/menu/View/View Choices/Extra Viewer"
-#define NAUTILUS_MENU_PATH_BEFORE_SHORT_LIST_SEPARATOR "/menu/View/View Choices/Before Short List"
-#define NAUTILUS_MENU_PATH_SHORT_LIST_PLACEHOLDER "/menu/View/View Choices/Short List"
-#define NAUTILUS_MENU_PATH_AFTER_SHORT_LIST_SEPARATOR "/menu/View/View Choices/After Short List"
+#define NAUTILUS_MENU_PATH_EXTRA_VIEWER_PLACEHOLDER "/MenuBar/View/View Choices/Extra Viewer"
+#define NAUTILUS_MENU_PATH_SHORT_LIST_PLACEHOLDER "/MenuBar/View/View Choices/Short List"
+#define NAUTILUS_MENU_PATH_AFTER_SHORT_LIST_SEPARATOR "/MenuBar/View/View Choices/After Short List"
enum {
ARG_0,
- ARG_APP_ID,
ARG_APP
};
-static void cancel_view_as_callback (NautilusWindow *window);
+enum {
+ GO_UP,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+typedef struct {
+ NautilusWindow *window;
+ char *id;
+} ActivateViewData;
+
+static void cancel_view_as_callback (NautilusWindow *window);
+static void nautilus_window_info_iface_init (NautilusWindowInfoIface *iface);
+static void action_view_as_callback (GtkAction *action,
+ ActivateViewData *data);
static GList *history_list;
-GNOME_CLASS_BOILERPLATE (NautilusWindow, nautilus_window,
- BonoboWindow, BONOBO_TYPE_WINDOW)
+G_DEFINE_TYPE_WITH_CODE (NautilusWindow, nautilus_window, GTK_TYPE_WINDOW,
+ G_IMPLEMENT_INTERFACE (NAUTILUS_TYPE_WINDOW_INFO,
+ nautilus_window_info_iface_init));
+
static void
set_up_default_icon_list (void)
@@ -162,25 +164,50 @@ icons_changed_callback (GObject *factory, NautilusWindow *window)
}
static void
-nautilus_window_instance_init (NautilusWindow *window)
+nautilus_window_init (NautilusWindow *window)
{
+ GtkWidget *table;
+ GtkWidget *menu;
+ GtkWidget *statusbar;
+
window->details = g_new0 (NautilusWindowDetails, 1);
- window->details->show_hidden_files_mode = Nautilus_SHOW_HIDDEN_FILES_DEFAULT;
+ window->details->show_hidden_files_mode = NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT;
- /* CORBA and Bonobo setup, which must be done before the location bar setup */
- window->details->ui_container = bonobo_window_get_ui_container (BONOBO_WINDOW (window));
- bonobo_object_ref (window->details->ui_container);
-
/* Set initial window title */
gtk_window_set_title (GTK_WINDOW (window), _("Nautilus"));
- window->details->shell_ui = bonobo_ui_component_new ("Nautilus Shell");
- bonobo_ui_component_set_container
- (window->details->shell_ui,
- nautilus_window_get_ui_container (window),
- NULL);
+ table = gtk_table_new (1, 5, FALSE);
+ window->details->table = table;
+ gtk_widget_show (table);
+ gtk_container_add (GTK_CONTAINER (window), table);
+
+
+ statusbar = gtk_statusbar_new ();
+ window->details->statusbar = statusbar;
+ gtk_table_attach (GTK_TABLE (table),
+ statusbar,
+ /* X direction */ /* Y direction */
+ 0, 1, 4, 5,
+ GTK_EXPAND | GTK_FILL, 0,
+ 0, 0);
+ window->details->help_message_cid = gtk_statusbar_get_context_id
+ (GTK_STATUSBAR (statusbar), "help_message");
+ gtk_widget_show (statusbar);
+
+ nautilus_window_initialize_menus (window);
+
+ menu = gtk_ui_manager_get_widget (window->details->ui_manager, "/MenuBar");
+ window->details->menubar = menu;
+ gtk_widget_show (menu);
+ gtk_table_attach (GTK_TABLE (table),
+ menu,
+ /* X direction */ /* Y direction */
+ 0, 1, 0, 1,
+ GTK_EXPAND | GTK_FILL, 0,
+ 0, 0);
+
/* Register IconFactory callback to update the window border icon
* when the icon-theme is changed.
*/
@@ -188,144 +215,19 @@ nautilus_window_instance_init (NautilusWindow *window)
G_CALLBACK (icons_changed_callback), window,
0);
- /* Create a separate component so when we remove the status
- * we don't loose the status bar
- */
- window->details->status_ui = bonobo_ui_component_new ("Status Component");
- bonobo_ui_component_set_container
- (window->details->status_ui,
- nautilus_window_get_ui_container (window),
- NULL);
-
gtk_quit_add_destroy (1, GTK_OBJECT (window));
/* Keep the main event loop alive as long as the window exists */
nautilus_main_event_loop_register (GTK_OBJECT (window));
-}
-
-static gint
-ui_idle_handler (gpointer data)
-{
- NautilusWindow *window;
- gboolean old_updating_bonobo_state;
-
- window = data;
-
- g_assert (NAUTILUS_IS_WINDOW (window));
- g_object_ref (data);
-
- g_assert (window->details->ui_change_depth == 0);
-
- /* Simulate an extra freeze/thaw so that calling window_ui_freeze
- * and thaw from within the idle handler doesn't try to remove it
- * (the already running idle handler)
- */
- window->details->ui_change_depth++;
- old_updating_bonobo_state = window->details->updating_bonobo_state;
-
- if (window->details->ui_pending_initialize_menus_part_2) {
- EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
- merge_menus_2, (window));
- }
-
- if (window->details->ui_is_frozen) {
- window->details->updating_bonobo_state = TRUE;
- bonobo_ui_engine_thaw (bonobo_ui_container_get_engine (window->details->ui_container));
- window->details->ui_is_frozen = FALSE;
- window->details->updating_bonobo_state = old_updating_bonobo_state;
- }
-
- window->details->ui_change_depth--;
-
- window->details->ui_idle_id = 0;
-
- g_object_unref (data);
-
- return FALSE;
-}
-static inline void
-ui_install_idle_handler (NautilusWindow *window)
-{
- if (window->details->ui_idle_id == 0) {
- window->details->ui_idle_id = g_idle_add_full (G_PRIORITY_LOW, ui_idle_handler, window, NULL);
- }
-}
-
-static inline void
-ui_remove_idle_handler (NautilusWindow *window)
-{
- if (window->details->ui_idle_id != 0) {
- g_source_remove (window->details->ui_idle_id);
- window->details->ui_idle_id = 0;
- }
-}
-
-/* Register that BonoboUI changes are going to be made to WINDOW. The UI
- * won't actually be synchronised until some arbitrary date in the future.
- */
-void
-nautilus_window_ui_freeze (NautilusWindow *window)
-{
- g_object_ref (window);
-
- if (window->details->ui_change_depth == 0) {
- ui_remove_idle_handler (window);
- }
-
- if (!window->details->ui_is_frozen) {
- bonobo_ui_engine_freeze (bonobo_ui_container_get_engine (window->details->ui_container));
- window->details->ui_is_frozen = TRUE;
- }
-
- window->details->ui_change_depth++;
-}
-
-/* Register that the BonoboUI changes for WINDOW have finished. There _must_
- * be one and only one call to this function for every call to
- * starting_ui_change ()
- */
-void
-nautilus_window_ui_thaw (NautilusWindow *window)
-{
- window->details->ui_change_depth--;
-
- g_assert (window->details->ui_change_depth >= 0);
-
- if (window->details->ui_change_depth == 0
- && (window->details->ui_is_frozen
- || window->details->ui_pending_initialize_menus_part_2)) {
- ui_install_idle_handler (window);
- }
-
- g_object_unref (window);
+ nautilus_window_allow_stop (window, FALSE);
}
-/* Unconditionally synchronize the BonoboUI of WINDOW. */
+/* Unconditionally synchronize the GtkUIManager of WINDOW. */
static void
nautilus_window_ui_update (NautilusWindow *window)
{
- BonoboUIEngine *engine;
- gboolean old_updating_bonobo_state;
-
- engine = bonobo_ui_container_get_engine (window->details->ui_container);
- old_updating_bonobo_state = window->details->updating_bonobo_state;
-
- window->details->updating_bonobo_state = TRUE;
- if (window->details->ui_is_frozen) {
- bonobo_ui_engine_thaw (engine);
- if (window->details->ui_change_depth == 0) {
- window->details->ui_is_frozen = FALSE;
- if (!window->details->ui_pending_initialize_menus_part_2) {
- ui_remove_idle_handler (window);
- }
- } else {
- bonobo_ui_engine_freeze (engine);
- }
- } else {
- bonobo_ui_engine_update (engine);
- }
- window->details->updating_bonobo_state = old_updating_bonobo_state;
+ gtk_ui_manager_ensure_update (window->details->ui_manager);
}
static gboolean
@@ -335,7 +237,7 @@ nautilus_window_clear_status (gpointer callback_data)
window = NAUTILUS_WINDOW (callback_data);
- bonobo_ui_component_set_status (window->details->status_ui, NULL, NULL);
+ gtk_statusbar_pop (GTK_STATUSBAR (window->details->statusbar), 0); /* clear any previous message, underflow is allowed */
return FALSE;
}
@@ -344,7 +246,7 @@ void
nautilus_window_set_status (NautilusWindow *window, const char *text)
{
if (text != NULL && text[0] != '\0') {
- bonobo_ui_component_set_status (window->details->status_ui, text, NULL);
+ gtk_statusbar_push (GTK_STATUSBAR (window->details->statusbar), 0, text);
} else {
nautilus_window_clear_status (window);
}
@@ -356,12 +258,22 @@ nautilus_window_go_to (NautilusWindow *window, const char *uri)
nautilus_window_open_location (window, uri, FALSE);
}
+
void
nautilus_window_go_to_with_selection (NautilusWindow *window, const char *uri, GList *new_selection)
{
nautilus_window_open_location_with_selection (window, uri, new_selection, FALSE);
}
+static gboolean
+nautilus_window_go_up_signal (NautilusWindow *window, gboolean close_behind)
+{
+ nautilus_window_go_up (window, close_behind);
+ return TRUE;
+}
+
+
+
void
nautilus_window_go_up (NautilusWindow *window, gboolean close_behind)
{
@@ -379,7 +291,6 @@ nautilus_window_go_up (NautilusWindow *window, gboolean close_behind)
gnome_vfs_uri_unref (current_uri);
if (parent_uri == NULL) {
- g_warning ("Can't go Up from here. The UI should have prevented us from getting this far.");
return;
}
@@ -397,43 +308,44 @@ nautilus_window_go_up (NautilusWindow *window, gboolean close_behind)
void
nautilus_window_allow_up (NautilusWindow *window, gboolean allow)
{
+ GtkAction *action;
+
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- nautilus_window_ui_freeze (window);
-
- nautilus_bonobo_set_sensitive (window->details->shell_ui,
- NAUTILUS_COMMAND_UP, allow);
-
- nautilus_window_ui_thaw (window);
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_UP);
+ gtk_action_set_sensitive (action, allow);
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_UP_ACCEL);
+ gtk_action_set_sensitive (action, allow);
}
void
nautilus_window_allow_stop (NautilusWindow *window, gboolean allow)
{
+ GtkAction *action;
+
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- nautilus_window_ui_freeze (window);
-
- nautilus_bonobo_set_sensitive (window->details->shell_ui,
- NAUTILUS_COMMAND_STOP, allow);
-
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_STOP);
+ gtk_action_set_sensitive (action, allow);
+
EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
set_throbber_active, (window, allow));
-
- nautilus_window_ui_thaw (window);
}
void
nautilus_window_allow_reload (NautilusWindow *window, gboolean allow)
{
+ GtkAction *action;
+
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- nautilus_window_ui_freeze (window);
-
- nautilus_bonobo_set_sensitive (window->details->shell_ui,
- NAUTILUS_COMMAND_RELOAD, allow);
+ action = gtk_action_group_get_action (window->details->main_action_group,
+ NAUTILUS_ACTION_RELOAD);
+ gtk_action_set_sensitive (action, allow);
- nautilus_window_ui_thaw (window);
}
void
@@ -441,19 +353,7 @@ nautilus_window_go_home (NautilusWindow *window)
{
char *home_uri;
-#if !NEW_UI_COMPLETE
- /* Hrm, this probably belongs in any location switch, not
- * just when going home. */
- if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
- nautilus_navigation_window_set_search_mode (NAUTILUS_NAVIGATION_WINDOW (window), FALSE);
- }
-#endif
-
-#ifdef WEB_NAVIGATION_ENABLED
- home_uri = eel_preferences_get (NAUTILUS_PREFERENCES_HOME_URI);
-#else
home_uri = gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
-#endif
g_assert (home_uri != NULL);
nautilus_window_go_to (window, home_uri);
@@ -481,15 +381,16 @@ void
nautilus_window_zoom_in (NautilusWindow *window)
{
if (window->content_view != NULL) {
- nautilus_view_frame_zoom_in (window->content_view);
+ nautilus_view_bump_zoom_level (window->content_view, 1);
}
}
void
-nautilus_window_zoom_to_level (NautilusWindow *window, float level)
+nautilus_window_zoom_to_level (NautilusWindow *window,
+ NautilusZoomLevel level)
{
if (window->content_view != NULL) {
- nautilus_view_frame_set_zoom_level (window->content_view, level);
+ nautilus_view_zoom_to_level (window->content_view, level);
}
}
@@ -497,15 +398,15 @@ void
nautilus_window_zoom_out (NautilusWindow *window)
{
if (window->content_view != NULL) {
- nautilus_view_frame_zoom_out (window->content_view);
+ nautilus_view_bump_zoom_level (window->content_view, -1);
}
}
void
-nautilus_window_zoom_to_fit (NautilusWindow *window)
+nautilus_window_zoom_to_default (NautilusWindow *window)
{
if (window->content_view != NULL) {
- nautilus_view_frame_zoom_to_fit (window->content_view);
+ nautilus_view_restore_default_zoom_level (window->content_view);
}
}
@@ -527,8 +428,12 @@ get_max_forced_width (GdkScreen *screen)
return (gdk_screen_get_width (screen) * 90) / 100;
}
+/* This must be called when construction of NautilusWindow is finished,
+ * since it depends on the type of the argument, which isn't decided at
+ * construction time.
+ */
static void
-set_initial_window_geometry (NautilusWindow *window)
+nautilus_window_set_initial_window_geometry (NautilusWindow *window)
{
GdkScreen *screen;
guint max_width_for_screen, max_height_for_screen, min_width, min_height;
@@ -568,10 +473,10 @@ set_initial_window_geometry (NautilusWindow *window)
max_width_for_screen),
MIN (min_height,
max_height_for_screen));
-
+
EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
get_default_size, (window, &default_width, &default_height));
-
+
gtk_window_set_default_size (GTK_WINDOW (window),
MIN (default_width,
max_width_for_screen),
@@ -579,82 +484,24 @@ set_initial_window_geometry (NautilusWindow *window)
max_height_for_screen));
}
-static void
-real_merge_menus (NautilusWindow *window)
-{
- /* Load the user interface from the XML file. */
- bonobo_ui_util_set_ui (window->details->shell_ui,
- DATADIR,
- "nautilus-shell-ui.xml",
- "nautilus", NULL);
-
-
- bonobo_ui_component_freeze (window->details->shell_ui, NULL);
-
- bonobo_ui_component_thaw (window->details->shell_ui, NULL);
-
- /* initalize the menus and toolbars */
- nautilus_window_initialize_menus_part_1 (window);
-
- /* We'll do the second part later (bookmarks and go menus) */
- window->details->ui_pending_initialize_menus_part_2 = TRUE;
-}
-
-static void
-real_merge_menus_2 (NautilusWindow *window)
-{
- window->details->ui_pending_initialize_menus_part_2 = FALSE;
-}
-
-static void
+void
nautilus_window_constructed (NautilusWindow *window)
{
- nautilus_window_ui_freeze (window);
-
- set_initial_window_geometry (window);
-
- EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
- merge_menus, (window));
-
- nautilus_window_allow_stop (window, FALSE);
-
- /* Set up undo manager */
- nautilus_undo_manager_attach (window->application->undo_manager, G_OBJECT (window));
-
- /* Register that things may be dragged from this window */
- nautilus_drag_window_register (GTK_WINDOW (window));
-
- nautilus_window_ui_thaw (window);
+ nautilus_window_set_initial_window_geometry (window);
+ nautilus_undo_manager_attach (window->application->undo_manager, G_OBJECT (window));
}
static void
nautilus_window_set_property (GObject *object,
guint arg_id,
- const GValue *value,
+ const GValue *value,
GParamSpec *pspec)
{
- char *old_name;
NautilusWindow *window;
window = NAUTILUS_WINDOW (object);
switch (arg_id) {
- case ARG_APP_ID:
- if (g_value_get_string (value) == NULL) {
- return;
- }
- old_name = bonobo_window_get_name (BONOBO_WINDOW (window));
- bonobo_window_set_name (BONOBO_WINDOW (window), g_value_get_string (value));
- /* This hack of using the time when the name first
- * goes non-NULL to be window-constructed time is
- * completely lame. But it works, so for now we leave
- * it alone.
- */
- if (old_name == NULL) {
- nautilus_window_constructed (window);
- }
- g_free (old_name);
- break;
case ARG_APP:
window->application = NAUTILUS_APPLICATION (g_value_get_object (value));
break;
@@ -668,11 +515,6 @@ nautilus_window_get_property (GObject *object,
GParamSpec *pspec)
{
switch (arg_id) {
- case ARG_APP_ID:
- g_value_set_string_take_ownership (
- value,
- bonobo_window_get_name (BONOBO_WINDOW (object)));
- break;
case ARG_APP:
g_value_set_object (value, NAUTILUS_WINDOW (object)->application);
break;
@@ -683,10 +525,10 @@ static void
free_stored_viewers (NautilusWindow *window)
{
eel_g_list_free_deep_custom (window->details->short_list_viewers,
- (GFunc) nautilus_view_identifier_free,
+ (GFunc) g_free,
NULL);
window->details->short_list_viewers = NULL;
- nautilus_view_identifier_free (window->details->extra_viewer);
+ g_free (window->details->extra_viewer);
window->details->extra_viewer = NULL;
}
@@ -700,11 +542,11 @@ nautilus_window_destroy (GtkObject *object)
nautilus_window_manage_views_destroy (window);
if (window->content_view) {
- gtk_object_destroy (GTK_OBJECT (window->content_view));
+ g_object_unref (window->content_view);
window->content_view = NULL;
}
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
+ GTK_OBJECT_CLASS (nautilus_window_parent_class)->destroy (object);
}
static void
@@ -717,30 +559,12 @@ nautilus_window_finalize (GObject *object)
nautilus_window_manage_views_finalize (window);
nautilus_window_set_viewed_file (window, NULL);
- nautilus_window_remove_go_menu_callback (window);
-
- if (window->details->ui_idle_id != 0) {
- g_source_remove (window->details->ui_idle_id);
- }
-
- if (window->details->shell_ui != NULL) {
- bonobo_ui_component_unset_container (window->details->shell_ui, NULL);
- bonobo_object_unref (window->details->shell_ui);
- window->details->shell_ui = NULL;
- }
-
- if (window->details->status_ui != NULL) {
- bonobo_ui_component_unset_container (window->details->status_ui, NULL);
- bonobo_object_unref (window->details->status_ui);
- window->details->status_ui = NULL;
- }
nautilus_file_unref (window->details->viewed_file);
free_stored_viewers (window);
g_free (window->details->location);
- eel_g_list_free_deep (window->details->selection);
eel_g_list_free_deep (window->details->pending_selection);
if (window->current_location_bookmark != NULL) {
@@ -750,7 +574,7 @@ nautilus_window_finalize (GObject *object)
g_object_unref (window->last_location_bookmark);
}
- bonobo_object_unref (window->details->ui_container);
+ g_object_unref (window->details->ui_manager);
if (window->details->location_change_at_idle_id != 0) {
g_source_remove (window->details->location_change_at_idle_id);
@@ -760,7 +584,7 @@ nautilus_window_finalize (GObject *object)
g_free (window->details);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (nautilus_window_parent_class)->finalize (object);
}
void
@@ -785,7 +609,7 @@ nautilus_window_size_request (GtkWidget *widget,
g_assert (NAUTILUS_IS_WINDOW (widget));
g_assert (requisition != NULL);
- GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
+ GTK_WIDGET_CLASS (nautilus_window_parent_class)->size_request (widget, requisition);
screen = gtk_window_get_screen (GTK_WINDOW (widget));
@@ -820,83 +644,86 @@ nautilus_window_size_request (GtkWidget *widget,
*/
static void
-activate_nth_short_list_item (NautilusWindow *window, guint index)
+free_activate_view_data (gpointer data)
{
- g_assert (NAUTILUS_IS_WINDOW (window));
- g_assert (index < g_list_length (window->details->short_list_viewers));
+ ActivateViewData *activate_data;
- nautilus_window_set_content_view (window,
- g_list_nth_data (window->details->short_list_viewers, index));
-}
+ activate_data = data;
-static void
-activate_extra_viewer (NautilusWindow *window)
-{
- g_assert (NAUTILUS_IS_WINDOW (window));
- g_assert (window->details->extra_viewer != NULL);
-
- nautilus_window_set_content_view (window, window->details->extra_viewer);
+ g_free (activate_data->id);
+ g_free (activate_data);
}
static void
-handle_view_as_item_from_bonobo_menu (NautilusWindow *window, const char *id)
+action_view_as_callback (GtkAction *action,
+ ActivateViewData *data)
{
- char *container_path;
-
- container_path = nautilus_bonobo_get_numbered_menu_item_container_path_from_command (id);
-
- if (eel_strcmp (container_path, NAUTILUS_MENU_PATH_SHORT_LIST_PLACEHOLDER) == 0) {
- activate_nth_short_list_item
- (window,
- nautilus_bonobo_get_numbered_menu_item_index_from_command (id));
- } else if (eel_strcmp (container_path, NAUTILUS_MENU_PATH_EXTRA_VIEWER_PLACEHOLDER) == 0) {
- g_return_if_fail
- (nautilus_bonobo_get_numbered_menu_item_index_from_command (id) == 0);
- activate_extra_viewer (window);
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
+ nautilus_window_set_content_view (data->window,
+ data->id);
}
-
- g_free (container_path);
}
-void
-nautilus_window_handle_ui_event_callback (BonoboUIComponent *ui,
- const char *id,
- Bonobo_UIComponent_EventType type,
- const char *state,
- NautilusWindow *window)
-{
- if (!window->details->updating_bonobo_state
- && type == Bonobo_UIComponent_STATE_CHANGED
- && strcmp (state, "1") == 0) {
- handle_view_as_item_from_bonobo_menu (window, id);
- }
-}
-
-static void
-add_view_as_bonobo_menu_item (NautilusWindow *window,
- const char *placeholder_path,
- NautilusViewIdentifier *identifier,
- int index)
+static GtkRadioAction *
+add_view_as_menu_item (NautilusWindow *window,
+ const char *placeholder_path,
+ const char *identifier,
+ int index, /* extra_viewer is always index 0 */
+ guint merge_id)
{
char *tip;
- char *item_path;
+ const NautilusViewInfo *info;
+ char *label;
+ GtkRadioAction *action;
+ char *action_name;
+ ActivateViewData *data;
- nautilus_bonobo_add_numbered_radio_menu_item
- (window->details->shell_ui,
- placeholder_path,
- index,
- identifier->view_as_label_with_mnemonic,
- "viewers group");
+ info = nautilus_view_factory_lookup (identifier);
+ label = g_strdup_printf (_("View as %s"), _(info->label_with_mnemonic));
tip = g_strdup_printf (_("Display this location with \"%s\""),
- identifier->viewer_label);
- item_path = nautilus_bonobo_get_numbered_menu_item_path
- (window->details->shell_ui,
- placeholder_path,
- index);
- nautilus_bonobo_set_tip (window->details->shell_ui, item_path, tip);
- g_free (item_path);
+ _(info->label));
+
+ action_name = g_strdup_printf ("view_as_%d", index);
+ action = gtk_radio_action_new (action_name,
+ label,
+ tip,
+ NULL,
+ 0);
+
+ if (window->details->view_as_radio_action != NULL) {
+ gtk_radio_action_set_group (action,
+ gtk_radio_action_get_group (window->details->view_as_radio_action));
+ } else if (index != 0) {
+ /* Index 0 is the extra view, and we don't want to use that here,
+ as it can get deleted/changed later */
+ window->details->view_as_radio_action = action;
+ }
+
+ g_free (label);
g_free (tip);
+
+ data = g_new (ActivateViewData, 1);
+ data->window = window;
+ data->id = g_strdup (identifier);
+ g_signal_connect_data (action, "activate",
+ G_CALLBACK (action_view_as_callback),
+ data, (GClosureNotify) free_activate_view_data, 0);
+
+ gtk_action_group_add_action (window->details->view_as_action_group,
+ GTK_ACTION (action));
+ g_object_unref (action);
+
+ gtk_ui_manager_add_ui (window->details->ui_manager,
+ merge_id,
+ placeholder_path,
+ action_name,
+ action_name,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+ g_free (action_name);
+
+ return action; /* return value owned by group */
}
/* Make a special first item in the "View as" option menu that represents
@@ -905,7 +732,7 @@ add_view_as_bonobo_menu_item (NautilusWindow *window,
*/
static void
update_extra_viewer_in_view_as_menus (NautilusWindow *window,
- const NautilusViewIdentifier *id)
+ const char *id)
{
gboolean had_extra_viewer;
@@ -917,22 +744,33 @@ update_extra_viewer_in_view_as_menus (NautilusWindow *window,
}
} else {
if (had_extra_viewer
- && nautilus_view_identifier_compare (window->details->extra_viewer, id) == 0) {
+ && strcmp (window->details->extra_viewer, id) == 0) {
return;
}
}
- nautilus_view_identifier_free (window->details->extra_viewer);
- window->details->extra_viewer = nautilus_view_identifier_copy (id);
+ g_free (window->details->extra_viewer);
+ window->details->extra_viewer = g_strdup (id);
- /* Also update the Bonobo View menu item */
- if (id == NULL) {
- nautilus_bonobo_remove_menu_items_and_commands
- (window->details->shell_ui, NAUTILUS_MENU_PATH_EXTRA_VIEWER_PLACEHOLDER);
- } else {
- add_view_as_bonobo_menu_item (window,
- NAUTILUS_MENU_PATH_EXTRA_VIEWER_PLACEHOLDER,
- window->details->extra_viewer,
- 0);
+ if (window->details->extra_viewer_merge_id != 0) {
+ gtk_ui_manager_remove_ui (window->details->ui_manager,
+ window->details->extra_viewer_merge_id);
+ window->details->extra_viewer_merge_id = 0;
+ }
+
+ if (window->details->extra_viewer_radio_action != NULL) {
+ gtk_action_group_remove_action (window->details->view_as_action_group,
+ GTK_ACTION (window->details->extra_viewer_radio_action));
+ window->details->extra_viewer_radio_action = NULL;
+ }
+
+ if (id != NULL) {
+ window->details->extra_viewer_merge_id = gtk_ui_manager_new_merge_id (window->details->ui_manager);
+ window->details->extra_viewer_radio_action =
+ add_view_as_menu_item (window,
+ NAUTILUS_MENU_PATH_EXTRA_VIEWER_PLACEHOLDER,
+ window->details->extra_viewer,
+ 0,
+ window->details->extra_viewer_merge_id);
}
}
@@ -945,11 +783,10 @@ remove_extra_viewer_in_view_as_menus (NautilusWindow *window)
static void
replace_extra_viewer_in_view_as_menus (NautilusWindow *window)
{
- NautilusViewIdentifier *id;
+ const char *id;
id = nautilus_window_get_content_view_id (window);
update_extra_viewer_in_view_as_menus (window, id);
- nautilus_view_identifier_free (id);
}
/**
@@ -965,60 +802,66 @@ static void
nautilus_window_synch_view_as_menus (NautilusWindow *window)
{
int index;
- char *verb_name, *command_path;
+ char *action_name;
GList *node;
- const char *numbered_menu_item_container_path;
+ GtkAction *action;
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
if (window->content_view == NULL) {
return;
}
-
- for (node = window->details->short_list_viewers, index = 0;
+ for (node = window->details->short_list_viewers, index = 1;
node != NULL;
node = node->next, ++index) {
- if (nautilus_window_content_view_matches_iid (window, ((NautilusViewIdentifier *)node->data)->iid)) {
+ if (nautilus_window_content_view_matches_iid (window, (char *)node->data)) {
break;
}
}
if (node == NULL) {
replace_extra_viewer_in_view_as_menus (window);
index = 0;
- numbered_menu_item_container_path = NAUTILUS_MENU_PATH_EXTRA_VIEWER_PLACEHOLDER;
} else {
remove_extra_viewer_in_view_as_menus (window);
- numbered_menu_item_container_path = NAUTILUS_MENU_PATH_SHORT_LIST_PLACEHOLDER;
}
- g_assert (numbered_menu_item_container_path != NULL);
-
- /* Make View menu in menu bar mark the right item */
- verb_name = nautilus_bonobo_get_numbered_menu_item_command
- (window->details->shell_ui,
- numbered_menu_item_container_path, index);
- command_path = g_strconcat (COMMAND_PREFIX, verb_name, NULL);
- nautilus_bonobo_set_toggle_state (window->details->shell_ui, command_path, TRUE);
- g_free (command_path);
- g_free (verb_name);
+ action_name = g_strdup_printf ("view_as_%d", index);
+ action = gtk_action_group_get_action (window->details->view_as_action_group,
+ action_name);
+ g_free (action_name);
+
+ /* Don't trigger the action callback when we're synchronizing */
+ g_signal_handlers_block_matched (action,
+ G_SIGNAL_MATCH_FUNC,
+ 0, 0,
+ NULL,
+ action_view_as_callback,
+ NULL);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+ g_signal_handlers_unblock_matched (action,
+ G_SIGNAL_MATCH_FUNC,
+ 0, 0,
+ NULL,
+ action_view_as_callback,
+ NULL);
}
static void
refresh_stored_viewers (NautilusWindow *window)
{
- GList *components, *node, *viewers;
- NautilusViewIdentifier *identifier;
+ GList *viewers;
+ char *uri, *mimetype;
- components = nautilus_view_query_get_components_for_file (window->details->viewed_file);
- viewers = NULL;
- for (node = components; node != NULL; node = node->next) {
- identifier = nautilus_view_identifier_new_from_content_view (node->data);
- viewers = g_list_prepend (viewers, identifier);
- }
- gnome_vfs_mime_component_list_free (components);
+ uri = nautilus_file_get_uri (window->details->viewed_file);
+ mimetype = nautilus_file_get_mime_type (window->details->viewed_file);
+ viewers = nautilus_view_factory_get_views_for_uri (uri,
+ nautilus_file_get_file_type (window->details->viewed_file),
+ mimetype);
+ g_free (uri);
+ g_free (mimetype);
free_stored_viewers (window);
- window->details->short_list_viewers = g_list_reverse (viewers);
+ window->details->short_list_viewers = viewers;
}
static void
@@ -1026,33 +869,56 @@ real_load_view_as_menu (NautilusWindow *window)
{
GList *node;
int index;
+ guint merge_id;
+
+ if (window->details->short_list_merge_id != 0) {
+ gtk_ui_manager_remove_ui (window->details->ui_manager,
+ window->details->short_list_merge_id);
+ window->details->short_list_merge_id = 0;
+ }
+ if (window->details->view_as_action_group != NULL) {
+ gtk_ui_manager_remove_action_group (window->details->ui_manager,
+ window->details->view_as_action_group);
+ window->details->view_as_action_group = NULL;
+ }
- /* Clear out the menu items created last time. For the option menu, we need do
- * nothing since we replace the entire menu. For the View menu, we have
- * to do this explicitly.
- */
- nautilus_bonobo_remove_menu_items_and_commands
- (window->details->shell_ui, NAUTILUS_MENU_PATH_SHORT_LIST_PLACEHOLDER);
- nautilus_bonobo_remove_menu_items_and_commands
- (window->details->shell_ui, NAUTILUS_MENU_PATH_EXTRA_VIEWER_PLACEHOLDER);
-
+ if (window->details->extra_viewer_merge_id != 0) {
+ gtk_ui_manager_remove_ui (window->details->ui_manager,
+ window->details->extra_viewer_merge_id);
+ window->details->extra_viewer_merge_id = 0;
+ }
+ if (window->details->extra_viewer_radio_action != NULL) {
+ gtk_action_group_remove_action (window->details->view_as_action_group,
+ GTK_ACTION (window->details->extra_viewer_radio_action));
+ window->details->extra_viewer_radio_action = NULL;
+ }
+ g_free (window->details->extra_viewer);
+ window->details->extra_viewer = NULL;
+
refresh_stored_viewers (window);
-
+ merge_id = gtk_ui_manager_new_merge_id (window->details->ui_manager);
+ window->details->short_list_merge_id = merge_id;
+ window->details->view_as_action_group = gtk_action_group_new ("ViewAsGroup");
+ gtk_action_group_set_translation_domain (window->details->view_as_action_group, GETTEXT_PACKAGE);
+ window->details->view_as_radio_action = NULL;
+
/* Add a menu item for each view in the preferred list for this location. */
- for (node = window->details->short_list_viewers, index = 0;
+ /* Start on 1, because extra_viewer gets index 0 */
+ for (node = window->details->short_list_viewers, index = 1;
node != NULL;
node = node->next, ++index) {
/* Menu item in View menu. */
- add_view_as_bonobo_menu_item (window,
- NAUTILUS_MENU_PATH_SHORT_LIST_PLACEHOLDER,
- node->data,
- index);
+ add_view_as_menu_item (window,
+ NAUTILUS_MENU_PATH_SHORT_LIST_PLACEHOLDER,
+ node->data,
+ index,
+ merge_id);
}
-
- nautilus_bonobo_set_hidden (window->details->shell_ui,
- NAUTILUS_MENU_PATH_AFTER_SHORT_LIST_SEPARATOR,
- window->details->short_list_viewers == NULL);
+ gtk_ui_manager_insert_action_group (window->details->ui_manager,
+ window->details->view_as_action_group,
+ -1);
+ g_object_unref (window->details->view_as_action_group); /* owned by ui_manager */
nautilus_window_synch_view_as_menus (window);
}
@@ -1145,9 +1011,9 @@ real_get_title (NautilusWindow *window)
title = NULL;
if (window->new_content_view != NULL) {
- title = nautilus_view_frame_get_title (window->new_content_view);
+ title = nautilus_view_get_title (window->new_content_view);
} else if (window->content_view != NULL) {
- title = nautilus_view_frame_get_title (window->content_view);
+ title = nautilus_view_get_title (window->content_view);
}
if (title == NULL) {
@@ -1158,6 +1024,12 @@ real_get_title (NautilusWindow *window)
}
static char *
+nautilus_window_get_cached_title (NautilusWindow *window)
+{
+ return g_strdup (window->details->title);
+}
+
+static char *
nautilus_window_get_title (NautilusWindow *window)
{
return EEL_CALL_METHOD_WITH_RETURN_VALUE (NAUTILUS_WINDOW_CLASS, window,
@@ -1168,6 +1040,8 @@ static void
real_set_title (NautilusWindow *window,
const char *title)
{
+ char *copy;
+
g_free (window->details->title);
window->details->title = g_strdup (title);
@@ -1176,13 +1050,15 @@ real_set_title (NautilusWindow *window,
/* Name of item in history list changed, tell listeners. */
nautilus_send_history_list_changed ();
}
-
- /* warn all views and sidebar panels of the potential title change */
- if (window->content_view != NULL) {
- nautilus_view_frame_title_changed (window->content_view, title);
- }
+
+ copy = g_strdup (window->details->title);
+ g_signal_emit_by_name (window, "title_changed",
+ copy);
+ g_free (copy);
}
+/* Sets window->details->title, and the actual GtkWindow title which
+ * might look a bit different (e.g. with "file browser:" added) */
static void
nautilus_window_set_title (NautilusWindow *window,
const char *title)
@@ -1191,11 +1067,19 @@ nautilus_window_set_title (NautilusWindow *window,
&& strcmp (title, window->details->title) == 0) {
return;
}
-
+
EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
set_title, (window, title));
+
}
+/* update_title:
+ *
+ * Re-calculate the window title.
+ * Called when the location or view has changed.
+ * @window: The NautilusWindow in question.
+ *
+ */
void
nautilus_window_update_title (NautilusWindow *window)
{
@@ -1207,34 +1091,69 @@ nautilus_window_update_title (NautilusWindow *window)
g_free (title);
}
+/* nautilus_window_update_icon:
+ *
+ * Re-calculate the window icon
+ * Called when the location or view or icon set has changed.
+ * @window: The NautilusWindow in question.
+ *
+ */
+void
+nautilus_window_update_icon (NautilusWindow *window)
+{
+ GdkPixbuf *pixbuf;
+ GtkIconTheme *icon_theme;
+
+ pixbuf = NULL;
+
+ /* Desktop window special icon */
+ if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
+ icon_theme = nautilus_icon_factory_get_icon_theme ();
+ pixbuf = gtk_icon_theme_load_icon (icon_theme,
+ "gnome-fs-desktop", 48,
+ 0, NULL);
+ g_object_unref(icon_theme);
+
+ } else {
+ pixbuf = nautilus_icon_factory_get_pixbuf_for_file (window->details->viewed_file,
+ "open",
+ NAUTILUS_ICON_SIZE_STANDARD);
+ }
+
+ if (pixbuf != NULL) {
+ gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
+ g_object_unref (pixbuf);
+ }
+}
+
+
static void
real_set_content_view_widget (NautilusWindow *window,
- NautilusViewFrame *new_view)
+ NautilusView *new_view)
{
+ GtkWidget *widget;
+
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
- g_return_if_fail (new_view == NULL || NAUTILUS_IS_VIEW_FRAME (new_view));
+ g_return_if_fail (new_view == NULL || NAUTILUS_IS_VIEW (new_view));
if (new_view == window->content_view) {
return;
}
if (window->content_view != NULL) {
- gtk_object_destroy (GTK_OBJECT (window->content_view));
+ widget = nautilus_view_get_widget (window->content_view);
+ gtk_widget_destroy (widget);
+ g_object_unref (window->content_view);
window->content_view = NULL;
}
if (new_view != NULL) {
- gtk_widget_show (GTK_WIDGET (new_view));
-
- /* When creating the desktop window the UI needs to
- * be in sync. Otherwise I get failed assertions in
- * bonobo while trying to reference something called
- * `/commands/Unmount Volume Conditional'
- */
- nautilus_window_ui_update (window);
+ widget = nautilus_view_get_widget (new_view);
+ gtk_widget_show (widget);
}
window->content_view = new_view;
+ g_object_ref (window->content_view);
/* Update displayed view in menu. Only do this if we're not switching
* locations though, because if we are switching locations we'll
@@ -1248,7 +1167,7 @@ real_set_content_view_widget (NautilusWindow *window,
void
nautilus_window_set_content_view_widget (NautilusWindow *window,
- NautilusViewFrame *frame)
+ NautilusView *frame)
{
g_assert (NAUTILUS_IS_WINDOW (window));
@@ -1256,73 +1175,6 @@ nautilus_window_set_content_view_widget (NautilusWindow *window,
set_content_view_widget, (window, frame));
}
-static void
-show_dock_item (NautilusWindow *window, const char *dock_item_path)
-{
- if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
- return;
- }
-
- nautilus_window_ui_freeze (window);
-
- nautilus_bonobo_set_hidden (window->details->shell_ui,
- dock_item_path,
- FALSE);
- nautilus_window_update_show_hide_menu_items (window);
-
- nautilus_window_ui_thaw (window);
-}
-
-static void
-hide_dock_item (NautilusWindow *window, const char *dock_item_path)
-{
- nautilus_window_ui_freeze (window);
-
- nautilus_bonobo_set_hidden (window->details->shell_ui,
- dock_item_path,
- TRUE);
- nautilus_window_update_show_hide_menu_items (window);
-
- nautilus_window_ui_thaw (window);
-}
-
-static gboolean
-dock_item_showing (NautilusWindow *window, const char *dock_item_path)
-{
- return !nautilus_bonobo_get_hidden (window->details->shell_ui,
- dock_item_path);
-}
-
-void
-nautilus_window_hide_status_bar (NautilusWindow *window)
-{
- hide_dock_item (window, STATUS_BAR_PATH);
-
- nautilus_window_update_show_hide_menu_items (window);
- if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR) &&
- eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR)) {
- eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR, FALSE);
- }
-}
-
-void
-nautilus_window_show_status_bar (NautilusWindow *window)
-{
- show_dock_item (window, STATUS_BAR_PATH);
-
- nautilus_window_update_show_hide_menu_items (window);
- if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR) &&
- !eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR)) {
- eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR, TRUE);
- }
-}
-
-gboolean
-nautilus_window_status_bar_showing (NautilusWindow *window)
-{
- return dock_item_showing (window, STATUS_BAR_PATH);
-}
-
/**
* nautilus_window_show:
* @widget: GtkWidget
@@ -1337,18 +1189,15 @@ nautilus_window_show (GtkWidget *widget)
window = NAUTILUS_WINDOW (widget);
-
- GTK_WIDGET_CLASS (parent_class)->show (widget);
+ GTK_WIDGET_CLASS (nautilus_window_parent_class)->show (widget);
nautilus_window_ui_update (window);
}
-Bonobo_UIContainer
-nautilus_window_get_ui_container (NautilusWindow *window)
+GtkUIManager *
+nautilus_window_get_ui_manager (NautilusWindow *window)
{
- g_return_val_if_fail (NAUTILUS_IS_WINDOW (window), CORBA_OBJECT_NIL);
-
- return BONOBO_OBJREF (window->details->ui_container);
+ return window->details->ui_manager;
}
void
@@ -1541,9 +1390,79 @@ nautilus_get_history_list (void)
return history_list;
}
+static GList *
+nautilus_window_get_history (NautilusWindow *window)
+{
+ return eel_g_object_list_copy (history_list);
+}
+
+
+static NautilusWindowType
+nautilus_window_get_window_type (NautilusWindow *window)
+{
+ return NAUTILUS_WINDOW_GET_CLASS (window)->window_type;
+}
+
+static int
+nautilus_window_get_selection_count (NautilusWindow *window)
+{
+ if (window->content_view != NULL) {
+ return nautilus_view_get_selection_count (window->content_view);
+ }
+ return 0;
+}
+
+static GList *
+nautilus_window_get_selection (NautilusWindow *window)
+{
+ if (window->content_view != NULL) {
+ return nautilus_view_get_selection (window->content_view);
+ }
+ return NULL;
+}
+
+static NautilusWindowShowHiddenFilesMode
+nautilus_window_get_hidden_files_mode (NautilusWindow *window)
+{
+ return window->details->show_hidden_files_mode;
+}
+
+static void
+nautilus_window_set_hidden_files_mode (NautilusWindowInfo *window,
+ NautilusWindowShowHiddenFilesMode mode)
+{
+ window->details->show_hidden_files_mode = mode;
+
+ g_signal_emit_by_name (window, "hidden_files_mode_changed",
+ mode);
+}
+
+static void
+nautilus_window_info_iface_init (NautilusWindowInfoIface *iface)
+{
+ iface->report_load_underway = nautilus_window_report_load_underway;
+ iface->report_load_complete = nautilus_window_report_load_complete;
+ iface->report_selection_changed = nautilus_window_report_selection_changed;
+ iface->report_view_failed = nautilus_window_report_view_failed;
+ iface->open_location = nautilus_window_open_location_full;
+ iface->close_window = nautilus_window_close;
+ iface->set_status = nautilus_window_set_status;
+ iface->get_window_type = nautilus_window_get_window_type;
+ iface->get_title = nautilus_window_get_cached_title;
+ iface->get_history = nautilus_window_get_history;
+ iface->get_current_location = nautilus_window_get_location;
+ iface->get_ui_manager = nautilus_window_get_ui_manager;
+ iface->get_selection_count = nautilus_window_get_selection_count;
+ iface->get_selection = nautilus_window_get_selection;
+ iface->get_hidden_files_mode = nautilus_window_get_hidden_files_mode;
+ iface->set_hidden_files_mode = nautilus_window_set_hidden_files_mode;
+}
+
static void
nautilus_window_class_init (NautilusWindowClass *class)
{
+ GtkBindingSet *binding_set;
+
G_OBJECT_CLASS (class)->finalize = nautilus_window_finalize;
G_OBJECT_CLASS (class)->get_property = nautilus_window_get_property;
G_OBJECT_CLASS (class)->set_property = nautilus_window_set_property;
@@ -1553,18 +1472,9 @@ nautilus_window_class_init (NautilusWindowClass *class)
class->add_current_location_to_history_list = real_add_current_location_to_history_list;
class->get_title = real_get_title;
class->set_title = real_set_title;
- class->merge_menus = real_merge_menus;
- class->merge_menus_2 = real_merge_menus_2;
class->set_content_view_widget = real_set_content_view_widget;
class->load_view_as_menu = real_load_view_as_menu;
-
- g_object_class_install_property (G_OBJECT_CLASS (class),
- ARG_APP_ID,
- g_param_spec_string ("app_id",
- _("Application ID"),
- _("The application ID of the window."),
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
g_object_class_install_property (G_OBJECT_CLASS (class),
ARG_APP,
g_param_spec_object ("app",
@@ -1580,4 +1490,21 @@ nautilus_window_class_init (NautilusWindowClass *class)
* dialogs?
*/
set_up_default_icon_list ();
+
+
+ signals[GO_UP] =
+ g_signal_new ("go_up",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (NautilusWindowClass, go_up),
+ g_signal_accumulator_true_handled, NULL,
+ eel_marshal_BOOLEAN__BOOLEAN,
+ G_TYPE_BOOLEAN, 1, G_TYPE_BOOLEAN);
+
+ binding_set = gtk_binding_set_by_class (class);
+ gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, 0,
+ "go_up", 1,
+ G_TYPE_BOOLEAN, FALSE);
+
+ class->go_up = nautilus_window_go_up_signal;
}
diff --git a/src/nautilus-window.h b/src/nautilus-window.h
index 2f6283c9f..adbb375be 100644
--- a/src/nautilus-window.h
+++ b/src/nautilus-window.h
@@ -30,11 +30,10 @@
#define NAUTILUS_WINDOW_H
#include <bonobo/bonobo-window.h>
+#include <gtk/gtkuimanager.h>
#include <eel/eel-glib-extensions.h>
#include <libnautilus-private/nautilus-bookmark.h>
-#include <libnautilus-private/nautilus-view-identifier.h>
-#include "nautilus-applicable-views.h"
-#include "nautilus-view-frame.h"
+#include <libnautilus-private/nautilus-window-info.h>
#include "nautilus-application.h"
#include "nautilus-information-panel.h"
#include "nautilus-side-pane.h"
@@ -52,9 +51,9 @@ typedef struct NautilusWindow NautilusWindow;
#endif
typedef struct {
- BonoboWindowClass parent_spot;
+ GtkWindowClass parent_spot;
- Nautilus_WindowType window_type;
+ NautilusWindowType window_type;
/* Function pointers for overriding, without corresponding signals */
@@ -68,16 +67,17 @@ typedef struct {
char * (* get_title) (NautilusWindow *window);
void (* set_title) (NautilusWindow *window, const char *title);
- void (* merge_menus) (NautilusWindow *window);
- void (* merge_menus_2) (NautilusWindow *window);
void (* load_view_as_menu) (NautilusWindow *window);
void (* set_content_view_widget) (NautilusWindow *window,
- NautilusViewFrame *frame);
+ NautilusView *new_view);
void (* set_throbber_active) (NautilusWindow *window,
gboolean active);
void (* prompt_for_location) (NautilusWindow *window);
void (* get_default_size) (NautilusWindow *window, guint *default_width, guint *default_height);
void (* close) (NautilusWindow *window);
+
+ /* Signals used only for keybindings */
+ gboolean (* go_up) (NautilusWindow *window, gboolean close);
} NautilusWindowClass;
typedef enum {
@@ -89,7 +89,7 @@ typedef enum {
typedef struct NautilusWindowDetails NautilusWindowDetails;
struct NautilusWindow {
- BonoboWindow parent_object;
+ GtkWindow parent_object;
NautilusWindowDetails *details;
@@ -103,18 +103,13 @@ struct NautilusWindow {
NautilusBookmark *last_location_bookmark;
/* Current views stuff */
- NautilusViewFrame *content_view;
+ NautilusView *content_view;
/* Pending changes */
- NautilusViewFrame *new_content_view;
-
- /* All views */
- GList *views;
+ NautilusView *new_content_view;
};
GType nautilus_window_get_type (void);
-void nautilus_window_ui_freeze (NautilusWindow *window);
-void nautilus_window_ui_thaw (NautilusWindow *window);
void nautilus_window_close (NautilusWindow *window);
char * nautilus_window_get_location (NautilusWindow *window);
void nautilus_window_go_to (NautilusWindow *window,
@@ -132,9 +127,6 @@ void nautilus_window_display_error (NautilusWindow *window
const char *error_msg);
void nautilus_window_reload (NautilusWindow *window);
-void nautilus_window_hide_status_bar (NautilusWindow *window);
-void nautilus_window_show_status_bar (NautilusWindow *window);
-gboolean nautilus_window_status_bar_showing (NautilusWindow *window);
void nautilus_window_allow_reload (NautilusWindow *window,
gboolean allow);
void nautilus_window_allow_up (NautilusWindow *window,
@@ -143,5 +135,6 @@ void nautilus_window_allow_stop (NautilusWindow *window
gboolean allow);
void nautilus_window_allow_burn_cd (NautilusWindow *window,
gboolean allow);
+GtkUIManager * nautilus_window_get_ui_manager (NautilusWindow *window);
#endif
diff --git a/src/nautilus-zoom-control.c b/src/nautilus-zoom-control.c
index 1252b1325..b8bbd8fd6 100644
--- a/src/nautilus-zoom-control.c
+++ b/src/nautilus-zoom-control.c
@@ -4,6 +4,7 @@
* Nautilus
*
* Copyright (C) 2000 Eazel, Inc.
+ * Copyright (C) 2004 Red Hat, Inc.
*
* Nautilus is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,6 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Andy Hertzfeld <andy@eazel.com>
+ * Alexander Larsson <alexl@redhat.com>
*
* This is the zoom control for the location bar
*
@@ -53,7 +55,7 @@ enum {
ZOOM_IN,
ZOOM_OUT,
ZOOM_TO_LEVEL,
- ZOOM_TO_FIT,
+ ZOOM_TO_DEFAULT,
CHANGE_VALUE,
LAST_SIGNAL
};
@@ -64,9 +66,9 @@ struct NautilusZoomControlDetails {
GtkWidget *zoom_event;
GtkWidget *zoom_label;
- float zoom_level;
- float min_zoom_level;
- float max_zoom_level;
+ NautilusZoomLevel zoom_level;
+ NautilusZoomLevel min_zoom_level;
+ NautilusZoomLevel max_zoom_level;
gboolean has_min_zoom_level;
gboolean has_max_zoom_level;
GList *preferred_zoom_levels;
@@ -82,19 +84,19 @@ static gpointer accessible_parent_class;
static const char *nautilus_zoom_control_accessible_action_names[] = {
N_("Zoom In"),
N_("Zoom Out"),
- N_("Zoom to Fit"),
+ N_("Zoom to Default"),
};
static int nautilus_zoom_control_accessible_action_signals[] = {
ZOOM_IN,
ZOOM_OUT,
- ZOOM_TO_FIT,
+ ZOOM_TO_DEFAULT,
};
static const char *nautilus_zoom_control_accessible_action_descriptions[] = {
N_("Show the contents in more detail"),
N_("Show the contents in less detail"),
- N_("Try to fit in window"),
+ N_("Show in the default detail level"),
};
static GtkMenu *create_zoom_menu (NautilusZoomControl *zoom_control);
@@ -112,7 +114,7 @@ GNOME_CLASS_BOILERPLATE (NautilusZoomControl, nautilus_zoom_control,
static void
nautilus_zoom_control_finalize (GObject *object)
{
- eel_g_list_free_deep (NAUTILUS_ZOOM_CONTROL (object)->details->preferred_zoom_levels);
+ g_list_free (NAUTILUS_ZOOM_CONTROL (object)->details->preferred_zoom_levels);
g_free (NAUTILUS_ZOOM_CONTROL (object)->details);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -138,7 +140,7 @@ nautilus_zoom_control_button_press_event (GtkWidget *widget,
event);
return TRUE;
} else if (event->button == 1) {
- g_signal_emit (zoom_control, signals[ZOOM_TO_FIT], 0);
+ g_signal_emit (zoom_control, signals[ZOOM_TO_DEFAULT], 0);
}
/* We don't change our state (to reflect the new zoom) here.
@@ -199,15 +201,22 @@ static void
nautilus_zoom_control_instance_init (NautilusZoomControl *zoom_control)
{
GtkWidget *image;
+ int i;
zoom_control->details = g_new0 (NautilusZoomControlDetails, 1);
- zoom_control->details->zoom_level = 1.0;
- zoom_control->details->min_zoom_level = 0.0;
- zoom_control->details->max_zoom_level = 2.0;
+ zoom_control->details->zoom_level = NAUTILUS_ZOOM_LEVEL_STANDARD;
+ zoom_control->details->min_zoom_level = NAUTILUS_ZOOM_LEVEL_SMALLEST;
+ zoom_control->details->max_zoom_level = NAUTILUS_ZOOM_LEVEL_LARGEST;
zoom_control->details->has_min_zoom_level = TRUE;
zoom_control->details->has_max_zoom_level = TRUE;
+ for (i = NAUTILUS_ZOOM_LEVEL_SMALLEST; i <= NAUTILUS_ZOOM_LEVEL_LARGEST; i++) {
+ zoom_control->details->preferred_zoom_levels = g_list_append (
+ zoom_control->details->preferred_zoom_levels,
+ GINT_TO_POINTER (i));
+ }
+
image = gtk_image_new_from_stock (GTK_STOCK_ZOOM_OUT, GTK_ICON_SIZE_MENU);
zoom_control->details->zoom_out = gtk_button_new ();
gtk_button_set_relief (GTK_BUTTON (zoom_control->details->zoom_out),
@@ -279,7 +288,7 @@ nautilus_zoom_control_redraw (NautilusZoomControl *zoom_control)
gtk_widget_set_sensitive (zoom_control->details->zoom_out,
nautilus_zoom_control_can_zoom_out (zoom_control));
- percent = floor ((100.0 * zoom_control->details->zoom_level) + .5);
+ percent = floor ((100.0 * nautilus_get_relative_icon_size_for_zoom_level (zoom_control->details->zoom_level)) + .5);
num_str = g_strdup_printf ("%d%%", percent);
gtk_label_set_text (GTK_LABEL (zoom_control->details->zoom_label), num_str);
g_free (num_str);
@@ -290,7 +299,7 @@ nautilus_zoom_control_redraw (NautilusZoomControl *zoom_control)
static void
zoom_menu_callback (GtkMenuItem *item, gpointer callback_data)
{
- float zoom_level;
+ NautilusZoomLevel zoom_level;
NautilusZoomControl *zoom_control;
gboolean can_zoom;
@@ -306,7 +315,7 @@ zoom_menu_callback (GtkMenuItem *item, gpointer callback_data)
return;
}
- zoom_level = * (float *) g_object_get_data (G_OBJECT (item), "zoom_level");
+ zoom_level = (NautilusZoomLevel) GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "zoom_level"));
/* Assume we can zoom and then check whether we're right. */
can_zoom = TRUE;
@@ -325,12 +334,11 @@ zoom_menu_callback (GtkMenuItem *item, gpointer callback_data)
static GtkRadioMenuItem *
create_zoom_menu_item (NautilusZoomControl *zoom_control, GtkMenu *menu,
- float zoom_level,
+ NautilusZoomLevel zoom_level,
GtkRadioMenuItem *previous_radio_item)
{
GtkWidget *menu_item;
char *item_text;
- float *zoom_level_ptr;
GSList *radio_item_group;
int percent;
@@ -342,7 +350,7 @@ create_zoom_menu_item (NautilusZoomControl *zoom_control, GtkMenu *menu,
/* This is marked for localization in case the % sign is not
* appropriate in some locale. I guess that's unlikely.
*/
- percent = floor ((100.0 * zoom_level) + .5);
+ percent = floor ((100.0 * nautilus_get_relative_icon_size_for_zoom_level (zoom_level)) + .5);
item_text = g_strdup_printf ("%d%%", percent);
radio_item_group = previous_radio_item == NULL
@@ -350,13 +358,10 @@ create_zoom_menu_item (NautilusZoomControl *zoom_control, GtkMenu *menu,
: gtk_radio_menu_item_get_group (previous_radio_item);
menu_item = gtk_radio_menu_item_new_with_label (radio_item_group, item_text);
- zoom_level_ptr = g_new (float, 1);
- *zoom_level_ptr = zoom_level;
-
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item),
zoom_level == zoom_control->details->zoom_level);
- g_object_set_data_full (G_OBJECT (menu_item), "zoom_level", zoom_level_ptr, g_free);
+ g_object_set_data (G_OBJECT (menu_item), "zoom_level", GINT_TO_POINTER (zoom_level));
g_signal_connect_object (menu_item, "activate",
G_CALLBACK (zoom_menu_callback), zoom_control, 0);
@@ -380,7 +385,7 @@ create_zoom_menu (NautilusZoomControl *zoom_control)
previous_item = NULL;
for (node = zoom_control->details->preferred_zoom_levels; node != NULL; node = node->next) {
previous_item = create_zoom_menu_item
- (zoom_control, menu, * (float *) node->data, previous_item);
+ (zoom_control, menu, GPOINTER_TO_INT (node->data), previous_item);
}
return menu;
@@ -424,7 +429,8 @@ nautilus_zoom_control_change_value (NautilusZoomControl *zoom_control,
}
void
-nautilus_zoom_control_set_zoom_level (NautilusZoomControl *zoom_control, float zoom_level)
+nautilus_zoom_control_set_zoom_level (NautilusZoomControl *zoom_control,
+ NautilusZoomLevel zoom_level)
{
zoom_control->details->zoom_level = zoom_level;
nautilus_zoom_control_redraw (zoom_control);
@@ -432,8 +438,8 @@ nautilus_zoom_control_set_zoom_level (NautilusZoomControl *zoom_control, float z
void
nautilus_zoom_control_set_parameters (NautilusZoomControl *zoom_control,
- float min_zoom_level,
- float max_zoom_level,
+ NautilusZoomLevel min_zoom_level,
+ NautilusZoomLevel max_zoom_level,
gboolean has_min_zoom_level,
gboolean has_max_zoom_level,
GList *zoom_levels)
@@ -445,25 +451,25 @@ nautilus_zoom_control_set_parameters (NautilusZoomControl *zoom_control,
zoom_control->details->has_min_zoom_level = has_min_zoom_level;
zoom_control->details->has_max_zoom_level = has_max_zoom_level;
- eel_g_list_free_deep (zoom_control->details->preferred_zoom_levels);
+ g_list_free (zoom_control->details->preferred_zoom_levels);
zoom_control->details->preferred_zoom_levels = zoom_levels;
nautilus_zoom_control_redraw (zoom_control);
}
-float
+NautilusZoomLevel
nautilus_zoom_control_get_zoom_level (NautilusZoomControl *zoom_control)
{
return zoom_control->details->zoom_level;
}
-float
+NautilusZoomLevel
nautilus_zoom_control_get_min_zoom_level (NautilusZoomControl *zoom_control)
{
return zoom_control->details->min_zoom_level;
}
-float
+NautilusZoomLevel
nautilus_zoom_control_get_max_zoom_level (NautilusZoomControl *zoom_control)
{
return zoom_control->details->max_zoom_level;
@@ -569,17 +575,17 @@ nautilus_zoom_control_class_init (NautilusZoomControlClass *class)
G_STRUCT_OFFSET (NautilusZoomControlClass,
zoom_to_level),
NULL, NULL,
- g_cclosure_marshal_VOID__FLOAT,
+ g_cclosure_marshal_VOID__INT,
G_TYPE_NONE,
1,
- G_TYPE_FLOAT);
+ G_TYPE_INT);
- signals[ZOOM_TO_FIT] =
- g_signal_new ("zoom_to_fit",
+ signals[ZOOM_TO_DEFAULT] =
+ g_signal_new ("zoom_to_default",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (NautilusZoomControlClass,
- zoom_to_fit),
+ zoom_to_default),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -609,11 +615,11 @@ nautilus_zoom_control_class_init (NautilusZoomControlClass *class)
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Equal, 0,
- "zoom_to_fit",
+ "zoom_to_default",
0);
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Equal, 0,
- "zoom_to_fit",
+ "zoom_to_default",
0);
gtk_binding_entry_add_signal (binding_set,
@@ -687,15 +693,15 @@ nautilus_zoom_control_accessible_get_current_value (AtkValue *accessible,
{
NautilusZoomControl *control;
- g_value_init (value, G_TYPE_FLOAT);
+ g_value_init (value, G_TYPE_INT);
control = NAUTILUS_ZOOM_CONTROL (GTK_ACCESSIBLE (accessible)->widget);
if (!control) {
- g_value_set_float (value, 0.0);
+ g_value_set_int (value, NAUTILUS_ZOOM_LEVEL_STANDARD);
return;
}
- g_value_set_float (value, control->details->zoom_level);
+ g_value_set_int (value, control->details->zoom_level);
}
static void
@@ -704,15 +710,15 @@ nautilus_zoom_control_accessible_get_maximum_value (AtkValue *accessible,
{
NautilusZoomControl *control;
- g_value_init (value, G_TYPE_FLOAT);
+ g_value_init (value, G_TYPE_INT);
control = NAUTILUS_ZOOM_CONTROL (GTK_ACCESSIBLE (accessible)->widget);
if (!control) {
- g_value_set_float (value, 0.0);
+ g_value_set_int (value, NAUTILUS_ZOOM_LEVEL_STANDARD);
return;
}
- g_value_set_float (value, control->details->max_zoom_level);
+ g_value_set_int (value, control->details->max_zoom_level);
}
static void
@@ -721,33 +727,33 @@ nautilus_zoom_control_accessible_get_minimum_value (AtkValue *accessible,
{
NautilusZoomControl *control;
- g_value_init (value, G_TYPE_FLOAT);
+ g_value_init (value, G_TYPE_INT);
control = NAUTILUS_ZOOM_CONTROL (GTK_ACCESSIBLE (accessible)->widget);
if (!control) {
- g_value_set_float (value, 0.0);
+ g_value_set_int (value, NAUTILUS_ZOOM_LEVEL_STANDARD);
return;
}
- g_value_set_float (value, control->details->min_zoom_level);
+ g_value_set_int (value, control->details->min_zoom_level);
}
-static float
-nearest_preferred (NautilusZoomControl *zoom_control, float value)
+static NautilusZoomLevel
+nearest_preferred (NautilusZoomControl *zoom_control, NautilusZoomLevel value)
{
- float last_value;
- float current_value;
+ NautilusZoomLevel last_value;
+ NautilusZoomLevel current_value;
GList *l;
if (!zoom_control->details->preferred_zoom_levels) {
return value;
}
- last_value = * (float *)zoom_control->details->preferred_zoom_levels->data;
+ last_value = GPOINTER_TO_INT (zoom_control->details->preferred_zoom_levels->data);
current_value = last_value;
for (l = zoom_control->details->preferred_zoom_levels; l != NULL; l = l->next) {
- current_value = * (float*)l->data;
+ current_value = GPOINTER_TO_INT (l->data);
if (current_value > value) {
float center = (last_value + current_value) / 2;
@@ -767,14 +773,14 @@ nautilus_zoom_control_accessible_set_current_value (AtkValue *accessible,
const GValue *value)
{
NautilusZoomControl *control;
- float zoom;
+ NautilusZoomLevel zoom;
control = NAUTILUS_ZOOM_CONTROL (GTK_ACCESSIBLE (accessible)->widget);
if (!control) {
return FALSE;
}
- zoom = nearest_preferred (control, g_value_get_float (value));
+ zoom = nearest_preferred (control, g_value_get_int (value));
g_signal_emit (control, signals[ZOOM_TO_LEVEL], 0, zoom);
diff --git a/src/nautilus-zoom-control.h b/src/nautilus-zoom-control.h
index 739a2b51b..36120187a 100644
--- a/src/nautilus-zoom-control.h
+++ b/src/nautilus-zoom-control.h
@@ -29,6 +29,7 @@
#define NAUTILUS_ZOOM_CONTROL_H
#include <gtk/gtkhbox.h>
+#include <libnautilus-private/nautilus-icon-factory.h> /* For NautilusZoomLevel */
#define NAUTILUS_TYPE_ZOOM_CONTROL (nautilus_zoom_control_get_type ())
#define NAUTILUS_ZOOM_CONTROL(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ZOOM_CONTROL, NautilusZoomControl))
@@ -51,32 +52,30 @@ struct NautilusZoomControlClass {
void (*zoom_in) (NautilusZoomControl *control);
void (*zoom_out) (NautilusZoomControl *control);
void (*zoom_to_level) (NautilusZoomControl *control,
- float zoom_level);
- void (*zoom_to_fit) (NautilusZoomControl *control);
+ NautilusZoomLevel zoom_level);
+ void (*zoom_to_default) (NautilusZoomControl *control);
/* Action signal for keybindings, do not connect to this */
void (*change_value) (NautilusZoomControl *control,
GtkScrollType scroll);
};
-GType nautilus_zoom_control_get_type (void);
-GtkWidget *nautilus_zoom_control_new (void);
-
-void nautilus_zoom_control_set_zoom_level (NautilusZoomControl *zoom_control,
- float zoom_level);
-void nautilus_zoom_control_set_parameters (NautilusZoomControl *zoom_control,
- float min_zoom_level,
- float max_zoom_level,
- gboolean has_min_zoom_level,
- gboolean has_max_zoom_level,
- GList *zoom_levels);
-
-float nautilus_zoom_control_get_zoom_level (NautilusZoomControl *zoom_control);
-float nautilus_zoom_control_get_min_zoom_level (NautilusZoomControl *zoom_control);
-float nautilus_zoom_control_get_max_zoom_level (NautilusZoomControl *zoom_control);
-gboolean nautilus_zoom_control_has_min_zoom_level (NautilusZoomControl *zoom_control);
-gboolean nautilus_zoom_control_has_max_zoom_level (NautilusZoomControl *zoom_control);
-gboolean nautilus_zoom_control_can_zoom_in (NautilusZoomControl *zoom_control);
-gboolean nautilus_zoom_control_can_zoom_out (NautilusZoomControl *zoom_control);
+GType nautilus_zoom_control_get_type (void);
+GtkWidget * nautilus_zoom_control_new (void);
+void nautilus_zoom_control_set_zoom_level (NautilusZoomControl *zoom_control,
+ NautilusZoomLevel zoom_level);
+void nautilus_zoom_control_set_parameters (NautilusZoomControl *zoom_control,
+ NautilusZoomLevel min_zoom_level,
+ NautilusZoomLevel max_zoom_level,
+ gboolean has_min_zoom_level,
+ gboolean has_max_zoom_level,
+ GList *zoom_levels);
+NautilusZoomLevel nautilus_zoom_control_get_zoom_level (NautilusZoomControl *zoom_control);
+NautilusZoomLevel nautilus_zoom_control_get_min_zoom_level (NautilusZoomControl *zoom_control);
+NautilusZoomLevel nautilus_zoom_control_get_max_zoom_level (NautilusZoomControl *zoom_control);
+gboolean nautilus_zoom_control_has_min_zoom_level (NautilusZoomControl *zoom_control);
+gboolean nautilus_zoom_control_has_max_zoom_level (NautilusZoomControl *zoom_control);
+gboolean nautilus_zoom_control_can_zoom_in (NautilusZoomControl *zoom_control);
+gboolean nautilus_zoom_control_can_zoom_out (NautilusZoomControl *zoom_control);
#endif /* NAUTILUS_ZOOM_CONTROL_H */
diff --git a/test/Makefile.am b/test/Makefile.am
index 6975b921a..629086a15 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -9,7 +9,6 @@ INCLUDES =\
$(NULL)
LDADD =\
- $(top_builddir)/libnautilus/libnautilus.la \
$(top_builddir)/libnautilus-private/libnautilus-private.la \
$(CORE_LIBS) \
$(NULL)