seed r232 - trunk/examples/ide



Author: hortont
Date: Mon Nov 10 13:30:09 2008
New Revision: 232
URL: http://svn.gnome.org/viewvc/seed?rev=232&view=rev

Log:
More IDE message area cleanup.


Modified:
   trunk/examples/ide/ide-actions.js
   trunk/examples/ide/ide-messagearea.js
   trunk/examples/ide/ide-sourceview.js

Modified: trunk/examples/ide/ide-actions.js
==============================================================================
--- trunk/examples/ide/ide-actions.js	(original)
+++ trunk/examples/ide/ide-actions.js	Mon Nov 10 13:30:09 2008
@@ -26,7 +26,7 @@
 
 function save_file()
 {
-    current_tab().source_view.save();
+    return current_tab().source_view.save();
 }
 
 function undo()

Modified: trunk/examples/ide/ide-messagearea.js
==============================================================================
--- trunk/examples/ide/ide-messagearea.js	(original)
+++ trunk/examples/ide/ide-messagearea.js	Mon Nov 10 13:30:09 2008
@@ -48,6 +48,7 @@
     	{
     		this.tab = tab;
     		
+			this.set_buttons([{stock:Gtk.STOCK_CLOSE,callback:this.hide_message}]);
     		this.set_message(msg, submsg);
     		this.set_icon(icon);
     		
@@ -56,7 +57,8 @@
     	
     	prototype.set_buttons = function (buttons)
     	{
-    		this.button_hbox.destroy();
+    		if(this.button_hbox)
+    			this.button_hbox.destroy();
 			this.button_hbox = new Gtk.HBox({spacing: 6});
 			
     		for(but in buttons)
@@ -108,13 +110,7 @@
 		this.text_vbox.pack_start(this.text, true, true, 4);
 		this.text_vbox.pack_start(this.detail, true, true, 4);
 		
-		this.close = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE);
-		this.close.signal.clicked.connect(this.hide_message, this);
-		this.button_hbox = new Gtk.HBox({spacing: 6});
-		this.button_hbox.pack_start(this.close);
-		
 		this.button_vbox = new Gtk.VBox({border_width: 6});
-		this.button_vbox.pack_start(this.button_hbox, false, true);
 		
 		this.inner_box.pack_start(this.icon);
 		this.inner_box.pack_start(this.text_vbox, true, true);

Modified: trunk/examples/ide/ide-sourceview.js
==============================================================================
--- trunk/examples/ide/ide-sourceview.js	(original)
+++ trunk/examples/ide/ide-sourceview.js	Mon Nov 10 13:30:09 2008
@@ -36,7 +36,8 @@
             }
             catch(e)
             {
-            	var title = "Could not load the file <i>" + this.filename + "</i>.";
+            	var filename = this.filename.split("/").slice(-1);
+            	var title = "Could not load the file <i>" + filename + "</i>.";
             	this.tab.message_area.show_with_message(title,
             				e.message, Gtk.STOCK_DIALOG_ERROR, this.tab);
             }
@@ -75,7 +76,8 @@
 				}
 				catch(e)
 				{
-					var title = "Could not save the file <i>" + this.filename + "</i>.";
+					var filename = this.filename.split("/").slice(-1);
+					var title = "Could not save the file <i>" + filename + "</i>.";
             		this.tab.message_area.show_with_message(title,
             				e.message, Gtk.STOCK_DIALOG_ERROR, this.tab);
 				}
@@ -87,6 +89,10 @@
         prototype.query_save = function ()
         {
         	var filename = this.filename.split("/").slice(-1);
+        	
+        	if(filename == "")
+        		filename = "Untitled";
+        	
         	var ma = current_tab().message_area;
 			ma.tab = current_tab();
 			ma.set_icon(Gtk.STOCK_DIALOG_WARNING);
@@ -94,10 +100,10 @@
 						   "Would you like to save it, or close, and lose changes?");
 			ma.set_buttons([{stock:Gtk.STOCK_CLOSE, callback:tab_view.force_close_current_tab},
 							{stock:Gtk.STOCK_CANCEL, callback:ma.hide_message},
-							{stock:Gtk.STOCK_SAVE, callback:function(){save_file();ma.hide_message();}}]);
+							{stock:Gtk.STOCK_SAVE, callback:function(){if(!save_file()) ma.hide_message();}}]);
 			ma.show_message();
     		
-    		return false; // false = we didn't save, so don't close; true = we saved, so it's OK
+    		return false;
         }
         
         prototype.exception_clear = function ()



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