Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
6ba21fe5
by Philipp Hörist at 2019-07-17T22:00:47Z
-
a58e9d31
by Philipp Hörist at 2019-07-17T22:00:52Z
-
e2c4a6d5
by Philipp Hörist at 2019-07-17T22:01:06Z
-
05bb0f45
by Philipp Hörist at 2019-07-17T22:01:06Z
3 changed files:
Changes:
| ... | ... | @@ -543,7 +543,7 @@ |
| 543 | 543 |
<property name="halign">start</property>
|
| 544 | 544 |
<property name="valign">start</property>
|
| 545 | 545 |
<property name="use_underline">True</property>
|
| 546 |
- <signal name="clicked" handler="_on_nickname_cancel_clicked" swapped="no"/>
|
|
| 546 |
+ <signal name="clicked" handler="_on_page_cancel_clicked" swapped="no"/>
|
|
| 547 | 547 |
</object>
|
| 548 | 548 |
<packing>
|
| 549 | 549 |
<property name="expand">False</property>
|
| ... | ... | @@ -592,6 +592,118 @@ |
| 592 | 592 |
<property name="position">2</property>
|
| 593 | 593 |
</packing>
|
| 594 | 594 |
</child>
|
| 595 |
+ <child>
|
|
| 596 |
+ <object class="GtkBox">
|
|
| 597 |
+ <property name="visible">True</property>
|
|
| 598 |
+ <property name="can_focus">False</property>
|
|
| 599 |
+ <property name="orientation">vertical</property>
|
|
| 600 |
+ <child>
|
|
| 601 |
+ <object class="GtkGrid">
|
|
| 602 |
+ <property name="visible">True</property>
|
|
| 603 |
+ <property name="can_focus">False</property>
|
|
| 604 |
+ <property name="halign">center</property>
|
|
| 605 |
+ <property name="valign">center</property>
|
|
| 606 |
+ <property name="hexpand">True</property>
|
|
| 607 |
+ <property name="vexpand">True</property>
|
|
| 608 |
+ <property name="row_spacing">12</property>
|
|
| 609 |
+ <child>
|
|
| 610 |
+ <object class="GtkLabel">
|
|
| 611 |
+ <property name="visible">True</property>
|
|
| 612 |
+ <property name="can_focus">False</property>
|
|
| 613 |
+ <property name="label" translatable="yes">Change Subject</property>
|
|
| 614 |
+ <property name="xalign">0</property>
|
|
| 615 |
+ <style>
|
|
| 616 |
+ <class name="bold16"/>
|
|
| 617 |
+ </style>
|
|
| 618 |
+ </object>
|
|
| 619 |
+ <packing>
|
|
| 620 |
+ <property name="left_attach">0</property>
|
|
| 621 |
+ <property name="top_attach">0</property>
|
|
| 622 |
+ </packing>
|
|
| 623 |
+ </child>
|
|
| 624 |
+ <child>
|
|
| 625 |
+ <object class="GtkBox">
|
|
| 626 |
+ <property name="visible">True</property>
|
|
| 627 |
+ <property name="can_focus">False</property>
|
|
| 628 |
+ <property name="homogeneous">True</property>
|
|
| 629 |
+ <child>
|
|
| 630 |
+ <object class="GtkButton">
|
|
| 631 |
+ <property name="label" translatable="yes">_Cancel</property>
|
|
| 632 |
+ <property name="visible">True</property>
|
|
| 633 |
+ <property name="can_focus">True</property>
|
|
| 634 |
+ <property name="receives_default">True</property>
|
|
| 635 |
+ <property name="halign">start</property>
|
|
| 636 |
+ <property name="valign">start</property>
|
|
| 637 |
+ <property name="use_underline">True</property>
|
|
| 638 |
+ <signal name="clicked" handler="_on_page_cancel_clicked" swapped="no"/>
|
|
| 639 |
+ </object>
|
|
| 640 |
+ <packing>
|
|
| 641 |
+ <property name="expand">False</property>
|
|
| 642 |
+ <property name="fill">True</property>
|
|
| 643 |
+ <property name="position">0</property>
|
|
| 644 |
+ </packing>
|
|
| 645 |
+ </child>
|
|
| 646 |
+ <child>
|
|
| 647 |
+ <object class="GtkButton" id="subject_change_button">
|
|
| 648 |
+ <property name="label" translatable="yes">Ch_ange</property>
|
|
| 649 |
+ <property name="visible">True</property>
|
|
| 650 |
+ <property name="can_focus">True</property>
|
|
| 651 |
+ <property name="can_default">True</property>
|
|
| 652 |
+ <property name="receives_default">True</property>
|
|
| 653 |
+ <property name="halign">end</property>
|
|
| 654 |
+ <property name="valign">start</property>
|
|
| 655 |
+ <property name="use_underline">True</property>
|
|
| 656 |
+ <signal name="clicked" handler="_on_subject_change_clicked" swapped="no"/>
|
|
| 657 |
+ <style>
|
|
| 658 |
+ <class name="suggested-action"/>
|
|
| 659 |
+ </style>
|
|
| 660 |
+ </object>
|
|
| 661 |
+ <packing>
|
|
| 662 |
+ <property name="expand">False</property>
|
|
| 663 |
+ <property name="fill">True</property>
|
|
| 664 |
+ <property name="position">1</property>
|
|
| 665 |
+ </packing>
|
|
| 666 |
+ </child>
|
|
| 667 |
+ </object>
|
|
| 668 |
+ <packing>
|
|
| 669 |
+ <property name="left_attach">0</property>
|
|
| 670 |
+ <property name="top_attach">2</property>
|
|
| 671 |
+ </packing>
|
|
| 672 |
+ </child>
|
|
| 673 |
+ <child>
|
|
| 674 |
+ <object class="GtkScrolledWindow">
|
|
| 675 |
+ <property name="width_request">450</property>
|
|
| 676 |
+ <property name="height_request">250</property>
|
|
| 677 |
+ <property name="visible">True</property>
|
|
| 678 |
+ <property name="can_focus">True</property>
|
|
| 679 |
+ <property name="hscrollbar_policy">never</property>
|
|
| 680 |
+ <property name="shadow_type">in</property>
|
|
| 681 |
+ <child>
|
|
| 682 |
+ <object class="GtkTextView" id="subject_textview">
|
|
| 683 |
+ <property name="visible">True</property>
|
|
| 684 |
+ <property name="can_focus">True</property>
|
|
| 685 |
+ <property name="wrap_mode">word</property>
|
|
| 686 |
+ </object>
|
|
| 687 |
+ </child>
|
|
| 688 |
+ </object>
|
|
| 689 |
+ <packing>
|
|
| 690 |
+ <property name="left_attach">0</property>
|
|
| 691 |
+ <property name="top_attach">1</property>
|
|
| 692 |
+ </packing>
|
|
| 693 |
+ </child>
|
|
| 694 |
+ </object>
|
|
| 695 |
+ <packing>
|
|
| 696 |
+ <property name="expand">False</property>
|
|
| 697 |
+ <property name="fill">True</property>
|
|
| 698 |
+ <property name="position">0</property>
|
|
| 699 |
+ </packing>
|
|
| 700 |
+ </child>
|
|
| 701 |
+ </object>
|
|
| 702 |
+ <packing>
|
|
| 703 |
+ <property name="name">subject</property>
|
|
| 704 |
+ <property name="position">3</property>
|
|
| 705 |
+ </packing>
|
|
| 706 |
+ </child>
|
|
| 595 | 707 |
</object>
|
| 596 | 708 |
<packing>
|
| 597 | 709 |
<property name="expand">True</property>
|
| ... | ... | @@ -538,6 +538,7 @@ class GroupchatControl(ChatControlBase): |
| 538 | 538 |
transition = Gtk.StackTransitionType.SLIDE_DOWN
|
| 539 | 539 |
if name == 'groupchat':
|
| 540 | 540 |
transition = Gtk.StackTransitionType.SLIDE_UP
|
| 541 |
+ self.msg_textview.grab_focus()
|
|
| 541 | 542 |
self.xml.stack.set_visible_child_full(name, transition)
|
| 542 | 543 |
|
| 543 | 544 |
def _get_current_page(self):
|
| ... | ... | @@ -627,17 +628,6 @@ class GroupchatControl(ChatControlBase): |
| 627 | 628 |
|
| 628 | 629 |
# Actions
|
| 629 | 630 |
|
| 630 |
- def _on_change_subject(self, action, param):
|
|
| 631 |
- def on_ok(subject):
|
|
| 632 |
- # Note, we don't update self.subject since we don't know whether it
|
|
| 633 |
- # will work yet
|
|
| 634 |
- con = app.connections[self.account]
|
|
| 635 |
- con.get_module('MUC').set_subject(self.room_jid, subject)
|
|
| 636 |
- |
|
| 637 |
- InputTextDialog(_('Changing Subject'),
|
|
| 638 |
- _('Please specify the new subject:'), input_str=self.subject,
|
|
| 639 |
- ok_handler=on_ok, transient_for=self.parent_win.window)
|
|
| 640 |
- |
|
| 641 | 631 |
def _on_disconnect(self, action, param):
|
| 642 | 632 |
app.connections[self.account].get_module('MUC').leave(self.room_jid)
|
| 643 | 633 |
self.force_non_minimizable = True
|
| ... | ... | @@ -2322,17 +2312,6 @@ class GroupchatControl(ChatControlBase): |
| 2322 | 2312 |
# gc can only have messages as event
|
| 2323 | 2313 |
return nb
|
| 2324 | 2314 |
|
| 2325 |
- def _on_change_subject_menuitem_activate(self, widget):
|
|
| 2326 |
- def on_ok(subject):
|
|
| 2327 |
- # Note, we don't update self.subject since we don't know whether it
|
|
| 2328 |
- # will work yet
|
|
| 2329 |
- con = app.connections[self.account]
|
|
| 2330 |
- con.get_module('MUC').set_subject(self.room_jid, subject)
|
|
| 2331 |
- |
|
| 2332 |
- InputTextDialog(_('Changing Subject'),
|
|
| 2333 |
- _('Please specify the new subject:'), input_str=self.subject,
|
|
| 2334 |
- ok_handler=on_ok, transient_for=self.parent_win.window)
|
|
| 2335 |
- |
|
| 2336 | 2315 |
def _on_drag_data_received(self, widget, context, x, y, selection,
|
| 2337 | 2316 |
target_type, timestamp):
|
| 2338 | 2317 |
if not selection.get_data():
|
| ... | ... | @@ -2949,6 +2928,8 @@ class GroupchatControl(ChatControlBase): |
| 2949 | 2928 |
self.revoke_owner(widget, jid)
|
| 2950 | 2929 |
|
| 2951 | 2930 |
def _on_change_nick(self, _action, _param):
|
| 2931 |
+ if self._get_current_page() == 'nickname':
|
|
| 2932 |
+ return
|
|
| 2952 | 2933 |
self.xml.nickname_entry.set_text(self.nick)
|
| 2953 | 2934 |
self.xml.nickname_entry.grab_focus()
|
| 2954 | 2935 |
self.xml.nickname_change_button.grab_default()
|
| ... | ... | @@ -2972,7 +2953,23 @@ class GroupchatControl(ChatControlBase): |
| 2972 | 2953 |
self.room_jid, new_nick)
|
| 2973 | 2954 |
self._show_page('groupchat')
|
| 2974 | 2955 |
|
| 2975 |
- def _on_nickname_cancel_clicked(self, _button):
|
|
| 2956 |
+ def _on_change_subject(self, _action, _param):
|
|
| 2957 |
+ if self._get_current_page() == 'subject':
|
|
| 2958 |
+ return
|
|
| 2959 |
+ self.xml.subject_textview.get_buffer().set_text(self.subject)
|
|
| 2960 |
+ self.xml.subject_textview.grab_focus()
|
|
| 2961 |
+ self._show_page('subject')
|
|
| 2962 |
+ |
|
| 2963 |
+ def _on_subject_change_clicked(self, _button):
|
|
| 2964 |
+ buffer_ = self.xml.subject_textview.get_buffer()
|
|
| 2965 |
+ subject = buffer_.get_text(buffer_.get_start_iter(),
|
|
| 2966 |
+ buffer_.get_end_iter(),
|
|
| 2967 |
+ False)
|
|
| 2968 |
+ con = app.connections[self.account]
|
|
| 2969 |
+ con.get_module('MUC').set_subject(self.room_jid, subject)
|
|
| 2970 |
+ self._show_page('groupchat')
|
|
| 2971 |
+ |
|
| 2972 |
+ def _on_page_cancel_clicked(self, _button):
|
|
| 2976 | 2973 |
self._show_page('groupchat')
|
| 2977 | 2974 |
|
| 2978 | 2975 |
|
| ... | ... | @@ -132,9 +132,6 @@ class MessageWindow: |
| 132 | 132 |
id_ = self.notebook.connect('switch-page',
|
| 133 | 133 |
self._on_notebook_switch_page)
|
| 134 | 134 |
self.handlers[id_] = self.notebook
|
| 135 |
- id_ = self.notebook.connect('key-press-event',
|
|
| 136 |
- self._on_notebook_key_press)
|
|
| 137 |
- self.handlers[id_] = self.notebook
|
|
| 138 | 135 |
|
| 139 | 136 |
# Tab customizations
|
| 140 | 137 |
pref_pos = app.config.get('tabs_position')
|
| ... | ... | @@ -257,17 +254,6 @@ class MessageWindow: |
| 257 | 254 |
self.move_to_next_unread_tab(False)
|
| 258 | 255 |
return
|
| 259 | 256 |
|
| 260 |
- def _on_notebook_key_press(self, _widget, event):
|
|
| 261 |
- control = self.get_active_control()
|
|
| 262 |
- if control is None:
|
|
| 263 |
- return
|
|
| 264 |
- |
|
| 265 |
- if isinstance(control, ChatControlBase):
|
|
| 266 |
- # we forwarded it to message textview
|
|
| 267 |
- control.msg_textview.remove_placeholder()
|
|
| 268 |
- control.msg_textview.event(event)
|
|
| 269 |
- control.msg_textview.grab_focus()
|
|
| 270 |
- |
|
| 271 | 257 |
def change_account_name(self, old_name, new_name):
|
| 272 | 258 |
if old_name in self._controls:
|
| 273 | 259 |
self._controls[new_name] = self._controls[old_name]
|