Skip to content

Instantly share code, notes, and snippets.

View benwaffle's full-sized avatar
🍝
best spaghetti in town

Ben Iofel benwaffle

🍝
best spaghetti in town
View GitHub Profile
class App : Gtk.Application {
public override void activate () {
var win = new Gtk.ApplicationWindow (this);
var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
var bar = new Gtk.ProgressBar ();
var scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 1, 0.0001);
scale.value_changed.connect (() => bar.fraction = scale.get_value ());
class App : Gtk.Application {
public override void activate () {
var win = new Gtk.ApplicationWindow (this);
var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
var label = new Gtk.Label ("");
label.attributes = new Pango.AttrList ();
var scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 1, 0.01);
scale.value_changed.connect (() => {
class App : Gtk.Application {
public override void activate () {
var win = new Gtk.ApplicationWindow (this);
var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
var button1 = new Gtk.ToggleButton.with_label ("AM");
var button2 = new Gtk.ToggleButton.with_label ("PM");
box.get_style_context ().add_class ("linked");
[Plugin]
Module=meson_plugin
Loader=python3
Name=Meson
Description=Provides integration with the Meson build system
Authors=
Copyright=Copyright © 2015
Builtin=true
Hidden=true
@benwaffle
benwaffle / anim.vala
Created August 24, 2015 02:37
animations
using Gtk;
class App : Gtk.Application {
static Revealer mk (uint duration, RevealerTransitionType type) {
var r = new Revealer ();
r.transition_duration = duration;
r.transition_type = type;
return r;
}
function deepEqual(a, b) {
if (a === b) return true;
if (typeof a != typeof b) return false;
if (a === null || b === null) return false;
if (typeof a == 'object' && typeof b == 'object') {
for (var x in a)
if (!(x in b) || !deepEqual(a[x], b[x]))
return false;
return true;
}
using Gtk;
class App : Gtk.Application {
private void show_popover (Button b) {
var pop = new Popover (b);
pop.set_modal (false);
pop.set_position (PositionType.BOTTOM);
var fixed = new Fixed ();
var b2 = new LinkButton (b.label);
b2.clicked.connect (show_popover);
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
void walk_tree(Display *display, Window win, int depth)
// GIO demo
#include <libsoup/soup.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
typedef struct {
char buf[1024];
gsize bytes;
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.19.0 -->
<interface>
<requires lib="gtk+" version="3.16"/>
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<signal name="delete-event" handler="gtk_main_quit" swapped="no"/>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>