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


Commits:
bbe243c9 by wurstsalat at 2021-07-16T20:32:27+02:00
Startup: Show AccountWizzard if no account available

- - - - -
082537f1 by wurstsalat at 2021-07-16T21:16:26+02:00
Ellipsize nickname in ChatList and ConversationView

- - - - -
cd151520 by wurstsalat at 2021-07-16T21:36:09+02:00
MessageRow: Improve detecting own nickname

- - - - -
5ddf2d40 by wurstsalat at 2021-07-16T22:47:53+02:00
Settings: Fix initial workspace and migration

- - - - -


5 changed files:

- gajim/common/settings.py
- gajim/data/gui/chat_list_row.ui
- gajim/gtk/conversation/rows/base.py
- gajim/gtk/conversation/rows/message.py
- gajim/gtk/main.py


Changes:

=====================================
gajim/common/settings.py
=====================================
@@ -163,6 +163,8 @@ def init(self) -> None:
         self._load_settings()
         self._load_account_settings()
         if not self._settings['app']:
+            # ['app'] is empty in a newly created database.
+            # If there is an old config, it gets migrated at this point.
             self._migrate_old_config()
             self._commit()
         self._migrate_database()
@@ -247,7 +249,8 @@ def _migrate(self) -> None:
             sql = '''INSERT INTO settings(name, settings)
                      VALUES ('workspaces', ?)'''
             self._con.execute(sql, (json.dumps(INITAL_WORKSPACE),))
-            self._set_user_version(2)
+            self._settings['workspaces'] = INITAL_WORKSPACE
+            self._set_user_version(1)
 
     def _migrate_old_config(self) -> None:
         config_file = configpaths.get('CONFIG_FILE')


=====================================
gajim/data/gui/chat_list_row.ui
=====================================
@@ -148,6 +148,7 @@
                         <property name="can-focus">False</property>
                         <property name="no-show-all">True</property>
                         <property name="halign">start</property>
+                        <property name="ellipsize">end</property>
                         <property name="single-line-mode">True</property>
                         <property name="xalign">0</property>
                         <style>


=====================================
gajim/gtk/conversation/rows/base.py
=====================================
@@ -77,6 +77,7 @@ def create_timestamp_widget(timestamp: datetime) -> Gtk.Label:
     def create_name_widget(name: str, is_self: bool) -> Gtk.Label:
         label = Gtk.Label()
         label.set_selectable(True)
+        label.set_ellipsize(Pango.EllipsizeMode.END)
         label.get_style_context().add_class('conversation-nickname')
         label.set_markup(GLib.markup_escape_text(name))
 


=====================================
gajim/gtk/conversation/rows/message.py
=====================================
@@ -22,6 +22,7 @@
 from gajim.common import app
 from gajim.common.const import AvatarSize
 from gajim.common.const import TRUST_SYMBOL_DATA
+from gajim.common.helpers import get_group_chat_nick
 from gajim.common.helpers import get_muc_context
 from gajim.common.helpers import reduce_chars_newlines
 from gajim.common.helpers import to_user_string
@@ -87,11 +88,14 @@ def __init__(self,
             self._message_widget = MessageWidget(account)
             self._message_widget.add_content(result)
             if self._is_groupchat:
-                if self._contact.get_self().name != name:
+                our_nick = get_group_chat_nick(
+                    self._account, self._contact.jid)
+                if name != our_nick:
                     self._check_for_highlight(result)
 
         if self._is_groupchat:
-            is_self = name == self._contact.get_self().name
+            our_nick = get_group_chat_nick(self._account, self._contact.jid)
+            is_self = name == our_nick
         else:
             is_self = kind == 'outgoing'
         name_widget = self.create_name_widget(name, is_self)


=====================================
gajim/gtk/main.py
=====================================
@@ -80,6 +80,7 @@ def __init__(self):
             ('account-disabled', ged.GUI1, self._on_account_disabled),
         ])
 
+        self._check_for_account()
         self._load_chats()
         self._add_actions()
         self._add_actions2()
@@ -414,6 +415,17 @@ def _remove_contact():
              DialogButton.make('Remove',
                                callback=_remove_contact)]).show()
 
+    @staticmethod
+    def _check_for_account():
+        accounts = app.settings.get_accounts()
+        if (not accounts or accounts == ['Local'] and
+                not app.settings.get_account_setting('Local', 'active')):
+            # Either no account configured or only disabled Local account
+            def _open_wizard():
+                open_window('AccountWizard')
+
+            GLib.idle_add(_open_wizard)
+
     def _load_chats(self):
         for workspace_id in app.settings.get_workspaces():
             self.add_workspace(workspace_id)



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/318ca493a6d716bb69d927c0bbb6d9b543c6ab35...5ddf2d40a78b7ecf567973a400a35dc05fa55142

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/318ca493a6d716bb69d927c0bbb6d9b543c6ab35...5ddf2d40a78b7ecf567973a400a35dc05fa55142
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