Author: lluis
Date: 2006-04-18 08:32:21 -0400 (Tue, 18 Apr 2006)
New Revision: 59588

Modified:
   trunk/stetic/ChangeLog
   trunk/stetic/libstetic/wrapper/Notebook.cs
   trunk/stetic/libstetic/wrapper/objects.xml
   trunk/stetic/stetic/Stetic.cs
Log:
2006-04-18  Lluis Sanchez Gual  <[EMAIL PROTECTED]> 

        * libstetic/wrapper/objects.xml:
        * libstetic/wrapper/Notebook.cs: Disable "Insert Before" and
          "Delete Page" commands when there are no pages in the notebook.
        * stetic/Stetic.cs: Fix crash when deleting a widget.



Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog      2006-04-18 12:17:45 UTC (rev 59587)
+++ trunk/stetic/ChangeLog      2006-04-18 12:32:21 UTC (rev 59588)
@@ -1,3 +1,10 @@
+2006-04-18  Lluis Sanchez Gual  <[EMAIL PROTECTED]> 
+
+       * libstetic/wrapper/objects.xml:
+       * libstetic/wrapper/Notebook.cs: Disable "Insert Before" and
+         "Delete Page" commands when there are no pages in the notebook.
+       * stetic/Stetic.cs: Fix crash when deleting a widget.
+
 2006-04-18  Lluis Sanchez Gual  <[EMAIL PROTECTED]>
 
        * libstetic/wrapper/Widget.cs:

Modified: trunk/stetic/libstetic/wrapper/Notebook.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Notebook.cs  2006-04-18 12:17:45 UTC (rev 
59587)
+++ trunk/stetic/libstetic/wrapper/Notebook.cs  2006-04-18 12:32:21 UTC (rev 
59588)
@@ -172,6 +172,11 @@
                        tabs.RemoveAt (notebook.CurrentPage);
                        notebook.RemovePage (notebook.CurrentPage);
                }
+               
+               internal bool CheckDeletePage ()
+               {
+                       return notebook.NPages > 0;
+               }
 
                internal void SwapPrevious ()
                {
@@ -188,6 +193,11 @@
                        notebook.CurrentPage = InsertPage 
(notebook.CurrentPage);
                }
 
+               internal bool CheckInsertBefore ()
+               {
+                       return notebook.NPages > 0;
+               }
+
                internal void InsertAfter ()
                {
                        notebook.CurrentPage = InsertPage (notebook.CurrentPage 
+ 1);

Modified: trunk/stetic/libstetic/wrapper/objects.xml
===================================================================
--- trunk/stetic/libstetic/wrapper/objects.xml  2006-04-18 12:17:45 UTC (rev 
59587)
+++ trunk/stetic/libstetic/wrapper/objects.xml  2006-04-18 12:32:21 UTC (rev 
59588)
@@ -1066,6 +1066,7 @@
                <property name="Scrollable" />
                <property name="BorderWidth" />
                <command name="InsertBefore" label="Insert Page Before"
+                        check="CheckInsertBefore"
                         description="Insert a blank page before this one" />
                <command name="InsertAfter" label="Insert Page After"
                         description="Insert a blank page after this one" />
@@ -1091,7 +1092,8 @@
                     description="Show the next page"
                     check="CheckNextPage" />
            <command name="DeletePage" label="Delete Page"
-                    description="Delete the current page" />
+                    description="Delete the current page"
+                    check="CheckDeletePage" />
            <command name="SwapPrevious" label="Swap with Previous Page"
                     description="Swap the contents of this page with the 
contents of the previous page"
                     check="CheckPreviousPage" />

Modified: trunk/stetic/stetic/Stetic.cs
===================================================================
--- trunk/stetic/stetic/Stetic.cs       2006-04-18 12:17:45 UTC (rev 59587)
+++ trunk/stetic/stetic/Stetic.cs       2006-04-18 12:32:21 UTC (rev 59588)
@@ -173,9 +173,7 @@
                
                static void OnWidgetRemoved (object s, Wrapper.WidgetEventArgs 
args)
                {
-                       if (args.Widget.IsTopLevel) {
-                               CloseWindow (args.Widget.Wrapped as 
Gtk.Container);
-                       }
+                       CloseWindow (args.Widget.Wrapped as Gtk.Container);
                }
                
                static void OnSelectionChanged (object s, 
Wrapper.WidgetEventArgs args)
@@ -236,10 +234,12 @@
                
                static void CloseWindow (Gtk.Container widget)
                {
-                       Gtk.Widget page = (Gtk.Widget) openWindows [widget];
-                       if (page != null) {
-                               WidgetNotebook.Remove (page);
-                               openWindows.Remove (widget);
+                       if (widget != null) {
+                               Gtk.Widget page = (Gtk.Widget) openWindows 
[widget];
+                               if (page != null) {
+                                       WidgetNotebook.Remove (page);
+                                       openWindows.Remove (widget);
+                               }
                        }
                }
        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to