Commit b681cee9 authored by Canek Peláez's avatar Canek Peláez
Browse files

application-window: Use gsettings and set selected font when invoking

the open() method.
parent 34453ba2
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -6,12 +6,21 @@ namespace Example {
        [GtkChild]
        [GtkChild]
        private Gtk.Stack stack;
        private Gtk.Stack stack;


        private GLib.Settings settings;

        public ApplicationWindow (Gtk.Application application) {
        public ApplicationWindow (Gtk.Application application) {
            GLib.Object (application: application);
            GLib.Object (application: application);

            settings = new GLib.Settings ("org.gtk.exampleapp");

            settings.bind ("transition", stack, "transition-type",
                           GLib.SettingsBindFlags.DEFAULT);
        }
        }


        public void open (GLib.File file) {
        public void open (GLib.File file) {
            var basename = file.get_basename ();
            var basename = file.get_basename ();
            var font_name = settings.get_string ("font");
            var font = Pango.FontDescription.from_string (font_name);


            var scrolled = new Gtk.ScrolledWindow (null, null);
            var scrolled = new Gtk.ScrolledWindow (null, null);
            scrolled.show ();
            scrolled.show ();
@@ -21,6 +30,7 @@ namespace Example {
            var view = new Gtk.TextView ();
            var view = new Gtk.TextView ();
            view.editable = false;
            view.editable = false;
            view.cursor_visible = false;
            view.cursor_visible = false;
            view.override_font (font);
            view.show ();
            view.show ();


            scrolled.add (view);
            scrolled.add (view);