Skip to content

Instantly share code, notes, and snippets.

@rmacqueen
Created March 25, 2015 19:59
Show Gist options
  • Save rmacqueen/aa68c0920f60baaa2956 to your computer and use it in GitHub Desktop.
Save rmacqueen/aa68c0920f60baaa2956 to your computer and use it in GitHub Desktop.
const Gtk = imports.gi.Gtk;
const Pango = imports.gi.Pango;
Gtk.init(null);
let text = " Mon: ကျာ် လ္ဂုၚ်.";
let label = new Gtk.Label({
ellipsize: Pango.EllipsizeMode.END,
lines: 2,
max_width_chars: 10,
label: text,
});
let mwindow = new Gtk.Window({
default_width: 600,
default_height: 400
});
mwindow.add(label);
mwindow.show_all();
mwindow.connect('destroy', function() { Gtk.main_quit() });
Gtk.main();
@ptomato
Copy link

ptomato commented Mar 25, 2015

This also segfaults:

#include <gtk/gtk.h>
#include <pango/pango.h>

int
main (int argc, char **argv)
{
    gtk_init (&argc, &argv);

    GtkWidget *label = g_object_new (GTK_TYPE_LABEL,
        "ellipsize", PANGO_ELLIPSIZE_END,
        "lines", 2,
        "max-width-chars", 10, 
        "label", " Mon: ကျာ လ္ဂုၚ်.",
        NULL);
    GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_container_add (GTK_CONTAINER (window), label);
    gtk_widget_show_all (window);
    g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
    gtk_main (); 

    return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment