Provide default search engines
This commit is contained in:
parent
2be81621d8
commit
135b1be01e
3 changed files with 50 additions and 4 deletions
21
data/search
Normal file
21
data/search
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
[Google]
|
||||||
|
name=Google
|
||||||
|
text=Web Search
|
||||||
|
uri=http://www.google.com/search?q=%s
|
||||||
|
icon=
|
||||||
|
token=g
|
||||||
|
|
||||||
|
[Wikipedia]
|
||||||
|
name=Wikipedia
|
||||||
|
text=The free encyclopedia
|
||||||
|
uri=http://en.wikipedia.org/wiki/%s
|
||||||
|
icon=
|
||||||
|
token=wp
|
||||||
|
|
||||||
|
[TheFreeDictionary]
|
||||||
|
name=The Free Dictionary
|
||||||
|
text=Dictionary, Encyclopedia and Thesaurus
|
||||||
|
uri=http://www.thefreedictionary.com/%s
|
||||||
|
icon=
|
||||||
|
token=fd
|
|
@ -2166,13 +2166,34 @@ main (int argc,
|
||||||
katze_assign (config_file, build_config_filename ("search"));
|
katze_assign (config_file, build_config_filename ("search"));
|
||||||
error = NULL;
|
error = NULL;
|
||||||
search_engines = search_engines_new_from_file (config_file, &error);
|
search_engines = search_engines_new_from_file (config_file, &error);
|
||||||
if (error)
|
if (!error && katze_array_is_empty (search_engines))
|
||||||
|
{
|
||||||
|
const gchar* const * config_dirs = g_get_system_config_dirs ();
|
||||||
|
i = 0;
|
||||||
|
while (config_dirs[i])
|
||||||
|
{
|
||||||
|
g_object_unref (search_engines);
|
||||||
|
katze_assign (config_file,
|
||||||
|
g_build_filename (config_dirs[i], PACKAGE_NAME, "search", NULL));
|
||||||
|
search_engines = search_engines_new_from_file (config_file, NULL);
|
||||||
|
if (!katze_array_is_empty (search_engines))
|
||||||
|
continue;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (katze_array_is_empty (search_engines))
|
||||||
|
{
|
||||||
|
g_object_unref (search_engines);
|
||||||
|
katze_assign (config_file,
|
||||||
|
g_build_filename (SYSCONFDIR, "xdg", PACKAGE_NAME, "search", NULL));
|
||||||
|
search_engines = search_engines_new_from_file (config_file, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (error)
|
||||||
{
|
{
|
||||||
/* FIXME: We may have a "file empty" error, how do we recognize that?
|
|
||||||
if (error->code != G_FILE_ERROR_NOENT)
|
if (error->code != G_FILE_ERROR_NOENT)
|
||||||
g_string_append_printf (error_messages,
|
g_string_append_printf (error_messages,
|
||||||
_("The search engines couldn't be loaded. %s\n"),
|
_("The search engines couldn't be loaded. %s\n"),
|
||||||
error->message); */
|
error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
}
|
}
|
||||||
bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
|
bookmarks = katze_array_new (KATZE_TYPE_ARRAY);
|
||||||
|
|
6
wscript
6
wscript
|
@ -86,9 +86,10 @@ def configure (conf):
|
||||||
nls = 'no '
|
nls = 'no '
|
||||||
conf.define ('ENABLE_NLS', [0,1][nls == 'yes'])
|
conf.define ('ENABLE_NLS', [0,1][nls == 'yes'])
|
||||||
|
|
||||||
dirname_default ('LIBDIR', os.path.join (conf.env['PREFIX'], 'lib'))
|
|
||||||
dirname_default ('DATADIR', os.path.join (conf.env['PREFIX'], 'share'))
|
dirname_default ('DATADIR', os.path.join (conf.env['PREFIX'], 'share'))
|
||||||
dirname_default ('DOCDIR', os.path.join (conf.env['DATADIR'], 'doc'))
|
dirname_default ('DOCDIR', os.path.join (conf.env['DATADIR'], 'doc'))
|
||||||
|
dirname_default ('LIBDIR', os.path.join (conf.env['PREFIX'], 'lib'))
|
||||||
|
dirname_default ('SYSCONFDIR', os.path.join (conf.env['PREFIX'], 'etc'))
|
||||||
|
|
||||||
if option_enabled ('apidocs'):
|
if option_enabled ('apidocs'):
|
||||||
conf.find_program ('gtkdoc-scan', var='GTKDOC_SCAN')
|
conf.find_program ('gtkdoc-scan', var='GTKDOC_SCAN')
|
||||||
|
@ -291,6 +292,9 @@ def build (bld):
|
||||||
bld.install_files ('${DOCDIR}/' + APPNAME + '/', \
|
bld.install_files ('${DOCDIR}/' + APPNAME + '/', \
|
||||||
'AUTHORS ChangeLog COPYING EXPAT README TRANSLATE')
|
'AUTHORS ChangeLog COPYING EXPAT README TRANSLATE')
|
||||||
|
|
||||||
|
# Install default configuration
|
||||||
|
bld.install_files ('${SYSCONFDIR}/xdg/' + APPNAME + '/', 'data/search')
|
||||||
|
|
||||||
if bld.env['RST2HTML']:
|
if bld.env['RST2HTML']:
|
||||||
# FIXME: Build only if needed
|
# FIXME: Build only if needed
|
||||||
if not os.access (blddir, os.F_OK):
|
if not os.access (blddir, os.F_OK):
|
||||||
|
|
Loading…
Reference in a new issue