Last active
June 5, 2018 09:21
-
-
Save multani/5747431 to your computer and use it in GitHub Desktop.
Test Gtk CSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test-c | |
test-vala |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: test-c test-vala | |
test-vala: test.vala | |
valac --pkg gtk+-3.0 $< -o $@ | |
test-c: test.c | |
gcc `pkg-config --cflags gtk+-3.0` -std=c99 -o test-c test.c `pkg-config --libs gtk+-3.0` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <gtk/gtk.h> | |
int main (int argc, char *argv[]) | |
{ | |
GtkCssProvider* provider; | |
GError* error; | |
const char* files[4];// = {"test1.css", "test2.css", "test3.css", "test4.css"}; | |
files[0] = "test1.css"; | |
files[1] = "test2.css"; | |
files[2] = "test3.css"; | |
files[3] = "test4.css"; | |
for (int i = 0; i < 4; i++) { | |
const char* file = files[i]; | |
printf("Loading %s\n", file); | |
provider = gtk_css_provider_new(); | |
gtk_css_provider_load_from_path(provider, (gchar*)file, &error); | |
} | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gi.repository import Gtk | |
def test(path): | |
print("Testing %s..." % path) | |
provider = Gtk.CssProvider() | |
try: | |
provider.load_from_path(path) | |
except Exception as e: | |
print("%s -> Failure: %s" % (path, str(e))) | |
else: | |
print("%s -> OK" % (path, )) | |
test('test1.css') | |
test('test2.css') | |
test('test3.css') | |
test('test4.css') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// valac --pkg gtk+-3.0 test.vala | |
using Gtk; | |
int main (string[] args) { | |
string[] files = {"test1.css", "test2.css", "test3.css", "test4.css"}; | |
foreach (var file in files) | |
{ | |
var provider = new Gtk.CssProvider(); | |
stdout.printf("Testing %s...\n", file); | |
try { | |
provider.load_from_path(file); | |
} catch (GLib.Error e) { | |
stdout.printf("%s -> Failure: %s\n", file, e.message); | |
continue; | |
} | |
stdout.printf("%s -> OK\n", file); | |
} | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GtkLabel.test { | |
font-size: 19; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GtkLabel.test { | |
font-size: 19px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GtkLabel.test { | |
font-size: 19.5; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GtkLabel.test { | |
font-size: 19.5px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment