[Xfce4-commits] r25296 - squeeze/trunk/libsqueeze

Stephan Arts stephan at xfce.org
Mon Mar 26 11:33:35 CEST 2007


Author: stephan
Date: 2007-03-26 09:33:35 +0000 (Mon, 26 Mar 2007)
New Revision: 25296

Added:
   squeeze/trunk/libsqueeze/xfce-launch-command.c
   squeeze/trunk/libsqueeze/xfce-launch-command.h
Removed:
   squeeze/trunk/libsqueeze/dbus-command.c
   squeeze/trunk/libsqueeze/dbus-command.h
Modified:
   squeeze/trunk/libsqueeze/Makefile.am
   squeeze/trunk/libsqueeze/command-builder.c
   squeeze/trunk/libsqueeze/libsqueeze-module.h
Log:
open / view (or how you want to call it) works, though it is a bit of a hack

Modified: squeeze/trunk/libsqueeze/Makefile.am
===================================================================
--- squeeze/trunk/libsqueeze/Makefile.am	2007-03-25 18:37:16 UTC (rev 25295)
+++ squeeze/trunk/libsqueeze/Makefile.am	2007-03-26 09:33:35 UTC (rev 25296)
@@ -14,7 +14,7 @@
 	archive-command.c archive-command.h \
 	spawn-command.c spawn-command.h \
 	macro-command.c macro-command.h \
-	dbus-command.c dbus-command.h \
+	xfce-launch-command.c xfce-launch-command.h \
 	archive-tempfs.c archive-tempfs.h \
 	builder-settings.c builder-settings.h \
 	command-builder.c command-builder.h \

Modified: squeeze/trunk/libsqueeze/command-builder.c
===================================================================
--- squeeze/trunk/libsqueeze/command-builder.c	2007-03-25 18:37:16 UTC (rev 25295)
+++ squeeze/trunk/libsqueeze/command-builder.c	2007-03-26 09:33:35 UTC (rev 25296)
@@ -28,11 +28,6 @@
 #include "archive-iter.h"
 #include "archive-tempfs.h"
 #include "archive.h"
-#include "archive-command.h"
-#include "macro-command.h"
-#include "spawn-command.h"
-#include "dbus-command.h"
-#include "command-builder.h"
 #include "builder-settings.h"
 
 static void
@@ -124,7 +119,8 @@
 lsq_command_builder_build_open(LSQCommandBuilder *builder, LSQArchive *archive, GSList *files)
 {
 	LSQArchiveCommand *extract = builder->build_extract(builder, archive, lsq_tempfs_get_root_dir(archive), files);
-	LSQArchiveCommand *launch = lsq_dbus_command_new("Execute", archive, "org.xfce.FileManager", "/org/xfce/FileManager","org.xfce.FileManager", "Launch");
+	LSQArchiveCommand *launch = lsq_xfce_launch_command_new("Execute", 
+	                                                 archive, lsq_tempfs_get_root_dir(archive), files);
 	LSQArchiveCommand *macro = lsq_macro_command_new("Open", archive);
 
 	lsq_macro_command_append(LSQ_MACRO_COMMAND(macro), extract);

Deleted: squeeze/trunk/libsqueeze/dbus-command.c

Deleted: squeeze/trunk/libsqueeze/dbus-command.h

Modified: squeeze/trunk/libsqueeze/libsqueeze-module.h
===================================================================
--- squeeze/trunk/libsqueeze/libsqueeze-module.h	2007-03-25 18:37:16 UTC (rev 25295)
+++ squeeze/trunk/libsqueeze/libsqueeze-module.h	2007-03-26 09:33:35 UTC (rev 25296)
@@ -16,13 +16,14 @@
 #ifndef __LIBSQUEEZE_MODULE_H__
 #define __LIBSQUEEZE_MODULE_H__ 
 
+#include <dbus/dbus.h>
 #include <dbus/dbus-glib.h>
 #include <libsqueeze/libsqueeze-archive.h>
 #include <libsqueeze/libsqueeze-command.h>
 #include <libsqueeze/archive-command.h>
 #include <libsqueeze/macro-command.h>
 #include <libsqueeze/spawn-command.h>
-#include <libsqueeze/dbus-command.h>
+#include <libsqueeze/xfce-launch-command.h>
 #include <libsqueeze/builder-settings.h>
 #include <libsqueeze/command-builder.h>
 #include <libsqueeze/internals.h>

Copied: squeeze/trunk/libsqueeze/xfce-launch-command.c (from rev 25295, squeeze/trunk/libsqueeze/dbus-command.c)
===================================================================
--- squeeze/trunk/libsqueeze/xfce-launch-command.c	                        (rev 0)
+++ squeeze/trunk/libsqueeze/xfce-launch-command.c	2007-03-26 09:33:35 UTC (rev 25296)
@@ -0,0 +1,157 @@
+/* 
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or 
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+#include <glib-object.h> 
+#include <signal.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <thunar-vfs/thunar-vfs.h>
+
+#include "libsqueeze-module.h"
+#include "archive-iter.h"
+#include "archive-command.h"
+#include "xfce-launch-command.h"
+#include "archive.h"
+
+static void
+lsq_xfce_launch_command_class_init(LSQXfceLaunchCommandClass *);
+static void
+lsq_xfce_launch_command_init(LSQXfceLaunchCommand *);
+static void
+lsq_xfce_launch_command_dispose(GObject *object);
+static void
+lsq_xfce_launch_command_finalize(GObject *object);
+
+static gboolean
+lsq_xfce_launch_command_execute(LSQArchiveCommand *command);
+
+//static gint lsq_archive_command_signals[0];
+
+static GObjectClass *parent_class;
+
+GType
+lsq_xfce_launch_command_get_type ()
+{
+	static GType lsq_xfce_launch_command_type = 0;
+
+ 	if (!lsq_xfce_launch_command_type)
+	{
+ 		static const GTypeInfo lsq_xfce_launch_command_info = 
+		{
+			sizeof (LSQXfceLaunchCommandClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) lsq_xfce_launch_command_class_init,
+			(GClassFinalizeFunc) NULL,
+			NULL,
+			sizeof (LSQXfceLaunchCommand),
+			0,
+			(GInstanceInitFunc) lsq_xfce_launch_command_init,
+			NULL
+		};
+
+		lsq_xfce_launch_command_type = g_type_register_static (LSQ_TYPE_ARCHIVE_COMMAND, "LSQXfceLaunchCommand", &lsq_xfce_launch_command_info, 0);
+	}
+	return lsq_xfce_launch_command_type;
+}
+
+static void
+lsq_xfce_launch_command_class_init(LSQXfceLaunchCommandClass *xfce_launch_command_class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS(xfce_launch_command_class);
+
+	object_class->dispose = lsq_xfce_launch_command_dispose;
+	object_class->finalize = lsq_xfce_launch_command_finalize;
+
+	parent_class = g_type_class_peek(LSQ_TYPE_ARCHIVE_COMMAND); 
+
+}
+
+static void
+lsq_xfce_launch_command_init(LSQXfceLaunchCommand *xfce_launch_command)
+{
+	LSQArchiveCommand *command = LSQ_ARCHIVE_COMMAND(xfce_launch_command);
+	command->execute = lsq_xfce_launch_command_execute;
+}
+
+/**
+ * lsq_xfce_launch_command_dispose:
+ *
+ * @object: LSQXfceLaunchCommand object
+ *
+ */
+static void
+lsq_xfce_launch_command_dispose(GObject *object)
+{
+	parent_class->dispose(object);
+}
+
+/**
+ * lsq_xfce_launch_command_finalize:
+ *
+ * @object: LSQXfceLaunchCommand object
+ *
+ */
+static void
+lsq_xfce_launch_command_finalize(GObject *object)
+{
+	parent_class->finalize(object);
+}
+
+
+/**
+ * lsq_xfce_launch_command_new:
+ * @comment: a description, describing what the command does
+ * @archive: the archive the command modifies
+ * 
+ * Returns: a new LSQXfceLaunchCommand object
+ */
+LSQArchiveCommand *
+lsq_xfce_launch_command_new(const gchar *comment, LSQArchive *archive, const gchar *prefix, GSList *files)
+{
+	GError *error = NULL;
+	LSQArchiveCommand *archive_command;
+
+	archive_command = g_object_new(lsq_xfce_launch_command_get_type(), NULL);
+
+	LSQXfceLaunchCommand    *xfce_launch_command = LSQ_XFCE_LAUNCH_COMMAND(archive_command);
+
+	xfce_launch_command->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+
+	xfce_launch_command->proxy = dbus_g_proxy_new_for_name(xfce_launch_command->connection, 
+	                                                       "org.xfce.FileManager",
+	                                                       "/org/xfce/FileManager",
+	                                                       "org.xfce.FileManager");
+	
+	archive_command->archive = archive;
+	xfce_launch_command->files = g_strconcat(prefix, files->data, NULL);
+
+	return archive_command;
+}
+
+static gboolean
+lsq_xfce_launch_command_execute(LSQArchiveCommand *command)
+{
+	LSQXfceLaunchCommand *xfce_launch_command = LSQ_XFCE_LAUNCH_COMMAND(command);
+	
+	/* args */
+	dbus_g_proxy_call(xfce_launch_command->proxy, "Launch", NULL, G_TYPE_STRING, xfce_launch_command->files, G_TYPE_STRING, "",  NULL);
+	return TRUE;
+}

Copied: squeeze/trunk/libsqueeze/xfce-launch-command.h (from rev 25295, squeeze/trunk/libsqueeze/dbus-command.h)
===================================================================
--- squeeze/trunk/libsqueeze/xfce-launch-command.h	                        (rev 0)
+++ squeeze/trunk/libsqueeze/xfce-launch-command.h	2007-03-26 09:33:35 UTC (rev 25296)
@@ -0,0 +1,62 @@
+/*
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software 
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+ */
+
+#ifndef __LIBSQUEEZE_XFCE_LAUNCH_COMMAND_H__
+#define __LIBSQUEEZE_XFCE_LAUNCH_COMMAND_H__ 
+G_BEGIN_DECLS
+
+#define LSQ_TYPE_XFCE_LAUNCH_COMMAND lsq_xfce_launch_command_get_type()
+
+#define LSQ_XFCE_LAUNCH_COMMAND(obj)         ( \
+		G_TYPE_CHECK_INSTANCE_CAST ((obj),    \
+			LSQ_TYPE_XFCE_LAUNCH_COMMAND,      \
+			LSQXfceLaunchCommand))
+
+#define LSQ_IS_XFCE_LAUNCH_COMMAND(obj)      ( \
+		G_TYPE_CHECK_INSTANCE_TYPE ((obj),    \
+			LSQ_TYPE_XFCE_LAUNCH_COMMAND))
+
+#define LSQ_XFCE_LAUNCH_COMMAND_CLASS(class) ( \
+		G_TYPE_CHECK_CLASS_CAST ((class),     \
+			LSQ_TYPE_XFCE_LAUNCH_COMMAND,      \
+			LSQXfceLaunchCommandClass))
+
+#define LSQ_IS_XFCE_LAUNCH_COMMAND_CLASS(class) ( \
+		G_TYPE_CHECK_CLASS_TYPE ((class),        \
+			LSQ_TYPE_XFCE_LAUNCH_COMMAND))
+
+typedef struct _LSQXfceLaunchCommand LSQXfceLaunchCommand;
+
+struct _LSQXfceLaunchCommand
+{
+	LSQArchiveCommand  parent;
+	DBusGConnection *connection;
+	DBusGProxy      *proxy;
+	gchar *files;
+};
+
+typedef struct _LSQXfceLaunchCommandClass LSQXfceLaunchCommandClass;
+
+struct _LSQXfceLaunchCommandClass
+{
+	LSQArchiveCommandClass parent;
+}; 
+
+GType               lsq_xfce_launch_command_get_type();
+LSQArchiveCommand  *lsq_xfce_launch_command_new(const gchar *comment, LSQArchive *archive, const gchar *, GSList *files);
+void                lsq_xfce_launch_command_set_args(LSQXfceLaunchCommand *command);
+
+G_END_DECLS
+#endif /* __LIBSQUEEZE_XFCE_LAUNCH_COMMAND_H__ */



More information about the Xfce4-commits mailing list