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

Back to archive index

Yasumichi Akahoshi yasum****@users*****
2005年 2月 11日 (金) 01:20:46 JST


Index: cxplorer/src/cxp-right-pane.c
diff -u cxplorer/src/cxp-right-pane.c:1.11 cxplorer/src/cxp-right-pane.c:1.12
--- cxplorer/src/cxp-right-pane.c:1.11	Fri Feb 11 00:36:53 2005
+++ cxplorer/src/cxp-right-pane.c	Fri Feb 11 01:20:46 2005
@@ -2,6 +2,7 @@
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
+#include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -1011,3 +1012,29 @@
 	}
 }
 
+void cxp_right_pane_send_file_to_command (CxpRightPane *right_pane, const gchar *cmd)
+{
+	gchar *fullpath;
+	gchar *fullcmd;
+	GError *gerror = NULL;
+	GtkWidget *dialog;
+
+	g_return_if_fail(cmd != NULL);
+
+	fullpath = cxp_right_pane_get_active_file_name (right_pane);
+	fullcmd = g_strdup_printf("%s '%s'", cmd, fullpath);
+	if(g_spawn_command_line_async (fullcmd, &gerror) == FALSE)
+	{
+		dialog = gtk_message_dialog_new (NULL,
+				GTK_DIALOG_DESTROY_WITH_PARENT,
+				GTK_MESSAGE_ERROR,
+				GTK_BUTTONS_CLOSE,
+				"%s",
+				gerror->message);
+		gtk_dialog_run (GTK_DIALOG (dialog));
+		gtk_widget_destroy (dialog);
+	}
+	g_free(fullcmd);
+	g_free(fullpath);
+}
+
Index: cxplorer/src/cxp-right-pane.h
diff -u cxplorer/src/cxp-right-pane.h:1.7 cxplorer/src/cxp-right-pane.h:1.8
--- cxplorer/src/cxp-right-pane.h:1.7	Fri Feb 11 00:36:53 2005
+++ cxplorer/src/cxp-right-pane.h	Fri Feb 11 01:20:46 2005
@@ -65,5 +65,6 @@
 void cxp_right_pane_delete_current_file (CxpRightPane *right_pane);
 void cxp_right_pane_paste_from_clipboard (CxpRightPane *right_pane);
 void cxp_right_pane_rename_file_request (CxpRightPane *right_pane);
+void cxp_right_pane_send_file_to_command (CxpRightPane *right_pane, const gchar *cmd);
 
 #endif /* CXP_RIGHT_PANE_H */
Index: cxplorer/src/menubar.c
diff -u cxplorer/src/menubar.c:1.29 cxplorer/src/menubar.c:1.30
--- cxplorer/src/menubar.c:1.29	Fri Feb 11 00:36:53 2005
+++ cxplorer/src/menubar.c	Fri Feb 11 01:20:46 2005
@@ -5,7 +5,7 @@
  * This file contains functions which related menubar.
  * @author Yasumichi Akahoshi <yasum****@users*****>
  * @date Tue Jun  8 22:32:55 2004
- * $Revision: 1.29 $
+ * $Revision: 1.30 $
  ****************************************************************************/
 
 #ifdef HAVE_CONFIG_H
@@ -356,35 +356,34 @@
  */
 void on_attach_activate (GtkMenuItem * menuitem, gpointer user_data)
 {
-	/*
-	Cxplorer *cxplorer;
-	gchar gcFormat[] = "sylpheed --attach %s";
-	gchar *gcFullPath;
-	GString *gsCommand;
-	GtkTreeIter gtIter;
-	GtkTreeModel *gtModel;
-	GtkTreeSelection *gtSelection;
+	Cxplorer *cxplorer = (Cxplorer *) user_data;
+	gchar *cmd;
+	gchar *cmd_format;
+	gchar *fullpath;
+	GError *gerror = NULL;
+	GtkWidget *dialog;
 
-	cxplorer = (Cxplorer *) user_data;
-	gtSelection =
-		gtk_tree_view_get_selection (GTK_TREE_VIEW
-					     (cxplorer->gwFileListView));
-	if (gtk_tree_selection_get_selected (gtSelection, &gtModel, &gtIter))
+
+	cmd_format = cxp_profile_get_string (cxplorer->profile, "AttachCommand", "sylpheed --attach %s");
+	if((fullpath = cxp_right_pane_get_active_file_name (CXP_RIGHT_PANE(cxplorer->right_pane))) != NULL)
 	{
-		gtk_tree_model_get (gtModel, &gtIter,
-				    FVC_FILE_PATH, &gcFullPath, FVC_TERMINATOR);
-		if (g_file_test (gcFullPath, G_FILE_TEST_IS_REGULAR))
+		cmd = g_strdup_printf(cmd_format, fullpath);
+		g_print("%s\n", cmd);
+		if(g_spawn_command_line_async (cmd, &gerror) == FALSE)
 		{
-			gsCommand = g_string_new ("");
-			*/
-			/* @todo check gcFormat */
-			/*
-			g_string_printf (gsCommand, gcFormat, gcFullPath);
-			g_spawn_command_line_async (gsCommand->str, NULL);
-			g_string_free (gsCommand, TRUE);
+			dialog = gtk_message_dialog_new (NULL,
+					GTK_DIALOG_DESTROY_WITH_PARENT,
+					GTK_MESSAGE_ERROR,
+					GTK_BUTTONS_CLOSE,
+					"%s",
+					gerror->message);
+			gtk_dialog_run (GTK_DIALOG (dialog));
+			gtk_widget_destroy (dialog);
 		}
+		
+		g_free(fullpath);
 	}
-	*/
+	g_free(cmd);
 }
 
 /**


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