summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Estrugo <ramiro@src.gnome.org>2001-04-10 05:52:44 +0000
committerRamiro Estrugo <ramiro@src.gnome.org>2001-04-10 05:52:44 +0000
commit992ab7632d68cd10419040da4ef285bc05316864 (patch)
tree89c76a08420a4a7aa35ada8ae62e3431c87e5105
parente9cdcb7c6588d755011d6b78bd6d55888839178a (diff)
downloadnautilus-992ab7632d68cd10419040da4ef285bc05316864.tar.gz
Stage one of removing services from the nautilus cvs tree. Make
the services enabled machinery work at runtime rather than compile time. * acconfig.h: Add HAVE_AMMONITE. * components/mozilla/main.c: (main): * components/mozilla/nautilus-mozilla-content-view.c: (translate_uri_nautilus_to_mozilla), (translate_uri_mozilla_to_nautilus): Use HAVE_AMMONITE instead of EAZEL_SERVICES for the specific Ammonite features. * components/text/services/Makefile.am: Fix rogue spacing. * configure.in: * libnautilus-extensions/nautilus-directory.c: (nautilus_self_check_directory): Remove EAZEL_SERVICES from self test code. Run the test for the eazel-services uri scheme regardless. * libnautilus-extensions/nautilus-mime-actions.h: * libnautilus-extensions/nautilus-mime-actions.c: (mime_get_all_components_for_uri_scheme): New flavor of function tha takes a uri scheme parameter instead of a NautilusFile. (nautilus_mime_has_any_components_for_uri_scheme): New function to find out if there exists any components registered to handle a uri scheme. * src/Makefile.am: Use AMMONITE_CFLAGS and AMMONITE_LIBS instead of SERVICES_LIBS hac. * src/nautilus-services.h, * src/nautilus-services.c: New files for putting all shared services related code in one places. * src/nautilus-window-menus.c: (services_button_callback), (nautilus_window_initialize_menus_part_1): Remove EAZEL_HACKING hackery. Make the services code always be linked in. Use new shared services functions to determine whether we need to populate the services menus and toolbars. * src/nautilus-window-service-ui.c: (goto_services_summary), (goto_online_storage), (goto_software_catalog), (nautilus_window_install_service_ui): Simplify by using shared services code. Remove all Ammonite code from here. Ammonite code is constrained to nautilus-services.[ch] only. Use shared services code t determine the target uris for services callbacks. * src/nautilus-window-toolbars.c: (set_up_toolbar_images): * src/nautilus-window.c: (nautilus_window_constructed): Remove EAZEL_HACKING hackery. Decide at runtime whether to setup the services toobar or not.
-rw-r--r--ChangeLog59
-rw-r--r--acconfig.h1
-rw-r--r--components/mozilla/main.c4
-rw-r--r--components/mozilla/nautilus-mozilla-content-view.c18
-rw-r--r--components/text/services/Makefile.am2
-rw-r--r--configure.in21
-rw-r--r--libnautilus-extensions/nautilus-directory.c2
-rw-r--r--libnautilus-extensions/nautilus-mime-actions.c42
-rw-r--r--libnautilus-extensions/nautilus-mime-actions.h8
-rw-r--r--libnautilus-private/nautilus-directory.c2
-rw-r--r--libnautilus-private/nautilus-mime-actions.c42
-rw-r--r--libnautilus-private/nautilus-mime-actions.h8
-rw-r--r--src/Makefile.am15
-rw-r--r--src/nautilus-navigation-window-menus.c19
-rw-r--r--src/nautilus-navigation-window.c9
-rw-r--r--src/nautilus-object-window.c9
-rw-r--r--src/nautilus-services.c112
-rw-r--r--src/nautilus-services.h37
-rw-r--r--src/nautilus-spatial-window.c9
-rw-r--r--src/nautilus-window-menus.c19
-rw-r--r--src/nautilus-window-service-ui.c68
-rw-r--r--src/nautilus-window-toolbars.c19
-rw-r--r--src/nautilus-window.c9
23 files changed, 408 insertions, 126 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a0a5340a..9cdcc0387 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,61 @@
-2001-04-09 John Sullivan <sullivan@eazel.com>
+2001-04-09 Ramiro Estrugo <ramiro@eazel.com>
- reviewed by: <delete if not using a buddy>
+ * acconfig.h:
+ Add HAVE_AMMONITE.
+
+ * components/mozilla/main.c: (main):
+ * components/mozilla/nautilus-mozilla-content-view.c:
+ (translate_uri_nautilus_to_mozilla),
+ (translate_uri_mozilla_to_nautilus):
+ Use HAVE_AMMONITE instead of EAZEL_SERVICES for the specific
+ Ammonite features.
+
+ * components/text/services/Makefile.am:
+ Fix rogue spacing.
+
+ * configure.in:
+
+ * libnautilus-extensions/nautilus-directory.c:
+ (nautilus_self_check_directory):
+ Remove EAZEL_SERVICES from self test code. Run the test for the
+ eazel-services uri scheme regardless.
+
+ * libnautilus-extensions/nautilus-mime-actions.h:
+ * libnautilus-extensions/nautilus-mime-actions.c:
+ (mime_get_all_components_for_uri_scheme): New flavor of function
+ tha takes a uri scheme parameter instead of a NautilusFile.
+ (nautilus_mime_has_any_components_for_uri_scheme): New function to
+ find out if there exists any components registered to handle a uri
+ scheme.
+
+ * src/Makefile.am:
+ Use AMMONITE_CFLAGS and AMMONITE_LIBS instead of SERVICES_LIBS
+ hac.
+
+ * src/nautilus-services.h,
+ * src/nautilus-services.c: New files for putting all shared
+ services related code in one places.
+
+ * src/nautilus-window-menus.c: (services_button_callback),
+ (nautilus_window_initialize_menus_part_1):
+ Remove EAZEL_HACKING hackery. Make the services code always be
+ linked in. Use new shared services functions to determine whether
+ we need to populate the services menus and toolbars.
+
+ * src/nautilus-window-service-ui.c: (goto_services_summary),
+ (goto_online_storage), (goto_software_catalog),
+ (nautilus_window_install_service_ui):
+ Simplify by using shared services code. Remove all Ammonite code
+ from here. Ammonite code is constrained to nautilus-services.[ch]
+ only. Use shared services code t determine the target uris for
+ services callbacks.
+
+ * src/nautilus-window-toolbars.c: (set_up_toolbar_images):
+ * src/nautilus-window.c: (nautilus_window_constructed):
+ Remove EAZEL_HACKING hackery. Decide at runtime whether to setup
+ the services toobar or not.
+
+2001-04-09 John Sullivan <sullivan@eazel.com>
Wired up the remaining new view global preferences,
and added a menu item for resetting the current view
diff --git a/acconfig.h b/acconfig.h
index 952c6fcea..fc0b9af75 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -15,6 +15,7 @@
#undef HAVE_RPM_40
#undef HAVE_STPCPY
#undef HAVE_LIBBZ2
+#undef HAVE_AMMONITE
#undef bzCompress
#undef bzCompressInit
#undef bzDecompress
diff --git a/components/mozilla/main.c b/components/mozilla/main.c
index 38f0f0123..64973331e 100644
--- a/components/mozilla/main.c
+++ b/components/mozilla/main.c
@@ -37,7 +37,7 @@
#include <gconf/gconf.h>
-#ifdef EAZEL_SERVICES
+#ifdef HAVE_AMMONITE
#include <libtrilobite/libammonite-gtk.h>
#endif
@@ -196,7 +196,7 @@ main (int argc, char *argv[])
gnome_vfs_init ();
-#ifdef EAZEL_SERVICES
+#ifdef HAVE_AMMONITE
ammonite_init ((PortableServer_POA) bonobo_poa);
#endif
diff --git a/components/mozilla/nautilus-mozilla-content-view.c b/components/mozilla/nautilus-mozilla-content-view.c
index d1183735b..ee7adb3c5 100644
--- a/components/mozilla/nautilus-mozilla-content-view.c
+++ b/components/mozilla/nautilus-mozilla-content-view.c
@@ -62,7 +62,7 @@
#include <eel/eel-stock-dialogs.h>
-#ifdef EAZEL_SERVICES
+#ifdef HAVE_AMMONITE
#include <libtrilobite/libammonite-gtk.h>
#endif
@@ -209,7 +209,7 @@ static gint string_list_get_index_of_string (const char *string_list[],
static void pre_widget_initialize (void);
static void post_widget_initialize (void);
-#ifdef EAZEL_SERVICES
+#ifdef HAVE_AMMONITE
/*
* URL scheme hack for the eazel-services: scheme
@@ -220,7 +220,7 @@ static char * eazel_services_scheme_to_http (NautilusMozillaContentView *view,
static char * eazel_services_scheme_from_http (NautilusMozillaContentView *view,
const char *uri);
-#endif /* EAZEL_SERVICES */
+#endif /* HAVE_AMMONITE */
/* BonoboControl callbacks */
static void bonobo_control_activate_callback (BonoboObject *control, gboolean state, gpointer callback_data);
@@ -1346,11 +1346,11 @@ translate_uri_nautilus_to_mozilla (NautilusMozillaContentView *view, const char
g_return_val_if_fail (uri != NULL, NULL);
-#ifdef EAZEL_SERVICES
+#ifdef HAVE_AMMONITE
if (0 == strncmp (uri, "eazel-services:", strlen ("eazel-services:"))) {
ret = eazel_services_scheme_to_http (view, uri);
} else
-#endif /* EAZEL_SERVICES */
+#endif /* HAVE_AMMONITE */
{
ret = g_strdup (uri);
}
@@ -1362,11 +1362,11 @@ translate_uri_nautilus_to_mozilla (NautilusMozillaContentView *view, const char
static char *
translate_uri_mozilla_to_nautilus (NautilusMozillaContentView *view, const char *uri)
{
-#ifdef EAZEL_SERVICES
+#ifdef HAVE_AMMONITE
return eazel_services_scheme_from_http (view, uri);
#else
return g_strdup (uri);
-#endif /* EAZEL_SERVICES */
+#endif /* HAVE_AMMONITE */
}
#ifdef BUSY_CURSOR
@@ -1966,7 +1966,7 @@ post_widget_initialize (void)
}
-#ifdef EAZEL_SERVICES
+#ifdef HAVE_AMMONITE
/*
* URL scheme hack for the eazel-services: scheme
@@ -2045,4 +2045,4 @@ eazel_services_scheme_from_http (NautilusMozillaContentView *view,
return ret;
}
-#endif /* EAZEL_SERVICES */
+#endif /* HAVE_AMMONITE */
diff --git a/components/text/services/Makefile.am b/components/text/services/Makefile.am
index 857d82b98..d4a4cc36c 100644
--- a/components/text/services/Makefile.am
+++ b/components/text/services/Makefile.am
@@ -6,5 +6,5 @@ services_DATA = \
google.xml \
webster.xml \
$(NULL)
-
+
EXTRA_DIST = $(services_DATA)
diff --git a/configure.in b/configure.in
index 9ebf6c34f..e6377275f 100644
--- a/configure.in
+++ b/configure.in
@@ -866,9 +866,21 @@ dnl = End tests for medusa
dnl =======================
dnl ====================================
-dnl = Begin tests for ammonite (--enable-eazel-services only)
+dnl = Begin tests for ammonite
dnl ====================================
-if test "x$EAZEL_SERVICES_ENABLED" = "xyes" ;
+ammonite_module=`$GNOME_CONFIG --modversion ammonite 2> /dev/null | awk -F"-" '{ print $1; }'`
+
+if test "$ammonite_module" = "ammonite"
+then
+ HAVE_AMMONITE=1
+ AC_DEFINE(HAVE_AMMONITE)
+else
+ HAVE_AMMONITE=0
+fi
+
+AC_SUBST(HAVE_AMMONITE)
+
+if test "$HAVE_AMMONITE" = "1"
then
EAZEL_VERSION_INSIST(ammonite, $GNOME_CONFIG --modversion ammonite | awk -F- '{print $2}', >=, AMMONITE_REQUIRED)
@@ -1186,6 +1198,11 @@ case "X$ENABLE_PROFILER" in
;;
esac
+dnl <= Ammonite =>
+echo "HAVE_AMMONITE : $HAVE_AMMONITE"
+echo "AMMONITE_CFLAGS : $AMMONITE_CFLAGS"
+echo "AMMONITE_LIBS : $AMMONITE_LIBS"
+
dnl <= FreeType2 =>
echo "FREETYPE2_CFLAGS : $FREETYPE2_CFLAGS"
echo "FREETYPE2_LIBS : $FREETYPE2_LIBS"
diff --git a/libnautilus-extensions/nautilus-directory.c b/libnautilus-extensions/nautilus-directory.c
index 9166fa4d9..b136fe8e4 100644
--- a/libnautilus-extensions/nautilus-directory.c
+++ b/libnautilus-extensions/nautilus-directory.c
@@ -1645,10 +1645,8 @@ nautilus_self_check_directory (void)
EEL_CHECK_STRING_RESULT (nautilus_directory_make_uri_canonical ("http://le-hackeur.org/dir/"), "http://le-hackeur.org/dir");
/* FIXME bugzilla.eazel.com 5068: the "nested" URI loses some characters here. Maybe that's OK because we escape them in practice? */
EEL_CHECK_STRING_RESULT (nautilus_directory_make_uri_canonical ("search://[file://]file_name contains stuff"), "search://[file/]file_name contains stuff");
-#ifdef EAZEL_SERVICES
EEL_CHECK_STRING_RESULT (nautilus_directory_make_uri_canonical ("eazel-services:/~turtle"), "eazel-services:///~turtle");
EEL_CHECK_STRING_RESULT (nautilus_directory_make_uri_canonical ("eazel-services:///~turtle"), "eazel-services:///~turtle");
-#endif
}
#endif /* !NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus-extensions/nautilus-mime-actions.c b/libnautilus-extensions/nautilus-mime-actions.c
index bfbd46ee5..b8e51febb 100644
--- a/libnautilus-extensions/nautilus-mime-actions.c
+++ b/libnautilus-extensions/nautilus-mime-actions.c
@@ -815,6 +815,46 @@ nautilus_mime_has_any_components_for_file (NautilusFile *file)
return result;
}
+
+static GList *
+mime_get_all_components_for_uri_scheme (const char *uri_scheme)
+{
+ GList *info_list;
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (eel_strlen (uri_scheme) > 0, NULL);
+
+ CORBA_exception_init (&ev);
+
+ info_list = nautilus_do_component_query (NULL,
+ uri_scheme,
+ NULL,
+ TRUE,
+ NULL,
+ NULL,
+ NULL,
+ &ev);
+
+ CORBA_exception_free (&ev);
+
+ return info_list;
+}
+
+gboolean
+nautilus_mime_has_any_components_for_uri_scheme (const char *uri_scheme)
+{
+ GList *list;
+ gboolean result;
+
+ g_return_val_if_fail (eel_strlen (uri_scheme) > 0, FALSE);
+
+ list = mime_get_all_components_for_uri_scheme (uri_scheme);
+ result = list != NULL;
+ gnome_vfs_mime_component_list_free (list);
+
+ return result;
+}
+
GnomeVFSResult
nautilus_mime_set_default_action_type_for_file (NautilusFile *file,
GnomeVFSMimeActionType action_type)
@@ -1422,7 +1462,7 @@ make_oaf_query_with_uri_scheme_only (const char *uri_scheme,
/* The explicit metafile iid query for the %s above. */
, explicit_iid_query,
extra_requirements != NULL ? extra_requirements : "true");
-
+
return result;
}
diff --git a/libnautilus-extensions/nautilus-mime-actions.h b/libnautilus-extensions/nautilus-mime-actions.h
index 8390df21d..0c0b38d3d 100644
--- a/libnautilus-extensions/nautilus-mime-actions.h
+++ b/libnautilus-extensions/nautilus-mime-actions.h
@@ -32,9 +32,7 @@
GList *nautilus_mime_actions_get_minimum_file_attributes (void);
GList *nautilus_mime_actions_get_full_file_attributes (void);
-
gboolean nautilus_mime_actions_file_needs_full_file_attributes (NautilusFile *file);
-
GnomeVFSMimeActionType nautilus_mime_get_default_action_type_for_file (NautilusFile *file);
GnomeVFSMimeAction * nautilus_mime_get_default_action_for_file (NautilusFile *file);
GnomeVFSMimeApplication *nautilus_mime_get_default_application_for_file (NautilusFile *file);
@@ -61,8 +59,8 @@ GnomeVFSResult nautilus_mime_add_application_to_short_list_for_file
const char *application_id);
GnomeVFSResult nautilus_mime_remove_application_from_short_list_for_file (NautilusFile *file,
const char *application_id);
-GnomeVFSResult nautilus_mime_set_short_list_components_for_file (NautilusFile *file,
- GList *components);
+GnomeVFSResult nautilus_mime_set_short_list_components_for_file (NautilusFile *file,
+ GList *components);
GnomeVFSResult nautilus_mime_add_component_to_short_list_for_file (NautilusFile *file,
const char *iid);
GnomeVFSResult nautilus_mime_remove_component_from_short_list_for_file (NautilusFile *file,
@@ -74,6 +72,8 @@ GnomeVFSResult nautilus_mime_extend_all_applications_for_file
/* Only "user" entries may be removed. */
GnomeVFSResult nautilus_mime_remove_from_all_applications_for_file (NautilusFile *file,
GList *applications);
+gboolean nautilus_mime_has_any_components_for_uri_scheme (const char *uri_scheme);
+
/* No way to add to all components; oafinfo database assumed trusted in this regard. */
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c
index 9166fa4d9..b136fe8e4 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/nautilus-directory.c
@@ -1645,10 +1645,8 @@ nautilus_self_check_directory (void)
EEL_CHECK_STRING_RESULT (nautilus_directory_make_uri_canonical ("http://le-hackeur.org/dir/"), "http://le-hackeur.org/dir");
/* FIXME bugzilla.eazel.com 5068: the "nested" URI loses some characters here. Maybe that's OK because we escape them in practice? */
EEL_CHECK_STRING_RESULT (nautilus_directory_make_uri_canonical ("search://[file://]file_name contains stuff"), "search://[file/]file_name contains stuff");
-#ifdef EAZEL_SERVICES
EEL_CHECK_STRING_RESULT (nautilus_directory_make_uri_canonical ("eazel-services:/~turtle"), "eazel-services:///~turtle");
EEL_CHECK_STRING_RESULT (nautilus_directory_make_uri_canonical ("eazel-services:///~turtle"), "eazel-services:///~turtle");
-#endif
}
#endif /* !NAUTILUS_OMIT_SELF_CHECK */
diff --git a/libnautilus-private/nautilus-mime-actions.c b/libnautilus-private/nautilus-mime-actions.c
index bfbd46ee5..b8e51febb 100644
--- a/libnautilus-private/nautilus-mime-actions.c
+++ b/libnautilus-private/nautilus-mime-actions.c
@@ -815,6 +815,46 @@ nautilus_mime_has_any_components_for_file (NautilusFile *file)
return result;
}
+
+static GList *
+mime_get_all_components_for_uri_scheme (const char *uri_scheme)
+{
+ GList *info_list;
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (eel_strlen (uri_scheme) > 0, NULL);
+
+ CORBA_exception_init (&ev);
+
+ info_list = nautilus_do_component_query (NULL,
+ uri_scheme,
+ NULL,
+ TRUE,
+ NULL,
+ NULL,
+ NULL,
+ &ev);
+
+ CORBA_exception_free (&ev);
+
+ return info_list;
+}
+
+gboolean
+nautilus_mime_has_any_components_for_uri_scheme (const char *uri_scheme)
+{
+ GList *list;
+ gboolean result;
+
+ g_return_val_if_fail (eel_strlen (uri_scheme) > 0, FALSE);
+
+ list = mime_get_all_components_for_uri_scheme (uri_scheme);
+ result = list != NULL;
+ gnome_vfs_mime_component_list_free (list);
+
+ return result;
+}
+
GnomeVFSResult
nautilus_mime_set_default_action_type_for_file (NautilusFile *file,
GnomeVFSMimeActionType action_type)
@@ -1422,7 +1462,7 @@ make_oaf_query_with_uri_scheme_only (const char *uri_scheme,
/* The explicit metafile iid query for the %s above. */
, explicit_iid_query,
extra_requirements != NULL ? extra_requirements : "true");
-
+
return result;
}
diff --git a/libnautilus-private/nautilus-mime-actions.h b/libnautilus-private/nautilus-mime-actions.h
index 8390df21d..0c0b38d3d 100644
--- a/libnautilus-private/nautilus-mime-actions.h
+++ b/libnautilus-private/nautilus-mime-actions.h
@@ -32,9 +32,7 @@
GList *nautilus_mime_actions_get_minimum_file_attributes (void);
GList *nautilus_mime_actions_get_full_file_attributes (void);
-
gboolean nautilus_mime_actions_file_needs_full_file_attributes (NautilusFile *file);
-
GnomeVFSMimeActionType nautilus_mime_get_default_action_type_for_file (NautilusFile *file);
GnomeVFSMimeAction * nautilus_mime_get_default_action_for_file (NautilusFile *file);
GnomeVFSMimeApplication *nautilus_mime_get_default_application_for_file (NautilusFile *file);
@@ -61,8 +59,8 @@ GnomeVFSResult nautilus_mime_add_application_to_short_list_for_file
const char *application_id);
GnomeVFSResult nautilus_mime_remove_application_from_short_list_for_file (NautilusFile *file,
const char *application_id);
-GnomeVFSResult nautilus_mime_set_short_list_components_for_file (NautilusFile *file,
- GList *components);
+GnomeVFSResult nautilus_mime_set_short_list_components_for_file (NautilusFile *file,
+ GList *components);
GnomeVFSResult nautilus_mime_add_component_to_short_list_for_file (NautilusFile *file,
const char *iid);
GnomeVFSResult nautilus_mime_remove_component_from_short_list_for_file (NautilusFile *file,
@@ -74,6 +72,8 @@ GnomeVFSResult nautilus_mime_extend_all_applications_for_file
/* Only "user" entries may be removed. */
GnomeVFSResult nautilus_mime_remove_from_all_applications_for_file (NautilusFile *file,
GList *applications);
+gboolean nautilus_mime_has_any_components_for_uri_scheme (const char *uri_scheme);
+
/* No way to add to all components; oafinfo database assumed trusted in this regard. */
diff --git a/src/Makefile.am b/src/Makefile.am
index 09ef4277e..4c7bbb764 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,6 +13,7 @@ INCLUDES =\
$(LIBRSVG_INCLUDEDIR) \
$(OAF_CFLAGS) \
$(BONOBO_CFLAGS) \
+ $(AMMONITE_CFLAGS) \
$(OAF_CFLAGS) \
$(GCONF_CFLAGS) \
$(GNOMEUI_CFLAGS) \
@@ -26,10 +27,6 @@ INCLUDES =\
-DDATADIR=\""$(datadir)"\" \
$(NULL)
-if EAZEL_SERVICES
-SERVICE_LIBS = $(AMMONITE_LIBS)
-endif
-
LDADD =\
$(top_builddir)/src/file-manager/libnautilus-file-manager.la \
$(top_builddir)/libnautilus/libnautilus.la \
@@ -38,13 +35,13 @@ LDADD =\
$(EEL_LIBS) \
$(LIBRSVG_LIBS) \
$(BONOBO_LIBS) \
+ $(AMMONITE_LIBS) \
$(OAF_LIBS) \
$(GCONF_LIBS) \
$(GNOMEUI_LIBS) \
$(GNOMECANVASPIXBUF_LIBS) \
$(VFS_LIBS) \
$(XML_LIBS) \
- $(SERVICE_LIBS) \
$(NULL)
nautilus_shell_interface_idl_sources = \
@@ -74,11 +71,12 @@ noinst_HEADERS = \
nautilus-main.h \
nautilus-navigation-bar.h \
nautilus-property-browser.h \
+ nautilus-search-bar-criterion-private.h \
+ nautilus-search-bar-criterion.h \
nautilus-search-bar-private.h \
nautilus-search-bar.h \
- nautilus-search-bar-criterion.h \
- nautilus-search-bar-criterion-private.h \
nautilus-self-check-functions.h \
+ nautilus-services.h \
nautilus-shell.h \
nautilus-sidebar-tabs.h \
nautilus-sidebar-title.h \
@@ -115,9 +113,10 @@ nautilus_SOURCES = \
nautilus-main.c \
nautilus-navigation-bar.c \
nautilus-property-browser.c \
- nautilus-search-bar.c \
nautilus-search-bar-criterion.c \
+ nautilus-search-bar.c \
nautilus-self-check-functions.c \
+ nautilus-services.c \
nautilus-shell.c \
nautilus-sidebar-tabs.c \
nautilus-sidebar-title.c \
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index cbc7c4c4f..6934e2f66 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -33,6 +33,7 @@
#include "nautilus-bookmark-parsing.h"
#include "nautilus-bookmarks-window.h"
#include "nautilus-property-browser.h"
+#include "nautilus-services.h"
#include "nautilus-signaller.h"
#include "nautilus-switchable-navigation-bar.h"
#include "nautilus-theme-selector.h"
@@ -287,15 +288,16 @@ stop_button_callback (BonoboUIComponent *component,
nautilus_window_stop_loading (NAUTILUS_WINDOW (user_data));
}
-#ifdef EAZEL_SERVICES
static void
services_button_callback (BonoboUIComponent *component,
gpointer user_data,
const char *verb)
{
- nautilus_window_go_to (NAUTILUS_WINDOW (user_data), "eazel:");
+ char *summary_uri;
+ summary_uri = nautilus_services_get_summary_uri ();
+ nautilus_window_go_to (NAUTILUS_WINDOW (user_data), summary_uri);
+ g_free (summary_uri);
}
-#endif
static void
edit_menu_undo_callback (BonoboUIComponent *component,
@@ -1294,10 +1296,11 @@ nautilus_window_initialize_menus_part_1 (NautilusWindow *window)
BONOBO_UI_VERB ("Stop", stop_button_callback),
-#ifdef EAZEL_SERVICES
- BONOBO_UI_VERB ("Services", services_button_callback),
-#endif
+ BONOBO_UI_VERB_END
+ };
+ BonoboUIVerb services_verbs [] = {
+ BONOBO_UI_VERB ("Services", services_button_callback),
BONOBO_UI_VERB_END
};
@@ -1307,6 +1310,10 @@ nautilus_window_initialize_menus_part_1 (NautilusWindow *window)
bonobo_ui_component_add_verb_list_with_data (window->details->shell_ui, verbs, window);
+ if (nautilus_services_are_enabled ()) {
+ bonobo_ui_component_add_verb_list_with_data (window->details->shell_ui, services_verbs, window);
+ }
+
nautilus_window_update_show_hide_menu_items (window);
/* Keep track of user level changes to update the user level menu item icons */
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index bb883d8b8..a50736747 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -30,9 +30,10 @@
#include <config.h>
#include "nautilus-window-private.h"
-#include "nautilus-main.h"
#include "nautilus-application.h"
#include "nautilus-bookmarks-window.h"
+#include "nautilus-main.h"
+#include "nautilus-services.h"
#include "nautilus-sidebar.h"
#include "nautilus-signaller.h"
#include "nautilus-switchable-navigation-bar.h"
@@ -681,9 +682,9 @@ nautilus_window_constructed (NautilusWindow *window)
bonobo_ui_component_thaw (window->details->shell_ui, NULL);
/* Load the services part of the user interface too if desired. */
-#ifdef EAZEL_SERVICES
- nautilus_window_install_service_ui (window);
-#endif
+ if (nautilus_services_are_enabled ()) {
+ nautilus_window_install_service_ui (window);
+ }
/* set up location bar */
location_bar_box = gtk_hbox_new (FALSE, GNOME_PAD);
diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c
index bb883d8b8..a50736747 100644
--- a/src/nautilus-object-window.c
+++ b/src/nautilus-object-window.c
@@ -30,9 +30,10 @@
#include <config.h>
#include "nautilus-window-private.h"
-#include "nautilus-main.h"
#include "nautilus-application.h"
#include "nautilus-bookmarks-window.h"
+#include "nautilus-main.h"
+#include "nautilus-services.h"
#include "nautilus-sidebar.h"
#include "nautilus-signaller.h"
#include "nautilus-switchable-navigation-bar.h"
@@ -681,9 +682,9 @@ nautilus_window_constructed (NautilusWindow *window)
bonobo_ui_component_thaw (window->details->shell_ui, NULL);
/* Load the services part of the user interface too if desired. */
-#ifdef EAZEL_SERVICES
- nautilus_window_install_service_ui (window);
-#endif
+ if (nautilus_services_are_enabled ()) {
+ nautilus_window_install_service_ui (window);
+ }
/* set up location bar */
location_bar_box = gtk_hbox_new (FALSE, GNOME_PAD);
diff --git a/src/nautilus-services.c b/src/nautilus-services.c
new file mode 100644
index 000000000..77709ab09
--- /dev/null
+++ b/src/nautilus-services.c
@@ -0,0 +1,112 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* nautilus-services-support.c - Functions for using services from Nautilus.
+
+ Copyright (C) 2001 Eazel, Inc.
+
+ The Gnome Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the Gnome Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Authors: Ramiro Estrugo <ramiro@eazel.com>
+*/
+
+#include <config.h>
+#include "nautilus-services.h"
+
+#include <libnautilus-extensions/nautilus-mime-actions.h>
+#ifdef HAVE_AMMONITE
+#include <libtrilobite/libammonite.h>
+#include <bonobo/bonobo-main.h>
+#endif
+
+/* FIXME bugzilla.eazel.com xxxx:
+ *
+ * Perhaps this needs to be a more generic scheme ?
+ */
+#define NAUTILUS_SERVICES_URI_SCHEME "eazel"
+#define NAUTILUS_SERVICES_PROTOCOL "eazel-services://"
+
+/* Make an OAF query to determine whether a component that can handle services
+ * exists. For now, the query is done only once. If we want to have services
+ * be available without having to restart Nautilus, we would have to change this
+ */
+gboolean
+nautilus_services_are_enabled (void)
+{
+ static gboolean enabled = FALSE;
+ static gboolean enabled_known = FALSE;
+
+ if (!enabled_known) {
+ enabled = nautilus_mime_has_any_components_for_uri_scheme (NAUTILUS_SERVICES_URI_SCHEME);
+ enabled_known = TRUE;
+ }
+
+ return enabled;
+}
+
+char *
+nautilus_services_get_summary_uri (void)
+{
+ return g_strdup (NAUTILUS_SERVICES_URI_SCHEME ":");
+}
+
+char *
+nautilus_services_get_user_name (void)
+{
+#ifdef HAVE_AMMONITE
+ if (ammonite_init (bonobo_poa ())) {
+ return ammonite_get_default_user_username ();
+ }
+#endif
+
+ return NULL;
+}
+
+char *
+nautilus_services_get_online_storage_uri (void)
+{
+ char *user_name;
+ char *uri;
+
+ user_name = nautilus_services_get_user_name ();
+
+ /* FIXME bugzilla.eazel.com 5036: user feedback needs to be displayed in this case */
+ /* Something better than just going to the summary page */
+ if (user_name == NULL) {
+ return nautilus_services_get_summary_uri ();
+ }
+
+ uri = g_strdup_printf ("%s/~%s", NAUTILUS_SERVICES_PROTOCOL, user_name);
+ g_free (user_name);
+
+ return uri;
+}
+
+char *
+nautilus_services_get_software_catalog_uri (void)
+{
+ char *user_name;
+ char *uri;
+
+ user_name = nautilus_services_get_user_name ();
+
+ uri = user_name != NULL ?
+ g_strdup ("eazel-services:///catalog") :
+ g_strdup ("eazel-services://anonymous/catalog");
+
+ g_free (user_name);
+
+ return uri;
+}
diff --git a/src/nautilus-services.h b/src/nautilus-services.h
new file mode 100644
index 000000000..4581d047a
--- /dev/null
+++ b/src/nautilus-services.h
@@ -0,0 +1,37 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* nautilus-services-support.h - Functions for using services from Nautilus.
+
+ Copyright (C) 2001 Eazel, Inc.
+
+ The Gnome Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the Gnome Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Authors: Ramiro Estrugo <ramiro@eazel.com>
+*/
+
+#ifndef NAUTILUS_SERVICES_H
+#define NAUTILUS_SERVICES_H
+
+#include <glib.h>
+
+gboolean nautilus_services_are_enabled (void);
+char * nautilus_services_get_summary_uri (void);
+char * nautilus_services_get_user_name (void);
+char * nautilus_services_get_online_storage_uri (void);
+char * nautilus_services_get_software_catalog_uri (void);
+
+#endif /* NAUTILUS_SERVICES_H */
+
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index bb883d8b8..a50736747 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -30,9 +30,10 @@
#include <config.h>
#include "nautilus-window-private.h"
-#include "nautilus-main.h"
#include "nautilus-application.h"
#include "nautilus-bookmarks-window.h"
+#include "nautilus-main.h"
+#include "nautilus-services.h"
#include "nautilus-sidebar.h"
#include "nautilus-signaller.h"
#include "nautilus-switchable-navigation-bar.h"
@@ -681,9 +682,9 @@ nautilus_window_constructed (NautilusWindow *window)
bonobo_ui_component_thaw (window->details->shell_ui, NULL);
/* Load the services part of the user interface too if desired. */
-#ifdef EAZEL_SERVICES
- nautilus_window_install_service_ui (window);
-#endif
+ if (nautilus_services_are_enabled ()) {
+ nautilus_window_install_service_ui (window);
+ }
/* set up location bar */
location_bar_box = gtk_hbox_new (FALSE, GNOME_PAD);
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index cbc7c4c4f..6934e2f66 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -33,6 +33,7 @@
#include "nautilus-bookmark-parsing.h"
#include "nautilus-bookmarks-window.h"
#include "nautilus-property-browser.h"
+#include "nautilus-services.h"
#include "nautilus-signaller.h"
#include "nautilus-switchable-navigation-bar.h"
#include "nautilus-theme-selector.h"
@@ -287,15 +288,16 @@ stop_button_callback (BonoboUIComponent *component,
nautilus_window_stop_loading (NAUTILUS_WINDOW (user_data));
}
-#ifdef EAZEL_SERVICES
static void
services_button_callback (BonoboUIComponent *component,
gpointer user_data,
const char *verb)
{
- nautilus_window_go_to (NAUTILUS_WINDOW (user_data), "eazel:");
+ char *summary_uri;
+ summary_uri = nautilus_services_get_summary_uri ();
+ nautilus_window_go_to (NAUTILUS_WINDOW (user_data), summary_uri);
+ g_free (summary_uri);
}
-#endif
static void
edit_menu_undo_callback (BonoboUIComponent *component,
@@ -1294,10 +1296,11 @@ nautilus_window_initialize_menus_part_1 (NautilusWindow *window)
BONOBO_UI_VERB ("Stop", stop_button_callback),
-#ifdef EAZEL_SERVICES
- BONOBO_UI_VERB ("Services", services_button_callback),
-#endif
+ BONOBO_UI_VERB_END
+ };
+ BonoboUIVerb services_verbs [] = {
+ BONOBO_UI_VERB ("Services", services_button_callback),
BONOBO_UI_VERB_END
};
@@ -1307,6 +1310,10 @@ nautilus_window_initialize_menus_part_1 (NautilusWindow *window)
bonobo_ui_component_add_verb_list_with_data (window->details->shell_ui, verbs, window);
+ if (nautilus_services_are_enabled ()) {
+ bonobo_ui_component_add_verb_list_with_data (window->details->shell_ui, services_verbs, window);
+ }
+
nautilus_window_update_show_hide_menu_items (window);
/* Keep track of user level changes to update the user level menu item icons */
diff --git a/src/nautilus-window-service-ui.c b/src/nautilus-window-service-ui.c
index 868ed0a02..4a868ef43 100644
--- a/src/nautilus-window-service-ui.c
+++ b/src/nautilus-window-service-ui.c
@@ -25,20 +25,21 @@
#include <config.h>
#include "nautilus-window-service-ui.h"
-#include <bonobo/bonobo-ui-util.h>
+#include "nautilus-services.h"
#include "nautilus-window-private.h"
+#include <bonobo/bonobo-ui-util.h>
#include <gtk/gtksignal.h>
-#ifdef EAZEL_SERVICES
-#include <libtrilobite/libammonite.h>
-#include <bonobo/bonobo-main.h>
static void
goto_services_summary (BonoboUIComponent *component,
gpointer callback_data,
const char *verb)
{
- nautilus_window_go_to (NAUTILUS_WINDOW (callback_data),
- "eazel:");
+ char *summary_uri;
+
+ summary_uri = nautilus_services_get_summary_uri ();
+ nautilus_window_go_to (NAUTILUS_WINDOW (callback_data), summary_uri);
+ g_free (summary_uri);
}
static void
@@ -46,28 +47,11 @@ goto_online_storage (BonoboUIComponent *component,
gpointer callback_data,
const char *verb)
{
- char *url;
- char *user_name;
+ char *online_storage_uri;
- if ( ammonite_init (bonobo_poa())) {
- user_name = ammonite_get_default_user_username ();
- } else {
- user_name = NULL;
- }
-
- if (user_name == NULL) {
- url = g_strdup ("eazel:");
- /* FIXME bugzilla.eazel.com 5036: user feedback needs to be displayed in this case */
- /* Something better than just going to the summary page */
-
- } else {
- url = g_strdup_printf ("eazel-services:///~%s", user_name);
- g_free (user_name);
- user_name = NULL;
- }
- nautilus_window_go_to (NAUTILUS_WINDOW (callback_data), url);
- g_free (url);
- url = NULL;
+ online_storage_uri = nautilus_services_get_online_storage_uri ();
+ nautilus_window_go_to (NAUTILUS_WINDOW (callback_data), online_storage_uri);
+ g_free (online_storage_uri);
}
static void
@@ -75,30 +59,11 @@ goto_software_catalog (BonoboUIComponent *component,
gpointer callback_data,
const char *verb)
{
- char *url;
- gboolean logged_in;
- char *user_name;
-
- if (ammonite_init (bonobo_poa())) {
- user_name = ammonite_get_default_user_username ();
-
- logged_in = (NULL != user_name);
- g_free (user_name);
- } else {
- logged_in = FALSE;
- }
-
-
- if (!logged_in) {
- url = g_strdup ("eazel-services://anonymous/catalog");
- } else {
- url = g_strdup ("eazel-services:///catalog");
- }
-
- nautilus_window_go_to (NAUTILUS_WINDOW (callback_data), url);
- g_free (url);
- url = NULL;
+ char *software_catalog_uri;
+ software_catalog_uri = nautilus_services_get_software_catalog_uri ();
+ nautilus_window_go_to (NAUTILUS_WINDOW (callback_data), software_catalog_uri);
+ g_free (software_catalog_uri);
}
static void
@@ -143,6 +108,3 @@ nautilus_window_install_service_ui (NautilusWindow *window)
detach_service_ui,
service_ui);
}
-
-#endif
-
diff --git a/src/nautilus-window-toolbars.c b/src/nautilus-window-toolbars.c
index 504d90d11..f2a2b8dc2 100644
--- a/src/nautilus-window-toolbars.c
+++ b/src/nautilus-window-toolbars.c
@@ -29,23 +29,24 @@
#include <config.h>
#include "nautilus-application.h"
+#include "nautilus-services.h"
#include "nautilus-window-manage-views.h"
#include "nautilus-window-private.h"
#include "nautilus-window.h"
#include <bonobo.h>
+#include <eel/eel-gnome-extensions.h>
+#include <eel/eel-gtk-extensions.h>
+#include <eel/eel-string.h>
#include <gtk/gtkframe.h>
#include <gtk/gtktogglebutton.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-app.h>
#include <libgnomeui/gnome-app-helper.h>
+#include <libgnomeui/gnome-app.h>
#include <libgnomeui/gnome-preferences.h>
#include <libnautilus-extensions/nautilus-bonobo-extensions.h>
#include <libnautilus-extensions/nautilus-bookmark.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
-#include <eel/eel-gnome-extensions.h>
-#include <eel/eel-gtk-extensions.h>
-#include <eel/eel-string.h>
#include <libnautilus-extensions/nautilus-theme.h>
static void
@@ -306,9 +307,13 @@ set_up_toolbar_images (NautilusWindow *window)
set_up_standard_bonobo_button (window, "/Toolbar/Toggle Find Mode", "Search", FALSE);
set_up_standard_bonobo_button (window, "/Toolbar/Go to Web Search", "SearchWeb", TRUE);
set_up_standard_bonobo_button (window, "/Toolbar/Stop", "Stop", FALSE);
-#ifdef EAZEL_SERVICES
- set_up_standard_bonobo_button (window, "/Toolbar/Extra Buttons Placeholder/Services", "Services", TRUE);
-#endif
+
+ /* Set up the services toolbar button if needed */
+ if (nautilus_services_are_enabled ()) {
+ set_up_standard_bonobo_button (window, "/Toolbar/Extra Buttons Placeholder/Services",
+ "Services", TRUE);
+ }
+
bonobo_ui_component_thaw (window->details->shell_ui, NULL);
nautilus_window_ui_thaw (window);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index bb883d8b8..a50736747 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -30,9 +30,10 @@
#include <config.h>
#include "nautilus-window-private.h"
-#include "nautilus-main.h"
#include "nautilus-application.h"
#include "nautilus-bookmarks-window.h"
+#include "nautilus-main.h"
+#include "nautilus-services.h"
#include "nautilus-sidebar.h"
#include "nautilus-signaller.h"
#include "nautilus-switchable-navigation-bar.h"
@@ -681,9 +682,9 @@ nautilus_window_constructed (NautilusWindow *window)
bonobo_ui_component_thaw (window->details->shell_ui, NULL);
/* Load the services part of the user interface too if desired. */
-#ifdef EAZEL_SERVICES
- nautilus_window_install_service_ui (window);
-#endif
+ if (nautilus_services_are_enabled ()) {
+ nautilus_window_install_service_ui (window);
+ }
/* set up location bar */
location_bar_box = gtk_hbox_new (FALSE, GNOME_PAD);