[Cxplorer-cvs 01363] CVS update: cxplorer/src

Back to archive index

Yasumichi Akahoshi yasum****@users*****
2005年 10月 22日 (土) 23:36:38 JST


Index: cxplorer/src/cxp-right-pane.c
diff -u cxplorer/src/cxp-right-pane.c:1.94.2.3 cxplorer/src/cxp-right-pane.c:1.94.2.4
--- cxplorer/src/cxp-right-pane.c:1.94.2.3	Mon Oct 17 15:21:54 2005
+++ cxplorer/src/cxp-right-pane.c	Sat Oct 22 23:36:38 2005
@@ -146,6 +146,8 @@
 static void cxp_right_pane_drag_data_received (GtkWidget *widget, GdkDragContext *dc, gint x, gint y, GtkSelectionData *selection_data, guint info, guint t, gpointer data);
 static gboolean cxp_right_pane_drag_drop (GtkWidget *widget, GdkDragContext *dc, gint x, gint y, guint t, gpointer data);
 static gchar *cxp_right_pane_get_drag_dest_dir (CxpRightPane *obj, gint x, gint y);
+static gboolean cxp_right_pane_file_found (GIOChannel *source, GIOCondition condition, gpointer data);
+static void cxp_right_pane_child_watch (GPid pid, gint status, gpointer data);
 
 GType cxp_right_pane_get_type (void)
 {
@@ -1697,6 +1699,33 @@
 	return	result;
 }
 
+static gboolean cxp_right_pane_file_found (GIOChannel *source, GIOCondition condition, gpointer data)
+{
+	CxpRightPanePrivate *priv = CXP_RIGHT_PANE_GET_PRIVATE (data);
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	gchar *line;
+	
+	if (g_io_channel_read_line (source, &line, NULL, NULL, NULL) == G_IO_STATUS_NORMAL)
+	{
+		g_strchomp (line);
+		model = gtk_tree_view_get_model (GTK_TREE_VIEW(priv->file_list));
+		cxp_file_list_store_append_file (CXP_FILE_LIST_STORE(model), line, &iter);
+		/*
+		   if (GTK_WIDGET_VISIBLE(priv->file_list) && GTK_WIDGET_DRAWABLE(priv->file_list))
+		   gdk_window_process_updates(priv->file_list->window, FALSE);
+		   */
+		g_free (line);
+	}
+
+	return	TRUE;
+}
+
+static void cxp_right_pane_child_watch (GPid pid, gint status, gpointer data)
+{
+	g_print ("child prosess end.\n");
+}
+
 void cxp_right_pane_search_file (CxpRightPane *right_pane, const gchar *cmd)
 {
 	CxpRightPanePrivate *priv = CXP_RIGHT_PANE_GET_PRIVATE (right_pane);
@@ -1704,9 +1733,7 @@
 	GPid pid;
 	GtkTreeModel *model;
 	GtkTreeViewColumn *column;
-	GtkTreeIter iter;
 	gchar **args;
-	gchar *line;
 	gint sout;
 	GError *error = NULL;
 
@@ -1724,20 +1751,10 @@
 	{
 		if (g_spawn_async_with_pipes (NULL, args, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &pid, NULL, &sout, NULL, &error))
 		{
+			g_child_watch_add_full (G_PRIORITY_DEFAULT, pid, cxp_right_pane_child_watch, right_pane, NULL);
 			channel = g_io_channel_unix_new (sout);
 			g_io_channel_set_encoding (channel, NULL, NULL);
-
-			while (g_io_channel_read_line (channel, &line, NULL, NULL, NULL) == G_IO_STATUS_NORMAL)
-			{
-				g_strchomp (line);
-				cxp_file_list_store_append_file (CXP_FILE_LIST_STORE(model), line, &iter);
-				if (GTK_WIDGET_VISIBLE(priv->file_list) && GTK_WIDGET_DRAWABLE(priv->file_list))
-					    gdk_window_process_updates(priv->file_list->window, FALSE);
-				g_free (line);
-			}
-			g_io_channel_shutdown (channel, FALSE, NULL);
-			g_io_channel_unref (channel);
-			g_spawn_close_pid (pid);
+			g_io_add_watch (channel, G_IO_IN, cxp_right_pane_file_found, right_pane);
 		}
 		else
 		{
Index: cxplorer/src/cxplorer-window.c
diff -u cxplorer/src/cxplorer-window.c:1.67.2.3 cxplorer/src/cxplorer-window.c:1.67.2.4
--- cxplorer/src/cxplorer-window.c:1.67.2.3	Sat Oct 15 00:38:40 2005
+++ cxplorer/src/cxplorer-window.c	Sat Oct 22 23:36:38 2005
@@ -589,10 +589,8 @@
 	cmd_utf8 = g_locale_to_utf8(cmd, -1, NULL, NULL, NULL);
 	cid = gtk_statusbar_get_context_id (GTK_STATUSBAR(private->statusbar), "SearchContext");
 	gtk_statusbar_push (GTK_STATUSBAR(private->statusbar), cid, cmd_utf8);
-	while (gtk_events_pending())
-		    gtk_main_iteration();
 	cxp_right_pane_search_file (CXP_RIGHT_PANE(private->right_pane), cmd);
-	gtk_statusbar_pop (GTK_STATUSBAR(private->statusbar), cid);
+	//gtk_statusbar_pop (GTK_STATUSBAR(private->statusbar), cid);
 	g_free (cmd);
 	g_free (cmd_utf8);
 	g_free (pat_locale);


Cxplorer-cvs メーリングリストの案内
Back to archive index