[PATCH] Use GtkMountOperation.



---
 libnautilus-private/nautilus-file-operations.c |    2 +-
 libnautilus-private/nautilus-mime-actions.c    |   19 ++++++++++++-------
 src/file-manager/fm-directory-view.c           |    7 +++----
 src/nautilus-connect-server-dialog-main.c      |    4 ++--
 src/nautilus-window-manage-views.c             |    3 +--
 5 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index 927d3d2..ecfdb40 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -2218,7 +2218,7 @@ nautilus_file_operations_mount_volume_full (GtkWindow *parent_window,
 {
 	GMountOperation *mount_op;
 
-	mount_op = eel_mount_operation_new (parent_window);
+	mount_op = gtk_mount_operation_new (parent_window);
 	g_object_set_data (G_OBJECT (mount_op),
 			   "mount-callback",
 			   mount_callback);
diff --git a/libnautilus-private/nautilus-mime-actions.c b/libnautilus-private/nautilus-mime-actions.c
index 84d28f5..44c8188 100644
--- a/libnautilus-private/nautilus-mime-actions.c
+++ b/libnautilus-private/nautilus-mime-actions.c
@@ -28,7 +28,6 @@
 #include <eel/eel-glib-extensions.h>
 #include <eel/eel-stock-dialogs.h>
 #include <eel/eel-string.h>
-#include <eel/eel-mount-operation.h>
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
 #include <string.h>
@@ -957,10 +956,14 @@ activation_start_timed_cancel (ActivateParameters *parameters)
 }
 
 static void
-activate_mount_op_active (EelMountOperation *operation,
-			  gboolean is_active,
+activate_mount_op_active (GtkMountOperation *operation,
+			  GParamSpec *pspec,
 			  ActivateParameters *parameters)
 {
+	gboolean is_active;
+
+	g_object_get (operation, "is-showing", &is_active, NULL);
+
 	if (is_active) {
 		if (parameters->timed_wait_active) {
 			eel_timed_wait_stop (cancel_activate_callback, parameters);
@@ -1312,8 +1315,9 @@ activation_mount_not_mounted (ActivateParameters *parameters)
 
 	if (parameters->not_mounted != NULL) {
 		file = parameters->not_mounted->data;
-		mount_op = eel_mount_operation_new (parameters->parent_window);
-		g_signal_connect (mount_op, "active_changed", (GCallback)activate_mount_op_active, parameters);
+		mount_op = gtk_mount_operation_new (parameters->parent_window);
+		g_signal_connect_object (mount_op, "notify::is-showing",
+					 G_CALLBACK (activate_mount_op_active), parameters, 0);
 		location = nautilus_file_get_location (file);
 		g_file_mount_enclosing_volume (location, 0, mount_op, parameters->cancellable,
 					       activation_mount_not_mounted_callback, parameters);
@@ -1550,8 +1554,9 @@ activation_mount_mountables (ActivateParameters *parameters)
 
 	if (parameters->mountables != NULL) {
 		file = parameters->mountables->data;
-		mount_op = eel_mount_operation_new (parameters->parent_window);
-		g_signal_connect (mount_op, "active_changed", (GCallback)activate_mount_op_active, parameters);
+		mount_op = gtk_mount_operation_new (parameters->parent_window);
+		g_signal_connect_object (mount_op, "notify::is-showing",
+					 G_CALLBACK (activate_mount_op_active), parameters, 0);
 		nautilus_file_mount (file,
 				     mount_op,
 				     parameters->cancellable,
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index f94b2f7..5685037 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -38,7 +38,6 @@
 #include "fm-properties-window.h"
 #include "libnautilus-private/nautilus-open-with-dialog.h"
 
-#include <eel/eel-mount-operation.h>
 #include <eel/eel-background.h>
 #include <eel/eel-glib-extensions.h>
 #include <eel/eel-gnome-extensions.h>
@@ -5934,7 +5933,7 @@ action_mount_volume_callback (GtkAction *action,
 		file = NAUTILUS_FILE (l->data);
 		
 		if (nautilus_file_can_mount (file)) {
-			mount_op = eel_mount_operation_new (fm_directory_view_get_containing_window (view));
+			mount_op = gtk_mount_operation_new (fm_directory_view_get_containing_window (view));
 			nautilus_file_mount (file, mount_op, NULL,
 					     NULL, NULL);
 			g_object_unref (mount_op);
@@ -6023,7 +6022,7 @@ action_self_mount_volume_callback (GtkAction *action,
 		return;
 	}
 
-	mount_op = eel_mount_operation_new (fm_directory_view_get_containing_window (view));
+	mount_op = gtk_mount_operation_new (fm_directory_view_get_containing_window (view));
 	nautilus_file_mount (file, mount_op, NULL, NULL, NULL);
 	g_object_unref (mount_op);
 }
@@ -6098,7 +6097,7 @@ action_location_mount_volume_callback (GtkAction *action,
 		return;
 	}
 
-	mount_op = eel_mount_operation_new (fm_directory_view_get_containing_window (view));
+	mount_op = gtk_mount_operation_new (fm_directory_view_get_containing_window (view));
 	nautilus_file_mount (file, mount_op, NULL, NULL, NULL);
 	g_object_unref (mount_op);
 }
diff --git a/src/nautilus-connect-server-dialog-main.c b/src/nautilus-connect-server-dialog-main.c
index 0704d98..e96e853 100644
--- a/src/nautilus-connect-server-dialog-main.c
+++ b/src/nautilus-connect-server-dialog-main.c
@@ -35,7 +35,6 @@
 
 #include <eel/eel-preferences.h>
 #include <eel/eel-stock-dialogs.h>
-#include <eel/eel-mount-operation.h>
 
 #include <libnautilus-private/nautilus-icon-names.h>
 
@@ -150,12 +149,13 @@ nautilus_connect_server_dialog_present_uri (NautilusApplication *application,
 {
 	GMountOperation *op;
 
-	op = eel_mount_operation_new (GTK_WINDOW (widget));
+	op = gtk_mount_operation_new (GTK_WINDOW (widget));
 	g_file_mount_enclosing_volume (location,
 				       0, op,
 				       NULL,
 				       (GAsyncReadyCallback) mount_enclosing_ready_cb,
 				       widget);
+	g_object_unref (op);
 }
 
 int
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index a064356..2224e6a 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -48,7 +48,6 @@
 #include <eel/eel-gtk-macros.h>
 #include <eel/eel-stock-dialogs.h>
 #include <eel/eel-string.h>
-#include <eel/eel-mount-operation.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 #include <glib/gi18n.h>
@@ -1042,7 +1041,7 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
 	    !slot->tried_mount) {
 		slot->tried_mount = TRUE;
 
-		mount_op = eel_mount_operation_new (GTK_WINDOW (window));
+		mount_op = gtk_mount_operation_new (GTK_WINDOW (window));
 		location = nautilus_file_get_location (file);
 		data = g_new0 (MountNotMountedData, 1);
 		data->cancellable = g_cancellable_new ();
-- 
1.5.6.3


--=-T/ZP0O+j/l3A//fB90yI
Content-Disposition: attachment; filename="eel-drop-mount-op.patch"
Content-Type: text/x-patch; name="eel-drop-mount-op.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit

Index: eel/eel-mount-operation.c
===================================================================
--- eel/eel-mount-operation.c	(revision 2182)
+++ eel/eel-mount-operation.c	(working copy)
@@ -1,289 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* eel-mount-operation.c - Gtk+ implementation for GMountOperation
-
-   Copyright (C) 2007 Red Hat, Inc.
-
-   The Gnome Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The Gnome Library 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 Library General Public
-   License along with the Gnome Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
-
-   Author: Alexander Larsson <alexl redhat com>
-*/
-
-#include <config.h>
-#include "eel-i18n.h"
-#include "eel-mount-operation.h"
-#include <libgnomeui/gnome-password-dialog.h>
-#include <gtk/gtk.h>
-#include <string.h>
-
-#define I_(string) g_intern_static_string (string)
-
-G_DEFINE_TYPE (EelMountOperation, eel_mount_operation, G_TYPE_MOUNT_OPERATION);
-
-enum {
-	ACTIVE_CHANGED,
-	LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-struct EelMountOperationPrivate {
-	GtkWindow *parent_window;
-	gboolean is_active;
-};
-	
-static void
-eel_mount_operation_finalize (GObject *object)
-{
-	EelMountOperation *operation;
-	EelMountOperationPrivate *priv;
-
-	operation = EEL_MOUNT_OPERATION (object);
-
-	priv = operation->priv;
-
-	if (priv->parent_window) {
-		g_object_unref (priv->parent_window);
-	}
-  
-	(*G_OBJECT_CLASS (eel_mount_operation_parent_class)->finalize) (object);
-}
-
-static void
-set_active (EelMountOperation *operation,
-	    gboolean is_active)
-{
-	if (operation->priv->is_active != is_active) {
-		operation->priv->is_active = is_active;
-		g_signal_emit (operation, signals[ACTIVE_CHANGED], 0, is_active);
-	}
-}
-
-static void
-password_dialog_button_clicked (GtkDialog *dialog, 
-				gint button_number, 
-				GMountOperation *op)
-{
-	char *username, *domain, *password;
-	gboolean anon;
-	GnomePasswordDialog *gpd;
-
-	gpd = GNOME_PASSWORD_DIALOG (dialog);
-
-	if (button_number == GTK_RESPONSE_OK) {
-		username = gnome_password_dialog_get_username (gpd);
-		if (username) {
-			g_mount_operation_set_username (op, username);
-			g_free (username);
-		}
-
-		domain = gnome_password_dialog_get_domain (gpd);
-		if (domain) {
-			g_mount_operation_set_domain (op, domain);
-			g_free (domain);
-		}
-		
-		password = gnome_password_dialog_get_password (gpd);
-		if (password) {
-			g_mount_operation_set_password (op, password);
-			g_free (password);
-		}
-
-		anon = gnome_password_dialog_anon_selected (gpd);
-		g_mount_operation_set_anonymous (op, anon);
-
-		switch (gnome_password_dialog_get_remember (gpd)) {
-		case GNOME_PASSWORD_DIALOG_REMEMBER_NOTHING:
-			g_mount_operation_set_password_save (op, G_PASSWORD_SAVE_NEVER);
-			break;
-		case GNOME_PASSWORD_DIALOG_REMEMBER_SESSION:
-			g_mount_operation_set_password_save (op, G_PASSWORD_SAVE_FOR_SESSION);
-			break;
-		case GNOME_PASSWORD_DIALOG_REMEMBER_FOREVER:
-			g_mount_operation_set_password_save (op, G_PASSWORD_SAVE_PERMANENTLY);
-			break;
-		}
-
-		g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED);
-	} else {
-		g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED);
-	}
-
-	gtk_widget_destroy (GTK_WIDGET (dialog));
-	set_active (EEL_MOUNT_OPERATION (op), FALSE);
-	g_object_unref (op);
-}
-
-static void
-ask_password (GMountOperation *op,
-	      const char      *message,
-	      const char      *default_user,
-	      const char      *default_domain,
-	      GAskPasswordFlags flags)
-{
-	GtkWidget *dialog;
-
-	dialog = gnome_password_dialog_new (_("Enter Password"),
-					    message,
-					    default_user,
-					    "",
-					    FALSE);
-	gtk_window_set_modal (GTK_WINDOW (dialog), FALSE);
-
-	gnome_password_dialog_set_show_password (GNOME_PASSWORD_DIALOG (dialog),
-						 flags & G_ASK_PASSWORD_NEED_PASSWORD);
-	
-	gnome_password_dialog_set_show_username (GNOME_PASSWORD_DIALOG (dialog),
-						 flags & G_ASK_PASSWORD_NEED_USERNAME);
-	gnome_password_dialog_set_show_domain (GNOME_PASSWORD_DIALOG (dialog),
-					       flags & G_ASK_PASSWORD_NEED_DOMAIN);
-	gnome_password_dialog_set_show_userpass_buttons	(GNOME_PASSWORD_DIALOG (dialog),
-							 flags & G_ASK_PASSWORD_ANONYMOUS_SUPPORTED);
-	gnome_password_dialog_set_show_remember (GNOME_PASSWORD_DIALOG (dialog),
-						 flags & G_ASK_PASSWORD_SAVING_SUPPORTED);
-	
-	if (default_domain) {
-		gnome_password_dialog_set_domain (GNOME_PASSWORD_DIALOG (dialog),
-						  default_domain);
-	}
-		
-	if (EEL_MOUNT_OPERATION (op)->priv->parent_window != NULL) {
-		gtk_window_set_transient_for (GTK_WINDOW (dialog),
-					      EEL_MOUNT_OPERATION (op)->priv->parent_window);
-	}
-
-	g_signal_connect (dialog, "response", 
-			  G_CALLBACK (password_dialog_button_clicked), op);
-
-	set_active (EEL_MOUNT_OPERATION (op), TRUE);
-	gtk_widget_show (GTK_WIDGET (dialog));
-	g_object_ref (op);
-}
-
-
-static void
-question_dialog_button_clicked (GtkDialog *dialog, 
-				gint button_number, 
-				GMountOperation *op)
-{
-	if (button_number >= 0) {
-		g_mount_operation_set_choice (op, button_number);
-		g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED);
-	} else {
-		g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED);
-	}
-	
-	gtk_widget_destroy (GTK_WIDGET (dialog));
-	set_active (EEL_MOUNT_OPERATION (op), FALSE);
-	g_object_unref (op);
-}
-
-  
-static void
-ask_question (GMountOperation *op,
-	      const char      *message,
-	      const char      *choices[])
-{
-	GtkWidget *dialog;
-	int cnt, len;
-	char *primary;
-	const char *secondary = NULL;
-
-	primary = strstr (message, "\n");
-	if (primary) {
-		secondary = primary + 1;
-		primary = g_strndup (message, strlen (message) - strlen (primary));
-	}
-	
-	dialog = gtk_message_dialog_new (EEL_MOUNT_OPERATION (op)->priv->parent_window,
-					 0, GTK_MESSAGE_QUESTION,
-					 GTK_BUTTONS_NONE, "%s", primary != NULL ? primary : message);
-	g_free (primary);
-
-	if (secondary) {
-		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-							  "%s", secondary);
-	}
-	
-	if (choices) {
-		/* First count the items in the list then 
-		 * add the buttons in reverse order */
-		for (len = 0; choices[len] != NULL; len++) {
-			;
-		}
-		
-		for (cnt = len - 1; cnt >= 0; cnt--) {
-			gtk_dialog_add_button (GTK_DIALOG (dialog), choices[cnt], cnt);
-		}
-	}
-
-
-	g_signal_connect (GTK_OBJECT(dialog), "response", 
-			  G_CALLBACK (question_dialog_button_clicked), op);
-
-	set_active (EEL_MOUNT_OPERATION (op), TRUE);
-	
-	gtk_widget_show (GTK_WIDGET (dialog));
-
-	g_object_ref (op);
-}
-
-static void
-eel_mount_operation_class_init (EelMountOperationClass *klass)
-{
-	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-	GMountOperationClass *gmountoperation_class = G_MOUNT_OPERATION_CLASS (klass);
-
-	g_type_class_add_private (klass, sizeof (EelMountOperationPrivate));
-	
-	gobject_class->finalize = eel_mount_operation_finalize;
-	
-	gmountoperation_class->ask_password = ask_password;
-	gmountoperation_class->ask_question = ask_question;
-
-
-	signals[ACTIVE_CHANGED] =
-		g_signal_new (I_("active_changed"),
-			      G_TYPE_FROM_CLASS (gobject_class),
-			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (EelMountOperationClass, active_changed),
-			      NULL, NULL,
-			      g_cclosure_marshal_VOID__BOOLEAN,
-			      G_TYPE_NONE, 1,
-			      G_TYPE_BOOLEAN);
-}
-
-static void
-eel_mount_operation_init (EelMountOperation *operation)
-{
-	operation->priv = G_TYPE_INSTANCE_GET_PRIVATE (operation,
-						       EEL_TYPE_MOUNT_OPERATION,
-						       EelMountOperationPrivate);
-}
-
-GMountOperation *
-eel_mount_operation_new (GtkWindow *parent)
-{
-	EelMountOperation *mount_operation;
-
-	mount_operation = g_object_new (eel_mount_operation_get_type (), NULL);
-
-	if (parent) {
-		mount_operation->priv->parent_window = g_object_ref (parent);
-	}
-
-	return G_MOUNT_OPERATION (mount_operation);
-}
Index: eel/eel-mount-operation.h
===================================================================
--- eel/eel-mount-operation.h	(revision 2182)
+++ eel/eel-mount-operation.h	(working copy)
@@ -1,70 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* eel-mount-operation.h - Gtk+ implementation for GMountOperation
-
-   Copyright (C) 2007 Red Hat, Inc.
-
-   The Gnome Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   The Gnome Library 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 Library General Public
-   License along with the Gnome Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
-
-   Author: Alexander Larsson <alexl redhat com>
-*/
-
-#ifndef EEL_MOUNT_OPERATION_H
-#define EEL_MOUNT_OPERATION_H
-
-#include <glib.h>
-#include <gio/gio.h>
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define EEL_TYPE_MOUNT_OPERATION         (eel_mount_operation_get_type ())
-#define EEL_MOUNT_OPERATION(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EEL_TYPE_MOUNT_OPERATION, EelMountOperation))
-#define EEL_MOUNT_OPERATION_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), EEL_TYPE_MOUNT_OPERATION, EelMountOperationClass))
-#define EEL_IS_MOUNT_OPERATION(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EEL_TYPE_MOUNT_OPERATION))
-#define EEL_IS_MOUNT_OPERATION_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), EEL_TYPE_MOUNT_OPERATION))
-#define EEL_MOUNT_OPERATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EEL_TYPE_MOUNT_OPERATION, EelMountOperationClass))
-
-typedef struct EelMountOperation	    EelMountOperation;
-typedef struct EelMountOperationClass       EelMountOperationClass;
-typedef struct EelMountOperationPrivate     EelMountOperationPrivate;
-
-struct EelMountOperation
-{
-	GMountOperation parent_instance;
-	
-	EelMountOperationPrivate *priv;
-};
-
-struct EelMountOperationClass 
-{
-	GMountOperationClass parent_class;
-
-
-	/* signals: */
-
-	void (* active_changed) (EelMountOperation *operation,
-				 gboolean is_active);
-};
-
-GType            eel_mount_operation_get_type (void);
-GMountOperation *eel_mount_operation_new      (GtkWindow *parent);
-
-G_END_DECLS
-
-#endif /* EEL_MOUNT_OPERATION_H */
-
-

--=-T/ZP0O+j/l3A//fB90yI--



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