Skip to content

Commit

Permalink
Merge pull request #200 from DaPigGuy/adw-dialog
Browse files Browse the repository at this point in the history
Port to Adw.Dialog
  • Loading branch information
amka authored May 3, 2024
2 parents 42996ea + d2ead4c commit 63a3c59
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 154 deletions.
2 changes: 1 addition & 1 deletion data/com.github.tenderowl.frog.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<file preprocess="xml-stripblanks">ui/language_dialog.ui</file>
<file preprocess="xml-stripblanks">ui/language_row.ui</file>
<file preprocess="xml-stripblanks">ui/shortcuts.ui</file>
<file preprocess="xml-stripblanks">ui/preferences_window.ui</file>
<file preprocess="xml-stripblanks">ui/preferences_dialog.ui</file>
<file preprocess="xml-stripblanks">ui/preferences_general.ui</file>
<file preprocess="xml-stripblanks">ui/preferences_languages.ui</file>
<file preprocess="xml-stripblanks">ui/share_row.ui</file>
Expand Down
3 changes: 1 addition & 2 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ subdir('icons')

blueprints = custom_target('blueprints',
input: files(
'ui/language_dialog.blp',
'ui/preferences_window.blp',
'ui/preferences_dialog.blp',
'ui/preferences_general.blp',
'ui/preferences_languages.blp',
'ui/shortcuts.blp',
Expand Down
45 changes: 0 additions & 45 deletions data/ui/language_dialog.blp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using Gtk 4.0;
using Adw 1;

template $PreferencesWindow : Adw.PreferencesWindow {
default-height: 480;
default-width: 640;
template $PreferencesDialog : Adw.PreferencesDialog {
content-height: 480;
content-width: 640;
width-request: 360;
height-request: 300;
modal: true;
search-enabled: false;

$PreferencesGeneralPage general_page {}
Expand Down
2 changes: 1 addition & 1 deletion flatpak/com.github.tenderowl.frog.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"app-id" : "com.github.tenderowl.frog",
"runtime" : "org.gnome.Platform",
"runtime-version" : "45",
"runtime-version" : "46",
"sdk" : "org.gnome.Sdk",
"command" : "frog",
"finish-args" : [
Expand Down
7 changes: 3 additions & 4 deletions frog/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def on_github_star(self, _action, _param) -> None:

def on_about(self, _action, _param):
telemetry.capture('about activated')
about_window = Adw.AboutWindow(
about_window = Adw.AboutDialog(
application_name="Frog",
application_icon=APP_ID,
version=self.version,
Expand All @@ -183,10 +183,9 @@ def on_about(self, _action, _param):
</ul>
<p>Full list of changes you may find in the repository.</p>
<p>We hope you enjoy our work!</p>
""",
transient_for=self.props.active_window
"""
)
about_window.present()
about_window.present(self.props.active_window)

def on_shortcuts(self, _action, _param):
telemetry.capture('shortcuts activated')
Expand Down
87 changes: 0 additions & 87 deletions frog/widgets/language_dialog.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# preferences_window.py
# preferences_dialog.py
#
# Copyright 2021-2023 Andrey Maksimov
#
Expand Down Expand Up @@ -35,16 +35,15 @@
from frog.widgets.preferences_languages_page import PreferencesLanguagesPage


@Gtk.Template(resource_path=f'{RESOURCE_PREFIX}/ui/preferences_window.ui')
class PreferencesWindow(Adw.PreferencesWindow):
__gtype_name__ = 'PreferencesWindow'
@Gtk.Template(resource_path=f'{RESOURCE_PREFIX}/ui/preferences_dialog.ui')
class PreferencesDialog(Adw.PreferencesDialog):
__gtype_name__ = 'PreferencesDialog'

general_page: PreferencesGeneralPage = Gtk.Template.Child()
languages_page: PreferencesLanguagesPage = Gtk.Template.Child()

def __init__(self, settings: Settings, parent: Adw.Window = None):
def __init__(self):
super().__init__()
self.set_transient_for(parent)

self.connect('show', lambda x: telemetry.capture_page_view('preferences'))

Expand Down
7 changes: 3 additions & 4 deletions frog/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from frog.services.share_service import ShareService
from frog.widgets.extracted_page import ExtractedPage
from frog.widgets.list_menu_row import ListMenuRow
from frog.widgets.preferences_window import PreferencesWindow
from frog.widgets.preferences_dialog import PreferencesDialog
from frog.widgets.welcome_page import WelcomePage


Expand Down Expand Up @@ -294,9 +294,8 @@ def on_copy_to_clipboard(self, sender) -> None:
self.show_toast(_("Text copied"))

def show_preferences(self):
# dialog = LanguagePacksDialog(self)
dialog = PreferencesWindow(settings=self.settings, parent=self)
dialog.present()
dialog = PreferencesDialog()
dialog.present(self)

def show_welcome_page(self, *_):
self.split_view.set_show_content(False)
Expand Down

0 comments on commit 63a3c59

Please sign in to comment.