Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ build
builddir
.flatpak-builder
*~
.flatpak
.vscode
12 changes: 11 additions & 1 deletion com.github.elfenware.obliviate.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
app-id: com.github.elfenware.obliviate

runtime: io.elementary.Platform
runtime-version: '7'
runtime-version: '8.2'
sdk: io.elementary.Sdk

command: com.github.elfenware.obliviate

finish-args:
- '--share=ipc'
- '--device=dri'
- '--socket=fallback-x11'
- '--socket=wayland'

Expand All @@ -18,6 +19,15 @@ modules:
- type: archive
url: https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.8.tar.bz2
sha256: 895de2bb981dd127f0821d1ce13fadf7d760f9fa7737648b15f2c1fe13cc5af5
modules:
- name: libgpg-error
buildsystem: autotools
config-opts:
- "--enable-install-gpg-error-config"
sources:
- type: archive
url: https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.55.tar.gz
sha256: bda09f51d7ed64565e41069d782bfcc4984aed908ae68bee01fb692b64ea96e2
- name: obliviate
buildsystem: meson
sources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
<p>Bonus: If you need your passwords on another device, you can get them on the web from obliviate.app.</p>
</description>
<releases>
<release version="3.0.0" date="2022-06-05">
<description>
<ul>
<li>Move to modern tech</li>
</ul>
</description>
</release>
<release version="2.4.0" date="2022-06-05">
<description>
<ul>
Expand Down
8 changes: 4 additions & 4 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ endforeach
i18n.merge_file (
input: meson.project_name () + '.desktop.in',
output: meson.project_name () + '.desktop',
po_dir: join_paths (meson.source_root (), 'po', 'extra'),
po_dir: join_paths (meson.project_source_root (), 'po', 'extra'),
type: 'desktop',
install: true,
install_dir: join_paths (get_option ('datadir'), 'applications')
)

# Translate and install our .appdata.xml file so AppCenter will see it
i18n.merge_file (
input: meson.project_name () + '.appdata.xml.in',
output: meson.project_name () + '.appdata.xml',
po_dir: join_paths (meson.source_root (), 'po', 'extra'),
input: meson.project_name () + '.metainfo.xml.in',
output: meson.project_name () + '.metainfo.xml',
po_dir: join_paths (meson.project_source_root (), 'po', 'extra'),
install: true,
install_dir: join_paths (get_option ('datadir'), 'metainfo')
)
Expand Down
13 changes: 8 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
project (
'com.github.elfenware.obliviate',
'vala', 'c',
version: '2.4.0'
version: '3.0.0'
)

# Translation module
Expand Down Expand Up @@ -38,9 +38,8 @@ asresources = gnome.compile_resources (
# Listing dependencies
dependencies = [
dependency ('glib-2.0'),
dependency ('granite'),
dependency ('gtk+-3.0'),
dependency ('libhandy-1'),
dependency ('granite-7'),
dependency ('gtk4'),
declare_dependency (dependencies: [
meson.get_compiler ('c').find_library ('libgcrypt'),
meson.get_compiler ('vala').find_library ('gcrypt', dirs: join_paths (meson.current_source_dir (), 'vapi'))
Expand All @@ -62,4 +61,8 @@ executable (
subdir('data')
subdir('po')

meson.add_install_script ('meson/post_install.py')
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
update_desktop_database: true
)
17 changes: 0 additions & 17 deletions meson/post_install.py

This file was deleted.

2 changes: 1 addition & 1 deletion po/extra/meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Install metadata translations
i18n.gettext ('extra',
args: [
'--directory=' + meson.source_root (),
'--directory=' + meson.project_source_root (),
'--from-code=UTF-8'
],
install: false
Expand Down
2 changes: 1 addition & 1 deletion po/meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Install main translations
i18n.gettext (meson.project_name (),
args: [
'--directory=' + meson.source_root (),
'--directory=' + meson.project_source_root (),
'--from-code=UTF-8',
'-cTRANSLATORS'
],
Expand Down
6 changes: 3 additions & 3 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

public class Obliviate.Application : Granite.Application {
public class Obliviate.Application : Gtk.Application {
private Obliviate.MainWindow window;

public Application () {
Expand Down Expand Up @@ -52,8 +52,8 @@ public class Obliviate.Application : Granite.Application {

var provider = new Gtk.CssProvider ();
provider.load_from_resource ("/com/github/elfenware/obliviate/Application.css");
Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (),
Gtk.StyleContext.add_provider_for_display (
Gdk.Display.get_default (),
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);
Expand Down
96 changes: 38 additions & 58 deletions src/MainView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,97 +18,81 @@
*
*/

public class Obliviate.MainView : Gtk.Overlay {
public class Obliviate.MainView : Gtk.Box {
private Gtk.Overlay overlay;
private Gtk.Grid grid;
private Granite.Widgets.Toast toast;
private Granite.Toast toast;

private Gtk.Entry site;
private Gtk.Entry cipher_key;
private Gtk.Entry generated_pass;
private Gtk.ToggleButton show_generated_pass;
private Gtk.PasswordEntry cipher_key;
private Gtk.PasswordEntry generated_pass;
private Gtk.Button copy_btn;
private Gtk.Button copy_without_symbols_btn;
private Gtk.Label clearing_label;
private Gtk.ProgressBar clearing_progress;

private Gtk.Clipboard clipboard;
private Gdk.Clipboard clipboard;
private const float CLIPBOARD_LIFE = 30;
private uint timeout_id;

construct {
overlay = new Gtk.Overlay();

grid = new Gtk.Grid () {
row_spacing = 4,
column_spacing = 4,
margin = 30,
margin_top = 30,
margin_bottom = 30,
margin_start = 30,
margin_end = 30,
halign = Gtk.Align.CENTER
};

toast = new Granite.Widgets.Toast (_ ("Copied to clipboard"));
var toast = new Granite.Toast (_ ("Copied to clipboard"));

add (grid);
add_overlay (toast);
overlay.set_child (grid);
overlay.add_overlay (toast);

var site_label = new Gtk.Label (_ ("Site:")) {
halign = Gtk.Align.END,
margin_end = 4
};

site = new Gtk.Entry () {
placeholder_text = _ ("GitHub")
placeholder_text = _ ("GitHub"),
primary_icon_name = "dialog-information-symbolic",
primary_icon_tooltip_text = "Site is not case-sensitive. “GitHub” equals “github”."
};

site.changed.connect (handle_generate_password);

var site_info = new Gtk.Image.from_icon_name ("dialog-information-symbolic", Gtk.IconSize.MENU) {
tooltip_text = _ ("Site is not case-sensitive. “GitHub” equals “github”.")
};

var cipher_key_label = new Gtk.Label (_ ("Cipher key:")) {
halign = Gtk.Align.END,
margin_end = 4
};

// TODO: replace with Gtk.PasswordEntry after updating to Gtk4
cipher_key = new Gtk.Entry () {
visibility = false,
caps_lock_warning = true,
input_purpose = Gtk.InputPurpose.PASSWORD,
cipher_key = new Gtk.PasswordEntry () {
show_peek_icon = true,
placeholder_text = _ ("correct horse battery staple"),
width_chars = 24
};

cipher_key.changed.connect (handle_generate_password);

var show_cipher_key = new Gtk.ToggleButton () {
active = true,
tooltip_text = _ ("Show or hide the cipher key")
};

show_cipher_key.add (new Gtk.Image.from_icon_name ("image-red-eye-symbolic", Gtk.IconSize.BUTTON));
show_cipher_key.bind_property ("active", cipher_key, "visibility", BindingFlags.INVERT_BOOLEAN);

generated_pass = new Gtk.Entry () {
visibility = false,
this.generated_pass = new Gtk.PasswordEntry () {
show_peek_icon = true,
editable = false,
sensitive = false
};

generated_pass.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);

show_generated_pass = new Gtk.ToggleButton () {
active = true,
tooltip_text = _ ("Show or hide the password"),
sensitive = false
sensitive = false,
width_chars = 24
};

show_generated_pass.add (new Gtk.Image.from_icon_name ("image-red-eye-symbolic", Gtk.IconSize.BUTTON));
show_generated_pass.bind_property ("active", generated_pass, "visibility", BindingFlags.INVERT_BOOLEAN);
this.generated_pass.add_css_class (Granite.STYLE_CLASS_FLAT);

copy_btn = new Gtk.Button.with_label (_ ("Copy")) {
sensitive = false
};

copy_btn.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
copy_btn.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);

copy_btn.clicked.connect (() => {
handle_copy ();
Expand All @@ -123,8 +107,8 @@ public class Obliviate.MainView : Gtk.Overlay {
});

var button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
button_box.pack_start (copy_btn);
button_box.pack_end (copy_without_symbols_btn);
button_box.prepend (copy_btn);
button_box.append (copy_without_symbols_btn);

clearing_label = new Gtk.Label (ngettext (
"Clearing clipboard in %.0f second",
Expand All @@ -140,45 +124,42 @@ public class Obliviate.MainView : Gtk.Overlay {
fraction = 1
};

clearing_progress.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
clearing_progress.add_css_class (Granite.STYLE_CLASS_FLAT);

var plus_label = new Gtk.Label ("+");
plus_label.get_style_context ().add_class ("sign");
plus_label.add_css_class ("sign");

var equals_label = new Gtk.Label ("=");
equals_label.get_style_context ().add_class ("sign");
equals_label.add_css_class ("sign");

grid.attach (site_label, 0, 0, 1, 1);
grid.attach_next_to (site, site_label, Gtk.PositionType.RIGHT);
grid.attach_next_to (site_info, site, Gtk.PositionType.RIGHT);

grid.attach_next_to (plus_label, site, Gtk.PositionType.BOTTOM);

grid.attach (cipher_key_label, 0, 2, 1, 1);
grid.attach_next_to (cipher_key, cipher_key_label, Gtk.PositionType.RIGHT);
grid.attach_next_to (show_cipher_key, cipher_key, Gtk.PositionType.RIGHT);

grid.attach_next_to (equals_label, cipher_key, Gtk.PositionType.BOTTOM);

grid.attach_next_to (generated_pass, equals_label, Gtk.PositionType.BOTTOM);
grid.attach_next_to (show_generated_pass, generated_pass, Gtk.PositionType.RIGHT);
grid.attach_next_to (button_box, generated_pass, Gtk.PositionType.BOTTOM);

clipboard = Gtk.Clipboard.get_default (Gdk.Display.get_default ());
clipboard = this.get_clipboard ();

append (overlay);
}

private void handle_generate_password () {
if (site.text.length == 0 || cipher_key.text.length == 0) {
generated_pass.text = "";
show_generated_pass.sensitive = false;
copy_btn.sensitive = false;
copy_without_symbols_btn.sensitive = false;
return;
}

try {
generated_pass.text = Service.derive_password (cipher_key.text, site.text.down ());
show_generated_pass.sensitive = true;
copy_btn.sensitive = true;
copy_without_symbols_btn.sensitive = true;
animate_password ();
Expand All @@ -195,7 +176,7 @@ public class Obliviate.MainView : Gtk.Overlay {
? Service.remove_symbols (generated_pass.text)
: generated_pass.text;

clipboard.set_text (text_to_copy, generated_pass.text.length);
clipboard.set_text (text_to_copy);

toast.title = _ ("Copied to clipboard");
toast.send_notification ();
Expand All @@ -205,7 +186,7 @@ public class Obliviate.MainView : Gtk.Overlay {
float seconds_left = CLIPBOARD_LIFE;
timeout_id = Timeout.add_seconds (1, () => {
if (seconds_left == 0) {
clipboard.clear ();
clipboard.set_text ("");

toast.title = _ ("Cleared the clipboard");
toast.send_notification ();
Expand Down Expand Up @@ -242,10 +223,9 @@ public class Obliviate.MainView : Gtk.Overlay {
}

private void animate_password () {
var password_style = generated_pass.get_style_context ();
password_style.add_class ("regenerating");
generated_pass.add_css_class ("regenerating");
Timeout.add (100, () => {
password_style.remove_class ("regenerating");
generated_pass.remove_css_class ("regenerating");
return false;
});
}
Expand Down
Loading
Loading