Skip to content

Commit bde09fa

Browse files
committed
Add an option to select what items will be imported
1 parent bcff35d commit bde09fa

6 files changed

Lines changed: 23 additions & 31 deletions

File tree

data/io.github.vikdevelop.SaveDesktop.gschema.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</key>
3636
<key name="save-gtk-settings" type="b">
3737
<default>true</default>
38-
<summary>Save the GTK application settings (appearance, tabs, styles)</summary>
38+
<summary>Save the GTK application settings</summary>
3939
</key>
4040
<key name="save-installed-flatpaks" type="b">
4141
<default>true</default>

po/savedesktop.pot

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ msgstr ""
3232
#: src/gui/templates/shortcuts_window.ui:57
3333
#: src/gui/window.py
3434
#: src/gui/items_dialog.py
35-
msgid "Items to include in the configuration archive"
35+
msgid "Select configuration items"
3636
msgstr ""
3737

3838
#: src/gui/items_dialog.py
39-
msgid "These settings also apply to periodic saving"
39+
msgid "These settings are used for manual and periodic saves, imports, and synchronization."
4040
msgstr ""
4141

4242
#: src/gui/items_dialog.py
@@ -63,6 +63,14 @@ msgstr ""
6363
msgid "Desktop"
6464
msgstr ""
6565

66+
#: src/gui/items_dialog.py
67+
msgid "GTK application settings"
68+
msgstr ""
69+
70+
#: src/gui/items_dialog.py
71+
msgid "Bookmarks, styles, etc."
72+
msgstr ""
73+
6674
#: src/gui/items_dialog.py
6775
msgid "Flatpak apps"
6876
msgstr ""

src/gui/items_dialog.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def __init__(self, parent):
110110
super().__init__()
111111
self.parent = parent
112112

113-
self.set_heading(_("Items to include in the configuration archive"))
114-
self.set_body(_("These settings also apply to periodic saving"))
113+
self.set_heading(_("Select configuration items"))
114+
self.set_body(_("These settings are used for manual and periodic saves, imports, and synchronization."))
115115

116116
# Box for loading widgets in this dialog
117117
self.itemsBox = Gtk.ListBox.new()
@@ -192,6 +192,7 @@ def __init__(self, parent):
192192

193193
self.desktop_row = Adw.ActionRow.new()
194194
self.desktop_row.set_title(title=_("Desktop"))
195+
self.desktop_row.set_subtitle(subtitle=GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DESKTOP))
195196
self.desktop_row.set_subtitle_selectable(True)
196197
self.desktop_row.set_use_markup(True)
197198
self.desktop_row.set_title_lines(2)
@@ -200,14 +201,15 @@ def __init__(self, parent):
200201
self.desktop_row.set_activatable_widget(self.switch_de)
201202
self.itemsBox.append(child=self.desktop_row)
202203

203-
# Swithc and row of option 'GTK application settings (appearance, tabs, styles)'
204+
# Switch and row of the option: GTK Settings
204205
self.switch_gtk = Gtk.Switch.new()
205206
if settings["save-gtk-settings"]:
206207
self.switch_gtk.set_active(True)
207208
self.switch_gtk.set_valign(align=Gtk.Align.CENTER)
208209

209210
self.gtk_row = Adw.ActionRow.new()
210-
self.gtk_row.set_title(title=_("GTK application settings (appearance, tabs, styles)"))
211+
self.gtk_row.set_title(title=_("GTK application settings"))
212+
self.gtk_row.set_subtitle(subtitle=_("Bookmarks, styles, etc."))
211213
self.gtk_row.set_subtitle_selectable(True)
212214
self.gtk_row.set_use_markup(True)
213215
self.gtk_row.set_title_lines(2)

src/gui/templates/shortcuts_window.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
</child>
5555
<child>
5656
<object class="GtkShortcutsShortcut">
57-
<property name="title" translatable="yes">Items to include in the configuration archive</property>
57+
<property name="title" translatable="yes">Select configuration items</property>
5858
<property name="action-name">app.items-dialog</property>
5959
<property name="accelerator">&lt;primary&gt;&lt;shift&gt;i</property>
6060
</object>

src/gui/window.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from pathlib import Path
88
from threading import Thread
99
from savedesktop.globals import *
10-
from savedesktop.gui.items_dialog import FolderSwitchRow, FlatpakAppsDialog, itemsDialog
1110
from savedesktop.gui.more_options_dialog import MoreOptionsDialog
1211
from savedesktop.gui.synchronization_dialogs import InitSetupDialog, SetDialog, CloudDialog
1312

@@ -38,6 +37,7 @@ def __init__(self, *args, **kwargs):
3837
# primary menu section
3938
self.general_menu = Gio.Menu()
4039
self.general_menu.append(_("Keyboard shortcuts"), 'app.shortcuts')
40+
self.general_menu.append(_("Select configuration items"), 'app.items-dialog')
4141
self.general_menu.append(_("About app"), 'app.about')
4242
self.main_menu.append_section(None, self.general_menu)
4343

@@ -187,21 +187,6 @@ def save_desktop(self):
187187
self.saveEntry.set_text(settings["filename"])
188188
self.lbox_e.append(self.saveEntry)
189189

190-
# Button for opening dialog for selecting items that will be included to the config archive
191-
self.itemsButton = Gtk.Button.new_from_icon_name("go-next-symbolic")
192-
self.itemsButton.set_valign(Gtk.Align.CENTER)
193-
self.itemsButton.add_css_class("flat")
194-
self.itemsButton.connect("clicked", self._open_items_dialog)
195-
196-
# Action row for opening dialog for selecting items that will be included to the config archive
197-
self.items_row = Adw.ActionRow.new()
198-
self.items_row.set_title(title=_("Items to include in the configuration archive"))
199-
self.items_row.set_use_markup(True)
200-
self.items_row.set_title_lines(5)
201-
self.items_row.add_suffix(self.itemsButton)
202-
self.items_row.set_activatable_widget(self.itemsButton)
203-
self.lbox_e.append(child=self.items_row)
204-
205190
self.lbox_e.set_show_separators(True)
206191

207192
# section for showing dialog with more options
@@ -234,12 +219,6 @@ def _open_more_options_dialog(self, w):
234219
self.more_options_dialog.choose(self, None, None, None)
235220
self.more_options_dialog.present(self)
236221

237-
# open a dialog for selecting the items to include in the configuration archive
238-
def _open_items_dialog(self, w):
239-
self.items_dialog = itemsDialog(self)
240-
self.items_dialog.choose(self, None, None, None)
241-
self.items_dialog.present(self)
242-
243222
# Import configuration page
244223
def import_desktop(self):
245224
self.importBox.set_valign(Gtk.Align.CENTER)

src/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
gi.require_version('Adw', '1')
44
from gi.repository import Gtk, Adw, Gio, GLib
55
from savedesktop.gui.window import MainWindow
6+
from savedesktop.gui.items_dialog import FolderSwitchRow, FlatpakAppsDialog, itemsDialog
67
from savedesktop.globals import *
78

89
@Gtk.Template(resource_path="/io/github/vikdevelop/SaveDesktop/gui/templates/shortcuts_window.ui")
@@ -44,7 +45,9 @@ def call_ms_dialog(self, action, param):
4445

4546
# Open the "Items to include in the configuration archive" dialog using Ctrl+Shift+I keyboard shortcut
4647
def call_items_dialog(self, action, param):
47-
self.win._open_items_dialog(w="")
48+
self.items_dialog = itemsDialog(self.win)
49+
self.items_dialog.choose(self.win, None, None, None)
50+
self.items_dialog.present(self.win)
4851

4952
# Open the "Set up the sync file" dialog using Ctrl+Shift+S keyboard shortcut
5053
def call_setDialog(self, action, param):

0 commit comments

Comments
 (0)