rpms/libgnomeui/devel filechooser-auth.patch, NONE, 1.1 .cvsignore, 1.51, 1.52 libgnomeui.spec, 1.94, 1.95 sources, 1.51, 1.52

Matthias Clasen (mclasen) fedora-extras-commits at redhat.com
Wed Apr 9 18:03:07 UTC 2008


Author: mclasen

Update of /cvs/extras/rpms/libgnomeui/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20808

Modified Files:
	.cvsignore libgnomeui.spec sources 
Added Files:
	filechooser-auth.patch 
Log Message:
2.22.1


filechooser-auth.patch:

--- NEW FILE filechooser-auth.patch ---
diff -up libgnomeui-2.22.1/file-chooser/gtkfilesystemgio.c.filechooser-auth libgnomeui-2.22.1/file-chooser/gtkfilesystemgio.c
--- libgnomeui-2.22.1/file-chooser/gtkfilesystemgio.c.filechooser-auth	2008-04-09 13:54:15.000000000 -0400
+++ libgnomeui-2.22.1/file-chooser/gtkfilesystemgio.c	2008-04-09 13:54:30.000000000 -0400
@@ -25,6 +25,7 @@
 #include <gtk/gtk.h>
 #include <string.h>
 #include "gtkfilesystemgio.h"
+#include <libgnomeui/gnome-password-dialog.h>
 
 #define GTK_FILE_SYSTEM_GIO_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c),   GTK_TYPE_FILE_SYSTEM_GIO, GtkFileSystemGioClass))
 #define GTK_IS_FILE_SYSTEM_GIO_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c),   GTK_TYPE_FILE_SYSTEM_GIO))
@@ -90,6 +91,8 @@ struct GtkFileSystemHandleGio
   gpointer callback;
   gpointer data;
   guint tried_mount : 1;
+  
+  GMountOperation *mount_op;
 };
 
 struct GtkFileFolderGioClass
@@ -248,6 +251,144 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (GtkFileF
 				MODULE_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_FOLDER,
 							    gtk_file_folder_gio_iface_init))
 
+
+
+/* GMountOperation callbacks */
+static void
+mount_op_ask_password (GMountOperation *op,
+	      const char      *message,
+	      const char      *default_user,
+	      const char      *default_domain,
+	      GAskPasswordFlags flags)
+{
+	GtkWidget *dialog;
+	char *username, *domain, *password;
+	gboolean anon;
+	int res;
+
+	gdk_threads_enter ();
+
+	dialog = gnome_password_dialog_new (_("Enter Password"),
+					    message,
+					    default_user,
+					    "",
+					    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);
+	}
+
+	res = gtk_dialog_run (GTK_DIALOG (dialog));
+	if (res == GTK_RESPONSE_OK) {
+		username = gnome_password_dialog_get_username (GNOME_PASSWORD_DIALOG (dialog));
+		if (username) {
+			g_mount_operation_set_username (op, username);
+			g_free (username);
+		}
+
+		domain = gnome_password_dialog_get_domain (GNOME_PASSWORD_DIALOG (dialog));
+		if (domain) {
+			g_mount_operation_set_domain (op, domain);
+			g_free (domain);
+		}
+		
+		password = gnome_password_dialog_get_password (GNOME_PASSWORD_DIALOG (dialog));
+		if (password) {
+			g_mount_operation_set_password (op, password);
+			g_free (password);
+		}
+
+		anon = gnome_password_dialog_anon_selected (GNOME_PASSWORD_DIALOG (dialog));
+		g_mount_operation_set_anonymous (op, anon);
+
+		switch (gnome_password_dialog_get_remember (GNOME_PASSWORD_DIALOG (dialog))) {
+		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));
+	gdk_threads_leave ();
+}
+
+static void
+mount_op_ask_question (GMountOperation *op,
+	      const char      *message,
+	      const char      *choices[])
+{
+	GtkWidget *dialog;
+	int cnt, len;
+	char *primary;
+	const char *secondary = NULL;
+	int res;
+
+	primary = strstr (message, "\n");
+	if (primary) {
+		secondary = primary + 1;
+		primary = g_strndup (message, strlen (message) - strlen (primary));
+	}
+
+	gdk_threads_enter ();
+	dialog = gtk_message_dialog_new (NULL,
+					 0, GTK_MESSAGE_QUESTION,
+					 GTK_BUTTONS_NONE, "%s", primary);
+	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);
+		}
+	}
+
+	res = gtk_dialog_run (GTK_DIALOG (dialog));
+	if (res >= 0) {
+		g_mount_operation_set_choice (op, res);
+		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));
+	gdk_threads_leave ();
+}
+
+
+
 /* GtkFileSystemGio methods */
 static void
 gtk_file_system_gio_class_init (GtkFileSystemGioClass *class)
@@ -501,6 +642,7 @@ gtk_file_system_handle_gio_class_finaliz
 static void
 gtk_file_system_handle_gio_init (GtkFileSystemHandleGio *impl)
 {
+  impl->mount_op = NULL;
 }
 
 static void
@@ -939,11 +1081,21 @@ mount_async_callback (GObject      *sour
     }
   else
     {
+      /* This is a dirty hack to indicate gtk+ that user has cancelled the password dialog.
+       * Trying to avoid checking G_IO_ERROR values in gtkfilechooserdefault.c directly
+       * which would cause a need to link libgio to gtk lib. */
+      if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED)) {
+    	  error->domain = G_FILE_ERROR;
+    	  error->code = G_FILE_ERROR_INTR;
+      }
+
       gdk_threads_enter ();
       ((GtkFileSystemGetInfoCallback) handle->callback) (GTK_FILE_SYSTEM_HANDLE (handle),
 							 NULL, error, handle->data);
       gdk_threads_leave ();
     }
+  if (handle->mount_op)
+    g_object_unref (handle->mount_op);
 }
 
 static void
@@ -956,6 +1108,7 @@ query_info_callback (GObject      *sourc
   GError *error = NULL;
   GFileInfo *file_info;
   GFile *file;
+  GMountOperation *mount_op;
 
   DEBUG ("query_info_callback");
 
@@ -973,7 +1126,15 @@ query_info_callback (GObject      *sourc
       /* If it's not mounted, try to mount it ourselves */
       g_error_free (error);
       handle->tried_mount = TRUE;
-      g_file_mount_enclosing_volume (file, G_MOUNT_MOUNT_NONE, NULL,
+
+      mount_op = g_mount_operation_new ();
+      handle->mount_op = mount_op;
+      g_signal_connect (mount_op, "ask-password",
+			G_CALLBACK (mount_op_ask_password), handle);
+      g_signal_connect (mount_op, "ask-question",
+			G_CALLBACK (mount_op_ask_question), handle);
+
+      g_file_mount_enclosing_volume (file, G_MOUNT_MOUNT_NONE, mount_op,
 				     handle->cancellable,
 				     mount_async_callback,
 				     handle);
@@ -1204,6 +1365,9 @@ volume_mount_cb (GObject *source_object,
                                                          error, handle->data);
   gdk_threads_leave ();
 
+  if (handle->mount_op)
+      g_object_unref (handle->mount_op);
+      
   if (error)
     g_error_free (error);
 }
@@ -1262,8 +1426,14 @@ gtk_file_system_gio_volume_mount (GtkFil
       GMountOperation *mount_op;
 
       mount_op = g_mount_operation_new ();
+      handle->mount_op = mount_op;
+
+      g_signal_connect (mount_op, "ask-password",
+			G_CALLBACK (mount_op_ask_password), handle);
+      g_signal_connect (mount_op, "ask-question",
+			G_CALLBACK (mount_op_ask_question), handle);
+      
       g_volume_mount (volume, 0, mount_op, handle->cancellable, volume_mount_cb, handle);
-      g_object_unref (mount_op);
     }
 
   return GTK_FILE_SYSTEM_HANDLE (handle);


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/libgnomeui/devel/.cvsignore,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- .cvsignore	10 Mar 2008 21:50:39 -0000	1.51
+++ .cvsignore	9 Apr 2008 18:02:18 -0000	1.52
@@ -1 +1 @@
-libgnomeui-2.22.01.tar.bz2
+libgnomeui-2.22.1.tar.bz2


Index: libgnomeui.spec
===================================================================
RCS file: /cvs/extras/rpms/libgnomeui/devel/libgnomeui.spec,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- libgnomeui.spec	10 Mar 2008 21:50:39 -0000	1.94
+++ libgnomeui.spec	9 Apr 2008 18:02:18 -0000	1.95
@@ -17,12 +17,11 @@
 
 Summary: GNOME base GUI library
 Name: libgnomeui
-Version: 2.22.01
+Version: 2.22.1
 Release: 1%{?dist}
 URL: http://www.gnome.org
 Source0: http://download.gnome.org/sources/libgnomeui/2.22/%{name}-%{version}.tar.bz2
-# http://bugzilla.gnome.org/show_bug.cgi?id=517276
-Patch0: gio-thumbnail.patch
+#
 
 License: LGPLv2+
 Group: System Environment/Libraries
@@ -86,6 +85,9 @@
 Requires: libICE-devel
 Requires: pkgconfig
 
+# http://bugzilla.gnome.org/show_bug.cgi?id=521032
+Patch0: filechooser-auth.patch
+
 Conflicts: gnome-libs-devel < 1.4.1.2
 Conflicts: gdk-pixbuf-devel <= 0.11
 
@@ -104,7 +106,7 @@
 
 %prep
 %setup -q
-%patch0 -p1 -b .gio-thumbnail
+%patch0 -p1 -b .filechooser-auth
 
 aclocal
 automake
@@ -150,6 +152,10 @@
 %{_datadir}/gtk-doc/html/libgnomeui
 
 %changelog
+* Wed Apr  9 2008 Matthias Clasen <mclasen at redhat.com> - 2.22.1-1
+- Update to 2.22.1 (filechooser crash fixes)
+- Implement authentication support for the file chooser (Tomas Bzatek)
+
 * Mon Mar 10 2008 Matthias Clasen <mclasen at redhat.com> - 2.22.01-1
 - Update to 2.22.01
 


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/libgnomeui/devel/sources,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- sources	10 Mar 2008 21:50:39 -0000	1.51
+++ sources	9 Apr 2008 18:02:18 -0000	1.52
@@ -1 +1 @@
-7d2bb24361f90201bcbf1327e1498251  libgnomeui-2.22.01.tar.bz2
+5a60405f006e873ba7bc97ec9c8e4c5d  libgnomeui-2.22.1.tar.bz2




More information about the fedora-extras-commits mailing list