mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-10-05 23:40:01 +00:00
Merge bonobo-slay-branch
2004-11-22 Alexander Larsson <alexl@redhat.com> * Merge bonobo-slay-branch
This commit is contained in:
parent
8dc115c339
commit
67e2a42fea
649
ChangeLog
649
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
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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.
|
|
@ -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)
|
|
@ -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>
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -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 */
|
||||
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
|
@ -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 */
|
|
@ -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 */
|
|
@ -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);
|
||||
}
|
|
@ -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 */
|
||||
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -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 */
|
|
@ -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));
|
||||
|
||||
}
|
||||
|
|
@ -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 */
|
||||
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
|
@ -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 */
|
||||
|
||||
|
||||
|
|
@ -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? */
|
||||
}
|
|
@ -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 */
|
||||
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
|
@ -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 */
|
|
@ -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);
|
||||
}
|
|
@ -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 */
|
|
@ -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
|
|
@ -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>
|
|
@ -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"
|
||||
};
|
|
@ -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 */
|
|
@ -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 */
|
|
@ -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
|
|
@ -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>
|
|
@ -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"
|
||||
};
|
|
@ -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);
|
||||
}
|
|
@ -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
|
|
@ -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>
|
|
@ -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"
|
||||
};
|
|
@ -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 */
|
|
@ -1,10 +0,0 @@
|
|||
NULL=
|
||||
|
||||
SUBDIRS =\
|
||||
content sidebar\
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST=\
|
||||
README \
|
||||
$(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
|
||||
|
||||
|
|
@ -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
|
|
@ -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>
|
|
@ -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;
|
||||
}
|
|
@ -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>
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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 */
|
||||
|
|
@ -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
|
|
@ -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>
|
|
@ -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;
|
||||
}
|
|
@ -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>
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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 */
|
||||
|
|
@ -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)
|
|
@ -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>
|
Binary file not shown.
Before Width: | Height: | Size: 583 B |
|
@ -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);
|
||||
}
|
|
@ -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__ */
|
File diff suppressed because it is too large
Load diff
Binary file not shown.
Before Width: | Height: | Size: 441 B |
|
@ -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&_w=f&_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>
|
|
@ -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
|
|
@ -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>
|
|
@ -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"
|
||||
};
|
|
@ -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
|
|
@ -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>
|
|
@ -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.
|
|
@ -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);
|
||||
}
|
|
@ -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>
|
|
@ -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);
|
||||
}
|
|
@ -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 */
|
|
@ -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
|
|
@ -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>
|
|
@ -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);
|
||||
}
|
|
@ -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>
|
|
@ -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);
|
||||
}
|
|
@ -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 */
|
|
@ -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
|
|
@ -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>
|
|
@ -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);
|
||||
}
|
55
configure.in
55
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
|
||||
|
|
|
@ -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)
|
||||
|
|
@ -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 */
|
|
@ -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)
|
||||
|
|
|
@ -643,21 +643,6 @@
|
|||
</locale>
|
||||
</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>
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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 */
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,55 +42,33 @@
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -96,6 +76,7 @@ select_all (GtkEditable *editable)
|
|||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
set_clipboard_menu_items_sensitive (BonoboUIComponent *component)
|
||||
set_paste_sensitive_if_clipboard_contains_data (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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_clipboard_menu_items_insensitive (BonoboUIComponent *component)
|
||||
set_clipboard_menu_items_sensitive (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, TRUE);
|
||||
action = gtk_action_group_get_action (action_group,
|
||||
"Copy");
|
||||
gtk_action_set_sensitive (action, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
set_clipboard_menu_items_insensitive (GtkActionGroup *action_group)
|
||||
{
|
||||
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,23 +332,34 @@ 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);
|
||||
}
|
|
@ -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 */
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 (¶ms[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 (¶ms[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 (¶ms[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);
|
||||
}
|
|
@ -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 */
|
|
@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue