hope you can all you me it's not that you know and peace to free
to interrupted anytimes and questions
so the topic is G T K propagation developers and
i've
but not us but it's an abstract that wasn't really clear on what i was
going to do so well actually sit down to write prepared this talk i figured
and i want to try and just show some examples of what's possible this project
a K and i hope i can convey these examples that it's actually it's really
easy not to build country style applications as we expect them to be that they
had about that's
nicely nice transitions and all that stuff that you see in blocks and rather than
and these applications
this is dedicated point and
but most of the building block so that are in place and
it doesn't take that much work to get something like that off the ground
and i will show that in the series of examples
then i had his nine steps
yesterday's on going to show nine example sell forget so the
and at the end i will have something that looks a bit like an application
just really limited but that's something
hopefully inspiring and i did not prepare a slide so this instead i decided i
want this material to be available for the longer term so i will call as
actually wanna but examples they all available in the did okay so three itself sometime
last week
and that extra rolled around it is it's all available in the G D K
A P I documentation you have a tutorial section there and you check that right
so you can look on it up online if you want
it's available that solve
last week
and we'll see how well it actually works for talk it's an experiment so let
me know if it doesn't work more than five to do something else
so but before we step into the examples maybe it's were stepping back a little
bit and ask what actually is an application we learned from that out yesterday
how we things an application to look at the star trek future it's all the
single bundle that you can just download and run it without installation it will be
very cool but that's not quite where we are today so as of today applications
that have a number of things that need to be spread around to five system
and i just put up the list the of the things that are they obviously
it's the application binary itself expected will use a bit
then applications need to have a testify that's pretty from the established that the show
can actually displayed nicely and it also needs and i can for that obviously
and then every nontrivial applications will have some settings and for that we need a
setting schema and then they might be just a miscellaneous other resources like you i
files and whatnot
which you would ordinarily also spatter on the five system
but we actually have resources nowadays if you pay attention to the examples to see
that we actually get to put all those other resources inside the binary itself so
that's all already a pretty good step towards the
single file application future
that we want to get to
and don't here i'll talk a little bit about all the stuff that i'm hoping
to touch on the examples
i'm not gonna we the whole list here you can see this stuff to go
to so let's get to it
in stockholm building up a vacation
so the first thing to know about they don't want to use jic application here
which is the application class that you can provide so that yes
yes i know i just wanted to have the idea one line main functions like
i was willing to like except that league
so let's not go to too much on that the one thing to take away
he is that the main function is really not ready action is it's just the
one line that the really just creates an instance of obligation class and then we
college application on it and to give at the command of parameters minutes it
not much else to that's all the all the logic of application and all the
ending of command line options and all that is happening in the application class
so one and a little bit us a very trivial application classes we do some
plastic application for that that's the intended way of using it
and we used to the usual G object want to pay for that we don't
really implement anything here yet
just december entry points to applications this for instance if you just run the application
all about them not giving it any arguments then we have an entry point it's
called active at a
which is what is called when you in then you just run it by itself
and i have a kind of trivial application at implementation of that here which just
creates a new window and then presented
the entry point that i have implemented years opening files
so if you run the application and give it file filenames on the command line
well colour different into point it's called open and that gets an array of files
and in this implementation here not much is happening we just
again we created i would know and then we call this
open function for each of the files and
magic might happen the functional not
and that's about it one thing to maybe briefly possible look at is
that creating an application
subclass you always want to have an application id that's kind important because that's really
very central concept in the board of the application you really want to have an
application id which is used as the last name and it seems just of ideally
you system in for the best of file and all those things so we need
a unique identifier for the implication
and that's this idea here
that's not a of this fairly trivial skeleton implementation is that just saw for that
at some places i created windows
and those and those are actually instances of this class example up a little
which is a subclass of G T K application bundle and
again this is an entirely empty imitation does nothing but than necessary scalable is a
so it's a question like the last slide would be one line and it's this
main what do you can tax you bind text domain is that handled for you
and you have to shine directly or should and i mean as well i only
glanced over that here but i guess you would have to do some setup work
for that and okay so you do that automatically there's no magic that's just a
matter don't know okay
maybe my dad that if you to i don't know that
so maybe things are changing that offer knowledgeable if you wanted internationalisation you have to
set that up
okay
last thing that i have in this initial example is that we also one and
i can attest of file up is the created some
model like i can dare think the game for five minutes
and
the decibel it after five years also very couple of i just put an ad
in the idea
just to cheat a little bit because i'm running one able runs that location in
a minute and i'm actually running it uninstalled so i have to actually catch to
like being here
to make that work
and we actually switch to
running his example
should also take first
this is inside the G T K so it is an examples directory and if
you look and that
this nine subdirectories which contain examples and i'm going to here
and right now i'm stepping into the first one
and it's already component are running it
who this my educational it's not very exciting admittedly
doesn't really contain anything it doesn't even will the title
but
notice that the channel already picks up the it has some five
and find see i can we just because i she did a little bit and
put the i can in the whole local share i can somewhere and up to
justify there's also just that this works you
and realised of course it's all these files and user share somewhere
have it worked that way
so it's not very impressive but admittedly we didn't write much good either and
well there's not much to see this already
it's a football geolocation which has a presence on the bus a single instance
characteristics
and it technically also kind of file so right now i just activated that are
running it without arguments but it could give it a
an argument like this
well nothing else happens because we'd have implemented the open function yet but at least
it accepts the adamant
and things are set up for the next
so step to is
this winter was twenty so yes
it's annoying isn't
so they're not here
and then for that
okay so i'm next that is still
get some content and the window so that we are using something that if you
went to just on stock just before lunch you probably talked about ten that's
maybe you didn't did you
okay so we're using complex this is all just on that in the last year
or two and it finally landed in G T K
so what's attempted is likely you i follicles want to use to editing that's great
operating late
and
just like that you can see the beginning of the file
the my main difference between that and the directional you i find is that attempted
actually define say it complex which is like a container with internal structure
and you can use clay for populating that instead of having to manually writing in
that function that that's G T K contain i had of this G T K
box next out of that and handily really write a lot of code for populating
your constructed your complex you are you can one adding like know which is really
pretty nice
and so he is our initial and that
you can see we have a defining the example happen a class that i showed
earlier
maybe just pack a few things in the first of all we set some useful
properties like to be no title and the people size
maybe put in the box and they have the populate the box that i had
about a stack
you can stick and didn't and inside the had about we have a stack switching
and i see these which it and actually in a minute
but first able to stop briefly and show how we actually get to use this
template so now we just click on the set
you i file
and
to make use of it for actually defining application middle class we because a function
called G T K widget class set template from resource
which finds this templates
to our
or subclass
and i talk about the results that in a minute bottom that's the first step
the other step is that then we actually instantiate this class integrated application the know
in the in a function for that we have to called you can project in
the template actually use the template and populate our instance
it's a two steps for using attempted
and i touched on that earlier be using resources
and
that means that we actually take this window dot U I for the to the
national italian fee turn it into a
resource hundred happy then link into our education binary
that's done using the tool called
gina compile resources and do the proper resources takes
it's input like we tell it what actually to compile into that resource bundle by
but in this little excellence that up there
and i'm not gonna get too much into it if you want to really look
into that you can check out examples
in the repository that's all hooked up with the makefile you can see actually running
looking let me switch back to actually running this example now
so we are stop to
and i'm running it again
but
as you can see the windows not entirely empty at this point you have
obviously we have the window title and if you if you look at the top
of them and you can kind of see the and you had about their which
it's not really prominent of the that's gonna get populated in the next steps
well no this is just basis for the work
okay so that's me is
we want to actually populate the speculated that we put in place an ultimate upon
that out and we want to
i to act what you know if you can are already passed financial the command
line so the next have a step we actually want to open these files and
children
for that
because if you know features that want to mention
all example brno class now case a private start
you can see to find out there that contains just one on i'm not currently
this stack pointer there
and there's a new way actually just change recently you the way it used to
be for private starts that you use to call
G type class at try that in your class in a function and we turned
that around to cycle and we actually made that more declarative so now the new
way of doing this is that you use G define typhus private and that that's
automatically on seems
we don't have to do anything anymore in your class function for this
and it is that you can do something else in your class in a function
which is
well you can use
this somewhat magic thing here called G T K widget last
find template right private that's quite a most well i think that's the content of
a long as function name and G T K
i couldn't really how it need to be that long to fit all the naming
patterns and everything else so what does this do
just for the should things behind the scene so we give it the example happened
or name
and we give it a name of variables that there and
what's happening behind the scene is that this instructs you to create a
because to use the private various function it knows that it actually is supposed to
look in the private struck that's also associated press example happen all so example up
in the private
and
should look for this stack member in it
and it showed populate definitely
that which it from the template that escorts that
so this is one of the magic not at actual this that when we get
to a instance and it function we can rely on the fact that the
the staff member in our private structures is pointing to the better that we want
to point to
so there's not a lot of hassle manually look and also
i don't know that's a question from under
okay so this was just preparatory work for actually
doing some actual logic here i'm not gonna explain this in detail
this is the code to create a store dwindle great attacks to inside it and
open the file that was passed as an argument
and populate the text to with the contents of that file
one thing that's worth pointing out us some venom at all this a line the
record it a stack at titled
that is very actually at the
this more brno S A H in our state so to speak
and
we give it very unique identifier for that we just use the basin of the
file and then there's another argument which is
did a display title to actually show in the you know i will see that
the be obvious one so run it
and the other one thing i want to say about that is that the display
type is obviously going to be displayed but this text which i would just the
rolls of caps
but we don't have to touch this text which at all you because
this text which are just getting all this data needs to know how many types
display able to show and then by looking at the at the stack that is
associated with
so the problem
so i'm switching back to running as well
well that's magic now we actually have contended it looks like a real application of
so let me make is a little bit and actually given files
i don't know that's a question for the design as i think i mean i
think about available for this case
and
i would i'm sure the designers would do time we often find something wrong about
it works so
good things to say it is that you see this text which are now that's
the like the two buttons updated
those get created but it's text which are
and you know the
the content of the file at U C obviously council
from the function i just showed you and we can
actually switch between them and it works so that that's you can stack and you
can stick switcher
connection
i just keep moving on is this questions feel free to interrupt me at any
time
next this we want to resolve a little more that an application menu i don't
need to say too much evolved modification men us and how it works
well dive right into how you do this
and also get specified by educator that you iphone
like this one here
and i don't think i should say too much and details about the syntax you
can see that we actually created menu element which is a menu not surprisingly and
they can be sections in there
and items and the items have
a couple of at a good see a we set a label which is what's
gonna going to shop in the U I
and then we have an action for each item
which is what's going to get activated and you have to check on that menu
item
and actually used is you i for an obligation we need to call G T
K application setup menu
and a good place to do that is in the startup before
of your energy application
i mentioned earlier that you application as a number of different entry points like it
has an active right does it open or you could activated by directly calling in
action
and how you activated how you started there's always a startup different that it gets
caught no matter what
so that's a good place to do things that you want to happen in all
the cases
because if you have to actually
get a lot
you are funded i just so
and then we
well you get the menu model
that the data constructed format and we called you get jic application setup menu
which does all the work behind the scenes just this puts us stuff on the
bus on the session but also the show picks it up from there so that's
a lot of things that are happening behind the scenes of that's right
right i did not really get into the difference between finer primary and secondary instance
but you're so right points out that G application as this concept of single instance
which are briefly mentioned earlier and that means there's a primary instance which is actually
fourty flash running application and if you start again on the command line it's not
gonna open set second binary but just
talk to the primary instance
and the startup function i said it gets run no matter what it only gets
run in the province but if you're if you're starting at or second time and
doesn't actually launch something them started with not
okay that's a fair point
going back to this i said earlier in a financial to you have a if
you to be mention applications like each item as an associated action
and so we need to somehow bring these actions into
into being and that's what what's happening actually four lines up here
we call a function called G action map at actually entries
which is
also a lot of work that's happening by the scenes that school of a little
bit
you can actually see the add entries irate if you pass in there
this looks very similar to what we what we have and how to indicate for
the longest time which is a G T K action entry every
and this is just basically the same kind of idea translated into G action sort
of detection
so we are creating to actions one is as the name preferences minus on this
and it could
just a student to do that you saw the U I five before
and we have you be also specify the activate callbacks you like could activated it's
called in the collection is activated preferences activated escort
when preferences you preference actions activated
that's actually try that out
so not to step for
that you have to have an
vision and you know yes it's there so the shell has successfully picked up
menu the other people on the bus
and that S which it shows of the preferences and could menu item
no one click on preferences
nothing happens that's because the preferences activity function that i just is percent these of
us nothing
exciting is going on but it is fully functional
just works and a little bit want to show that
you may not more may not what is it but for the for the could
i don't actually specified a keyboard accelerator people talk out in the U I for
the expected one controlled you
and when i had control to here
also works or that is already hooked up
and the next that will be to make the preferences menu item actually something
well that i'm moving on to the next step
which is
soon so how preferences work
and
we want our preferences obviously to be remembered from one run of the application for
the next are we gonna use G settings to number them
and for using G settings the first step is always to that you need a
schema for a settings
which is another type of X M L file actually here
is fairly minimal scheme are just system to settings and it the one is
a font the unless a transition time
there's some magic that you need to do some magic intent incantations that you need
to do to make it make use of the scheme or you have to compile
it but you have to like
installed icexml from the right location and then you call gina comply schemas to
it's gotta be have some autoconf
macros to make that
the little easier if you're using all the tools
so i'm not gonna dive into the details of how to do that let's just
assume
that we can figure that out
and so now we have a disk in that case
which means you can actually now use our settings and for that
we need to quality settings new to obtain an instance of our settings
object
and
the next thing we do is we use a very convenient functionality of T settings
which is finding
so we have this settings here actually earlier which is about the other which was
called transition
and we just find that too
remember pressed accuracy
it's a pointer that points to the do you can stack which is that we
have in our window somewhere
and the do you can stack it's a property that's called transition type
and i would just by deciding to the
to the property
and that's all we need to do to make the reject reactor the changes of
the setting
there's some educated and i'm not gonna get into right now
it's even better than
then i'm telling
so let's
let's see if i can actually because
so remember we don't have a preference dialogue get that we have hooked up to
setting service
going to see and if i can actually
prove to you that if i don't change the settings
on the command line using the G settings commitment to
i hope that something is
as i mean i was gonna less impressive that wanted because the window was hidden
but you can see that the
the application actually picked up my phone so strange before was one space to open
autumn especially
but obviously using the command line for these kind of changes it's not ideal so
we want to
a preference dialogue so that that's move on and constructive
obviously be we use all the same things that we've already used to be again
right attempted five for this dialogue this time it's a
it's a subclass of you could dialogue can see appear
and i'm not gonna go to listen detail but you can see that we populated
that they
some labels and the data from that they're gonna use for the phone probably obviously
and the little further down
is a combo box that using for the this transition property which is three possible
values
and i'm specifying them right in the in the template
and then
you obviously a great a subclass of ticket dialogue for this
using the standard
so there's all the same one i played and i showed you for our occasional
you find type of private that business
and we do the same tended finding that we did for vacation and when this
time you do it for a preference dialogue
we again obtain an instance of our settings you
percent X
and again we use the settings finding functionality combine
or settings this time to bite into the controls we have in the dialogue actually
the changing
so for the for the font setting the use the
the functional
and for the position settings use this combo box
i didn't actually pointed out that the name of that budget in the time that
five was position
and
there's a lot more part of it here
on think we still have to do is
we created this preferences activated callback for the action but it was empty so we
know need to go back to it and
make it actually created you instance of a preference dialogue and present that
and
so let's go back and see how that looks
you can see of all font settings change from last one got remembered across to
be stuff
and
no tricking preferences again and a test our preference that'll and it has the things
that i pointed out earlier in the that so there's a one choose a
chose the value that we just sat in the on the command line
and that's the combo box for the transition
just gonna briefly pause and show what it actually does
change the slide
and if i know change taps here
actually any mates so this is a new feature indicates that
as opposed to the old do you can notebook
you can actually do nice animated transitions here the other one that i have it
here in the preference dialogue i'm gonna show that as well as the cross fade
so for change to that then
you can kind of see the cross fade happening here
so that's a nice new feature of you can stack which is made possible by
all the frame based drawing like that owned it the last year
okay well known
this application starting to look like an application that's fairly minimal so will add a
few more bits of functionality here
the next that is very common and don't see application research that's obviously very central
so i want to show how to make be
research entry here that looks somewhat similar to what we have another one applications
product we the use do you can search entry which is just a subclass of
do you can feel it has a bit of extra functionality
to make a certain like basically a button and it has see extra signal that
kind of patches the changes things like that and then we used to do concerts
but i would just and you a budget
which lets you
place such country and maybe some other divided you might need and content in relation
to that
in inside a
toolbar model stick and slide in from the top
let's see how we actually use those
so they go back to our
have that for application than or
and the and if you extra things
right we had a probable so they had a bar
the be much easier to see that men i run the application and i'm just
pointing out how this looks and they
covered
and
no further down
between the had about the stack you know put a search by
the search but contains a search entry
and
what we also do here is
we hook up this segment of for the search changed signal of the searching for
you might you know that have that right so we don't have too many legal
ninety six not connect to know
so once again this reduces
the amount of menu cool to have to be produced
and obviously implementing search actually takes quite a bit of work i'm not gonna go
to that in detail here but i just wanted to
if you show that there see the main did to be for this work us
having a second like he has touched exchange which gets called
whenever you talk a new character in your surgery
and then we would do magic was text you just to find the first match
for that you know text
and
one vector
like a couple again
so it is well you can see the
there's of like on is that all the button that i mentioned
if i click that's
so sparse lights in the such entry
and i can type something like
so just
that's kinda need
escape i think
okay
so
that's already pretty good
but you can at the present a little more functionality you before but i'm not
so
think it's a step eight of nine so i might actually gets too much steps
supposed to learn that
sidebar
i really have to like wracked my brain to come up is some example that
lets me put in as many of the new but just as possible so i
cannot this let me let me know that that's totally ridiculous but at least it
gets the don't drop down definitional do you can menu button did you can reveal
and you can just box set
so once again we
go back into our tempted
and we are just sort you that we added top to bottom
we know at a menu button next to that that's down here you can menu
button
and then going for the down
and maybe used to have the G T K stack
we know
wrap that inside you get box and
put a
a little extra
before it is actually i was audible so we put something left
which is a G T K with you know that contains a list box in
the school window
and
it's a little more xml here to show
i said that i put a menu button there i didn't actually tell you where
the menus coming from that's yet another
the U I for that actually here
which is really virtually identical to the syntax of the one that i showed you
polyak menu it's just another
you i five to be find a gym anymore
in this case i just put a single item in there right now
just a label words and they know the action here words
and obviously i need to tell you where that actually comes from
so we go back to this is actually to go back you can
i so i called action show works but actually the U I five says when
dot show words
the window hottest this goebbels the action so the actions we saw before for the
application manoeuvre applications goal actions which we defined in
in the startup function of the application
but there can also be we know school actions
and the can i mention here is that you refer to those by putting went
off as the prefix the name
and obviously in brno school action should not be defined in the G application startup
function but it should be specific to the rental so we at that action in
the in the function of our example than a class
and the last three lines that actually but it happens
in this case we use a settings actually
which is a neat little this integrate to take one of audio settings
in this case it's setting called sure words and just wrap actually and actually wanted
and
activating the action will have that we change the value of the setting
this case the setting this is leon and
the settings action who just probably and every time you activated
that's a very convenient way to make settings available to the you live in the
form of actions
and but that i'm switching back to show you know that looks
okay so
next a lot of the button up there
is to get something you know
menu button
click connect
is the menu item that i just
mystified
and if i actually
product
decide partials up and you saw that it actually slides and that's what the really
knows doing it cannot that's the animated
reveal
and inside they really lazy
in this box here this block so i could can spend an entire talked us
talking about do you can this box and what that's about it doesn't do but
it is essentially it's just a container that is
it's meant to contain lots of digits and it has
functionality that you normally associate with the but that review like it can filter can
consult the items that are contained in it
but the to the defining difference between this and the triggers that
it shows actually is that which it it's not a seven day which is kind
of a different layout model so this is nice if you want to have a
list
but you want to have actual july and it's not necessarily just data-driven
giant data is
and since i have to come up to something for this example adjust
created buttons one button for each button my text and if i click on one
of those buttons
research again so this december
make this example but meaningful
right
and i just saw the movie to hide itself again
so we don't
almost and this is the last step
but i've been about them of this like first it had only it's that's actually
and then ryan came back to me and said okay just reason like probably actions
because that's need to so i went back and i racked my brain a little
more and try to come up with some way of showing property actions
so what what's that about
which is all and a topic so if you have lots of useful properties and
it's a it's a said earlier these settings action but it just showed it's a
very convenient way to make settings accessible to do you want to from corrections
and there similarly G property action does the same thing for properties of widget object
and
we'll see how that works
so i'm not going in all the details here but just explaining what what's happening
here we have seen to have to go back to our camp that again and
be i'm adding a two labels
pulled out of our
the names are lines label lines actually get again just talk about it and then
we go to our
the U I for it defines the geeky a menu
and be out at the second item there
the name lines and
but they are the new action show lines
which now would be a property action
so i have to show you know that is done
and again it's done in the in a function of all in the class and
it is the first line there's
G property actually you so we specify the name show lines and then we
we use the lines object
and you probably expect by now that pretty lines is another
point a very banal prime instructed gets magically populated finally
gee wouldn't you can window class pine temperature a lot well
so that's for that one little that we just added
and use the visible property of the label and we have another boolean target actually
here
and
yet another thing that i squeezed in this last that is that
but only can be do that but we can also
use
object binding here logistic in a nice way to basically connect properties of different objects
and keep them and so
so that's what we're using here to assess at the at to labels but we
always want them to become visible invisible together so we can adjust we use do
you object buying property to just connect the visible property of these two widgets
so when i when i show the first one the second one automatically get shown
as well
let me show you look something about it yes
okay so
rest of them here's our new menu item lines i just quit that
metropolis
to label simply here
and show you the code for actually counting the lines the text
as well that that's interesting to taps
it actually a baseline count you
and if i top and the property again
most of them disappeared the same time because that was the properties are all together
and
that was the last step so i'm actually
and on the my samples
i'll be and what that and if you have any questions free to ask
thanks to take a break from this i hope are but it's actually really not
hard automatic norm three style vacation using
bits and pieces that are available in typically master now so it's tickets we can
all of this would be
would be at your disposal and
actually did a line count you on the last step you that most complete example
that i have comes onto some five hundred lines of C code and some two
hundred lines of you across
so that's not too bad considering it see
no i that i used to be a for this
but i hope late what we have to it as well that's just
yes
can repeat the question mark
okay
yes this first of all as i said earlier these examples including all the makefile
integration everything is available the G T K source tree so you can go then
local actually that this that's make for the yams
there's also a various documentation for instance the i pointed out at some point is
that we should some macros in G I L actually for the for the schema
compilation part and there's a link that's of the G I O documentation but that's
explain
and
maybe have documentation for some for the resource part of so an actual about that
okay so some of this might not be wrapped a nice macros
but some of it is and for the parts that are there should be documentation
somewhere inside the G I O documentation but that's not necessarily easy to find so
i try to put links to that in this
right that's a that's a good exactly actually
so there's a there's a nice you way of writing documentation hold how do i
that wind kicked off and this drumming
drumming for which
that that's available i think it's a one about resources maybe not yet but
we should make one available
so there's more questions or nothing i want to say is that this is the
location where you can actually find all of all of this online this is the
D A P I documentation where
that i just wanted to other point out that i found a few box and
in the documentation gonna bend over this last night so but i showed you was
my local fixed build and that will be all our online but the next you
can release
and this is a the G T K sources and you can see the night
subdirectories where i ran
these examples
thank you next time
and questions
okay thank you