Explorar el Código

Simlify console

Daniele Bartolini hace 12 años
padre
commit
1cd0b9acf6

+ 4 - 5
tools/gui/console/MainWindow.cs

@@ -492,7 +492,6 @@ public partial class MainWindow: Gtk.Window
 	protected void SendScript(String script)
 	{
 		string json = "{\"type\":\"script\",\"script\":\"" + script + "\"}";
-
 		Send(json);
 	}
 
@@ -534,12 +533,12 @@ public partial class MainWindow: Gtk.Window
 			Connect();
 
 			// Sanitize entered text
-			string safe_text = text.Replace("\"", "\\\""); 
+			string safe_text = text.Replace("\"", "\\\"");
 
-			if (combobox1.Active == 0) {
-				SendScript (safe_text);
+			if (safe_text[0] == '\\') {
+				SendCommand (safe_text.Substring(1));
 			} else {
-				SendCommand (safe_text);
+				SendScript (safe_text);	
 			}
 
 			// Log entered text

+ 6 - 25
tools/gui/console/gtk-gui/MainWindow.cs

@@ -10,8 +10,6 @@ public partial class MainWindow
 	private global::Gtk.MenuBar menubar1;
 	private global::Gtk.ScrolledWindow scrolledwindow1;
 	private global::Gtk.TextView textview1;
-	private global::Gtk.HBox hbox2;
-	private global::Gtk.ComboBox combobox1;
 	private global::Gtk.Entry entry1;
 
 	protected virtual void Build ()
@@ -59,34 +57,17 @@ public partial class MainWindow
 		global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.scrolledwindow1]));
 		w4.Position = 1;
 		// Container child vbox1.Gtk.Box+BoxChild
-		this.hbox2 = new global::Gtk.HBox ();
-		this.hbox2.Name = "hbox2";
-		this.hbox2.Spacing = 6;
-		// Container child hbox2.Gtk.Box+BoxChild
-		this.combobox1 = global::Gtk.ComboBox.NewText ();
-		this.combobox1.AppendText (global::Mono.Unix.Catalog.GetString ("Script"));
-		this.combobox1.AppendText (global::Mono.Unix.Catalog.GetString ("Command"));
-		this.combobox1.Name = "combobox1";
-		this.combobox1.Active = 0;
-		this.hbox2.Add (this.combobox1);
-		global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.combobox1]));
-		w5.Position = 0;
-		w5.Expand = false;
-		w5.Fill = false;
-		// Container child hbox2.Gtk.Box+BoxChild
 		this.entry1 = new global::Gtk.Entry ();
 		this.entry1.CanFocus = true;
 		this.entry1.Name = "entry1";
 		this.entry1.IsEditable = true;
 		this.entry1.InvisibleChar = '●';
-		this.hbox2.Add (this.entry1);
-		global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.entry1]));
-		w6.Position = 1;
-		this.vbox1.Add (this.hbox2);
-		global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.hbox2]));
-		w7.Position = 2;
-		w7.Expand = false;
-		w7.Fill = false;
+		this.vbox1.Add (this.entry1);
+		global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.entry1]));
+		w5.PackType = ((global::Gtk.PackType)(1));
+		w5.Position = 2;
+		w5.Expand = false;
+		w5.Fill = false;
 		this.Add (this.vbox1);
 		if ((this.Child != null)) {
 			this.Child.ShowAll ();

+ 7 - 31
tools/gui/console/gtk-gui/gui.stetic

@@ -65,40 +65,16 @@
           </packing>
         </child>
         <child>
-          <widget class="Gtk.HBox" id="hbox2">
+          <widget class="Gtk.Entry" id="entry1">
             <property name="MemberName" />
-            <property name="Spacing">6</property>
-            <child>
-              <widget class="Gtk.ComboBox" id="combobox1">
-                <property name="MemberName" />
-                <property name="IsTextCombo">True</property>
-                <property name="Items" translatable="yes">Script
-Command</property>
-                <property name="Active">0</property>
-              </widget>
-              <packing>
-                <property name="Position">0</property>
-                <property name="AutoSize">True</property>
-                <property name="Expand">False</property>
-                <property name="Fill">False</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="Gtk.Entry" id="entry1">
-                <property name="MemberName" />
-                <property name="CanFocus">True</property>
-                <property name="IsEditable">True</property>
-                <property name="InvisibleChar">●</property>
-                <signal name="Activated" handler="OnEntryActivated" />
-                <signal name="KeyPressEvent" handler="OnEntryKeyPressed" />
-              </widget>
-              <packing>
-                <property name="Position">1</property>
-                <property name="AutoSize">True</property>
-              </packing>
-            </child>
+            <property name="CanFocus">True</property>
+            <property name="IsEditable">True</property>
+            <property name="InvisibleChar">●</property>
+            <signal name="Activated" handler="OnEntryActivated" />
+            <signal name="KeyPressEvent" handler="OnEntryKeyPressed" />
           </widget>
           <packing>
+            <property name="PackType">End</property>
             <property name="Position">2</property>
             <property name="AutoSize">True</property>
             <property name="Expand">False</property>