Skip to content
Snippets Groups Projects
Commit 3322fa4d authored by Enrico Tröger's avatar Enrico Tröger
Browse files

Concatenate text command line arguments as one string as search text.

(Old svn revision: 4579)
parent 3b4d8dd0
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
* Update Readme.
* Reformat ChangeLog.
* Add "-h" command line option if GLib supports printing the help text.
* Concatenate text command line arguments as one string as search text.
2008-04-14 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
......
......@@ -13,6 +13,7 @@ distclean-local:
EXTRA_DIST = \
xfce4-dict.1 \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
......@@ -28,6 +29,7 @@ hicolor48_DATA = xfce4-dict.svg
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
man_MANS=xfce4-dict.1
install-data-hook:
@-if test -z "$(DESTDIR)"; then \
......
......@@ -27,7 +27,7 @@
((ptr) && (ptr)[0])
#define PLUGIN_WEBSITE "http://goodies.xfce.org/projects/xfce4-dict"
#define PLUGIN_WEBSITE "http://goodies.xfce.org/projects/applications/xfce4-dict"
#define DICT_FLAGS_FOCUS_PANEL_ENTRY 1
#define DICT_FLAGS_MODE_DICT 2
......
......@@ -102,11 +102,27 @@ static gchar get_flags()
}
static gchar *get_search_text(gint count, gchar **values)
{
GString *str = g_string_sized_new(128);
gint i;
for (i = 1; i < count; i++)
{
g_string_append(str, values[i]);
if (i < (count - 1))
g_string_append_c(str, ' ');
}
return g_string_free(str, FALSE);
}
gint main(gint argc, gchar *argv[])
{
DictData *dd;
GOptionContext *context;
gchar flags;
gchar *search_text;
#ifdef ENABLE_NLS
xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
......@@ -146,9 +162,15 @@ gint main(gint argc, gchar *argv[])
flags = get_flags();
/* concatenate remaining command line arguments */
search_text = get_search_text(argc, argv);
/* try to find an existing panel plugin and pop it up */
if (dict_find_panel_plugin(flags, (argc > 1) ? argv[1] : NULL))
if (dict_find_panel_plugin(flags, search_text))
{
g_free(search_text);
exit(0);
}
/* no plugin found, start stand-alone app */
......@@ -172,8 +194,11 @@ gint main(gint argc, gchar *argv[])
/* search text from command line options, if any */
/* TODO take all remaining args, not only argv[1] */
if (argc > 1)
dict_search_word(dd, argv[1]);
if (search_text != NULL)
{
dict_search_word(dd, search_text);
g_free(search_text);
}
dict_gui_status_add(dd, _("Ready."));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment