changeset fc3322e08c90 in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=fc3322e08c90
description: adopted new filesystem layout, gtkbuilder format and some other 
design changes in the otr branch

diffstat:

 data/gui/contact_context_menu.ui  |   2 +-
 data/gui/contact_otr_window.ui    |  53 +++++++++++++++++++++++++-----------
 src/common/check_paths.py         |   2 +
 src/common/connection.py          |   6 ++-
 src/common/connection_handlers.py |  56 ++++++++++++++++++++------------------
 src/config.py                     |   6 +---
 src/gajim.py                      |   8 +++--
 src/gui_menu_builder.py           |   2 +-
 src/otr_windows.py                |  14 ++++-----
 9 files changed, 87 insertions(+), 62 deletions(-)

diffs (truncated from 416 to 300 lines):

diff -r 1182e1367856 -r fc3322e08c90 data/gui/contact_context_menu.ui
--- a/data/gui/contact_context_menu.ui  Sat Feb 27 19:03:07 2010 +0100
+++ b/data/gui/contact_context_menu.ui  Sun Feb 28 16:02:46 2010 +0100
@@ -73,7 +73,7 @@
         <property name="sensitive">False</property>
         <property name="label" translatable="yes">Off-the-Record 
Encryption</property>
         <property name="use_underline">True</property>
-        <child>
+        <child type="submenu">
           <object class="GtkMenu" id="otr_submenu_menu">
             <child>
               <object class="GtkMenuItem" id="otr_settings_menuitem">
diff -r 1182e1367856 -r fc3322e08c90 data/gui/contact_otr_window.ui
--- a/data/gui/contact_otr_window.ui    Sat Feb 27 19:03:07 2010 +0100
+++ b/data/gui/contact_otr_window.ui    Sun Feb 28 16:02:46 2010 +0100
@@ -7,6 +7,7 @@
     <child>
       <object class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
+        <property name="orientation">vertical</property>
         <child>
           <object class="GtkNotebook" id="notebook1">
             <property name="visible">True</property>
@@ -15,6 +16,7 @@
               <object class="GtkVBox" id="otr_fp_vbox">
                 <property name="visible">True</property>
                 <property name="border_width">5</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">5</property>
                 <property name="homogeneous">True</property>
                 <child>
@@ -50,9 +52,14 @@
                       <object class="GtkComboBox" id="verified_combobox">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="active">1</property>
-                        <property name="items">I have NOT
-I have</property>
+                        <property name="model">verifiedmodel</property>
+                        <property name="active">0</property>
+                        <child>
+                          <object class="GtkCellRendererText" 
id="cellrenderertext1"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -67,6 +74,7 @@
                         <property name="wrap">True</property>
                       </object>
                       <packing>
+                        <property name="expand">False</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
@@ -77,14 +85,14 @@
                 </child>
               </object>
             </child>
-            <child>
+            <child type="tab">
               <object class="GtkLabel" id="label1">
                 <property name="visible">True</property>
                 <property name="label" 
translatable="yes">Authentication</property>
               </object>
               <packing>
+                <property name="position">1</property>
                 <property name="tab_fill">False</property>
-                <property name="type">tab</property>
               </packing>
             </child>
             <child>
@@ -96,6 +104,7 @@
                   <object class="GtkVBox" id="otr_settings_vbox">
                     <property name="visible">True</property>
                     <property name="border_width">5</property>
+                    <property name="orientation">vertical</property>
                     <property name="spacing">5</property>
                     <property name="homogeneous">True</property>
                     <child>
@@ -176,7 +185,7 @@
                     </child>
                   </object>
                 </child>
-                <child>
+                <child type="label">
                   <object class="GtkCheckButton" id="otr_default_checkbutton">
                     <property name="label" translatable="yes">Use the default 
settings</property>
                     <property name="visible">True</property>
@@ -185,16 +194,13 @@
                     <property name="active">True</property>
                     <property name="draw_indicator">True</property>
                   </object>
-                  <packing>
-                    <property name="type">label_item</property>
-                  </packing>
                 </child>
               </object>
               <packing>
                 <property name="position">1</property>
               </packing>
             </child>
-            <child>
+            <child type="tab">
               <object class="GtkLabel" id="label2">
                 <property name="visible">True</property>
                 <property name="label" translatable="yes">OTR 
Settings</property>
@@ -202,7 +208,6 @@
               <packing>
                 <property name="position">1</property>
                 <property name="tab_fill">False</property>
-                <property name="type">tab</property>
               </packing>
             </child>
           </object>
@@ -216,7 +221,7 @@
             <property name="layout_style">end</property>
             <child>
               <object class="GtkButton" id="settings_cancel_button">
-                <property name="label" translatable="yes">gtk-cancel</property>
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -230,7 +235,7 @@
             </child>
             <child>
               <object class="GtkButton" id="settings_ok_button">
-                <property name="label" translatable="yes">gtk-ok</property>
+                <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
@@ -257,10 +262,12 @@
     <child>
       <object class="GtkVBox" id="vbox3">
         <property name="visible">True</property>
+        <property name="orientation">vertical</property>
         <child>
           <object class="GtkVBox" id="vbox4">
             <property name="visible">True</property>
             <property name="border_width">5</property>
+            <property name="orientation">vertical</property>
             <property name="spacing">5</property>
             <child>
               <object class="GtkLabel" id="desclabel1">
@@ -347,7 +354,7 @@
                 <property name="layout_style">end</property>
                 <child>
                   <object class="GtkButton" id="smp_cancel_button">
-                    <property name="label" 
translatable="yes">gtk-cancel</property>
+                    <property name="label">gtk-cancel</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
@@ -361,7 +368,7 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="smp_ok_button">
-                    <property name="label" translatable="yes">gtk-ok</property>
+                    <property name="label">gtk-ok</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
@@ -387,4 +394,18 @@
       </object>
     </child>
   </object>
-</glade-interface>
+  <object class="GtkListStore" id="verifiedmodel">
+    <columns>
+      <!-- column-name verified -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">I have NOT</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">I have</col>
+      </row>
+    </data>
+  </object>
+</interface>
diff -r 1182e1367856 -r fc3322e08c90 src/common/check_paths.py
--- a/src/common/check_paths.py Sat Feb 27 19:03:07 2010 +0100
+++ b/src/common/check_paths.py Sun Feb 28 16:02:46 2010 +0100
@@ -212,6 +212,8 @@
             OLD_DATA_FILES.append(f)
         if f == 'cacerts.pem':
             OLD_DATA_FILES.append(f)
+        if f.endswith('.fpr') or f.endswith('.key'):
+            OLD_DATA_FILES.append(f)
 
     if not os.path.exists(OLD_LOG_DB_PATH):
         return
diff -r 1182e1367856 -r fc3322e08c90 src/common/connection.py
--- a/src/common/connection.py  Sat Feb 27 19:03:07 2010 +0100
+++ b/src/common/connection.py  Sun Feb 28 16:02:46 2010 +0100
@@ -609,6 +609,8 @@
                 if msg:
                     p.setStatus(msg)
 
+                self.disconnect_all_otr_contexts()
+
                 
self.connection.RegisterDisconnectHandler(self._on_disconnected)
                 self.connection.send(p, now=True)
                 self.connection.start_disconnect()
@@ -1505,11 +1507,11 @@
         if gajim.otr_module:
             try:
                 gajim.otr_module.otrl_privkey_read(self.otr_userstates,
-                    os.path.join(gajim.gajimpaths.root,
+                    os.path.join(gajim.gajimpaths.data_root,
                     '%s.key' % self.name).encode())
                 gajim.otr_module.otrl_privkey_read_fingerprints(
                     self.otr_userstates, os.path.join(
-                    gajim.gajimpaths.root, '%s.fpr' %
+                    gajim.gajimpaths.data_root, '%s.fpr' %
                     self.name).encode(),
                     (gajim.otr_add_appdata, self.name))
             except Exception, e:
diff -r 1182e1367856 -r fc3322e08c90 src/common/connection_handlers.py
--- a/src/common/connection_handlers.py Sat Feb 27 19:03:07 2010 +0100
+++ b/src/common/connection_handlers.py Sun Feb 28 16:02:46 2010 +0100
@@ -836,16 +836,6 @@
         """
         Send termination messages and delete all active sessions
         """
-        if gajim.otr_module:
-            # disconnect from ENCRYPTED OTR contexts
-            ctx = self.otr_userstates.context_root
-            while ctx is not None:
-                if ctx.msgstate == gajim.otr_module.OTRL_MSGSTATE_ENCRYPTED:
-                    
gajim.otr_module.otrl_message_disconnect(self.otr_userstates,
-                            (gajim.otr_ui_ops, {'account': self.name,'urgent': 
True}),
-                            ctx.accountname, ctx.protocol, ctx.username)
-                ctx = ctx.next
-
         for jid in self.sessions:
             for thread_id in self.sessions[jid]:
                 self.sessions[jid][thread_id].terminate(send_termination)
@@ -1379,6 +1369,35 @@
             self.dispatch('ROSTERX', (action, exchange_items_list, jid_from))
         raise common.xmpp.NodeProcessed
 
+
+    def disconnect_all_otr_contexts(self):
+        if gajim.otr_module:
+            # disconnect from ENCRYPTED OTR contexts
+            ctx = self.otr_userstates.context_root
+            while ctx is not None:
+                self.disconnect_otr_context(ctx)
+                ctx = ctx.next
+
+    def disconnect_otr_context(self, ctx, kwargs={}):
+        if not gajim.otr_module:
+            return
+
+        if ctx and ctx.msgstate == gajim.otr_module.OTRL_MSGSTATE_ENCRYPTED:
+            kwargs = kwargs.copy()
+            kwargs['account'] = self.name
+            kwargs['urgent'] = True
+
+            gajim.otr_module.otrl_message_disconnect(self.otr_userstates,
+                    (gajim.otr_ui_ops, kwargs), ctx.accountname,
+                    ctx.protocol, ctx.username)
+
+            gajim.otr_ui_ops.gajim_log(_('Private conversation with %s ' \
+                    'lost.') % ctx.username.decode(), self.name, ctx.username)
+
+            ctrl = gajim.otr_ui_ops.get_control(ctx.username, self.name)
+            if ctrl:
+                ctrl.update_otr()
+
     def disconnect_otr_helper(self, frm, thread_id):
         """ disconnect OTR context - it's safe to call this helper
         function any time a OTR context might exist and should be
@@ -1393,22 +1412,7 @@
                 gajim.OTR_PROTO, 0, (gajim.otr_add_appdata,
                     self.name))[0]
 
-        if not ctx or ctx.msgstate != \
-        gajim.otr_module.OTRL_MSGSTATE_ENCRYPTED:
-            return
-
-        gajim.otr_module.otrl_message_disconnect(self.otr_userstates,
-                (gajim.otr_ui_ops, {'account': self.name,
-                    'urgent':False, 'thread_id':thread_id}),
-                ctx.accountname, gajim.OTR_PROTO, ctx.username)
-
-        gajim.otr_ui_ops.gajim_log(_('Private conversation with %s ' \
-                'lost.') % frm, self.name, frm.encode())
-
-        ctrl = gajim.otr_ui_ops.get_control(frm.encode(), self.name)
-        if ctrl:
-            ctrl.update_otr()
-
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to