Commit 5b851868 authored by J Shane Culpepper's avatar J Shane Culpepper Committed by J Shane Culpepper
Browse files

Have all of the eazel: views hooked into the build now. Most of the

2000-07-02  J Shane Culpepper  <pepper@eazel.com>

        * components/services/Makefile.am:
        * components/services/login/nautilus-view/nautilus-login-view.c:
        (generate_form_title):
        * components/services/startup/lib/Makefile.am:
        * components/services/startup/lib/eazel-register.c:
        * components/services/startup/lib/eazel-register.h:
        * components/services/startup/nautilus-view/Makefile.am:
        * components/services/startup/nautilus-view/icons/Makefile.am:
        * components/services/startup/nautilus-view/main.c:
        (service_object_destroyed), (service_make_object), (main):
        *
        components/services/startup/nautilus-view/nautilus-service-startup-
        view.c: (generate_startup_form), (go_to_uri),
        (generate_form_title),
        (nautilus_service_startup_view_initialize_class),
        (nautilus_service_startup_view_initialize),
        (nautilus_service_startup_view_destroy),
        (nautilus_service_startup_view_get_nautilus_view), (is_location),
        (nautilus_service_startup_view_load_uri),
        (service_load_location_callback):
        *
        components/services/startup/nautilus-view/nautilus-service-startup-
        view.h:

        Have all of the eazel: views hooked into the build now.  Most of the
        backend parsing of eazel:login, eazel:inventory, eazel:summary,
        eazel:time, eazel:startup.  Most of these views don't look very good.
        That's the next task.
parent 57e9dea1
2000-07-02 J Shane Culpepper <pepper@eazel.com>
* components/services/Makefile.am:
* components/services/login/nautilus-view/nautilus-login-view.c:
(generate_form_title):
* components/services/startup/lib/Makefile.am:
* components/services/startup/lib/eazel-register.c:
* components/services/startup/lib/eazel-register.h:
* components/services/startup/nautilus-view/Makefile.am:
* components/services/startup/nautilus-view/icons/Makefile.am:
* components/services/startup/nautilus-view/main.c:
(service_object_destroyed), (service_make_object), (main):
*
components/services/startup/nautilus-view/nautilus-service-startup-
view.c: (generate_startup_form), (go_to_uri),
(generate_form_title),
(nautilus_service_startup_view_initialize_class),
(nautilus_service_startup_view_initialize),
(nautilus_service_startup_view_destroy),
(nautilus_service_startup_view_get_nautilus_view), (is_location),
(nautilus_service_startup_view_load_uri),
(service_load_location_callback):
*
components/services/startup/nautilus-view/nautilus-service-startup-
view.h:
Have all of the eazel: views hooked into the build now. Most of the
backend parsing of eazel:login, eazel:inventory, eazel:summary,
eazel:time, eazel:startup. Most of these views don't look very good.
That's the next task.
2000-07-01 Maciej Stachowiak <mjs@eazel.com>
* components/tree/main.c (main): Remove unnecessary debugging
......
SUBDIRS = trilobite startup install time
SUBDIRS = trilobite startup install time login summary inventory vault
......@@ -56,7 +56,7 @@ struct _NautilusLoginViewDetails {
GtkWidget *feedback_text;
};
#define SERVICE_VIEW_DEFAULT_BACKGROUND_COLOR "rgb:BBBB/DDDD/FFFF"
#define SERVICE_VIEW_DEFAULT_BACKGROUND_COLOR "rgb:0/6666/6666"
#define SERVICE_DOMAIN_NAME "eazel24.eazel.com"
static void nautilus_login_view_initialize_class (NautilusLoginViewClass *klass);
......@@ -238,7 +238,7 @@ generate_form_title (NautilusLoginView *view,
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");
file_name = nautilus_pixmap_file ("eazel-cloud-logo.png");
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);
......
......@@ -2,12 +2,11 @@ NULL =
CPPFLAGS = \
-DPREFIX=\"$(prefix)\" \
-DG_LOG_DOMAIN=\"Nautilus-Services\"
-DG_LOG_DOMAIN=\"trilobite-eazel-startup\"
INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir) \
-I/usr/include/rpm \
-I$(top_srcdir)/components/services/trilobite/libtrilobite \
$(GNOME_CFLAGS) \
$(GCONF_CFLAGS) \
......@@ -18,7 +17,5 @@ INCLUDES = \
noinst_LIBRARIES = libstartup.a
libstartup_a_SOURCES = \
eazel-register.h \
eazel-register.c \
$(NULL)
/* -*- 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>
*
* Here is the code responsible for the initial service registration and the
* characterization of the hardware and software environments.
*
*/
#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-register.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, 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 = 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 (&current_time);
time_string = g_strdup (ctime (&current_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;
}
/* -*- 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>
*
* This is the header file for the service registration stuff
*
*/
#ifndef __EAZEL_REGISTER_H__
#define __EAZEL_REGISTER_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 /* __NAUTILUS_ZOOM_CONTROL_H__ */
......@@ -4,12 +4,11 @@ SUBDIRS=icons
CPPFLAGS = \
-DPREFIX=\"$(prefix)\"
-DG_LOG_DOMAIN=\"Nautilus-Services\"
-DG_LOG_DOMAIN=\"trilobite-eazel-startup\"
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/components/services/trilobite/libtrilobite\
-I$(top_srcdir)/components/services/startup/lib \
-I$(top_builddir) \
$(GNOMEUI_CFLAGS) \
$(GCONF_CFLAGS) \
......@@ -45,7 +44,6 @@ nautilus_service_startup_view_LDADD = \
$(VFS_LIBS) \
$(GHTTP_LIBS) \
$(OAF_LIBS) \
$(top_builddir)/components/services/startup/lib/libstartup.a \
$(NULL)
EXTRA_DIST = $(oaf_DATA)
NULL =
icondir = $(datadir)/pixmaps/nautilus
icon_DATA = \
config-gather.png \
register.png
register.png \
eazel-cloud-logo.png \
$(NULL)
EXTRA_DIST = $(icon_DATA)
......@@ -32,7 +32,7 @@
static int object_count =0;
static void
services_object_destroyed (GtkObject *obj) {
service_object_destroyed (GtkObject *obj) {
object_count--;
if (object_count <= 0) {
gtk_main_quit ();
......@@ -40,14 +40,14 @@ services_object_destroyed (GtkObject *obj) {
}
static BonoboObject*
services_make_object (BonoboGenericFactory* factory,
const char* goad_id,
service_make_object (BonoboGenericFactory* factory,
const char* iid,
void* closure) {
NautilusServicesContentView* view;
NautilusView* nautilus_view;
NautilusServiceStartupView *view;
NautilusView *nautilus_view;
if (strcmp (goad_id, "OAFIID:nautilus_service_startup_view:a8f1b0ef-a39f-4f92-84bc-1704f0321a82")) {
if (strcmp (iid, "OAFIID:nautilus_service_startup_view:a8f1b0ef-a39f-4f92-84bc-1704f0321a82")) {
return NULL;
}
......@@ -55,7 +55,7 @@ services_make_object (BonoboGenericFactory* factory,
object_count++;
gtk_signal_connect (GTK_OBJECT (view), "destroy", services_object_destroyed, NULL);
gtk_signal_connect (GTK_OBJECT (view), "destroy", service_object_destroyed, NULL);
nautilus_view = nautilus_service_startup_view_get_nautilus_view (view);
......@@ -73,14 +73,14 @@ main (int argc, char *argv[]) {
CORBA_exception_init (&ev);
gnome_init_with_popt_table ("nautilus-service-startup-view", VERSION,
gnome_init_with_popt_table ("nautilus-service-startup-view", VERSION,
argc, argv,
oaf_popt_options, 0, NULL);
orb = oaf_init (argc, argv);
bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
factory = bonobo_generic_factory_new_multi ("OAFIID:nautilus_service_startup_view_factory:fafa0f0d-a2d1-41f9-8164-4beb5e34656c", services_make_object, NULL);
factory = bonobo_generic_factory_new_multi ("OAFIID:nautilus_service_startup_view_factory:fafa0f0d-a2d1-41f9-8164-4beb5e34656c", service_make_object, NULL);
do {
bonobo_main ();
......
......@@ -20,45 +20,42 @@
* Author: Ramiro Estrugo
*/
/* nautilus-services-content-view.h - services content view
component. This component just displays a simple label of the URI
and does nothing else. It should be a good basis for writing
out-of-proc content views.*/
/* nautilus-services-startup-view.h - services bootstrap startup view.
*/
#ifndef NAUTILUS_SERVICE_STARTUP_VIEW_H
#define NAUTILUS_SERVICE_STARTUP_VIEW_H
#include <libnautilus/nautilus-view.h>
#include <gtk/gtk.h>
typedef struct _NautilusServicesContentView NautilusServicesContentView;
typedef struct _NautilusServicesContentViewClass NautilusServicesContentViewClass;
typedef struct _NautilusServiceStartupView NautilusServiceStartupView;
typedef struct _NautilusServiceStartupViewClass NautilusServiceStartupViewClass;
#define NAUTILUS_TYPE_SERVICE_STARTUP_VIEW (nautilus_service_startup_view_get_type ())
#define NAUTILUS_SERVICE_STARTUP_VIEW(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_SERVICE_STARTUP_VIEW, NautilusServicesContentView))
#define NAUTILUS_SERVICE_STARTUP_VIEW_CLASS (klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_SERVICE_STARTUP_VIEW, NautilusServicesContentViewClass))
#define NAUTILUS_IS_SERVICE_STARTUP_VIEW (obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_SERVICE_STARTUP_VIEW))
#define NAUTILUS_IS_SERVICE_STARTUP_VIEW_CLASS (klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_SERVICE_STARTUP_VIEW))
#define NAUTILUS_TYPE_SERVICE_STARTUP_VIEW (nautilus_service_startup_view_get_type ())
#define NAUTILUS_SERVICE_STARTUP_VIEW(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_SERVICE_STARTUP_VIEW, NautilusServiceStartupView))
#define NAUTILUS_SERVICE_STARTUP_VIEW_CLASS (klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_SERVICE_STARTUP_VIEW, NautilusServiceStartupViewClass))
#define NAUTILUS_IS_SERVICE_STARTUP_VIEW(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_SERVICE_STARTUP_VIEW))
#define NAUTILUS_IS_SERVICE_STARTUP_VIEW_CLASS (klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_SERVICE_STARTUP_VIEW))
typedef struct _NautilusServicesContentViewDetails NautilusServicesContentViewDetails;
typedef struct _NautilusServiceStartupViewDetails NautilusServiceStartupViewDetails;
struct _NautilusServicesContentView {
GtkEventBox parent;
NautilusServicesContentViewDetails *details;
struct _NautilusServiceStartupView {
GtkEventBox parent;
NautilusServiceStartupViewDetails *details;
};
struct _NautilusServicesContentViewClass {
GtkVBoxClass parent_class;
struct _NautilusServiceStartupViewClass {
GtkVBoxClass parent_class;
};
/* GtkObject support */
GtkType nautilus_service_startup_view_get_type (void);
/* Component embedding support */
NautilusView *nautilus_service_startup_view_get_nautilus_view (NautilusServicesContentView *view);
NautilusView *nautilus_service_startup_view_get_nautilus_view (NautilusServiceStartupView *view);
/* URI handling */
void nautilus_service_startup_view_load_uri (NautilusServicesContentView *view,
const char *uri);
void nautilus_service_startup_view_load_uri (NautilusServiceStartupView *view,
const char *uri);
#endif /* NAUTILUS_SERVICE_STARTUP_VIEW_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment