UI: Port to blueprint
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
This commit is contained in:
parent
2f9ad060b8
commit
a2b1ddf747
6 changed files with 73 additions and 40 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/subprojects/blueprint-compiler
|
8
subprojects/blueprint-compiler.wrap
Normal file
8
subprojects/blueprint-compiler.wrap
Normal file
|
@ -0,0 +1,8 @@
|
|||
[wrap-git]
|
||||
directory = blueprint-compiler
|
||||
url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git
|
||||
revision = v0.16.0
|
||||
depth = 1
|
||||
|
||||
[provide]
|
||||
program_names = blueprint-compiler
|
|
@ -1,9 +1,25 @@
|
|||
name = 'vala-quick-setting'
|
||||
|
||||
blueprints = custom_target(
|
||||
'blueprints',
|
||||
input: files(
|
||||
'qs.blp',
|
||||
),
|
||||
output: '.',
|
||||
command: [
|
||||
find_program('blueprint-compiler'),
|
||||
'batch-compile',
|
||||
'@OUTPUT@',
|
||||
'@CURRENT_SOURCE_DIR@',
|
||||
'@INPUT@',
|
||||
],
|
||||
)
|
||||
|
||||
vala_quick_setting_resources = gnome.compile_resources(
|
||||
'phosh-plugin-vala-quick-setting-resources',
|
||||
'extension.gresources.xml',
|
||||
c_name: 'phosh_plugin_vala_quick_setting',
|
||||
dependencies: blueprints,
|
||||
)
|
||||
|
||||
vala_quick_setting_plugin_sources = files(
|
||||
|
|
44
vala-quick-setting/qs.blp
Normal file
44
vala-quick-setting/qs.blp
Normal file
|
@ -0,0 +1,44 @@
|
|||
using Gtk 3.0; // This requires blueprint-compiller changes
|
||||
using Phosh 0;
|
||||
|
||||
template $ExtensionQuickSetting: Phosh.QuickSetting {
|
||||
status-icon: info;
|
||||
status-page: status_page;
|
||||
clicked => $on_clicked();
|
||||
}
|
||||
|
||||
Phosh.StatusIcon info {
|
||||
visible: true;
|
||||
}
|
||||
|
||||
Phosh.StatusPage status_page {
|
||||
visible: true;
|
||||
title: _("Quick Setting Example");
|
||||
content: content;
|
||||
footer: footer;
|
||||
}
|
||||
|
||||
// Idk why there are no that placeholder in typelib
|
||||
$PhoshStatusPagePlaceholder content{
|
||||
visible: true;
|
||||
icon-name: "face-angel-symbolic";
|
||||
extra-widget: label;
|
||||
}
|
||||
|
||||
Label label{
|
||||
visible: true;
|
||||
label: _("Im' written in Vala!");
|
||||
}
|
||||
|
||||
|
||||
Button footer {
|
||||
visible: true;
|
||||
hexpand: true;
|
||||
clicked => $on_footer_clicked();
|
||||
|
||||
Label {
|
||||
visible: true;
|
||||
ellipsize: end;
|
||||
label: _("Open Plugin Settings");
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.24"/>
|
||||
<template class="ExtensionQuickSetting" parent="PhoshQuickSetting">
|
||||
<property name="status-icon">info</property>
|
||||
<property name="status-page">status_page</property>
|
||||
<signal name="clicked" handler="on_clicked" object="PhoshValaQuickSetting" swapped="yes"/>
|
||||
</template>
|
||||
<object class="PhoshStatusIcon" id="info">
|
||||
<property name="visible">1</property>
|
||||
<property name="pixel-size">16</property>
|
||||
</object>
|
||||
<object class="PhoshStatusPage" id="status_page">
|
||||
<property name="visible">1</property>
|
||||
<property name="title" translatable="yes">Quick Setting Example</property>
|
||||
<property name="content">placeholder</property>
|
||||
<property name="footer">footer</property>
|
||||
</object>
|
||||
<object class="PhoshStatusPagePlaceholder" id="placeholder">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-name">face-angel-symbolic</property>
|
||||
<property name="extra-widget">label</property>
|
||||
</object>
|
||||
<object class="GtkLabel" id="label">
|
||||
<property name="visible">1</property>
|
||||
<property name="label" translatable="yes">Im' written in Vala!</property>
|
||||
</object>
|
||||
<object class="GtkButton" id="footer">
|
||||
<property name="visible">1</property>
|
||||
<property name="hexpand">1</property>
|
||||
<signal name="clicked" handler="on_footer_clicked" object="PhoshValaQuickSetting" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">1</property>
|
||||
<property name="ellipsize">end</property>
|
||||
<property name="label" translatable="yes">Open Plugin Settings</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
|
@ -29,6 +29,10 @@ public class Extension.QuickSetting : Phosh.QuickSetting {
|
|||
set_active (!active);
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
private void on_footer_clicked (Gtk.Button btn) {
|
||||
}
|
||||
|
||||
construct {
|
||||
info.set_icon_name ("face-shutmouth-symbolic");
|
||||
info.set_info ("I'm Inactive");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue