Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
-
750cc4b7
by wurstsalat at 2022-09-12T23:05:16+02:00
2 changed files:
Changes:
| ... | ... | @@ -48,6 +48,7 @@ |
| 48 | 48 | from .settings import SettingsDialog
|
| 49 | 49 | from .sidebar_switcher import SideBarSwitcher
|
| 50 | 50 | from .video_preview import VideoPreview
|
| 51 | +from .preview import PREVIEW_CLICK_ACTIONS
|
|
| 51 | 52 | from .util import open_window
|
| 52 | 53 | from .util import get_app_window
|
| 53 | 54 | from .builder import get_builder
|
| ... | ... | @@ -413,14 +414,6 @@ def __init__(self, *args: Any) -> None: |
| 413 | 414 | 10485760: '10 MiB',
|
| 414 | 415 | }
|
| 415 | 416 | |
| 416 | - actions = {
|
|
| 417 | - 'open': _('Open'),
|
|
| 418 | - 'save_as': _('Save As…'),
|
|
| 419 | - 'open_folder': _('Open Folder'),
|
|
| 420 | - 'copy_link_location': _('Copy Link Location'),
|
|
| 421 | - 'open_link_in_browser': _('Open Link in Browser'),
|
|
| 422 | - }
|
|
| 423 | - |
|
| 424 | 417 | settings = [
|
| 425 | 418 | Setting(SettingKind.SWITCH,
|
| 426 | 419 | _('File Preview'),
|
| ... | ... | @@ -465,7 +458,7 @@ def __init__(self, *args: Any) -> None: |
| 465 | 458 | 'preview_leftclick_action',
|
| 466 | 459 | desc=_('Action when left-clicking a preview'),
|
| 467 | 460 | bind='enable_file_preview',
|
| 468 | - props={'entries': actions}),
|
|
| 461 | + props={'entries': PREVIEW_CLICK_ACTIONS}),
|
|
| 469 | 462 | |
| 470 | 463 | Setting(SettingKind.SWITCH,
|
| 471 | 464 | _('HTTPS Verification'),
|
| ... | ... | @@ -47,6 +47,14 @@ |
| 47 | 47 | |
| 48 | 48 | log = logging.getLogger('gajim.gui.preview')
|
| 49 | 49 | |
| 50 | +PREVIEW_CLICK_ACTIONS = {
|
|
| 51 | + 'open': _('Open'),
|
|
| 52 | + 'save_as': _('Save As…'),
|
|
| 53 | + 'open_folder': _('Open Folder'),
|
|
| 54 | + 'copy_link_location': _('Copy Link Location'),
|
|
| 55 | + 'open_link_in_browser': _('Open Link in Browser'),
|
|
| 56 | +}
|
|
| 57 | + |
|
| 50 | 58 | |
| 51 | 59 | class PreviewWidget(Gtk.Box):
|
| 52 | 60 | def __init__(self, account: str) -> None:
|
| ... | ... | @@ -66,6 +74,12 @@ def __init__(self, account: str) -> None: |
| 66 | 74 | self._ui.connect_signals(self)
|
| 67 | 75 | self.add(self._ui.preview_box)
|
| 68 | 76 | |
| 77 | + leftclick_action = app.settings.get('preview_leftclick_action')
|
|
| 78 | + self._ui.icon_button.set_tooltip_text(
|
|
| 79 | + PREVIEW_CLICK_ACTIONS[leftclick_action])
|
|
| 80 | + app.settings.connect_signal(
|
|
| 81 | + 'preview_leftclick_action', self._update_icon_button_tooltip)
|
|
| 82 | + |
|
| 69 | 83 | self.connect('destroy', self._on_destroy)
|
| 70 | 84 | |
| 71 | 85 | self.show_all()
|
| ... | ... | @@ -73,6 +87,10 @@ def __init__(self, account: str) -> None: |
| 73 | 87 | def _on_destroy(self, _widget: Gtk.Widget) -> None:
|
| 74 | 88 | self._destroyed = True
|
| 75 | 89 | |
| 90 | + def _update_icon_button_tooltip(self, setting: str, *args: Any) -> None:
|
|
| 91 | + self._ui.icon_button.set_tooltip_text(
|
|
| 92 | + PREVIEW_CLICK_ACTIONS[setting])
|
|
| 93 | + |
|
| 76 | 94 | def get_text(self) -> str:
|
| 77 | 95 | if self._preview is None:
|
| 78 | 96 | return ''
|