moserial r25 - in trunk: . data/glade src



Author: mjc
Date: Tue Mar 17 13:06:03 2009
New Revision: 25
URL: http://svn.gnome.org/viewvc/moserial?rev=25&view=rev

Log:
2009-03-17  Michael J. Chudobiak  <mjc svn gnome org>

        * data/glade/moserial.glade:
        * data/glade/moserial.ui:
        Added a recent files submenu.

        * src/Main.vala:
        Mangle command-line filename argument appropriately.

        * src/MainWindow.vala:
        Added recent files support.
        Refactored profile loading, to reduce duplicated code.



Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/data/glade/moserial.glade
   trunk/data/glade/moserial.ui
   trunk/src/Main.vala
   trunk/src/MainWindow.vala

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Tue Mar 17 13:06:03 2009
@@ -1,3 +1,10 @@
+Version 1.0.8
+-------------
+
+	* Added a recent files chooser submenu.
+
+	Updates docs: Swedish (sv)
+
 Version 1.0.7
 -------------
 

Modified: trunk/data/glade/moserial.glade
==============================================================================
--- trunk/data/glade/moserial.glade	(original)
+++ trunk/data/glade/moserial.glade	Tue Mar 17 13:06:03 2009
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Mon Mar 16 13:37:24 2009 -->
+<!--Generated with glade3 3.4.5 on Tue Mar 17 08:32:06 2009 -->
 <glade-interface>
   <widget class="GtkWindow" id="window">
     <property name="title" translatable="yes">moserial</property>
@@ -11,7 +11,7 @@
       <widget class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
         <child>
-          <widget class="GtkMenuBar" id="menubar1">
+          <widget class="GtkMenuBar" id="menubar">
             <property name="visible">True</property>
             <child>
               <widget class="GtkMenuItem" id="menuitem1">
@@ -35,6 +35,13 @@
                       </widget>
                     </child>
                     <child>
+                      <widget class="GtkMenuItem" id="menubar_open_recent">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Open _Recent</property>
+                        <property name="use_underline">True</property>
+                      </widget>
+                    </child>
+                    <child>
                       <widget class="GtkSeparatorMenuItem" id="menuitem5">
                         <property name="visible">True</property>
                         <property name="label" translatable="yes">menuitem5</property>
@@ -591,268 +598,268 @@
                 <property name="n_rows">8</property>
                 <property name="n_columns">2</property>
                 <child>
-                  <widget class="GtkCheckButton" id="settings_local_echo">
+                  <widget class="GtkComboBox" id="settings_open_for">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="tooltip" translatable="yes">Normally disabled</property>
-                    <property name="label" translatable="yes">Echo received data</property>
-                    <property name="response_id">0</property>
-                    <property name="draw_indicator">True</property>
+                    <property name="items" translatable="yes">Read and Write
+Read Only
+Write Only</property>
                   </widget>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">7</property>
-                    <property name="bottom_attach">8</property>
-                    <property name="x_padding">2</property>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
+                    <property name="y_options">GTK_EXPAND</property>
                     <property name="y_padding">2</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label26">
+                  <widget class="GtkHBox" id="hbox3">
                     <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Local Echo</property>
+                    <child>
+                      <widget class="GtkCheckButton" id="settings_hardware_handshake">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="tooltip" translatable="yes">Also known as RTS/CTS handshaking</property>
+                        <property name="label" translatable="yes">Hardware</property>
+                        <property name="response_id">0</property>
+                        <property name="draw_indicator">True</property>
+                      </widget>
+                      <packing>
+                        <property name="padding">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkCheckButton" id="settings_software_handshake">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="tooltip" translatable="yes">Also known as XON/XOFF handshaking</property>
+                        <property name="label" translatable="yes">Software</property>
+                        <property name="response_id">0</property>
+                        <property name="draw_indicator">True</property>
+                      </widget>
+                      <packing>
+                        <property name="padding">2</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
-                    <property name="top_attach">7</property>
-                    <property name="bottom_attach">8</property>
-                    <property name="x_padding">4</property>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label1">
+                  <widget class="GtkComboBox" id="settings_parity">
                     <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Device</property>
+                    <property name="items" translatable="yes">None
+Odd
+Even
+Mark
+Space</property>
                   </widget>
                   <packing>
-                    <property name="x_padding">4</property>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                    <property name="y_options">GTK_EXPAND</property>
+                    <property name="y_padding">2</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label2">
+                  <widget class="GtkComboBox" id="settings_stop_bits">
                     <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Baud Rate</property>
+                    <property name="items" translatable="yes">1
+2</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
-                    <property name="x_padding">4</property>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                    <property name="y_options">GTK_EXPAND</property>
+                    <property name="y_padding">2</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label3">
+                  <widget class="GtkComboBox" id="settings_data_bits">
                     <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Data Bits</property>
+                    <property name="items" translatable="yes">5
+6
+7
+8</property>
                   </widget>
                   <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
                     <property name="top_attach">2</property>
                     <property name="bottom_attach">3</property>
-                    <property name="x_padding">4</property>
+                    <property name="y_options">GTK_EXPAND</property>
+                    <property name="y_padding">2</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label4">
+                  <widget class="GtkComboBox" id="settings_baud_rate">
                     <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Stop Bits</property>
+                    <property name="items" translatable="yes">300
+600
+1200
+2400
+4800
+9600
+19200
+38400
+57600
+115200
+230400
+460800
+576000
+927600</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
-                    <property name="x_padding">4</property>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="y_options">GTK_EXPAND</property>
+                    <property name="y_padding">2</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label5">
+                  <widget class="GtkComboBoxEntry" id="settings_device">
                     <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Parity</property>
+                    <property name="items" translatable="yes">/dev/ttyS0
+/dev/ttyS1
+/dev/ttyS2
+/dev/ttyS3
+/dev/ttyUSB0
+/dev/ttyUSB1
+/dev/ttyUSB2
+/dev/ttyUSB3</property>
+                    <child internal-child="entry">
+                      <widget class="GtkEntry" id="comboboxentry-entry1">
+                      </widget>
+                    </child>
                   </widget>
                   <packing>
-                    <property name="top_attach">4</property>
-                    <property name="bottom_attach">5</property>
-                    <property name="x_padding">4</property>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="y_options">GTK_EXPAND</property>
+                    <property name="y_padding">2</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label7">
+                  <widget class="GtkLabel" id="label8">
                     <property name="visible">True</property>
                     <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Handshake</property>
+                    <property name="label" translatable="yes">Access Mode</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">5</property>
-                    <property name="bottom_attach">6</property>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
                     <property name="x_padding">4</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label8">
+                  <widget class="GtkLabel" id="label7">
                     <property name="visible">True</property>
                     <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Access Mode</property>
+                    <property name="label" translatable="yes">Handshake</property>
                   </widget>
                   <packing>
-                    <property name="top_attach">6</property>
-                    <property name="bottom_attach">7</property>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
                     <property name="x_padding">4</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkComboBoxEntry" id="settings_device">
+                  <widget class="GtkLabel" id="label5">
                     <property name="visible">True</property>
-                    <property name="items" translatable="yes">/dev/ttyS0
-/dev/ttyS1
-/dev/ttyS2
-/dev/ttyS3
-/dev/ttyUSB0
-/dev/ttyUSB1
-/dev/ttyUSB2
-/dev/ttyUSB3</property>
-                    <child internal-child="entry">
-                      <widget class="GtkEntry" id="comboboxentry-entry1">
-                      </widget>
-                    </child>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Parity</property>
                   </widget>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="y_options">GTK_EXPAND</property>
-                    <property name="y_padding">2</property>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                    <property name="x_padding">4</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkComboBox" id="settings_baud_rate">
+                  <widget class="GtkLabel" id="label4">
                     <property name="visible">True</property>
-                    <property name="items" translatable="yes">300
-600
-1200
-2400
-4800
-9600
-19200
-38400
-57600
-115200
-230400
-460800
-576000
-927600</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Stop Bits</property>
                   </widget>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
-                    <property name="y_options">GTK_EXPAND</property>
-                    <property name="y_padding">2</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                    <property name="x_padding">4</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkComboBox" id="settings_data_bits">
+                  <widget class="GtkLabel" id="label3">
                     <property name="visible">True</property>
-                    <property name="items" translatable="yes">5
-6
-7
-8</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Data Bits</property>
                   </widget>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
                     <property name="top_attach">2</property>
                     <property name="bottom_attach">3</property>
-                    <property name="y_options">GTK_EXPAND</property>
-                    <property name="y_padding">2</property>
+                    <property name="x_padding">4</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkComboBox" id="settings_stop_bits">
+                  <widget class="GtkLabel" id="label2">
                     <property name="visible">True</property>
-                    <property name="items" translatable="yes">1
-2</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Baud Rate</property>
                   </widget>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
-                    <property name="y_options">GTK_EXPAND</property>
-                    <property name="y_padding">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_padding">4</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkComboBox" id="settings_parity">
+                  <widget class="GtkLabel" id="label1">
                     <property name="visible">True</property>
-                    <property name="items" translatable="yes">None
-Odd
-Even
-Mark
-Space</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Device</property>
                   </widget>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">4</property>
-                    <property name="bottom_attach">5</property>
-                    <property name="y_options">GTK_EXPAND</property>
-                    <property name="y_padding">2</property>
+                    <property name="x_padding">4</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkHBox" id="hbox3">
+                  <widget class="GtkLabel" id="label26">
                     <property name="visible">True</property>
-                    <child>
-                      <widget class="GtkCheckButton" id="settings_hardware_handshake">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="tooltip" translatable="yes">Also known as RTS/CTS handshaking</property>
-                        <property name="label" translatable="yes">Hardware</property>
-                        <property name="response_id">0</property>
-                        <property name="draw_indicator">True</property>
-                      </widget>
-                      <packing>
-                        <property name="padding">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <widget class="GtkCheckButton" id="settings_software_handshake">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="tooltip" translatable="yes">Also known as XON/XOFF handshaking</property>
-                        <property name="label" translatable="yes">Software</property>
-                        <property name="response_id">0</property>
-                        <property name="draw_indicator">True</property>
-                      </widget>
-                      <packing>
-                        <property name="padding">2</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Local Echo</property>
                   </widget>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                    <property name="top_attach">5</property>
-                    <property name="bottom_attach">6</property>
+                    <property name="top_attach">7</property>
+                    <property name="bottom_attach">8</property>
+                    <property name="x_padding">4</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkComboBox" id="settings_open_for">
+                  <widget class="GtkCheckButton" id="settings_local_echo">
                     <property name="visible">True</property>
-                    <property name="items" translatable="yes">Read and Write
-Read Only
-Write Only</property>
+                    <property name="can_focus">True</property>
+                    <property name="tooltip" translatable="yes">Normally disabled</property>
+                    <property name="label" translatable="yes">Echo received data</property>
+                    <property name="response_id">0</property>
+                    <property name="draw_indicator">True</property>
                   </widget>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">6</property>
-                    <property name="bottom_attach">7</property>
-                    <property name="y_options">GTK_EXPAND</property>
+                    <property name="top_attach">7</property>
+                    <property name="bottom_attach">8</property>
+                    <property name="x_padding">2</property>
                     <property name="y_padding">2</property>
                   </packing>
                 </child>
@@ -1051,13 +1058,19 @@
         <property name="visible">True</property>
         <property name="n_rows">4</property>
         <child>
-          <widget class="GtkLabel" id="stop_recording_label">
+          <widget class="GtkLabel" id="disconnect_label">
             <property name="visible">True</property>
-            <property name="label" translatable="yes">Stop Recording</property>
+            <property name="label" translatable="yes">Disconnect</property>
+          </widget>
+        </child>
+        <child>
+          <widget class="GtkLabel" id="connect_label">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Connect</property>
           </widget>
           <packing>
-            <property name="top_attach">3</property>
-            <property name="bottom_attach">4</property>
+            <property name="top_attach">1</property>
+            <property name="bottom_attach">2</property>
           </packing>
         </child>
         <child>
@@ -1071,21 +1084,15 @@
           </packing>
         </child>
         <child>
-          <widget class="GtkLabel" id="connect_label">
+          <widget class="GtkLabel" id="stop_recording_label">
             <property name="visible">True</property>
-            <property name="label" translatable="yes">Connect</property>
+            <property name="label" translatable="yes">Stop Recording</property>
           </widget>
           <packing>
-            <property name="top_attach">1</property>
-            <property name="bottom_attach">2</property>
+            <property name="top_attach">3</property>
+            <property name="bottom_attach">4</property>
           </packing>
         </child>
-        <child>
-          <widget class="GtkLabel" id="disconnect_label">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Disconnect</property>
-          </widget>
-        </child>
       </widget>
     </child>
   </widget>

Modified: trunk/data/glade/moserial.ui
==============================================================================
--- trunk/data/glade/moserial.ui	(original)
+++ trunk/data/glade/moserial.ui	Tue Mar 17 13:06:03 2009
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!--Generated with glade3 3.4.5 on Mon Mar 16 13:37:24 2009 -->
+<!--Generated with glade3 3.4.5 on Tue Mar 17 08:32:06 2009 -->
 <interface>
   <object class="GtkAdjustment" id="adjustment1">
     <property name="upper">5000</property>
@@ -85,32 +85,71 @@
     </columns>
     <data>
       <row>
-        <col id="0">/dev/ttyS0</col>
+        <col id="0">Read and Write</col>
       </row>
       <row>
-        <col id="0">/dev/ttyS1</col>
+        <col id="0">Read Only</col>
       </row>
       <row>
-        <col id="0">/dev/ttyS2</col>
+        <col id="0">Write Only</col>
       </row>
+    </data>
+  </object>
+  <object class="GtkListStore" id="model4">
+    <columns>
+      <column type="gchararray"/>
+    </columns>
+    <data>
       <row>
-        <col id="0">/dev/ttyS3</col>
+        <col id="0">None</col>
       </row>
       <row>
-        <col id="0">/dev/ttyUSB0</col>
+        <col id="0">Odd</col>
       </row>
       <row>
-        <col id="0">/dev/ttyUSB1</col>
+        <col id="0">Even</col>
       </row>
       <row>
-        <col id="0">/dev/ttyUSB2</col>
+        <col id="0">Mark</col>
       </row>
       <row>
-        <col id="0">/dev/ttyUSB3</col>
+        <col id="0">Space</col>
       </row>
     </data>
   </object>
-  <object class="GtkListStore" id="model4">
+  <object class="GtkListStore" id="model5">
+    <columns>
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0">1</col>
+      </row>
+      <row>
+        <col id="0">2</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkListStore" id="model6">
+    <columns>
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0">5</col>
+      </row>
+      <row>
+        <col id="0">6</col>
+      </row>
+      <row>
+        <col id="0">7</col>
+      </row>
+      <row>
+        <col id="0">8</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkListStore" id="model7">
     <columns>
       <column type="gchararray"/>
     </columns>
@@ -159,73 +198,34 @@
       </row>
     </data>
   </object>
-  <object class="GtkListStore" id="model5">
-    <columns>
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0">5</col>
-      </row>
-      <row>
-        <col id="0">6</col>
-      </row>
-      <row>
-        <col id="0">7</col>
-      </row>
-      <row>
-        <col id="0">8</col>
-      </row>
-    </data>
-  </object>
-  <object class="GtkListStore" id="model6">
-    <columns>
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0">1</col>
-      </row>
-      <row>
-        <col id="0">2</col>
-      </row>
-    </data>
-  </object>
-  <object class="GtkListStore" id="model7">
+  <object class="GtkListStore" id="model8">
     <columns>
       <column type="gchararray"/>
     </columns>
     <data>
       <row>
-        <col id="0">None</col>
+        <col id="0">/dev/ttyS0</col>
       </row>
       <row>
-        <col id="0">Odd</col>
+        <col id="0">/dev/ttyS1</col>
       </row>
       <row>
-        <col id="0">Even</col>
+        <col id="0">/dev/ttyS2</col>
       </row>
       <row>
-        <col id="0">Mark</col>
+        <col id="0">/dev/ttyS3</col>
       </row>
       <row>
-        <col id="0">Space</col>
+        <col id="0">/dev/ttyUSB0</col>
       </row>
-    </data>
-  </object>
-  <object class="GtkListStore" id="model8">
-    <columns>
-      <column type="gchararray"/>
-    </columns>
-    <data>
       <row>
-        <col id="0">Read and Write</col>
+        <col id="0">/dev/ttyUSB1</col>
       </row>
       <row>
-        <col id="0">Read Only</col>
+        <col id="0">/dev/ttyUSB2</col>
       </row>
       <row>
-        <col id="0">Write Only</col>
+        <col id="0">/dev/ttyUSB3</col>
       </row>
     </data>
   </object>
@@ -262,6 +262,12 @@
           </object>
         </child>
         <child>
+          <object class="GtkAction" id="menubar_open_recent">
+            <property name="name">menubar_open_recent</property>
+            <property name="label" translatable="yes">Open _Recent</property>
+          </object>
+        </child>
+        <child>
           <object class="GtkAction" id="menubar_save_settings">
             <property name="stock_id">gtk-save</property>
             <property name="name">menubar_save_settings</property>
@@ -334,9 +340,10 @@
       </object>
     </child>
     <ui>
-      <menubar name="menubar1">
+      <menubar name="menubar">
         <menu action="menuitem1">
           <menuitem action="menubar_open_settings"/>
+          <menuitem action="menubar_open_recent"/>
           <separator/>
           <menuitem action="menubar_save_settings"/>
           <menuitem action="menubar_save_settings_as"/>
@@ -366,7 +373,7 @@
       <object class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
         <child>
-          <object class="GtkMenuBar" constructor="uimanager1" id="menubar1">
+          <object class="GtkMenuBar" constructor="uimanager1" id="menubar">
             <property name="visible">True</property>
           </object>
           <packing>
@@ -787,140 +794,63 @@
                 <property name="n_rows">8</property>
                 <property name="n_columns">2</property>
                 <child>
-                  <object class="GtkCheckButton" id="settings_local_echo">
+                  <object class="GtkComboBox" id="settings_open_for">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="tooltip-text" translatable="yes">Normally disabled</property>
-                    <property name="label" translatable="yes">Echo received data</property>
-                    <property name="draw_indicator">True</property>
+                    <property name="model">model3</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="renderer3"/>
+                      <attributes>
+                        <attribute name="text">0</attribute>
+                      </attributes>
+                    </child>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">7</property>
-                    <property name="bottom_attach">8</property>
-                    <property name="x_padding">2</property>
-                    <property name="y_padding">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label26">
-                    <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Local Echo</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">7</property>
-                    <property name="bottom_attach">8</property>
-                    <property name="x_padding">4</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label1">
-                    <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Device</property>
-                  </object>
-                  <packing>
-                    <property name="x_padding">4</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label2">
-                    <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Baud Rate</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
-                    <property name="x_padding">4</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label3">
-                    <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Data Bits</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">2</property>
-                    <property name="bottom_attach">3</property>
-                    <property name="x_padding">4</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label4">
-                    <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Stop Bits</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
-                    <property name="x_padding">4</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label5">
-                    <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Parity</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">4</property>
-                    <property name="bottom_attach">5</property>
-                    <property name="x_padding">4</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label7">
-                    <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Handshake</property>
-                  </object>
-                  <packing>
-                    <property name="top_attach">5</property>
-                    <property name="bottom_attach">6</property>
-                    <property name="x_padding">4</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label8">
-                    <property name="visible">True</property>
-                    <property name="xalign">1</property>
-                    <property name="label" translatable="yes">Access Mode</property>
-                  </object>
-                  <packing>
                     <property name="top_attach">6</property>
                     <property name="bottom_attach">7</property>
-                    <property name="x_padding">4</property>
+                    <property name="y_options">GTK_EXPAND</property>
+                    <property name="y_padding">2</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBoxEntry" id="settings_device">
+                  <object class="GtkHBox" id="hbox3">
                     <property name="visible">True</property>
-                    <child internal-child="entry">
-                      <object class="GtkEntry" id="comboboxentry-entry1">
+                    <child>
+                      <object class="GtkCheckButton" id="settings_hardware_handshake">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="tooltip-text" translatable="yes">Also known as RTS/CTS handshaking</property>
+                        <property name="label" translatable="yes">Hardware</property>
+                        <property name="draw_indicator">True</property>
                       </object>
+                      <packing>
+                        <property name="padding">2</property>
+                      </packing>
                     </child>
-                    <property name="model">model3</property>
                     <child>
-                      <object class="GtkCellRendererText" id="renderer3"/>
-                      <attributes>
-                        <attribute name="text">0</attribute>
-                      </attributes>
+                      <object class="GtkCheckButton" id="settings_software_handshake">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="tooltip-text" translatable="yes">Also known as XON/XOFF handshaking</property>
+                        <property name="label" translatable="yes">Software</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="padding">2</property>
+                        <property name="position">1</property>
+                      </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="y_options">GTK_EXPAND</property>
-                    <property name="y_padding">2</property>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="settings_baud_rate">
+                  <object class="GtkComboBox" id="settings_parity">
                     <property name="visible">True</property>
                     <property name="model">model4</property>
                     <child>
@@ -933,14 +863,14 @@
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
                     <property name="y_options">GTK_EXPAND</property>
                     <property name="y_padding">2</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="settings_data_bits">
+                  <object class="GtkComboBox" id="settings_stop_bits">
                     <property name="visible">True</property>
                     <property name="model">model5</property>
                     <child>
@@ -953,14 +883,14 @@
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">2</property>
-                    <property name="bottom_attach">3</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
                     <property name="y_options">GTK_EXPAND</property>
                     <property name="y_padding">2</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="settings_stop_bits">
+                  <object class="GtkComboBox" id="settings_data_bits">
                     <property name="visible">True</property>
                     <property name="model">model6</property>
                     <child>
@@ -973,14 +903,14 @@
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">3</property>
-                    <property name="bottom_attach">4</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
                     <property name="y_options">GTK_EXPAND</property>
                     <property name="y_padding">2</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="settings_parity">
+                  <object class="GtkComboBox" id="settings_baud_rate">
                     <property name="visible">True</property>
                     <property name="model">model7</property>
                     <child>
@@ -993,65 +923,142 @@
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">4</property>
-                    <property name="bottom_attach">5</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
                     <property name="y_options">GTK_EXPAND</property>
                     <property name="y_padding">2</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkHBox" id="hbox3">
+                  <object class="GtkComboBoxEntry" id="settings_device">
                     <property name="visible">True</property>
-                    <child>
-                      <object class="GtkCheckButton" id="settings_hardware_handshake">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="tooltip-text" translatable="yes">Also known as RTS/CTS handshaking</property>
-                        <property name="label" translatable="yes">Hardware</property>
-                        <property name="draw_indicator">True</property>
+                    <child internal-child="entry">
+                      <object class="GtkEntry" id="comboboxentry-entry1">
                       </object>
-                      <packing>
-                        <property name="padding">2</property>
-                      </packing>
                     </child>
+                    <property name="model">model8</property>
                     <child>
-                      <object class="GtkCheckButton" id="settings_software_handshake">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="tooltip-text" translatable="yes">Also known as XON/XOFF handshaking</property>
-                        <property name="label" translatable="yes">Software</property>
-                        <property name="draw_indicator">True</property>
-                      </object>
-                      <packing>
-                        <property name="padding">2</property>
-                        <property name="position">1</property>
-                      </packing>
+                      <object class="GtkCellRendererText" id="renderer8"/>
+                      <attributes>
+                        <attribute name="text">0</attribute>
+                      </attributes>
                     </child>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
+                    <property name="y_options">GTK_EXPAND</property>
+                    <property name="y_padding">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label8">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Access Mode</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
+                    <property name="x_padding">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label7">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Handshake</property>
+                  </object>
+                  <packing>
                     <property name="top_attach">5</property>
                     <property name="bottom_attach">6</property>
+                    <property name="x_padding">4</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="settings_open_for">
+                  <object class="GtkLabel" id="label5">
                     <property name="visible">True</property>
-                    <property name="model">model8</property>
-                    <child>
-                      <object class="GtkCellRendererText" id="renderer8"/>
-                      <attributes>
-                        <attribute name="text">0</attribute>
-                      </attributes>
-                    </child>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Parity</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                    <property name="x_padding">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label4">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Stop Bits</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                    <property name="x_padding">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Data Bits</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                    <property name="x_padding">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Baud Rate</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_padding">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Device</property>
+                  </object>
+                  <packing>
+                    <property name="x_padding">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label26">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Local Echo</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">7</property>
+                    <property name="bottom_attach">8</property>
+                    <property name="x_padding">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="settings_local_echo">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="tooltip-text" translatable="yes">Normally disabled</property>
+                    <property name="label" translatable="yes">Echo received data</property>
+                    <property name="draw_indicator">True</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
-                    <property name="top_attach">6</property>
-                    <property name="bottom_attach">7</property>
-                    <property name="y_options">GTK_EXPAND</property>
+                    <property name="top_attach">7</property>
+                    <property name="bottom_attach">8</property>
+                    <property name="x_padding">2</property>
                     <property name="y_padding">2</property>
                   </packing>
                 </child>
@@ -1101,9 +1108,9 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="0">settings_local_echo</action-widget>
       <action-widget response="0">settings_hardware_handshake</action-widget>
       <action-widget response="0">settings_software_handshake</action-widget>
+      <action-widget response="0">settings_local_echo</action-widget>
       <action-widget response="0">settings_cancel_button</action-widget>
       <action-widget response="0">settings_ok_button</action-widget>
     </action-widgets>
@@ -1259,13 +1266,19 @@
         <property name="visible">True</property>
         <property name="n_rows">4</property>
         <child>
-          <object class="GtkLabel" id="stop_recording_label">
+          <object class="GtkLabel" id="disconnect_label">
             <property name="visible">True</property>
-            <property name="label" translatable="yes">Stop Recording</property>
+            <property name="label" translatable="yes">Disconnect</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="connect_label">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Connect</property>
           </object>
           <packing>
-            <property name="top_attach">3</property>
-            <property name="bottom_attach">4</property>
+            <property name="top_attach">1</property>
+            <property name="bottom_attach">2</property>
           </packing>
         </child>
         <child>
@@ -1279,21 +1292,15 @@
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="connect_label">
+          <object class="GtkLabel" id="stop_recording_label">
             <property name="visible">True</property>
-            <property name="label" translatable="yes">Connect</property>
+            <property name="label" translatable="yes">Stop Recording</property>
           </object>
           <packing>
-            <property name="top_attach">1</property>
-            <property name="bottom_attach">2</property>
+            <property name="top_attach">3</property>
+            <property name="bottom_attach">4</property>
           </packing>
         </child>
-        <child>
-          <object class="GtkLabel" id="disconnect_label">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Disconnect</property>
-          </object>
-        </child>
       </object>
     </child>
   </object>

Modified: trunk/src/Main.vala
==============================================================================
--- trunk/src/Main.vala	(original)
+++ trunk/src/Main.vala	Tue Mar 17 13:06:03 2009
@@ -17,6 +17,8 @@
                         var msg = new MessageDialog (null, DialogFlags.MODAL, MessageType.ERROR, ButtonsType.CANCEL, _("Failed to load UI\n%s"), e.message);
                         msg.run ();
                 }
+                if(!(profileFilename==null) && (!GLib.Path.is_absolute(profileFilename)))
+                		profileFilename=GLib.Path.build_filename(GLib.Environment.get_current_dir(), profileFilename);
                 mainWindow = new moserial.MainWindow(builder, profileFilename);
                 mainWindow.showWindow();
         }

Modified: trunk/src/MainWindow.vala
==============================================================================
--- trunk/src/MainWindow.vala	(original)
+++ trunk/src/MainWindow.vala	Tue Mar 17 13:06:03 2009
@@ -70,6 +70,7 @@
         private bool profileChanged=false;
         private Gtk.Action cutMenuItem;
         private Gtk.Action copyMenuItem;
+        //private Gtk.RecentChooser recentChooser;
         public MainWindow(Builder builder, string? profileFilename) {
                 this.builder=builder;
                 this.startupProfileFilename=profileFilename;
@@ -238,6 +239,26 @@
                 terminationMode = (ComboBox)builder.get_object("termination_mode");
                 terminationMode.set_active(0);
                 
+                //setup recent chooser
+                RecentManager recentManager = RecentManager.get_default ();
+                RecentChooserMenu recentChooserMenu = new Gtk.RecentChooserMenu.for_manager(recentManager);
+                recentChooserMenu.item_activated += recentItemOpen;
+                RecentFilter filter = new RecentFilter();
+                filter.add_application(GLib.Environment.get_application_name());
+                recentChooserMenu.add_filter(filter);
+                recentChooserMenu.set_show_numbers(true);
+                /* We have to do this ugly iteration stuff because 
+		   gtk-builder-convert currently turns menuitems into actions.
+		   Hopefully this wont be need with new glade versions. */
+                MenuShell menuBar = (MenuBar)builder.get_object("menubar");
+               	GLib.List children = menuBar.get_children();
+               	MenuItem fileMenu;
+               	fileMenu = (MenuItem)children.first().data;
+               	MenuShell fileMenuShell = (MenuShell)fileMenu.get_submenu();
+                children = fileMenuShell.get_children();
+                MenuItem recentFileItem = (MenuItem)children.nth(2).data;
+               	recentFileItem.set_submenu(recentChooserMenu);
+
                 //load and apply preferences
                 currentPreferences = Preferences.loadFromProfile(profile);
        		updatePreferences(null, currentPreferences);
@@ -248,6 +269,26 @@
 		currentPaths = DefaultPaths.loadFromProfile(profile);
         }
 	
+	private void applyProfile (string filename) {
+		if (profile.load(filename, gtkWindow)) {
+			profileFilename = filename;
+			ensureDisconnected();
+			currentSettings = Settings.loadFromProfile(profile);
+			currentPreferences = Preferences.loadFromProfile(profile);
+			currentPaths = DefaultPaths.loadFromProfile(profile);
+			updatePreferences(null, currentPreferences);
+			statusbar.pop(statusbarContext);
+			statusbar.push(statusbarContext, currentSettings.getStatusbarString(false));
+			gtkWindow.set_title("moserial - %s".printf(GLib.Path.get_basename(filename)));
+			profileChanged=false;
+			RecentManager recentManager = RecentManager.get_default ();
+			recentManager.add_item(GLib.Filename.to_uri(filename));
+		}
+	}
+
+	private void recentItemOpen(RecentChooser r) {
+		applyProfile(GLib.Filename.from_uri(r.get_current_uri()));
+	}
 
         private void insertBufferEnd (TextBuffer buf, string s) {
                 TextIter iter;
@@ -365,11 +406,13 @@
 		        sz.transferComplete += this.sendComplete;
 		}
         }
+
         public void sendComplete(GLib.Object o) {
 	        sz.updateStatus-=sendProgressDialog.updateStatus;
         	sendProgressDialog.transferCanceled-=sz.transferCanceled;
                 sendProgressDialog.hide(sendProgressDialog);
         }
+
         private void doReceiveChooser(ToolButton button) {
                 if (!ensureConnected())
                         return;
@@ -710,6 +753,7 @@
                 profile.save(null, gtkWindow);
                 Gtk.main_quit ();
         }
+
 	private void saveProfile () {
                 currentPreferences.saveToProfile(profile);
                 currentSettings.saveToProfile(profile);
@@ -720,7 +764,10 @@
 			return;
 		profile.save(profileFilename, gtkWindow);
 		profileChanged=false;
+		RecentManager recentManager = RecentManager.get_default ();
+		recentManager.add_item(GLib.Filename.to_uri(profileFilename));
 	}	
+
 	private void saveProfileAs () {
                 var dialog = new FileChooserDialog (null, gtkWindow, Gtk.FileChooserAction.SAVE);
                 dialog.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_SAVE, Gtk.ResponseType.ACCEPT, null);
@@ -734,38 +781,18 @@
                 if(response == Gtk.ResponseType.ACCEPT)
                 	saveProfile();
 	}
+
 	private void loadProfileOnStartup(string profileFilename) {
-	        if (profile.load(profileFilename, gtkWindow)) {
-			ensureDisconnected();
-		        currentSettings = Settings.loadFromProfile(profile);
-        	        currentPreferences = Preferences.loadFromProfile(profile);
-			currentPaths = DefaultPaths.loadFromProfile(profile);
-			updatePreferences(null, currentPreferences);
-        		statusbar.pop(statusbarContext);
-        		statusbar.push(statusbarContext, currentSettings.getStatusbarString(false));
-			gtkWindow.set_title("moserial - %s".printf(GLib.Path.get_basename(profileFilename)));
-			profileChanged=false;
-			this.profileFilename=profileFilename;
-		}
+		applyProfile(profileFilename);
 	}
+
 	private void loadProfile() {
                 var dialog = new FileChooserDialog (null, gtkWindow, Gtk.FileChooserAction.OPEN);
                 dialog.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.ACCEPT, null);
                 dialog.set_local_only(false);
 	        int response = dialog.run();
 	        if(response == Gtk.ResponseType.ACCEPT) {
-		        profileFilename=dialog.get_filename();
-		        if (profile.load(profileFilename, gtkWindow)) {
-				ensureDisconnected();
-			        currentSettings = Settings.loadFromProfile(profile);
-        	                currentPreferences = Preferences.loadFromProfile(profile);
-				currentPaths = DefaultPaths.loadFromProfile(profile);
-	       			updatePreferences(null, currentPreferences);
-	                	statusbar.pop(statusbarContext);
-        	        	statusbar.push(statusbarContext, currentSettings.getStatusbarString(false));
-				gtkWindow.set_title("moserial - %s".printf(GLib.Path.get_basename(profileFilename)));
-				profileChanged=false;
-			}
+		        applyProfile(dialog.get_filename());
 		}
                 dialog.destroy();
 	}



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