[nautilus] file-utilities: remove custom inhibit/unhibit methods



commit 042b7990acb0f68432d4a1eed7d410c6b33a94dd
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Apr 26 15:14:08 2012 -0400

    file-utilities: remove custom inhibit/unhibit methods
    
    We use GtkApplication now for this.

 libnautilus-private/nautilus-file-utilities.c |  129 -------------------------
 libnautilus-private/nautilus-file-utilities.h |    4 -
 2 files changed, 0 insertions(+), 133 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c
index 6c655b6..c666f4f 100644
--- a/libnautilus-private/nautilus-file-utilities.c
+++ b/libnautilus-private/nautilus-file-utilities.c
@@ -766,135 +766,6 @@ nautilus_is_file_roller_installed (void)
 	return installed > 0 ? TRUE : FALSE;
 }
 
-#define GSM_NAME  "org.gnome.SessionManager"
-#define GSM_PATH "/org/gnome/SessionManager"
-#define GSM_INTERFACE "org.gnome.SessionManager"
-
-/* The following values come from
- * http://www.gnome.org/~mccann/gnome-session/docs/gnome-session.html#org.gnome.SessionManager.Inhibit 
- */
-#define INHIBIT_LOGOUT (1U)
-#define INHIBIT_SUSPEND (4U)
-
-static GDBusConnection *
-get_dbus_connection (void)
-{
-	static GDBusConnection *conn = NULL;
-
-	if (conn == NULL) {
-		GError *error = NULL;
-
-	        conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
-
-		if (conn == NULL) {
-	                g_warning ("Could not connect to session bus: %s", error->message);
-			g_error_free (error);
-		}
-	}
-
-	return conn;
-}
-
-/**
- * nautilus_inhibit_power_manager:
- * @message: a human readable message for the reason why power management
- *       is being suspended.
- *
- * Inhibits the power manager from logging out or suspending the machine
- * (e.g. whenever Nautilus is doing file operations).
- *
- * Returns: an integer cookie, which must be passed to
- *    nautilus_uninhibit_power_manager() to resume
- *    normal power management.
- */
-int
-nautilus_inhibit_power_manager (const char *message)
-{
-	GDBusConnection *connection;
-	GVariant *result;
-	GError *error = NULL;
-	guint cookie = 0;
-
-	g_return_val_if_fail (message != NULL, -1);
-
-        connection = get_dbus_connection ();
-
-        if (connection == NULL) {
-                return -1;
-        }
-
-	result = g_dbus_connection_call_sync (connection,
-					      GSM_NAME,
-					      GSM_PATH,
-					      GSM_INTERFACE,
-					      "Inhibit",
-					      g_variant_new ("(susu)",
-							     "Nautilus",
-							     (guint) 0,
-							     message,
-							     (guint) (INHIBIT_LOGOUT | INHIBIT_SUSPEND)),
-					      G_VARIANT_TYPE ("(u)"),
-					      G_DBUS_CALL_FLAGS_NO_AUTO_START,
-					      -1,
-					      NULL,
-					      &error);
-
-	if (error != NULL) {
-		g_warning ("Could not inhibit power management: %s", error->message);
-		g_error_free (error);
-		return -1;
-	}
-
-	g_variant_get (result, "(u)", &cookie);
-	g_variant_unref (result);
-
-	return (int) cookie;
-}
-
-/**
- * nautilus_uninhibit_power_manager:
- * @cookie: the cookie value returned by nautilus_inhibit_power_manager()
- *
- * Uninhibits power management. This function must be called after the task
- * which inhibited power management has finished, or the system will not
- * return to normal power management.
- */
-void
-nautilus_uninhibit_power_manager (gint cookie)
-{
-	GDBusConnection *connection;
-	GVariant *result;
-	GError *error = NULL;
-
-	g_return_if_fail (cookie > 0);
-
-	connection = get_dbus_connection ();
-
-	if (connection == NULL) {
-		return;
-	}
-
-	result = g_dbus_connection_call_sync (connection,
-					      GSM_NAME,
-					      GSM_PATH,
-					      GSM_INTERFACE,
-					      "Uninhibit",
-					      g_variant_new ("(u)", (guint) cookie),
-					      NULL,
-					      G_DBUS_CALL_FLAGS_NO_AUTO_START,
-					      -1,
-					      NULL,
-					      &error);
-
-	if (result == NULL) {
-		g_warning ("Could not uninhibit power management: %s", error->message);
-		g_error_free (error);
-		return;
-	}
-
-	g_variant_unref (result);
-}
-
 /* Returns TRUE if the file is in XDG_DATA_DIRS. This is used for
    deciding if a desktop file is "trusted" based on the path */
 gboolean
diff --git a/libnautilus-private/nautilus-file-utilities.h b/libnautilus-private/nautilus-file-utilities.h
index 1ba6d2a..0736ab6 100644
--- a/libnautilus-private/nautilus-file-utilities.h
+++ b/libnautilus-private/nautilus-file-utilities.h
@@ -60,10 +60,6 @@ char *	 nautilus_compute_title_for_location	     (GFile *file);
 
 gboolean nautilus_is_file_roller_installed           (void);
 
-/* Inhibit/Uninhibit GNOME Power Manager */
-int    nautilus_inhibit_power_manager                (const char *message) G_GNUC_WARN_UNUSED_RESULT;
-void     nautilus_uninhibit_power_manager            (int cookie);
-
 /* Return an allocated file name that is guranteed to be unique, but
  * tries to make the name readable to users.
  * This isn't race-free, so don't use for security-related things



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]