diff options
author | Mikael Hallendal <micke@codefactory.se> | 2003-03-31 21:04:50 +0000 |
---|---|---|
committer | Mikael Hallendal <hallski@src.gnome.org> | 2003-03-31 21:04:50 +0000 |
commit | 3f2e52dfdf39b1200fac3d8887b7a6bab3bdb1e7 (patch) | |
tree | c50029cd3ef11a9932e2bf14810f50953563b932 | |
parent | 3116729c4bd94bfdc2ca7b9bca87b8df13fec4ba (diff) | |
download | yelp-3f2e52dfdf39b1200fac3d8887b7a6bab3bdb1e7.tar.gz |
- Added --with-cache-dir (not used yet). - Cleaned up popt mess - Changed
2003-03-31 Mikael Hallendal <micke@codefactory.se>
* src/yelp-main.c:
- Added --with-cache-dir (not used yet).
- Cleaned up popt mess
- Changed the session stuff a bit (it now uses --open-urls instead
of multiple --url)
- Removed support for 'gman', fixes #103750
* src/Makefile.am:
- removed Gtkhtml1 support.
- Removed support for 'gman', fixes #103750
* configure.in:
- bumped version.
- removed gtkhtml1 support.
* src/yelp-scrollkeeper.c (scrollkeeper_get_xml_docpath):
- fixed #109599
* src/yelp-info.c (yelp_info_init): some cleanups.
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | configure.in | 20 | ||||
-rw-r--r-- | src/Makefile.am | 11 | ||||
-rw-r--r-- | src/yelp-info.c | 26 | ||||
-rw-r--r-- | src/yelp-main.c | 167 | ||||
-rw-r--r-- | src/yelp-reader.c | 1 | ||||
-rw-r--r-- | src/yelp-scrollkeeper.c | 11 |
7 files changed, 154 insertions, 104 deletions
@@ -1,3 +1,25 @@ +2003-03-31 Mikael Hallendal <micke@codefactory.se> + + * src/yelp-main.c: + - Added --with-cache-dir (not used yet). + - Cleaned up popt mess + - Changed the session stuff a bit (it now uses --open-urls instead + of multiple --url) + - Removed support for 'gman', fixes #103750 + + * src/Makefile.am: + - removed Gtkhtml1 support. + - Removed support for 'gman', fixes #103750 + + * configure.in: + - bumped version. + - removed gtkhtml1 support. + + * src/yelp-scrollkeeper.c (scrollkeeper_get_xml_docpath): + - fixed #109599 + + * src/yelp-info.c (yelp_info_init): some cleanups. + 2003-03-13 Christian Rose <menthos@menthos.com> * configure.in: Added "ml" to ALL_LINGUAS. diff --git a/configure.in b/configure.in index f1c88b19..34cd612a 100644 --- a/configure.in +++ b/configure.in @@ -1,11 +1,9 @@ AC_INIT(src/yelp-main.c) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(yelp, 2.2.0) +AM_INIT_AUTOMAKE(yelp, 2.3.0) AC_PROG_INTLTOOL -AC_ARG_WITH(html-widget, [ --with-html-widget=[gtkhtml1/gtkhtml2] html widget to use]) - AM_MAINTAINER_MODE AC_PROG_CC @@ -71,6 +69,7 @@ PKG_CHECK_MODULES(YELP, libxslt >= 1.0.15 libglade-2.0 >= 2.0.0 gconf-2.0 + libgtkhtml-2.0 >= 2.1.2 ]) CFLAGS="$YELP_CFLAGS $CFLAGS" @@ -96,21 +95,6 @@ AC_CHECK_LIB(popt, poptGetArgs, [POPT_LIBS="-lpopt"], AC_SUBST(POPT_LIBS) -if test x$with_html_widget = xgtkhtml1; then - PKG_CHECK_MODULES(HTML_WIDGET, libgtkhtml-3.0 >= 3.0) -else - PKG_CHECK_MODULES(HTML_WIDGET, libgtkhtml-2.0 >= 2.1.2) -fi - -CFLAGS="$HTML_WIDGET_CFLAGS $CFLAGS" - -AM_CONDITIONAL(HTML_WIDGET_GTKHTML1, test x$with_html_widget = xgtkhtml1) -if test x$with_html_widget = xgtkhtml1; then - echo "***" - echo "*** Using GtkHMTML 1 instead of the default GtkHTML 2" - echo "***" -fi - AC_OUTPUT([ Makefile src/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index e7b1c928..0d312a6e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -13,13 +13,6 @@ INCLUDES = \ -DSERVERDIR=\"$(libexecdir)\" \ -DBINDIR=\""$(bindir)"\" - -if HTML_WIDGET_GTKHTML1 -html_widget_impl=yelp-html-gtkhtml1.c -else -html_widget_impl=yelp-html-gtkhtml2.c -endif - libexec_PROGRAMS = yelp-db2html bin_PROGRAMS = yelp yelp-pregenerate @@ -49,7 +42,6 @@ test_reader_LDADD = \ install-exec-local: rm -f $(DESTDIR)$(bindir)/gnome-help ln -s yelp $(DESTDIR)$(bindir)/gnome-help - ln -sf yelp $(DESTDIR)$(bindir)/gman yelp-marshal.h: yelp-marshal.list cd $(srcdir) && \ @@ -83,7 +75,7 @@ yelp_SOURCES = \ yelp-cache.c yelp-cache.h \ yelp-error.c yelp-error.h \ yelp-history.c yelp-history.h \ - $(html_widget_impl) yelp-html.h \ + yelp-html-gtkhtml2.c yelp-html.h \ yelp-index-model.c yelp-index-model.h \ yelp-info.c yelp-info.h \ yelp-main.c \ @@ -102,7 +94,6 @@ yelp_SOURCES = \ yelp_LDADD = \ @YELP_LIBS@ \ - @HTML_WIDGET_LIBS@ \ $(POPT_LIBS) gnome_yelp_idl_sources = \ diff --git a/src/yelp-info.c b/src/yelp-info.c index 6f1622e7..4df0115c 100644 --- a/src/yelp-info.c +++ b/src/yelp-info.c @@ -117,18 +117,16 @@ yelp_info_read_info_dir (const char *basedir, GSList **info_list) gboolean yelp_info_init (GNode *tree, GList **index) { - GNode *root; - struct stat stat_dir1; - struct stat stat_dir2; - GSList *info_list = NULL; - GSList *node; - gchar **infopathes; - gchar *infopath; - gint i; + GNode *root; + GSList *info_list = NULL; + GSList *node; - infopath = g_strdup (g_getenv ("INFOPATH")); - - if (infopath) { + if (g_getenv ("INFOPATH")) { + gchar **infopathes; + gchar *infopath; + gint i; + + infopath = g_strdup (g_getenv ("INFOPATH")); g_strstrip (infopath); infopathes = g_strsplit (infopath, ":", -1); g_free (infopath); @@ -137,13 +135,17 @@ yelp_info_init (GNode *tree, GList **index) yelp_info_read_info_dir (infopathes[i], &info_list); } } else { + struct stat stat_dir1; + struct stat stat_dir2; + stat ("/usr/info", &stat_dir1); stat ("/usr/share/info", &stat_dir2); yelp_info_read_info_dir ("/usr/info", &info_list); if (stat_dir1.st_ino != stat_dir2.st_ino) { - yelp_info_read_info_dir ("/usr/share/info", &info_list); + yelp_info_read_info_dir ("/usr/share/info", + &info_list); } } diff --git a/src/yelp-main.c b/src/yelp-main.c index fac455e1..e2f344d5 100644 --- a/src/yelp-main.c +++ b/src/yelp-main.c @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Copyright (C) 2001-2002 Mikael Hallendal <micke@codefactory.se> + * Copyright (C) 2001-2003 Mikael Hallendal <micke@codefactory.se> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -46,22 +46,13 @@ poptContext poptCon; gint next_opt; +gchar *cache_dir; +gchar *open_urls; /*structure defining command line option.*/ - -struct poptOption options[] = { - { - "url", - 'u', - POPT_ARG_STRING, - NULL, - 1, - NULL, - NULL, - }, - { - NULL - } +enum { + OPTION_OPEN_URLS = 1, + OPTION_CACHE_DIR }; static BonoboObject * main_base_factory (BonoboGenericFactory *factory, @@ -85,6 +76,28 @@ static void main_client_die (GnomeClient *client, static gboolean main_restore_session (void); +struct poptOption options[] = { + { + "open-urls", + '\0', + POPT_ARG_STRING | POPT_ARGFLAG_DOC_HIDDEN, + &open_urls, + OPTION_OPEN_URLS, + NULL, NULL, + }, + { + "with-cache-dir", + '\0', + POPT_ARG_STRING, + &cache_dir, + OPTION_CACHE_DIR, + N_("Define which cache dir to use"), + NULL, + }, + { + NULL + } +}; static BonoboObject * main_base_factory (BonoboGenericFactory *factory, @@ -195,7 +208,8 @@ main_save_session (GnomeClient *client, CORBA_Object yelp_base; gchar **argv; gint i=1; - gint temp; + gint arg_len = 1; + gboolean store_open_urls = FALSE; CORBA_exception_init (&ev); @@ -205,23 +219,50 @@ main_save_session (GnomeClient *client, bonobo_object_release_unref (yelp_base, NULL); - temp = list->_length; + if (cache_dir) { + arg_len++; + } + + if (list->_length > 0) { + store_open_urls = TRUE; + arg_len++; + } - temp = temp + 1; + argv = g_malloc0 (sizeof (gchar *) * arg_len); - argv = g_malloc0 (sizeof (gchar *) * temp); + /* Program name */ + argv[0] = g_strdup ((gchar *) cdata); + + if (cache_dir) { + argv[1] = g_strdup_printf ("--with-cache-dir=\"%s\"", + cache_dir); + } - argv[0] = (gchar*) cdata; - - /* Get the URI of each window */ + if (store_open_urls) { + gchar *urls; + + /* Get the URI of each window */ + urls = g_strdup_printf ("--open-urls=\"%s", list->_buffer[0]); + + for (i=1; i < list->_length; i++) { + gchar *tmp; + + tmp = g_strconcat (urls, ";", list->_buffer[i], NULL); + g_free (urls); + urls = tmp; + } - for (i=0 ;i < list->_length; i++) { - argv[i+1] = g_strconcat ("--url=", list->_buffer[i], NULL); - } + argv[2] = g_strconcat (urls, "\"", NULL); + g_free (urls); + } - gnome_client_set_clone_command (client, temp, argv); - gnome_client_set_restart_command (client, temp, argv); + gnome_client_set_clone_command (client, arg_len, argv); + gnome_client_set_restart_command (client, arg_len, argv); + for (i = 0; i < arg_len; ++i) { + g_free (argv[i]); + } + g_free (argv); return TRUE; @@ -245,17 +286,18 @@ main_restore_session (void) g_error ("Couldn't activate YelpBase"); } - /*Get the argument of commandline option*/ - - while( (next_opt = poptGetNextOpt (poptCon)) > 0) { - if ( next_opt == 1) { - gchar *url = (gchar *) poptGetOptArg (poptCon); - main_open_new_window (yelp_base, url); - if (url) { - g_free (url); - } - } - } + if (open_urls) { + gchar **urls = g_strsplit (open_urls, ";", -1); + gchar *url; + gint i = 0; + + while ((url = urls[i]) != NULL) { + main_open_new_window (yelp_base, url); + ++i; + } + + g_strfreev (urls); + } return TRUE; } @@ -263,37 +305,40 @@ main_restore_session (void) int main (int argc, char **argv) { - GnomeProgram *program; - CORBA_Object factory; - gchar *url = NULL; - GnomeClient *client; - gboolean flag = FALSE; + GnomeProgram *program; + CORBA_Object factory; + gchar *url = NULL; + GnomeClient *client; + gboolean session_started = FALSE; + const gchar **args; + bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); g_thread_init (NULL); - if (strcmp (argv[0], "gman") == 0) { - url = g_strdup ("toc:man"); - } - else if (argc >= 2) { - url = g_strdup (argv[1]); - } else { - url = g_strdup (""); - } program = gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, - argc, argv, + argc, argv, + GNOME_PARAM_POPT_TABLE, options, GNOME_PROGRAM_STANDARD_PROPERTIES, NULL); gnome_vfs_init (); - /*Commandline parsing is done here*/ - - poptCon = poptGetContext (PACKAGE, argc, (const gchar **) argv, options, 0); + /* Commandline parsing is done here */ + g_object_get (G_OBJECT (program), + GNOME_PARAM_POPT_CONTEXT, &poptCon, + NULL); + + args = poptGetArgs (poptCon); + if (args) { + url = g_strdup (*args); + } else { + url = g_strdup (""); + } client = gnome_master_client (); g_signal_connect (client, "save_yourself", @@ -305,10 +350,9 @@ main (int argc, char **argv) Bonobo_ACTIVATION_FLAG_EXISTING_ONLY, NULL, NULL); - /*Check for previous session to restore.*/ - - if(gnome_client_get_flags (client) & GNOME_CLIENT_RESTORED) { - flag = TRUE; + /* Check for previous session to restore. */ + if (gnome_client_get_flags (client) & GNOME_CLIENT_RESTORED) { + session_started = TRUE; } if (!factory) { /* Not started, start now */ @@ -325,9 +369,8 @@ main (int argc, char **argv) bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory)); - /*Depending on the flag, restore the session*/ - - if (flag) { + /* If started by session, restore from last session */ + if (session_started) { g_idle_add ((GSourceFunc) main_restore_session, NULL); } else { g_idle_add ((GSourceFunc) main_idle_start, url); diff --git a/src/yelp-reader.c b/src/yelp-reader.c index 37b4cfd0..18eda6f1 100644 --- a/src/yelp-reader.c +++ b/src/yelp-reader.c @@ -434,7 +434,6 @@ reader_start (ReaderThreadData *th_data) YelpReader *reader; YelpReaderPriv *priv; YelpURI *uri; - gchar *str_uri; g_return_val_if_fail (th_data != NULL, NULL); diff --git a/src/yelp-scrollkeeper.c b/src/yelp-scrollkeeper.c index 44b770a8..1a70e3a3 100644 --- a/src/yelp-scrollkeeper.c +++ b/src/yelp-scrollkeeper.c @@ -326,11 +326,12 @@ scrollkeeper_get_xml_docpath (const gchar *command, const gchar *argument) gchar *full_command; gchar *xml_location = NULL; gchar *std_err; + gint exit_status; full_command = g_strconcat (command, " ", argument, NULL); success = g_spawn_command_line_sync (full_command, &xml_location, - &std_err, NULL, NULL); + &std_err, &exit_status, NULL); g_free (full_command); g_free (std_err); @@ -346,6 +347,14 @@ scrollkeeper_get_xml_docpath (const gchar *command, const gchar *argument) return NULL; } + + if (exit_status) { + if (xml_location) { + g_free (xml_location); + } + return NULL; + } + g_strchomp (xml_location); return xml_location; |