Revision: 4442 http://geany.svn.sourceforge.net/geany/?rev=4442&view=rev Author: eht16 Date: 2009-11-23 22:59:36 +0000 (Mon, 23 Nov 2009)
Log Message: ----------- Add and use utils_get_help_url().
Modified Paths: -------------- trunk/ChangeLog trunk/src/callbacks.c trunk/src/utils.c trunk/src/utils.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-11-23 22:25:11 UTC (rev 4441) +++ trunk/ChangeLog 2009-11-23 22:59:36 UTC (rev 4442) @@ -3,19 +3,21 @@ * tagmanager/php.c: Remove duplicate regular expression for parsing classes. Fix and improve parsing of constants (patch by Harold Aling, thanks). - * doc/geany.1.in, doc/geany.html, doc/geany.txt, src/main.c, + * doc/geany.1.in, doc/geany.html, doc/geany.txt, src/main.c, src/main.h, THANKS, src/about.c: Add new command line option "--socket-file" to be able to specify - separate socket filenames for instances + separate socket filenames for instances (closes #2896027, patch by Jörn Reder, thanks). * src/keybindings.c, src/keybindings.h: Add keybindings_check_event() to manually check GdkKeyEvents against Geany's keybindings. + * src/callbacks.c, src/utils.c, src/utils.h: + Add and use utils_get_help_url().
2009-11-22 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
- * src/toolbar.c, src/geanymenubuttonaction.c, + * src/toolbar.c, src/geanymenubuttonaction.c, src/geanymenubuttonaction.h: Use separate tooltips for toolbar menu buttons and their attached drop-down arrows.
Modified: trunk/src/callbacks.c =================================================================== --- trunk/src/callbacks.c 2009-11-23 22:25:11 UTC (rev 4441) +++ trunk/src/callbacks.c 2009-11-23 22:59:36 UTC (rev 4442) @@ -1323,24 +1323,9 @@ on_help1_activate (GtkMenuItem *menuitem, gpointer user_data) { - gint skip; gchar *uri;
-#ifdef G_OS_WIN32 - skip = 8; - uri = g_strconcat("file:///", app->docdir, "/Manual.html", NULL); - g_strdelimit(uri, "\", '/'); /* replace '\' by '/' */ -#else - skip = 7; - uri = g_strconcat("file://", app->docdir, "index.html", NULL); -#endif - - if (! g_file_test(uri + skip, G_FILE_TEST_IS_REGULAR)) - { /* fall back to online documentation if it is not found on the hard disk */ - g_free(uri); - uri = g_strconcat(GEANY_HOMEPAGE, "manual/", VERSION, "/index.html", NULL); - } - + uri = utils_get_help_url(NULL); utils_open_browser(uri); g_free(uri); }
Modified: trunk/src/utils.c =================================================================== --- trunk/src/utils.c 2009-11-23 22:25:11 UTC (rev 4441) +++ trunk/src/utils.c 2009-11-23 22:59:36 UTC (rev 4442) @@ -1864,3 +1864,33 @@ }
+/* Suffix can be NULL or a string which should be appended to the Help URL like + * an anchor link, e.g. "#some_anchor". */ +gchar *utils_get_help_url(const gchar *suffix) +{ + gint skip; + gchar *uri; + +#ifdef G_OS_WIN32 + skip = 8; + uri = g_strconcat("file:///", app->docdir, "/Manual.html", NULL); + g_strdelimit(uri, "\", '/'); /* replace '\' by '/' */ +#else + skip = 7; + uri = g_strconcat("file://", app->docdir, "index.html", NULL); +#endif + + if (! g_file_test(uri + skip, G_FILE_TEST_IS_REGULAR)) + { /* fall back to online documentation if it is not found on the hard disk */ + g_free(uri); + uri = g_strconcat(GEANY_HOMEPAGE, "manual/", VERSION, "/index.html", NULL); + } + + if (suffix != NULL) + { + setptr(uri, g_strconcat(uri, suffix, NULL)); + } + + return uri; +} +
Modified: trunk/src/utils.h =================================================================== --- trunk/src/utils.h 2009-11-23 22:25:11 UTC (rev 4441) +++ trunk/src/utils.h 2009-11-23 22:59:36 UTC (rev 4442) @@ -200,6 +200,8 @@
GSList *utils_get_config_files(const gchar *subdir);
+gchar *utils_get_help_url(const gchar *suffix); + gboolean utils_str_has_upper(const gchar *str);
gint utils_is_file_writeable(const gchar *locale_filename);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.