summaryrefslogtreecommitdiff
path: root/src/caja-application.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2013-02-23 22:02:09 +0100
committerStefano Karapetsas <[email protected]>2013-02-23 22:02:09 +0100
commitd1715e4fdef385cea4eda116090311dcff9fcd18 (patch)
tree1c86cab85e0e254924edb953560cac3a94626521 /src/caja-application.c
parente99cd96502845cce688ee4f545eb4a4f2edfb23a (diff)
downloadcaja-d1715e4fdef385cea4eda116090311dcff9fcd18.tar.bz2
caja-d1715e4fdef385cea4eda116090311dcff9fcd18.tar.xz
Add support for freedesktop.org File Manager DBus Interface
http://www.freedesktop.org/wiki/Specifications/file-manager-interface Most of code is adapted from Nautilus: http://git.gnome.org/browse/nautilus/tree/src/nautilus-freedesktop-dbus.c Closes https://github.com/mate-desktop/mate-file-manager/issues/3
Diffstat (limited to 'src/caja-application.c')
-rw-r--r--src/caja-application.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/caja-application.c b/src/caja-application.c
index f70fbae7..b4f180f5 100644
--- a/src/caja-application.c
+++ b/src/caja-application.c
@@ -55,6 +55,7 @@
#include "libcaja-private/caja-file-operations.h"
#include "caja-window-private.h"
#include "caja-window-manage-views.h"
+#include "caja-freedesktop-dbus.h"
#include <unistd.h>
#include <libxml/xmlsave.h>
#include <glib/gstdio.h>
@@ -107,6 +108,9 @@ static GList *caja_application_spatial_window_list;
/* The saving of the accelerator map was requested */
static gboolean save_of_accel_map_requested = FALSE;
+/* File Manager DBus Interface */
+static CajaFreedesktopDBus *fdb_manager = NULL;
+
static void desktop_changed_callback (gpointer user_data);
static void desktop_location_changed_callback (gpointer user_data);
static void mount_removed_callback (GVolumeMonitor *monitor,
@@ -370,6 +374,12 @@ caja_application_finalize (GObject *object)
application->proxy = NULL;
}
+ if (fdb_manager != NULL)
+ {
+ g_object_unref (fdb_manager);
+ fdb_manager = NULL;
+ }
+
G_OBJECT_CLASS (caja_application_parent_class)->finalize (object);
}
@@ -846,6 +856,29 @@ open_windows (CajaApplication *application,
}
}
+void
+caja_application_open_location (CajaApplication *application,
+ GFile *location,
+ GFile *selection,
+ const char *startup_id)
+{
+ CajaWindow *window;
+ GList *sel_list = NULL;
+
+ window = caja_application_create_navigation_window (application, startup_id, gdk_screen_get_default ());
+
+ if (selection != NULL) {
+ sel_list = g_list_prepend (NULL, g_object_ref (selection));
+ }
+
+ caja_window_slot_open_location_full (caja_window_get_active_slot (window), location,
+ 0, CAJA_WINDOW_OPEN_FLAG_NEW_WINDOW, sel_list, NULL, NULL);
+
+ if (sel_list != NULL) {
+ caja_file_list_free (sel_list);
+ }
+}
+
static UniqueResponse
message_received_cb (UniqueApp *unique_app,
gint command,
@@ -985,6 +1018,9 @@ caja_application_startup (CajaApplication *application,
g_signal_connect (application->unique_app, "message-received", G_CALLBACK (message_received_cb), application);
}
+ /* Start the File Manager DBus Interface */
+ fdb_manager = caja_freedesktop_dbus_new (application);
+
/* Monitor the preference to show or hide the desktop */
g_signal_connect_swapped (mate_background_preferences,
"changed::" MATE_BG_KEY_SHOW_DESKTOP,