[Goodies-commits] r5794 - in xfce4-dict/trunk: . panel-plugin src

Enrico Troeger enrico at xfce.org
Fri Oct 24 19:30:29 CEST 2008


Author: enrico
Date: 2008-10-24 17:30:29 +0000 (Fri, 24 Oct 2008)
New Revision: 5794

Modified:
   xfce4-dict/trunk/ChangeLog
   xfce4-dict/trunk/README
   xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c
   xfce4-dict/trunk/src/popup_plugin.c
   xfce4-dict/trunk/src/xfce4-dict.c
   xfce4-dict/trunk/xfce4-dict.1
Log:
Fix wrong status bar text when querying a server for the first time in the stand-alone app.
Update Readme and manpage.

Modified: xfce4-dict/trunk/ChangeLog
===================================================================
--- xfce4-dict/trunk/ChangeLog	2008-10-24 17:30:25 UTC (rev 5793)
+++ xfce4-dict/trunk/ChangeLog	2008-10-24 17:30:29 UTC (rev 5794)
@@ -6,6 +6,9 @@
  * When highlighting cross-references, ignore short ones like
    {n}, {f} and {m} as often found in translation dictionaries.
  * Highlight phonetic information provided by some dictionaries.
+ * Fix wrong status bar text when querying a server for the first
+   time in the stand-alone app.
+ * Update Readme and manpage.
 
 
 2008-10-19  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: xfce4-dict/trunk/README
===================================================================
--- xfce4-dict/trunk/README	2008-10-24 17:30:25 UTC (rev 5793)
+++ xfce4-dict/trunk/README	2008-10-24 17:30:29 UTC (rev 5794)
@@ -1,6 +1,7 @@
 Xfce4 Dictionary - A client program to query different dictionaries
--------------------------------------------------------------
+===================================================================
 
+
 This program allows you to search different kinds of dictionary services
 for words or phrases and shows you the result.
 Currently you can query a "Dict" server(RFC 2229), any online dictionary
@@ -28,7 +29,18 @@
 plugin in Xfce's settings manager and assign "xfce4-dict" as the action
 command.
 
+Please note:
+there is a limitation of max. 12 characters in passing a search term
+to xfce4-dict when the panel plugin is loaded. That is, if pass a search
+term as command line argument(s) to xfce4-dict which is longer than 12
+characters, it is truncated. To be exact, the limit is 12 bytes so if
+the search term contains any non-ASCII characters it might be even less
+than 12 characters.
+To work around this limitation, you can add the command line '-i' so
+that xfce4-dict will start a single stand-alone application. Then all
+passed text is used as search term.
 
+
 Panel Plugin
 ------------
 
@@ -57,7 +69,22 @@
 work with any other servers which implement the DICT protocol defined
 in RFC 2229.
 
+Search result highlighting
+``````````````````````````
 
+Sometimes defintions in certain dictionaries contain special markups
+to give additional information. Two of them are:
+ * Cross-references
+     These are some kind of links in definitions to link to other
+     defintions.
+     Xfce4-dict will highlight these definitions and make them clickable
+     to easily jump (by searching) to this highlighted defition.
+ * Phonetic hints
+    These are mostly phonetic spellings found in translation
+    dictionaries to illustrate how a word is pronounced.
+    Xfce4-dict will highlight these with a green colour.
+
+
 Web-based dictionaries
 ----------------------
 
@@ -67,7 +94,7 @@
 preferences dialog.
 
 A note on the started web browser:
-xfce4-dict will open the configured URL with the "exo-open" command
+xfce4-dict will open the configured URL with the "xdg-open" command
 which will open the configured default browser. If that doesn't work
 other known browsers are tried. But it's better to set a default browser
 using "Preferred Applications" in the Xfce settings manager.

Modified: xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c
===================================================================
--- xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c	2008-10-24 17:30:25 UTC (rev 5793)
+++ xfce4-dict/trunk/panel-plugin/xfce4-dict-plugin.c	2008-10-24 17:30:29 UTC (rev 5794)
@@ -144,13 +144,19 @@
 	}
 	else
 	{
-		const gchar *panel_text = gtk_entry_get_text(GTK_ENTRY(dpd->dd->panel_entry));
-
 		dict_gui_show_main_window(dpd->dd);
-		if (NZV(panel_text))
+		/* Do not search the panel text if it is still the default text */
+		if (dpd->dd->show_panel_entry &&
+			xfce_panel_plugin_get_orientation(dpd->plugin) == GTK_ORIENTATION_HORIZONTAL &&
+			entry_is_dirty)
 		{
-			dict_search_word(dpd->dd, panel_text);
-			gtk_entry_set_text(GTK_ENTRY(dpd->dd->main_entry), panel_text);
+			const gchar *panel_text = gtk_entry_get_text(GTK_ENTRY(dpd->dd->panel_entry));
+
+			if (NZV(panel_text))
+			{
+				dict_search_word(dpd->dd, panel_text);
+				gtk_entry_set_text(GTK_ENTRY(dpd->dd->main_entry), panel_text);
+			}
 		}
 		gtk_widget_grab_focus(dpd->dd->main_entry);
 	}

Modified: xfce4-dict/trunk/src/popup_plugin.c
===================================================================
--- xfce4-dict/trunk/src/popup_plugin.c	2008-10-24 17:30:25 UTC (rev 5793)
+++ xfce4-dict/trunk/src/popup_plugin.c	2008-10-24 17:30:29 UTC (rev 5794)
@@ -64,12 +64,16 @@
 
 	if (text == NULL)
 		text = "";
+	else if (strlen(text) > 12)
+		g_warning("The passed search text is longer than 12 characters and was truncated. Currently you can pass only a maximum of 12 characters to the panel plugin (or even less when using non-ASCII characters).");
 
 	/* format of the send string: "xfdict?text":
 	 * "xfdict" is for identification of ourselves
 	 * ? is a bitmask to control the behaviour, it can contain one or more of DICT_FLAGS_*,
 	 * we send it as %c to ensure it takes only one char in the string,
 	 * everything after this is the text to search, given on command line */
+	/** FIXME: remove the limit of 12 characters, maybe by sending more than message or by
+	  *        using another IPC mechanism, maybe DBus? */
 	g_snprintf(gev.data.b, sizeof gev.data.b, "xfdict%c%s", flags, text);
 
 	if (check_is_running(win, &id))

Modified: xfce4-dict/trunk/src/xfce4-dict.c
===================================================================
--- xfce4-dict/trunk/src/xfce4-dict.c	2008-10-24 17:30:25 UTC (rev 5793)
+++ xfce4-dict/trunk/src/xfce4-dict.c	2008-10-24 17:30:29 UTC (rev 5794)
@@ -214,10 +214,11 @@
 		gtk_entry_set_text(GTK_ENTRY(dd->main_entry), search_text);
 		dict_search_word(dd, search_text);
 	}
+	else
+		dict_gui_status_add(dd, _("Ready."));
+
 	g_free(search_text);
 
-	dict_gui_status_add(dd, _("Ready."));
-
 	gtk_widget_show_all(dd->window);
 
 	gtk_main();

Modified: xfce4-dict/trunk/xfce4-dict.1
===================================================================
--- xfce4-dict/trunk/xfce4-dict.1	2008-10-24 17:30:25 UTC (rev 5793)
+++ xfce4-dict/trunk/xfce4-dict.1	2008-10-24 17:30:29 UTC (rev 5794)
@@ -1,4 +1,4 @@
-.TH "XFCE4-DICT" "1" "September 15, 2008" "xfce4-dict 0.4.2" ""
+.TH "XFCE4-DICT" "1" "October 23, 2008" "xfce4-dict 0.4.2" ""
 .SH "NAME"
 xfce4-dict \(em a client program to query different dictionaries
 .SH "SYNOPSIS"
@@ -38,6 +38,17 @@
 Show help information and exit.
 .PP
 xfce4-dict supports all generic GTK options, a list is available on the help screen.
+.SH "BUGS"
+.PP
+There is a limitation of max. 12 characters in passing a search term
+to xfce4\-dict when the panel plugin is loaded. That is, if pass a search
+term as command line argument(s) to xfce4\-dict which is longer than 12
+characters, it is truncated. To be exact, the limit is 12 bytes so if
+the search term contains any non\-ASCII characters it might be even less
+than 12 characters.
+To work around this limitation, you can add the command line '\-i' so
+that xfce4-dict will start a single stand\-alone application. Then all
+passed text is used as search term.
 .SH "AUTHOR"
 .PP
 This manual page was written by Enrico Troeger. Permission is granted to copy,




More information about the Goodies-commits mailing list