[nautilus-share] Allow actions to be undone without closing window



commit a6e6475421264add418347a1da73b259940aa0dc
Author: Chow Loong Jin <hyperair gmail com>
Date:   Thu Jul 2 16:11:15 2009 +0800

    Allow actions to be undone without closing window
    
    Previously, after clicking "Create Share" or "Modify Share", it is impossible
    to undo the action, i.e. remove the share after creating it, or to re-add the
    share after removing it. This commit fixes that.

 src/nautilus-share.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-share.c b/src/nautilus-share.c
index 1d22ba5..e26eae3 100644
--- a/src/nautilus-share.c
+++ b/src/nautilus-share.c
@@ -415,6 +415,13 @@ property_page_commit (PropertyPage *page)
   if (!is_shared)
     restore_saved_permissions (page->path);
 
+  /* update initially shared state, so that we may undo later on */
+  if (retval)
+    {
+      page->was_initially_shared = is_shared;
+      page->is_dirty = FALSE;
+    }
+
   return retval;
 }
 
@@ -545,6 +552,8 @@ property_page_check_sensitivity (PropertyPage *page)
     apply_is_sensitive = page->was_initially_shared;
 
   gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive);
+  gtk_button_set_label (GTK_BUTTON(page->button_apply),
+			page->was_initially_shared ? _("Modify _Share") : _("Create _Share"));
 }
 
 static void
@@ -641,6 +650,8 @@ button_apply_clicked_cb (GtkButton *button,
     {
       if (page->standalone_window)
 	gtk_widget_destroy (page->standalone_window);
+      else
+        property_page_check_sensitivity (page);
     }
 }
 



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