mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-10-02 14:03:39 +00:00
Deleted help component as it is not slated to be part of Gnome 2.
* components/Makefile.am: * components/help/*: * nautilus.spec.in: Deleted help component as it is not slated to be part of Gnome 2. * RENAMING: No need to rename hyperbola if it's gone. * configure.in: Removed ScrollKeeper check. Took a cut at making the medusa check use pkg-config, it's probably messed up but at least we won't define HAVE_MEDUSA if we see the Gnome 1 medusa. * libnautilus-private/nautilus-icon-canvas-item.c: (nautilus_icon_canvas_item_init), (nautilus_icon_canvas_item_finalize), (nautilus_icon_canvas_item_set_arg), (nautilus_icon_canvas_item_get_arg), (draw_or_measure_label_text_aa), (draw_label_text_aa), (nautilus_icon_canvas_item_class_init): Quick cut at porting to Pango from Eel font code. It's all under ifdef USE_EEL_TEXT because it's not working well yet. At the moment the text looks bad, and it's very slow, and it's not centered. * libnautilus-private/nautilus-icon-factory.c: (embed_text): Baby steps at doing the port to Pango here too. * src/file-manager/fm-directory-view.c: (real_update_menus): Add a check for NULL that seems required. This change was suggested by the backtrace in bug 66809, but it's not clear if this really fixes anything. (Rolled from stable branch.) * src/file-manager/fm-icon-view.c: (icon_view_handle_uri_list): Fix code that passed a path instead of a URI when creating a desktop file. (Rolled from stable branch.) * TODO: Minor updates.
This commit is contained in:
parent
612ed122c7
commit
22ac93ef82
40
ChangeLog
40
ChangeLog
|
@ -1,3 +1,41 @@
|
|||
2001-12-13 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* components/Makefile.am:
|
||||
* components/help/*:
|
||||
* nautilus.spec.in:
|
||||
Deleted help component as it is not slated to be part of Gnome 2.
|
||||
|
||||
* RENAMING: No need to rename hyperbola if it's gone.
|
||||
|
||||
* configure.in: Removed ScrollKeeper check. Took a cut at making
|
||||
the medusa check use pkg-config, it's probably messed up but at
|
||||
least we won't define HAVE_MEDUSA if we see the Gnome 1 medusa.
|
||||
|
||||
* libnautilus-private/nautilus-icon-canvas-item.c:
|
||||
(nautilus_icon_canvas_item_init),
|
||||
(nautilus_icon_canvas_item_finalize),
|
||||
(nautilus_icon_canvas_item_set_arg),
|
||||
(nautilus_icon_canvas_item_get_arg),
|
||||
(draw_or_measure_label_text_aa), (draw_label_text_aa),
|
||||
(nautilus_icon_canvas_item_class_init):
|
||||
Quick cut at porting to Pango from Eel font code. It's all under
|
||||
ifdef USE_EEL_TEXT because it's not working well yet. At the moment
|
||||
the text looks bad, and it's very slow, and it's not centered.
|
||||
|
||||
* libnautilus-private/nautilus-icon-factory.c: (embed_text):
|
||||
Baby steps at doing the port to Pango here too.
|
||||
|
||||
* src/file-manager/fm-directory-view.c: (real_update_menus):
|
||||
Add a check for NULL that seems required. This change was
|
||||
suggested by the backtrace in bug 66809, but it's not clear
|
||||
if this really fixes anything. (Rolled from stable branch.)
|
||||
|
||||
* src/file-manager/fm-icon-view.c: (icon_view_handle_uri_list):
|
||||
Fix code that passed a path instead of a URI when creating a
|
||||
desktop file. (Rolled from stable branch.)
|
||||
|
||||
* TODO: Minor updates.
|
||||
|
||||
2001-12-12 Michael Meeks <michael@ximian.com>
|
||||
|
||||
* src/file-manager/fm-icon-view.c
|
||||
|
@ -1144,6 +1182,8 @@ Tue Nov 20 21:45:43 2001 Owen Taylor <otaylor@redhat.com>
|
|||
(nautilus_link_desktop_file_get_link_name_from_desktop):
|
||||
Use the localized string
|
||||
|
||||
=== Gnome 1 Nautilus development continues on nautilus-gnome-1 stable branch ===
|
||||
|
||||
=== nautilus 1.0.5 ===
|
||||
|
||||
2001-10-19 Darin Adler <darin@bentspoon.com>
|
||||
|
|
1
RENAMING
1
RENAMING
|
@ -28,7 +28,6 @@ file names
|
|||
----------
|
||||
*-ui.xml -> *.ui
|
||||
src/file-manager/fm-* -> ?
|
||||
hyperbola -> nautilus-help-system
|
||||
nautilus-authn-manager.c -> nautilus-authentication-manager.c
|
||||
|
||||
----------------------------
|
||||
|
|
3
TODO
3
TODO
|
@ -2,7 +2,6 @@ For tasks outside the porting effort, we track them as bugs in
|
|||
http://bugzilla.gnome.org.
|
||||
|
||||
- Make closing a window work (Bonobo fix needed).
|
||||
- Get embedded controls working (back and forward buttons and throbber).
|
||||
- Get list view working.
|
||||
- Visit all the destroy and move things into finalize or dispose
|
||||
and make them callable twice as appropriate.
|
||||
|
@ -12,5 +11,5 @@ http://bugzilla.gnome.org.
|
|||
dialog comes up.
|
||||
|
||||
- Get EelLabel working and switch back to it on the sidebar.
|
||||
- Get rid of all the direct freetype use and switch to using
|
||||
- Get rid of the direct freetype use and switch to using
|
||||
Pango instead.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
NULL=
|
||||
|
||||
SUBDIRS = \
|
||||
help \
|
||||
history \
|
||||
image-viewer \
|
||||
news \
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
*.la
|
||||
*.lo
|
||||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
Nautilus_View_help.server
|
||||
hyperbola
|
||||
test-help-method
|
|
@ -1,66 +0,0 @@
|
|||
NULL=
|
||||
|
||||
bin_PROGRAMS=hyperbola
|
||||
modules_LTLIBRARIES=libvfs-help.la
|
||||
noinst_PROGRAMS=test-help-method
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
-DPREFIX=\""$(prefix)"\" \
|
||||
-DHYPERBOLA_DATADIR=\""$(datadir)/nautilus/components/hyperbola"\" \
|
||||
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
|
||||
-DINFODIR=\"$(infodir)\" \
|
||||
-DENABLE_SCROLLKEEPER_SUPPORT \
|
||||
$(COMPONENT_CFLAGS) \
|
||||
$(GNOME_DB2HTML3_FLAG) \
|
||||
$(NULL)
|
||||
|
||||
LDADD =\
|
||||
$(top_builddir)/libnautilus/libnautilus.la \
|
||||
$(top_builddir)/libnautilus-private/libnautilus-private.la \
|
||||
$(COMPONENT_LIBS)
|
||||
|
||||
hyperbola_SOURCES= \
|
||||
hyperbola-nav.h \
|
||||
hyperbola-types.h \
|
||||
hyperbola-nav-tree.c \
|
||||
hyperbola-main.c \
|
||||
hyperbola-filefmt.c \
|
||||
hyperbola-filefmt.h \
|
||||
hyperbola-nav-index.c \
|
||||
hyperbola-nav-search.c
|
||||
|
||||
mapdatadir=$(datadir)/nautilus/components/hyperbola/maps
|
||||
mapdata_DATA=pages.map
|
||||
|
||||
module_flags = -export_dynamic -avoid-version
|
||||
modulesdir = $(libdir)/vfs/modules
|
||||
|
||||
libvfs_help_la_SOURCES = help-method.c help-method.h
|
||||
libvfs_help_la_LDFLAGS = $(module_flags)
|
||||
libvfs_help_la_LIBADD =
|
||||
|
||||
|
||||
test_help_method_SOURCES = test-help-method.c
|
||||
test_help_method_LDADD = $(COMPONENT_LIBS)
|
||||
|
||||
|
||||
modulesconfdir=$(sysconfdir)/vfs/modules
|
||||
modulesconf_DATA = help-methods.conf
|
||||
|
||||
hyperboladir=$(datadir)/nautilus/components/hyperbola
|
||||
hyperbola_DATA=topleveldocs.xml
|
||||
|
||||
uidir=$(datadir)/gnome-2.0/ui
|
||||
ui_DATA = nautilus-hyperbola-ui.xml
|
||||
|
||||
serverdir = $(libdir)/bonobo/servers
|
||||
server_in_files = \
|
||||
Nautilus_View_help.server.in \
|
||||
$(NULL)
|
||||
server_DATA = $(server_in_files:.server.in=.server)
|
||||
|
||||
@INTLTOOL_SERVER_RULE@
|
||||
|
||||
|
||||
EXTRA_DIST=pages.map $(server_in_files) $(server_DATA) help-methods.conf topleveldocs.xml
|
|
@ -1,27 +0,0 @@
|
|||
<oaf_info>
|
||||
|
||||
<oaf_server iid="OAFIID:hyperbola_factory:02b54c63-101b-4b27-a285-f99ed332ecdb" type="exe" location="hyperbola">
|
||||
<oaf_attribute name="repo_ids" type="stringv">
|
||||
<item value="IDL:GNOME/ObjectFactory:1.0"/>
|
||||
</oaf_attribute>
|
||||
<oaf_attribute name="description" type="string" _value="Internal use only"/>
|
||||
</oaf_server>
|
||||
|
||||
<oaf_server iid="OAFIID:hyperbola_navigation_tree:57542ce0-71ff-442d-a764-462c92514234" type="factory" location="OAFIID:hyperbola_factory:02b54c63-101b-4b27-a285-f99ed332ecdb">
|
||||
<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="description" type="string" _value="Help Navigation Tree"/>
|
||||
<oaf_attribute name="name" type="string" _value="Help sidebar panel"/>
|
||||
<oaf_attribute name="nautilus:sidebar_panel_name" type="string" _value="Help"/>
|
||||
<oaf_attribute name="nautilus:recommended_uri_schemes" type="stringv">
|
||||
<item value="help"/>
|
||||
<item value="ghelp"/>
|
||||
<item value="man"/>
|
||||
<item value="info"/>
|
||||
</oaf_attribute>
|
||||
</oaf_server>
|
||||
|
||||
</oaf_info>
|
|
@ -1,15 +0,0 @@
|
|||
ScrollKeeper Related Changes
|
||||
----------------------------
|
||||
|
||||
- Should look at going over to a SAX based interface for processing
|
||||
the XML files. It would have the advantage of being less memory
|
||||
intensive. It might also be a bit more robust given the current
|
||||
use of copied pointers.
|
||||
|
||||
SAX would require some seperate data structures though, as the
|
||||
positioning within the tree is important. The current DOM approach
|
||||
is more natural because we're populating a tree from a tree. SAX
|
||||
may not be suited to this task.
|
||||
|
||||
- See about specifying levels of TOC to process in Nautilus preferences
|
||||
and reading this in the component.
|
|
@ -1,591 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 Red Hat Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* The Gnome Library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "help-method.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <gnome.h>
|
||||
#include <libgnomevfs/gnome-vfs-module-shared.h>
|
||||
#include <libgnomevfs/gnome-vfs-module.h>
|
||||
#include <libgnomevfs/gnome-vfs.h>
|
||||
#include <libgnomevfs/gnome-vfs-method.h>
|
||||
#include <libgnomevfs/gnome-vfs-mime.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static gboolean already_initialized = FALSE;
|
||||
G_LOCK_DEFINE_STATIC (already_initialized);
|
||||
|
||||
static GHashTable *app_list = NULL;
|
||||
G_LOCK_DEFINE_STATIC (app_list);
|
||||
|
||||
typedef enum {
|
||||
SGML_FILE,
|
||||
MAN_FILE,
|
||||
INFO_FILE,
|
||||
HTML_FILE,
|
||||
XML_FILE,
|
||||
UNKNOWN_FILE
|
||||
} HelpFileTypes;
|
||||
|
||||
typedef struct {
|
||||
char *file; /* The absolute path */
|
||||
char *section;
|
||||
HelpFileTypes type;
|
||||
} HelpURI;
|
||||
|
||||
|
||||
static gboolean file_in_info_path (const char *file);
|
||||
|
||||
/* This is a copy of eel_shell_quote. The best thing to do is to
|
||||
* use the one on GNOME for GNOME 2.0, but we could also move this
|
||||
* into gnome-vfs or some other library so we could share it.
|
||||
*/
|
||||
static char *
|
||||
shell_quote (const char *string)
|
||||
{
|
||||
const char *p;
|
||||
GString *quoted_string;
|
||||
char *quoted_str;
|
||||
|
||||
/* All kinds of ways to do this fancier.
|
||||
* - Detect when quotes aren't needed at all.
|
||||
* - Use double quotes when they would look nicer.
|
||||
* - Avoid sequences of quote/unquote in a row (like when you quote "'''").
|
||||
* - Do it higher speed with strchr.
|
||||
* - Allocate the GString with g_string_sized_new.
|
||||
*/
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
|
||||
quoted_string = g_string_new ("'");
|
||||
|
||||
for (p = string; *p != '\0'; p++) {
|
||||
if (*p == '\'') {
|
||||
/* Get out of quotes, do a quote, then back in. */
|
||||
g_string_append (quoted_string, "'\\''");
|
||||
} else {
|
||||
g_string_append_c (quoted_string, *p);
|
||||
}
|
||||
}
|
||||
|
||||
g_string_append_c (quoted_string, '\'');
|
||||
|
||||
/* Let go of the GString. */
|
||||
quoted_str = quoted_string->str;
|
||||
g_string_free (quoted_string, FALSE);
|
||||
|
||||
return quoted_str;
|
||||
}
|
||||
|
||||
static HelpURI *
|
||||
help_uri_new (void)
|
||||
{
|
||||
HelpURI *retval;
|
||||
|
||||
retval = g_new0 (HelpURI, 1);
|
||||
retval->type = UNKNOWN_FILE;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static char *
|
||||
help_uri_to_string (HelpURI *help_uri)
|
||||
{
|
||||
const char *command;
|
||||
char *parameter, *command_line, *escaped, *uri;
|
||||
|
||||
switch (help_uri->type) {
|
||||
case SGML_FILE: case XML_FILE:
|
||||
#ifdef USE_GNOME_DB2HTML3
|
||||
command = "gnome-db2html3";
|
||||
#else
|
||||
command = "gnome-db2html2";
|
||||
#endif
|
||||
if (help_uri->section != NULL) {
|
||||
parameter = g_strconcat (help_uri->file, "?", help_uri->section, NULL);
|
||||
} else {
|
||||
parameter = g_strdup (help_uri->file);
|
||||
}
|
||||
break;
|
||||
case MAN_FILE:
|
||||
command = "gnome-man2html2";
|
||||
parameter = g_strdup (help_uri->file);
|
||||
break;
|
||||
case INFO_FILE:
|
||||
command = "gnome-info2html2";
|
||||
parameter = g_strdup (help_uri->file);
|
||||
break;
|
||||
case HTML_FILE:
|
||||
escaped = gnome_vfs_escape_path_string (help_uri->file);
|
||||
if (help_uri->section == NULL) {
|
||||
uri = g_strconcat ("file://", escaped, NULL);
|
||||
} else {
|
||||
uri = g_strconcat ("file://", escaped, "#", help_uri->section, NULL);
|
||||
}
|
||||
g_free (escaped);
|
||||
return uri;
|
||||
case UNKNOWN_FILE:
|
||||
return NULL;
|
||||
default:
|
||||
/* FIXME bugzilla.gnome.org 42401:
|
||||
* An assert at runtime may be a bit harsh.
|
||||
* We'd prefer behavior more like g_return_if_fail.
|
||||
* In glib 2.0 we can use g_return_val_if_reached.
|
||||
*/
|
||||
g_assert_not_reached ();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (parameter[0] == '-') {
|
||||
g_free (parameter);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Build a command line. */
|
||||
escaped = shell_quote (parameter);
|
||||
g_free (parameter);
|
||||
command_line = g_strconcat (command, " ", escaped, ";mime-type=text/html", NULL);
|
||||
g_free (escaped);
|
||||
escaped = gnome_vfs_escape_string (command_line);
|
||||
g_free (command_line);
|
||||
uri = g_strconcat ("pipe:", escaped, NULL);
|
||||
g_free (escaped);
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
static void
|
||||
help_uri_free (HelpURI *help_uri)
|
||||
{
|
||||
g_free (help_uri->file);
|
||||
g_free (help_uri->section);
|
||||
g_free (help_uri);
|
||||
}
|
||||
|
||||
static void
|
||||
init_help_module (void)
|
||||
{
|
||||
G_LOCK (already_initialized);
|
||||
if (already_initialized) {
|
||||
G_UNLOCK (already_initialized);
|
||||
return;
|
||||
}
|
||||
already_initialized = TRUE;
|
||||
G_UNLOCK (already_initialized);
|
||||
|
||||
G_LOCK (app_list);
|
||||
app_list = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
G_UNLOCK (app_list);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
convert_file_to_uri (HelpURI *help_uri, char *file)
|
||||
{
|
||||
const char *mime_type;
|
||||
|
||||
/* FIXME: This test is no longer necessary since we know the file exists from calling function */
|
||||
if (!g_file_test (file, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
help_uri->file = file;
|
||||
mime_type = gnome_vfs_mime_type_from_name (file);
|
||||
|
||||
if (g_ascii_strcasecmp (mime_type, "text/sgml") == 0) {
|
||||
help_uri->type = SGML_FILE;
|
||||
} else if (g_ascii_strcasecmp (mime_type, "text/xml") == 0) {
|
||||
help_uri->type = XML_FILE;
|
||||
} else if (g_ascii_strcasecmp (mime_type, "text/html") == 0) {
|
||||
help_uri->type = HTML_FILE;
|
||||
} else if (g_ascii_strcasecmp (mime_type, "application/x-troff-man") == 0) {
|
||||
/* FIXME bugzilla.gnome.org 42402:
|
||||
* The check above used to check for a prefix
|
||||
* of "application/x-troff-man", but now we check for
|
||||
* an exact string match. Is that what we really want?
|
||||
*/
|
||||
help_uri->type = MAN_FILE;
|
||||
} else if (file_in_info_path (file)) {
|
||||
help_uri->type = INFO_FILE;
|
||||
} else {
|
||||
help_uri->type = UNKNOWN_FILE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
string_ends_in (const char *string, const char *suffix)
|
||||
{
|
||||
size_t string_len, suffix_len;
|
||||
|
||||
string_len = strlen (string);
|
||||
suffix_len = strlen (suffix);
|
||||
|
||||
if (suffix_len > string_len) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return 0 == strcmp (string + strlen (string) - strlen (suffix), suffix);
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
strdup_string_to_substring_end (const char *string, const char *substring)
|
||||
{
|
||||
const char *marker;
|
||||
size_t substring_length;
|
||||
|
||||
if (string == NULL || substring == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
substring_length = strlen (substring);
|
||||
marker = strstr (string, substring);
|
||||
|
||||
if (marker == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
marker += substring_length;
|
||||
|
||||
return g_strndup (string, marker-string);
|
||||
}
|
||||
|
||||
/*
|
||||
* bugzilla.gnome.org 46761:
|
||||
* Automatically promote requests for html help to sgml help
|
||||
* if available
|
||||
*
|
||||
* ghelp:/.../gfoo/C/index.html -> ghelp:/.../gfoo/C/gfoo.sgml#index
|
||||
* ghelp:/.../gfoo/C/index.html#abc -> ghelp:/.../gfoo/C/gfoo.sgml#abc
|
||||
* ghelp:/.../gfoo/C/stuff.html -> ghelp:/.../gfoo/C/gfoo.sgml#stuff
|
||||
* ghelp:/.../gfoo/C/stuff.html#def -> ghelp:/.../gfoo/C/gfoo.sgml#def
|
||||
*/
|
||||
static void
|
||||
check_sgml_promotion (const char *base, /*OUT*/ char **p_new_uri, /*INOUT*/ char **p_section)
|
||||
{
|
||||
gchar **path_split;
|
||||
char *help_dir_base;
|
||||
char *sgml_path;
|
||||
|
||||
g_return_if_fail (p_new_uri != NULL);
|
||||
g_return_if_fail (p_section != NULL);
|
||||
|
||||
if (!string_ends_in (base, ".html")) {
|
||||
*p_new_uri = g_strdup (base);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The path format is assumed to be
|
||||
* share/gnome/help/ <application> / <locale> / <resource>
|
||||
* Note that the fragment has already been stripped and is passed in
|
||||
* separately
|
||||
*/
|
||||
|
||||
help_dir_base = strdup_string_to_substring_end (base, "share/gnome/help/");
|
||||
|
||||
if (help_dir_base == NULL) {
|
||||
*p_new_uri = g_strdup (base);
|
||||
return;
|
||||
}
|
||||
|
||||
path_split = g_strsplit (base + strlen(help_dir_base), "/" , 3);
|
||||
|
||||
if (path_split[0] == NULL || path_split[1] == NULL || path_split[2] == NULL
|
||||
|| strchr (path_split[2], '/') != NULL ) {
|
||||
g_strfreev (path_split);
|
||||
*p_new_uri = g_strdup (base);
|
||||
return;
|
||||
}
|
||||
|
||||
/* sgml document name should be "application.sgml" */
|
||||
sgml_path = g_strconcat (help_dir_base, path_split[0], "/", path_split[1], "/", path_split[0], ".sgml", NULL);
|
||||
|
||||
if (g_file_exists (sgml_path)) {
|
||||
*p_new_uri = sgml_path;
|
||||
sgml_path = NULL;
|
||||
|
||||
/* resources not equal to index.html turn into sections
|
||||
* if there is no section already defined
|
||||
* (presense of ".html" suffix was asserted above)
|
||||
*/
|
||||
if (0 != strcmp (path_split[2], "index.html") && *p_section == NULL) {
|
||||
/* chew off .html */
|
||||
|
||||
path_split[2][strlen (path_split[2]) - strlen (".html")] = '\0';
|
||||
g_free (*p_section);
|
||||
*p_section = g_strdup (path_split[2]);
|
||||
}
|
||||
} else {
|
||||
*p_new_uri = g_strdup (base);
|
||||
}
|
||||
}
|
||||
static char *
|
||||
file_from_path (const char *path)
|
||||
{
|
||||
const char *slash, *period;
|
||||
|
||||
/* Get rid of the path to just get the filename */
|
||||
slash = strrchr (path, '/');
|
||||
if (slash != NULL) {
|
||||
period = strchr (slash, '.');
|
||||
} else {
|
||||
period = strchr (path, '.');
|
||||
}
|
||||
|
||||
if (period != NULL) {
|
||||
if (slash == NULL) {
|
||||
/* e.g. file.sgml */
|
||||
return g_strndup (path, period - path);
|
||||
} else {
|
||||
/* e.g. path/to/file.sgml */
|
||||
slash = slash + 1; /* Get rid of leading '/' */
|
||||
return g_strndup (slash, period - slash);
|
||||
}
|
||||
} else {
|
||||
if (slash != NULL) {
|
||||
/* e.g. path/to/file */
|
||||
return g_strdup (slash+1);
|
||||
} else {
|
||||
/* e.g. file */
|
||||
return g_strdup (path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If the help file exists returns the appropriate PATH (taking locale into account)
|
||||
* otherwise it returns NULL */
|
||||
static char *
|
||||
help_name_to_local_path (const char *old_uri)
|
||||
{
|
||||
char *base_name, *new_uri, *buf;
|
||||
GList *language_list;
|
||||
char *new_uri_with_extension;
|
||||
char *old_help;
|
||||
gboolean is_toc;
|
||||
|
||||
is_toc = FALSE;
|
||||
|
||||
base_name = file_from_path (old_uri);
|
||||
if (base_name == NULL || base_name[0] == '\0') {
|
||||
g_free (base_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
is_toc = strcmp (old_uri, "toc") == 0;
|
||||
|
||||
new_uri_with_extension = NULL;
|
||||
new_uri = NULL;
|
||||
|
||||
language_list = (GList *) gnome_i18n_get_language_list ("LC_MESSAGES");
|
||||
|
||||
while (!new_uri_with_extension && language_list) {
|
||||
const char *lang;
|
||||
|
||||
lang = language_list->data;
|
||||
if (is_toc)
|
||||
buf = g_strdup_printf ("gnome/help/help-browser/%s/default-page.html",
|
||||
lang);
|
||||
else
|
||||
buf = g_strdup_printf ("gnome/help/%s/%s/%s", base_name, lang, old_uri);
|
||||
|
||||
new_uri = gnome_unconditional_datadir_file (buf);
|
||||
g_free (buf);
|
||||
|
||||
if (is_toc) {
|
||||
if (g_file_exists (new_uri)) {
|
||||
new_uri_with_extension = new_uri;
|
||||
new_uri = NULL;
|
||||
}
|
||||
} else {
|
||||
new_uri_with_extension = g_strconcat (new_uri, ".xml", NULL);
|
||||
/* FIXME: Should we use g_file_test instead? */
|
||||
if (!g_file_exists (new_uri_with_extension)) {
|
||||
/* XML file doesn't exist - now try SGML */
|
||||
g_free (new_uri_with_extension);
|
||||
|
||||
new_uri_with_extension = g_strconcat (new_uri, ".sgml", NULL);
|
||||
if (!g_file_exists (new_uri_with_extension)) {
|
||||
/* SGML file doesn't exist - fallback to SGML */
|
||||
g_free (new_uri_with_extension);
|
||||
|
||||
old_help = g_strdup_printf ("gnome/help/%s/%s/index.html", base_name, lang);
|
||||
new_uri_with_extension = gnome_unconditional_datadir_file (old_help);
|
||||
g_free (old_help);
|
||||
|
||||
if (!g_file_exists (new_uri_with_extension)) {
|
||||
/* HTML file doesn't exist - next language */
|
||||
g_free (new_uri_with_extension);
|
||||
new_uri_with_extension = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_free (new_uri);
|
||||
new_uri = NULL;
|
||||
language_list = language_list->next;
|
||||
}
|
||||
|
||||
return new_uri_with_extension;
|
||||
}
|
||||
|
||||
/* We can handle sgml, info and html files only.
|
||||
*
|
||||
* Possible cases for absolute paths:
|
||||
*
|
||||
* /path/to/file[.sgml][?section]
|
||||
* /path/to/file[.html][#section]
|
||||
* /absolute/path/to/file[.sgml]
|
||||
*
|
||||
* Possible cases for relative paths:
|
||||
* path/to/file[.sgml]
|
||||
* file[.sgml]
|
||||
*/
|
||||
|
||||
static HelpURI *
|
||||
transform_file (const char *old_uri)
|
||||
{
|
||||
HelpURI *help_uri;
|
||||
char *p;
|
||||
char *base, *new_uri;
|
||||
|
||||
help_uri = help_uri_new ();
|
||||
|
||||
/* Find the part after either a "?" or a "#". Only look for a
|
||||
* "#" if there is no "?". (We could instead use strpbrk to
|
||||
* search for the first occurence of either "?" or "#".)
|
||||
*/
|
||||
p = strrchr (old_uri, '?');
|
||||
if (p == NULL) {
|
||||
p = strrchr (old_uri, '#');
|
||||
}
|
||||
|
||||
if (p == NULL) {
|
||||
base = g_strdup (old_uri);
|
||||
} else {
|
||||
help_uri->section = g_strdup (p + 1);
|
||||
base = g_strndup (old_uri, p - old_uri);
|
||||
}
|
||||
|
||||
/* We do not want trailing spaces or it can screw things up. */
|
||||
g_strchomp (base);
|
||||
|
||||
if (base != NULL && base[0] == '/') {
|
||||
/* If an html file is specifed but an sgml file is present
|
||||
* we want to use that instead
|
||||
*/
|
||||
check_sgml_promotion (base, &new_uri, &(help_uri->section));
|
||||
} else {
|
||||
new_uri = help_name_to_local_path (base);
|
||||
}
|
||||
|
||||
g_free (base);
|
||||
|
||||
if (new_uri == NULL) {
|
||||
/* there is no SGML/XML or old HTML help path */
|
||||
help_uri_free (help_uri);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Try the URI. */
|
||||
if (convert_file_to_uri (help_uri, new_uri)) {
|
||||
return help_uri;
|
||||
}
|
||||
|
||||
/* Failed, so return. */
|
||||
g_free (new_uri);
|
||||
help_uri_free (help_uri);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GnomeVFSResult
|
||||
help_do_transform (GnomeVFSTransform *transform,
|
||||
const char *old_uri,
|
||||
char **new_uri,
|
||||
GnomeVFSContext *context)
|
||||
{
|
||||
HelpURI *help_uri;
|
||||
|
||||
*new_uri = NULL;
|
||||
if (old_uri == NULL || *old_uri == '\0') {
|
||||
return GNOME_VFS_ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
help_uri = transform_file (old_uri);
|
||||
|
||||
if (help_uri == NULL) {
|
||||
return GNOME_VFS_ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
*new_uri = help_uri_to_string (help_uri);
|
||||
help_uri_free (help_uri);
|
||||
|
||||
return GNOME_VFS_OK;
|
||||
}
|
||||
|
||||
static GnomeVFSTransform transform = {
|
||||
help_do_transform
|
||||
};
|
||||
|
||||
GnomeVFSTransform *
|
||||
vfs_module_transform (const char *method_name, const char *args)
|
||||
{
|
||||
init_help_module ();
|
||||
return &transform;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
file_in_info_path (const char *file)
|
||||
{
|
||||
const char *info_path;
|
||||
char **info_path_strv;
|
||||
int i;
|
||||
|
||||
/* Check some hardcoded locations. */
|
||||
if (strncmp (file, "/usr/info/", strlen ("/usr/info/")) == 0 ||
|
||||
strncmp (file, "/usr/local/info/", strlen ("/usr/local/info/")) ||
|
||||
strncmp (file, "/usr/gnome/info/", strlen ("/usr/gnome/info/")) ||
|
||||
strncmp (file, "/usr/share/info/", strlen ("/usr/share/info/"))) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Check the INFOPATH */
|
||||
info_path = getenv ("INFOPATH");
|
||||
if (info_path != NULL) {
|
||||
info_path_strv = g_strsplit (info_path, ":", 0);
|
||||
|
||||
for (i = 0; info_path_strv [i] != NULL; i++) {
|
||||
if (strncmp (file, info_path_strv[i], strlen (info_path_strv[i])) == 0) {
|
||||
g_strfreev (info_path_strv);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev (info_path_strv);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef HELP_METHOD_H
|
||||
#define HELP_METHOD_H 1
|
||||
|
||||
#include <libgnomevfs/gnome-vfs.h>
|
||||
|
||||
#endif
|
|
@ -1,5 +0,0 @@
|
|||
help: libvfs-help.so
|
||||
ghelp: libvfs-help.so
|
||||
gnome-help: libvfs-help.so
|
||||
info: libvfs-translate.so -default-mime-type text/html -real-method pipe -pattern "gnome-info2html2 %s"
|
||||
man: libvfs-translate.so -default-mime-type text/html -real-method pipe -pattern "gnome-man2html2 %s"
|
File diff suppressed because it is too large
Load diff
|
@ -1,14 +0,0 @@
|
|||
#ifndef HYPERBOLA_FILEFMT_H
|
||||
#define HYPERBOLA_FILEFMT_H 1
|
||||
|
||||
#include "hyperbola-types.h"
|
||||
|
||||
void hyperbola_doc_tree_populate (HyperbolaDocTree * tree);
|
||||
int hyperbola_top_doc_tree_populate (HyperbolaDocTree * tree);
|
||||
HyperbolaDocTree *hyperbola_doc_tree_new (void);
|
||||
void hyperbola_doc_tree_destroy (HyperbolaDocTree * tree);
|
||||
void hyperbola_doc_tree_add (HyperbolaDocTree * tree,
|
||||
HyperbolaTreeNodeType type, const char **path,
|
||||
const char *title, const char *uri);
|
||||
|
||||
#endif
|
|
@ -1,145 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 Red Hat, Inc.
|
||||
* Copyright (C) 2000, 2001 Eazel, Inc.
|
||||
*
|
||||
* Nautilus 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.
|
||||
*
|
||||
* Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <bonobo.h>
|
||||
#include <eel/eel-debug.h>
|
||||
#include <gnome.h>
|
||||
#include <libnautilus-private/nautilus-global-preferences.h>
|
||||
#include <bonobo-activation/bonobo-activation.h>
|
||||
|
||||
#include "hyperbola-nav.h"
|
||||
|
||||
#define IID "OAFIID:hyperbola_factory:02b54c63-101b-4b27-a285-f99ed332ecdb"
|
||||
|
||||
static int object_count = 0;
|
||||
|
||||
static void
|
||||
do_destroy (GtkObject * obj)
|
||||
{
|
||||
object_count--;
|
||||
|
||||
if (object_count <= 0)
|
||||
gtk_main_quit ();
|
||||
}
|
||||
/*
|
||||
* If scrollkeeper support is enabled then hyperbola_navigation_tree_new()
|
||||
* is the only function called. This will create the contents display and
|
||||
* the index/search display.
|
||||
*
|
||||
* If scrollkeeper support is not enabled, then this function is called and
|
||||
* will only create the contents display. The other functions
|
||||
* hyperbola_navigation_index_new() and hyperbola_navigation_search_new()
|
||||
* are not implemented.
|
||||
*/
|
||||
|
||||
static BonoboObject *
|
||||
make_obj (BonoboGenericFactory * Factory, const char *goad_id, void *closure)
|
||||
{
|
||||
BonoboObject *retval = NULL;
|
||||
/*
|
||||
* If scrollkeeper support is enabled then hyperbola_navigation_tree_new()
|
||||
* will create the access to the contents display and the index/search display.
|
||||
*/
|
||||
if (!strcmp
|
||||
(goad_id,
|
||||
"OAFIID:hyperbola_navigation_tree:57542ce0-71ff-442d-a764-462c92514234"))
|
||||
retval = hyperbola_navigation_tree_new ();
|
||||
#ifndef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
else
|
||||
if (!strcmp
|
||||
(goad_id,
|
||||
"OAFIID:hyperbola_navigation_index:0bafadc7-09f1-4f10-8c8e-dad53124fc49"))
|
||||
retval = hyperbola_navigation_index_new ();
|
||||
else
|
||||
if (!strcmp
|
||||
(goad_id,
|
||||
"OAFIID:hyperbola_navigation_search:89b2f3b8-4f09-49c8-9a7b-ccb14d034813"))
|
||||
retval = hyperbola_navigation_search_new ();
|
||||
#endif
|
||||
|
||||
if (retval) {
|
||||
object_count++;
|
||||
g_signal_connect (retval, "destroy",
|
||||
G_CALLBACK (do_destroy), NULL);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
BonoboGenericFactory *factory;
|
||||
#ifdef GNOME2_CONVERSION_COMPLETE
|
||||
char *registration_id;
|
||||
#endif
|
||||
|
||||
/* Initialize gettext support */
|
||||
#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */
|
||||
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
|
||||
bind_textdomain_codeset (PACKAGE, "UTF-8");
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
if (g_getenv ("NAUTILUS_DEBUG") != NULL) {
|
||||
eel_make_warnings_and_criticals_stop_in_debugger ();
|
||||
}
|
||||
|
||||
/* Disable session manager connection */
|
||||
#ifdef GNOME2_CONVERSION_COMPLETE
|
||||
gnome_client_disable_master_connection ();
|
||||
|
||||
gnomelib_register_popt_table (bonobo_activation_popt_options,
|
||||
bonobo_activation_get_popt_table_name ());
|
||||
orb = bonobo_activation_init (argc, argv);
|
||||
|
||||
gnome_init ("hyperbola", VERSION, argc, argv);
|
||||
|
||||
gdk_rgb_init ();
|
||||
|
||||
bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
|
||||
#endif
|
||||
bonobo_ui_init ("hyperbola", VERSION, &argc, argv);
|
||||
|
||||
nautilus_global_preferences_init ();
|
||||
|
||||
#ifdef GNOME2_CONVERSION_COMPLETE
|
||||
registration_id =
|
||||
bonobo_activation_make_registration_id
|
||||
("OAFIID:hyperbola_factory:02b54c63-101b-4b27-a285-f99ed332ecdb",
|
||||
g_getenv ("DISPLAY"));
|
||||
#endif
|
||||
factory =
|
||||
bonobo_generic_factory_new (IID, make_obj,
|
||||
NULL);
|
||||
#ifdef GNOME2_CONVERSION_COMPLETE
|
||||
g_free (registration_id);
|
||||
#endif
|
||||
|
||||
do {
|
||||
bonobo_main ();
|
||||
} while (object_count > 0);
|
||||
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,201 +0,0 @@
|
|||
#include <config.h>
|
||||
#include <libnautilus/libnautilus.h>
|
||||
#include <gnome.h>
|
||||
#include "hyperbola-filefmt.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <dirent.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "hyperbola-nav.h"
|
||||
|
||||
typedef struct {
|
||||
NautilusView *nautilus_view;
|
||||
|
||||
GtkWidget *clist, *ent;
|
||||
|
||||
gint8 notify_count;
|
||||
} HyperbolaNavigationSearch;
|
||||
|
||||
static void
|
||||
hyperbola_navigation_search_ent_changed (GtkWidget * ent,
|
||||
HyperbolaNavigationSearch * hns)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
hyperbola_navigation_search_ent_activate (GtkWidget * ent,
|
||||
HyperbolaNavigationSearch * hns)
|
||||
{
|
||||
GString *query;
|
||||
FILE *fh;
|
||||
char *dir;
|
||||
char *ctmp;
|
||||
const char *linetmp;
|
||||
char *line;
|
||||
|
||||
query = g_string_new (NULL);
|
||||
|
||||
gtk_clist_freeze (GTK_CLIST (hns->clist));
|
||||
gtk_clist_clear (GTK_CLIST (hns->clist));
|
||||
|
||||
dir = gnome_datadir_file ("gnome/help");
|
||||
g_string_sprintf (query, "sgrep -l '");
|
||||
|
||||
linetmp = gtk_entry_get_text (GTK_ENTRY (hns->ent));
|
||||
line = g_strdup(linetmp);
|
||||
while ((ctmp = strtok (line, " \t"))) {
|
||||
g_string_sprintfa (query, "%sword(\"%s\")",
|
||||
line ? "" : " and ", ctmp);
|
||||
line = NULL;
|
||||
}
|
||||
g_string_sprintfa (query, "' %s/*/*/*.sgml", dir);
|
||||
g_free (dir);
|
||||
g_free (line);
|
||||
|
||||
fh = popen (query->str, "r");
|
||||
g_string_free (query, TRUE);
|
||||
|
||||
if (fh) {
|
||||
char aline[LINE_MAX];
|
||||
char uri[512], *uriptr;
|
||||
GHashTable *uri_hash;
|
||||
|
||||
uri_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
while (fgets (aline, sizeof (aline), fh)) {
|
||||
char *filename, *ctmp;
|
||||
int len, rownum;
|
||||
|
||||
if (strncmp (aline, "---", 3) != 0) /* Skip non match-info lines */
|
||||
continue;
|
||||
|
||||
g_strstrip (aline);
|
||||
filename = strtok (aline, " \t");
|
||||
if (!filename)
|
||||
continue;
|
||||
filename = strtok (NULL, " \t");
|
||||
if (!filename)
|
||||
continue;
|
||||
filename = strtok (NULL, " \t");
|
||||
if (!filename)
|
||||
continue;
|
||||
|
||||
len = strlen (filename);
|
||||
if (filename[len - 1] == ':')
|
||||
filename[len - 1] = '\0';
|
||||
|
||||
/* XXX lame! Should use gnome_file_locate eventually to figure out all possible prefixes. */
|
||||
ctmp = strstr (filename, "/help/");
|
||||
if (ctmp) {
|
||||
char **pieces;
|
||||
|
||||
ctmp += strlen ("/help/");
|
||||
|
||||
pieces = g_strsplit (ctmp, "/", -1);
|
||||
|
||||
if (!pieces || !pieces[0] || !pieces[1] ||
|
||||
!pieces[2] || pieces[3])
|
||||
ctmp = NULL;
|
||||
else {
|
||||
ctmp = strrchr (pieces[2], '.');
|
||||
if (ctmp && !strcmp (ctmp, ".sgml"))
|
||||
*ctmp = '\0';
|
||||
|
||||
g_snprintf (uri, sizeof (uri),
|
||||
"help:%s/%s", pieces[0],
|
||||
pieces[2]);
|
||||
}
|
||||
|
||||
g_strfreev (pieces);
|
||||
}
|
||||
|
||||
if (!ctmp)
|
||||
g_snprintf (uri, sizeof (uri), "file://%s",
|
||||
filename);
|
||||
|
||||
uriptr = g_hash_table_lookup (uri_hash, uri);
|
||||
if (uriptr)
|
||||
continue;
|
||||
|
||||
uriptr = uri;
|
||||
rownum =
|
||||
gtk_clist_append (GTK_CLIST (hns->clist),
|
||||
&uriptr);
|
||||
if (gtk_clist_get_text
|
||||
(GTK_CLIST (hns->clist), rownum, 0, &uriptr))
|
||||
g_hash_table_insert (uri_hash, uriptr,
|
||||
uriptr);
|
||||
}
|
||||
|
||||
pclose (fh);
|
||||
g_hash_table_destroy (uri_hash);
|
||||
}
|
||||
|
||||
gtk_clist_thaw (GTK_CLIST (hns->clist));
|
||||
}
|
||||
|
||||
static void
|
||||
hyperbola_navigation_search_select_row (GtkWidget * clist, gint row,
|
||||
gint column, GdkEvent * event,
|
||||
HyperbolaNavigationSearch * hns)
|
||||
{
|
||||
char *uri;
|
||||
|
||||
if (!event || event->type != GDK_2BUTTON_PRESS) /* we only care if the user has double-clicked on an item...? */
|
||||
return;
|
||||
|
||||
if (gtk_clist_get_text (GTK_CLIST (clist), row, 0, &uri))
|
||||
return;
|
||||
|
||||
nautilus_view_open_location_in_this_window (hns->nautilus_view, uri);
|
||||
}
|
||||
|
||||
BonoboObject *
|
||||
hyperbola_navigation_search_new (void)
|
||||
{
|
||||
HyperbolaNavigationSearch *hns;
|
||||
GtkWidget *wtmp, *vbox;
|
||||
|
||||
hns = g_new0 (HyperbolaNavigationSearch, 1);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, GNOME_PAD);
|
||||
|
||||
hns->ent = gtk_entry_new ();
|
||||
g_signal_connect (hns->ent, "changed",
|
||||
G_CALLBACK (hyperbola_navigation_search_ent_changed), hns);
|
||||
g_signal_connect (hns->ent, "activate",
|
||||
G_CALLBACK (hyperbola_navigation_search_ent_activate), hns);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), hns->ent);
|
||||
|
||||
hns->clist = gtk_clist_new (1);
|
||||
gtk_clist_freeze (GTK_CLIST (hns->clist));
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (hns->clist),
|
||||
GTK_SELECTION_BROWSE);
|
||||
|
||||
g_signal_connect (hns->clist, "select_row",
|
||||
G_CALLBACK (hyperbola_navigation_search_select_row), hns);
|
||||
|
||||
wtmp =
|
||||
gtk_scrolled_window_new (gtk_clist_get_hadjustment
|
||||
(GTK_CLIST (hns->clist)),
|
||||
gtk_clist_get_vadjustment (GTK_CLIST
|
||||
(hns->
|
||||
clist)));
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wtmp),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (wtmp), hns->clist);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), wtmp);
|
||||
|
||||
gtk_clist_columns_autosize (GTK_CLIST (hns->clist));
|
||||
gtk_clist_thaw (GTK_CLIST (hns->clist));
|
||||
gtk_widget_show_all (vbox);
|
||||
|
||||
hns->nautilus_view = nautilus_view_new (vbox);
|
||||
|
||||
return BONOBO_OBJECT (hns->nautilus_view);
|
||||
}
|
|
@ -1,758 +0,0 @@
|
|||
#include <config.h>
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
#include "hyperbola-types.h"
|
||||
#else
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtkctree.h>
|
||||
#include <libgnome/gnome-i18n.h>
|
||||
#include <libgnomeui/gnome-uidefs.h>
|
||||
#include <libnautilus-private/nautilus-theme.h>
|
||||
#include <libnautilus/libnautilus.h>
|
||||
#endif
|
||||
|
||||
#include "hyperbola-filefmt.h"
|
||||
#include "hyperbola-nav.h"
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
typedef struct {
|
||||
NautilusView *view_frame;
|
||||
|
||||
GtkWidget *ctree;
|
||||
HyperbolaDocTree *doc_tree;
|
||||
char *pending_location;
|
||||
|
||||
gint notify_count;
|
||||
|
||||
GdkPixmap *folder_open_pixmap;
|
||||
GdkBitmap *folder_open_mask;
|
||||
GdkPixmap *folder_closed_pixmap;
|
||||
GdkBitmap *folder_closed_mask;
|
||||
|
||||
GdkPixmap *book_open_pixmap;
|
||||
GdkBitmap *book_open_mask;
|
||||
GdkPixmap *book_closed_pixmap;
|
||||
GdkBitmap *book_closed_mask;
|
||||
|
||||
GdkPixmap *section_open_pixmap;
|
||||
GdkBitmap *section_open_mask;
|
||||
GdkPixmap *section_closed_pixmap;
|
||||
GdkBitmap *section_closed_mask;
|
||||
} HyperbolaNavigationTree;
|
||||
|
||||
typedef struct {
|
||||
HyperbolaNavigationTree *view;
|
||||
GtkWidget *ctree;
|
||||
GtkCTreeNode *sibling, *parent;
|
||||
} PopulateInfo;
|
||||
|
||||
static void hyperbola_navigation_tree_destroy (GtkCTree * ctree,
|
||||
HyperbolaNavigationTree *
|
||||
view);
|
||||
static void hyperbola_navigation_tree_select_row (GtkCTree * ctree,
|
||||
GtkCTreeNode * node,
|
||||
gint column,
|
||||
HyperbolaNavigationTree *
|
||||
view);
|
||||
#endif
|
||||
static void hyperbola_navigation_tree_load_location (NautilusView *
|
||||
view_frame,
|
||||
const char *location_uri,
|
||||
HyperbolaNavigationTree *
|
||||
hview);
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
void set_pending_location (HyperbolaNavigationTree * view, const char *location);
|
||||
#else
|
||||
static void set_pending_location (HyperbolaNavigationTree * view, const char *location);
|
||||
#endif
|
||||
static void
|
||||
ensure_pixmap_and_mask (GdkPixmap **pixmap, GdkBitmap **mask, const char *name)
|
||||
{
|
||||
char *fullname;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
if (*pixmap != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
fullname = nautilus_theme_get_image_path (name);
|
||||
if (fullname == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file (fullname, NULL);
|
||||
if (pixbuf == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_pixbuf_render_pixmap_and_mask (pixbuf,
|
||||
pixmap,
|
||||
mask,
|
||||
127 /* alpha_threshold */);
|
||||
|
||||
g_free (fullname);
|
||||
}
|
||||
|
||||
static void
|
||||
ensure_icons (HyperbolaNavigationTree *view)
|
||||
{
|
||||
ensure_pixmap_and_mask (&view->folder_open_pixmap,
|
||||
&view->folder_open_mask,
|
||||
"hyperbola-folder-open.png");
|
||||
ensure_pixmap_and_mask (&view->folder_closed_pixmap,
|
||||
&view->folder_closed_mask,
|
||||
"hyperbola-folder-closed.png");
|
||||
|
||||
ensure_pixmap_and_mask (&view->book_open_pixmap,
|
||||
&view->book_open_mask,
|
||||
"hyperbola-book-open.png");
|
||||
ensure_pixmap_and_mask (&view->book_closed_pixmap,
|
||||
&view->book_closed_mask,
|
||||
"hyperbola-book-closed.png");
|
||||
|
||||
ensure_pixmap_and_mask (&view->section_open_pixmap,
|
||||
&view->section_open_mask,
|
||||
"hyperbola-section-open.png");
|
||||
ensure_pixmap_and_mask (&view->section_closed_pixmap,
|
||||
&view->section_closed_mask,
|
||||
"hyperbola-section-closed.png");
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
void
|
||||
#else
|
||||
static void
|
||||
#endif
|
||||
get_node_icons (HyperbolaNavigationTree *view,
|
||||
HyperbolaTreeNode *node,
|
||||
GdkPixmap **pixmap_closed,
|
||||
GdkBitmap **mask_closed,
|
||||
GdkPixmap **pixmap_opened,
|
||||
GdkBitmap **mask_opened)
|
||||
{
|
||||
ensure_icons (view);
|
||||
|
||||
if (node->type == HYP_TREE_NODE_FOLDER) {
|
||||
*pixmap_opened = view->folder_open_pixmap;
|
||||
*mask_opened = view->folder_open_mask;
|
||||
*pixmap_closed = view->folder_closed_pixmap;
|
||||
*mask_closed = view->folder_closed_mask;
|
||||
} else if (node->type == HYP_TREE_NODE_BOOK) {
|
||||
*pixmap_opened = view->book_open_pixmap;
|
||||
*mask_opened = view->book_open_mask;
|
||||
*pixmap_closed = view->book_closed_pixmap;
|
||||
*mask_closed = view->book_closed_mask;
|
||||
} else if (node->type == HYP_TREE_NODE_SECTION
|
||||
|| node->type == HYP_TREE_NODE_PAGE) {
|
||||
*pixmap_opened = view->section_open_pixmap;
|
||||
*mask_opened = view->section_open_mask;
|
||||
*pixmap_closed = view->section_closed_pixmap;
|
||||
*mask_closed = view->section_closed_mask;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
ctree_populate_subnode (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
HyperbolaTreeNode *node = value;
|
||||
PopulateInfo *pi = (PopulateInfo *) user_data, subpi;
|
||||
gboolean term;
|
||||
char *title;
|
||||
GdkPixmap *pixmap_closed = NULL;
|
||||
GdkBitmap *mask_closed = NULL;
|
||||
GdkPixmap *pixmap_opened = NULL;
|
||||
GdkBitmap *mask_opened = NULL;
|
||||
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
/* Get rid of leading numbers used to make sure TOCs are displayed properly */
|
||||
if (strstr (node->title, ". ") != NULL) {
|
||||
char **split;
|
||||
|
||||
split = g_strsplit (node->title, ". ", 1);
|
||||
title = g_strdup (split[1]);
|
||||
|
||||
/* Clean up the strings a bit. These modify the string in-place */
|
||||
g_strchug (title);
|
||||
g_strchomp (title);
|
||||
|
||||
g_strfreev (split);
|
||||
} else
|
||||
#endif
|
||||
title = node->title;
|
||||
|
||||
get_node_icons (pi->view, node,
|
||||
&pixmap_closed, &mask_closed,
|
||||
&pixmap_opened, &mask_opened);
|
||||
|
||||
term = (node->type == HYP_TREE_NODE_PAGE) || !node->children;
|
||||
pi->sibling =
|
||||
gtk_ctree_insert_node (GTK_CTREE (pi->ctree),
|
||||
pi->parent, NULL, &title, 5,
|
||||
pixmap_closed, mask_closed,
|
||||
pixmap_opened, mask_opened,
|
||||
term, FALSE);
|
||||
node->user_data = pi->sibling;
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
if (title != node->title)
|
||||
g_free (title); /* We used the copy from the split */
|
||||
#endif
|
||||
|
||||
gtk_ctree_node_set_row_data (GTK_CTREE (pi->ctree), pi->sibling,
|
||||
node);
|
||||
|
||||
if (node->children) {
|
||||
subpi.view = pi->view;
|
||||
subpi.ctree = pi->ctree;
|
||||
subpi.sibling = NULL;
|
||||
subpi.parent = pi->sibling;
|
||||
g_tree_traverse (node->children, ctree_populate_subnode,
|
||||
G_IN_ORDER, &subpi);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
ctree_populate (HyperbolaNavigationTree * view)
|
||||
{
|
||||
PopulateInfo subpi;
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
subpi.view = view;
|
||||
subpi.ctree = view->top_ctree;
|
||||
subpi.sibling = NULL;
|
||||
subpi.parent = NULL;
|
||||
|
||||
g_tree_traverse (view->top_doc_tree->children, ctree_populate_subnode,
|
||||
G_IN_ORDER, &subpi);
|
||||
#endif
|
||||
subpi.view = view;
|
||||
subpi.ctree = view->ctree;
|
||||
subpi.sibling = NULL;
|
||||
subpi.parent = NULL;
|
||||
|
||||
g_tree_traverse (view->doc_tree->children, ctree_populate_subnode,
|
||||
G_IN_ORDER, &subpi);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
/*
|
||||
* make_contents_page
|
||||
* @HyperbolaNavigationTree *contents: pointer to the contents page's
|
||||
* HyperbolaNavigationTree
|
||||
* Creates the widget that will be appended to the GtkNotebook as the
|
||||
* contents page.
|
||||
* Returns a pointer to the widget.
|
||||
*/
|
||||
|
||||
static GtkWidget *
|
||||
make_contents_page(HyperbolaNavigationTree *contents)
|
||||
{
|
||||
GtkWidget *wtmp1, *wtmp2;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *label;
|
||||
int top_tree_empty;
|
||||
|
||||
contents->top_ctree = gtk_ctree_new(1, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (contents->top_ctree), 0);
|
||||
gtk_ctree_set_line_style (GTK_CTREE (contents->top_ctree),
|
||||
GTK_CTREE_LINES_NONE);
|
||||
gtk_ctree_set_expander_style (GTK_CTREE (contents->top_ctree),
|
||||
GTK_CTREE_EXPANDER_TRIANGLE);
|
||||
|
||||
gtk_clist_freeze (GTK_CLIST (contents->top_ctree));
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (contents->top_ctree),
|
||||
GTK_SELECTION_BROWSE);
|
||||
g_signal_connect (contents->top_ctree, "tree_select_row",
|
||||
G_CALLBACK (hyperbola_navigation_tree_select_row), contents);
|
||||
g_signal_connect (contents->top_ctree, "destroy",
|
||||
G_CALLBACK (hyperbola_navigation_tree_destroy), contents);
|
||||
|
||||
contents->ctree = gtk_ctree_new (1, 0);
|
||||
gtk_ctree_set_line_style (GTK_CTREE (contents->ctree),
|
||||
GTK_CTREE_LINES_NONE);
|
||||
gtk_ctree_set_expander_style (GTK_CTREE (contents->ctree),
|
||||
GTK_CTREE_EXPANDER_TRIANGLE);
|
||||
|
||||
gtk_clist_freeze (GTK_CLIST (contents->ctree));
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (contents->ctree),
|
||||
GTK_SELECTION_BROWSE);
|
||||
g_signal_connect (contents->ctree, "tree_select_row",
|
||||
G_CALLBACK (hyperbola_navigation_tree_select_row), contents);
|
||||
g_signal_connect (contents->ctree, "destroy",
|
||||
G_CALLBACK (hyperbola_navigation_tree_destroy), contents);
|
||||
|
||||
contents->selected_ctree = NULL;
|
||||
contents->selected_node = NULL;
|
||||
contents->select = 0;
|
||||
|
||||
contents->doc_tree = hyperbola_doc_tree_new ();
|
||||
contents->doc_tree->contents_tree_type = TRUE;
|
||||
hyperbola_doc_tree_populate (contents->doc_tree);
|
||||
contents->top_doc_tree = hyperbola_doc_tree_new ();
|
||||
top_tree_empty = !hyperbola_top_doc_tree_populate(contents->top_doc_tree);
|
||||
|
||||
ctree_populate (contents);
|
||||
|
||||
wtmp1 = gtk_scrolled_window_new (gtk_clist_get_hadjustment
|
||||
(GTK_CLIST (contents->ctree)),
|
||||
gtk_clist_get_vadjustment (GTK_CLIST (contents-> ctree)));
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wtmp1),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_widget_show (wtmp1);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
if (!top_tree_empty) {
|
||||
label = gtk_label_new (_("Introductory Documents"));
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_misc_set_padding (GTK_MISC (label), GNOME_PAD_SMALL, 0);
|
||||
gtk_widget_show (label);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
wtmp2 = gtk_scrolled_window_new (gtk_clist_get_hadjustment
|
||||
(GTK_CLIST (contents->top_ctree)),
|
||||
gtk_clist_get_vadjustment(GTK_CLIST(contents->top_ctree)));
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wtmp2),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_widget_show(contents->top_ctree);
|
||||
gtk_widget_show (wtmp2);
|
||||
|
||||
gtk_box_pack_start ( GTK_BOX(vbox), wtmp2, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (wtmp2), contents->top_ctree);
|
||||
}
|
||||
else {
|
||||
gtk_widget_hide (contents->top_ctree);
|
||||
}
|
||||
|
||||
|
||||
label = gtk_label_new (_("Documents by Subject"));
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_misc_set_padding (GTK_MISC (label), GNOME_PAD_SMALL, 0);
|
||||
gtk_widget_show (label);
|
||||
gtk_box_pack_start ( GTK_BOX(vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show (contents->ctree);
|
||||
gtk_box_pack_start ( GTK_BOX(vbox), wtmp1, TRUE, TRUE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (wtmp1), contents->ctree);
|
||||
|
||||
gtk_clist_set_column_auto_resize (GTK_CLIST (contents->top_ctree),
|
||||
0 /* column */,
|
||||
TRUE /* auto_resize */);
|
||||
gtk_clist_thaw (GTK_CLIST (contents->top_ctree));
|
||||
gtk_clist_set_column_auto_resize (GTK_CLIST (contents->ctree),
|
||||
0 /* column */,
|
||||
TRUE /* auto_resize */);
|
||||
gtk_clist_thaw (GTK_CLIST (contents->ctree));
|
||||
return vbox;
|
||||
}
|
||||
|
||||
/* Callback functions for keyboard acceleration */
|
||||
static void
|
||||
switch_notebook_cb(BonoboUIComponent *com, gpointer data, const char *verb) {
|
||||
|
||||
HyperbolaNavigationIndex *indx = (HyperbolaNavigationIndex *)data;
|
||||
|
||||
if(!strcmp("Switch Contents", verb))
|
||||
gtk_notebook_set_page(GTK_NOTEBOOK(indx->notebook),0 );
|
||||
else
|
||||
gtk_notebook_set_page(GTK_NOTEBOOK(indx->notebook),1 );
|
||||
}
|
||||
|
||||
static void
|
||||
focus_scrolled_window_cb(BonoboUIComponent *com, gpointer data,const char *verb)
|
||||
{
|
||||
|
||||
HyperbolaNavigationIndex *indx = (HyperbolaNavigationIndex *)data;
|
||||
|
||||
if(strcmp("Select", verb)) {
|
||||
gtk_clist_select_row(GTK_CLIST(indx->index_contents->ctree), 0,0);
|
||||
gtk_widget_grab_focus(GTK_WIDGET(indx->index_contents->ctree));
|
||||
}
|
||||
else {
|
||||
gtk_clist_select_row(GTK_CLIST(indx->clist), 0,0);
|
||||
gtk_widget_grab_focus(GTK_WIDGET(indx->clist));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
button_selected_cb(BonoboUIComponent *com, gpointer data, const char *verb){
|
||||
|
||||
HyperbolaNavigationIndex *indx = (HyperbolaNavigationIndex *)data;
|
||||
|
||||
if(!strcmp("All", verb))
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
|
||||
indx->all_rbutton), TRUE);
|
||||
else if(!strcmp("Contents Tab", verb))
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
|
||||
indx->contents_rbutton), TRUE);
|
||||
else if(!strcmp("Specific",verb))
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
|
||||
indx->specific_rbutton), TRUE);
|
||||
else if(!strcmp("Show All Terms", verb))
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
|
||||
indx->all_terms_rbutton), TRUE);
|
||||
else if(!strcmp("Show Specific Terms", verb))
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
|
||||
indx->specific_terms_rbutton), TRUE);
|
||||
else if(!strcmp("Show", verb))
|
||||
gtk_button_pressed(GTK_BUTTON(indx->show_button));
|
||||
else if(!strcmp("Select All", verb))
|
||||
gtk_button_pressed(GTK_BUTTON(indx->all_button));
|
||||
else if(!strcmp("Select None", verb))
|
||||
gtk_button_pressed(GTK_BUTTON(indx->none_button));
|
||||
|
||||
}
|
||||
/* Callback to setup keyboard accelerator for hyperbola view when activated
|
||||
*/
|
||||
|
||||
static void
|
||||
merge_items_callback(BonoboControl *control, gboolean state, gpointer user_data)
|
||||
{
|
||||
NautilusView *view;
|
||||
HyperbolaNavigationIndex *indx = (HyperbolaNavigationIndex *) user_data;
|
||||
BonoboUIComponent *ui;
|
||||
|
||||
BonoboUIVerb verbs[] = {
|
||||
BONOBO_UI_VERB("Switch Contents", switch_notebook_cb),
|
||||
BONOBO_UI_VERB("Switch Index", switch_notebook_cb),
|
||||
BONOBO_UI_VERB("Contents Tab", button_selected_cb),
|
||||
BONOBO_UI_VERB("All", button_selected_cb),
|
||||
BONOBO_UI_VERB("Specific", button_selected_cb),
|
||||
BONOBO_UI_VERB("Show All Terms", button_selected_cb),
|
||||
BONOBO_UI_VERB("Show Specific Terms", button_selected_cb),
|
||||
BONOBO_UI_VERB("Show", button_selected_cb),
|
||||
BONOBO_UI_VERB("Index", focus_scrolled_window_cb),
|
||||
BONOBO_UI_VERB("Select", focus_scrolled_window_cb),
|
||||
BONOBO_UI_VERB("Select All", button_selected_cb),
|
||||
BONOBO_UI_VERB("Select None", button_selected_cb),
|
||||
BONOBO_UI_VERB_END
|
||||
};
|
||||
|
||||
g_assert(BONOBO_IS_CONTROL(control));
|
||||
view = NAUTILUS_VIEW(indx->index_view_frame);
|
||||
|
||||
if (state) {
|
||||
ui = nautilus_view_set_up_ui(view, HYPERBOLA_DATADIR, "nautilus-hyperbola-ui.xml", "hyperbola");
|
||||
|
||||
bonobo_ui_component_add_verb_list_with_data(ui, verbs, indx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* hyperbola_navigation_tree_new.
|
||||
* Creates a GtkNotebook with two pages:
|
||||
* - contents page displays the list of contents;
|
||||
* - index page will display alternatively the
|
||||
* index_display_page or the index_select page.
|
||||
* The index_display page displays an index, the
|
||||
* index_select_page display a contents list to
|
||||
* allow the user to select documents whose indexes
|
||||
* can then be displayed on the index_display_page.
|
||||
* Function then creates a BonoboObject from the notebook
|
||||
* Returns the BonoboObject pointer.
|
||||
*/
|
||||
BonoboObject *
|
||||
hyperbola_navigation_tree_new (void)
|
||||
{
|
||||
NautilusView *view_frame;
|
||||
GtkWidget *notebook, *index_page, *page_label, *contents_page;
|
||||
HyperbolaNavigationTree *contents;
|
||||
HyperbolaNavigationIndex *index;
|
||||
|
||||
notebook = gtk_notebook_new();
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook),
|
||||
GTK_POS_TOP);
|
||||
|
||||
contents = g_new0 (HyperbolaNavigationTree, 1);
|
||||
index = g_new0 (HyperbolaNavigationIndex, 1);
|
||||
|
||||
/*
|
||||
* the index page requires a HyperbolaNavigationTree that
|
||||
* will be displayed on the index_select_page
|
||||
*/
|
||||
index->index_contents = g_new0 (HyperbolaNavigationTree, 1);
|
||||
|
||||
contents_page = make_contents_page(contents);
|
||||
page_label = gtk_label_new("");
|
||||
gtk_label_parse_uline(GTK_LABEL(page_label), _("_Contents"));
|
||||
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), contents_page, page_label);
|
||||
|
||||
|
||||
index->notebook = notebook;
|
||||
|
||||
/*
|
||||
* The index display will need access to the contents page's
|
||||
* ctree and top_ctree as the user is allowed to select documents
|
||||
* here whose indexes will be displayed on the index page
|
||||
*/
|
||||
|
||||
index->contents_ctree = contents->ctree;
|
||||
index->contents_top_ctree = contents->top_ctree;
|
||||
|
||||
index_page = make_index_page(index);
|
||||
page_label = gtk_label_new("");
|
||||
gtk_label_parse_uline(GTK_LABEL(page_label), _("_Index"));
|
||||
|
||||
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), index_page, page_label);
|
||||
g_signal_connect(notebook, "switch_page",
|
||||
G_CALLBACK (hyperbola_navigation_notebook_page_changed), index);
|
||||
gtk_widget_show (notebook);
|
||||
g_signal_connect (index->clist, "select_row",
|
||||
G_CALLBACK (hyperbola_navigation_index_clist_select_row), index);
|
||||
|
||||
view_frame = nautilus_view_new (notebook);
|
||||
|
||||
index->index_view_frame = view_frame;
|
||||
contents->view_frame = view_frame;
|
||||
|
||||
g_signal_connect((nautilus_view_get_bonobo_control(
|
||||
NAUTILUS_VIEW(view_frame))), "activate",
|
||||
G_CALLBACK (merge_items_callback), index);
|
||||
g_signal_connect (contents->view_frame, "load_location",
|
||||
G_CALLBACK (hyperbola_navigation_tree_load_location), contents);
|
||||
|
||||
return BONOBO_OBJECT (view_frame);
|
||||
|
||||
}
|
||||
#else
|
||||
BonoboObject *
|
||||
hyperbola_navigation_tree_new (void)
|
||||
{
|
||||
GtkWidget *wtmp;
|
||||
HyperbolaNavigationTree *view;
|
||||
|
||||
view = g_new0 (HyperbolaNavigationTree, 1);
|
||||
|
||||
view->ctree = gtk_ctree_new (1, 0);
|
||||
gtk_ctree_set_line_style (GTK_CTREE (view->ctree),
|
||||
GTK_CTREE_LINES_NONE);
|
||||
gtk_ctree_set_expander_style (GTK_CTREE (view->ctree),
|
||||
GTK_CTREE_EXPANDER_TRIANGLE);
|
||||
|
||||
gtk_clist_freeze (GTK_CLIST (view->ctree));
|
||||
gtk_clist_set_selection_mode (GTK_CLIST (view->ctree),
|
||||
GTK_SELECTION_BROWSE);
|
||||
g_signal_connect (view->ctree, "tree_select_row",
|
||||
hyperbola_navigation_tree_select_row, view);
|
||||
g_signal_connect (view->ctree, "destroy",
|
||||
hyperbola_navigation_tree_destroy, view);
|
||||
|
||||
|
||||
view->doc_tree = hyperbola_doc_tree_new ();
|
||||
hyperbola_doc_tree_populate (view->doc_tree);
|
||||
|
||||
ctree_populate (view);
|
||||
|
||||
wtmp =
|
||||
gtk_scrolled_window_new (gtk_clist_get_hadjustment
|
||||
(GTK_CLIST (view->ctree)),
|
||||
gtk_clist_get_vadjustment (GTK_CLIST
|
||||
(view->
|
||||
ctree)));
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wtmp),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_widget_show (wtmp);
|
||||
|
||||
gtk_widget_show (view->ctree);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (wtmp), view->ctree);
|
||||
|
||||
gtk_clist_set_column_auto_resize (GTK_CLIST (view->ctree),
|
||||
0 /* column */,
|
||||
TRUE /* auto_resize */);
|
||||
gtk_clist_thaw (GTK_CLIST (view->ctree));
|
||||
|
||||
view->view_frame = nautilus_view_new (wtmp);
|
||||
|
||||
g_signal_connect (view->view_frame, "load_location",
|
||||
hyperbola_navigation_tree_load_location, view);
|
||||
|
||||
return BONOBO_OBJECT (view->view_frame);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
void
|
||||
#else
|
||||
static void
|
||||
#endif
|
||||
set_pending_location (HyperbolaNavigationTree * view, const char *location)
|
||||
{
|
||||
g_free (view->pending_location);
|
||||
view->pending_location = g_strdup (location);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
hyperbola_navigation_tree_load_location (NautilusView * view_frame,
|
||||
const char *location_uri,
|
||||
HyperbolaNavigationTree * hview)
|
||||
{
|
||||
HyperbolaTreeNode *tnode;
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
HyperbolaDocTree *doc_tree1, *doc_tree2;
|
||||
GtkWidget *ctree1, *ctree2;
|
||||
|
||||
if (hview->select) /* if we come here because of a mouse select then get out */
|
||||
{
|
||||
hview->select = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
set_pending_location (hview, NULL);
|
||||
|
||||
if (hview->notify_count > 0)
|
||||
return;
|
||||
|
||||
hview->notify_count++;
|
||||
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
if (hview->selected_ctree == NULL) {
|
||||
ctree1 = hview->top_ctree;
|
||||
ctree2 = hview->ctree;
|
||||
doc_tree1 = hview->top_doc_tree;
|
||||
doc_tree2 = hview->doc_tree;
|
||||
}
|
||||
else {
|
||||
ctree1 = hview->selected_ctree;
|
||||
|
||||
if (ctree1 == hview->top_ctree) {
|
||||
ctree2 = hview->ctree;
|
||||
doc_tree1 = hview->top_doc_tree;
|
||||
doc_tree2 = hview->doc_tree;
|
||||
}
|
||||
else {
|
||||
ctree2 = hview->top_ctree;
|
||||
doc_tree2 = hview->top_doc_tree;
|
||||
doc_tree1 = hview->doc_tree;
|
||||
}
|
||||
}
|
||||
|
||||
if (hview->selected_ctree != NULL &&
|
||||
hview->selected_node != NULL)
|
||||
gtk_ctree_unselect(GTK_CTREE (hview->selected_ctree), hview->selected_node);
|
||||
|
||||
tnode =
|
||||
g_hash_table_lookup (doc_tree1->global_by_uri,
|
||||
location_uri);
|
||||
if (tnode != NULL) {
|
||||
gtk_ctree_select (GTK_CTREE (ctree1), tnode->user_data);
|
||||
hview->selected_ctree = ctree1;
|
||||
hview->selected_node = tnode->user_data;
|
||||
}
|
||||
else {
|
||||
tnode =
|
||||
g_hash_table_lookup (doc_tree2->global_by_uri,
|
||||
location_uri);
|
||||
if (tnode != NULL) {
|
||||
gtk_ctree_select (GTK_CTREE (ctree2), tnode->user_data);
|
||||
hview->selected_ctree = ctree2;
|
||||
hview->selected_node = tnode->user_data;
|
||||
}
|
||||
else {
|
||||
hview->selected_ctree = NULL;
|
||||
hview->selected_node = NULL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
tnode =
|
||||
g_hash_table_lookup (hview->doc_tree->global_by_uri,
|
||||
location_uri);
|
||||
|
||||
if (tnode != NULL)
|
||||
gtk_ctree_select (GTK_CTREE (hview->ctree), tnode->user_data);
|
||||
|
||||
#endif
|
||||
hview->notify_count--;
|
||||
}
|
||||
#ifndef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
static void
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
hyperbola_navigation_tree_select_row (GtkCTree * ctree, GtkCTreeNode * node,
|
||||
gint column,
|
||||
HyperbolaNavigationTree * view)
|
||||
{
|
||||
HyperbolaTreeNode *tnode;
|
||||
|
||||
if (view->notify_count > 0)
|
||||
return;
|
||||
|
||||
tnode = gtk_ctree_node_get_row_data (ctree, node);
|
||||
|
||||
if (!tnode || !tnode->uri)
|
||||
return;
|
||||
|
||||
/* Don't start another load of the location you just started a load on. This
|
||||
* could happen on double-click and causes trouble in the Nautilus window/view
|
||||
* state machine. See bug 5197.
|
||||
*/
|
||||
if (view->pending_location != NULL &&
|
||||
strcmp (view->pending_location, tnode->uri) == 0)
|
||||
return;
|
||||
|
||||
view->notify_count++;
|
||||
|
||||
set_pending_location (view, tnode->uri);
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
if (view->selected_ctree != NULL &&
|
||||
view->selected_node != NULL)
|
||||
gtk_ctree_unselect(GTK_CTREE (view->selected_ctree), view->selected_node);
|
||||
view->selected_ctree = GTK_WIDGET (ctree);
|
||||
view->selected_node = node;
|
||||
view->select = 1;
|
||||
#endif
|
||||
nautilus_view_open_location_in_this_window (view->view_frame,
|
||||
tnode->uri);
|
||||
|
||||
view->notify_count--;
|
||||
}
|
||||
|
||||
static void
|
||||
pixmap_unref_and_null (GdkPixmap **pixmap)
|
||||
{
|
||||
if (*pixmap != NULL) {
|
||||
gdk_pixmap_unref (*pixmap);
|
||||
*pixmap = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bitmap_unref_and_null (GdkPixmap **bitmap)
|
||||
{
|
||||
if (*bitmap != NULL) {
|
||||
gdk_bitmap_unref (*bitmap);
|
||||
*bitmap = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
hyperbola_navigation_tree_destroy (GtkCTree * ctree,
|
||||
HyperbolaNavigationTree * view)
|
||||
{
|
||||
set_pending_location (view, NULL);
|
||||
|
||||
pixmap_unref_and_null (&view->folder_open_pixmap);
|
||||
bitmap_unref_and_null (&view->folder_open_mask);
|
||||
pixmap_unref_and_null (&view->folder_closed_pixmap);
|
||||
bitmap_unref_and_null (&view->folder_closed_mask);
|
||||
|
||||
pixmap_unref_and_null (&view->book_open_pixmap);
|
||||
bitmap_unref_and_null (&view->book_open_mask);
|
||||
pixmap_unref_and_null (&view->book_closed_pixmap);
|
||||
bitmap_unref_and_null (&view->book_closed_mask);
|
||||
|
||||
pixmap_unref_and_null (&view->section_open_pixmap);
|
||||
bitmap_unref_and_null (&view->section_open_mask);
|
||||
pixmap_unref_and_null (&view->section_closed_pixmap);
|
||||
bitmap_unref_and_null (&view->section_closed_mask);
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
#ifndef HYPERBOLA_NAV_H
|
||||
#define HYPERBOLA_NAV_H 1
|
||||
|
||||
#include "hyperbola-types.h"
|
||||
|
||||
|
||||
/* In hyperbola-nav-tree.c */
|
||||
BonoboObject *hyperbola_navigation_tree_new (void);
|
||||
/* in hyperbola-nav-index.c */
|
||||
BonoboObject *hyperbola_navigation_index_new( void );
|
||||
/* in hyperbola-nav-search.c */
|
||||
BonoboObject *hyperbola_navigation_search_new (void);
|
||||
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
GtkWidget *make_index_page(HyperbolaNavigationIndex *index);
|
||||
void hyperbola_navigation_index_clist_select_row (GtkWidget * clist, gint row,
|
||||
gint column, GdkEvent * event,
|
||||
HyperbolaNavigationIndex * hni);
|
||||
void hyperbola_navigation_notebook_page_changed (GtkNotebook *notebook,
|
||||
GtkNotebookPage *page,
|
||||
gint page_num,
|
||||
HyperbolaNavigationIndex *index);
|
||||
void hyperbola_navigation_tree_destroy (GtkCTree * ctree,
|
||||
HyperbolaNavigationTree *view);
|
||||
void hyperbola_navigation_tree_select_row ( GtkCTree * ctree,
|
||||
GtkCTreeNode * node,
|
||||
gint column,
|
||||
HyperbolaNavigationTree *view);
|
||||
|
||||
void
|
||||
get_node_icons (HyperbolaNavigationTree *view,
|
||||
HyperbolaTreeNode *node,
|
||||
GdkPixmap **pixmap_closed,
|
||||
GdkBitmap **mask_closed,
|
||||
GdkPixmap **pixmap_opened,
|
||||
GdkBitmap **mask_opened);
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,183 +0,0 @@
|
|||
#ifndef HYPERBOLA_TYPES_H
|
||||
#define HYPERBOLA_TYPES_H 1
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtkctree.h>
|
||||
#include <gtk/gtknotebook.h>
|
||||
#include <libgnome/gnome-i18n.h>
|
||||
#include <libgnomeui/gnome-uidefs.h>
|
||||
#include <libnautilus-private/nautilus-theme.h>
|
||||
#include <libnautilus/libnautilus.h>
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
/* 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;
|
||||
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
/*
|
||||
* HyperbolaIndexSelection is used to flag the type of index to be built, ie from:
|
||||
* all files; index files selected from the index page's contents tree; or
|
||||
* index files selected from the contents page's contents tree.
|
||||
*/
|
||||
typedef enum {
|
||||
ALL_INDEX_FILES,
|
||||
INDEX_SELECTED_INDEX_FILES,
|
||||
CONTENTS_SELECTED_INDEX_FILES
|
||||
} HyperbolaIndexSelection;
|
||||
|
||||
typedef enum {
|
||||
CONTENTS_PAGE,
|
||||
INDEX_DISPLAY_PAGE,
|
||||
INDEX_SELECT_PAGE
|
||||
}HyperbolaPageType;
|
||||
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
GHashTable *all_index_files; /* Stores all index files, key is doc uri */
|
||||
|
||||
gboolean contents_tree_type; /* If true, then it is a contents tree
|
||||
* for the contents page, if false, then
|
||||
* it is a contents tree for the index page
|
||||
*/
|
||||
#endif
|
||||
gpointer user_data;
|
||||
} HyperbolaDocTree;
|
||||
|
||||
#ifdef ENABLE_SCROLLKEEPER_SUPPORT
|
||||
/*
|
||||
* if scrollkeeper support not enabled then the equivalents of
|
||||
* these structs (plus/minus some members) are defined in
|
||||
* hyperbola-nav-tree.c and hyperbola-nav-index.c
|
||||
*/
|
||||
typedef struct {
|
||||
NautilusView *view_frame;
|
||||
GtkWidget *contents_widget;
|
||||
GtkWidget *ctree;
|
||||
HyperbolaDocTree *doc_tree;
|
||||
GtkWidget *top_ctree;
|
||||
HyperbolaDocTree *top_doc_tree;
|
||||
GtkWidget *selected_ctree;
|
||||
GtkCTreeNode *selected_node;
|
||||
int select;
|
||||
char *pending_location;
|
||||
|
||||
gint notify_count;
|
||||
|
||||
GdkPixmap *folder_open_pixmap;
|
||||
GdkBitmap *folder_open_mask;
|
||||
GdkPixmap *folder_closed_pixmap;
|
||||
GdkBitmap *folder_closed_mask;
|
||||
|
||||
GdkPixmap *book_open_pixmap;
|
||||
GdkBitmap *book_open_mask;
|
||||
GdkPixmap *book_closed_pixmap;
|
||||
GdkBitmap *book_closed_mask;
|
||||
|
||||
GdkPixmap *section_open_pixmap;
|
||||
GdkBitmap *section_open_mask;
|
||||
GdkPixmap *section_closed_pixmap;
|
||||
GdkBitmap *section_closed_mask;
|
||||
} HyperbolaNavigationTree;
|
||||
|
||||
typedef struct {
|
||||
NautilusView *index_view_frame;
|
||||
|
||||
HyperbolaNavigationTree *index_contents;
|
||||
|
||||
GtkWidget *notebook;
|
||||
|
||||
GtkWidget *index_display_page;
|
||||
|
||||
GtkWidget *contents_rbutton;
|
||||
GtkWidget *specific_rbutton;
|
||||
GtkWidget *all_rbutton;
|
||||
GtkWidget *all_terms_rbutton;
|
||||
GtkWidget *specific_terms_rbutton;
|
||||
GtkWidget *show_button;
|
||||
GtkWidget *wtmp;
|
||||
|
||||
GtkWidget *index_select_page;
|
||||
/* the index page will need pointers to the contents page's
|
||||
* top_ctree and ctree
|
||||
*/
|
||||
GtkWidget *all_button;
|
||||
GtkWidget *none_button;
|
||||
GtkWidget *index_select_win;
|
||||
|
||||
GtkWidget *contents_ctree;
|
||||
|
||||
GtkWidget *contents_top_ctree;
|
||||
|
||||
GtkWidget *clist, *all_index_terms_clist, *ent;
|
||||
|
||||
GTree *current_index_items;
|
||||
|
||||
GTree *all_index_items;
|
||||
|
||||
GTree *index_selected_index_items;
|
||||
|
||||
GTree *contents_selected_index_items;
|
||||
|
||||
GHashTable *index_selected_index_files;
|
||||
|
||||
GHashTable *contents_selected_index_files;
|
||||
|
||||
HyperbolaIndexSelection index_type;
|
||||
|
||||
gboolean index_terms_found; /* if true, index entry found for clist */
|
||||
|
||||
gboolean show_all_terms; /* If true then show all index terms, if false then
|
||||
* show only selected index terms.
|
||||
*/
|
||||
HyperbolaPageType page_type;
|
||||
|
||||
gint8 notify_count;
|
||||
|
||||
} HyperbolaNavigationIndex;
|
||||
|
||||
typedef struct {
|
||||
HyperbolaNavigationTree *view;
|
||||
GtkWidget *ctree;
|
||||
GtkCTreeNode *sibling, *parent;
|
||||
} PopulateInfo;
|
||||
typedef struct {
|
||||
HyperbolaNavigationIndex *hni;
|
||||
GtkCTreeNode *sibling, *parent;
|
||||
} IndexPopulateInfo;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,32 +0,0 @@
|
|||
<Root>
|
||||
<keybindings>
|
||||
<accel name="*Alt*c" verb="Switch Contents"/>
|
||||
<accel name="*Alt*i" verb="Switch Index"/>
|
||||
|
||||
<accel name="*Alt*t" verb="Contents Tab"/>
|
||||
<accel name="*Alt*a" verb="All"/>
|
||||
<accel name="*Alt*s" verb="Specific"/>
|
||||
|
||||
<accel name="*Alt*h" verb="Show All Terms"/>
|
||||
<accel name="*Alt*o" verb="Show Specific Terms"/>
|
||||
|
||||
<accel name="*Alt*w" verb="Show"/>
|
||||
<accel name="*Alt*x" verb="Index"/>
|
||||
<accel name="*Alt*d" verb="Select"/>
|
||||
<accel name="*Alt*l" verb="Select All"/>
|
||||
<accel name="*Alt*n" verb="Select None"/>
|
||||
</keybindings>
|
||||
<menu>
|
||||
<submenu name="File">
|
||||
<placeholder name="Global">
|
||||
<menuitem name="Contents"
|
||||
_label="Contents Selected"
|
||||
accel="*Control*n"
|
||||
verb="Contents"/>
|
||||
<menuitem name="All"
|
||||
_label="All Selected"
|
||||
verb="All"/>
|
||||
</placeholder>
|
||||
</submenu>
|
||||
</menu>
|
||||
</Root>
|
|
@ -1,23 +0,0 @@
|
|||
# svgalib
|
||||
3 vga_.* Manual/Development/APIs/svgalib
|
||||
# ncurses
|
||||
3 curs_.* Manual/Development/APIs/ncurses
|
||||
3 define_key Manual/Development/APIs/ncurses
|
||||
3 dft_fgbg Manual/Development/APIs/ncurses
|
||||
3 form Manual/Development/APIs/ncurses
|
||||
3 form_.* Manual/Development/APIs/ncurses
|
||||
3 keyok Manual/Development/APIs/ncurses
|
||||
3 menu Manual/Development/APIs/ncurses
|
||||
3 menu_.* Manual/Development/APIs/ncurses
|
||||
3 mitem_.* Manual/Development/APIs/ncurses
|
||||
3 ncurses Manual/Development/APIs/ncurses
|
||||
3 panel Manual/Development/APIs/ncurses
|
||||
3 resizeterm Manual/Development/APIs/ncurses
|
||||
3 wresize Manual/Development/APIs/ncurses
|
||||
3 pthread_.* Manual/Development/APIs/pthread
|
||||
3 TIFF.* Manual/Development/APIs/libtiff
|
||||
3 Gtk_.* Manual/Development/APIs/gtk--
|
||||
3 GtkBase.* Manual/Development/APIs/gtk--
|
||||
3 G_.* Manual/Development/APIs/gtk--
|
||||
3 _gtk_string Manual/Development/APIs/gtk--
|
||||
3 gtkmm_add_signal_class Manual/Development/APIs/gtk--
|
|
@ -1,131 +0,0 @@
|
|||
#include <libgnomevfs/gnome-vfs.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
#define STRING_OR_NULL(x) (NULL == x ? "NULL" : x)
|
||||
|
||||
guint gl_tests_failed = 0;
|
||||
|
||||
static void
|
||||
test_failed (const char *uri, const char *expected, const char *got)
|
||||
{
|
||||
printf ("Test failed: '%s' expected '%s' got '%s'\n",
|
||||
STRING_OR_NULL(uri), STRING_OR_NULL(expected), STRING_OR_NULL(got));
|
||||
|
||||
gl_tests_failed++;
|
||||
}
|
||||
|
||||
static int
|
||||
strcmp_tolerate_nulls (const char *s1, const char *s2)
|
||||
{
|
||||
if (s1 == NULL && s2 == NULL) {
|
||||
return 0;
|
||||
} else if (s1 == NULL) {
|
||||
return -1;
|
||||
} else if (s2 == NULL) {
|
||||
return 1;
|
||||
} else {
|
||||
return strcmp (s1, s2);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_uri_transform (const char *orig, const char *expected)
|
||||
{
|
||||
GnomeVFSURI *uri;
|
||||
char *result;
|
||||
|
||||
uri = gnome_vfs_uri_new (orig);
|
||||
|
||||
if (uri) {
|
||||
result = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
|
||||
if (0 != strcmp_tolerate_nulls (expected, result)) {
|
||||
test_failed (orig, expected, result);
|
||||
}
|
||||
} else if (expected != NULL) {
|
||||
test_failed (orig, expected, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
|
||||
gnome_vfs_init ();
|
||||
|
||||
/* These test cases are bad as they assume an eazel-hacking
|
||||
* install with the docs in /gnome.
|
||||
*
|
||||
* Note that I had HTML control-center documentation
|
||||
* and SGML nautilus documentation when running the tests below
|
||||
*/
|
||||
test_uri_transform (
|
||||
"gnome-help:control-center",
|
||||
"file:///gnome/share/gnome/help/control-center/C/index.html");
|
||||
|
||||
test_uri_transform (
|
||||
"gnome-help:/gnome/share/gnome/help/control-center/C/index.html",
|
||||
"file:///gnome/share/gnome/help/control-center/C/index.html");
|
||||
|
||||
test_uri_transform (
|
||||
"gnome-help:/gnome/share/gnome/help/control-center/C/index",
|
||||
NULL);
|
||||
|
||||
test_uri_transform (
|
||||
"ghelp:control-center",
|
||||
"file:///gnome/share/gnome/help/control-center/C/index.html");
|
||||
|
||||
test_uri_transform (
|
||||
"help:control-center",
|
||||
"file:///gnome/share/gnome/help/control-center/C/index.html");
|
||||
|
||||
test_uri_transform (
|
||||
"gnome-help:control-center#foo",
|
||||
"file:///gnome/share/gnome/help/control-center/C/index.html#foo");
|
||||
|
||||
test_uri_transform (
|
||||
"ghelp:nautilus",
|
||||
"pipe:gnome-db2html2%20'%2Fgnome%2Fshare%2Fgnome%2Fhelp%2Fnautilus%2FC%2Fnautilus.sgml'%3Bmime-type%3Dtext%2Fhtml");
|
||||
|
||||
test_uri_transform (
|
||||
"ghelp:nautilus#fragment",
|
||||
"pipe:gnome-db2html2%20'%2Fgnome%2Fshare%2Fgnome%2Fhelp%2Fnautilus%2FC%2Fnautilus.sgml%3Ffragment'%3Bmime-type%3Dtext%2Fhtml");
|
||||
|
||||
test_uri_transform (
|
||||
"ghelp:///gnome/share/gnome/help/nautilus/C/nautilus.sgml",
|
||||
"pipe:gnome-db2html2%20'%2F%2F%2Fgnome%2Fshare%2Fgnome%2Fhelp%2Fnautilus%2FC%2Fnautilus.sgml'%3Bmime-type%3Dtext%2Fhtml");
|
||||
|
||||
test_uri_transform (
|
||||
"ghelp:/gnome/share/gnome/help/nautilus/C/nautilus.sgml",
|
||||
"pipe:gnome-db2html2%20'%2Fgnome%2Fshare%2Fgnome%2Fhelp%2Fnautilus%2FC%2Fnautilus.sgml'%3Bmime-type%3Dtext%2Fhtml");
|
||||
|
||||
test_uri_transform (
|
||||
"ghelp:/gnome/share/gnome/help/nautilus/C/krak/index.html",
|
||||
NULL);
|
||||
|
||||
test_uri_transform (
|
||||
"ghelp:/gnome/share/gnome/help/nautilus/C/index.html",
|
||||
"pipe:gnome-db2html2%20'%2Fgnome%2Fshare%2Fgnome%2Fhelp%2Fnautilus%2FC%2Fnautilus.sgml'%3Bmime-type%3Dtext%2Fhtml");
|
||||
|
||||
test_uri_transform (
|
||||
"ghelp:/gnome/share/gnome/help/nautilus/C/index.html#fragment",
|
||||
"pipe:gnome-db2html2%20'%2Fgnome%2Fshare%2Fgnome%2Fhelp%2Fnautilus%2FC%2Fnautilus.sgml%3Ffragment'%3Bmime-type%3Dtext%2Fhtml");
|
||||
|
||||
test_uri_transform (
|
||||
"ghelp:/gnome/share/gnome/help/nautilus/C/stuff.html",
|
||||
"pipe:gnome-db2html2%20'%2Fgnome%2Fshare%2Fgnome%2Fhelp%2Fnautilus%2FC%2Fnautilus.sgml%3Fstuff'%3Bmime-type%3Dtext%2Fhtml");
|
||||
|
||||
test_uri_transform (
|
||||
"ghelp:/gnome/share/gnome/help/nautilus/C/stuff.html#fragment",
|
||||
"pipe:gnome-db2html2%20'%2Fgnome%2Fshare%2Fgnome%2Fhelp%2Fnautilus%2FC%2Fnautilus.sgml%3Ffragment'%3Bmime-type%3Dtext%2Fhtml");
|
||||
|
||||
if (gl_tests_failed == 0) {
|
||||
exit (0);
|
||||
} else {
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load diff
34
configure.in
34
configure.in
|
@ -25,7 +25,6 @@ MEDUSA_REQUIRED=0.5.1
|
|||
ORBIT_REQUIRED=2.3.97
|
||||
POPT_REQUIRED=1.5
|
||||
RSVG_REQUIRED=1.1
|
||||
SCROLLKEEPER_REQUIRED=0.1.4
|
||||
XML_REQUIRED=2.4.6
|
||||
|
||||
AC_SUBST(EEL_REQUIRED)
|
||||
|
@ -36,7 +35,6 @@ AC_SUBST(MEDUSA_REQUIRED)
|
|||
AC_SUBST(ORBIT_REQUIRED)
|
||||
AC_SUBST(POPT_REQUIRED)
|
||||
AC_SUBST(RSVG_REQUIRED)
|
||||
AC_SUBST(SCROLLKEEPER_REQUIRED)
|
||||
AC_SUBST(XML_REQUIRED)
|
||||
|
||||
dnl ===========================================================================
|
||||
|
@ -183,15 +181,6 @@ AC_CHECK_HEADERS(cdda_interface.h cdda_paranoia.h, [
|
|||
|
||||
dnl ==========================================================================
|
||||
|
||||
dnl scrollkeeper
|
||||
|
||||
AC_PATH_PROG(SCROLLKEEPER_CONFIG, scrollkeeper-config,no)
|
||||
if test x$SCROLLKEEPER_CONFIG = xno; then
|
||||
AC_MSG_ERROR(Couldn't find scrollkeeper-config, please install the scrollkeeper packaga)
|
||||
fi
|
||||
|
||||
dnl ==========================================================================
|
||||
|
||||
dnl jw (for doc build)
|
||||
|
||||
AC_PATH_PROG(JW,jw,no)
|
||||
|
@ -205,25 +194,13 @@ AC_SUBST(HAVE_JW)
|
|||
|
||||
dnl ==========================================================================
|
||||
|
||||
dnl medusa checking (this is the Gnome 1 version -- change to pkg-config)
|
||||
|
||||
AC_MSG_CHECKING(for Medusa)
|
||||
|
||||
case "`medusa-config --libs 2>/dev/null | cut -d ' ' -f1`" in
|
||||
'')
|
||||
MEDUSA_CFLAGS=""
|
||||
MEDUSA_LIBS=""
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
|
||||
*)
|
||||
MEDUSA_CFLAGS=`medusa-config --cflags`
|
||||
MEDUSA_LIBS=`medusa-config --libs`
|
||||
AC_DEFINE(HAVE_MEDUSA)
|
||||
AC_MSG_RESULT(yes)
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(MEDUSA_CFLAGS)
|
||||
AC_SUBST(MEDUSA_LIBS)
|
||||
PKG_CHECK_MODULES(MEDUSA, medusa-2.0 >= $MEDUSA_REQUIRED, have_medusa=yes, have_medusa=no)
|
||||
AM_CONDITIONAL(HAVE_MEDUSA, test x$have_medusa = xyes)
|
||||
AC_SUBST(HAVE_MEDUSA)
|
||||
|
||||
dnl ==========================================================================
|
||||
|
||||
|
@ -362,7 +339,6 @@ components/Makefile
|
|||
components/adapter/Makefile
|
||||
components/hardware/Makefile
|
||||
components/hardware/icons/Makefile
|
||||
components/help/Makefile
|
||||
components/history/Makefile
|
||||
components/image-viewer/Makefile
|
||||
components/loser/Makefile
|
||||
|
|
|
@ -25,37 +25,39 @@
|
|||
#include <config.h>
|
||||
#include "nautilus-icon-canvas-item.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
#include "nautilus-file-utilities.h"
|
||||
#include "nautilus-global-preferences.h"
|
||||
#include "nautilus-icon-factory.h"
|
||||
#include "nautilus-icon-private.h"
|
||||
#include "nautilus-theme.h"
|
||||
#include <eel/eel-art-extensions.h>
|
||||
#include <eel/eel-gdk-extensions.h>
|
||||
#include <eel/eel-gdk-font-extensions.h>
|
||||
#include <eel/eel-gdk-pixbuf-extensions.h>
|
||||
#include <eel/eel-glib-extensions.h>
|
||||
#include <eel/eel-gnome-extensions.h>
|
||||
#include <eel/eel-graphic-effects.h>
|
||||
#include <eel/eel-gtk-macros.h>
|
||||
#include <eel/eel-string.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <libgnome/gnome-i18n.h>
|
||||
#include <libgnomecanvas/gnome-canvas-util.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
#include <libart_lgpl/art_rgb.h>
|
||||
#include <libart_lgpl/art_rgb_affine.h>
|
||||
#include <libart_lgpl/art_rgb_rgba_affine.h>
|
||||
#include <libart_lgpl/art_svp_vpath.h>
|
||||
#include "nautilus-icon-private.h"
|
||||
#include <eel/eel-string.h>
|
||||
#include <eel/eel-art-extensions.h>
|
||||
#include <eel/eel-glib-extensions.h>
|
||||
#include <eel/eel-gdk-extensions.h>
|
||||
#include <eel/eel-gdk-font-extensions.h>
|
||||
#include <eel/eel-gdk-pixbuf-extensions.h>
|
||||
#include "nautilus-global-preferences.h"
|
||||
#include <eel/eel-gtk-macros.h>
|
||||
#include <eel/eel-gnome-extensions.h>
|
||||
#include <eel/eel-graphic-effects.h>
|
||||
#include "nautilus-file-utilities.h"
|
||||
#include "nautilus-icon-factory.h"
|
||||
#include "nautilus-theme.h"
|
||||
#include <eel/eel-smooth-text-layout.h>
|
||||
#include <eel/eel-smooth-text-layout-cache.h>
|
||||
#include <libgnome/gnome-i18n.h>
|
||||
#include <libgnomecanvas/gnome-canvas-util.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define USE_EEL_TEXT
|
||||
|
||||
#ifdef USE_EEL_TEXT
|
||||
#include <eel/eel-smooth-text-layout-cache.h>
|
||||
#include <eel/eel-smooth-text-layout.h>
|
||||
#endif
|
||||
|
||||
/* Comment this out if the new smooth fonts code give you problems
|
||||
* This isnt meant to be permanent. Its just a precaution.
|
||||
*/
|
||||
#define EMBLEM_SPACING 2
|
||||
|
||||
/* gap between bottom of icon and start of text box */
|
||||
|
@ -101,9 +103,11 @@ struct NautilusIconCanvasItemDetails {
|
|||
|
||||
gboolean is_renaming;
|
||||
|
||||
#ifdef USE_EEL_TEXT
|
||||
/* Font stuff whilst in smooth mode */
|
||||
int smooth_font_size;
|
||||
EelScalableFont *smooth_font;
|
||||
#endif
|
||||
|
||||
/* Cached rectangle in canvas coordinates */
|
||||
ArtIRect canvas_rect;
|
||||
|
@ -121,8 +125,10 @@ enum {
|
|||
ARG_HIGHLIGHTED_AS_KEYBOARD_FOCUS,
|
||||
ARG_HIGHLIGHTED_FOR_DROP,
|
||||
ARG_MODIFIER,
|
||||
#ifdef USE_EEL_TEXT
|
||||
ARG_SMOOTH_FONT_SIZE,
|
||||
ARG_SMOOTH_FONT
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
@ -192,6 +198,8 @@ EEL_CLASS_BOILERPLATE (NautilusIconCanvasItem,
|
|||
nautilus_icon_canvas_item,
|
||||
GNOME_TYPE_CANVAS_ITEM)
|
||||
|
||||
#ifdef USE_EEL_TEXT
|
||||
|
||||
static EelSmoothTextLayoutCache *layout_cache;
|
||||
|
||||
static void
|
||||
|
@ -200,6 +208,8 @@ free_layout_cache (void)
|
|||
g_object_unref (layout_cache);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Object initialization function for the icon item. */
|
||||
static void
|
||||
nautilus_icon_canvas_item_init (NautilusIconCanvasItem *icon_item)
|
||||
|
@ -215,9 +225,11 @@ nautilus_icon_canvas_item_init (NautilusIconCanvasItem *icon_item)
|
|||
/* invalidate cached text dimensions initially */
|
||||
nautilus_icon_canvas_item_invalidate_label_size (icon_item);
|
||||
|
||||
#ifdef USE_EEL_TEXT
|
||||
/* set up the default font and size */
|
||||
icon_item->details->smooth_font_size = 12;
|
||||
icon_item->details->smooth_font = eel_scalable_font_get_default_font ();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -241,7 +253,9 @@ nautilus_icon_canvas_item_finalize (GObject *object)
|
|||
gdk_font_unref (details->font);
|
||||
}
|
||||
|
||||
#ifdef USE_EEL_TEXT
|
||||
g_object_unref (details->smooth_font);
|
||||
#endif
|
||||
|
||||
if (details->rendered_pixbuf != NULL) {
|
||||
g_object_unref (details->rendered_pixbuf);
|
||||
|
@ -348,6 +362,7 @@ nautilus_icon_canvas_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
|||
details->is_highlighted_for_drop = GTK_VALUE_BOOL (*arg);
|
||||
break;
|
||||
|
||||
#ifdef USE_EEL_TEXT
|
||||
case ARG_SMOOTH_FONT:
|
||||
nautilus_icon_canvas_item_set_smooth_font (NAUTILUS_ICON_CANVAS_ITEM (object),
|
||||
EEL_SCALABLE_FONT (GTK_VALUE_OBJECT (*arg)));
|
||||
|
@ -358,6 +373,7 @@ nautilus_icon_canvas_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
|||
nautilus_icon_canvas_item_set_smooth_font_size (NAUTILUS_ICON_CANVAS_ITEM (object),
|
||||
GTK_VALUE_INT (*arg));
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
g_warning ("nautilus_icons_view_item_item_set_arg on unknown argument");
|
||||
|
@ -401,6 +417,7 @@ nautilus_icon_canvas_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
|||
GTK_VALUE_BOOL (*arg) = details->is_highlighted_for_drop;
|
||||
break;
|
||||
|
||||
#ifdef USE_EEL_TEXT
|
||||
case ARG_SMOOTH_FONT:
|
||||
g_object_ref (details->smooth_font);
|
||||
GTK_VALUE_OBJECT (*arg) = GTK_OBJECT (details->smooth_font);
|
||||
|
@ -409,6 +426,7 @@ nautilus_icon_canvas_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
|
|||
case ARG_SMOOTH_FONT_SIZE:
|
||||
GTK_VALUE_INT (*arg) = details->smooth_font_size;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
arg->type = G_TYPE_INVALID;
|
||||
|
@ -1313,13 +1331,21 @@ draw_or_measure_label_text_aa (NautilusIconCanvasItem *item,
|
|||
int icon_bottom)
|
||||
{
|
||||
NautilusIconCanvasItemDetails *details;
|
||||
guint width_so_far, height_so_far;
|
||||
int width_so_far, height_so_far;
|
||||
guint32 label_name_color;
|
||||
guint32 label_info_color;
|
||||
GnomeCanvasItem *canvas_item;
|
||||
int max_text_width;
|
||||
int icon_width, text_left, box_left;
|
||||
#ifdef USE_EEL_TEXT
|
||||
EelSmoothTextLayout *smooth_text_layout;
|
||||
#else
|
||||
PangoContext *context;
|
||||
PangoLayout *layout;
|
||||
int layout_width, layout_height;
|
||||
PangoAttrList *attr_list;
|
||||
PangoAttribute *attr;
|
||||
#endif
|
||||
char **pieces;
|
||||
const char *text_piece;
|
||||
int i;
|
||||
|
@ -1411,6 +1437,7 @@ draw_or_measure_label_text_aa (NautilusIconCanvasItem *item,
|
|||
text_piece = " ";
|
||||
}
|
||||
|
||||
#ifdef USE_EEL_TEXT
|
||||
smooth_text_layout = eel_smooth_text_layout_cache_render (layout_cache,
|
||||
text_piece,
|
||||
strlen (text_piece),
|
||||
|
@ -1418,16 +1445,45 @@ draw_or_measure_label_text_aa (NautilusIconCanvasItem *item,
|
|||
details->smooth_font_size,
|
||||
TRUE, LABEL_LINE_SPACING,
|
||||
max_text_width);
|
||||
|
||||
#else
|
||||
context = eel_gnome_canvas_get_pango_context (canvas_item->canvas);
|
||||
|
||||
layout = pango_layout_new (context);
|
||||
pango_layout_set_text (layout, text_piece, -1);
|
||||
pango_layout_set_width (layout, max_text_width * PANGO_SCALE);
|
||||
#if GNOME2_CONVERSION_COMPLETE
|
||||
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
|
||||
#endif
|
||||
pango_layout_set_spacing (layout, LABEL_LINE_SPACING);
|
||||
|
||||
pango_layout_get_pixel_size (layout, &layout_width, &layout_height);
|
||||
#endif
|
||||
|
||||
/* Draw text if we are not in user rename mode */
|
||||
if (destination_pixbuf != NULL && !details->is_renaming) {
|
||||
gboolean underlined;
|
||||
ArtIRect destination_area;
|
||||
|
||||
#ifdef USE_EEL_TEXT
|
||||
gboolean underlined;
|
||||
|
||||
text_left = icon_left + (icon_width - eel_smooth_text_layout_get_width (smooth_text_layout)) / 2;
|
||||
|
||||
/* if it's prelit, and we're in click-to-activate mode, underline the text */
|
||||
underlined = (details->is_prelit && in_single_click_mode ());
|
||||
underlined = details->is_prelit && in_single_click_mode ();
|
||||
#else
|
||||
text_left = icon_left + (icon_width - layout_width) / 2;
|
||||
|
||||
/* if it's prelit, and we're in click-to-activate mode, underline the text */
|
||||
if (details->is_prelit && in_single_click_mode ()) {
|
||||
attr_list = pango_attr_list_new ();
|
||||
attr = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
|
||||
attr->start_index = 0;
|
||||
attr->end_index = strlen (text_piece);
|
||||
pango_attr_list_insert (attr_list, attr);
|
||||
pango_layout_set_attributes (layout, attr_list);
|
||||
pango_attr_list_unref (attr_list);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* draw the shadow in black */
|
||||
if (needs_highlight) {
|
||||
|
@ -1436,6 +1492,7 @@ draw_or_measure_label_text_aa (NautilusIconCanvasItem *item,
|
|||
|
||||
destination_area.x0 = text_left + 2;
|
||||
destination_area.y0 = icon_bottom + height_so_far + 1;
|
||||
#ifdef USE_EEL_TEXT
|
||||
destination_area.x1 = destination_area.x0 + eel_smooth_text_layout_get_width (smooth_text_layout);
|
||||
destination_area.y1 = destination_area.y0 + eel_smooth_text_layout_get_height (smooth_text_layout);
|
||||
eel_smooth_text_layout_draw_to_pixbuf (smooth_text_layout,
|
||||
|
@ -1447,10 +1504,20 @@ draw_or_measure_label_text_aa (NautilusIconCanvasItem *item,
|
|||
underlined,
|
||||
EEL_RGB_COLOR_BLACK,
|
||||
0xff);
|
||||
#else
|
||||
destination_area.x1 = destination_area.x0 + layout_width;
|
||||
destination_area.y1 = destination_area.y0 + layout_height;
|
||||
eel_draw_layout_to_pixbuf (layout,
|
||||
destination_pixbuf,
|
||||
0, 0,
|
||||
destination_area,
|
||||
EEL_RGB_COLOR_BLACK);
|
||||
#endif
|
||||
}
|
||||
|
||||
destination_area.x0 = text_left;
|
||||
destination_area.y0 = icon_bottom + height_so_far;
|
||||
#ifdef USE_EEL_TEXT
|
||||
destination_area.x1 = destination_area.x0 + eel_smooth_text_layout_get_width (smooth_text_layout);
|
||||
destination_area.y1 = destination_area.y0 + eel_smooth_text_layout_get_height (smooth_text_layout);
|
||||
eel_smooth_text_layout_draw_to_pixbuf (smooth_text_layout,
|
||||
|
@ -1462,11 +1529,21 @@ draw_or_measure_label_text_aa (NautilusIconCanvasItem *item,
|
|||
underlined,
|
||||
label_color,
|
||||
0xff);
|
||||
#else
|
||||
destination_area.x1 = destination_area.x0 + layout_width;
|
||||
destination_area.y1 = destination_area.y0 + layout_height;
|
||||
eel_draw_layout_to_pixbuf (layout,
|
||||
destination_pixbuf,
|
||||
0, 0,
|
||||
destination_area,
|
||||
label_color);
|
||||
#endif
|
||||
|
||||
/* if it's highlighted, embolden by drawing twice */
|
||||
if (needs_highlight) {
|
||||
destination_area.x0 = text_left + 1;
|
||||
destination_area.y0 = icon_bottom + height_so_far;
|
||||
#ifdef USE_EEL_TEXT
|
||||
destination_area.x1 = destination_area.x0 + eel_smooth_text_layout_get_width (smooth_text_layout);
|
||||
destination_area.y1 = destination_area.y0 + eel_smooth_text_layout_get_height (smooth_text_layout);
|
||||
eel_smooth_text_layout_draw_to_pixbuf (smooth_text_layout,
|
||||
|
@ -1478,14 +1555,30 @@ draw_or_measure_label_text_aa (NautilusIconCanvasItem *item,
|
|||
underlined,
|
||||
label_color,
|
||||
0xff);
|
||||
#else
|
||||
destination_area.x1 = destination_area.x0 + layout_width;
|
||||
destination_area.y1 = destination_area.y0 + layout_height;
|
||||
eel_draw_layout_to_pixbuf (layout,
|
||||
destination_pixbuf,
|
||||
0, 0,
|
||||
destination_area,
|
||||
label_color);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
width_so_far = MAX (width_so_far, (guint) eel_smooth_text_layout_get_width (smooth_text_layout));
|
||||
#ifdef USE_EEL_TEXT
|
||||
width_so_far = MAX (width_so_far, eel_smooth_text_layout_get_width (smooth_text_layout));
|
||||
height_so_far += eel_smooth_text_layout_get_height (smooth_text_layout) + LABEL_LINE_SPACING;
|
||||
|
||||
g_object_unref (smooth_text_layout);
|
||||
#else
|
||||
width_so_far = MAX (width_so_far, layout_width);
|
||||
height_so_far += layout_height + LABEL_LINE_SPACING;
|
||||
|
||||
g_object_unref (layout);
|
||||
#endif
|
||||
}
|
||||
g_strfreev (pieces);
|
||||
|
||||
|
@ -1500,8 +1593,8 @@ draw_or_measure_label_text_aa (NautilusIconCanvasItem *item,
|
|||
* differently and change these asserts.
|
||||
*/
|
||||
#if (defined PERFORMANCE_TEST_MEASURE_DISABLE || defined PERFORMANCE_TEST_DRAW_DISABLE)
|
||||
g_assert ((int) height_so_far == details->text_height);
|
||||
g_assert ((int) width_so_far == details->text_width);
|
||||
g_assert (height_so_far == details->text_height);
|
||||
g_assert (width_so_far == details->text_width);
|
||||
#endif
|
||||
|
||||
box_left = icon_left + (icon_width - width_so_far) / 2;
|
||||
|
@ -1573,8 +1666,14 @@ draw_label_text_aa (NautilusIconCanvasItem *icon_item, GnomeCanvasBuf *buf, int
|
|||
&& icon_item->details->additional_text[0] != '\0';
|
||||
|
||||
/* No font or no text, then do no work. */
|
||||
if (icon_item->details->smooth_font == NULL
|
||||
|| (!have_editable && !have_additional)) {
|
||||
#ifdef USE_EEL_TEXT
|
||||
if (icon_item->details->smooth_font == NULL) {
|
||||
icon_item->details->text_height = 0;
|
||||
icon_item->details->text_width = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (!have_editable && !have_additional) {
|
||||
icon_item->details->text_height = 0;
|
||||
icon_item->details->text_width = 0;
|
||||
return;
|
||||
|
@ -2095,6 +2194,8 @@ nautilus_icon_canvas_item_get_max_text_width (NautilusIconCanvasItem *item)
|
|||
|
||||
}
|
||||
|
||||
#ifdef USE_EEL_TEXT
|
||||
|
||||
void
|
||||
nautilus_icon_canvas_item_set_smooth_font (NautilusIconCanvasItem *icon_item,
|
||||
EelScalableFont *font)
|
||||
|
@ -2133,6 +2234,8 @@ nautilus_icon_canvas_item_set_smooth_font_size (NautilusIconCanvasItem *icon_ite
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Class initialization function for the icon canvas item. */
|
||||
static void
|
||||
nautilus_icon_canvas_item_class_init (NautilusIconCanvasItemClass *class)
|
||||
|
@ -2140,10 +2243,12 @@ nautilus_icon_canvas_item_class_init (NautilusIconCanvasItemClass *class)
|
|||
GtkObjectClass *object_class;
|
||||
GnomeCanvasItemClass *item_class;
|
||||
|
||||
#ifdef USE_EEL_TEXT
|
||||
if (layout_cache == NULL) {
|
||||
layout_cache = eel_smooth_text_layout_cache_new ();
|
||||
g_atexit (free_layout_cache);
|
||||
}
|
||||
#endif
|
||||
|
||||
object_class = GTK_OBJECT_CLASS (class);
|
||||
item_class = GNOME_CANVAS_ITEM_CLASS (class);
|
||||
|
@ -2160,10 +2265,12 @@ nautilus_icon_canvas_item_class_init (NautilusIconCanvasItemClass *class)
|
|||
G_TYPE_BOOLEAN, GTK_ARG_READWRITE, ARG_HIGHLIGHTED_AS_KEYBOARD_FOCUS);
|
||||
gtk_object_add_arg_type ("NautilusIconCanvasItem::highlighted_for_drop",
|
||||
G_TYPE_BOOLEAN, GTK_ARG_READWRITE, ARG_HIGHLIGHTED_FOR_DROP);
|
||||
#ifdef USE_EEL_TEXT
|
||||
gtk_object_add_arg_type ("NautilusIconCanvasItem::smooth_font_size",
|
||||
G_TYPE_INT, GTK_ARG_READWRITE, ARG_SMOOTH_FONT_SIZE);
|
||||
gtk_object_add_arg_type ("NautilusIconCanvasItem::smooth_font",
|
||||
GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_SMOOTH_FONT);
|
||||
#endif
|
||||
|
||||
G_OBJECT_CLASS (class)->finalize = nautilus_icon_canvas_item_finalize;
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include <eel/eel-glib-extensions.h>
|
||||
#include <eel/eel-gtk-macros.h>
|
||||
#include <eel/eel-scalable-font.h>
|
||||
#include <eel/eel-smooth-text-layout.h>
|
||||
#include <eel/eel-string.h>
|
||||
#include <eel/eel-vfs-extensions.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
|
@ -60,6 +59,12 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define USE_EEL_TEXT
|
||||
|
||||
#ifdef USE_EEL_TEXT
|
||||
#include <eel/eel-smooth-text-layout.h>
|
||||
#endif
|
||||
|
||||
#define ICON_NAME_BLOCK_DEVICE "i-blockdev"
|
||||
#define ICON_NAME_BROKEN_SYMBOLIC_LINK "i-symlink"
|
||||
#define ICON_NAME_CHARACTER_DEVICE "i-chardev"
|
||||
|
@ -2278,8 +2283,8 @@ embed_text (GdkPixbuf *pixbuf_without_text,
|
|||
embedded_text_preferences_callbacks_added = TRUE;
|
||||
|
||||
eel_preferences_add_callback (NAUTILUS_PREFERENCES_DEFAULT_SMOOTH_FONT,
|
||||
embedded_text_font_changed_callback,
|
||||
GINT_TO_POINTER (TRUE));
|
||||
embedded_text_font_changed_callback,
|
||||
GINT_TO_POINTER (TRUE));
|
||||
embedded_text_font_changed_callback (GINT_TO_POINTER (FALSE));
|
||||
|
||||
g_atexit (embedded_text_font_free);
|
||||
|
|
|
@ -33,7 +33,6 @@ Requires: librsvg >= @LIBRSVG_REQUIRED@
|
|||
Requires: libxml >= @LIBXML_REQUIRED@
|
||||
Requires: medusa >= @MEDUSA_REQUIRED@
|
||||
Requires: popt >= @POPT_REQUIRED@
|
||||
Requires: scrollkeeper >= @SCROLLKEEPER_REQUIRED@
|
||||
|
||||
BuildRequires: GConf-devel >= @GCONF_REQUIRED@
|
||||
BuildRequires: ORBit-devel >= @ORBIT_REQUIRED@
|
||||
|
@ -52,7 +51,6 @@ BuildRequires: librsvg-devel >= @LIBRSVG_REQUIRED@
|
|||
BuildRequires: libxml-devel >= @LIBXML_REQUIRED@
|
||||
BuildRequires: medusa-devel >= @MEDUSA_REQUIRED@
|
||||
BuildRequires: popt >= @POPT_REQUIRED@
|
||||
BuildRequires: scrollkeeper >= @SCROLLKEEPER_REQUIRED@
|
||||
BuildRequires: xpdf >= 0.90
|
||||
|
||||
%description
|
||||
|
@ -140,7 +138,6 @@ scrollkeeper-update
|
|||
|
||||
%defattr(0555, bin, bin)
|
||||
%doc AUTHORS COPYING COPYING-DOCS COPYING.LIB TRADEMARK_NOTICE ChangeLog NEWS README
|
||||
%{_bindir}/hyperbola
|
||||
%{_bindir}/nautilus
|
||||
%{_bindir}/nautilus-adapter
|
||||
%{_bindir}/nautilus-error-dialog
|
||||
|
@ -177,8 +174,6 @@ scrollkeeper-update
|
|||
%{_datadir}/gnome/apps/Applications/*.desktop
|
||||
%{_datadir}/locale/*/LC_MESSAGES/*.mo
|
||||
%{_datadir}/nautilus/*.xml
|
||||
%{_datadir}/nautilus/components/hyperbola/*.xml
|
||||
%{_datadir}/nautilus/components/hyperbola/maps/*.map
|
||||
%{_datadir}/nautilus/emblems/*.png
|
||||
%{_datadir}/nautilus/linksets/*.xml
|
||||
%{_datadir}/nautilus/patterns/*.jpg
|
||||
|
@ -212,7 +207,6 @@ scrollkeeper-update
|
|||
%{_libdir}/bonobo/servers/Nautilus_ComponentAdapterFactory_std.server
|
||||
%{_libdir}/bonobo/servers/Nautilus_Control_throbber.server
|
||||
%{_libdir}/bonobo/servers/Nautilus_View_hardware.server
|
||||
%{_libdir}/bonobo/servers/Nautilus_View_help.server
|
||||
%{_libdir}/bonobo/servers/Nautilus_View_history.server
|
||||
%{_libdir}/bonobo/servers/Nautilus_View_image.server
|
||||
%{_libdir}/bonobo/servers/Nautilus_View_music.server
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2001-12-13 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* POTFILES.in: Removed translations for the help component.
|
||||
If we ever revive it, we can get the translations from here.
|
||||
|
||||
2001-12-06 Darin Adler <darin@bentspoon.com>
|
||||
|
||||
* POTFILES.in: Moved mozilla component into its own module.
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
components/adapter/Nautilus_ComponentAdapterFactory_std.server.in
|
||||
components/hardware/Nautilus_View_hardware.server.in
|
||||
components/hardware/nautilus-hardware-view.c
|
||||
components/help/Nautilus_View_help.server.in
|
||||
components/help/hyperbola-filefmt.c
|
||||
components/help/hyperbola-nav-index.c
|
||||
components/help/hyperbola-nav-tree.c
|
||||
components/help/hyperbola-types.h
|
||||
components/help/nautilus-hyperbola-ui.xml
|
||||
components/history/Nautilus_View_history.server.in
|
||||
components/history/nautilus-history-view.c
|
||||
components/image-viewer/Nautilus_View_image.server.in
|
||||
|
|
|
@ -4173,6 +4173,10 @@ real_update_menus (FMDirectoryView *view)
|
|||
gboolean can_duplicate_files;
|
||||
gboolean show_separate_delete_command;
|
||||
EelBackground *background;
|
||||
|
||||
if (view->details->ui == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
selection = fm_directory_view_get_selection (view);
|
||||
selection_count = g_list_length (selection);
|
||||
|
|
|
@ -2556,6 +2556,7 @@ icon_view_handle_uri_list (NautilusIconContainer *container, const char *item_ur
|
|||
GnomeDesktopEntry *entry;
|
||||
#endif
|
||||
GdkPoint point;
|
||||
char *uri;
|
||||
char *local_path;
|
||||
char *stripped_uri;
|
||||
char *container_uri_string;
|
||||
|
@ -2650,12 +2651,12 @@ icon_view_handle_uri_list (NautilusIconContainer *container, const char *item_ur
|
|||
container_path = gnome_vfs_get_local_path_from_uri (container_uri_string);
|
||||
for (node = real_uri_list; node != NULL; node = node->next) {
|
||||
/* Make a link using the desktop file contents? */
|
||||
local_path = gnome_vfs_get_local_path_from_uri (node->data);
|
||||
uri = node->data;
|
||||
local_path = gnome_vfs_get_local_path_from_uri (uri);
|
||||
if (local_path != NULL) {
|
||||
#if GNOME2_CONVERSION_COMPLETE
|
||||
entry = gnome_desktop_entry_load (local_path);
|
||||
if (entry != NULL) {
|
||||
|
||||
/* FIXME: Handle name conflicts? */
|
||||
nautilus_link_local_create_from_gnome_entry (entry, container_path, &point);
|
||||
gnome_desktop_entry_free (entry);
|
||||
|
@ -2673,20 +2674,19 @@ icon_view_handle_uri_list (NautilusIconContainer *container, const char *item_ur
|
|||
/* FIXME: This should be using eel_uri_get_basename
|
||||
* instead of a "roll our own" solution.
|
||||
*/
|
||||
stripped_uri = eel_str_strip_trailing_chr ((char *)node->data, '/');
|
||||
g_print ("local_path:%s\nstripped_uri:%s\n", (char *)node->data, stripped_uri);
|
||||
stripped_uri = eel_str_strip_trailing_chr (uri, '/');
|
||||
g_print ("local_path:%s\nstripped_uri:%s\n", local_path, stripped_uri);
|
||||
last_slash = strrchr (stripped_uri, '/');
|
||||
link_name = last_slash == NULL ? NULL : last_slash + 1;
|
||||
|
||||
if (!eel_str_is_empty (link_name)) {
|
||||
/* FIXME: Handle name conflicts? */
|
||||
nautilus_link_local_create (container_path, link_name,
|
||||
"gnome-http-url", local_path,
|
||||
"gnome-http-url", uri,
|
||||
&point, NAUTILUS_LINK_GENERIC);
|
||||
}
|
||||
|
||||
g_free (stripped_uri);
|
||||
|
||||
break;
|
||||
}
|
||||
g_free (container_path);
|
||||
|
|
Loading…
Reference in a new issue