diff --git a/simplelogin-gui/data/im.zander.SimpleLogin.gschema.xml b/simplelogin-gui/data/im.zander.SimpleLogin.gschema.xml
index 0e59605..206d4f5 100644
--- a/simplelogin-gui/data/im.zander.SimpleLogin.gschema.xml
+++ b/simplelogin-gui/data/im.zander.SimpleLogin.gschema.xml
@@ -6,6 +6,16 @@
Api key
The api key for the current user
+
+ nothing
+ Profile picture url
+ The url for the users profile picture
+
+
+ nothing
+ Profile picture data
+ The data for the users profile picture
+
(-1,-1)
diff --git a/simplelogin-gui/data/settings_panel.blp b/simplelogin-gui/data/settings_panel.blp
index 9abb9c3..ac9ebc6 100644
--- a/simplelogin-gui/data/settings_panel.blp
+++ b/simplelogin-gui/data/settings_panel.blp
@@ -14,17 +14,13 @@ template $SettingsPanel : Box {
row-homogeneous: true;
valign: start;
- Button profile_image_button {
- has-frame: false;
-
- Image profile_image {
- halign: center;
- icon-name: "user-info-symbolic";
- icon-size: large;
- margin-end: 5;
- valign: center;
- vexpand: true;
- }
+ Image profile_image {
+ halign: center;
+ icon-name: "user-info-symbolic";
+ icon-size: large;
+ margin-end: 5;
+ valign: center;
+ vexpand: true;
layout {
column: "0";
@@ -34,27 +30,17 @@ template $SettingsPanel : Box {
}
}
- Box {
- Button remove_picture_button {
- halign: start;
- valign: center;
- icon-name: "window-close-symbolic";
- visible: false;
- }
-
- Entry name_label {
- editable: false;
- can-focus: false;
- has-frame: false;
- hexpand: true;
- input-hints: no_emoji | no_spellcheck;
- text: "Testy McTesterface";
-
- styles [
- "login-title-label",
- ]
- }
+ Entry name_label {
+ editable: false;
+ can-focus: false;
+ has-frame: false;
+ hexpand: true;
+ input-hints: no_emoji | no_spellcheck;
+ text: "Testy McTesterface";
+ styles [
+ "login-title-label",
+ ]
layout {
column: "1";
column-span: "1";
diff --git a/simplelogin-gui/src/application.rs b/simplelogin-gui/src/application.rs
index 0d28eaf..1088721 100644
--- a/simplelogin-gui/src/application.rs
+++ b/simplelogin-gui/src/application.rs
@@ -17,6 +17,7 @@ mod imp {
pub struct Application {
#[property(name = "api-key", type = Option,
get = Self::api_key, set = Self::set_api_key, nullable)]
+ #[property(get)]
pub settings: RefCell,
pub context: RefCell,
}
diff --git a/simplelogin-gui/src/settings_panel.rs b/simplelogin-gui/src/settings_panel.rs
index f8ef46a..7ed4c1d 100644
--- a/simplelogin-gui/src/settings_panel.rs
+++ b/simplelogin-gui/src/settings_panel.rs
@@ -1,6 +1,6 @@
use crate::application;
use gtk4 as gtk;
-use gtk::{glib, prelude::*, subclass::prelude::*};
+use gtk::{glib, gio, gdk, prelude::*, subclass::prelude::*};
mod imp {
use super::*;
@@ -8,6 +8,7 @@ mod imp {
use std::cell::RefCell;
use glib::subclass::Signal;
use once_cell::sync::Lazy;
+ use simplelogin::reqwest;
#[derive(Debug, Default, glib::Properties, gtk::CompositeTemplate)]
#[template(file = "data/settings_panel.blp")]
@@ -20,12 +21,8 @@ mod imp {
#[template_child]
pub content: TemplateChild,
#[template_child]
- pub profile_image_button: TemplateChild,
- #[template_child]
pub profile_image: TemplateChild,
#[template_child]
- pub remove_picture_button: TemplateChild,
- #[template_child]
pub name_label: TemplateChild,
#[template_child]
pub edit_button: TemplateChild,
@@ -149,6 +146,79 @@ mod imp {
}
}
+ fn did_profile_picture_change(
+ new_url: &Option, settings: &gio::Settings
+ ) -> bool {
+ let old_url: Option = settings.value("profile-url")
+ .get::