Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
-
da303a80
by wurstsalat at 2021-07-26T20:32:40+02:00
-
9bcc42ed
by wurstsalat at 2021-07-26T21:17:22+02:00
-
5fd4e96b
by wurstsalat at 2021-07-26T21:17:47+02:00
-
4a3dbf13
by wurstsalat at 2021-07-26T21:28:57+02:00
9 changed files:
- gajim/data/gui/account_page.ui
- gajim/data/style/gajim-dark.css
- gajim/data/style/gajim.css
- gajim/gtk/conversation/message_widget.py
- gajim/gtk/conversation/plain_widget.py
- gajim/gtk/conversation/rows/base.py
- gajim/gtk/notification_manager.py
- gajim/gtk/search_view.py
- gajim/gui_interface.py
Changes:
| ... | ... | @@ -117,156 +117,168 @@ |
| 117 | 117 |
</packing>
|
| 118 | 118 |
</child>
|
| 119 | 119 |
<child>
|
| 120 |
- <object class="GtkBox" id="account_box">
|
|
| 120 |
+ <object class="GtkScrolledWindow">
|
|
| 121 | 121 |
<property name="visible">True</property>
|
| 122 |
- <property name="can-focus">False</property>
|
|
| 123 |
- <property name="hexpand">True</property>
|
|
| 124 |
- <property name="orientation">vertical</property>
|
|
| 125 |
- <property name="spacing">18</property>
|
|
| 122 |
+ <property name="can-focus">True</property>
|
|
| 126 | 123 |
<child>
|
| 127 |
- <object class="GtkBox">
|
|
| 124 |
+ <object class="GtkViewport">
|
|
| 128 | 125 |
<property name="visible">True</property>
|
| 129 | 126 |
<property name="can-focus">False</property>
|
| 130 |
- <property name="orientation">vertical</property>
|
|
| 131 |
- <property name="spacing">6</property>
|
|
| 132 | 127 |
<child>
|
| 133 |
- <object class="GtkOverlay">
|
|
| 128 |
+ <object class="GtkBox" id="account_box">
|
|
| 134 | 129 |
<property name="visible">True</property>
|
| 135 | 130 |
<property name="can-focus">False</property>
|
| 136 |
- <property name="halign">center</property>
|
|
| 131 |
+ <property name="hexpand">True</property>
|
|
| 132 |
+ <property name="orientation">vertical</property>
|
|
| 133 |
+ <property name="spacing">18</property>
|
|
| 137 | 134 |
<child>
|
| 138 |
- <object class="GtkImage" id="avatar_image">
|
|
| 135 |
+ <object class="GtkBox">
|
|
| 139 | 136 |
<property name="visible">True</property>
|
| 140 | 137 |
<property name="can-focus">False</property>
|
| 141 |
- <property name="icon-name">missging-image</property>
|
|
| 142 |
- <property name="icon_size">6</property>
|
|
| 138 |
+ <property name="orientation">vertical</property>
|
|
| 139 |
+ <property name="spacing">6</property>
|
|
| 140 |
+ <child>
|
|
| 141 |
+ <object class="GtkOverlay">
|
|
| 142 |
+ <property name="visible">True</property>
|
|
| 143 |
+ <property name="can-focus">False</property>
|
|
| 144 |
+ <property name="halign">center</property>
|
|
| 145 |
+ <child>
|
|
| 146 |
+ <object class="GtkImage" id="avatar_image">
|
|
| 147 |
+ <property name="visible">True</property>
|
|
| 148 |
+ <property name="can-focus">False</property>
|
|
| 149 |
+ <property name="icon-name">missging-image</property>
|
|
| 150 |
+ <property name="icon_size">6</property>
|
|
| 151 |
+ </object>
|
|
| 152 |
+ <packing>
|
|
| 153 |
+ <property name="index">-1</property>
|
|
| 154 |
+ </packing>
|
|
| 155 |
+ </child>
|
|
| 156 |
+ <child type="overlay">
|
|
| 157 |
+ <object class="GtkButton">
|
|
| 158 |
+ <property name="visible">True</property>
|
|
| 159 |
+ <property name="can-focus">True</property>
|
|
| 160 |
+ <property name="receives-default">True</property>
|
|
| 161 |
+ <property name="tooltip-text" translatable="yes">Edit Profile…</property>
|
|
| 162 |
+ <property name="halign">end</property>
|
|
| 163 |
+ <property name="valign">start</property>
|
|
| 164 |
+ <signal name="clicked" handler="_on_edit_profile" swapped="no"/>
|
|
| 165 |
+ <child>
|
|
| 166 |
+ <object class="GtkImage">
|
|
| 167 |
+ <property name="visible">True</property>
|
|
| 168 |
+ <property name="can-focus">False</property>
|
|
| 169 |
+ <property name="icon-name">document-edit-symbolic</property>
|
|
| 170 |
+ </object>
|
|
| 171 |
+ </child>
|
|
| 172 |
+ </object>
|
|
| 173 |
+ </child>
|
|
| 174 |
+ </object>
|
|
| 175 |
+ <packing>
|
|
| 176 |
+ <property name="expand">False</property>
|
|
| 177 |
+ <property name="fill">True</property>
|
|
| 178 |
+ <property name="position">0</property>
|
|
| 179 |
+ </packing>
|
|
| 180 |
+ </child>
|
|
| 181 |
+ <child>
|
|
| 182 |
+ <object class="GtkLabel" id="account_label">
|
|
| 183 |
+ <property name="visible">True</property>
|
|
| 184 |
+ <property name="can-focus">False</property>
|
|
| 185 |
+ <property name="label"><name></property>
|
|
| 186 |
+ <style>
|
|
| 187 |
+ <class name="large-header"/>
|
|
| 188 |
+ </style>
|
|
| 189 |
+ </object>
|
|
| 190 |
+ <packing>
|
|
| 191 |
+ <property name="expand">False</property>
|
|
| 192 |
+ <property name="fill">True</property>
|
|
| 193 |
+ <property name="position">1</property>
|
|
| 194 |
+ </packing>
|
|
| 195 |
+ </child>
|
|
| 143 | 196 |
</object>
|
| 144 | 197 |
<packing>
|
| 145 |
- <property name="index">-1</property>
|
|
| 198 |
+ <property name="expand">False</property>
|
|
| 199 |
+ <property name="fill">True</property>
|
|
| 200 |
+ <property name="position">0</property>
|
|
| 146 | 201 |
</packing>
|
| 147 | 202 |
</child>
|
| 148 |
- <child type="overlay">
|
|
| 149 |
- <object class="GtkButton">
|
|
| 203 |
+ <child>
|
|
| 204 |
+ <object class="GtkBox" id="account_action_box">
|
|
| 150 | 205 |
<property name="visible">True</property>
|
| 151 |
- <property name="can-focus">True</property>
|
|
| 152 |
- <property name="receives-default">True</property>
|
|
| 153 |
- <property name="tooltip-text" translatable="yes">Edit Profile…</property>
|
|
| 154 |
- <property name="halign">end</property>
|
|
| 155 |
- <property name="valign">start</property>
|
|
| 156 |
- <signal name="clicked" handler="_on_edit_profile" swapped="no"/>
|
|
| 206 |
+ <property name="can-focus">False</property>
|
|
| 207 |
+ <property name="halign">center</property>
|
|
| 208 |
+ <property name="spacing">12</property>
|
|
| 157 | 209 |
<child>
|
| 158 |
- <object class="GtkImage">
|
|
| 210 |
+ <object class="GtkButton" id="account_settings">
|
|
| 159 | 211 |
<property name="visible">True</property>
|
| 160 |
- <property name="can-focus">False</property>
|
|
| 161 |
- <property name="icon-name">document-edit-symbolic</property>
|
|
| 212 |
+ <property name="can-focus">True</property>
|
|
| 213 |
+ <property name="receives-default">True</property>
|
|
| 214 |
+ <property name="tooltip-text" translatable="yes">Account Settings…</property>
|
|
| 215 |
+ <property name="halign">end</property>
|
|
| 216 |
+ <signal name="clicked" handler="_on_account_settings" swapped="no"/>
|
|
| 217 |
+ <child>
|
|
| 218 |
+ <object class="GtkImage">
|
|
| 219 |
+ <property name="visible">True</property>
|
|
| 220 |
+ <property name="can-focus">False</property>
|
|
| 221 |
+ <property name="icon-name">preferences-other-symbolic</property>
|
|
| 222 |
+ </object>
|
|
| 223 |
+ </child>
|
|
| 162 | 224 |
</object>
|
| 225 |
+ <packing>
|
|
| 226 |
+ <property name="expand">False</property>
|
|
| 227 |
+ <property name="fill">True</property>
|
|
| 228 |
+ <property name="position">0</property>
|
|
| 229 |
+ </packing>
|
|
| 230 |
+ </child>
|
|
| 231 |
+ <child>
|
|
| 232 |
+ <placeholder/>
|
|
| 163 | 233 |
</child>
|
| 164 | 234 |
</object>
|
| 235 |
+ <packing>
|
|
| 236 |
+ <property name="expand">False</property>
|
|
| 237 |
+ <property name="fill">True</property>
|
|
| 238 |
+ <property name="position">1</property>
|
|
| 239 |
+ </packing>
|
|
| 165 | 240 |
</child>
|
| 166 |
- </object>
|
|
| 167 |
- <packing>
|
|
| 168 |
- <property name="expand">False</property>
|
|
| 169 |
- <property name="fill">True</property>
|
|
| 170 |
- <property name="position">0</property>
|
|
| 171 |
- </packing>
|
|
| 172 |
- </child>
|
|
| 173 |
- <child>
|
|
| 174 |
- <object class="GtkLabel" id="account_label">
|
|
| 175 |
- <property name="visible">True</property>
|
|
| 176 |
- <property name="can-focus">False</property>
|
|
| 177 |
- <property name="label"><name></property>
|
|
| 178 |
- <style>
|
|
| 179 |
- <class name="large-header"/>
|
|
| 180 |
- </style>
|
|
| 181 |
- </object>
|
|
| 182 |
- <packing>
|
|
| 183 |
- <property name="expand">False</property>
|
|
| 184 |
- <property name="fill">True</property>
|
|
| 185 |
- <property name="position">1</property>
|
|
| 186 |
- </packing>
|
|
| 187 |
- </child>
|
|
| 188 |
- </object>
|
|
| 189 |
- <packing>
|
|
| 190 |
- <property name="expand">False</property>
|
|
| 191 |
- <property name="fill">True</property>
|
|
| 192 |
- <property name="position">0</property>
|
|
| 193 |
- </packing>
|
|
| 194 |
- </child>
|
|
| 195 |
- <child>
|
|
| 196 |
- <object class="GtkBox" id="account_action_box">
|
|
| 197 |
- <property name="visible">True</property>
|
|
| 198 |
- <property name="can-focus">False</property>
|
|
| 199 |
- <property name="halign">center</property>
|
|
| 200 |
- <property name="spacing">12</property>
|
|
| 201 |
- <child>
|
|
| 202 |
- <object class="GtkButton" id="account_settings">
|
|
| 203 |
- <property name="visible">True</property>
|
|
| 204 |
- <property name="can-focus">True</property>
|
|
| 205 |
- <property name="receives-default">True</property>
|
|
| 206 |
- <property name="tooltip-text" translatable="yes">Account Settings…</property>
|
|
| 207 |
- <property name="halign">end</property>
|
|
| 208 |
- <signal name="clicked" handler="_on_account_settings" swapped="no"/>
|
|
| 209 | 241 |
<child>
|
| 210 |
- <object class="GtkImage">
|
|
| 242 |
+ <object class="GtkBox" id="status_message_box">
|
|
| 211 | 243 |
<property name="visible">True</property>
|
| 212 | 244 |
<property name="can-focus">False</property>
|
| 213 |
- <property name="icon-name">preferences-other-symbolic</property>
|
|
| 245 |
+ <property name="orientation">vertical</property>
|
|
| 246 |
+ <child>
|
|
| 247 |
+ <placeholder/>
|
|
| 248 |
+ </child>
|
|
| 214 | 249 |
</object>
|
| 250 |
+ <packing>
|
|
| 251 |
+ <property name="expand">False</property>
|
|
| 252 |
+ <property name="fill">True</property>
|
|
| 253 |
+ <property name="position">2</property>
|
|
| 254 |
+ </packing>
|
|
| 215 | 255 |
</child>
|
| 256 |
+ <child>
|
|
| 257 |
+ <object class="GtkLabel">
|
|
| 258 |
+ <property name="visible">True</property>
|
|
| 259 |
+ <property name="can-focus">False</property>
|
|
| 260 |
+ <property name="margin-top">6</property>
|
|
| 261 |
+ <property name="label" translatable="yes">Notifications</property>
|
|
| 262 |
+ <style>
|
|
| 263 |
+ <class name="bold16"/>
|
|
| 264 |
+ </style>
|
|
| 265 |
+ </object>
|
|
| 266 |
+ <packing>
|
|
| 267 |
+ <property name="expand">False</property>
|
|
| 268 |
+ <property name="fill">True</property>
|
|
| 269 |
+ <property name="position">3</property>
|
|
| 270 |
+ </packing>
|
|
| 271 |
+ </child>
|
|
| 272 |
+ <child>
|
|
| 273 |
+ <placeholder/>
|
|
| 274 |
+ </child>
|
|
| 275 |
+ <style>
|
|
| 276 |
+ <class name="account-page-box"/>
|
|
| 277 |
+ </style>
|
|
| 216 | 278 |
</object>
|
| 217 |
- <packing>
|
|
| 218 |
- <property name="expand">False</property>
|
|
| 219 |
- <property name="fill">True</property>
|
|
| 220 |
- <property name="position">0</property>
|
|
| 221 |
- </packing>
|
|
| 222 |
- </child>
|
|
| 223 |
- <child>
|
|
| 224 |
- <placeholder/>
|
|
| 225 | 279 |
</child>
|
| 226 | 280 |
</object>
|
| 227 |
- <packing>
|
|
| 228 |
- <property name="expand">False</property>
|
|
| 229 |
- <property name="fill">True</property>
|
|
| 230 |
- <property name="position">1</property>
|
|
| 231 |
- </packing>
|
|
| 232 |
- </child>
|
|
| 233 |
- <child>
|
|
| 234 |
- <object class="GtkBox" id="status_message_box">
|
|
| 235 |
- <property name="visible">True</property>
|
|
| 236 |
- <property name="can-focus">False</property>
|
|
| 237 |
- <property name="orientation">vertical</property>
|
|
| 238 |
- <child>
|
|
| 239 |
- <placeholder/>
|
|
| 240 |
- </child>
|
|
| 241 |
- </object>
|
|
| 242 |
- <packing>
|
|
| 243 |
- <property name="expand">False</property>
|
|
| 244 |
- <property name="fill">True</property>
|
|
| 245 |
- <property name="position">2</property>
|
|
| 246 |
- </packing>
|
|
| 247 | 281 |
</child>
|
| 248 |
- <child>
|
|
| 249 |
- <object class="GtkLabel">
|
|
| 250 |
- <property name="visible">True</property>
|
|
| 251 |
- <property name="can-focus">False</property>
|
|
| 252 |
- <property name="margin-top">6</property>
|
|
| 253 |
- <property name="label" translatable="yes">Notifications</property>
|
|
| 254 |
- <style>
|
|
| 255 |
- <class name="bold16"/>
|
|
| 256 |
- </style>
|
|
| 257 |
- </object>
|
|
| 258 |
- <packing>
|
|
| 259 |
- <property name="expand">False</property>
|
|
| 260 |
- <property name="fill">True</property>
|
|
| 261 |
- <property name="position">3</property>
|
|
| 262 |
- </packing>
|
|
| 263 |
- </child>
|
|
| 264 |
- <child>
|
|
| 265 |
- <placeholder/>
|
|
| 266 |
- </child>
|
|
| 267 |
- <style>
|
|
| 268 |
- <class name="account-page-box"/>
|
|
| 269 |
- </style>
|
|
| 270 | 282 |
</object>
|
| 271 | 283 |
<packing>
|
| 272 | 284 |
<property name="resize">True</property>
|
| ... | ... | @@ -20,11 +20,11 @@ infobar.error > revealer > box { |
| 20 | 20 |
|
| 21 | 21 |
/* ConversationView */
|
| 22 | 22 |
.conversation-mention-highlight {
|
| 23 |
- background-color: rgb(251, 151, 97);
|
|
| 24 |
-}
|
|
| 25 |
-.conversation-mention-highlight:hover {
|
|
| 26 |
- background-color: rgb(251, 151, 97);
|
|
| 23 |
+ background-color: rgb(100, 50, 10);
|
|
| 27 | 24 |
}
|
| 28 | 25 |
.conversation-mention-highlight grid textview text {
|
| 29 |
- background-color: rgb(251, 151, 97);
|
|
| 26 |
+ background-color: rgb(100, 50, 10);
|
|
| 27 |
+}
|
|
| 28 |
+.conversation-mention-highlight:hover {
|
|
| 29 |
+ background-color: rgb(110, 50, 10);
|
|
| 30 | 30 |
}
|
| ... | ... | @@ -59,6 +59,13 @@ .conversation-row grid textview:not(.sourceview) text { |
| 59 | 59 |
.conversation-mention-highlight {
|
| 60 | 60 |
background-color: rgb(255, 215, 194);
|
| 61 | 61 |
}
|
| 62 |
+.conversation-mention-highlight grid textview text {
|
|
| 63 |
+ background-color: rgb(255, 215, 194);
|
|
| 64 |
+}
|
|
| 65 |
+.conversation-mention-highlight:hover {
|
|
| 66 |
+ background-color: rgb(255, 205, 184);
|
|
| 67 |
+}
|
|
| 68 |
+ |
|
| 62 | 69 |
@keyframes highlight {
|
| 63 | 70 |
from { background: rgb(194, 215, 255) }
|
| 64 | 71 |
to { background: transparent }
|
| ... | ... | @@ -291,6 +298,10 @@ .notification-listbox { |
| 291 | 298 |
.notification-listbox row {
|
| 292 | 299 |
padding: 12px;
|
| 293 | 300 |
border: 1px solid @borders;
|
| 301 |
+ border-bottom: 0px;
|
|
| 302 |
+}
|
|
| 303 |
+.notification-listbox row:nth-last-child(2) {
|
|
| 304 |
+ border-bottom: 1px solid @borders;
|
|
| 294 | 305 |
}
|
| 295 | 306 |
|
| 296 | 307 |
/*Middle Grid*/
|
| ... | ... | @@ -20,9 +20,10 @@ |
| 20 | 20 |
|
| 21 | 21 |
|
| 22 | 22 |
class MessageWidget(Gtk.Box):
|
| 23 |
- def __init__(self, account):
|
|
| 23 |
+ def __init__(self, account, selectable=True):
|
|
| 24 | 24 |
Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
|
| 25 | 25 |
self._account = account
|
| 26 |
+ self._selectable = selectable
|
|
| 26 | 27 |
|
| 27 | 28 |
self._content = None
|
| 28 | 29 |
|
| ... | ... | @@ -37,7 +38,7 @@ def add_content(self, content): |
| 37 | 38 |
self._content = content
|
| 38 | 39 |
for block in content.blocks:
|
| 39 | 40 |
if block.name == 'plain':
|
| 40 |
- widget = PlainWidget(self._account)
|
|
| 41 |
+ widget = PlainWidget(self._account, self._selectable)
|
|
| 41 | 42 |
widget.add_content(block)
|
| 42 | 43 |
self.add(widget)
|
| 43 | 44 |
continue
|
| ... | ... | @@ -49,7 +50,7 @@ def add_content(self, content): |
| 49 | 50 |
continue
|
| 50 | 51 |
|
| 51 | 52 |
if block.name == 'quote':
|
| 52 |
- message_widget = MessageWidget(self._account)
|
|
| 53 |
+ message_widget = MessageWidget(self._account, self._selectable)
|
|
| 53 | 54 |
message_widget.add_content(block)
|
| 54 | 55 |
widget = QuoteWidget(self._account)
|
| 55 | 56 |
widget.attach_message_widget(message_widget)
|
| ... | ... | @@ -37,14 +37,14 @@ |
| 37 | 37 |
|
| 38 | 38 |
|
| 39 | 39 |
class PlainWidget(Gtk.Box):
|
| 40 |
- def __init__(self, account):
|
|
| 40 |
+ def __init__(self, account, selectable):
|
|
| 41 | 41 |
Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
|
| 42 | 42 |
self.set_vexpand(True)
|
| 43 | 43 |
|
| 44 | 44 |
self._account = account
|
| 45 | 45 |
|
| 46 | 46 |
# self._text_widget = MessageTextview(self._account)
|
| 47 |
- self._text_widget = MessageLabel(self._account)
|
|
| 47 |
+ self._text_widget = MessageLabel(self._account, selectable)
|
|
| 48 | 48 |
self.add(self._text_widget)
|
| 49 | 49 |
|
| 50 | 50 |
def add_content(self, block):
|
| ... | ... | @@ -52,10 +52,10 @@ def add_content(self, block): |
| 52 | 52 |
|
| 53 | 53 |
|
| 54 | 54 |
class MessageLabel(Gtk.Label):
|
| 55 |
- def __init__(self, account):
|
|
| 55 |
+ def __init__(self, account, selectable):
|
|
| 56 | 56 |
Gtk.Label.__init__(self)
|
| 57 | 57 |
self.set_hexpand(True)
|
| 58 |
- self.set_selectable(True)
|
|
| 58 |
+ self.set_selectable(selectable)
|
|
| 59 | 59 |
self.set_line_wrap(True)
|
| 60 | 60 |
self.set_xalign(0)
|
| 61 | 61 |
self.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
|
| ... | ... | @@ -59,6 +59,8 @@ def is_merged(self): |
| 59 | 59 |
return self._merged
|
| 60 | 60 |
|
| 61 | 61 |
def update_text_tags(self):
|
| 62 |
+ return
|
|
| 63 |
+ # TODO
|
|
| 62 | 64 |
if self.textview is not None:
|
| 63 | 65 |
self.textview.update_text_tags()
|
| 64 | 66 |
|
| ... | ... | @@ -21,27 +21,29 @@ |
| 21 | 21 |
from gajim.common.const import AvatarSize
|
| 22 | 22 |
from gajim.common.i18n import _
|
| 23 | 23 |
from gajim.common.helpers import get_groupchat_name
|
| 24 |
+from gajim.common.helpers import get_muc_context
|
|
| 24 | 25 |
|
| 25 | 26 |
from gajim.gui_menu_builder import get_subscription_menu
|
| 26 | 27 |
|
| 27 | 28 |
from .util import open_window
|
| 28 | 29 |
|
| 29 | 30 |
|
| 30 |
-class NotificationManager(Gtk.ScrolledWindow):
|
|
| 31 |
+class NotificationManager(Gtk.ListBox):
|
|
| 31 | 32 |
def __init__(self, account):
|
| 32 |
- Gtk.ScrolledWindow.__init__(self)
|
|
| 33 |
+ Gtk.ListBox.__init__(self)
|
|
| 33 | 34 |
self._account = account
|
| 34 | 35 |
self._client = app.get_client(account)
|
| 35 | 36 |
|
| 36 |
- self.set_vexpand(True)
|
|
| 37 |
+ self.set_selection_mode(Gtk.SelectionMode.NONE)
|
|
| 38 |
+ self.set_halign(Gtk.Align.CENTER)
|
|
| 39 |
+ self.get_style_context().add_class('notification-listbox')
|
|
| 37 | 40 |
|
| 38 |
- self._listbox = Gtk.ListBox()
|
|
| 39 |
- self._listbox.set_selection_mode(Gtk.SelectionMode.NONE)
|
|
| 40 |
- self._listbox.set_halign(Gtk.Align.CENTER)
|
|
| 41 |
- self._listbox.get_style_context().add_class('notification-listbox')
|
|
| 42 |
- self._set_placeholder()
|
|
| 41 |
+ label = Gtk.Label(label=_('No Notifications'))
|
|
| 42 |
+ label.set_valign(Gtk.Align.START)
|
|
| 43 |
+ label.get_style_context().add_class('dim-label')
|
|
| 44 |
+ label.show()
|
|
| 45 |
+ self.set_placeholder(label)
|
|
| 43 | 46 |
|
| 44 |
- self.add(self._listbox)
|
|
| 45 | 47 |
self.show_all()
|
| 46 | 48 |
|
| 47 | 49 |
self._add_actions()
|
| ... | ... | @@ -89,13 +91,6 @@ def _remove_actions(self): |
| 89 | 91 |
for action in actions:
|
| 90 | 92 |
app.window.remove_action(f'{action}-{self._account}')
|
| 91 | 93 |
|
| 92 |
- def _set_placeholder(self):
|
|
| 93 |
- label = Gtk.Label(label=_('No Notifications'))
|
|
| 94 |
- label.set_valign(Gtk.Align.START)
|
|
| 95 |
- label.get_style_context().add_class('dim-label')
|
|
| 96 |
- label.show()
|
|
| 97 |
- self._listbox.set_placeholder(label)
|
|
| 98 |
- |
|
| 99 | 94 |
def _on_subscription_accept(self, _action, param):
|
| 100 | 95 |
jid = param.get_string()
|
| 101 | 96 |
row = self._get_notification_row(jid)
|
| ... | ... | @@ -104,7 +99,7 @@ def _on_subscription_accept(self, _action, param): |
| 104 | 99 |
if not contact.is_in_roster:
|
| 105 | 100 |
open_window('AddContact', account=self._account,
|
| 106 | 101 |
jid=jid, nick=contact.name)
|
| 107 |
- self._listbox.remove(row)
|
|
| 102 |
+ self.remove(row)
|
|
| 108 | 103 |
|
| 109 | 104 |
def _on_subscription_block(self, _action, param):
|
| 110 | 105 |
jid = param.get_string()
|
| ... | ... | @@ -112,7 +107,7 @@ def _on_subscription_block(self, _action, param): |
| 112 | 107 |
self._deny_request(jid)
|
| 113 | 108 |
self._client.get_module('Blocking').block([jid])
|
| 114 | 109 |
row = self._get_notification_row(jid)
|
| 115 |
- self._listbox.remove(row)
|
|
| 110 |
+ self.remove(row)
|
|
| 116 | 111 |
|
| 117 | 112 |
def _on_subscription_report(self, _action, param):
|
| 118 | 113 |
jid = param.get_string()
|
| ... | ... | @@ -120,19 +115,19 @@ def _on_subscription_report(self, _action, param): |
| 120 | 115 |
self._deny_request(jid)
|
| 121 | 116 |
self._client.get_module('Blocking').block([jid], report='spam')
|
| 122 | 117 |
row = self._get_notification_row(jid)
|
| 123 |
- self._listbox.remove(row)
|
|
| 118 |
+ self.remove(row)
|
|
| 124 | 119 |
|
| 125 | 120 |
def _on_subscription_deny(self, _action, param):
|
| 126 | 121 |
jid = param.get_string()
|
| 127 | 122 |
self._deny_request(jid)
|
| 128 | 123 |
row = self._get_notification_row(jid)
|
| 129 |
- self._listbox.remove(row)
|
|
| 124 |
+ self.remove(row)
|
|
| 130 | 125 |
|
| 131 | 126 |
def _deny_request(self, jid):
|
| 132 | 127 |
self._client.get_module('Presence').unsubscribed(jid)
|
| 133 | 128 |
|
| 134 | 129 |
def _get_notification_row(self, jid):
|
| 135 |
- for child in self._listbox.get_children():
|
|
| 130 |
+ for child in self.get_children():
|
|
| 136 | 131 |
if child.jid == jid:
|
| 137 | 132 |
return child
|
| 138 | 133 |
return None
|
| ... | ... | @@ -140,27 +135,27 @@ def _get_notification_row(self, jid): |
| 140 | 135 |
def add_subscription_request(self, event):
|
| 141 | 136 |
row = self._get_notification_row(event.jid)
|
| 142 | 137 |
if row is None:
|
| 143 |
- self._listbox.add(SubscriptionRequestRow(
|
|
| 138 |
+ self.add(SubscriptionRequestRow(
|
|
| 144 | 139 |
self._account, event.jid, event.status, event.user_nick))
|
| 145 | 140 |
elif row.type == 'unsubscribed':
|
| 146 |
- self._listbox.remove(row)
|
|
| 141 |
+ self.remove(row)
|
|
| 147 | 142 |
|
| 148 | 143 |
def add_unsubscribed(self, event):
|
| 149 | 144 |
row = self._get_notification_row(event.jid)
|
| 150 | 145 |
if row is None:
|
| 151 |
- self._listbox.add(UnsubscribedRow(self._account, event.jid))
|
|
| 146 |
+ self.add(UnsubscribedRow(self._account, event.jid))
|
|
| 152 | 147 |
elif row.type == 'subscribe':
|
| 153 |
- self._listbox.remove(row)
|
|
| 148 |
+ self.remove(row)
|
|
| 154 | 149 |
|
| 155 | 150 |
def add_invitation_received(self, event):
|
| 156 | 151 |
row = self._get_notification_row(event.muc)
|
| 157 | 152 |
if row is None:
|
| 158 |
- self._listbox.add(InvitationReceivedRow(self._account, event))
|
|
| 153 |
+ self.add(InvitationReceivedRow(self._account, event))
|
|
| 159 | 154 |
|
| 160 | 155 |
def add_invitation_declined(self, event):
|
| 161 | 156 |
row = self._get_notification_row(event.muc)
|
| 162 | 157 |
if row is None:
|
| 163 |
- self._listbox.add(InvitationDeclinedRow(self._account, event))
|
|
| 158 |
+ self.add(InvitationDeclinedRow(self._account, event))
|
|
| 164 | 159 |
|
| 165 | 160 |
|
| 166 | 161 |
class NotificationRow(Gtk.ListBoxRow):
|
| ... | ... | @@ -177,6 +172,7 @@ def __init__(self, account, jid): |
| 177 | 172 |
def _generate_label():
|
| 178 | 173 |
label = Gtk.Label()
|
| 179 | 174 |
label.set_halign(Gtk.Align.START)
|
| 175 |
+ label.set_hexpand(True)
|
|
| 180 | 176 |
label.set_xalign(0)
|
| 181 | 177 |
label.set_ellipsize(Pango.EllipsizeMode.END)
|
| 182 | 178 |
label.set_max_width_chars(30)
|
| ... | ... | @@ -276,7 +272,7 @@ def __init__(self, account, jid): |
| 276 | 272 |
self.show_all()
|
| 277 | 273 |
|
| 278 | 274 |
def _on_dismiss(self, _button):
|
| 279 |
- self.get_parent().remove(self)
|
|
| 275 |
+ self.destroy()
|
|
| 280 | 276 |
|
| 281 | 277 |
|
| 282 | 278 |
class InvitationReceivedRow(NotificationRow):
|
| ... | ... | @@ -286,7 +282,11 @@ def __init__(self, account, event): |
| 286 | 282 |
|
| 287 | 283 |
self._event = event
|
| 288 | 284 |
|
| 289 |
- image = self._generate_avatar_image(event.from_.bare)
|
|
| 285 |
+ if get_muc_context(event.muc) == 'public':
|
|
| 286 |
+ jid = event.from_
|
|
| 287 |
+ else:
|
|
| 288 |
+ jid = event.from_.bare
|
|
| 289 |
+ image = self._generate_avatar_image(jid)
|
|
| 290 | 290 |
self.grid.attach(image, 1, 1, 1, 2)
|
| 291 | 291 |
|
| 292 | 292 |
title_label = self._generate_label()
|
| ... | ... | @@ -294,8 +294,7 @@ def __init__(self, account, event): |
| 294 | 294 |
title_label.get_style_context().add_class('bold')
|
| 295 | 295 |
self.grid.attach(title_label, 2, 1, 1, 1)
|
| 296 | 296 |
|
| 297 |
- contact = self._client.get_module('Contacts').get_contact(
|
|
| 298 |
- event.from_.bare)
|
|
| 297 |
+ contact = self._client.get_module('Contacts').get_contact(jid)
|
|
| 299 | 298 |
invitation_text = _('%(contact)s invited you to %(chat)s') % {
|
| 300 | 299 |
'contact': contact.name,
|
| 301 | 300 |
'chat': event.info.muc_name}
|
| ... | ... | @@ -307,6 +306,7 @@ def __init__(self, account, event): |
| 307 | 306 |
|
| 308 | 307 |
show_button = Gtk.Button.new_with_label(label=_('Show'))
|
| 309 | 308 |
show_button.set_valign(Gtk.Align.CENTER)
|
| 309 |
+ show_button.set_halign(Gtk.Align.END)
|
|
| 310 | 310 |
show_button.set_tooltip_text('Show Invitation')
|
| 311 | 311 |
show_button.connect('clicked', self._on_show_invitation)
|
| 312 | 312 |
self.grid.attach(show_button, 3, 1, 1, 2)
|
| ... | ... | @@ -323,12 +323,12 @@ def _on_show_invitation(self, _button): |
| 323 | 323 |
open_window('GroupChatInvitation',
|
| 324 | 324 |
account=self._account,
|
| 325 | 325 |
event=self._event)
|
| 326 |
- self.get_parent().remove(self)
|
|
| 326 |
+ self.destroy()
|
|
| 327 | 327 |
|
| 328 | 328 |
def _on_decline_invitation(self, _button):
|
| 329 | 329 |
self._client.get_module('MUC').decline(
|
| 330 |
- self.jid, self._event.from_.bare)
|
|
| 331 |
- self.get_parent().remove(self)
|
|
| 330 |
+ self.jid, self._event.from_)
|
|
| 331 |
+ self.destroy()
|
|
| 332 | 332 |
|
| 333 | 333 |
|
| 334 | 334 |
class InvitationDeclinedRow(NotificationRow):
|
| ... | ... | @@ -336,7 +336,9 @@ def __init__(self, account, event): |
| 336 | 336 |
NotificationRow.__init__(self, account, event.muc)
|
| 337 | 337 |
self.type = 'invitation-declined'
|
| 338 | 338 |
|
| 339 |
- image = self._generate_avatar_image(event.from_.bare)
|
|
| 339 |
+ jid = event.from_.bare
|
|
| 340 |
+ |
|
| 341 |
+ image = self._generate_avatar_image(jid)
|
|
| 340 | 342 |
self.grid.attach(image, 1, 1, 1, 2)
|
| 341 | 343 |
|
| 342 | 344 |
title_label = self._generate_label()
|
| ... | ... | @@ -344,9 +346,8 @@ def __init__(self, account, event): |
| 344 | 346 |
title_label.get_style_context().add_class('bold')
|
| 345 | 347 |
self.grid.attach(title_label, 2, 1, 1, 1)
|
| 346 | 348 |
|
| 347 |
- contact = self._client.get_module('Contacts').get_contact(
|
|
| 348 |
- event.from_.bare)
|
|
| 349 |
- muc_name = get_groupchat_name(self._client, event.from_.bare)
|
|
| 349 |
+ contact = self._client.get_module('Contacts').get_contact(jid)
|
|
| 350 |
+ muc_name = get_groupchat_name(self._client, event.muc)
|
|
| 350 | 351 |
invitation_text = _('%(contact)s declined your invitation '
|
| 351 | 352 |
'to %(chat)s') % {
|
| 352 | 353 |
'contact': contact.name,
|
| ... | ... | @@ -360,6 +361,7 @@ def __init__(self, account, event): |
| 360 | 361 |
dismiss_button = Gtk.Button.new_from_icon_name(
|
| 361 | 362 |
'window-close-symbolic', Gtk.IconSize.BUTTON)
|
| 362 | 363 |
dismiss_button.set_valign(Gtk.Align.CENTER)
|
| 364 |
+ dismiss_button.set_halign(Gtk.Align.END)
|
|
| 363 | 365 |
dismiss_button.set_tooltip_text(_('Remove Notification'))
|
| 364 | 366 |
dismiss_button.connect('clicked', self._on_dismiss)
|
| 365 | 367 |
self.grid.attach(dismiss_button, 3, 1, 1, 2)
|
| ... | ... | @@ -367,4 +369,4 @@ def __init__(self, account, event): |
| 367 | 369 |
self.show_all()
|
| 368 | 370 |
|
| 369 | 371 |
def _on_dismiss(self, _button):
|
| 370 |
- self.get_parent().remove(self)
|
|
| 372 |
+ self.destroy()
|
| ... | ... | @@ -261,7 +261,7 @@ def __init__(self, msg, account, jid): |
| 261 | 261 |
date = time.strftime('%H:%M', local_time)
|
| 262 | 262 |
self._ui.row_time_label.set_label(date)
|
| 263 | 263 |
|
| 264 |
- message_widget = MessageWidget(account)
|
|
| 264 |
+ message_widget = MessageWidget(account, selectable=False)
|
|
| 265 | 265 |
self._ui.result_row_grid.attach(message_widget, 1, 1, 2, 1)
|
| 266 | 266 |
result = process(msg.message)
|
| 267 | 267 |
message_widget.add_content(result)
|
| ... | ... | @@ -68,6 +68,7 @@ |
| 68 | 68 |
from gajim.common import helpers
|
| 69 | 69 |
from gajim.common import passwords
|
| 70 | 70 |
from gajim.common.helpers import ask_for_status_message
|
| 71 |
+from gajim.common.helpers import get_muc_context
|
|
| 71 | 72 |
from gajim.common.helpers import get_group_chat_nick
|
| 72 | 73 |
from gajim.common.structs import MUCData
|
| 73 | 74 |
from gajim.common.structs import OutgoingMessage
|
| ... | ... | @@ -372,29 +373,26 @@ def handle_event_msgnotsent(obj): |
| 372 | 373 |
obj.session.roster_message(obj.jid, msg, obj.time_, obj.conn.name,
|
| 373 | 374 |
msg_type='error')
|
| 374 | 375 |
|
| 375 |
- def handle_event_gc_invitation(self, event):
|
|
| 376 |
+ @staticmethod
|
|
| 377 |
+ def handle_event_gc_invitation(event):
|
|
| 376 | 378 |
event = events.GcInvitationtEvent(event)
|
| 377 | 379 |
|
| 378 | 380 |
# TODO: show account page
|
| 379 |
- # if (helpers.allow_popup_window(event.account) or
|
|
| 380 |
- # not self.systray_enabled):
|
|
| 381 |
- # open_window('GroupChatInvitation',
|
|
| 382 |
- # account=event.account,
|
|
| 383 |
- # event=event)
|
|
| 384 |
- # return
|
|
| 385 |
- |
|
| 386 |
- #self.add_event(event.account, str(event.from_), event)
|
|
| 381 |
+ # self.add_event(event.account, str(event.from_), event)
|
|
| 387 | 382 |
|
| 388 | 383 |
if helpers.allow_showing_notification(event.account):
|
| 389 | 384 |
client = app.get_client(event.account)
|
| 390 |
- contact = client.get_module('Contacts').get_contact(
|
|
| 391 |
- event.from_.bare)
|
|
| 385 |
+ if get_muc_context(event.muc) == 'public':
|
|
| 386 |
+ jid = event.from_
|
|
| 387 |
+ else:
|
|
| 388 |
+ jid = event.from_.bare
|
|
| 389 |
+ contact = client.get_module('Contacts').get_contact(jid)
|
|
| 392 | 390 |
event_type = _('Group Chat Invitation')
|
| 393 | 391 |
text = _('%(contact)s invited you to %(chat)s') % {
|
| 394 | 392 |
'contact': contact.name,
|
| 395 | 393 |
'chat': event.info.muc_name}
|
| 396 | 394 |
app.notification.popup(event_type,
|
| 397 |
- str(event.from_),
|
|
| 395 |
+ str(jid),
|
|
| 398 | 396 |
event.account,
|
| 399 | 397 |
'gc-invitation',
|
| 400 | 398 |
'gajim-gc_invitation',
|