[Goodies-commits] r5478 - in xfce4-dict/trunk: . src

Enrico Troeger enrico at xfce.org
Fri Sep 26 18:42:43 CEST 2008


Author: enrico
Date: 2008-09-26 16:42:43 +0000 (Fri, 26 Sep 2008)
New Revision: 5478

Modified:
   xfce4-dict/trunk/ChangeLog
   xfce4-dict/trunk/src/xfce4-dict.c
   xfce4-dict/trunk/xfce4-dict.1
Log:
Add new command line option: '--clipboard' (-c) to take the search text from the PRIMARY clipboard and performs a search.
Update manual page.

Modified: xfce4-dict/trunk/ChangeLog
===================================================================
--- xfce4-dict/trunk/ChangeLog	2008-09-26 16:42:39 UTC (rev 5477)
+++ xfce4-dict/trunk/ChangeLog	2008-09-26 16:42:43 UTC (rev 5478)
@@ -2,6 +2,9 @@
 
  * Add "en.wikipedia.org" and "www.merriam-webster.com" to the list
    of web dictionaries (thanks to Liviu Andronic for the hint).
+ * Add new command line option: '--clipboard' (-c) to take the
+   search text from the PRIMARY clipboard and performs a search.
+   Update manual page.
 
 
 2008-09-23  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: xfce4-dict/trunk/src/xfce4-dict.c
===================================================================
--- xfce4-dict/trunk/src/xfce4-dict.c	2008-09-26 16:42:39 UTC (rev 5477)
+++ xfce4-dict/trunk/src/xfce4-dict.c	2008-09-26 16:42:43 UTC (rev 5478)
@@ -42,6 +42,7 @@
 #endif
 static gboolean show_version = FALSE;
 static gboolean ignore_plugin = FALSE;
+static gboolean use_clipboard = FALSE;
 static gboolean focus_panel_entry = FALSE;
 static gboolean mode_dict = FALSE;
 static gboolean mode_web = FALSE;
@@ -58,6 +59,7 @@
 	{ "spell", 's', 0, G_OPTION_ARG_NONE, &mode_spell, N_("Check the given text with a spellchecker"), NULL },
 	{ "text-field", 't', 0, G_OPTION_ARG_NONE, &focus_panel_entry, N_("Grab the focus on the text field in the panel"), NULL },
 	{ "ignore-plugin", 'i', 0, G_OPTION_ARG_NONE, &ignore_plugin, N_("Start stand-alone application even if the panel plugin is loaded"), NULL },
+	{ "clipboard", 'c', 0, G_OPTION_ARG_NONE, &use_clipboard, N_("Grabs the PRIMARY selection content and uses it as search text."), NULL },
 	{ "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, N_("Show version information"), NULL },
 	{ NULL, 0, 0, 0, NULL, NULL, NULL }
 };
@@ -165,8 +167,19 @@
 
 	flags = get_flags();
 
-	/* concatenate remaining command line arguments */
-	search_text = get_search_text(argc, argv);
+	if (use_clipboard)
+	{
+		search_text = gtk_clipboard_wait_for_text(gtk_clipboard_get(
+						gdk_atom_intern("PRIMARY", FALSE)));
+		if (! search_text)
+			search_text = gtk_clipboard_wait_for_text(gtk_clipboard_get(
+							gdk_atom_intern("CLIPBOARD", FALSE)));
+	}
+	else
+	{
+		/* concatenate remaining command line arguments */
+		search_text = get_search_text(argc, argv);
+	}
 
 	/* try to find an existing panel plugin and pop it up */
 	if (! ignore_plugin && dict_find_panel_plugin(flags, search_text))

Modified: xfce4-dict/trunk/xfce4-dict.1
===================================================================
--- xfce4-dict/trunk/xfce4-dict.1	2008-09-26 16:42:39 UTC (rev 5477)
+++ xfce4-dict/trunk/xfce4-dict.1	2008-09-26 16:42:43 UTC (rev 5478)
@@ -1,4 +1,4 @@
-.TH "XFCE4-DICT" "1" "April 15, 2008" "xfce4-dict 0.4.0" ""
+.TH "XFCE4-DICT" "1" "September 15, 2008" "xfce4-dict 0.4.2" ""
 .SH "NAME"
 xfce4-dict \(em a client program to query different dictionaries
 .SH "SYNOPSIS"
@@ -26,6 +26,12 @@
 Check the given text with a spellchecker.
 .IP "\fB-i\fP, \fB\-\-ignore-plugin\fP         " 10
 Start stand-alone application even if the panel plugin is loaded.
+.IP "\fB-c\fP, \fB\-\-clipboard\fP         " 10
+Grabs the PRIMARY selection content (X selection clipboard), uses it as search text and performs
+a search. This is useful when you want to create keyboard shortcuts for this command.
+The search method can be specified with the \-d, \-w and \-s options, if not specified the
+default search method is used.
+If the PRIMARY clipboard doesn't contain any text, the normal clipboard is used.
 .IP "\fB-v\fP, \fB\-\-version\fP         " 10
 Show version information.
 .IP "\fB-?\fP, \fB-h\fP, \fB\-\-help\fP         " 10




More information about the Goodies-commits mailing list