Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
c0f5c2f3 by wurstsalat at 2022-02-25T23:14:16+01:00
StartChat: Don't assume contact type without server response

- - - - -


2 changed files:

- gajim/data/gui/start_chat_dialog.ui
- gajim/gtk/start_chat.py


Changes:

=====================================
gajim/data/gui/start_chat_dialog.ui
=====================================
@@ -547,108 +547,7 @@
       </packing>
     </child>
     <child>
-      <object class="GtkBox">
-        <property name="visible">True</property>
-        <property name="can-focus">False</property>
-        <property name="valign">center</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">6</property>
-        <child>
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="label" translatable="yes">Start New Chat</property>
-            <style>
-              <class name="large-header"/>
-              <class name="margin-12"/>
-            </style>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="label" translatable="yes">Gajim was not able to 
gather infos about this address.</property>
-            <property name="justify">center</property>
-            <property name="wrap">True</property>
-            <property name="max-width-chars">40</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkImage">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="icon-name">avatar-default-symbolic</property>
-            <property name="icon_size">6</property>
-            <style>
-              <class name="dim-label"/>
-              <class name="margin-12"/>
-            </style>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="margin-bottom">6</property>
-            <property name="label" translatable="yes">You can start a direct 
message chat, if you are sure this address is correct.</property>
-            <property name="justify">center</property>
-            <property name="wrap">True</property>
-            <property name="max-width-chars">40</property>
-            <style>
-              <class name="margin-12"/>
-            </style>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">3</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkButton">
-            <property name="label" translatable="yes">Start New Chat</property>
-            <property name="visible">True</property>
-            <property name="can-focus">True</property>
-            <property name="receives-default">True</property>
-            <property name="halign">center</property>
-            <signal name="clicked" handler="_on_no_disco_continue" 
swapped="no"/>
-            <style>
-              <class name="suggested-action"/>
-            </style>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">4</property>
-          </packing>
-        </child>
-        <style>
-          <class name="margin-18"/>
-        </style>
-      </object>
-      <packing>
-        <property name="name">no-disco</property>
-        <property name="position">5</property>
-      </packing>
+      <placeholder/>
     </child>
   </object>
   <object class="GtkBox" id="placeholder">


=====================================
gajim/gtk/start_chat.py
=====================================
@@ -374,9 +374,7 @@ def _start_new_chat(self, row: ContactRow) -> None:
 
     def _disco_info(self, row: ContactRow) -> None:
         if not app.account_is_available(row.account):
-            # Account is disconnected: offer to open 1:1 chat anyway
-            self._new_chat_row = row
-            self._ui.stack.set_visible_child_name('no-disco')
+            self._show_error_page(_('You are offline.'))
             return
 
         self._ui.stack.set_visible_child_name('progress')
@@ -407,10 +405,9 @@ def _disco_info_received(self, task: Task) -> None:
             self._show_error_page(error.get_text())
             return
         except TimeoutStanzaError:
-            # We reached the 10s timeout, but we should
-            # offer to open a chat anyway
-            self._new_chat_row = row
-            self._ui.stack.set_visible_child_name('no-disco')
+            # We reached the 10s timeout and we cannot
+            # assume which kind contact this is.
+            self._show_error_page(_('This address is not reachable.'))
             return
 
         if result.is_muc:



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/c0f5c2f35feb112d880611b9478c93b886d62343

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/c0f5c2f35feb112d880611b9478c93b886d62343
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to