|Published (Last):||14 May 2009|
|PDF File Size:||18.31 Mb|
|ePub File Size:||17.65 Mb|
|Price:||Free* [*Free Regsitration Required]|
The desktop file provides important information about the application to the desktop shell, such as its name, icon, D-Bus name, commandline to launch it, etc. Other files, such as Gtk::Builder ui files, are best loaded from resources stored in the application binary itself. In this chapter we'll build a simple application by starting from scratch, adding more and more pieces over time.
You can build each example separately by using make with the Makefile. When using Gtk::Application , the main function can be very simple. We just call Gio::Application::run on an instance of our application class. All the application logic is in the application class, which is a subclass of Gtk::Application. Our example does not yet have any interesting functionality. All it does is open a window when it is activated without arguments, and open the files it is given, if it is started with arguments.
Or rather, our application class tries to open the files, but our subclassed application window does not yet do what it's told to do. Gio::Application Reference.
Another important class that is part of the application support in gtkmm is Gtk::ApplicationWindow. It is typically subclassed as well.
Our subclass does not do anything yet, so we will just get an empty window. As part of the initial setup of our application, we also create an icon and a desktop file. Note that bindir in the desktop file needs to be replaced with the actual path to the binary before this desktop file can be used. This does not look very impressive yet, but our application is already presenting itself on the session bus, it has single-instance semantics, and it accepts files as commandline arguments.
Source Code. Building applications. A desktop file The desktop file provides important information about the application to the desktop shell, such as its name, icon, D-Bus name, commandline to launch it, etc. Other resources Other files, such as Gtk::Builder ui files, are best loaded from resources stored in the application binary itself. A trivial application.
Subscribe to RSS
gtkmm: gtkmm Reference Manual