[maemo-commits] [maemo-commits] r15477 - in projects/haf/trunk/hildon-fm: . hildon-fm

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Apr 23 17:13:53 EEST 2008
Author: marivoll
Date: 2008-04-23 17:13:52 +0300 (Wed, 23 Apr 2008)
New Revision: 15477

Modified:
   projects/haf/trunk/hildon-fm/ChangeLog
   projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-details-dialog.c
Log:
	* hildon-fm/hildon-file-details-dialog.c (change_state): Don't use
	the dialog as the parent for showing the information banner, it is
	already gone.
	(can_change_permissions): New.
	(hildon_file_details_dialog_set_file_iter): Use it to set the
	sensitivity of the read-only checkbox.


Modified: projects/haf/trunk/hildon-fm/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-fm/ChangeLog	2008-04-23 09:28:38 UTC (rev 15476)
+++ projects/haf/trunk/hildon-fm/ChangeLog	2008-04-23 14:13:52 UTC (rev 15477)
@@ -1,3 +1,12 @@
+2008-04-23  Marius Vollmer  <marius.vollmer at nokia.com>
+
+	* hildon-fm/hildon-file-details-dialog.c (change_state): Don't use
+	the dialog as the parent for showing the information banner, it is
+	already gone.
+	(can_change_permissions): New.
+	(hildon_file_details_dialog_set_file_iter): Use it to set the
+	sensitivity of the read-only checkbox.
+
 2008-04-17  Marius Vollmer  <marius.vollmer at nokia.com>
 
 	Released 2.0.3

Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-details-dialog.c
===================================================================
--- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-details-dialog.c	2008-04-23 09:28:38 UTC (rev 15476)
+++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-details-dialog.c	2008-04-23 14:13:52 UTC (rev 15477)
@@ -147,6 +147,26 @@
   return result;
 }
 
+static gboolean can_change_permissions (const gchar *uri)
+{
+  GnomeVFSFileInfo *info;
+  gboolean result = FALSE;
+
+  /* Get information about file */
+  info = gnome_vfs_file_info_new ();
+  if ((gnome_vfs_get_file_info (uri, info, GNOME_VFS_FILE_INFO_DEFAULT)
+       == GNOME_VFS_OK)
+      && (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS))
+    {
+      result = (gnome_vfs_set_file_info (uri, info,
+					 GNOME_VFS_SET_FILE_INFO_PERMISSIONS)
+		== GNOME_VFS_OK);
+    }
+
+  gnome_vfs_file_info_unref(info);
+  return result;
+}
+
 /* When model deletes a file, we check if our reference is still valid.
    If not, we emit response, which usually closes the dialog */
 static void check_validity(GtkTreeModel *model,
@@ -197,9 +217,9 @@
     }
 
     if (result != GNOME_VFS_OK)
-      hildon_banner_show_information (GTK_WIDGET (self), NULL,
-                                      gnome_vfs_result_to_string (result));
-
+      hildon_banner_show_information (NULL, NULL,
+				      gnome_vfs_result_to_string (result));
+    
     gnome_vfs_file_info_unref(info);
     g_free(uri);
   }
@@ -863,9 +883,12 @@
   g_signal_handler_block(self->priv->file_readonly, self->priv->toggle_handler);
 
   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(self->priv->file_readonly),
-    location_readonly || !write_access(uri));
-  gtk_widget_set_sensitive(self->priv->file_readonly, !location_readonly);
+			       location_readonly || !write_access(uri));
 
+  gtk_widget_set_sensitive(self->priv->file_readonly,
+			   (!location_readonly
+			    && can_change_permissions (uri)));
+
   self->priv->checkbox_original_state = gtk_toggle_button_get_active(
         GTK_TOGGLE_BUTTON(self->priv->file_readonly));
 


More information about the maemo-commits mailing list