[orca/new-settings] Changed the profilesCombo model to store the label and name of each profile. Also added extra combob



commit 5dda54b4fe0cfb828b2a3f8c95164846da8a1c13
Author: Juanje Ojeda <jojeda emergya es>
Date:   Wed Oct 13 05:28:02 2010 +0200

    Changed the profilesCombo model to store the label and name of each profile.
    Also added extra combobox at the profiles tab for selecting the profile
    that will be loaded on the start time.

 src/orca/backends/gconf_backend.py |   44 ++++++--
 src/orca/orca-setup.ui             |  204 ++++++++++++++++++++----------------
 src/orca/orca_gui_prefs.py         |   55 +++++++---
 3 files changed, 184 insertions(+), 119 deletions(-)
---
diff --git a/src/orca/backends/gconf_backend.py b/src/orca/backends/gconf_backend.py
index 099c023..dc5a6e5 100644
--- a/src/orca/backends/gconf_backend.py
+++ b/src/orca/backends/gconf_backend.py
@@ -715,13 +715,24 @@ class OrcaPrefs():
         # JD -> JH: Another sanity check: self.prefsDict['activeProfile']
         # might exist with a value of None.
         #
+        defaultValue = ['Default', 'default']
         if not self.prefsDict.get('activeProfile'):
-            self.prefsDict['activeProfile'] = 'default'
+            self.prefsDict['activeProfile'] = defaultValue
+        if not self.prefsDict.get('startingProfile'):
+            self.prefsDict['startingProfile'] = defaultValue
 
         if self.prefsDict:
-            self._client.set_string('/apps/gnome-orca/activeProfile',
+            self._client.set_list('/apps/gnome-orca/activeProfile',
+                                    gconf.VALUE_STRING,
                                     self.prefsDict['activeProfile'])
-            self.__app_key += '/%s' % self.prefsDict['activeProfile']
+            self._client.set_list('/apps/gnome-orca/startingProfile',
+                                    gconf.VALUE_STRING,
+                                    self.prefsDict['startingProfile'])
+            activeProfileName = self.prefsDict['activeProfile'][1]
+            self._client.set_list('/apps/gnome-orca/%s/profile' % activeProfileName,
+                                    gconf.VALUE_STRING,
+                                    self.prefsDict['activeProfile'])
+            self.__app_key += '/%s' % activeProfileName
 
             for key in settings.userCustomizableSettings:
                 if key != 'voices':
@@ -790,8 +801,9 @@ class OrcaPrefs():
         if not self._client.all_entries(self.__app_key):
             return False
         else:
-            path = '/apps/gnome-orca/activeProfile'
-            self.__app_key += '/%s' % self._client.get_string(path)
+            path = '/apps/gnome-orca/startingProfile'
+            profileKey = self._client.get_list(path, gconf.VALUE_STRING)
+            self.__app_key += '/%s' % profileKey[1]
         #    self.options = self.DEFAULTS
         #    self.gconf_save()
  
@@ -918,8 +930,10 @@ def readPreferences():
 
     # must be in userCustomizableSettings
     # profile support
-    path = '/apps/gnome-orca/activeProfile'
-    prefsDict['activeProfile'] = gconf.client_get_default().get_string(path)
+    client = gconf.client_get_default()
+    path = '/apps/gnome-orca/startingProfile'
+    prefsDict['startingProfile'] = client.get_list(path, gconf.VALUE_STRING)
+    prefsDict['activeProfile'] = prefsDict['startingProfile']
 
     return prefsDict
 
@@ -957,11 +971,19 @@ def loadSettings():
     return orcaPrefs.loadSettings()
 
 def availableProfiles():
-    """Returns available profiles"""
+    """Returns a list of available profiles
+    It will be a list of strings list like this:
+    ['Label', 'name']
+    """
     
     client = gconf.client_get_default()
     path = '/apps/gnome-orca'
-    profiles = client.all_dirs(path)
-    profiles = [profiles[profiles.index(profile)].split("%s/" % path)[1] \
-                for profile in profiles]
+    profilesKeys = client.all_dirs(path)
+    profiles = []
+    for profileKey in profilesKeys:
+        name = profileKey.split('/')[-1]
+        key = path + '/%s/profile' % name
+        profile = client.get_list(key, gconf.VALUE_STRING)
+        profiles.append(profile)
+
     return profiles 
diff --git a/src/orca/orca-setup.ui b/src/orca/orca-setup.ui
index 7ac8cdc..de2bbe7 100644
--- a/src/orca/orca-setup.ui
+++ b/src/orca/orca-setup.ui
@@ -263,7 +263,9 @@
   </object>
   <object class="GtkListStore" id="model9">
     <columns>
-      <!-- column-name profiles -->
+      <!-- column-name label -->
+      <column type="gchararray"/>
+      <!-- column-name name -->
       <column type="gchararray"/>
     </columns>
   </object>
@@ -276,13 +278,11 @@
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox1">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
         <property name="spacing">3</property>
         <child>
           <object class="GtkVBox" id="mainvbox">
             <property name="visible">True</property>
             <property name="border_width">6</property>
-            <property name="orientation">vertical</property>
             <property name="spacing">12</property>
             <child>
               <object class="GtkNotebook" id="notebook">
@@ -292,7 +292,6 @@
                   <object class="GtkVBox" id="generalVBox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
-                    <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkFrame" id="frame9">
                         <property name="visible">True</property>
@@ -306,7 +305,6 @@
                               <object class="GtkVBox" id="vbox22">
                                 <property name="visible">True</property>
                                 <property name="border_width">3</property>
-                                <property name="orientation">vertical</property>
                                 <child>
                                   <object class="GtkRadioButton" id="generalDesktopButton">
                                     <property name="label" translatable="yes">_Desktop</property>
@@ -558,7 +556,6 @@
                   <object class="GtkVBox" id="vbox20">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
-                    <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkCheckButton" id="speechSupportCheckButton">
                         <property name="label" translatable="yes">_Enable speech</property>
@@ -580,7 +577,6 @@
                       <object class="GtkVBox" id="speechVbox">
                         <property name="visible">True</property>
                         <property name="border_width">12</property>
-                        <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
                         <child>
                           <object class="GtkTable" id="speechTable">
@@ -980,7 +976,6 @@
                                               <object class="GtkVBox" id="vbox17">
                                                 <property name="visible">True</property>
                                                 <property name="border_width">3</property>
-                                                <property name="orientation">vertical</property>
                                                 <child>
                                                   <object class="GtkRadioButton" id="speechBriefButton">
                                                     <property name="label" translatable="yes">Brie_f</property>
@@ -1050,7 +1045,6 @@
                                               <object class="GtkVBox" id="vbox21">
                                                 <property name="visible">True</property>
                                                 <property name="border_width">3</property>
-                                                <property name="orientation">vertical</property>
                                                 <child>
                                                   <object class="GtkRadioButton" id="cellSpeechButton">
                                                     <property name="label" translatable="yes" comments="Translators: This is one of two options available in the Preferences dialog for the Table Rows setting. If chosen, Orca will speak just the new cell when the user arrows Up or Down in a table.">Speak _cell</property>
@@ -1148,7 +1142,6 @@
                                                 <child>
                                                   <object class="GtkVBox" id="progressBarVBox">
                                                     <property name="visible">True</property>
-                                                    <property name="orientation">vertical</property>
                                                     <child>
                                                       <object class="GtkHBox" id="speakUpdateIntervalHBox">
                                                         <property name="visible">True</property>
@@ -1498,7 +1491,6 @@
                   <object class="GtkVBox" id="brailleVbox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
-                    <property name="orientation">vertical</property>
                     <property name="spacing">12</property>
                     <child>
                       <object class="GtkTable" id="table2">
@@ -1509,7 +1501,6 @@
                         <child>
                           <object class="GtkVBox" id="vbox23">
                             <property name="visible">True</property>
-                            <property name="orientation">vertical</property>
                             <child>
                               <object class="GtkCheckButton" id="enableBrailleCheckButton">
                                 <property name="label" translatable="yes">Enable Braille _support</property>
@@ -1653,7 +1644,6 @@
                                   <object class="GtkVBox" id="vbox18">
                                     <property name="visible">True</property>
                                     <property name="border_width">3</property>
-                                    <property name="orientation">vertical</property>
                                     <child>
                                       <object class="GtkRadioButton" id="brailleBriefButton">
                                         <property name="label" translatable="yes">Brie_f</property>
@@ -1718,7 +1708,6 @@
                                   <object class="GtkVBox" id="vbox28">
                                     <property name="visible">True</property>
                                     <property name="border_width">3</property>
-                                    <property name="orientation">vertical</property>
                                     <child>
                                       <object class="GtkRadioButton" id="brailleSelectionNoneButton">
                                         <property name="label" translatable="yes">_None</property>
@@ -1816,7 +1805,6 @@
                                 <child>
                                   <object class="GtkVBox" id="vbox35">
                                     <property name="visible">True</property>
-                                    <property name="orientation">vertical</property>
                                     <child>
                                       <object class="GtkRadioButton" id="brailleLinkNoneButton">
                                         <property name="label" translatable="yes">_None</property>
@@ -1931,7 +1919,6 @@
                   <object class="GtkVBox" id="keyechoVbox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
-                    <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkCheckButton" id="keyEchoCheckButton">
                         <property name="label" translatable="yes">Enable _key echo</property>
@@ -2181,7 +2168,6 @@
                   <object class="GtkVBox" id="vbox19">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
-                    <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkCheckButton" id="magnifierSupportCheckButton">
                         <property name="label" translatable="yes">Enable _magnifier</property>
@@ -2605,7 +2591,6 @@
                                     <child>
                                       <object class="GtkVBox" id="vbox33">
                                         <property name="visible">True</property>
-                                        <property name="orientation">vertical</property>
                                         <child>
                                           <object class="GtkAlignment" id="alignment83">
                                             <property name="visible">True</property>
@@ -2686,8 +2671,8 @@
                                                             <property name="climb_rate">1</property>
                                                             <property name="numeric">True</property>
                                                             <accessibility>
-                                                            <relation type="labelled-by" target="magCrossHairSizeLabel"/>
                                                             <relation type="labelled-by" target="magCrossHairSizeUnitsLabel"/>
+                                                            <relation type="labelled-by" target="magCrossHairSizeLabel"/>
                                                             </accessibility>
                                                             <signal name="value_changed" handler="magCrossHairSizeValueChanged"/>
                                                           </object>
@@ -2811,7 +2796,6 @@
                                     <child>
                                       <object class="GtkVBox" id="vbox32">
                                         <property name="visible">True</property>
-                                        <property name="orientation">vertical</property>
                                         <child>
                                           <object class="GtkAlignment" id="alignment81">
                                             <property name="visible">True</property>
@@ -2891,8 +2875,8 @@
                                                             <property name="climb_rate">1</property>
                                                             <property name="numeric">True</property>
                                                             <accessibility>
-                                                            <relation type="labelled-by" target="magCursorSizeLabel"/>
                                                             <relation type="labelled-by" target="magCursorSizeUnitsLabel"/>
+                                                            <relation type="labelled-by" target="magCursorSizeLabel"/>
                                                             </accessibility>
                                                             <signal name="value_changed" handler="magCursorSizeValueChanged"/>
                                                           </object>
@@ -3162,7 +3146,6 @@
                                     <child>
                                       <object class="GtkVBox" id="vbox31">
                                         <property name="visible">True</property>
-                                        <property name="orientation">vertical</property>
                                         <child>
                                           <object class="GtkAlignment" id="alignment78">
                                             <property name="visible">True</property>
@@ -3471,8 +3454,8 @@
                                                     <property name="climb_rate">1</property>
                                                     <property name="numeric">True</property>
                                                     <accessibility>
-                                                      <relation type="labelled-by" target="magEdgeMarginUnitsLabel"/>
                                                       <relation type="labelled-by" target="magEdgeMarginLabel"/>
+                                                      <relation type="labelled-by" target="magEdgeMarginUnitsLabel"/>
                                                     </accessibility>
                                                     <signal name="value_changed" handler="magEdgeMarginValueChanged"/>
                                                   </object>
@@ -3627,7 +3610,6 @@
                   <object class="GtkVBox" id="keyBindingsVBox">
                     <property name="visible">True</property>
                     <property name="border_width">12</property>
-                    <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
                       <object class="GtkHBox" id="hbox36">
@@ -3657,7 +3639,7 @@
                             <child>
                               <object class="GtkCellRendererText" id="orcaModifierRenderer"/>
                               <attributes>
-                              <attribute name="text">0</attribute>
+                                <attribute name="text">0</attribute>
                               </attributes>
                             </child>
                           </object>
@@ -3712,7 +3694,6 @@
                 <child>
                   <object class="GtkVBox" id="vbox29">
                     <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkFrame" id="pronunciationFrame">
                         <property name="visible">True</property>
@@ -3826,7 +3807,6 @@
                             <child>
                               <object class="GtkVBox" id="vbox24">
                                 <property name="visible">True</property>
-                                <property name="orientation">vertical</property>
                                 <child>
                                   <object class="GtkScrolledWindow" id="scrolledwindow2">
                                     <property name="visible">True</property>
@@ -3920,7 +3900,6 @@
                     <child>
                       <object class="GtkVBox" id="vbox26">
                         <property name="visible">True</property>
-                        <property name="orientation">vertical</property>
                         <property name="homogeneous">True</property>
                         <child>
                           <object class="GtkFrame" id="adjustAttributesFrame">
@@ -3936,7 +3915,6 @@
                                   <object class="GtkVBox" id="vbox25">
                                     <property name="visible">True</property>
                                     <property name="border_width">5</property>
-                                    <property name="orientation">vertical</property>
                                     <child>
                                       <object class="GtkButton" id="textMoveToTopButton">
                                         <property name="label" translatable="yes" comments="Translators:  This label is on a button on the Text Attributes pane of the Orca Preferences dialog. On that pane there is a long list of possible text attributes. The user can select one and then, by using the Move to _top button, move that attribute to the top of the list. The ordering in the list is important as Orca will speak the selected text attributes in the given order.">Move to _top</property>
@@ -4034,7 +4012,6 @@ attributes&lt;/b&gt;</property>
                                   <object class="GtkVBox" id="vbox27">
                                     <property name="visible">True</property>
                                     <property name="border_width">3</property>
-                                    <property name="orientation">vertical</property>
                                     <child>
                                       <object class="GtkRadioButton" id="textBrailleNoneButton">
                                         <property name="label" translatable="yes">_None</property>
@@ -4145,78 +4122,121 @@ attributes&lt;/b&gt;</property>
                   <object class="GtkVBox" id="profilesVbox">
                     <property name="visible">True</property>
                     <child>
-                      <object class="GtkHBox" id="hbox2">
+                      <object class="GtkAspectFrame" id="aspectframe1">
                         <property name="visible">True</property>
-                        <property name="spacing">5</property>
-                        <child>
-                          <object class="GtkLabel" id="profilesLabel">
-                            <property name="visible">True</property>
-                            <property name="xalign">1</property>
-                            <property name="label" translatable="yes">Profile:</property>
-                            <property name="use_underline">True</property>
-                            <property name="justify">right</property>
-                            <property name="mnemonic_widget">availableProfilesComboBox</property>
-                            <accessibility>
-                              <relation type="label-for" target="speechServers"/>
-                            </accessibility>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="padding">5</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
+                        <property name="label_xalign">0</property>
+                        <property name="shadow_type">none</property>
+                        <property name="xalign">0</property>
                         <child>
-                          <object class="GtkComboBox" id="availableProfilesComboBox">
+                          <object class="GtkTable" id="profilesTable">
                             <property name="visible">True</property>
-                            <property name="model">model9</property>
+                            <property name="n_rows">2</property>
+                            <property name="n_columns">4</property>
+                            <property name="column_spacing">6</property>
+                            <property name="row_spacing">2</property>
                             <child>
-                              <object class="GtkCellRendererText" id="cellrenderertext4"/>
-                              <attributes>
-                                <attribute name="text">0</attribute>
-                              </attributes>
+                              <object class="GtkLabel" id="profilesLabel">
+                                <property name="width_request">150</property>
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">12</property>
+                                <property name="label" translatable="yes">Active Profile:</property>
+                                <property name="mnemonic_widget">availableProfilesComboBox</property>
+                                <property name="ellipsize">start</property>
+                                <accessibility>
+                                  <relation type="label-for" target="speechServers"/>
+                                </accessibility>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkComboBox" id="availableProfilesComboBox">
+                                <property name="width_request">200</property>
+                                <property name="visible">True</property>
+                                <property name="model">model9</property>
+                                <child>
+                                  <object class="GtkCellRendererText" id="cellrenderertext4"/>
+                                  <attributes>
+                                    <attribute name="text">0</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkButton" id="loadProfileButton">
+                                <property name="label" translatable="yes" comments="This button will load the selected settings profile in the application.">_Load</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="use_underline">True</property>
+                                <signal name="clicked" handler="loadProfileButtonClicked"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">2</property>
+                                <property name="right_attach">3</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkButton" id="saveProfileButton">
+                                <property name="label">gtk-save-as</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="use_stock">True</property>
+                                <signal name="clicked" handler="showProfileGUI"/>
+                              </object>
+                              <packing>
+                                <property name="left_attach">3</property>
+                                <property name="right_attach">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="startupProfileLabel">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="xpad">12</property>
+                                <property name="label" translatable="yes">Start-up Profile:</property>
+                                <property name="ellipsize">end</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBox" id="availableProfilesComboBox2">
+                                <property name="visible">True</property>
+                                <property name="model">model9</property>
+                                <child>
+                                  <object class="GtkCellRendererText" id="cellrenderertext3"/>
+                                  <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">1</property>
+                                <property name="bottom_attach">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
                             </child>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkButton" id="loadProfileButton">
-                            <property name="label" translatable="yes">Load</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <signal name="clicked" handler="loadProfileButtonClicked"/>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">2</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkButton" id="saveProfileButton">
-                            <property name="label">gtk-save-as</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="use_stock">True</property>
-                            <signal name="clicked" handler="showProfileGUI"/>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">3</property>
-                          </packing>
                         </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="padding">15</property>
+                        <property name="fill">False</property>
+                        <property name="padding">12</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 5e13bdd..3bb14a6 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -2203,6 +2203,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         # Orca User Profiles
         #
         self.profilesCombo = self.get_widget('availableProfilesComboBox')
+        self.startingProfileCombo = self.get_widget('availableProfilesComboBox2')
         self.profilesComboModel = self.get_widget('model9')
         self.__initProfileCombo()
 
@@ -2210,20 +2211,24 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         """Adding available profiles and setting active as the active one"""
 
         availableProfiles = self.__getAvailableProfiles()
-        iterChilds = {}
         self.profilesComboModel.clear()
 
+        defaultValue = ['Default', 'default']
         if not len(availableProfiles):
-            iterChilds.update({'default' : self.profilesComboModel.append(['default'])})
+            self.profilesComboModel.append(defaultValue)
         else:
             for profile in availableProfiles:
-                iterChilds.update({profile: self.profilesComboModel.append([profile])})
+                self.profilesComboModel.append(profile)
 
-        activeProfile = self.prefsDict.get('activeProfile') or 'default'
-        activeProfileItem = int(self.profilesComboModel.get_string_from_iter(iterChilds[activeProfile]))
+        activeProfile = self.prefsDict.get('activeProfile') or defaultValue
+        startingProfile = self.prefsDict.get('startingProfile') or defaultValue
 
-        # If not classic backend, show active profile
-        self.profilesCombo.set_active(activeProfileItem)
+        activeProfileIter = self.getComboBoxIndex(self.profilesCombo,
+                                                  activeProfile[0])
+        startingProfileIter = self.getComboBoxIndex(self.startingProfileCombo,
+                                                  startingProfile[0])
+        self.profilesCombo.set_active(activeProfileIter)
+        self.startingProfileCombo.set_active(startingProfileIter)
 
     def __getAvailableProfiles(self):
         """Get available user profiles or remove profiles page
@@ -2231,7 +2236,7 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         if _settingsManager.DEFAULT_BACKEND == 'classic':
             self.get_widget("profilesVbox").hide()
-            return ['default']
+            return ['Default', 'default']
         else:
             return _settingsManager.availableProfiles()
 
@@ -2275,6 +2280,16 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         return 0
 
+    def getComboBoxList(self, combobox):
+        """Get the list of values from the active combox
+        """
+        active = combobox.get_active()
+        model = combobox.get_model()
+        activeIter = model.get_iter(active)
+        activeLabel = model.get_value(activeIter, 0)
+        activeName = model.get_value(activeIter, 1)
+        return [activeLabel, activeName]
+
     def showGUI(self):
         """Show the Orca configuration GUI window. This assumes that
         the GUI has already been created.
@@ -4333,7 +4348,11 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
                 settings.SYSTEM_VOICE    : acss.ACSS(self.systemVoice),
             }
 
-        #self.prefsDict['activeProfile'] = self.profilesCombo.get_active_text()
+        activeProfile = self.getComboBoxList(self.profilesCombo)
+        startingProfile = self.getComboBoxList(self.startingProfileCombo) 
+
+        self.prefsDict['activeProfile'] = activeProfile
+        self.prefsDict['startingProfile'] = startingProfile
 
         settings.setGKSUGrabDisabled(self.disableKeyGrabPref)
 
@@ -4440,20 +4459,20 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         if not profileToSaveLabel:
             return
         profileToSave = profileToSaveLabel.replace(' ','_').lower()
+        profile = [profileToSaveLabel, profileToSave]
 
         def saveActiveProfile(newProfile = True):
             if newProfile:
-                profile = {profileToSave: self.profilesComboModel.append([profileToSaveLabel])}
-                activeProfile = int(self.profilesComboModel.get_string_from_iter(profile[profileToSave]))
-                self.profilesCombo.set_active(activeProfile)
+                activeProfileIter = self.profilesComboModel.append(profile)
+                self.profilesCombo.set_active_iter(activeProfileIter)
 
-            self.prefsDict['activeProfile'] = profileToSave
+            self.prefsDict['activeProfile'] = profile
             self.writeUserPreferences()
 
-
+        availableProfiles = [p[1] for p in self.__getAvailableProfiles()]
         if isinstance(profileToSave, str) \
                 and profileToSave != '' \
-                and not profileToSave in self.__getAvailableProfiles() \
+                and not profileToSave in availableProfiles \
                 and profileToSave != 'default':
             saveActiveProfile()
         else:
@@ -4552,7 +4571,11 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         #self.writeUserPreferences()
         import gconf
         gclient = gconf.client_get_default()
-        gclient.set_string('/apps/gnome-orca/activeProfile', self.profilesCombo.get_active_text())
+        activeItem = self.profilesCombo.get_active()
+        activeProfile = self.profilesComboModel[activeItem]
+        gclient.set_list('/apps/gnome-orca/activeProfile',
+                         gconf.VALUE_STRING,
+                         activeProfile)
         
         orca.loadUserSettings()
         



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