diff options
Diffstat (limited to 'src/caja-application.c')
-rw-r--r-- | src/caja-application.c | 224 |
1 files changed, 0 insertions, 224 deletions
diff --git a/src/caja-application.c b/src/caja-application.c index 85285304..62873184 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -619,183 +619,6 @@ automount_all_volumes_idle_cb (gpointer data) } static void -check_volume_queue (CajaApplication *application) -{ - GList *l, *next; - GVolume *volume; - - l = application->volume_queue; - - if (application->screensaver_active) - { - return; - } - - while (l != NULL) { - volume = l->data; - next = l->next; - - caja_file_operations_mount_volume (NULL, volume, TRUE); - application->volume_queue = - g_list_remove (application->volume_queue, volume); - - g_object_unref (volume); - l = next; - } - - application->volume_queue = NULL; -} - -#define SCREENSAVER_NAME "org.mate.ScreenSaver" -#define SCREENSAVER_PATH "/org/mate/ScreenSaver" -#define SCREENSAVER_INTERFACE "org.mate.ScreenSaver" - -static void -screensaver_signal_callback (GDBusProxy *proxy, - const gchar *sender_name, - const gchar *signal_name, - GVariant *parameters, - gpointer user_data) -{ - CajaApplication *application = user_data; - - if (g_strcmp0 (signal_name, "ActiveChanged") == 0) - { - g_variant_get (parameters, "(b)", &application->screensaver_active); - g_debug ("Screensaver active changed to %d", application->screensaver_active); - - check_volume_queue (application); - } -} - -static void -screensaver_get_active_ready_cb (GObject *source, - GAsyncResult *res, - gpointer user_data) -{ - CajaApplication *application = user_data; - GDBusProxy *proxy = application->ss_proxy; - GVariant *result; - GError *error = NULL; - - result = g_dbus_proxy_call_finish (proxy, - res, - &error); - - if (error != NULL) { - g_warning ("Can't call GetActive() on the ScreenSaver object: %s", - error->message); - g_error_free (error); - - return; - } - - g_variant_get (result, "(b)", &application->screensaver_active); - g_variant_unref (result); - - g_debug ("Screensaver GetActive() returned %d", application->screensaver_active); -} - -static void -screensaver_proxy_ready_cb (GObject *source, - GAsyncResult *res, - gpointer user_data) -{ - CajaApplication *application = user_data; - GError *error = NULL; - GDBusProxy *ss_proxy; - - ss_proxy = g_dbus_proxy_new_finish (res, &error); - - if (error != NULL) - { - g_warning ("Can't get proxy for the ScreenSaver object: %s", - error->message); - g_error_free (error); - - return; - } - - g_debug ("ScreenSaver proxy ready"); - - application->ss_proxy = ss_proxy; - - g_signal_connect (ss_proxy, "g-signal", - G_CALLBACK (screensaver_signal_callback), application); - - g_dbus_proxy_call (ss_proxy, - "GetActive", - NULL, - G_DBUS_CALL_FLAGS_NO_AUTO_START, - -1, - NULL, - screensaver_get_active_ready_cb, - application); -} - -static void -screensaver_appeared_callback (GDBusConnection *connection, - const gchar *name, - const gchar *name_owner, - gpointer user_data) -{ - CajaApplication *application = user_data; - - g_debug ("ScreenSaver name appeared"); - - application->screensaver_active = FALSE; - - g_dbus_proxy_new (connection, - G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, - NULL, - name, - SCREENSAVER_PATH, - SCREENSAVER_INTERFACE, - NULL, - screensaver_proxy_ready_cb, - application); -} - -static void -screensaver_vanished_callback (GDBusConnection *connection, - const gchar *name, - gpointer user_data) -{ - CajaApplication *application = user_data; - - g_debug ("ScreenSaver name vanished"); - - application->screensaver_active = FALSE; - if (application->ss_proxy != NULL) - { - g_object_unref (application->ss_proxy); - application->ss_proxy = NULL; - } - - /* in this case force a clear of the volume queue, without - * mounting them. - */ - if (application->volume_queue != NULL) - { - g_list_free_full (application->volume_queue, g_object_unref); - application->volume_queue = NULL; - } -} - -static void -do_initialize_screensaver (CajaApplication *application) -{ - application->ss_watch_id = - g_bus_watch_name (G_BUS_TYPE_SESSION, - SCREENSAVER_NAME, - G_BUS_NAME_WATCHER_FLAGS_NONE, - screensaver_appeared_callback, - screensaver_vanished_callback, - application, - NULL); -} - -static void selection_get_cb (GtkWidget *widget, GtkSelectionData *selection_data, guint info, @@ -1548,53 +1371,6 @@ mount_removed_callback (GVolumeMonitor *monitor, } static char * -icon_to_string (GIcon *icon) -{ - const char * const *names; - GFile *file; - - if (icon == NULL) - { - return NULL; - } - else if (G_IS_THEMED_ICON (icon)) - { - names = g_themed_icon_get_names (G_THEMED_ICON (icon)); - return g_strjoinv (":", (char **)names); - } - else if (G_IS_FILE_ICON (icon)) - { - file = g_file_icon_get_file (G_FILE_ICON (icon)); - return g_file_get_path (file); - } - return NULL; -} - -static GIcon * -icon_from_string (const char *string) -{ - GFile *file; - GIcon *icon; - gchar **names; - - if (g_path_is_absolute (string)) - { - file = g_file_new_for_path (string); - icon = g_file_icon_new (file); - g_object_unref (file); - return icon; - } - else - { - names = g_strsplit (string, ":", 0); - icon = g_themed_icon_new_from_names (names, -1); - g_strfreev (names); - return icon; - } - return NULL; -} - -static char * caja_application_get_session_data (CajaApplication *self) { xmlDocPtr doc; |