Commit 6c34856d authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui
Browse files

fix colour entry placeholder

parent 36ca234b
......@@ -39,9 +39,6 @@ impl ObjectImpl for ColourEntryPrivate {
self_.set_valign(gtk::Align::Center);
self_.get_style_context().add_class(&gtk::STYLE_CLASS_LINKED);
self_.set_hexpand(true);
// self_.set_tooltip_text(Some(&label));
//self.entry.set_placeholder_text(Some(label.as_str()));
self.entry.set_halign(gtk::Align::Center);
self.entry.set_valign(gtk::Align::Center);
self.entry.set_property_primary_icon_name(Some("circle-symbolic"));
......@@ -111,10 +108,12 @@ glib_wrapper! {
impl ColourEntry {
pub fn new(placeholder: &str) -> Self {
glib::Object::new(ColourEntry::static_type(), &[("placeholder", &placeholder.to_value())])
.unwrap()
.downcast::<ColourEntry>()
.unwrap()
let colour_entry = glib::Object::new(ColourEntry::static_type(), &[]).unwrap().downcast::<ColourEntry>().unwrap();
let self_ = ColourEntryPrivate::from_instance(&colour_entry);
colour_entry.set_tooltip_text(Some(&placeholder));
self_.entry.set_placeholder_text(Some(&placeholder));
colour_entry
}
pub fn get_entry(&self) -> gtk::Entry {
......
use super::application::Action;
use super::colour;
use super::colour_entry::ColourEntry;
use super::config::{APP_ID, PROFILE};
use super::config::PROFILE;
use super::contrast_level::ContrastLevelBar;
use super::contrast_preview::ContrastPreview;
use super::window_state::WindowState;
......@@ -35,11 +35,10 @@ impl ObjectSubclass for WindowPrivate {
glib_object_subclass!();
fn new() -> Self {
let settings = gio::Settings::new(APP_ID);
let bg_entry = ColourEntry::new(&gettext("Background Colour"));
let fg_entry = ColourEntry::new(&gettext("Foreground Colour"));
let state = Rc::new(RefCell::new(WindowState::init(settings)));
let state = Rc::new(RefCell::new(WindowState::init()));
let levelbar = RefCell::new(ContrastLevelBar::new());
let preview = ContrastPreview::new();
......
use super::colour;
use super::colour_entry::ColourEntry;
use super::config::APP_ID;
use super::window::Window;
use gio::prelude::SettingsExt;
use gtk::prelude::GtkWindowExt;
......@@ -35,7 +36,8 @@ pub struct WindowState {
}
impl WindowState {
pub fn init(settings: gio::Settings) -> WindowState {
pub fn init() -> WindowState {
let settings = gio::Settings::new(APP_ID);
let x = settings.get_int("window-x");
let y = settings.get_int("window-y");
let is_maximized = settings.get_boolean("is-maximized");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment