diff options
author | Eskil Heyn Olsen <eskil@src.gnome.org> | 2000-06-23 00:38:28 +0000 |
---|---|---|
committer | Eskil Heyn Olsen <eskil@src.gnome.org> | 2000-06-23 00:38:28 +0000 |
commit | 29cfbcff0f06d4312d0525d2a99668e83ba7c7be (patch) | |
tree | 451b5627def5c95448936ab90059ff854517b87a | |
parent | e77c95e0cb1b1360ee27fb95d4c4d4e9bb4406bf (diff) | |
download | nautilus-29cfbcff0f06d4312d0525d2a99668e83ba7c7be.tar.gz |
Vamped to use the gtk+ client wrapper for the corba nastiness.
* components/services/install/command-line/Makefile.am:
*
components/services/install/command-line/eazel-alt-install-corba.c:
(main):
Vamped to use the gtk+ client wrapper for the corba nastiness.
* components/services/install/idl/trilobite-eazel-install.idl:
Added the query call.
* components/services/install/lib/Makefile.am:
* components/services/install/lib/eazel-install-corba-callback.c:
(eazel_install_callback_new), (eazel_install_callback_corba),
(eazel_install_callback_install_packages),
(eazel_install_callback_query):
* components/services/install/lib/eazel-install-corba-callback.h:
* components/services/install/lib/eazel-install-corba-types.c:
(corba_category_list_from_categorydata_list):
* components/services/install/lib/eazel-install-corba-types.h:
* components/services/install/lib/eazel-install-corba.c:
(impl_Eazel_Install_install_packages), (impl_Eazel_Install_query),
(eazel_install_get_epv):
* components/services/install/lib/eazel-install-metadata.c:
(transferoptions_destroy), (installoptions_destroy):
* components/services/install/lib/eazel-install-object.c:
(eazel_install_destroy), (eazel_install_initialize),
(eazel_install_get_type), (eazel_install_new_with_config),
(create_temporary_directory),
(eazel_install_fetch_remote_package_list),
(eazel_install_open_log), (eazel_install_install_packages),
(eazel_install_uninstall), (eazel_install_emit_download_failed),
(eazel_install_emit_install_failed):
* components/services/install/lib/eazel-install-protocols.c:
(http_fetch_remote_file), (ftp_fetch_remote_file),
(local_fetch_remote_file), (get_url_for_package),
(get_search_url_for_package):
* components/services/install/lib/eazel-install-public.h:
* components/services/install/lib/eazel-install-query.c:
(eazel_install_query_package_system):
* components/services/install/lib/eazel-install-query.h:
* components/services/install/lib/eazel-install-rpm-glue.c:
(download_all_packages), (install_all_packages),
(uninstall_packages), (uninstall_a_package), (do_rpm_install),
(do_rpm_uninstall), (eazel_install_prune_packages_helper),
(eazel_install_load_rpm_headers),
(eazel_install_prepare_rpm_system),
(eazel_install_add_headers_to_rpm_set),
(eazel_install_fetch_rpm_dependencies),
(eazel_install_ensure_deps), (rpm_uninstall):
* components/services/install/lib/eazel-install-rpm-glue.h:
* components/services/install/lib/eazel-install-types.h:
* components/services/install/server/main.c:
(trilobite_service_factory_destroy):
i18n a lot of strings. Did some more work on the gtk+ wrapper for
the corba interface to libinstall. Added categories to the idl and
the code. Added comments to the gtk+ interface, converters to/from
the corba structs and CategoryData. Also closed bug 1024, 982, 980 and 1092.
* components/services/time/command-line/main.c: (main):
* components/services/time/service/trilobite-eazel-time-service.c:
(trilobite_eazel_time_service_destroy):
* components/services/trilobite/libtrilobite/trilobite-service.c:
(trilobite_service_destroy):
* components/services/trilobite/sample/command-line/main.c: (main):
* components/services/trilobite/sample/service/main.c:
(trilobite_service_factory_destroy):
*
components/services/trilobite/sample/service/sample-service-impl.c:
(sample_service_destroy):
Fixed the component destroy routines with Darins help.
28 files changed, 591 insertions, 248 deletions
@@ -1,3 +1,75 @@ +2000-06-22 Eskil Heyn Olsen <eskil@eazel.com> + + * components/services/install/command-line/Makefile.am: + * + components/services/install/command-line/eazel-alt-install-corba.c: + (main): + Vamped to use the gtk+ client wrapper for the corba nastiness. + + * components/services/install/idl/trilobite-eazel-install.idl: + Added the query call. + + * components/services/install/lib/Makefile.am: + * components/services/install/lib/eazel-install-corba-callback.c: + (eazel_install_callback_new), (eazel_install_callback_corba), + (eazel_install_callback_install_packages), + (eazel_install_callback_query): + * components/services/install/lib/eazel-install-corba-callback.h: + * components/services/install/lib/eazel-install-corba-types.c: + (corba_category_list_from_categorydata_list): + * components/services/install/lib/eazel-install-corba-types.h: + * components/services/install/lib/eazel-install-corba.c: + (impl_Eazel_Install_install_packages), (impl_Eazel_Install_query), + (eazel_install_get_epv): + * components/services/install/lib/eazel-install-metadata.c: + (transferoptions_destroy), (installoptions_destroy): + * components/services/install/lib/eazel-install-object.c: + (eazel_install_destroy), (eazel_install_initialize), + (eazel_install_get_type), (eazel_install_new_with_config), + (create_temporary_directory), + (eazel_install_fetch_remote_package_list), + (eazel_install_open_log), (eazel_install_install_packages), + (eazel_install_uninstall), (eazel_install_emit_download_failed), + (eazel_install_emit_install_failed): + * components/services/install/lib/eazel-install-protocols.c: + (http_fetch_remote_file), (ftp_fetch_remote_file), + (local_fetch_remote_file), (get_url_for_package), + (get_search_url_for_package): + * components/services/install/lib/eazel-install-public.h: + * components/services/install/lib/eazel-install-query.c: + (eazel_install_query_package_system): + * components/services/install/lib/eazel-install-query.h: + * components/services/install/lib/eazel-install-rpm-glue.c: + (download_all_packages), (install_all_packages), + (uninstall_packages), (uninstall_a_package), (do_rpm_install), + (do_rpm_uninstall), (eazel_install_prune_packages_helper), + (eazel_install_load_rpm_headers), + (eazel_install_prepare_rpm_system), + (eazel_install_add_headers_to_rpm_set), + (eazel_install_fetch_rpm_dependencies), + (eazel_install_ensure_deps), (rpm_uninstall): + * components/services/install/lib/eazel-install-rpm-glue.h: + * components/services/install/lib/eazel-install-types.h: + * components/services/install/server/main.c: + (trilobite_service_factory_destroy): + i18n a lot of strings. Did some more work on the gtk+ wrapper for + the corba interface to libinstall. Added categories to the idl and + the code. Added comments to the gtk+ interface, converters to/from + the corba structs and CategoryData. Also closed bug 1024, 982, 980 and 1092. + + * components/services/time/command-line/main.c: (main): + * components/services/time/service/trilobite-eazel-time-service.c: + (trilobite_eazel_time_service_destroy): + * components/services/trilobite/libtrilobite/trilobite-service.c: + (trilobite_service_destroy): + * components/services/trilobite/sample/command-line/main.c: (main): + * components/services/trilobite/sample/service/main.c: + (trilobite_service_factory_destroy): + * + components/services/trilobite/sample/service/sample-service-impl.c: + (sample_service_destroy): + Fixed the component destroy routines with Darins help. + 2000-06-22 Ramiro Estrugo <ramiro@eazel.com> * components/websearch/Makefile.am: diff --git a/components/services/install/command-line/Makefile.am b/components/services/install/command-line/Makefile.am index b981a3e7f..427602ba2 100644 --- a/components/services/install/command-line/Makefile.am +++ b/components/services/install/command-line/Makefile.am @@ -20,13 +20,7 @@ INCLUDES = \ $(WERROR) \ $(NULL) -bin_PROGRAMS = eazel-alt-install-corba - -eazel_alt_install_corba_SOURCES = \ - eazel-alt-install-corba.c \ - $(NULL) - -eazel_alt_install_corba_LDADD = \ +LDADD = \ $(top_builddir)/components/services/install/lib/libinstall_corba.a\ $(top_builddir)/components/services/install/lib/libinstall_base.a \ $(top_builddir)/components/services/trilobite/libtrilobite/libtrilobite.la \ @@ -35,3 +29,14 @@ eazel_alt_install_corba_LDADD = \ $(GHTTP_LIBS) \ $(RPM_LIBS) \ $(NULL) + +bin_PROGRAMS = eazel-install eazel-install-query + +eazel_install_SOURCES = \ + eazel-alt-install-corba.c \ + $(NULL) + +eazel_install_query_SOURCES = \ + eazel-install-query.c \ + $(NULL) + diff --git a/components/services/install/command-line/eazel-alt-install-corba.c b/components/services/install/command-line/eazel-alt-install-corba.c index 39cdaaf6f..5f286f263 100644 --- a/components/services/install/command-line/eazel-alt-install-corba.c +++ b/components/services/install/command-line/eazel-alt-install-corba.c @@ -284,7 +284,6 @@ done (EazelInstallCallback *service, int main(int argc, char *argv[]) { poptContext ctxt; - Trilobite_Eazel_PackageStructList *packagelist; GList *packages; GList *categories; char *str; @@ -312,7 +311,10 @@ int main(int argc, char *argv[]) { packages = g_list_prepend (packages, create_package (str)); } if (packages) { - packagelist = corba_packagestructlist_from_packagedata_list (packages); + CategoryData *category; + category = g_new0 (CategoryData, 1); + category->packages = packages; + categories = g_list_prepend (NULL, category); } else { g_message ("Using remote list "); } @@ -351,25 +353,31 @@ int main(int argc, char *argv[]) { installservice = bonobo_object_query_interface (BONOBO_OBJECT (service), "IDL:Trilobite/Eazel/Install:1.0"); if (installservice != CORBA_OBJECT_NIL) { EazelInstallCallback *cb; + set_parameters_from_command_line (installservice); - cb = eazel_install_callback_new (); + cb = eazel_install_callback_new (installservice); + gtk_signal_connect (GTK_OBJECT (cb), "download_progress", eazel_download_progress_signal, "Download progress"); gtk_signal_connect (GTK_OBJECT (cb), "install_progress", eazel_install_progress_signal, "Install progress"); gtk_signal_connect (GTK_OBJECT (cb), "install_failed", install_failed, ""); gtk_signal_connect (GTK_OBJECT (cb), "download_failed", download_failed, NULL); gtk_signal_connect (GTK_OBJECT (cb), "dependency_check", dep_check, NULL); gtk_signal_connect (GTK_OBJECT (cb), "done", done, NULL); + + eazel_install_callback_install_packages (cb, categories, &ev); + + fprintf (stdout, "\nEntering main loop...\n"); + bonobo_main (); - Trilobite_Eazel_Install_install_packages (installservice, packagelist, eazel_install_callback_corba (cb), &ev); + /* Cleanup the stuff from query_interface */ + Bonobo_Unknown_unref (installservice, &ev); + CORBA_Object_release (installservice, &ev); } else { - g_error ("The bonobo object "); + g_error ("The bonobo object does not contain a IDL:Trilobite/Eazel/Install object"); } - bonobo_main (); - Bonobo_Unknown_unref (installservice, &ev); /* for the query_interface */ + /* Corba cleanup */ bonobo_object_unref (BONOBO_OBJECT (service)); /* for the object_activate */ - CORBA_Object_release (installservice, &ev); - CORBA_exception_free (&ev); diff --git a/components/services/install/idl/trilobite-eazel-install.idl b/components/services/install/idl/trilobite-eazel-install.idl index 9f458d639..7c84b43d0 100644 --- a/components/services/install/idl/trilobite-eazel-install.idl +++ b/components/services/install/idl/trilobite-eazel-install.idl @@ -77,6 +77,12 @@ module Trilobite { }; typedef sequence <PackageStruct> PackageStructList; + struct CategoryStruct { + string name; + PackageStructList packages; + }; + typedef sequence <CategoryStruct> CategoryStructList; + interface InstallCallback : Bonobo::Unknown { /* Called during download of a file */ oneway void download_progress (in string file, in long amount, in long total); @@ -118,9 +124,11 @@ module Trilobite { oneway void uninstall (in string packagelist, in InstallCallback cb); /* These are for installing/uninstalling specific packages */ - oneway void install_packages (in PackageStructList packages, in InstallCallback cb); - oneway void uninstall_packages (in PackageStructList packages, in InstallCallback cb); + oneway void install_packages (in CategoryStructList categories, in InstallCallback cb); + oneway void uninstall_packages (in CategoryStructList categories, in InstallCallback cb); + /* Run a query to the package sys */ + PackageStructList query (in string query); }; }; }; diff --git a/components/services/install/lib/Makefile.am b/components/services/install/lib/Makefile.am index d406a38f7..6477ad4be 100644 --- a/components/services/install/lib/Makefile.am +++ b/components/services/install/lib/Makefile.am @@ -29,7 +29,7 @@ noinst_HEADERS = \ eazel-install-metadata.h \ eazel-install-protocols.h \ eazel-install-rpm-glue.h \ - eazel-install-rpm-glue.h \ + eazel-install-query.h \ eazel-install-tests.h \ eazel-install-xml-package-list.h \ eazel-install-private.h \ @@ -50,6 +50,8 @@ libinstall_base_a_SOURCES = \ eazel-install-metadata.c \ eazel-install-protocols.c \ eazel-install-rpm-glue.c \ + eazel-install-query-lex.c \ + eazel-install-query.c \ eazel-install-tests.c \ eazel-install-xml-package-list.c \ eazel-install-object.c \ @@ -60,6 +62,12 @@ libinstall_gtk_a_SOURCES = \ eazel-install-object.c \ $(NULL) +EXTRA_DIST = eazel-install-query.l hest + +eazel-install-query-lex.c: $(srcdir)/eazel-install-query-lex.l eazel-install-query-parse.h + @rm -f $@ + $(LEX) -t $(srcdir)/eazel-install-query-lex.l >$@ + ## CORBA magic CORBA_GENERATED = \ diff --git a/components/services/install/lib/eazel-install-corba-callback.c b/components/services/install/lib/eazel-install-corba-callback.c index 4ed6baf88..a2de75d0e 100644 --- a/components/services/install/lib/eazel-install-corba-callback.c +++ b/components/services/install/lib/eazel-install-corba-callback.c @@ -326,12 +326,14 @@ eazel_install_callback_get_type() { } EazelInstallCallback* -eazel_install_callback_new() +eazel_install_callback_new(Trilobite_Eazel_Install installservice) { EazelInstallCallback *service; service = EAZEL_INSTALL_CALLBACK (gtk_object_new (TYPE_EAZEL_INSTALL_CALLBACK, NULL)); + service->installservice = installservice; + return service; } @@ -340,3 +342,31 @@ eazel_install_callback_corba (EazelInstallCallback *service) { return service->cb; } + +void +eazel_install_callback_install_packages (EazelInstallCallback *service, + GList *categories, + CORBA_Environment *ev) +{ + Trilobite_Eazel_CategoryStructList *corbacats; + corbacats = corba_category_list_from_categorydata_list (categories); + Trilobite_Eazel_Install_install_packages (service->installservice, + corbacats, + eazel_install_callback_corba (service), ev); +} + +GList* +eazel_install_callback_query (EazelInstallCallback *service, + char *query, + CORBA_Environment *ev) +{ + GList *result; + Trilobite_Eazel_PackageStructList *corbares; + + /* FIXME: bugzilla.eazel.com 1446 */ + + corbares = Trilobite_Eazel_Install_query (service->installservice, + query, + ev); + return result; +} diff --git a/components/services/install/lib/eazel-install-corba-callback.h b/components/services/install/lib/eazel-install-corba-callback.h index e5e32ece6..b11059f52 100644 --- a/components/services/install/lib/eazel-install-corba-callback.h +++ b/components/services/install/lib/eazel-install-corba-callback.h @@ -47,17 +47,26 @@ struct _EazelInstallCallbackClass { BonoboObjectClass parent_class; - /* signal prototypes */ + /* Called during the download of a file */ void (*download_progress) (EazelInstallCallback *service, const char *name, int amount, int total); + /* Called during install of a package */ void (*install_progress) (EazelInstallCallback *service, const PackageData *pack, int amount, int total); + /* Called during uninstall of a package */ void (*uninstall_progress) (EazelInstallCallback *service, const PackageData *pack, int amount, int total); + /* Called when a dependency check is being resolved */ void (*dependency_check) (EazelInstallCallback *service, const PackageData *package, const PackageData *needed ); + /* Called when a file could not be downloaded */ void (*download_failed) (EazelInstallCallback *service, char *name); + /* Called when a package install request fails, eg. for dependency reasons. + pd->soft_depends and pd->breaks can be traversed to see why the package + failed */ void (*install_failed) (EazelInstallCallback *service, PackageData *pd); + /* Same as install_failed... */ void (*uninstall_failed) (EazelInstallCallback *service, PackageData *pd); + /* Called when the operation is complete */ void (*done) (); gpointer servant_vepv; @@ -67,16 +76,32 @@ struct _EazelInstallCallback { BonoboObject parent; Trilobite_Eazel_InstallCallback cb; + Trilobite_Eazel_Install installservice; }; -EazelInstallCallback *eazel_install_callback_new (void); -GtkType eazel_install_callback_get_type (void); +/* Create a new eazel-install-callback object */ +EazelInstallCallback *eazel_install_callback_new (Trilobite_Eazel_Install installservice); +/* Destroy the eazel-install-callback object */ void eazel_install_callback_destroy (GtkObject *object); +/* Request the installation of a set of packages in categories. + If categories = NULL, the service tries to fetch the packagelist + from the server. See the trilobite-eazel-install.idl file for + the function to specify packagelist name */ +void eazel_install_callback_install_packages (EazelInstallCallback *service, + GList *categories, + CORBA_Environment *ev); + +GList* eazel_install_callback_query (EazelInstallCallback *service, + char *query, + CORBA_Environment *ev); + + +/* Stuff */ +GtkType eazel_install_callback_get_type (void); POA_Trilobite_Eazel_InstallCallback__epv *eazel_install_callback_get_epv (void); Trilobite_Eazel_InstallCallback eazel_install_callback_create_corba_object (BonoboObject *service); - -Trilobite_Eazel_InstallCallback eazel_install_callback_corba (EazelInstallCallback *service); +Trilobite_Eazel_InstallCallback eazel_install_callback_corba (EazelInstallCallback *service); #ifdef __cplusplus } diff --git a/components/services/install/lib/eazel-install-corba-types.c b/components/services/install/lib/eazel-install-corba-types.c index e8d70a6f4..e68569ff6 100644 --- a/components/services/install/lib/eazel-install-corba-types.c +++ b/components/services/install/lib/eazel-install-corba-types.c @@ -236,3 +236,34 @@ packagedata_from_corba_packagestruct (const Trilobite_Eazel_PackageStruct *corba return pack; } + +Trilobite_Eazel_CategoryStructList* +corba_category_list_from_categorydata_list (GList *categories) +{ + Trilobite_Eazel_CategoryStructList *corbacats; + GList *iterator; + int i; + + g_return_val_if_fail (categories != NULL, NULL); + + corbacats = Trilobite_Eazel_CategoryStructList__alloc (); + corbacats->_length = g_list_length (categories); + corbacats->_buffer = CORBA_sequence_Trilobite_Eazel_CategoryStruct_allocbuf (corbacats->_length); + + i = 0; + for (iterator = categories; iterator; iterator = iterator->next) { + CategoryData *cat; + Trilobite_Eazel_CategoryStruct corbacat; + Trilobite_Eazel_PackageStructList *packstructlist; + + cat = (CategoryData*)iterator->data; + corbacat.name = cat->name ? CORBA_string_dup (cat->name) : CORBA_string_dup (""); + packstructlist = corba_packagestructlist_from_packagedata_list (cat->packages); + corbacat.packages = *packstructlist; + CORBA_free (packstructlist); + + corbacats->_buffer[i] = corbacat; + i++; + } + return corbacats; +} diff --git a/components/services/install/lib/eazel-install-corba-types.h b/components/services/install/lib/eazel-install-corba-types.h index 310afc0d5..ab5a71d2e 100644 --- a/components/services/install/lib/eazel-install-corba-types.h +++ b/components/services/install/lib/eazel-install-corba-types.h @@ -34,6 +34,8 @@ Trilobite_Eazel_PackageDataStructList corba_packagedatastructlist_from_packageda Trilobite_Eazel_PackageStruct corba_packagestruct_from_packagedata (const PackageData *pack); Trilobite_Eazel_PackageDataStruct corba_packagedatastruct_from_packagedata (const PackageData *pack); +Trilobite_Eazel_CategoryStructList* corba_category_list_from_categorydata_list (GList *categories); + GList* packagedata_list_from_corba_packagedatastructlist (const Trilobite_Eazel_PackageDataStructList corbapack); GList *packagedata_list_from_corba_packagestructlist (const Trilobite_Eazel_PackageStructList corbapack); PackageData *packagedata_from_corba_packagedatastruct (const Trilobite_Eazel_PackageDataStruct corbapack); diff --git a/components/services/install/lib/eazel-install-corba.c b/components/services/install/lib/eazel-install-corba.c index e87cf33ab..13a4f213c 100644 --- a/components/services/install/lib/eazel-install-corba.c +++ b/components/services/install/lib/eazel-install-corba.c @@ -68,41 +68,46 @@ impl_Eazel_Install_uninstall(impl_POA_Trilobite_Eazel_Install *servant, static void impl_Eazel_Install_install_packages(impl_POA_Trilobite_Eazel_Install *servant, - const Trilobite_Eazel_PackageStructList *packagelist, + const Trilobite_Eazel_CategoryStructList *corbacategories, const Trilobite_Eazel_InstallCallback cb, CORBA_Environment * ev) { - GList *packages; GList *categories; - CategoryData *category; - int i; + int i,j; servant->object->callback = cb; - packages = NULL; categories = NULL; - for (i = 0; i < packagelist->_length; i++) { - PackageData *pack; - Trilobite_Eazel_PackageStruct corbapack; - - corbapack = packagelist->_buffer [i]; - pack = packagedata_from_corba_packagestruct (&corbapack); - - g_message ("Installing %s", pack->name); - - /* FIXME bugzilla.eazel.com 1366 - need to copy distribution here as well */ - - packages = g_list_prepend (packages, pack); + for (i = 0; i < corbacategories->_length; i++) { + CategoryData *category; + GList *packages; + Trilobite_Eazel_CategoryStruct corbacategory; + Trilobite_Eazel_PackageStructList packagelist; + + packages = NULL; + corbacategory = corbacategories->_buffer [i]; + packagelist = corbacategory.packages; + + for (j = 0; j < packagelist._length; j++) { + PackageData *pack; + Trilobite_Eazel_PackageStruct corbapack; + + corbapack = packagelist._buffer [j]; + pack = packagedata_from_corba_packagestruct (&corbapack); + + packages = g_list_prepend (packages, pack); + } + category = g_new0 (CategoryData, 1); + category->name = strlen (corbacategory.name)>0 ? g_strdup (corbacategory.name) : NULL; + category->packages = packages; + categories = g_list_prepend (categories, category); } - category = g_new0 (CategoryData, 1); - category->packages = packages; - categories = g_list_prepend (categories, category); + servant->object->callback = cb; eazel_install_install_packages (servant->object, categories); - categorydata_destroy (category); + g_list_foreach (categories, (GFunc)categorydata_destroy_foreach, NULL); g_list_free (categories); return; @@ -299,6 +304,22 @@ impl_Eazel_Install__get_protocol (impl_POA_Trilobite_Eazel_Install *servant, } } +static Trilobite_Eazel_PackageStructList* +impl_Eazel_Install_query (impl_POA_Trilobite_Eazel_Install *servant, + const CORBA_char *query, + CORBA_Environment *ev) +{ + Trilobite_Eazel_PackageStructList *result; + + /* FIXME: bugzilla.eazel.com + Finish this, need to convert the return value to a + corba sequence and return it. + */ + eazel_install_query_package_system (servant->object, query, 0); + + return result; +} + POA_Trilobite_Eazel_Install__epv* eazel_install_get_epv () { @@ -339,6 +360,8 @@ eazel_install_get_epv () epv->_set_tmp_dir = (gpointer)&impl_Eazel_Install__set_tmp_dir; epv->_get_tmp_dir = (gpointer)&impl_Eazel_Install__get_tmp_dir; + epv->query = (gpointer)&impl_Eazel_Install_query; + return epv; }; diff --git a/components/services/install/lib/eazel-install-metadata.c b/components/services/install/lib/eazel-install-metadata.c index 4adaff254..bc6461eb9 100644 --- a/components/services/install/lib/eazel-install-metadata.c +++ b/components/services/install/lib/eazel-install-metadata.c @@ -261,3 +261,27 @@ init_default_transfer_configuration (const char* config_file) { return rv; } /* end init_default_transfer_configuration */ + +void +transferoptions_destroy (TransferOptions *topts) +{ + g_return_if_fail (topts!=NULL); + g_free (topts->hostname); + topts->hostname = NULL; + g_free (topts->pkg_list_storage_path); + topts->pkg_list_storage_path = NULL; + g_free (topts->rpm_storage_path); + topts->rpm_storage_path = NULL; + g_free (topts->tmp_dir); + topts->tmp_dir = NULL; + g_free (topts->rpmrc_file); + topts->rpmrc_file = NULL; +} + +void +installoptions_destroy (InstallOptions *iopts) +{ + g_return_if_fail (iopts!=NULL); + g_free (iopts->pkg_list); + iopts->pkg_list = NULL; +} diff --git a/components/services/install/lib/eazel-install-object.c b/components/services/install/lib/eazel-install-object.c index 7b1ca0a10..3d69fab33 100644 --- a/components/services/install/lib/eazel-install-object.c +++ b/components/services/install/lib/eazel-install-object.c @@ -138,9 +138,9 @@ eazel_install_destroy (GtkObject *object) service = EAZEL_INSTALL (object); - /* FIXME bugzilla.eazel.com 1282. - implement this properly */ - g_message ("in eazel_install_destroy"); + if (GTK_OBJECT_CLASS (eazel_install_parent_class)->destroy) { + GTK_OBJECT_CLASS (eazel_install_parent_class)->destroy (object); + } } static void @@ -374,8 +374,6 @@ eazel_install_initialize (EazelInstall *service) { Trilobite_Eazel_Install corba_service; #endif /* EAZEL_INSTALL_NO_CORBA */ - /* g_message ("in eazel_install_initialize"); */ - g_assert (service != NULL); g_assert (IS_EAZEL_INSTALL (service)); @@ -384,7 +382,7 @@ eazel_install_initialize (EazelInstall *service) { /* This sets the bonobo structures in service using the corba object */ if (!bonobo_object_construct (BONOBO_OBJECT (service), corba_service)) { - g_warning ("bonobo_object_construct failed"); + g_error ("bonobo_object_construct failed"); } #endif /* EAZEL_INSTALL_NO_CORBA */ @@ -404,8 +402,6 @@ GtkType eazel_install_get_type() { static GtkType service_type = 0; - /* g_message ("into eazel_install_get_type"); */ - /* First time it's called ? */ if (!service_type) { @@ -474,9 +470,8 @@ eazel_install_new_with_config (const char *config_file) "server_port", topts->port_number, NULL)); - /* FIXME bugzilla.eazel.com 982: - topts and iopts are leaked at this point. There needs - to be a set of _destroy methods in eazel-install-metadata.c */ + transferoptions_destroy (topts); + installoptions_destroy (iopts); return service; } @@ -491,7 +486,7 @@ create_temporary_directory (const char* tmpdir) retval = mkdir (tmpdir, 0755); if (retval < 0) { if (errno != EEXIST) { - g_error (_("*** Could not create temporary directory! ***\n")); + g_error (_("Could not create temporary directory!\n")); } } } /* end create_temporary_directory */ @@ -514,7 +509,7 @@ eazel_install_fetch_remote_package_list (EazelInstall *service) if (retval == FALSE) { g_free (url); - g_warning ("*** Unable to retrieve package-list.xml! ***\n"); + g_error (_("Unable to retrieve package-list.xml!\n")); return FALSE; } g_free (url); @@ -543,8 +538,6 @@ eazel_install_open_log (EazelInstall *service, { SANITY (service); - g_message ("in eazel_install_open_log"); - if (service->private->logfile) { fclose (service->private->logfile); } @@ -557,11 +550,10 @@ eazel_install_open_log (EazelInstall *service, g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR, (GLogFunc)eazel_install_log, service); - g_message ("out eazel_install_open_log"); return; } - g_message ("Cannot write to file %s, using default log handler", fname); + g_warning (_("Cannot write to file %s, using default log handler"), fname); } void @@ -569,8 +561,6 @@ eazel_install_install_packages (EazelInstall *service, GList *categories) { SANITY (service); - g_message ("eazel_install_install_packages"); - if (!g_file_exists (eazel_install_get_tmp_dir (service))) { create_temporary_directory (eazel_install_get_tmp_dir (service)); } @@ -582,14 +572,14 @@ eazel_install_install_packages (EazelInstall *service, GList *categories) eazel_install_fetch_remote_package_list (service); break; case PROTOCOL_FTP: - g_error ("ftp install not supported"); + g_error (_("ftp install not supported")); break; case PROTOCOL_LOCAL: break; } } if (install_new_packages (service, categories)==FALSE) { - g_warning ("*** Install failed"); + g_warning (_("Install failed")); } eazel_install_emit_done (service); } @@ -599,20 +589,18 @@ eazel_install_uninstall (EazelInstall *service) { SANITY (service); - g_message ("eazel_install_uninstall"); - switch (service->private->iopts->protocol) { case PROTOCOL_HTTP: eazel_install_fetch_remote_package_list (service); break; case PROTOCOL_FTP: - g_error ("ftp install not supported"); + g_error (_("ftp install not supported")); break; case PROTOCOL_LOCAL: break; } if (uninstall_packages (service)==FALSE) { - g_warning ("*** Uninstall failed"); + g_warning (_("*** Uninstall failed")); } } @@ -684,7 +672,6 @@ eazel_install_emit_download_failed (EazelInstall *service, const char *name) { SANITY(service); - g_message ("DOWNLOAD_FAILED %s", name); gtk_signal_emit (GTK_OBJECT (service), signals[DOWNLOAD_FAILED], name); } @@ -708,7 +695,6 @@ eazel_install_emit_install_failed (EazelInstall *service, const PackageData *pd) { SANITY(service); - g_message ("INSTALL_FAILED %s", pd->name); gtk_signal_emit (GTK_OBJECT (service), signals[INSTALL_FAILED], pd); } diff --git a/components/services/install/lib/eazel-install-protocols.c b/components/services/install/lib/eazel-install-protocols.c index 09198f4cc..f02e23f5c 100644 --- a/components/services/install/lib/eazel-install-protocols.c +++ b/components/services/install/lib/eazel-install-protocols.c @@ -52,7 +52,7 @@ http_fetch_remote_file (EazelInstall *service, FILE* file; int total_bytes; - g_message ("Downloading %s...", url); + g_message (_("Downloading %s..."), url); file = fopen (target_file, "wb"); get_failed = 0; @@ -62,7 +62,7 @@ http_fetch_remote_file (EazelInstall *service, if (file == NULL) { get_failed = 1; - g_warning ("Could not open target file %s",target_file); + g_warning (_("Could not open target file %s"),target_file); return FALSE; } @@ -96,7 +96,7 @@ http_fetch_remote_file (EazelInstall *service, } eazel_install_emit_download_progress (service, target_file, total_bytes, total_bytes); if (ghttp_status_code (request) != 200) { - g_warning ("HTTP error: %d %s", ghttp_status_code (request), + g_warning (_("HTTP error: %d %s"), ghttp_status_code (request), ghttp_reason_phrase (request)); get_failed = 1; } @@ -131,7 +131,7 @@ ftp_fetch_remote_file (EazelInstall *service, char* url, const char* target_file) { - g_message ("Downloading %s...", url); + g_message (_("Downloading %s..."), url); g_warning (_("FTP not supported yet")); return FALSE; } @@ -144,7 +144,7 @@ local_fetch_remote_file (EazelInstall *service, { gboolean result; - g_message ("Checking local file %s...", target_file); + g_message (_("Checking local file %s..."), target_file); result = FALSE; if (access (target_file, R_OK|W_OK) == 0) { eazel_install_emit_download_progress (service, target_file, 100, 100); @@ -272,7 +272,7 @@ get_url_for_package (EazelInstall *service, url = NULL; search_url = get_search_url_for_package (service, package); - g_message ("Search URL: %s", search_url); + g_message (_("Search URL: %s"), search_url); request = ghttp_request_new(); if (request == NULL) { @@ -299,12 +299,6 @@ get_url_for_package (EazelInstall *service, url [ ghttp_get_body_len (request)] = 0; } } else { - /* - url = g_strdup_printf("http://%s%s/%s", - eazel_install_get_server (service), - eazel_install_get_rpm_storage_path (service), - rpmfilename_from_packagedata (package)); - */ url = NULL; } break; @@ -344,12 +338,15 @@ char* get_search_url_for_package (EazelInstall *service, /* FIXME: bugzilla.eazel.com 1333 We need to sent distro name at some point. Depends on the rpmsearch cgi script +*/ + /* if (pack->name != DISTRO_UNKNOWN) { char *distro; - distro = g_strconcat ("\"", trilobite_get_distribution_name (pack->distribution, TRUE), "\"", NULL); + distro = g_strdup_printf ("\"%s\"", + trilobite_get_distribution_name (pack->distribution, TRUE)); add_to_url (&url, "&distro=", distro); g_free (distro); } -*/ + */ return url; } diff --git a/components/services/install/lib/eazel-install-public.h b/components/services/install/lib/eazel-install-public.h index 2d927a8dd..95622cb52 100644 --- a/components/services/install/lib/eazel-install-public.h +++ b/components/services/install/lib/eazel-install-public.h @@ -134,6 +134,11 @@ void eazel_install_fetch_pockage_list (EazelInstall *service); void eazel_install_install_packages (EazelInstall *service, GList *categories); void eazel_install_uninstall (EazelInstall *service); +GList* eazel_install_query_package_system (EazelInstall *service, + const char *query, + int flags) ; + + /******************************************************************************/ /* Beware, from hereonafter, it's #def madness, to make the get/set functions */ diff --git a/components/services/install/lib/eazel-install-query-lex.l b/components/services/install/lib/eazel-install-query-lex.l new file mode 100644 index 000000000..8c3fb1501 --- /dev/null +++ b/components/services/install/lib/eazel-install-query-lex.l @@ -0,0 +1,96 @@ +%{ + +/* +This was mostly grabbed from gnome/oaf/oafd/ac-query-lex.l +*/ + +#include <glib.h> +#include <eazel-install-query-parse.h> + +#include <string.h> +#include <stdlib.h> +#define YY_NO_UNPUT + +static char* putSymbol( char *_name ); +static char* putString( char *_name ); +static int yywrap(void); +int yylex (void); +void initFlex( const char *_code ); + +%} + +DIGIT [0-9] + +%% + +"==" { return Q_EQ; } +"!=" { return Q_NEQ; } +"<" { return Q_LT; } +">" { return Q_GT; } +"<=" { return Q_LEQ; } +">=" { return Q_GEQ; } + +"." { return Q_PERIOD; } + +{DIGIT}+ { yylval.val_number = atof( yytext ); return Q_CONST_NUMBER; } +{DIGIT}+"."{DIGIT}+ { char *ptr; yylval.val_version_major = atof( yytext ); + ptr = strchr (yytext, '.'); ptr++; + yylval.val_version_minor = atof (ptr); return Q_CONST_VERSION; } + +"'"(\\'|[^'])+"'" { yylval.val_string = putString( yytext ); return Q_CONST_STRING; } +[a-zA-Z_-][a-zA-Z0-9_:-]* { yylval.val_string = putSymbol( yytext ); return Q_CONST_ID; } + +[ \t\n\r]+ /* eat up whitespace */ + +. { return PARSE_ERROR; } + +%% + +static char * +putSymbol( char *_name ) +{ + return g_strdup(_name); +} + +static char * +putString( char *_str ) +{ + int l = strlen( _str ); + char *p = (char*)g_malloc( l + 1); + char *s = _str + 1; + char *d = p; + while ( s < _str + l - 1 ) + { + if ( *s != '\\' ) + *d++ = *s++; + else + { + s++; + if ( *s == '\\' ) + *d++ = '\\'; + else if ( *s == 'n' ) + *d++ = '\n'; + else if ( *s == 'r' ) + *d++ = '\r'; + else if ( *s == 't' ) + *d++ = '\t'; + s++; + } + } + + *d = 0; + return p; +} + +void +initFlex( const char *_code ) +{ + yy_switch_to_buffer( yy_scan_string( _code ) ); +} + +static int +yywrap(void) +{ + yy_delete_buffer( YY_CURRENT_BUFFER ); + return 1; +} diff --git a/components/services/install/lib/eazel-install-query-parse.h b/components/services/install/lib/eazel-install-query-parse.h new file mode 100644 index 000000000..b978e4234 --- /dev/null +++ b/components/services/install/lib/eazel-install-query-parse.h @@ -0,0 +1,26 @@ +typedef union +{ + char *val_string; + int val_number; + int val_version_major, val_version_minor; + int val_enum; +} YYSTYPE; + +#define Q_CONST_STRING 257 +#define Q_CONST_NUMBER 258 +#define Q_CONST_VERSION 259 +#define Q_CONST_ID 260 + +#define Q_EQ 272 +#define Q_NEQ 273 +#define Q_LEQ 274 +#define Q_GEQ 275 +#define Q_LT 276 +#define Q_GT 277 + +#define Q_PERIOD 282 + +#define PARSE_ERROR 283 + + +extern YYSTYPE yylval; diff --git a/components/services/install/lib/eazel-install-query.c b/components/services/install/lib/eazel-install-query.c new file mode 100644 index 000000000..624d3d391 --- /dev/null +++ b/components/services/install/lib/eazel-install-query.c @@ -0,0 +1,80 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* + * Copyright (C) 2000 Eazel, Inc + * Copyright (C) 1998-1999 James Henstridge + * Copyright (C) 1998 Red Hat Software, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authors: Eskil Heyn Olsen <eskil@eazel.com> + */ + +#include <eazel-install-query.h> +#include <ctype.h> + +/*****************************************************************************/ +/* Query mechanisms */ +/*****************************************************************************/ + +/* + + query syntax : + " '<package>'.[<attr><op>'<arg>']* + + attr and op pairs : + ------------------- + version = < > <= >= + arch = + + query examples: + "'gnome-core'" check for package gnome-core + "'nautilus'.version>='0.1'.arch=i386" Check for nautilus, i386 binary version >= 0.1 + "'popt'.version='1.5'" check for popt version 1.5 (no more, no less) + +*/ + +typedef enum { + EI_Q_VERSION, + EI_Q_ARCH +} AttributeEnum; + +typedef enum { + EI_OP_EQ = 0x01, + EI_OP_LT = 0x02, + EI_OP_GT = 0x04, + EI_OP_NEG = 0x08, +} AttributeOpEnum; + +typedef struct { + AttributeEnum attrib; + AttributeOpEnum op; + char *arg; +} AttributeOpArg; + +GList* +eazel_install_query_package_system (EazelInstall *service, + const char *query, + int flags) +{ + g_message ("eazel_install_query_package_system (...,%s,...)", query); + + /* FIXME bugzilla.eazel.com 1445 + write and use a yacc parser for the queries here. + The lexer is in eazel-install-query-lex.l + */ + + return NULL; +} diff --git a/components/services/install/lib/eazel-install-query.h b/components/services/install/lib/eazel-install-query.h new file mode 100644 index 000000000..b43eb8f10 --- /dev/null +++ b/components/services/install/lib/eazel-install-query.h @@ -0,0 +1,32 @@ +/* -*- 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. + * + * Authors: Eskil Heyn Olsen <eskil@eazel.com> + */ + +#ifndef EAZEL_INSTALL_QUERY_H +#define EAZEL_INSTALL_QUERY_H + +#include "eazel-install-types.h" +#include "eazel-install-public.h" + +GList* eazel_install_query_package_system (EazelInstall *service, const char *query, int flags); + + +#endif /* EAZEL_INSTALL_QUERY_H */ diff --git a/components/services/install/lib/eazel-install-rpm-glue.c b/components/services/install/lib/eazel-install-rpm-glue.c index 012dc61ca..3b6e2d415 100644 --- a/components/services/install/lib/eazel-install-rpm-glue.c +++ b/components/services/install/lib/eazel-install-rpm-glue.c @@ -178,14 +178,14 @@ download_all_packages (EazelInstall *service, cat = categories->data; pkgs = cat->packages; - g_message ("Category = %s", cat->name); + g_message (_("Category = %s"), cat->name); while (pkgs) { PackageData* package; package = pkgs->data; if (eazel_install_fetch_package (service, package) == FALSE) { - g_warning ("*** Failed to retreive %s! ***", package->name); + g_warning (_("Failed to retreive %s!"), package->name); eazel_install_emit_download_failed (service, package->name); remove = g_list_prepend (remove, package); } @@ -224,36 +224,8 @@ install_all_packages (EazelInstall *service, eazel_install_ensure_deps (service, &pkgs, &failedfiles); } - g_message ("Category = %s, %d packages", cat->name, g_list_length (pkgs)); -/* - if (pkgs == NULL) { - } - while (pkgs) { - PackageData* pack; - char* pkg; - int retval; - - pack = pkgs->data; - retval = 0; - - pkg = g_strdup_printf ("%s/%s", - eazel_install_get_tmp_dir (service), - rpmfilename_from_packagedata (pack)); - g_message ("Installing %s", pkg); - - retval = rpm_install (service, - "/", pkg, NULL, - NULL, NULL); + g_message (_("Category = %s, %d packages"), cat->name, g_list_length (pkgs)); - if (retval == 0) { - g_message (_("Package install successful !")); - } else { - g_message (_("Package install failed !")); - rv = FALSE; - } - pkgs = pkgs->next; - } -*/ do_rpm_install (service, "/", pkgs, @@ -301,7 +273,7 @@ uninstall_packages (EazelInstall *service) { CategoryData* cat = categories->data; GList* pkgs = cat->packages; - g_message ("Category = %s", cat->name); + g_message (_("Category = %s"), cat->name); while (pkgs) { PackageData* package = pkgs->data; @@ -346,7 +318,7 @@ uninstall_a_package (EazelInstall *service, rv = TRUE; if (g_strcasecmp (package->archtype, "src") != 0) { - g_message ("Uninstalling %s", pkg); + g_message (_("Uninstalling %s"), pkg); retval = rpm_uninstall (service, "/", pkg, @@ -361,7 +333,7 @@ uninstall_a_package (EazelInstall *service, rv = FALSE; } } else { - g_message ("%s seems to be a source package. Skipping ...", pkg); + g_message (_("%s seems to be a source package. Skipping ..."), pkg); g_free (pkg); rv = FALSE; } @@ -578,7 +550,7 @@ do_rpm_install (EazelInstall *service, pack->soft_depends = g_list_prepend (pack->soft_depends, dep); eazel_install_emit_install_failed (service, pack); } else { - g_error ("I did not expect the package to not appear in the packages list"); + g_assert_not_reached (); } } @@ -721,7 +693,7 @@ do_rpm_uninstall (EazelInstall *service, if (!stop_uninstall && conflicts) { - g_message (_("Dependancy check failed.")); + g_message (_("Dependency check failed.")); printDepProblems (stderr, conflicts, num_conflicts); num_failed += num_packages; @@ -765,7 +737,7 @@ eazel_install_prune_packages_helper (EazelInstall *service, if (g_list_find (*pruned, pack) || pack->name==NULL) { return; } - g_message ("Stripping package %s (%s)", pack->name, pack->toplevel ? "top" : ""); + g_message (_("Reomving package %s"), pack->name); if (pack->toplevel) { /* We only emit signal for the toplevel packages, and only delete them. They _destroy function destroys @@ -878,7 +850,7 @@ eazel_install_load_rpm_headers (EazelInstall *service, fd = fdOpen (filename, O_RDONLY, 0644); if (fd == NULL) { - g_warning ("Cannot open %s", filename); + g_warning (_("Cannot open %s"), filename); pack->status = PACKAGE_CANNOT_OPEN; if (pack->toplevel) { eazel_install_prune_packages (service, pack, packages, NULL); @@ -995,26 +967,24 @@ eazel_install_prepare_rpm_system(EazelInstall *service) root_dir = eazel_install_get_root_dir (service) ? eazel_install_get_root_dir (service) : ""; if (eazel_install_get_install_flags (service) & RPMTRANS_FLAG_TEST) { - g_message ("rpmdbOpen with mode rdonly"); mode = O_RDONLY; } else { - g_message ("rpmdbOpen with mode rdwr"); mode = O_RDWR | O_EXCL; } - g_message ("rpmdbOpen with mode %d", mode); + if (rpmdbOpen (root_dir, db, mode, 0644)) { const char* dn; dn = rpmGetPath (root_dir, "%{_dbpath}", NULL); if (!dn) { - g_warning (_("Packages database query failed !")); + g_warning (_("RPM package database query failed !")); } return FALSE; } if (set) { (*set) = rpmtransCreateSet (*db, root_dir); if (set == NULL) { - g_message ("Create set failed"); + g_warning (_("Initialization of RPM package system failed")); return FALSE; } } @@ -1058,12 +1028,10 @@ eazel_install_add_headers_to_rpm_set (EazelInstall *service, interface_flags |= INSTALL_UPGRADE; } - g_message ("Adding %d packages to set", g_list_length (packages)); for (iterator = packages; iterator; iterator = iterator->next) { PackageData *pack; int err; pack = (PackageData*)iterator->data; - g_message ("adding %s (%s)", pack->name, pack->toplevel ? "true" : ""); err = rpmtransAddPackage (service->private->packsys.rpm.set, *((Header*)pack->packsys_struc), NULL, @@ -1150,7 +1118,7 @@ eazel_install_fetch_rpm_dependencies (EazelInstall *service, if (pack_entry == NULL) { switch (conflict.sense) { case RPMDEP_SENSE_REQUIRES: - g_warning ("%s needs %s %s", conflict.byName, conflict.needsName, conflict.needsVersion); + g_warning (_("%s needs %s %s"), conflict.byName, conflict.needsName, conflict.needsVersion); pack_entry = g_list_find_custom (*packages, (gpointer)conflict.needsName, (GCompareFunc)eazel_install_package_name_compare); @@ -1176,7 +1144,7 @@ eazel_install_fetch_rpm_dependencies (EazelInstall *service, /* If we end here, it's a conflict is going to break something */ /* FIXME: bugzilla.eazel.com Need to handle this more intelligently */ - g_warning ("%s conflicts %s-%s", conflict.byName, conflict.needsName, conflict.needsVersion); + g_warning (_("%s conflicts %s-%s"), conflict.byName, conflict.needsName, conflict.needsVersion); continue; break; } @@ -1190,7 +1158,7 @@ eazel_install_fetch_rpm_dependencies (EazelInstall *service, dep->archtype = g_strdup (pack->archtype); pack->soft_depends = g_list_prepend (pack->soft_depends, dep); - g_message ("Processing dep for %s : requires %s", pack->name, dep->name); + g_message (_("Processing dep for %s : requires %s"), pack->name, dep->name); if (eazel_install_fetch_package (service, dep)) { /* if it succeeds, add to a list of extras for this package @@ -1333,14 +1301,10 @@ eazel_install_ensure_deps (EazelInstall *service, GList **failedpackages) { gboolean result; - static int recurses = 0; - recurses++; g_return_val_if_fail (packages != NULL, TRUE); g_return_val_if_fail (*packages != NULL, TRUE); - g_message ("In ensure_deps_are_fetched, %d packages, recursion %d", g_list_length (*packages), recurses); - g_return_val_if_fail (g_list_length (*packages)>=1, FALSE); result = TRUE; @@ -1393,7 +1357,7 @@ eazel_install_ensure_deps (EazelInstall *service, pack->status = PACKAGE_PARTLY_RESOLVED; } - g_message ("%d deps failed!", *num_conflicts); + g_message (_("%d dependencies failed!"), *num_conflicts); /* Fetch the needed stuff. "extrapackages" gets the new packages added, @@ -1456,7 +1420,7 @@ eazel_install_ensure_deps (EazelInstall *service, pack = (PackageData*)iterator->data; pack->status = PACKAGE_RESOLVED; } - g_message ("deps ok"); + g_message (_("Dependencies are ok")); } } break; @@ -1511,94 +1475,3 @@ rpm_uninstall (EazelInstall *service, g_list_free (list); return result; } /* end rpm_uninstall */ - -/*****************************************************************************/ -/* Query mechanisms */ -/*****************************************************************************/ - -/* - - query syntax : - " '<package>'.[<attr><op>'<arg>']* - - attr and op pairs : - ------------------- - version = < > <= >= - arch = - - query examples: - "'gnome-core'" check for package gnome-core - "'nautilus'.version>='0.1'.arch=i386" Check for nautilus, i386 binary version >= 0.1 - "'popt'.version='1.5'" check for popt version 1.5 (no more, no less) - -*/ - -typedef enum { - EI_Q_VERSION, - EI_Q_ARCH -} AttributeEnum; - -typedef enum { - EI_OP_EQ = 0x01, - EI_OP_LT = 0x02, - EI_OP_GT = 0x04, - EI_OP_NEG = 0x08, -} AttributeOpEnum; - -typedef struct { - AttributeEnum attrib; - AttributeOpEnum op; - char *arg; -} AttributeOpArg; - - -/* - return codes - 0 - ok - 1 - same attribute occured twice or more - 2 - bad bad bad parameters; - */ -static int -ei_extract_attributes (char *query, GList **result) -{ - int i; - /* these should be in the correct order according to the enum */ - char *query_attribs[] = {".version", ".arch", NULL}; - - g_return_val_if_fail (query!=NULL, 2); - (*result) = NULL; - - for (i = 0; query_attribs[i]; i++) { - char *location; - char *op; - char *arg; - AttributeOpArg *argument; - - /* Check for the i'th attribute in the query */ - if ((location = strstr (query, query_attribs[i]))!=NULL) { - argument = g_new0 (AttributeOpArg, 1); - - /* Does it occur again ? */ - if (strstr (location, query_attribs[i])) { - g_free (argument); - return 1; - } - arg = op = location + strlen (query_attribs[i]); - while (*arg && *arg!='\'') { arg ++; } - if (strcasecmp (location, ".version")==0) { - argument->attrib = EI_Q_VERSION; - } - (*result) = g_list_prepend (*result, argument); - } - } - - return 0; -} - -GList* -eazel_install_query_package_system (char *query, int flags) -{ - GList *attribs; - ei_extract_attributes (query, &attribs); - return NULL; -} diff --git a/components/services/install/lib/eazel-install-rpm-glue.h b/components/services/install/lib/eazel-install-rpm-glue.h index d9a7b02ca..db0afb7c3 100644 --- a/components/services/install/lib/eazel-install-rpm-glue.h +++ b/components/services/install/lib/eazel-install-rpm-glue.h @@ -34,7 +34,5 @@ gboolean install_new_packages (EazelInstall *service, GList *categories); gboolean uninstall_packages (EazelInstall *service); -GList* eazel_install_query_package_system (char *query, int flags); - #endif /* EAZEL_INSTALL_RPM_GLUE_H */ diff --git a/components/services/install/lib/eazel-install-types.h b/components/services/install/lib/eazel-install-types.h index 82f6072d6..4e80d3462 100644 --- a/components/services/install/lib/eazel-install-types.h +++ b/components/services/install/lib/eazel-install-types.h @@ -87,6 +87,7 @@ struct _TransferOptions { char* tmp_dir; /* Local directory to store incoming RPMs */ char* rpmrc_file; /* Location of the rpm resource file */ }; +void transferoptions_destroy (TransferOptions *topts); struct _InstallOptions { URLType protocol; /* Specifies local, ftp, or http */ @@ -101,6 +102,7 @@ struct _InstallOptions { gboolean mode_uninstall; /* Uninstall the package list */ gboolean mode_downgrade; /* Downgrade the packages to previous version*/ }; +void installoptions_destroy (InstallOptions *iopts); struct _CategoryData { char* name; diff --git a/components/services/install/server/main.c b/components/services/install/server/main.c index a288a0f31..a0b57c21a 100644 --- a/components/services/install/server/main.c +++ b/components/services/install/server/main.c @@ -43,10 +43,13 @@ CORBA_Environment ev; static BonoboGenericFactory *factory; static int trilobites_active = 0; +static void trilobite_service_factory_destroy (GtkObject *object); + static void trilobite_service_factory_destroy (GtkObject *object) { trilobites_active--; + g_message ("eazel_install trilobites active = %d", trilobites_active); if (trilobites_active != 0) { return; diff --git a/components/services/time/command-line/main.c b/components/services/time/command-line/main.c index 7a3fed151..30fdbd786 100644 --- a/components/services/time/command-line/main.c +++ b/components/services/time/command-line/main.c @@ -141,6 +141,8 @@ int main(int argc, char *argv[]) { } Trilobite_Service_unref (timeservice, &ev); + CORBA_Object_release (timeservice, &ev); + bonobo_object_unref (BONOBO_OBJECT (service)); CORBA_exception_free (&ev); return 0; diff --git a/components/services/time/service/trilobite-eazel-time-service.c b/components/services/time/service/trilobite-eazel-time-service.c index 22dadcbc1..cf62a0d98 100644 --- a/components/services/time/service/trilobite-eazel-time-service.c +++ b/components/services/time/service/trilobite-eazel-time-service.c @@ -178,9 +178,10 @@ trilobite_eazel_time_service_destroy (GtkObject *object) g_free (service->private); - /* FIXME bugzilla.eazel.com 937: - implement this properly */ - g_message ("in trilobite_eazel_time_service_destroy"); + /* Call parents destroy */ + if (GTK_OBJECT_CLASS (trilobite_eazel_time_service_parent_class)->destroy) { + GTK_OBJECT_CLASS (trilobite_eazel_time_service_parent_class)->destroy (object); + } } /* diff --git a/components/services/trilobite/libtrilobite/trilobite-service.c b/components/services/trilobite/libtrilobite/trilobite-service.c index 43705f6bb..5bdcdc1e4 100644 --- a/components/services/trilobite/libtrilobite/trilobite-service.c +++ b/components/services/trilobite/libtrilobite/trilobite-service.c @@ -198,13 +198,11 @@ trilobite_service_destroy (GtkObject *object) g_free (trilobite->private->service_url); g_free (trilobite->private->service_icon); g_free (trilobite->private); - g_free (trilobite); } if (GTK_OBJECT_CLASS (trilobite_service_parent_class)->destroy) { - /* FIXME bugzilla.eazel.com 921: - this doesn't work... Implement proper destroy function */ - /* GTK_OBJECT_CLASS (trilobite_service_parent_class)->destroy (object); */ + /* g_message ("calling trilobite-service-parent->destroy ()"); */ + GTK_OBJECT_CLASS (trilobite_service_parent_class)->destroy (object); } } diff --git a/components/services/trilobite/sample/command-line/main.c b/components/services/trilobite/sample/command-line/main.c index dfb092bbe..79bb4735b 100644 --- a/components/services/trilobite/sample/command-line/main.c +++ b/components/services/trilobite/sample/command-line/main.c @@ -59,7 +59,7 @@ int main(int argc, char *argv[]) { trilobite = bonobo_object_corba_objref (BONOBO_OBJECT (service)); - /* Check the type of the object */ + /* Display some stuff about the corba object interfaces */ g_message ("CORBA Object properties :\ncorba object\t%s\nbonobo unknown\t%s\ntrilobite\t%s\ntestservice\t%s\n", CORBA_Object_is_a (trilobite, "IDL:CORBA/Object:1.0", &ev)?"yes":"no", CORBA_Object_is_a (trilobite, "IDL:Bonobo/Unknown:1.0", &ev)?"yes":"no", @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) { CORBA_Object_is_a (trilobite, "IDL:Trilobite/Eazel/Sample:1.0", &ev)?"yes":"no"); - /* Check the type of the object again... */ + /* Display some stuff about the bonobo object interfaces */ g_message ("BONOBO Object properties :\ncorba object\t%s\nbonobo unknown\t%s\ntrilobite\t%s\ntestservice\t%s\n", bonobo_object_client_has_interface (service, "IDL:CORBA/Object:1.0", &ev)?"yes":"no", bonobo_object_client_has_interface (service, "IDL:Bonobo/Unknown:1.0", &ev)?"yes":"no", @@ -84,6 +84,7 @@ int main(int argc, char *argv[]) { g_message ("service url : %s", Trilobite_Service_get_url (trilobite, &ev)); g_message ("service icon : %s", Trilobite_Service_get_icon (trilobite, &ev)); + /* Cleanup the refs and objects from query_interface */ Trilobite_Service_unref (trilobite, &ev); CORBA_Object_release (trilobite, &ev); } else { @@ -97,11 +98,14 @@ int main(int argc, char *argv[]) { Trilobite_Eazel_Sample_remember (sample_service, "horsedung", &ev); Trilobite_Eazel_Sample_say_it (sample_service, &ev); + /* Cleanup the refs and objects from query_interface */ Trilobite_Eazel_Sample_unref (sample_service, &ev); CORBA_Object_release (sample_service, &ev); } - bonobo_object_unref (BONOBO_OBJECT (service)); + /* Clean up the bonobo_object_activate return value */ + bonobo_object_unref (BONOBO_OBJECT (service)); + /* And free the exception structure */ CORBA_exception_free (&ev); return 0; diff --git a/components/services/trilobite/sample/service/main.c b/components/services/trilobite/sample/service/main.c index c084d6fae..70c396520 100644 --- a/components/services/trilobite/sample/service/main.c +++ b/components/services/trilobite/sample/service/main.c @@ -51,6 +51,8 @@ trilobite_service_factory_destroy (GtkObject *object) if (trilobites_active == 0) { return; } + + g_message ("destroying factory"); bonobo_object_unref (BONOBO_OBJECT (factory)); gtk_main_quit (); diff --git a/components/services/trilobite/sample/service/sample-service-impl.c b/components/services/trilobite/sample/service/sample-service-impl.c index f7d158f10..b82b0b371 100644 --- a/components/services/trilobite/sample/service/sample-service-impl.c +++ b/components/services/trilobite/sample/service/sample-service-impl.c @@ -129,13 +129,15 @@ sample_service_destroy (GtkObject *object) service = SAMPLE_SERVICE (object); + /* Free the objects own crap */ if (service->my_string) { g_free (service->my_string); } - /* FIXME bugzilla.eazel.com 920: - implement this properly */ - g_message ("in sample_service_destroy"); + /* Call parents destroy */ + if (GTK_OBJECT_CLASS (sample_service_parent_class)->destroy) { + GTK_OBJECT_CLASS (sample_service_parent_class)->destroy (object); + } } /* |