diff options
author | Maciej Stachowiak <mstachow@src.gnome.org> | 2000-12-14 03:53:10 +0000 |
---|---|---|
committer | Maciej Stachowiak <mstachow@src.gnome.org> | 2000-12-14 03:53:10 +0000 |
commit | 8711a09966a05412491a77b0868a0b4769aaf603 (patch) | |
tree | 2123ee742988b7336ac65fb43731b5652e6239c2 | |
parent | a609003378da98f34959705a347cc1d8dfbd0921 (diff) | |
download | nautilus-8711a09966a05412491a77b0868a0b4769aaf603.tar.gz |
New file documenting the directory layout of components/services.
* components/services/docs/directories: New file documenting the
directory layout of components/services.
* components/services/inventory/.cvsignore,
components/services/inventory/Makefile.am,
components/services/inventory/command-line/README,
components/services/inventory/lib/.cvsignore,
components/services/inventory/lib/Makefile.am,
components/services/inventory/lib/eazel-inventory-shared.c,
components/services/inventory/lib/eazel-inventory-shared.h,
components/services/inventory/nautilus-view/.cvsignore,
components/services/inventory/nautilus-view/Makefile.am,
components/services/inventory/nautilus-view/main.c,
components/services/inventory/nautilus-view/nautilus-inventory-view.c,
components/services/inventory/nautilus-view/nautilus-inventory-view.h,
components/services/inventory/nautilus-view/nautilus-inventory-view.oafinfo:
Remove old dead inventory code.
* components/services/login/command-line/README: Remove last file
in otherwise-empty directory.
* components/services/summary/command-line/README: Ditto.
* cut-n-paste-code/widgets/gtkclist/.cvsignore: Ditto.
18 files changed, 69 insertions, 1102 deletions
@@ -1,3 +1,28 @@ +2000-12-13 Maciej Stachowiak <mjs@eazel.com> + + * components/services/docs/directories: New file documenting the + directory layout of components/services. + + * components/services/inventory/.cvsignore, + components/services/inventory/Makefile.am, + components/services/inventory/command-line/README, + components/services/inventory/lib/.cvsignore, + components/services/inventory/lib/Makefile.am, + components/services/inventory/lib/eazel-inventory-shared.c, + components/services/inventory/lib/eazel-inventory-shared.h, + components/services/inventory/nautilus-view/.cvsignore, + components/services/inventory/nautilus-view/Makefile.am, + components/services/inventory/nautilus-view/main.c, + components/services/inventory/nautilus-view/nautilus-inventory-view.c, + components/services/inventory/nautilus-view/nautilus-inventory-view.h, + components/services/inventory/nautilus-view/nautilus-inventory-view.oafinfo: + Remove old dead inventory code. + + * components/services/login/command-line/README: Remove last file + in otherwise-empty directory. + * components/services/summary/command-line/README: Ditto. + * cut-n-paste-code/widgets/gtkclist/.cvsignore: Ditto. + 2000-12-13 Andy Hertzfeld <andy@eazel.com> * icons/Makefile.am: diff --git a/components/services/docs/directories b/components/services/docs/directories new file mode 100644 index 000000000..5d0c0ee30 --- /dev/null +++ b/components/services/docs/directories @@ -0,0 +1,44 @@ +docs/ - documentation + +install/ - install service +install/command-line/ - command-line installer +install/idl/ - Install service IDL +install/lib/ - install service libraries +install/nautilus-view/ - Nautilus install view +install/server/ - back-end implementation for install service + +login/ - Login code +login/nautilus-view - change password view + +nautilus-dependent-shared/ - shared code that depends on libnautilus-extensions +nautilus-dependent-shared/icons - icons related to various services + +summary/ - summary view and related +summary/lib - +summary/nautilus-view - Actual summary view code +summary/nautilus-view/icons - images needed for the summary view +summary/nautilus-view/icons/gray_tab_pieces - the images for drawing the grey summary view tabs +summary/nautilus-view/tests - test data for the summary view + +time/ - time service (status unknown) +time/command-line/ - command-line version of time service +time/idl/ - IDL for time service +time/nautilus-view/ - Nautilus View for time service +time/service/ - back-end implementation for time service + + +trilobite - general framework stuff for services +trilobite/doc - documentation +trilobite/helper - helper program for executing priveleged operations +trilobite/idl - IDL files for trilobite service framework +trilobite/libtrilobite - library of shared core code for service components +trilobite/sample - sample service +trilobite/sample/command-line - command-line version of sample service +trilobite/sample/idl - IDL files for sample service +trilobite/sample/lib - library for sample service +trilobite/sample/nautilus-view - Nautilus view for sample service +trilobite/sample/nautilus-view/icons - icons directory for sample service +trilobite/sample/service - back-end implementation for sample service + +vault - code related to the vault (online storage) service +vault/command-line - command-line tool for accessing the vault diff --git a/components/services/inventory/.cvsignore b/components/services/inventory/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/components/services/inventory/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/components/services/inventory/Makefile.am b/components/services/inventory/Makefile.am deleted file mode 100644 index 821eeee61..000000000 --- a/components/services/inventory/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = lib nautilus-view diff --git a/components/services/inventory/command-line/README b/components/services/inventory/command-line/README deleted file mode 100644 index c787385b0..000000000 --- a/components/services/inventory/command-line/README +++ /dev/null @@ -1 +0,0 @@ -The command-line implementation of inventory will be part of eazel-service. It will be located in nautilus/components/services/startup/command-line. diff --git a/components/services/inventory/lib/.cvsignore b/components/services/inventory/lib/.cvsignore deleted file mode 100644 index a9304e542..000000000 --- a/components/services/inventory/lib/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -Makefile -Makefile.in -trilobite-eazel-inventory-common.c -trilobite-eazel-inventory-skels.c -trilobite-eazel-inventory-stubs.c -trilobite-eazel-inventory.h diff --git a/components/services/inventory/lib/Makefile.am b/components/services/inventory/lib/Makefile.am deleted file mode 100644 index 10169c7c9..000000000 --- a/components/services/inventory/lib/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -NULL = - -INCLUDES = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"trilobite-eazel-inventory\" \ - -DSTANDALONE \ - -I$(top_srcdir) \ - -I$(top_builddir) \ - -I$(top_srcdir)/components/services/trilobite \ - -I/usr/include/rpm \ - $(GNOME_CFLAGS) \ - $(GCONF_CFLAGS) \ - $(GHTTP_CFLAGS) \ - $(NULL) - -noinst_LIBRARIES = libinventory.a - -libinventory_a_SOURCES = \ - eazel-inventory-shared.h \ - eazel-inventory-shared.c \ - $(NULL) - diff --git a/components/services/inventory/lib/eazel-inventory-shared.c b/components/services/inventory/lib/eazel-inventory-shared.c deleted file mode 100644 index 97b96c854..000000000 --- a/components/services/inventory/lib/eazel-inventory-shared.c +++ /dev/null @@ -1,311 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* Nautilus - * Copyright (C) 2000 Eazel, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Andy Hertzfeld <andy@eazel.com> - * J Shane Culpepper <pepper@eazel.com> - * - * The code responsible for the client inventory manipulation. - * - */ - -#include <config.h> -#include <gdk/gdk.h> -#include <stdio.h> -#include <fcntl.h> -#include <time.h> -#include <unistd.h> -#include <rpm/rpmlib.h> -#include <gnome.h> -#include <gnome-xml/entities.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/tree.h> -#include <libnautilus-extensions/nautilus-string.h> -#include "eazel-inventory-shared.h" - -void add_package_info (xmlDocPtr configuration_metafile); -void add_hardware_info (xmlDocPtr configuration_metafile); -char *read_proc_info (const char *proc_filename); -void add_info (xmlNodePtr node_ptr, - char *data, - const char *tag, - const char *field_name); -void add_io_info (xmlNodePtr node_ptr, - char *io_data); - -/* add package data from the package database to the passed in xml document */ - -void -add_package_info (xmlDocPtr configuration_metafile) -{ - - char package_count_str[32]; - char *package_name; - char *package_version; - char *package_release; - char *version_str; - xmlNodePtr packages_node; - xmlNodePtr current_package_node; - rpmdb rpm_db; - int current_offset; - int rpm_result; - int package_count; - - package_count = 0; - - /* open the rpm database for package lookups */ - - rpmReadConfigFiles (NULL, NULL); - rpm_result = rpmdbOpen ("", &rpm_db, O_RDONLY, 0644); - if (rpm_result != 0) { - g_message ("couldn't open package database: %d", rpm_result); - return; - } - - /* add the PACKAGES node */ - packages_node = xmlNewChild (configuration_metafile->root, NULL, "PACKAGES", NULL); - - /* iterate through all of the installed packages */ - - current_offset = rpmdbFirstRecNum (rpm_db); - while (current_offset) - { - Header current_package = rpmdbGetRecord (rpm_db, current_offset); - - headerGetEntry (current_package, RPMTAG_NAME, NULL, (void **) &package_name, NULL); - headerGetEntry (current_package, RPMTAG_VERSION, NULL, (void **) &package_version, NULL); - headerGetEntry(current_package, RPMTAG_RELEASE, NULL, (void **) &package_release, NULL); - - /* add a node for this package */ - - current_package_node = xmlNewChild (packages_node, NULL, "PACKAGE", NULL); - package_count += 1; - - version_str = g_strdup_printf ("%s-%s", package_version, package_release); - xmlSetProp (current_package_node, "name", package_name); - xmlSetProp (current_package_node, "version", version_str); - g_free (version_str); - - headerFree (current_package); - current_offset = rpmdbNextRecNum (rpm_db, current_offset); - - /* donate some time to gtk to handle updates, etc */ - while (gtk_events_pending()) { - gtk_main_iteration(); - } - } - - /* update the count */ - - sprintf (package_count_str, "%d", package_count); - xmlSetProp (packages_node, "count", package_count_str); - - /* close the package data base */ - rpmdbClose (rpm_db); -} - -/* utility routine to read a proc file into a string */ - -char* -read_proc_info (const char *proc_filename) -{ - - FILE *thisFile; - char *result; - char buffer[256]; - char *path_name; - GString *string_data; - - path_name = g_strdup_printf ("/proc/%s", proc_filename); - string_data = g_string_new (""); - thisFile = fopen (path_name, "r"); - - while (fgets (buffer, 255, thisFile) != NULL) { - g_string_append (string_data, buffer); - } - fclose (thisFile); - - result = g_strdup (string_data->str); - g_string_free (string_data, TRUE); - g_free (path_name); - - return result; -} - -/* utility routine to extract information from a string and add it to an XML node */ - -void -add_info (xmlNodePtr node_ptr, char *data, const char *tag, const char *field_name) -{ - - int index; - char **info_array; - char *field_data; - - field_data = NULL; - - /* parse the data into a string array */ - info_array = g_strsplit (data, "\n", 32); - /* iterate through the data isolating the field */ - for (index = 0; index < 32; index++) { - if (info_array[index] == NULL) - break; - if (nautilus_str_has_prefix (info_array[index], field_name)) { - field_data = info_array[index] + strlen(field_name); - field_data = strchr (field_data, ':') + 1; - field_data = g_strchug (field_data); - break; - } - } - - /* add the requested node if the field was found */ - if (field_data) { - xmlNodePtr new_node; - new_node = xmlNewChild (node_ptr, NULL, tag, NULL); - xmlNodeSetContent (new_node, field_data); - } - g_strfreev (info_array); -} - -/* utility routine to process io info */ - -void -add_io_info (xmlNodePtr node_ptr, char *io_data) -{ - - int index; - char *temp_str; - xmlNodePtr new_node; - char **info_array; - - /* parse the data into a string array */ - info_array = g_strsplit (io_data, "\n", 64); - /* iterate through the data creating a record for each line */ - for (index = 0; index < 64; index++) { - if (info_array[index] == NULL) - break; - new_node = xmlNewChild (node_ptr, NULL, "IORANGE", NULL); - temp_str = strchr (info_array[index], ':'); - if (temp_str) { - *temp_str = '\0'; - xmlSetProp (new_node, "RANGE", g_strstrip (info_array[index])); - xmlSetProp (new_node, "TYPE", g_strstrip (temp_str + 1)); - } - - } - - g_strfreev (info_array); -} - -/* add hardware info from the /proc directory to the passed in xml document */ - -void -add_hardware_info (xmlDocPtr configuration_metafile) -{ - - xmlNodePtr cpu_node; - xmlNodePtr this_node; - xmlNodePtr hardware_node; - char *temp_string; - - /* add the HARDWARE node */ - hardware_node = xmlNewChild (configuration_metafile->root, NULL, "HARDWARE", NULL); - - /* capture various information from the /proc filesystem */ - /* first, capture memory info */ - - temp_string = read_proc_info ("meminfo"); - add_info (hardware_node, temp_string, "MEMORYSIZE", "MemTotal"); - add_info (hardware_node, temp_string, "SWAPSIZE", "SwapTotal"); - g_free (temp_string); - - /* now handle CPU info */ - cpu_node = xmlNewChild (hardware_node, NULL, "CPU", NULL); - temp_string = read_proc_info ("cpuinfo"); - add_info (cpu_node, temp_string, "TYPE", "processor"); - add_info (cpu_node, temp_string, "VENDOR", "vendor_id"); - add_info (cpu_node, temp_string, "FAMILY", "cpu family"); - add_info (cpu_node, temp_string, "MODEL", "model"); - add_info (cpu_node, temp_string, "MODELNAME", "model name"); - add_info (cpu_node, temp_string, "STEPPING", "stepping"); - add_info (cpu_node, temp_string, "SPEED", "cpu MHz"); - add_info (cpu_node, temp_string, "CACHE", "cache size"); - g_free (temp_string); - - /* now handle IO port info */ - this_node = xmlNewChild (hardware_node, NULL, "IOPORTS", NULL); - temp_string = read_proc_info ("ioports"); - add_io_info (this_node, temp_string); - g_free (temp_string); -} - -/* synchronize an existing metafile with the rpm database */ -xmlDocPtr -synchronize_configuration_metafile () -{ - - return NULL; - -} - -/* update_package_metafile is called during initialization time to create or - synchronize the packages metafile */ - -xmlDocPtr -update_configuration_metafile () -{ - - return NULL; - -} - -/* create the configuration metafile and add package and hardware configuration info to it */ -xmlDocPtr -create_configuration_metafile (void) -{ - - /* create a new xml document */ - time_t current_time; - xmlNodePtr container_node; - char *time_string; - char host_name[512]; - xmlDocPtr configuration_metafile; - - configuration_metafile = xmlNewDoc ("1.0"); - - gethostname (&host_name[0], 511); - container_node = xmlNewDocNode (configuration_metafile, NULL, "CONFIGURATION", NULL); - - configuration_metafile->root = container_node; - time (¤t_time); - time_string = g_strdup (ctime (¤t_time)); - time_string[strlen(time_string) - 1] = '\0'; - xmlSetProp (container_node, "computer", host_name); - xmlSetProp (container_node, "date", time_string); - g_free (time_string); - - /* FIXME bugzilla.eazel.com 732: need to set up nautilus version here */ - - /* add the package info */ - add_package_info (configuration_metafile); - - /* add the hardware info */ - add_hardware_info (configuration_metafile); - - return configuration_metafile; -} diff --git a/components/services/inventory/lib/eazel-inventory-shared.h b/components/services/inventory/lib/eazel-inventory-shared.h deleted file mode 100644 index d162e0d8c..000000000 --- a/components/services/inventory/lib/eazel-inventory-shared.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* Nautilus - * Copyright (C) 2000 Eazel, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Authors: Andy Hertzfeld <andy@eazel.com> - * J Shane Culpepper <pepper@eazel.com> - * - * This is the header file for the service inventory stuff - * - */ - -#ifndef EAZEL_INVENTORY_SHARED_H -#define EAZEL_INVENTORY_SHARED_H - -#include <gnome-xml/entities.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/tree.h> - -xmlDocPtr create_configuration_metafile (void); -xmlDocPtr synchronize_configuration_metafile (void); -xmlDocPtr update_configuration_metafile (void); - -#endif /* EAZEL_INVENTORY_SHARED_H */ diff --git a/components/services/inventory/nautilus-view/.cvsignore b/components/services/inventory/nautilus-view/.cvsignore deleted file mode 100644 index f34bba46b..000000000 --- a/components/services/inventory/nautilus-view/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -nautilus-inventory-view diff --git a/components/services/inventory/nautilus-view/Makefile.am b/components/services/inventory/nautilus-view/Makefile.am deleted file mode 100644 index f6fbe2394..000000000 --- a/components/services/inventory/nautilus-view/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ -NULL = - -INCLUDES = \ - -DPREFIX=\"$(prefix)\" \ - -DG_LOG_DOMAIN=\"trilobite-eazel-inventory\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/components/services/trilobite/libtrilobite \ - -I$(top_srcdir)/components/services/inventory/lib \ - -I$(top_builddir) \ - $(GNOMEUI_CFLAGS) \ - $(GCONF_CFLAGS) \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - $(VFS_CFLAGS) \ - $(NULL) - -oafdir = $(datadir)/oaf - -oaf_DATA = \ - nautilus-inventory-view.oafinfo - - -bin_PROGRAMS = \ - nautilus-inventory-view - -nautilus_inventory_view_SOURCES = \ - nautilus-inventory-view.h \ - nautilus-inventory-view.c \ - main.c \ - $(NULL) - -nautilus_inventory_view_LDADD = \ - $(top_builddir)/components/services/trilobite/libtrilobite/libtrilobite.la \ - $(top_builddir)/libnautilus/libnautilus.la \ - $(top_builddir)/libnautilus-extensions/libnautilus-extensions.la \ - $(BONOBO_LIBS) \ - $(GNOMEUI_LIBS) \ - $(GCONF_LIBS) \ - $(VFS_LIBS) \ - $(GHTTP_LIBS) \ - $(OAF_LIBS) \ - $(top_builddir)/components/services/inventory/lib/libinventory.a \ - $(RPM_LIBS) \ - $(NULL) - -EXTRA_DIST = $(oaf_DATA) diff --git a/components/services/inventory/nautilus-view/main.c b/components/services/inventory/nautilus-view/main.c deleted file mode 100644 index 8167122aa..000000000 --- a/components/services/inventory/nautilus-view/main.c +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * Copyright (C) 2000 Eazel, Inc - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Maciej Stachowiak <mjs@eazel.com> - * J Shane Culpepper <pepper@eazel.com> - */ - -/* main.c - main function and object activation function for services - content view component. */ - -#include <config.h> -#include <gnome.h> -#include <liboaf/liboaf.h> -#include <bonobo.h> -#include "nautilus-inventory-view.h" - -static int object_count =0; - -static void -inventory_object_destroyed (GtkObject *obj) -{ - object_count--; - if (object_count <= 0) { - gtk_main_quit (); - } -} - -static BonoboObject* -inventory_make_object (BonoboGenericFactory *factory, - const char *iid, - void *closure) -{ - - NautilusInventoryView* view; - NautilusView* nautilus_view; - - if (strcmp (iid, "OAFIID:nautilus_inventory_view:f1032dfd-8075-4105-a9cd-c638b74511f5")) { - return NULL; - } - - view = NAUTILUS_INVENTORY_VIEW (gtk_object_new (NAUTILUS_TYPE_INVENTORY_VIEW, NULL)); - - object_count++; - - nautilus_view = nautilus_inventory_view_get_nautilus_view (view); - - gtk_signal_connect (GTK_OBJECT (nautilus_view), "destroy", inventory_object_destroyed, NULL); - - printf ("Returning new object %p\n", nautilus_view); - - return BONOBO_OBJECT (nautilus_view); -} - -int -main (int argc, char *argv[]) -{ - - BonoboGenericFactory *factory; - CORBA_ORB orb; - char *registration_id; - - -#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */ - bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE); -#endif - - gnome_init_with_popt_table ("nautilus-inventory-view", VERSION, - argc, argv, - oaf_popt_options, 0, NULL); - - orb = oaf_init (argc, argv); - - bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL); - - registration_id = oaf_make_registration_id ("OAFIID:nautilus_inventory_view_factory:400ef0a5-352a-4e98-bf96-83e728c462cf", getenv ("DISPLAY")); - factory = bonobo_generic_factory_new_multi (registration_id, - inventory_make_object, - NULL); - g_free (registration_id); - - - do { - bonobo_main (); - } while (object_count > 0); - - return 0; -} diff --git a/components/services/inventory/nautilus-view/nautilus-inventory-view.c b/components/services/inventory/nautilus-view/nautilus-inventory-view.c deleted file mode 100644 index bdc55f92a..000000000 --- a/components/services/inventory/nautilus-view/nautilus-inventory-view.c +++ /dev/null @@ -1,473 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* - * Copyright (C) 2000 Eazel, Inc - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: J Shane Culpepper <pepper@eazel.com> - */ - -#include <config.h> - -#include <ghttp.h> -#include <gnome-xml/tree.h> -#include <libgnomevfs/gnome-vfs-utils.h> -#include <libnautilus-extensions/nautilus-background.h> -#include <libnautilus-extensions/nautilus-gtk-extensions.h> -#include <libnautilus-extensions/nautilus-gtk-macros.h> -#include <libnautilus-extensions/nautilus-glib-extensions.h> -#include <libnautilus-extensions/nautilus-global-preferences.h> -#include <libnautilus-extensions/nautilus-file-utilities.h> -#include <libnautilus-extensions/nautilus-string.h> -#include <libnautilus-extensions/nautilus-font-factory.h> -#include <stdio.h> -#include <unistd.h> - -#include "nautilus-inventory-view.h" -#include "eazel-inventory-shared.h" - - - -/* A NautilusContentView's private information. */ -struct _NautilusInventoryViewDetails { - char *uri; - char *auth_token; - NautilusView *nautilus_view; - GtkWidget *form; - GtkWidget *form_title; - GtkWidget *feedback_text; -}; - -#define SERVICE_VIEW_DEFAULT_BACKGROUND_COLOR "rgb:BBBB/DDDD/FFFF" -#define SERVICE_DOMAIN_NAME "eazel24.eazel.com" - -static void nautilus_inventory_view_initialize_class (NautilusInventoryViewClass *klass); -static void nautilus_inventory_view_initialize (NautilusInventoryView *view); -static void nautilus_inventory_view_destroy (GtkObject *object); -static void inventory_load_location_callback (NautilusView *nautilus_view, - const char *location, - NautilusInventoryView *view); -static void show_feedback (NautilusInventoryView *view, - char *error_message); -static void generate_inventory_form (NautilusInventoryView *view); -static void gather_config_button_cb (GtkWidget *button, - NautilusInventoryView *view); -static void register_later_cb (GtkWidget *button, - NautilusInventoryView *view); -static char *get_home_uri (void); -static void update_now (void); -static ghttp_request *make_http_post_request (char *uri, - char *post_body, - char *auth_token); -static void generate_form_title (NautilusInventoryView *view, - const char *title_text); - -NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusInventoryView, nautilus_inventory_view, GTK_TYPE_EVENT_BOX) - -static void -generate_inventory_form (NautilusInventoryView *view) -{ - - char *message; - char *file_name; - GtkWidget *temp_widget; - GtkWidget *temp_box; - GtkWidget *config_button; - GtkWidget *config_label; - - /* allocate a vbox as a container */ - view->details->form = gtk_vbox_new (FALSE, 0); - gtk_container_add (GTK_CONTAINER (view), view->details->form); - gtk_widget_show (view->details->form); - - /* setup the title */ - generate_form_title (view, "Eazel Services Inventory"); - - /* if we came from signup, add a congrats message */ - - if (nautilus_str_has_suffix (view->details->uri, "signup")) { - message = "Congratulations, you have successfully signed up with the Eazel service!"; - temp_widget = gtk_label_new (message); - - gtk_box_pack_start (GTK_BOX (view->details->form), temp_widget, 0, 0, 12); - gtk_widget_show (temp_widget); - } - - /* make label containing text about uploading the configuration data */ - - temp_box = gtk_hbox_new (FALSE, 4); - gtk_box_pack_start (GTK_BOX (view->details->form), temp_box, 0, 0, 12); - gtk_widget_show (temp_box); - - file_name = nautilus_pixmap_file ("config-gather.png"); - temp_widget = GTK_WIDGET (gnome_pixmap_new_from_file (file_name)); - gtk_box_pack_start (GTK_BOX (temp_box), temp_widget, 0, 0, 8); - gtk_widget_show (temp_widget); - g_free (file_name); - - message = "With your permission, the Eazel service will gather data about the hardware and software configuration of your system so it can provide you with a customized software catalog with one-click installation. Your configuration data will be kept strictly confidential and will not be used for any other purpose. Click the button below to begin gathering the data."; - temp_widget = gtk_label_new (message); - gtk_label_set_line_wrap (GTK_LABEL(temp_widget), TRUE); - gtk_box_pack_start (GTK_BOX (temp_box), temp_widget, 0, 0, 12); - gtk_widget_show (temp_widget); - - /* add buttons for accepting and declining */ - - config_button = gtk_button_new (); - config_label = gtk_label_new (" Gather Configuration Data "); - gtk_widget_show (config_label); - gtk_container_add (GTK_CONTAINER (config_button), config_label); - temp_box = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (temp_box), config_button, FALSE, FALSE, 16); - - gtk_signal_connect (GTK_OBJECT (config_button), "clicked", - GTK_SIGNAL_FUNC (gather_config_button_cb), view); - gtk_widget_show (config_button); - - /* now allocate the decline button */ - - config_button = gtk_button_new (); - config_label = gtk_label_new (" No, Don't Gather Configuration Data "); - gtk_widget_show (config_label); - gtk_container_add (GTK_CONTAINER (config_button), config_label); - gtk_box_pack_start (GTK_BOX (temp_box), config_button, FALSE, FALSE, 16); - gtk_signal_connect (GTK_OBJECT (config_button), "clicked", - GTK_SIGNAL_FUNC (register_later_cb), view); - gtk_widget_show (config_button); - - /* show the buttons */ - gtk_widget_show (temp_box); - gtk_box_pack_start (GTK_BOX (view->details->form), temp_box, FALSE, FALSE, 16); - - /* add a label for feedback, but don't show it until there's an error */ - view->details->feedback_text = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (view->details->form), view->details->feedback_text, 0, 0, 8); - -} - -/* callback to handle the configuration button. First, make the configuration xml file, - * then feed it to the service over HTTP. Display an error message, or move on to the summary - * screen if successful - */ - -static void -gather_config_button_cb (GtkWidget *button, NautilusInventoryView *view) -{ - - FILE *config_file; - char buffer[256]; - char host_name[512]; - char *config_file_name; - char *config_string; - char *uri; - char *response_str; - char *cookie_str; - char *encoded_token; - char *encoded_host_name; - GString *config_data; - xmlDocPtr config_doc; - ghttp_request *request; - - show_feedback (view, "gathering configuration data..."); - update_now (); - - config_doc = create_configuration_metafile (); - if (config_doc == NULL) { - show_feedback (view, "Sorry, there was an error during the gathering"); - return; - } - - /* save the configuration file */ - - config_file_name = g_strdup_printf ("%s/.nautilus/configuration.xml", g_get_home_dir ()); - xmlSaveFile (config_file_name, config_doc); - xmlFreeDoc (config_doc); - - /* load the config file text into memory */ - - config_data = g_string_new (""); - config_file = fopen (config_file_name, "r"); - - while (fgets (buffer, 255, config_file) != NULL) { - g_string_append (config_data, buffer); - } - fclose (config_file); - config_string = g_strdup (config_data->str); - g_string_free(config_data, TRUE); - g_free (config_file_name); - - /* move into transmission phase by changing the feedback message */ - - show_feedback (view, "transmitting configuration data..."); - update_now (); - - /* send the config file to the server via HTTP */ - uri = g_strdup_printf ("http://%s/profile/set.pl", SERVICE_DOMAIN_NAME); - - gethostname (&host_name[0], 511); - - encoded_token = gnome_vfs_escape_string (view->details->auth_token); - encoded_host_name = gnome_vfs_escape_string (host_name); - - cookie_str = g_strdup_printf ("token=%s; computer=%s", encoded_token, encoded_host_name); - request = make_http_post_request (uri, config_string, cookie_str); - - g_free (encoded_token); - g_free (encoded_host_name); - g_free (cookie_str); - - response_str = ghttp_get_body (request); - g_message ("config response was %s", response_str); - - g_free (uri); - ghttp_request_destroy (request); - - /* handle the error response */ - if (strstr (response_str, "<ERROR field=") == response_str) { - show_feedback (view, "Sorry, but there was an error. Please try again some other time."); - } - else { - - /* give error feedback or go to the summary form if successful */ - nautilus_view_open_location (view, "eazel:overview?config"); - } - - g_free (config_string); - -} - -/* callback to handle the register later button */ -static void -register_later_cb (GtkWidget *button, NautilusInventoryView *view) -{ - - char *home_path; - - home_path = get_home_uri (); - nautilus_view_open_location (view, home_path); - g_free (home_path); - -} - -/* utility routine to show an error message */ -static void -show_feedback (NautilusInventoryView *view, char *error_message) -{ - - gtk_label_set_text (GTK_LABEL (view->details->feedback_text), error_message); - gtk_widget_show (view->details->feedback_text); -} - -/* utility routine to make an HTTP request. For now, it works synchronously but soon - * it will optionally work asynchronously. Return NULL if we get an error */ - -static ghttp_request* -make_http_post_request (char *uri, char *post_body, char *auth_token) -{ - - ghttp_request* request; - char* proxy; - - request = NULL; - proxy = g_getenv ("http_proxy"); - - request = ghttp_request_new(); - - if (!request) { - return NULL; - } - - if (proxy && (ghttp_set_proxy (request, proxy) != 0)) { - ghttp_request_destroy (request); - return NULL; - } - - if (ghttp_set_uri (request, uri) != 0) { - ghttp_request_destroy (request); - return NULL; - } - - ghttp_set_type (request, ghttp_type_post); - ghttp_set_header (request, http_hdr_Accept, "text/xml"); - ghttp_set_header (request, http_hdr_Content_Type, "text/xml"); - ghttp_set_header (request, http_hdr_Host, SERVICE_DOMAIN_NAME); - ghttp_set_header (request, http_hdr_User_Agent, "Nautilus/0.1 (Linux)"); - - if (auth_token) { - ghttp_set_header (request, "Cookie", auth_token); - } - - ghttp_set_header (request, http_hdr_Connection, "close"); - - ghttp_set_body (request, post_body, strlen (post_body)); - - if (ghttp_prepare (request) != 0) { - ghttp_request_destroy (request); - return NULL; - } - - /* here's where it spends all the time doing the actual request */ - if (ghttp_process (request) != ghttp_done) { - ghttp_request_destroy (request); - return NULL; - } - - return request; - -} - -static char* -get_home_uri () -{ - - return g_strdup_printf ("file://%s", g_get_home_dir ()); - -} - -/* utility to force updating to happen */ -static void -update_now () -{ - - while (gtk_events_pending ()) { - gtk_main_iteration (); - } - -} - -/* generate the standard eazel services header */ -static void -generate_form_title (NautilusInventoryView *view, - const char *title_text) -{ - - GtkWidget *temp_widget; - char *file_name; - GtkWidget *temp_container; - GdkFont *font; - - temp_container = gtk_hbox_new (FALSE, 0); - - gtk_box_pack_start (GTK_BOX (view->details->form), temp_container, 0, 0, 4); - gtk_widget_show (temp_container); - - file_name = nautilus_pixmap_file ("eazel-logo.gif"); - temp_widget = GTK_WIDGET (gnome_pixmap_new_from_file (file_name)); - gtk_box_pack_start (GTK_BOX(temp_container), temp_widget, 0, 0, 8); - gtk_widget_show (temp_widget); - g_free (file_name); - - view->details->form_title = gtk_label_new (title_text); - - font = nautilus_font_factory_get_font_from_preferences (18); - nautilus_gtk_widget_set_font (view->details->form_title, font); - gdk_font_unref (font); - - gtk_box_pack_start (GTK_BOX (temp_container), view->details->form_title, 0, 0, 8); - gtk_widget_show (view->details->form_title); -} - -static void -nautilus_inventory_view_initialize_class (NautilusInventoryViewClass *klass) -{ - - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - object_class = GTK_OBJECT_CLASS (klass); - widget_class = GTK_WIDGET_CLASS (klass); - parent_class = gtk_type_class (gtk_event_box_get_type ()); - object_class->destroy = nautilus_inventory_view_destroy; -} - -static void -nautilus_inventory_view_initialize (NautilusInventoryView *view) -{ - - NautilusBackground *background; - - view->details = g_new0 (NautilusInventoryViewDetails, 1); - view->details->nautilus_view = nautilus_view_new (GTK_WIDGET (view)); - gtk_signal_connect (GTK_OBJECT (view->details->nautilus_view), - "load_location", - GTK_SIGNAL_FUNC (inventory_load_location_callback), - view); - - background = nautilus_get_widget_background (GTK_WIDGET (view)); - nautilus_background_set_color (background, SERVICE_VIEW_DEFAULT_BACKGROUND_COLOR); - - gtk_widget_show (GTK_WIDGET (view)); -} - -static void -nautilus_inventory_view_destroy (GtkObject *object) -{ - - NautilusInventoryView *view; - - view = NAUTILUS_INVENTORY_VIEW (object); - - if (view->details->uri) { - g_free (view->details->uri); - } - g_free (view->details); - - NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object)); - -} - -NautilusView * -nautilus_inventory_view_get_nautilus_view (NautilusInventoryView *view) -{ - - return view->details->nautilus_view; - -} - -void -nautilus_inventory_view_load_uri (NautilusInventoryView *view, - const char *uri) -{ - - /* dispose of any old uri and copy in the new one */ - g_free (view->details->uri); - view->details->uri = g_strdup (uri); - - /* dispose of any old form that was installed */ - if (view->details->form != NULL) { - gtk_widget_destroy (view->details->form); - view->details->form = NULL; - } - - generate_inventory_form (view); -} - -static void -inventory_load_location_callback (NautilusView *nautilus_view, - const char *location, - NautilusInventoryView *view) -{ - - g_assert (nautilus_view == view->details->nautilus_view); - - nautilus_view_report_load_underway (nautilus_view); - - nautilus_inventory_view_load_uri (view, location); - - nautilus_view_report_load_complete (nautilus_view); -} - diff --git a/components/services/inventory/nautilus-view/nautilus-inventory-view.h b/components/services/inventory/nautilus-view/nautilus-inventory-view.h deleted file mode 100644 index cf80c8bc2..000000000 --- a/components/services/inventory/nautilus-view/nautilus-inventory-view.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * Copyright (C) 2000 Eazel, Inc - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: J Shane Culpepper - */ - -#ifndef NAUTILUS_INVENTORY_VIEW_H -#define NAUTILUS_INVENTORY_VIEW_H - -#include <libnautilus/nautilus-view.h> -#include <gtk/gtk.h> - -typedef struct _NautilusInventoryView NautilusInventoryView; -typedef struct _NautilusInventoryViewClass NautilusInventoryViewClass; - -#define NAUTILUS_TYPE_INVENTORY_VIEW (nautilus_inventory_view_get_type ()) -#define NAUTILUS_INVENTORY_VIEW(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_INVENTORY_VIEW, NautilusInventoryView)) -#define NAUTILUS_INVENTORY_VIEW_CLASS (klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_INVENTORY_VIEW, NautilusInventoryViewClass)) -#define NAUTILUS_IS_INVENTORY_VIEW(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_INVENTORY_VIEW)) -#define NAUTILUS_IS_INVENTORY_VIEW_CLASS (klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_INVENTORY_VIEW)) - -typedef struct _NautilusInventoryViewDetails NautilusInventoryViewDetails; - -struct _NautilusInventoryView { - GtkEventBox parent; - NautilusInventoryViewDetails *details; -}; - -struct _NautilusInventoryViewClass { - GtkVBoxClass parent_class; -}; - -/* GtkObject support */ -GtkType nautilus_inventory_view_get_type (void); - -/* Component embedding support */ -NautilusView *nautilus_inventory_view_get_nautilus_view (NautilusInventoryView *view); - -/* URI handling */ -void nautilus_inventory_view_load_uri (NautilusInventoryView *view, - const char *uri); - -#endif /* NAUTILUS_INVENTORY_VIEW_H */ - diff --git a/components/services/inventory/nautilus-view/nautilus-inventory-view.oafinfo b/components/services/inventory/nautilus-view/nautilus-inventory-view.oafinfo deleted file mode 100644 index c8a9543ef..000000000 --- a/components/services/inventory/nautilus-view/nautilus-inventory-view.oafinfo +++ /dev/null @@ -1,25 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:nautilus_inventory_view_factory:400ef0a5-352a-4e98-bf96-83e728c462cf" type="exe" location="nautilus-inventory-view"> -<oaf_attribute name="repo_ids" type="stringv"> -<item value="IDL:GNOME/ObjectFactory:1.0"/> -</oaf_attribute> -<oaf_attribute name="name" type="string" value="Nautilus Service Inventory View Factory"/> -<oaf_attribute name="description" type="string" value="Service Inventory View Component's Factory"/> -</oaf_server> - -<oaf_server iid="OAFIID:nautilus_inventory_view:f1032dfd-8075-4105-a9cd-c638b74511f5" type="factory" location="OAFIID:nautilus_inventory_view_factory:400ef0a5-352a-4e98-bf96-83e728c462cf"> -<oaf_attribute name="repo_ids" type="stringv"> -<item value="IDL:Bonobo/Unknown:1.0"/> -<item value="IDL:Bonobo/Control:1.0"/> -<item value="IDL:Nautilus/View:1.0"/> -</oaf_attribute> -<oaf_attribute name="name" type="string" value="Nautilus Inventory View"/> -<oaf_attribute name="description" type="string" value="Service Inventory view component"/> -<oaf_attribute name="bonobo:supported_uri_schemes" type="stringv"> -<item value="eazel-inventory"/> -</oaf_attribute> -<oaf_attribute name="nautilus:view_as_name" type="string" value="Inventory"/> -</oaf_server> - -</oaf_info> diff --git a/components/services/login/command-line/README b/components/services/login/command-line/README deleted file mode 100644 index a73ca6deb..000000000 --- a/components/services/login/command-line/README +++ /dev/null @@ -1 +0,0 @@ -The command-line implementation of login will be part of eazel-service. It will be located in nautilus/components/services/startup/command-line. diff --git a/components/services/summary/command-line/README b/components/services/summary/command-line/README deleted file mode 100644 index f5d2c73be..000000000 --- a/components/services/summary/command-line/README +++ /dev/null @@ -1 +0,0 @@ -The command-line implementation of summary will be part of eazel-service. It will be located in nautilus/components/services/startup/command-line. diff --git a/cut-n-paste-code/widgets/gtkclist/.cvsignore b/cut-n-paste-code/widgets/gtkclist/.cvsignore deleted file mode 100644 index fb56d207b..000000000 --- a/cut-n-paste-code/widgets/gtkclist/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile.in -Makefile -.deps -gtkclist.lo -libgtkclist.la -.libs
\ No newline at end of file |