devhelp r1073 - in trunk: . src



Author: rhult
Date: Wed Oct  1 20:22:41 2008
New Revision: 1073
URL: http://svn.gnome.org/viewvc/devhelp?rev=1073&view=rev

Log:
2008-10-01  Richard Hult  <richard imendio com>

	* src/dh-main.c: (message_received_cb), (main): Prepare for a new
	search method.


Modified:
   trunk/ChangeLog
   trunk/src/dh-main.c

Modified: trunk/src/dh-main.c
==============================================================================
--- trunk/src/dh-main.c	(original)
+++ trunk/src/dh-main.c	Wed Oct  1 20:22:41 2008
@@ -32,10 +32,17 @@
 #include "dh-base.h"
 #include "dh-window.h"
 
-#define COMMAND_QUIT           "quit"
-#define COMMAND_SEARCH         "search"
-#define COMMAND_FOCUS_SEARCH   "focus-search"
-#define COMMAND_RAISE          "raise"
+#define COMMAND_QUIT             "quit"
+#define COMMAND_SEARCH           "search"
+#define COMMAND_SEARCH_ASSISTANT "search-assistant"
+#define COMMAND_FOCUS_SEARCH     "focus-search"
+#define COMMAND_RAISE            "raise"
+
+static void
+search_assistant (DhBase      *base,
+                  const gchar *str)
+{
+}
 
 static void
 message_received_cb (const gchar *message, DhBase *base)
@@ -48,6 +55,13 @@
 		return;
 	}
 
+	if (g_str_has_prefix (message, COMMAND_SEARCH_ASSISTANT)) {
+                search_assistant (base,
+                                  message +
+                                  strlen (COMMAND_SEARCH_ASSISTANT) + 1);
+		return;
+	}
+
 	/* Note: This is a bit strange. It seems like we need both the
 	 * gtk_window_present() and gtk_window_present_with_time() to make all
 	 * the cases working.
@@ -80,6 +94,7 @@
 main (int argc, char **argv)
 {
 	gchar                  *option_search = NULL;
+	gchar                  *option_search_assistant = NULL;
 	gboolean                option_quit = FALSE;
 	gboolean                option_focus_search = FALSE;
 	gboolean                option_version = FALSE;
@@ -126,6 +141,15 @@
 			_("Focus the devhelp window with the search field active"),
 			NULL
 		},
+       		{
+			"search-assistant",
+			'a',
+			0,
+			G_OPTION_ARG_STRING,
+			&option_search_assistant,
+			_("Search and display any hit in the assistant window"),
+			NULL
+		},
 		{
 			NULL, '\0', 0, 0, NULL, NULL, NULL
 		}
@@ -172,6 +196,16 @@
 			bacon_message_connection_send (message_conn, command);
 			g_free (command);
 		}
+		else if (option_search_assistant) {
+			gchar *command;
+
+			command = g_strdup_printf ("%s %s",
+						   COMMAND_SEARCH_ASSISTANT,
+						   option_search_assistant);
+
+			bacon_message_connection_send (message_conn, command);
+			g_free (command);
+		}
 		else if (option_focus_search) {
 			bacon_message_connection_send (message_conn, COMMAND_FOCUS_SEARCH);
 		} else {
@@ -188,18 +222,23 @@
 	}
 
 	base = dh_base_new ();
-	window = dh_base_new_window (base);
 
 	bacon_message_connection_set_callback (
 		message_conn,
 		(BaconMessageReceivedFunc) message_received_cb,
 		base);
 
-	if (option_search) {
-		dh_window_search (DH_WINDOW (window), option_search);
-	}
+	if (!option_search_assistant) {
+		window = dh_base_new_window (base);
 
-	gtk_widget_show (window);
+                if (option_search) {
+                        dh_window_search (DH_WINDOW (window), option_search);
+                }
+
+		gtk_widget_show (window);
+	} else {
+		search_assistant (base, option_search_assistant);
+	}
 
 	gtk_main ();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]