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

Commits:

8 changed files:

Changes:

  • gajim/data/gui/app_page.ui
    1
    +<?xml version="1.0" encoding="UTF-8"?>
    
    2
    +<!-- Generated with glade 3.38.2 -->
    
    3
    +<interface>
    
    4
    +  <requires lib="gtk+" version="3.24"/>
    
    5
    +  <object class="GtkBox" id="gajim_update">
    
    6
    +    <property name="visible">True</property>
    
    7
    +    <property name="can-focus">False</property>
    
    8
    +    <property name="spacing">12</property>
    
    9
    +    <child>
    
    10
    +      <object class="GtkButton">
    
    11
    +        <property name="visible">True</property>
    
    12
    +        <property name="can-focus">True</property>
    
    13
    +        <property name="receives-default">True</property>
    
    14
    +        <property name="tooltip-text" translatable="yes">Dismiss</property>
    
    15
    +        <property name="valign">center</property>
    
    16
    +        <signal name="clicked" handler="_on_dismiss_update_clicked" swapped="no"/>
    
    17
    +        <child>
    
    18
    +          <object class="GtkImage">
    
    19
    +            <property name="visible">True</property>
    
    20
    +            <property name="can-focus">False</property>
    
    21
    +            <property name="icon-name">window-close-symbolic</property>
    
    22
    +          </object>
    
    23
    +        </child>
    
    24
    +      </object>
    
    25
    +      <packing>
    
    26
    +        <property name="expand">False</property>
    
    27
    +        <property name="fill">True</property>
    
    28
    +        <property name="pack-type">end</property>
    
    29
    +        <property name="position">0</property>
    
    30
    +      </packing>
    
    31
    +    </child>
    
    32
    +    <child>
    
    33
    +      <object class="GtkButton">
    
    34
    +        <property name="label" translatable="yes">Website</property>
    
    35
    +        <property name="visible">True</property>
    
    36
    +        <property name="can-focus">True</property>
    
    37
    +        <property name="receives-default">True</property>
    
    38
    +        <property name="valign">center</property>
    
    39
    +        <signal name="clicked" handler="_on_visit_website_clicked" swapped="no"/>
    
    40
    +        <style>
    
    41
    +          <class name="suggested-action"/>
    
    42
    +        </style>
    
    43
    +      </object>
    
    44
    +      <packing>
    
    45
    +        <property name="expand">False</property>
    
    46
    +        <property name="fill">True</property>
    
    47
    +        <property name="pack-type">end</property>
    
    48
    +        <property name="position">1</property>
    
    49
    +      </packing>
    
    50
    +    </child>
    
    51
    +    <child>
    
    52
    +      <object class="GtkBox">
    
    53
    +        <property name="visible">True</property>
    
    54
    +        <property name="can-focus">False</property>
    
    55
    +        <property name="valign">center</property>
    
    56
    +        <property name="orientation">vertical</property>
    
    57
    +        <child>
    
    58
    +          <object class="GtkLabel">
    
    59
    +            <property name="visible">True</property>
    
    60
    +            <property name="can-focus">False</property>
    
    61
    +            <property name="halign">start</property>
    
    62
    +            <property name="label" translatable="yes">Gajim Update</property>
    
    63
    +            <property name="ellipsize">end</property>
    
    64
    +            <property name="max-width-chars">30</property>
    
    65
    +            <property name="xalign">0</property>
    
    66
    +            <style>
    
    67
    +              <class name="bold"/>
    
    68
    +            </style>
    
    69
    +          </object>
    
    70
    +          <packing>
    
    71
    +            <property name="expand">False</property>
    
    72
    +            <property name="fill">True</property>
    
    73
    +            <property name="position">0</property>
    
    74
    +          </packing>
    
    75
    +        </child>
    
    76
    +        <child>
    
    77
    +          <object class="GtkLabel" id="update_message">
    
    78
    +            <property name="visible">True</property>
    
    79
    +            <property name="can-focus">False</property>
    
    80
    +            <property name="halign">start</property>
    
    81
    +            <property name="ellipsize">end</property>
    
    82
    +            <property name="max-width-chars">30</property>
    
    83
    +            <property name="xalign">0</property>
    
    84
    +            <style>
    
    85
    +              <class name="dim-label"/>
    
    86
    +            </style>
    
    87
    +          </object>
    
    88
    +          <packing>
    
    89
    +            <property name="expand">False</property>
    
    90
    +            <property name="fill">True</property>
    
    91
    +            <property name="position">1</property>
    
    92
    +          </packing>
    
    93
    +        </child>
    
    94
    +      </object>
    
    95
    +      <packing>
    
    96
    +        <property name="expand">True</property>
    
    97
    +        <property name="fill">True</property>
    
    98
    +        <property name="position">2</property>
    
    99
    +      </packing>
    
    100
    +    </child>
    
    101
    +    <style>
    
    102
    +      <class name="padding-6"/>
    
    103
    +    </style>
    
    104
    +  </object>
    
    105
    +  <object class="GtkBox" id="gajim_update_check">
    
    106
    +    <property name="visible">True</property>
    
    107
    +    <property name="can-focus">False</property>
    
    108
    +    <property name="spacing">12</property>
    
    109
    +    <child>
    
    110
    +      <object class="GtkButton">
    
    111
    +        <property name="visible">True</property>
    
    112
    +        <property name="can-focus">True</property>
    
    113
    +        <property name="receives-default">True</property>
    
    114
    +        <property name="tooltip-text" translatable="yes">Dismiss</property>
    
    115
    +        <property name="valign">center</property>
    
    116
    +        <signal name="clicked" handler="_on_dismiss_check_clicked" swapped="no"/>
    
    117
    +        <child>
    
    118
    +          <object class="GtkImage">
    
    119
    +            <property name="visible">True</property>
    
    120
    +            <property name="can-focus">False</property>
    
    121
    +            <property name="icon-name">window-close-symbolic</property>
    
    122
    +          </object>
    
    123
    +        </child>
    
    124
    +      </object>
    
    125
    +      <packing>
    
    126
    +        <property name="expand">False</property>
    
    127
    +        <property name="fill">True</property>
    
    128
    +        <property name="pack-type">end</property>
    
    129
    +        <property name="position">0</property>
    
    130
    +      </packing>
    
    131
    +    </child>
    
    132
    +    <child>
    
    133
    +      <object class="GtkButton">
    
    134
    +        <property name="label" translatable="yes">Yes</property>
    
    135
    +        <property name="visible">True</property>
    
    136
    +        <property name="can-focus">True</property>
    
    137
    +        <property name="receives-default">True</property>
    
    138
    +        <property name="valign">center</property>
    
    139
    +        <signal name="clicked" handler="_on_check_clicked" swapped="no"/>
    
    140
    +        <style>
    
    141
    +          <class name="suggested-action"/>
    
    142
    +        </style>
    
    143
    +      </object>
    
    144
    +      <packing>
    
    145
    +        <property name="expand">False</property>
    
    146
    +        <property name="fill">True</property>
    
    147
    +        <property name="pack-type">end</property>
    
    148
    +        <property name="position">1</property>
    
    149
    +      </packing>
    
    150
    +    </child>
    
    151
    +    <child>
    
    152
    +      <object class="GtkBox">
    
    153
    +        <property name="visible">True</property>
    
    154
    +        <property name="can-focus">False</property>
    
    155
    +        <property name="valign">center</property>
    
    156
    +        <property name="orientation">vertical</property>
    
    157
    +        <child>
    
    158
    +          <object class="GtkLabel">
    
    159
    +            <property name="visible">True</property>
    
    160
    +            <property name="can-focus">False</property>
    
    161
    +            <property name="halign">start</property>
    
    162
    +            <property name="label" translatable="yes">Update Check</property>
    
    163
    +            <property name="ellipsize">end</property>
    
    164
    +            <property name="max-width-chars">30</property>
    
    165
    +            <property name="xalign">0</property>
    
    166
    +            <style>
    
    167
    +              <class name="bold"/>
    
    168
    +            </style>
    
    169
    +          </object>
    
    170
    +          <packing>
    
    171
    +            <property name="expand">False</property>
    
    172
    +            <property name="fill">True</property>
    
    173
    +            <property name="position">0</property>
    
    174
    +          </packing>
    
    175
    +        </child>
    
    176
    +        <child>
    
    177
    +          <object class="GtkLabel">
    
    178
    +            <property name="visible">True</property>
    
    179
    +            <property name="can-focus">False</property>
    
    180
    +            <property name="halign">start</property>
    
    181
    +            <property name="label" translatable="yes">Search for Gajim updates periodically?</property>
    
    182
    +            <property name="ellipsize">end</property>
    
    183
    +            <property name="max-width-chars">30</property>
    
    184
    +            <property name="xalign">0</property>
    
    185
    +            <style>
    
    186
    +              <class name="dim-label"/>
    
    187
    +            </style>
    
    188
    +          </object>
    
    189
    +          <packing>
    
    190
    +            <property name="expand">False</property>
    
    191
    +            <property name="fill">True</property>
    
    192
    +            <property name="position">1</property>
    
    193
    +          </packing>
    
    194
    +        </child>
    
    195
    +      </object>
    
    196
    +      <packing>
    
    197
    +        <property name="expand">True</property>
    
    198
    +        <property name="fill">True</property>
    
    199
    +        <property name="position">2</property>
    
    200
    +      </packing>
    
    201
    +    </child>
    
    202
    +    <style>
    
    203
    +      <class name="padding-6"/>
    
    204
    +    </style>
    
    205
    +  </object>
    
    206
    +</interface>

  • gajim/data/gui/main.ui
    ... ... @@ -67,21 +67,13 @@
    67 67
               </packing>
    
    68 68
             </child>
    
    69 69
             <child>
    
    70
    -          <object class="GtkBox">
    
    70
    +          <object class="GtkBox" id="app_box">
    
    71 71
                 <property name="visible">True</property>
    
    72 72
                 <property name="can-focus">False</property>
    
    73 73
                 <property name="orientation">vertical</property>
    
    74 74
                 <property name="spacing">12</property>
    
    75 75
                 <child>
    
    76
    -              <object class="GtkImage" id="app_image">
    
    77
    -                <property name="visible">True</property>
    
    78
    -                <property name="can-focus">False</property>
    
    79
    -              </object>
    
    80
    -              <packing>
    
    81
    -                <property name="expand">False</property>
    
    82
    -                <property name="fill">True</property>
    
    83
    -                <property name="position">0</property>
    
    84
    -              </packing>
    
    76
    +              <placeholder/>
    
    85 77
                 </child>
    
    86 78
                 <child>
    
    87 79
                   <object class="GtkSeparator">
    
    ... ... @@ -91,11 +83,12 @@
    91 83
                   <packing>
    
    92 84
                     <property name="expand">False</property>
    
    93 85
                     <property name="fill">True</property>
    
    86
    +                <property name="pack-type">end</property>
    
    94 87
                     <property name="position">1</property>
    
    95 88
                   </packing>
    
    96 89
                 </child>
    
    97 90
                 <style>
    
    98
    -              <class name="app-image-box"/>
    
    91
    +              <class name="app-page-box"/>
    
    99 92
                 </style>
    
    100 93
               </object>
    
    101 94
               <packing>
    

  • gajim/data/style/gajim.css
    ... ... @@ -144,9 +144,19 @@
    144 144
         background: @theme_bg_color;
    
    145 145
     }
    
    146 146
     
    
    147
    -.app-image-box { margin: 12px 12px 0px 12px; }
    
    148
    -.app-image-box > separator {
    
    147
    +.app-page-box {
    
    148
    +    margin-top: 6px;
    
    149
    +}
    
    150
    +.app-page-box > separator {
    
    149 151
         background-color: darker(@theme_bg_color);
    
    152
    +    margin-left: 12px;
    
    153
    +    margin-right: 12px;
    
    154
    +}
    
    155
    +.app-page {
    
    156
    +    padding: 18px;
    
    157
    +}
    
    158
    +.app-message-listbox row {
    
    159
    +    border: 1px solid @borders;
    
    150 160
     }
    
    151 161
     
    
    152 162
     /* Workspace sidebar */
    

  • gajim/gtk/app_page.py
    1
    +# This file is part of Gajim.
    
    2
    +#
    
    3
    +# Gajim is free software; you can redistribute it and/or modify
    
    4
    +# it under the terms of the GNU General Public License as published
    
    5
    +# by the Free Software Foundation; version 3 only.
    
    6
    +#
    
    7
    +# Gajim is distributed in the hope that it will be useful,
    
    8
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    9
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    
    10
    +# GNU General Public License for more details.
    
    11
    +#
    
    12
    +# You should have received a copy of the GNU General Public License
    
    13
    +# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
    
    14
    +
    
    15
    +from gi.repository import GObject
    
    16
    +from gi.repository import Gtk
    
    17
    +
    
    18
    +from gajim.common import app
    
    19
    +from gajim.common.helpers import open_uri
    
    20
    +from gajim.common.i18n import _
    
    21
    +
    
    22
    +from .util import get_builder
    
    23
    +
    
    24
    +
    
    25
    +class AppPage(Gtk.Box):
    
    26
    +
    
    27
    +    __gsignals__ = {
    
    28
    +        'unread-count-changed': (GObject.SignalFlags.RUN_LAST,
    
    29
    +                                 None,
    
    30
    +                                 (int, )),
    
    31
    +    }
    
    32
    +
    
    33
    +    def __init__(self):
    
    34
    +        Gtk.Box.__init__(self,
    
    35
    +                         orientation=Gtk.Orientation.VERTICAL,
    
    36
    +                         spacing=12)
    
    37
    +        self.get_style_context().add_class('app-page')
    
    38
    +
    
    39
    +        self._unread_count = 0
    
    40
    +
    
    41
    +        update_label = Gtk.Label(label=_('Updates'))
    
    42
    +        update_label.get_style_context().add_class('large-header')
    
    43
    +        self.add(update_label)
    
    44
    +
    
    45
    +        self._app_message_listbox = AppMessageListBox()
    
    46
    +        self.add(self._app_message_listbox)
    
    47
    +
    
    48
    +        self.show_all()
    
    49
    +
    
    50
    +    def add_app_message(self, category, message):
    
    51
    +        self._app_message_listbox.add_app_message(category, message)
    
    52
    +
    
    53
    +        self._unread_count += 1
    
    54
    +        self.emit('unread-count-changed', self._unread_count)
    
    55
    +
    
    56
    +    def remove_app_message(self):
    
    57
    +        self._unread_count -= 1
    
    58
    +        self.emit('unread-count-changed', self._unread_count)
    
    59
    +
    
    60
    +    def process_event(self, event):
    
    61
    +        pass
    
    62
    +
    
    63
    +
    
    64
    +class AppMessageListBox(Gtk.ListBox):
    
    65
    +    def __init__(self):
    
    66
    +        Gtk.ListBox.__init__(self)
    
    67
    +        self.set_selection_mode(Gtk.SelectionMode.NONE)
    
    68
    +        self.set_halign(Gtk.Align.CENTER)
    
    69
    +        self.set_size_request(400, -1)
    
    70
    +        self.get_style_context().add_class('app-message-listbox')
    
    71
    +
    
    72
    +        placeholder = Gtk.Label(label=_('No updates available'))
    
    73
    +        placeholder.get_style_context().add_class('dim-label')
    
    74
    +        placeholder.show()
    
    75
    +        self.set_placeholder(placeholder)
    
    76
    +
    
    77
    +        self.show_all()
    
    78
    +
    
    79
    +    def add_app_message(self, category, message):
    
    80
    +        row = AppMessageRow(category, message)
    
    81
    +        self.add(row)
    
    82
    +
    
    83
    +    def remove_app_message(self, row):
    
    84
    +        self.remove(row)
    
    85
    +        self.get_parent().remove_app_message()
    
    86
    +
    
    87
    +
    
    88
    +class AppMessageRow(Gtk.ListBoxRow):
    
    89
    +    def __init__(self, category, message=None):
    
    90
    +        Gtk.ListBoxRow.__init__(self)
    
    91
    +        self._ui = get_builder('app_page.ui')
    
    92
    +
    
    93
    +        if category == 'gajim-update-check':
    
    94
    +            self.add(self._ui.gajim_update_check)
    
    95
    +
    
    96
    +        if category == 'gajim-update':
    
    97
    +            self.add(self._ui.gajim_update)
    
    98
    +            text = _('Version %s is available') % message
    
    99
    +            self._ui.update_message.set_text(text)
    
    100
    +
    
    101
    +        self._ui.connect_signals(self)
    
    102
    +        self.show_all()
    
    103
    +
    
    104
    +    def _on_check_clicked(self, _button):
    
    105
    +        app.interface.get_latest_release()
    
    106
    +        self.get_parent().remove_app_message(self)
    
    107
    +
    
    108
    +    def _on_dismiss_check_clicked(self, _button):
    
    109
    +        app.settings.set('check_for_update', False)
    
    110
    +        self.get_parent().remove_app_message(self)
    
    111
    +
    
    112
    +    def _on_visit_website_clicked(self, _button):
    
    113
    +        open_uri('https://gajim.org/download')
    
    114
    +        self.get_parent().remove_app_message(self)
    
    115
    +
    
    116
    +    def _on_dismiss_update_clicked(self, _button):
    
    117
    +        self.get_parent().remove_app_message(self)

  • gajim/gtk/app_side_bar.py
    1
    +# This file is part of Gajim.
    
    2
    +#
    
    3
    +# Gajim is free software; you can redistribute it and/or modify
    
    4
    +# it under the terms of the GNU General Public License as published
    
    5
    +# by the Free Software Foundation; version 3 only.
    
    6
    +#
    
    7
    +# Gajim is distributed in the hope that it will be useful,
    
    8
    +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    9
    +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    
    10
    +# GNU General Public License for more details.
    
    11
    +#
    
    12
    +# You should have received a copy of the GNU General Public License
    
    13
    +# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
    
    14
    +
    
    15
    +from gi.repository import Gtk
    
    16
    +
    
    17
    +from gajim.common import app
    
    18
    +
    
    19
    +from gajim.gui.util import load_icon
    
    20
    +
    
    21
    +
    
    22
    +class AppSideBar(Gtk.ListBox):
    
    23
    +    def __init__(self, app_page):
    
    24
    +        Gtk.ListBox.__init__(self)
    
    25
    +        self.set_selection_mode(Gtk.SelectionMode.NONE)
    
    26
    +        self.set_valign(Gtk.Align.START)
    
    27
    +        self.get_style_context().add_class('workspace-sidebar')
    
    28
    +
    
    29
    +        self.connect('row-activated', self._on_app_row_activated)
    
    30
    +
    
    31
    +        app_page.connect('unread-count-changed', self._on_unread_count_changed)
    
    32
    +
    
    33
    +        self._app_row = AppRow()
    
    34
    +        self.add(self._app_row)
    
    35
    +
    
    36
    +        self.show_all()
    
    37
    +
    
    38
    +    @staticmethod
    
    39
    +    def _on_app_row_activated(_listbox, _row):
    
    40
    +        app.window.show_app_page()
    
    41
    +
    
    42
    +    def _on_unread_count_changed(self, _app_page, count):
    
    43
    +        self._app_row.set_unread_count(count)
    
    44
    +
    
    45
    +
    
    46
    +class AppRow(Gtk.ListBoxRow):
    
    47
    +    def __init__(self):
    
    48
    +        Gtk.ListBoxRow.__init__(self)
    
    49
    +        self.get_style_context().add_class('workspace-sidebar-item')
    
    50
    +
    
    51
    +        self._unread_label = Gtk.Label()
    
    52
    +        self._unread_label.get_style_context().add_class(
    
    53
    +            'unread-counter')
    
    54
    +        self._unread_label.set_no_show_all(True)
    
    55
    +        self._unread_label.set_halign(Gtk.Align.END)
    
    56
    +        self._unread_label.set_valign(Gtk.Align.START)
    
    57
    +
    
    58
    +        surface = load_icon('org.gajim.Gajim', self, 40)
    
    59
    +        image = Gtk.Image.new_from_surface(surface)
    
    60
    +
    
    61
    +        selection_bar = Gtk.Box()
    
    62
    +        selection_bar.set_size_request(6, -1)
    
    63
    +        selection_bar.get_style_context().add_class('selection-bar')
    
    64
    +
    
    65
    +        item_box = Gtk.Box()
    
    66
    +        item_box.add(selection_bar)
    
    67
    +        item_box.add(image)
    
    68
    +
    
    69
    +        overlay = Gtk.Overlay()
    
    70
    +        overlay.add(item_box)
    
    71
    +        overlay.add_overlay(self._unread_label)
    
    72
    +
    
    73
    +        self.add(overlay)
    
    74
    +        self.show_all()
    
    75
    +
    
    76
    +    def set_unread_count(self, count):
    
    77
    +        if count < 1000:
    
    78
    +            self._unread_label.set_text(str(count))
    
    79
    +        else:
    
    80
    +            self._unread_label.set_text('999+')
    
    81
    +        self._unread_label.set_visible(bool(count))

  • gajim/gtk/main.py
    ... ... @@ -13,12 +13,12 @@
    13 13
     
    
    14 14
     from gajim.gui.adhoc import AdHocCommand
    
    15 15
     from gajim.gui.account_side_bar import AccountSideBar
    
    16
    +from gajim.gui.app_side_bar import AppSideBar
    
    16 17
     from gajim.gui.workspace_side_bar import WorkspaceSideBar
    
    17 18
     from gajim.gui.main_stack import MainStack
    
    18 19
     from gajim.gui.dialogs import DialogButton
    
    19 20
     from gajim.gui.dialogs import ConfirmationDialog
    
    20 21
     from gajim.gui.util import get_builder
    
    21
    -from gajim.gui.util import load_icon
    
    22 22
     
    
    23 23
     from .util import open_window
    
    24 24
     
    
    ... ... @@ -42,14 +42,15 @@ def __init__(self):
    42 42
     
    
    43 43
             self.add(self._ui.main_grid)
    
    44 44
     
    
    45
    -        surface = load_icon('org.gajim.Gajim', self, 40)
    
    46
    -        self._ui.app_image.set_from_surface(surface)
    
    47
    -
    
    48 45
             self._main_stack = MainStack()
    
    49 46
             self._ui.main_grid.add(self._main_stack)
    
    50 47
     
    
    51 48
             self._chat_page = self._main_stack.get_chat_page()
    
    52 49
     
    
    50
    +        self._app_page = self._main_stack.get_app_page()
    
    51
    +        self._app_side_bar = AppSideBar(self._app_page)
    
    52
    +        self._ui.app_box.add(self._app_side_bar)
    
    53
    +
    
    53 54
             self._workspace_side_bar = WorkspaceSideBar(self._chat_page)
    
    54 55
             self._ui.workspace_scrolled.add(self._workspace_side_bar)
    
    55 56
     
    
    ... ... @@ -334,6 +335,12 @@ def _add_to_roster(_action, param):
    334 335
             _workspace, account, jid = param.unpack()
    
    335 336
             open_window('AddContact', account=account, jid=jid)
    
    336 337
     
    
    338
    +    def show_app_page(self):
    
    339
    +        self._main_stack.show_app_page()
    
    340
    +
    
    341
    +    def add_app_message(self, category, message=None):
    
    342
    +        self._app_page.add_app_message(category, message)
    
    343
    +
    
    337 344
         def get_control(self, *args, **kwargs):
    
    338 345
             return self._chat_page.get_control(*args, **kwargs)
    
    339 346
     
    

  • gajim/gtk/main_stack.py
    ... ... @@ -16,6 +16,7 @@
    16 16
     
    
    17 17
     from gajim.common import app
    
    18 18
     
    
    19
    +from .app_page import AppPage
    
    19 20
     from .chat_page import ChatPage
    
    20 21
     from .account_page import AccountPage
    
    21 22
     
    
    ... ... @@ -26,6 +27,9 @@ def __init__(self):
    26 27
     
    
    27 28
             self.add_named(Gtk.Box(), 'empty')
    
    28 29
     
    
    30
    +        self._app_page = AppPage()
    
    31
    +        self.add_named(self._app_page, 'app')
    
    32
    +
    
    29 33
             self._chat_page = ChatPage()
    
    30 34
             self._chat_page.connect('chat-selected', self._on_chat_selected)
    
    31 35
             self.add_named(self._chat_page, 'chats')
    
    ... ... @@ -44,6 +48,12 @@ def remove_account_page(self, account):
    44 48
         def remove_chats_for_account(self, account):
    
    45 49
             self._chat_page.remove_chats_for_account(account)
    
    46 50
     
    
    51
    +    def show_app_page(self):
    
    52
    +        self.set_visible_child_name('app')
    
    53
    +
    
    54
    +    def get_app_page(self):
    
    55
    +        return self.get_child_by_name('app')
    
    56
    +
    
    47 57
         def show_chats(self, workspace_id):
    
    48 58
             self._chat_page.show_workspace_chats(workspace_id)
    
    49 59
             self.set_visible_child_name('chats')
    

  • gajim/gui_interface.py
    ... ... @@ -91,7 +91,6 @@
    91 91
     from gajim.gui.dialogs import WarningDialog
    
    92 92
     from gajim.gui.dialogs import InformationDialog
    
    93 93
     from gajim.gui.dialogs import ConfirmationDialog
    
    94
    -from gajim.gui.dialogs import ConfirmationCheckDialog
    
    95 94
     from gajim.gui.dialogs import InputDialog
    
    96 95
     from gajim.gui.dialogs import PassphraseDialog
    
    97 96
     from gajim.gui.filechoosers import FileChooserDialog
    
    ... ... @@ -1710,35 +1709,21 @@ def check_for_updates(self):
    1710 1709
             now = datetime.now()
    
    1711 1710
             last_check = app.settings.get('last_update_check')
    
    1712 1711
             if not last_check:
    
    1713
    -            def _on_cancel():
    
    1714
    -                app.settings.set('check_for_update', False)
    
    1715
    -
    
    1716
    -            def _on_check():
    
    1717
    -                self._get_latest_release()
    
    1718
    -
    
    1719
    -            ConfirmationDialog(
    
    1720
    -                _('Update Check'),
    
    1721
    -                _('Gajim Update Check'),
    
    1722
    -                _('Search for Gajim updates periodically?'),
    
    1723
    -                [DialogButton.make('Cancel',
    
    1724
    -                                   text=_('_No'),
    
    1725
    -                                   callback=_on_cancel),
    
    1726
    -                 DialogButton.make('Accept',
    
    1727
    -                                   text=_('_Search Periodically'),
    
    1728
    -                                   callback=_on_check)]).show()
    
    1712
    +            app.window.add_app_message('gajim-update-check')
    
    1729 1713
                 return
    
    1730 1714
     
    
    1731 1715
             last_check_time = datetime.strptime(last_check, '%Y-%m-%d %H:%M')
    
    1732 1716
             if (now - last_check_time).days < 7:
    
    1733 1717
                 return
    
    1734 1718
     
    
    1735
    -        self._get_latest_release()
    
    1719
    +        self.get_latest_release()
    
    1736 1720
     
    
    1737
    -    def _get_latest_release(self):
    
    1721
    +    def get_latest_release(self):
    
    1738 1722
             log.info('Checking for Gajim updates')
    
    1739 1723
             session = Soup.Session()
    
    1740 1724
             session.props.user_agent = 'Gajim %s' % app.version
    
    1741
    -        message = Soup.Message.new('GET', 'https://gajim.org/current-version.json')
    
    1725
    +        message = Soup.Message.new(
    
    1726
    +            'GET', 'https://gajim.org/current-version.json')
    
    1742 1727
             session.queue_message(message, self._on_update_checked)
    
    1743 1728
     
    
    1744 1729
         def _on_update_checked(self, _session, message):
    
    ... ... @@ -1754,27 +1739,7 @@ def _on_update_checked(self, _session, message):
    1754 1739
             latest_version = data['current_version']
    
    1755 1740
     
    
    1756 1741
             if V(latest_version) > V(app.version):
    
    1757
    -            def _on_cancel(is_checked):
    
    1758
    -                if is_checked:
    
    1759
    -                    app.settings.set('check_for_update', False)
    
    1760
    -
    
    1761
    -            def _on_update(is_checked):
    
    1762
    -                if is_checked:
    
    1763
    -                    app.settings.set('check_for_update', False)
    
    1764
    -                helpers.open_uri('https://gajim.org/download')
    
    1765
    -
    
    1766
    -            ConfirmationCheckDialog(
    
    1767
    -                _('Update Available'),
    
    1768
    -                _('Gajim Update Available'),
    
    1769
    -                _('There is an update available for Gajim '
    
    1770
    -                  '(latest version: %s)') % str(latest_version),
    
    1771
    -                _('_Do not show again'),
    
    1772
    -                [DialogButton.make('Cancel',
    
    1773
    -                                    text=_('_Later'),
    
    1774
    -                                    callback=_on_cancel),
    
    1775
    -                 DialogButton.make('Accept',
    
    1776
    -                                    text=_('_Update Now'),
    
    1777
    -                                    callback=_on_update)]).show()
    
    1742
    +            app.window.add_app_message('gajim-update', latest_version)
    
    1778 1743
             else:
    
    1779 1744
                 log.info('Gajim is up to date')
    
    1780 1745