Turn on compilation of hyperbola component. Compile and run. Create & set

* components/Makefile.am: Turn on compilation of hyperbola component.
* components/help/*: Compile and run.
* libnautilus/ntl-meta-view-client.c: Create & set the property bag if it doesn't exist.
* src/ntl-uri-map.c: Load the hyperbola nav tree component as a test meta view.
* src/ntl-view.c: Fill in NULL fields with empty strings, so that ORBit doesn't segfault.
* src/ntl-window-msgs.c: When creating new meta views, they should
be meta views and not content views (cut & paste error).
* src/file-manager/fm-directory-view.c: Don't redisplay every time a new entry comes in.
This commit is contained in:
Elliot Lee 1999-12-15 23:47:34 +00:00
parent 0dee7ad32e
commit a4a7dc95ac
20 changed files with 166 additions and 40 deletions

View file

@ -1,3 +1,14 @@
1999-12-15 Elliot Lee <sopwith@redhat.com>
* components/Makefile.am: Turn on compilation of hyperbola component.
* components/help/*: Compile and run.
* libnautilus/ntl-meta-view-client.c: Create & set the property bag if it doesn't exist.
* src/ntl-uri-map.c: Load the hyperbola nav tree component as a test meta view.
* src/ntl-view.c: Fill in NULL fields with empty strings, so that ORBit doesn't segfault.
* src/ntl-window-msgs.c: When creating new meta views, they should
be meta views and not content views (cut & paste error).
* src/file-manager/fm-directory-view.c: Don't redisplay every time a new entry comes in.
1999-12-15 Darin Adler <darin@eazel.com>
* configure.in: Turned "-Wshadow" and "-Wundef" off for now, since they

View file

@ -1 +1 @@
SUBDIRS=history
SUBDIRS=history help

View file

@ -1,6 +1,8 @@
bin_PROGRAMS=hyperbola
INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GNOMEUI_CFLAGS) $(BONOBO_CFLAGS)
INCLUDES=-I$(top_srcdir) -I$(top_builddir) \
$(GNOMEUI_CFLAGS) $(BONOBO_CFLAGS) \
-DINFODIR=\"$(infodir)\"
LDADD=$(top_builddir)/libnautilus/libnautilus.la $(BONOBO_LIBS) $(GNOMEUI_LIBS)
hyperbola_SOURCES= \
@ -9,7 +11,10 @@ hyperbola_SOURCES= \
hyperbola-filefmt.c \
hyperbola-filefmt.h
EXTRA_DIST=pages.map
EXTRA_DIST=pages.map hyperbola.goad
goaddir=$(sysconfdir)/CORBA/servers
goad_DATA=hyperbola.goad
mapdatadir=$(datadir)/hyperbola/maps
mapdata_DATA=pages.map

View file

@ -11,29 +11,21 @@
typedef struct {
const char *name;
FILE * (*get_html_stream) (HyperbolaLocationInfo *loci, const HyperbolaLocationReference uri);
void (*free_format_data) (gpointer data);
void (*populate_tree)(HyperbolaDocTree *tree);
} FormatHandler;
static FILE *fmt_man_get_html_stream(Nautilus_NavigationInfo *loci, const HyperbolaLocationReference uri);
static void fmt_man_free_format_data(gpointer data);
static void fmt_man_populate_tree(HyperbolaDocTree *tree);
static FILE *fmt_info_get_html_stream(Nautilus_NavigationInfo *loci, const HyperbolaLocationReference uri);
static void fmt_info_free_format_data(gpointer data);
static void fmt_info_populate_tree(HyperbolaDocTree *tree);
static FILE *fmt_ghelp_get_html_stream(Nautilus_NavigationInfo *loci, const HyperbolaLocationReference uri);
static void fmt_ghelp_free_format_data(gpointer data);
static void fmt_ghelp_populate_tree(HyperbolaDocTree *tree);
static void make_treesection(HyperbolaDocTree *tree, char **path);
static FormatHandler format_handlers[] = {
{"ghelp", fmt_ghelp_get_html_stream, fmt_ghelp_free_format_data, fmt_ghelp_populate_tree},
{"man", fmt_man_get_html_stream, fmt_man_free_format_data, fmt_man_populate_tree},
{"info", fmt_info_get_html_stream, fmt_info_free_format_data, fmt_info_populate_tree},
{"ghelp", fmt_ghelp_populate_tree},
{"man", fmt_man_populate_tree},
{"info", fmt_info_populate_tree},
{NULL}
};
@ -63,7 +55,7 @@ tree_key_compare(gconstpointer k1, gconstpointer k2)
HyperbolaDocTree *
hyperbola_doc_tree_new(void)
{
HyperbolaDocTree *retval = g_new(HyperbolaDocTree, 1);
HyperbolaDocTree *retval = g_new0(HyperbolaDocTree, 1);
retval->global_by_uri = g_hash_table_new(g_str_hash, g_str_equal);
retval->children = g_tree_new(tree_key_compare);
@ -209,7 +201,7 @@ fmt_read_mapping(TreeInfo *ti, const char *srcfile)
continue;
}
new_mapent = g_new(ManpageMapping, 1);
new_mapent = g_new0(ManpageMapping, 1);
g_snprintf(real_regbuf, sizeof(real_regbuf), "^%s$", line_pieces[1]);
@ -334,7 +326,7 @@ fmt_man_populate_tree_for_subdir(HyperbolaDocTree *tree, const char *basedir, ch
if(ctmp[1] != secnum)
continue; /* maybe the extension was '.gz' or something, which we most definitely don't handle right now */
g_snprintf(namebuf, sizeof(namebuf), "%.*s", ctmp - dent->d_name, dent->d_name);
g_snprintf(namebuf, sizeof(namebuf), "%.*s", (int)(ctmp - dent->d_name), dent->d_name);
strcpy(titlebuf, namebuf);
strcat(titlebuf, " (man)");
@ -507,15 +499,6 @@ fmt_man_populate_tree(HyperbolaDocTree *tree)
}
/***** info pages *****/
static void
fmt_info_free_format_data(gpointer data)
{
InfoFormatData *mfd = data;
g_free(mfd->filename);
g_free(mfd);
}
static void
fmt_info_populate_tree_for_subdir(HyperbolaDocTree *tree, const char *basedir, char **defpath)
{

View file

@ -23,9 +23,9 @@ int main(int argc, char *argv[])
GNORBA_INIT_SERVER_FUNC, &ev);
bonobo_init(orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
factory = gnome_generic_factory_new("hyperbola_factory", make_obj, NULL);
factory = gnome_generic_factory_new_multi("hyperbola_factory", make_obj, NULL);
gtk_main();
bonobo_main();
return 0;
}

View file

@ -2,8 +2,6 @@
#include "hyperbola-filefmt.h"
#include <gtk/gtk.h>
static HyperbolaDocTree *hyperbola_doc_tree_new(void);
typedef struct {
NautilusViewClient *vc;
@ -19,7 +17,7 @@ static void hyperbola_navigation_tree_select_row(GtkCTree *ctree,
HyperbolaNavigationTree *view);
static void hyperbola_navigation_tree_notify_location_change (NautilusViewClient *vc,
Nautilus_NavigationInfo *navi,
HyperbolaNavigationTree *view);
HyperbolaNavigationTree *hview);
typedef struct {
HyperbolaNavigationTree *view;
@ -70,7 +68,11 @@ hyperbola_navigation_tree_new(void)
view = g_new0(HyperbolaNavigationTree, 1);
view->vc = gtk_widget_new(nautilus_meta_view_client_get_type(), NULL);
view->vc = NAUTILUS_VIEW_CLIENT(gtk_widget_new(nautilus_meta_view_client_get_type(), NULL));
gtk_signal_connect(GTK_OBJECT(view->vc), "notify_location_change", hyperbola_navigation_tree_notify_location_change,
view);
nautilus_meta_view_set_label(NAUTILUS_META_VIEW_CLIENT(view->vc), "Help Contents");
view->ctree = gtk_ctree_new_with_titles(1, 0, (gchar **)titles);
gtk_clist_freeze(GTK_CLIST(view->ctree));
@ -97,6 +99,7 @@ hyperbola_navigation_tree_new(void)
static void
hyperbola_navigation_tree_notify_location_change (NautilusViewClient *vc,
Nautilus_NavigationInfo *navi,
HyperbolaNavigationTree *hview)
{
HyperbolaTreeNode *tnode;
@ -106,7 +109,7 @@ hyperbola_navigation_tree_notify_location_change (NautilusViewClient *vc,
hview->notify_count++;
tnode = g_hash_table_lookup(hview->doc_tree->global_by_uri, loci->uri);
tnode = g_hash_table_lookup(hview->doc_tree->global_by_uri, navi->requested_uri);
if(tnode)
gtk_ctree_select(GTK_CTREE(hview->ctree), tnode->user_data);
@ -118,6 +121,7 @@ static void hyperbola_navigation_tree_select_row(GtkCTree *ctree, GtkCTreeNode *
gint column, HyperbolaNavigationTree *view)
{
HyperbolaTreeNode *tnode;
Nautilus_NavigationRequestInfo nri;
if(view->notify_count > 0)
return;
@ -129,7 +133,10 @@ static void hyperbola_navigation_tree_select_row(GtkCTree *ctree, GtkCTreeNode *
view->notify_count++;
hyperbola_view_request_location_change(HYPERBOLA_VIEW(view), tnode->uri, NULL);
memset(&nri, 0, sizeof(nri));
nri.requested_uri = tnode->uri;
nri.new_window_default = nri.new_window_suggested = nri.new_window_enforced = Nautilus_V_UNKNOWN;
nautilus_view_client_request_location_change(view->vc, &nri);
view->notify_count--;
}

View file

@ -0,0 +1,45 @@
#ifndef HYPERBOLA_TYPES_H
#define HYPERBOLA_TYPES_H 1
#include <gtk/gtkwidget.h>
#include <stdio.h>
/* Be a URL, for now */
typedef const char * HyperbolaLocationReference;
typedef struct _HyperbolaTreeNode HyperbolaTreeNode;
typedef enum {
HYP_TREE_NODE_FOLDER,
HYP_TREE_NODE_SECTION,
HYP_TREE_NODE_BOOK,
HYP_TREE_NODE_PAGE
} HyperbolaTreeNodeType;
struct _HyperbolaTreeNode {
HyperbolaTreeNode *up;
HyperbolaTreeNodeType type;
char *title;
char *uri;
GTree *children; /* By title (relative to parent) */
gpointer user_data;
};
typedef struct {
GTree *children; /* By title */
GHashTable *global_by_uri;
gpointer user_data;
} HyperbolaDocTree;
#ifndef _
#define _(x) x
#define N_(x) x
#endif
#endif

View file

@ -0,0 +1,11 @@
[hyperbola_factory]
location_info=hyperbola
type=exe
description=Internal use only
repo_ids=IDL:GNOME/GenericFactory:1.0
[hyperbola_navigation_tree]
location_info=hyperbola_factory
type=factory
description=Help Navigation Tree
repo_ids=IDL:GNOME/Control:1.0 IDL:Nautilus/MetaView:1.0 IDL:Nautilus/View:1.0

View file

@ -111,6 +111,12 @@ nautilus_meta_view_set_label(NautilusMetaViewClient *mvc, const char *label)
ctl = nautilus_view_client_get_gnome_object(NAUTILUS_VIEW_CLIENT(mvc));
bag = gnome_control_get_property_bag(GNOME_CONTROL(ctl));
if(!bag)
{
bag = gnome_property_bag_new();
gnome_control_set_property_bag(GNOME_CONTROL(ctl), bag);
}
gnome_property_bag_add(bag, "label", "string",
g_strdup(label), g_strdup(label),
_("Label"), GNOME_PROPERTY_READ_ONLY);

View file

@ -111,6 +111,12 @@ nautilus_meta_view_set_label(NautilusMetaViewClient *mvc, const char *label)
ctl = nautilus_view_client_get_gnome_object(NAUTILUS_VIEW_CLIENT(mvc));
bag = gnome_control_get_property_bag(GNOME_CONTROL(ctl));
if(!bag)
{
bag = gnome_property_bag_new();
gnome_control_set_property_bag(GNOME_CONTROL(ctl), bag);
}
gnome_property_bag_add(bag, "label", "string",
g_strdup(label), g_strdup(label),
_("Label"), GNOME_PROPERTY_READ_ONLY);

View file

@ -111,6 +111,12 @@ nautilus_meta_view_set_label(NautilusMetaViewClient *mvc, const char *label)
ctl = nautilus_view_client_get_gnome_object(NAUTILUS_VIEW_CLIENT(mvc));
bag = gnome_control_get_property_bag(GNOME_CONTROL(ctl));
if(!bag)
{
bag = gnome_property_bag_new();
gnome_control_set_property_bag(GNOME_CONTROL(ctl), bag);
}
gnome_property_bag_add(bag, "label", "string",
g_strdup(label), g_strdup(label),
_("Label"), GNOME_PROPERTY_READ_ONLY);

View file

@ -111,6 +111,12 @@ nautilus_meta_view_set_label(NautilusMetaViewClient *mvc, const char *label)
ctl = nautilus_view_client_get_gnome_object(NAUTILUS_VIEW_CLIENT(mvc));
bag = gnome_control_get_property_bag(GNOME_CONTROL(ctl));
if(!bag)
{
bag = gnome_property_bag_new();
gnome_control_set_property_bag(GNOME_CONTROL(ctl), bag);
}
gnome_property_bag_add(bag, "label", "string",
g_strdup(label), g_strdup(label),
_("Label"), GNOME_PROPERTY_READ_ONLY);

View file

@ -111,6 +111,12 @@ nautilus_meta_view_set_label(NautilusMetaViewClient *mvc, const char *label)
ctl = nautilus_view_client_get_gnome_object(NAUTILUS_VIEW_CLIENT(mvc));
bag = gnome_control_get_property_bag(GNOME_CONTROL(ctl));
if(!bag)
{
bag = gnome_property_bag_new();
gnome_control_set_property_bag(GNOME_CONTROL(ctl), bag);
}
gnome_property_bag_add(bag, "label", "string",
g_strdup(label), g_strdup(label),
_("Label"), GNOME_PROPERTY_READ_ONLY);

View file

@ -763,9 +763,9 @@ directory_load_cb (GnomeVFSAsyncHandle *handle,
view->entries_to_display += entries_read;
display_pending_entries (view);
display_icons_not_in_layout (view);
if (result == GNOME_VFS_ERROR_EOF) {
display_pending_entries (view);
display_icons_not_in_layout (view);
stop_load (view);
/* gtk_signal_emit (GTK_OBJECT (view), signals[LOAD_DONE]); */
} else if (result != GNOME_VFS_OK) {

View file

@ -96,6 +96,8 @@ nautilus_navinfo_new(NautilusNavigationInfo *navinfo,
}
navinfo->meta_iids = g_slist_append(navinfo->meta_iids, "hyperbola_navigation_tree");
return navinfo;
}
@ -103,4 +105,6 @@ void
nautilus_navinfo_free(NautilusNavigationInfo *navinfo)
{
gnome_vfs_file_info_destroy(navinfo->vfs_fileinfo);
g_slist_free(navinfo->meta_iids);
}

View file

@ -469,7 +469,20 @@ nautilus_view_notify_location_change(NautilusView *view,
CORBA_exception_init(&ev);
if(!CORBA_Object_is_nil(view->view_client, &ev))
Nautilus_View_notify_location_change(view->view_client, nav_context, &ev);
{
Nautilus_NavigationInfo real_nav_ctx;
real_nav_ctx = *nav_context;
g_assert(real_nav_ctx.requested_uri);
#define DEFAULT_STRING(x) if(!real_nav_ctx.x) real_nav_ctx.x = ""
DEFAULT_STRING(actual_uri);
DEFAULT_STRING(referring_uri);
DEFAULT_STRING(actual_referring_uri);
DEFAULT_STRING(referring_content_type);
Nautilus_View_notify_location_change(view->view_client, &real_nav_ctx, &ev);
}
CORBA_exception_free(&ev);
}

View file

@ -201,7 +201,7 @@ nautilus_window_load_meta_view(NautilusWindow *window,
if(!curview)
{
meta_view = NAUTILUS_VIEW(gtk_widget_new(nautilus_content_view_get_type(), "main_window", window, NULL));
meta_view = NAUTILUS_VIEW(gtk_widget_new(nautilus_meta_view_get_type(), "main_window", window, NULL));
nautilus_view_load_client(meta_view, iid);
nautilus_window_add_meta_view(window, meta_view);
}

View file

@ -96,6 +96,8 @@ nautilus_navinfo_new(NautilusNavigationInfo *navinfo,
}
navinfo->meta_iids = g_slist_append(navinfo->meta_iids, "hyperbola_navigation_tree");
return navinfo;
}
@ -103,4 +105,6 @@ void
nautilus_navinfo_free(NautilusNavigationInfo *navinfo)
{
gnome_vfs_file_info_destroy(navinfo->vfs_fileinfo);
g_slist_free(navinfo->meta_iids);
}

View file

@ -469,7 +469,20 @@ nautilus_view_notify_location_change(NautilusView *view,
CORBA_exception_init(&ev);
if(!CORBA_Object_is_nil(view->view_client, &ev))
Nautilus_View_notify_location_change(view->view_client, nav_context, &ev);
{
Nautilus_NavigationInfo real_nav_ctx;
real_nav_ctx = *nav_context;
g_assert(real_nav_ctx.requested_uri);
#define DEFAULT_STRING(x) if(!real_nav_ctx.x) real_nav_ctx.x = ""
DEFAULT_STRING(actual_uri);
DEFAULT_STRING(referring_uri);
DEFAULT_STRING(actual_referring_uri);
DEFAULT_STRING(referring_content_type);
Nautilus_View_notify_location_change(view->view_client, &real_nav_ctx, &ev);
}
CORBA_exception_free(&ev);
}

View file

@ -201,7 +201,7 @@ nautilus_window_load_meta_view(NautilusWindow *window,
if(!curview)
{
meta_view = NAUTILUS_VIEW(gtk_widget_new(nautilus_content_view_get_type(), "main_window", window, NULL));
meta_view = NAUTILUS_VIEW(gtk_widget_new(nautilus_meta_view_get_type(), "main_window", window, NULL));
nautilus_view_load_client(meta_view, iid);
nautilus_window_add_meta_view(window, meta_view);
}