Commit 9def8141 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

New settings window

parent 5a630fc0
Pipeline #79651 failed with stages
in 3 minutes and 17 seconds
......@@ -83,3 +83,4 @@ target/
*.in~
*.gitignore~
*.build~
*.ui.in#
\ No newline at end of file
......@@ -18,6 +18,8 @@
"--talk-name=org.freedesktop.Flatpak",
/* Screenshot (used to scan QR code)*/
"--talk-name=org.gnome.Shell.Screenshot",
/* Follow Night Light Settings */
"--talk-name=org.gnome.SettingsDaemon.Color",
/* dconf */
"--filesystem=xdg-run/dconf", "--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.dconf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf",
......
......@@ -17,6 +17,7 @@
<file compressed="true" preprocess="xml-stripblanks" alias="account_row.ui">ui/account_row.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="accounts_widget.ui">ui/accounts_widget.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="provider_image.ui">ui/provider_image.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="password_widget.ui">ui/password_widget.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="window.ui">window.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="settings.ui">settings.ui</file>
</gresource>
......
......@@ -6,10 +6,15 @@
<summary>Default window position</summary>
<description>Default window position</description>
</key>
<key name="night-mode" type="b">
<key name="dark-theme" type="b">
<default>false</default>
<summary>Night mode</summary>
<description>Enable/disable night mode within the application</description>
<summary>Dark Theme</summary>
<description>Whether the application should use a dark theme.</description>
</key>
<key name="night-light" type="b">
<default>false</default>
<summary>Night Light</summary>
<description>Automatically enable dark mode at night.</description>
</key>
<key name="is-maximized" type="b">
<default>false</default>
......
.account-row,
.settings-row{
window box hdycolumn box list row{
background-color: mix(@theme_base_color,@theme_bg_color,0.3);
padding: 2px 8px;
margin:0;
border: 1px solid mix(@theme_base_color,@theme_fg_color,0.3);
border-bottom: 0px;
}
.account-row:last-child, .settings-row:last-child {
window box hdycolumn box list row:last-child{
border-bottom: 1px solid mix(@theme_base_color,@theme_fg_color,0.3);
}
window box hdycolumn box list row separator {
background-color: mix(@theme_base_color,@theme_fg_color,0.3);
}
/* AccountsList */
.accounts-list{
background-color: @theme_bg_color;
}
.provider-label{
font-size:14px;
font-weight: bold;
}
/* AccountRow */
.account-row .account-name-label{
font-size: 13px;
padding: 3px 6px;
}
.account-row .pin-label{
font-size: 12px;
}
/* Settings */
.settings-category-title{
font-size:13px;
font-weight:600;
padding: 6px 3px;
}
.settings-box-main-label{
font-size:12px;
}
.settings-box-secondary-label{
font-size:12px;
color: mix(@theme_base_color,@theme_fg_color,0.6);
}
.application-name {
font-size: 14px;
color: @theme_fg_color;
font-style: italic;
}
.account-name {
font-weight: bold;
font-size: 16px;
}
/* Common */
......@@ -65,7 +69,7 @@
border-radius: 0px
}
.app-notification{
font-size:11px;
}
.provider-widget{
margin: 4px 2px;
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="PasswordWidget" parent="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="current_password_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Current Password:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="current_password_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="visibility">False</property>
<property name="input_purpose">password</property>
<signal name="changed" handler="password_entry_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">New Password:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="password_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
<property name="input_purpose">password</property>
<signal name="changed" handler="password_entry_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Confirm New Password:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="confirm_password_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="visibility">False</property>
<property name="input_purpose">password</property>
<signal name="changed" handler="password_entry_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="change_password_btn">
<property name="label" translatable="yes">Change Password</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<property name="hexpand">True</property>
<signal name="clicked" handler="update_password_clicked" swapped="no"/>
<style>
<class name="suggested-action"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="delete_password_btn">
<property name="label" translatable="yes">Delete Password</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<property name="hexpand">True</property>
<signal name="clicked" handler="reset_password_clicked" swapped="no"/>
<style>
<class name="destructive-action"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="position">1</property>
</packing>
</child>
</template>
</interface>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkImage" id="add_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">list-add-symbolic</property>
</object>
<object class="GtkImage" id="add_image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">list-add-symbolic</property>
</object>
<object class="GtkImage" id="primary_menu_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">open-menu-symbolic</property>
</object>
<object class="GtkImage" id="search_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">system-search-symbolic</property>
</object>
<template class="Window" parent="GtkApplicationWindow">
<property name="width_request">350</property>
<property name="height_request">500</property>
<property name="can_focus">False</property>
<property name="default_width">350</property>
<property name="default_width">400</property>
<property name="default_height">500</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_close_button">True</property>
<child type="title">
<object class="GtkStack" id="headerbar_stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="transition_type">slide-left-right</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<child>
<object class="GtkButton" id="add_btn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">win.add-account</property>
<property name="image">add_image</property>
<signal name="clicked" handler="add_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="search_btn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">search_image</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="name">main_headerbar</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<child>
<object class="GtkButton" id="add_btn1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">win.add-account</property>
<property name="image">add_image1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="name">empty_headerbar</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="hexpand">True</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">locked_headerbar</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="primary_menu_btn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">primary_menu_image</property>
<signal name="clicked" handler="primary_menu_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="main_stack">
<property name="width_request">350</property>
......@@ -208,131 +334,5 @@
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_close_button">True</property>
<child type="title">
<object class="GtkStack" id="headerbar_stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="transition_type">slide-left-right</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<child>
<object class="GtkButton" id="add_btn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">win.add-account</property>
<property name="image">add_image</property>
<signal name="clicked" handler="add_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="search_btn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">search_image</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="name">main_headerbar</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<child>
<object class="GtkButton" id="add_btn1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">win.add-account</property>
<property name="image">add_image1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="name">empty_headerbar</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="hexpand">True</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">locked_headerbar</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="primary_menu_btn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">primary_menu_image</property>
<signal name="clicked" handler="primary_menu_btn_clicked" swapped="no"/>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</object>
</child>
</template>
<object class="GtkImage" id="add_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">list-add-symbolic</property>
</object>
<object class="GtkImage" id="add_image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">list-add-symbolic</property>
</object>
<object class="GtkImage" id="primary_menu_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">open-menu-symbolic</property>
</object>
<object class="GtkImage" id="search_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">system-search-symbolic</property>
</object>
</interface>
......@@ -9,16 +9,18 @@ gnome = import('gnome')
i18n = import('i18n')
gettext_package = 'Authenticator'
if get_option('profile') == 'development'
profile = 'Devel'
name_suffix = ' (Development)'
gettext_package += '-devel'
else
profile = ''
name_suffix = ''
profile = get_option('profile')
name_suffix = ''
if profile != 'default'
gettext_package += profile
if profile == 'beta'
name_suffix = ' (Beta)'
else
name_suffix = ' (Development)'
endif
endif
application_id = 'com.github.bilelmoussaoui.Authenticator@0@'.format(profile)
message('Looking for dependencies')
......
......@@ -3,7 +3,8 @@ option(
type: 'combo',
choices: [
'default',
'development'
'development',
'beta',
],
value: 'default'
)
......@@ -28,6 +28,7 @@ class Application(Gtk.Application):
instance = None
IS_DEVEL = False
is_locked = GObject.Property(type=bool, default=False)
profile = GObject.Property(type=str, default='default')
def __init__(self):
Gtk.Application.__init__(self,
......@@ -65,7 +66,7 @@ class Application(Gtk.Application):
# Set the default night mode
gtk_settings = Gtk.Settings.get_default()
Settings.get_default().bind("night-mode", gtk_settings,
Settings.get_default().bind("dark-theme", gtk_settings,
"gtk-application-prefer-dark-theme",
Gio.SettingsBindFlags.DEFAULT)
......@@ -146,8 +147,8 @@ class Application(Gtk.Application):
window.set_menu(self._menu)
window.set_application(self)
window.connect("delete-event", lambda x, y: self.__on_quit())
if Application.IS_DEVEL:
window.get_style_context().add_class("devel")
if self.props.profile != 'default':
window.get_style_context().add_class(self.props.profile)
self.add_window(window)
window.show_all()
window.present()
......
......@@ -120,7 +120,7 @@ class Keyring:
def set_password(password):
schema = Keyring.get_default().password_schema
# Clear old password
Secret.password_clear_sync(schema, {}, None)
Keyring.remove_password()
# Store the new one
Secret.password_store_sync(
schema,
......@@ -136,7 +136,7 @@ class Keyring:
return Keyring.get_password() is not None
@staticmethod
def clear_password():
def remove_password():
schema = Keyring.get_default().password_schema
Secret.password_clear_sync(schema, {}, None)
......@@ -64,19 +64,20 @@ class Settings(Gio.Settings):
self.set_value('window-position', position)