Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit 0c24532

Browse files
author
Bart Zaalberg
committed
Added css support and fixed background on form page
1 parent 00493d6 commit 0c24532

File tree

6 files changed

+31
-2
lines changed

6 files changed

+31
-2
lines changed

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@
102102
vte-2.91
103103
)
104104

105-
# tell cmake what to call the executable we just made
106-
add_executable(${EXEC_NAME} ${VALA_C})
105+
include (GResource)
106+
glib_compile_resources (GLIB_RESOURCES_ICONS SOURCE /data/icons/icons.gresource.xml)
107+
108+
# tell cmake what to call the executable we just made and install
109+
add_executable(${EXEC_NAME} ${VALA_C} ${GLIB_RESOURCES_ICONS})
107110

108111
#------------------------------------------------------------------------------------------
109112

data/application.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.stack-manager {
2+
background-color: #FFF;
3+
}
4+
5+
.form-component {
6+
background-color: #FFF;
7+
}

data/icons/icons.gresource.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<gresources>
3+
<gresource prefix="/com/github/bartzaalberg/bookmark-manager">
4+
<file alias="application.css" compressed="true">../application.css</file>
5+
</gresource>
6+
</gresources>
7+

src/Components/BookmarkForm.vala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public class BookmarkForm : Gtk.Grid{
1515

1616
public BookmarkForm(){
1717

18+
get_style_context().add_class("form-component");
19+
1820
var nicknameLabel = new BookmarkFormLabel (_("Nickname:"));
1921
var hostLabel = new BookmarkFormLabel (_("Host:*"));
2022
var hostNameLabel = new BookmarkFormLabel (_("Host name:*"));

src/MainWindow.vala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ public class MainWindow : Gtk.Window{
1010
private HeaderBar headerBar = HeaderBar.get_instance();
1111

1212
construct {
13+
14+
loadGresources();
15+
1316
if(settings.get_string ("sshname") == ""){
1417
settings.set_string ("sshname", Environment.get_user_name ());
1518
}
@@ -27,6 +30,12 @@ public class MainWindow : Gtk.Window{
2730
addShortcuts();
2831
}
2932

33+
private void loadGresources(){
34+
var provider = new Gtk.CssProvider ();
35+
provider.load_from_resource ("/com/github/bartzaalberg/bookmark-manager/application.css");
36+
Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
37+
}
38+
3039
private void addShortcuts(){
3140
key_press_event.connect ((e) => {
3241
switch (e.keyval) {

src/StackManager.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class StackManager : Object {
1919
// Private constructor
2020
StackManager() {
2121
stack = new Gtk.Stack ();
22+
stack.get_style_context().add_class("stack-manager");
2223
stack.transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT;
2324
}
2425

0 commit comments

Comments
 (0)