Commit 0ada3935 authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

window: use hdyApplicationWindow

parent ec52bbaa
Pipeline #195820 failed with stage
in 1 minute and 29 seconds
......@@ -6,7 +6,7 @@
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="type_hint">dialog</property>
<property name="program_name" translatable="yes">@name-prefix@Icon Library</property>
<property name="program_name" translatable="yes">Icon Library</property>
<property name="version">@version@</property>
<property name="website">https://gitlab.gnome.org/World/design/icon-library</property>
<property name="authors">Bilal Elmoussaoui</property>
......
......@@ -5,6 +5,7 @@
<requires lib="libhandy" version="0.0"/>
<object class="GtkStack" id="icons_view">
<property name="visible">True</property>
<property name="expand">True</property>
<property name="can_focus">False</property>
<property name="transition_type">crossfade</property>
<child>
......@@ -12,32 +13,50 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkViewport">
<object class="HdyClamp">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">none</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="maximum_size">900</property>
<property name="tightening_threshold">900</property>
<child>
<object class="HdyClamp">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="maximum_size">900</property>
<property name="tightening_threshold">900</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<object class="GtkBox" id="shipped_icons_container">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">24</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="shipped_icons_container">
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="system_help_container">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">24</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="margin_top">12</property>
<property name="label" translatable="yes">Pre-Installed System Icons</property>
<style>
<class name="title-1"/>
</style>
</object>
<packing>
<property name="expand">False</property>
......@@ -46,50 +65,20 @@
</packing>
</child>
<child>
<object class="GtkBox" id="system_help_container">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</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="margin_top">12</property>
<property name="label" translatable="yes">Pre-Installed System Icons</property>
<style>
<class name="title-1"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="label" translatable="yes">These icons come with the operating system, which means you have no control over them and they could change at any time. Only use them if you're sure you are using them in the correct context (e.g. three lines for a primary menu).</property>
<property name="justify">fill</property>
<property name="wrap">True</property>
<property name="ellipsize">end</property>
<property name="lines">2</property>
<style>
<class name="body"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<property name="halign">start</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="label" translatable="yes">These icons come with the operating system, which means you have no control over them and they could change at any time. Only use them if you're sure you are using them in the correct context (e.g. three lines for a primary menu).</property>
<property name="justify">fill</property>
<property name="wrap">True</property>
<property name="ellipsize">end</property>
<property name="lines">2</property>
<style>
<class name="body"/>
</style>
</object>
<packing>
<property name="expand">False</property>
......@@ -97,26 +86,31 @@
<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>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="system_icons_container">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">24</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="system_icons_container">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">24</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
......@@ -170,7 +164,6 @@
</object>
<packing>
<property name="name">no-results</property>
<property name="position">1</property>
</packing>
</child>
</object>
......
......@@ -46,74 +46,80 @@
</packing>
</child>
</object>
<object class="GtkApplicationWindow" id="window">
<object class="HdyApplicationWindow" id="window">
<property name="can_focus">False</property>
<property name="default_width">650</property>
<property name="default_height">500</property>
<property name="icon_name">@app-id@</property>
<property name="title" translatable="yes">@name-prefix@Icon Library</property>
<child type="titlebar">
<object class="HdyHeaderBar" id="headerbar">
<property name="title" translatable="yes">Icon Library</property>
<child>
<object class="GtkBox" id="container">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_close_button">True</property>
<property name="centering_policy">HDY_CENTERING_POLICY_STRICT</property>
<child type="title">
<object class="HdyClamp">
<property name="orientation">vertical</property>
<child>
<object class="HdyHeaderBar" id="headerbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tightening_threshold">400</property>
<property name="hexpand">True</property>
<child>
<object class="GtkSearchEntry" id="search_entry">
<property name="show_close_button">True</property>
<property name="centering_policy">HDY_CENTERING_POLICY_STRICT</property>
<child type="title">
<object class="HdyClamp">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<property name="placeholder_text" translatable="yes">Search for icons by name, category or tag</property>
<property name="can_focus">False</property>
<property name="tightening_threshold">400</property>
<property name="hexpand">True</property>
<child>
<object class="GtkSearchEntry" id="search_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<property name="placeholder_text" translatable="yes">Search for icons by name, category or tag</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="action_name">app.dark-mode</property>
<property name="tooltip_text" translatable="yes">Toggle Dark Mode</property>
<child>
<object class="GtkImage" id="dark_mode_image">
<object class="GtkButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">dark-mode-symbolic</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="action_name">app.dark-mode</property>
<property name="tooltip_text" translatable="yes">Toggle Dark Mode</property>
<child>
<object class="GtkImage" id="dark_mode_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">dark-mode-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">start</property>
</packing>
</child>
</object>
<packing>
<property name="pack_type">start</property>
</packing>
</child>
<child>
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popover">popover</property>
<child>
<object class="GtkImage">
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">open-menu-symbolic</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popover">popover</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">open-menu-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</object>
</child>
......
......@@ -12,13 +12,13 @@ use std::{cell::RefCell, rc::Rc};
#[derive(Clone)]
pub struct SearchProvider {
search_provider: Arc<SP>,
window: gtk::ApplicationWindow,
window: libhandy::ApplicationWindow,
sender: Sender<Action>,
model: Rc<IconsModel>,
}
impl SearchProvider {
pub fn new(model: Rc<IconsModel>, window: gtk::ApplicationWindow, sender: Sender<Action>) -> Rc<RefCell<Self>> {
pub fn new(model: Rc<IconsModel>, window: libhandy::ApplicationWindow, sender: Sender<Action>) -> Rc<RefCell<Self>> {
let search_provider = SP::new(APP_ID.to_string(), "/org/gnome/design/IconLibrary/SearchProvider".to_string());
let sp = Rc::new(RefCell::new(Self {
......
......@@ -7,7 +7,7 @@ use gtk::prelude::*;
use std::rc::Rc;
pub struct Window {
pub widget: gtk::ApplicationWindow,
pub widget: libhandy::ApplicationWindow,
builder: gtk::Builder,
sender: glib::Sender<Action>,
pub model: Rc<IconsModel>,
......@@ -17,7 +17,7 @@ impl Window {
pub fn new(sender: glib::Sender<Action>, model: Rc<IconsModel>) -> Self {
let settings = gio::Settings::new(APP_ID);
let builder = gtk::Builder::from_resource("/org/gnome/design/IconLibrary/window.ui");
get_widget!(builder, gtk::ApplicationWindow, window);
get_widget!(builder, libhandy::ApplicationWindow, window);
let window_widget = Window {
widget: window,
......@@ -67,7 +67,8 @@ impl Window {
for (_, icons_context) in self.model.shipped_icons.borrow().iter() {
icons_view.add_context(icons_context.clone());
}
self.widget.add(&icons_view.widget);
get_widget!(self.builder, gtk::Box, container);
container.add(&icons_view.widget);
// Search
get_widget!(self.builder, gtk::SearchEntry, search_entry);
......
......@@ -3,7 +3,7 @@ use gio::prelude::SettingsExt;
use gtk::prelude::GtkWindowExt;
use gtk::SettingsExt as gtkSettingsExt;
pub fn load(window: &gtk::ApplicationWindow, settings: &gio::Settings) {
pub fn load(window: &libhandy::ApplicationWindow, settings: &gio::Settings) {
let width = settings.get_int("window-width");
let height = settings.get_int("window-height");
......@@ -28,7 +28,7 @@ pub fn load(window: &gtk::ApplicationWindow, settings: &gio::Settings) {
}
}
pub fn save(window: &gtk::ApplicationWindow, settings: &gio::Settings) -> Result<()> {
pub fn save(window: &libhandy::ApplicationWindow, settings: &gio::Settings) -> Result<()> {
let size = window.get_size();
let position = window.get_position();
......
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