|
Packit |
1470ea |
|
|
Packit |
1470ea |
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" xmlns:xi="http://www.w3.org/2001/XInclude" type="guide" style="task" id="menubar.c" xml:lang="fr">
|
|
Packit |
1470ea |
<info>
|
|
Packit |
1470ea |
<title type="text">MenuBar (C)</title>
|
|
Packit |
1470ea |
<link type="guide" xref="c#menu-combo-toolbar"/>
|
|
Packit |
1470ea |
<link type="seealso" xref="aboutdialog.c"/>
|
|
Packit |
1470ea |
<link type="seealso" xref="gmenu.c"/>
|
|
Packit |
1470ea |
<revision version="0.2" date="2012-08-19" status="draft"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<credit type="author copyright">
|
|
Packit |
1470ea |
<name>Monica Kochofar</name>
|
|
Packit |
1470ea |
<email its:translate="no">monicakochofar@gmail.com</email>
|
|
Packit |
1470ea |
<years>2012</years>
|
|
Packit |
1470ea |
</credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<desc>Un composant graphique qui contient des éléments graphiques GtkMenuItem</desc>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Luc Rebert,</mal:name>
|
|
Packit |
1470ea |
<mal:email>traduc@rebert.name</mal:email>
|
|
Packit |
1470ea |
<mal:years>2011</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Alain Lojewski,</mal:name>
|
|
Packit |
1470ea |
<mal:email>allomervan@gmail.com</mal:email>
|
|
Packit |
1470ea |
<mal:years>2011-2012</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Luc Pionchon</mal:name>
|
|
Packit |
1470ea |
<mal:email>pionchon.luc@gmail.com</mal:email>
|
|
Packit |
1470ea |
<mal:years>2011</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Bruno Brouard</mal:name>
|
|
Packit |
1470ea |
<mal:email>annoa.b@gmail.com</mal:email>
|
|
Packit |
1470ea |
<mal:years>2011-12</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Luis Menina</mal:name>
|
|
Packit |
1470ea |
<mal:email>liberforce@freeside.fr</mal:email>
|
|
Packit |
1470ea |
<mal:years>2014</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
</info>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<title>BarreDeMenu</title>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<media type="image" mime="image/png" src="media/menubar.png"/>
|
|
Packit |
1470ea |
Une BarreDeMenu créée avec XML et GtkBuilder.
|
|
Packit |
1470ea |
<note>
|
|
Packit |
1470ea |
For a more in-depth look at this sample, please do not hesitate to check out the <link xref="menubar.vala">Vala MenuBar</link> and/or
|
|
Packit |
1470ea |
<link xref="menubar.py">Python MenuBar</link> tutorials.
|
|
Packit |
1470ea |
</note>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
#include <gtk/gtk.h>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Callback function for the "copy" action */
|
|
Packit |
1470ea |
static void
|
|
Packit |
1470ea |
copy_callback (GSimpleAction *simple,
|
|
Packit |
1470ea |
GVariant *parameter,
|
|
Packit |
1470ea |
gpointer user_data)
|
|
Packit |
1470ea |
{
|
|
Packit |
1470ea |
g_print ("\"Copy\" activated\n");
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Callback function for the "paste" action */
|
|
Packit |
1470ea |
static void
|
|
Packit |
1470ea |
paste_callback (GSimpleAction *simple,
|
|
Packit |
1470ea |
GVariant *parameter,
|
|
Packit |
1470ea |
gpointer user_data)
|
|
Packit |
1470ea |
{
|
|
Packit |
1470ea |
g_print ("\"Paste\" activated\n");
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Callback function for the "shape" action */
|
|
Packit |
1470ea |
static void
|
|
Packit |
1470ea |
shape_callback (GSimpleAction *simple,
|
|
Packit |
1470ea |
GVariant *parameter,
|
|
Packit |
1470ea |
gpointer user_data)
|
|
Packit |
1470ea |
{
|
|
Packit |
1470ea |
/* We first gather the value of the GVariant instance with a string type.
|
|
Packit |
1470ea |
* The overall goal here is to see if shape is set to line, triangle, etc,
|
|
Packit |
1470ea |
* and put that value within the variable "answer".
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
const gchar *answer = g_variant_get_string (parameter, NULL);
|
|
Packit |
1470ea |
g_printf ("Shape is set to %s.\n", answer);
|
|
Packit |
1470ea |
/* Note that we set the state of the action */
|
|
Packit |
1470ea |
g_simple_action_set_state (simple, parameter);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Callback function in which closes the about_dialog created below */
|
|
Packit |
1470ea |
static void
|
|
Packit |
1470ea |
on_close (GtkDialog *dialog,
|
|
Packit |
1470ea |
gint response_id,
|
|
Packit |
1470ea |
gpointer user_data)
|
|
Packit |
1470ea |
{
|
|
Packit |
1470ea |
gtk_widget_destroy (GTK_WIDGET (dialog));
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Callback function for the about action (see aboutdialog.c example) */
|
|
Packit |
1470ea |
static void
|
|
Packit |
1470ea |
about_callback (GSimpleAction *simple,
|
|
Packit |
1470ea |
GVariant *parameter,
|
|
Packit |
1470ea |
gpointer user_data)
|
|
Packit |
1470ea |
{
|
|
Packit |
1470ea |
GtkWidget *about_dialog;
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
about_dialog = gtk_about_dialog_new ();
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
const gchar *authors[] = {"GNOME Documentation Team", NULL};
|
|
Packit |
1470ea |
const gchar *documenters[] = {"GNOME Documentation Team", NULL};
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Fill in the about_dialog with the desired information */
|
|
Packit |
1470ea |
gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG (about_dialog), "AboutDialog Example");
|
|
Packit |
1470ea |
gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (about_dialog), "Copyright \xc2\xa9 2012 GNOME Documentation Team");
|
|
Packit |
1470ea |
gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (about_dialog), authors);
|
|
Packit |
1470ea |
gtk_about_dialog_set_documenters (GTK_ABOUT_DIALOG (about_dialog), documenters);
|
|
Packit |
1470ea |
gtk_about_dialog_set_website_label (GTK_ABOUT_DIALOG (about_dialog), "GNOME Developer Website");
|
|
Packit |
1470ea |
gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (about_dialog), "http://developer.gnome.org");
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* The "response" signal is emitted when the dialog receives a delete event,
|
|
Packit |
1470ea |
* therefore we connect that signal to the on_close callback function
|
|
Packit |
1470ea |
* created above.
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
g_signal_connect (GTK_DIALOG (about_dialog), "response",
|
|
Packit |
1470ea |
G_CALLBACK (on_close), NULL);
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Show the about dialog */
|
|
Packit |
1470ea |
gtk_widget_show (about_dialog);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
static void
|
|
Packit |
1470ea |
activate (GtkApplication *app,
|
|
Packit |
1470ea |
gpointer user_data)
|
|
Packit |
1470ea |
{
|
|
Packit |
1470ea |
GtkWidget *window;
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
GSimpleAction *copy_action;
|
|
Packit |
1470ea |
GSimpleAction *paste_action;
|
|
Packit |
1470ea |
GSimpleAction *shape_action;
|
|
Packit |
1470ea |
GSimpleAction *about_action;
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Create a window with a title and a default size */
|
|
Packit |
1470ea |
window = gtk_application_window_new (app);
|
|
Packit |
1470ea |
gtk_window_set_title (GTK_WINDOW (window), "MenuBar Example");
|
|
Packit |
1470ea |
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Begin creating the "copy" action.
|
|
Packit |
1470ea |
* Note that it is an action without a state.
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
copy_action = g_simple_action_new ("copy", NULL);
|
|
Packit |
1470ea |
/* Connected to a callback function */
|
|
Packit |
1470ea |
g_signal_connect (copy_action, "activate", G_CALLBACK (copy_callback),
|
|
Packit |
1470ea |
GTK_WINDOW (window));
|
|
Packit |
1470ea |
/* Added to the window */
|
|
Packit |
1470ea |
g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (copy_action));
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Begin creating the "paste" action.
|
|
Packit |
1470ea |
* Note that it is an action without a state.
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
paste_action = g_simple_action_new ("paste", NULL);
|
|
Packit |
1470ea |
/* Connect the action to a callback function */
|
|
Packit |
1470ea |
g_signal_connect (paste_action, "activate", G_CALLBACK (paste_callback),
|
|
Packit |
1470ea |
GTK_WINDOW (window));
|
|
Packit |
1470ea |
/* Add it to the window */
|
|
Packit |
1470ea |
g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (paste_action));
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Begin creating the "shape" action.
|
|
Packit |
1470ea |
* Note that it is an action with a state.
|
|
Packit |
1470ea |
* First we state that the parameter type of the simple action is a string.
|
|
Packit |
1470ea |
* When using g_variant_type_new, it is appropriate to free the return value
|
|
Packit |
1470ea |
* once you're done with it.
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
GVariantType *type_string = g_variant_type_new ("s");
|
|
Packit |
1470ea |
/* parameters for the g_simple_action_new_stateful are: (name, parameter type,
|
|
Packit |
1470ea |
* initial state).
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
shape_action = g_simple_action_new_stateful ("shape", type_string,
|
|
Packit |
1470ea |
g_variant_new_string ("line"));
|
|
Packit |
1470ea |
/* Connect the action to a callback function */
|
|
Packit |
1470ea |
g_signal_connect (shape_action, "activate", G_CALLBACK (shape_callback),
|
|
Packit |
1470ea |
GTK_WINDOW (window));
|
|
Packit |
1470ea |
/* Add it to the window */
|
|
Packit |
1470ea |
g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (shape_action));
|
|
Packit |
1470ea |
g_variant_type_free (type_string);
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Begin creating the "about" action.
|
|
Packit |
1470ea |
* Note that it is an action without a state.
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
about_action = g_simple_action_new ("about", NULL);
|
|
Packit |
1470ea |
/* Connect the action to a callback function */
|
|
Packit |
1470ea |
g_signal_connect (about_action, "activate", G_CALLBACK (about_callback),
|
|
Packit |
1470ea |
GTK_WINDOW (window));
|
|
Packit |
1470ea |
/* Add it to the window */
|
|
Packit |
1470ea |
g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (about_action));
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
gtk_widget_show_all (window);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Callback function for the "new" action */
|
|
Packit |
1470ea |
static void
|
|
Packit |
1470ea |
new_callback (GSimpleAction *simple,
|
|
Packit |
1470ea |
GVariant *parameter,
|
|
Packit |
1470ea |
gpointer user_data)
|
|
Packit |
1470ea |
{
|
|
Packit |
1470ea |
g_print ("You clicked \"New\"\n");
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Callback function for the "quit" action */
|
|
Packit |
1470ea |
static void
|
|
Packit |
1470ea |
quit_callback (GSimpleAction *simple,
|
|
Packit |
1470ea |
GVariant *parameter,
|
|
Packit |
1470ea |
gpointer user_data)
|
|
Packit |
1470ea |
{
|
|
Packit |
1470ea |
GApplication *application = user_data;
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
g_print ("You clicked \"Quit\"\n");
|
|
Packit |
1470ea |
g_application_quit (application);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Callback function for the "state" action */
|
|
Packit |
1470ea |
static void
|
|
Packit |
1470ea |
state_callback (GSimpleAction *simple,
|
|
Packit |
1470ea |
GVariant *parameter,
|
|
Packit |
1470ea |
gpointer user_data)
|
|
Packit |
1470ea |
{
|
|
Packit |
1470ea |
/* The two possibilities in this case for the "answer" variable are either
|
|
Packit |
1470ea |
* "on" or "off".
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
const gchar *answer = g_variant_get_string (parameter, NULL);
|
|
Packit |
1470ea |
/* We print the information to the user */
|
|
Packit |
1470ea |
g_printf ("State is set to %s.\n", answer);
|
|
Packit |
1470ea |
/* Note that we set the state of the action */
|
|
Packit |
1470ea |
g_simple_action_set_state (simple, parameter);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Callback function for the "awesome" action */
|
|
Packit |
1470ea |
static void
|
|
Packit |
1470ea |
awesome_callback (GSimpleAction *simple,
|
|
Packit |
1470ea |
GVariant *parameter,
|
|
Packit |
1470ea |
gpointer user_data)
|
|
Packit |
1470ea |
{
|
|
Packit |
1470ea |
GVariant *action_state = g_action_get_state (G_ACTION (simple));
|
|
Packit |
1470ea |
gboolean active = g_variant_get_boolean (action_state);
|
|
Packit |
1470ea |
GVariant *new_state = g_variant_new_boolean (!active);
|
|
Packit |
1470ea |
/* Set the new state for the action.
|
|
Packit |
1470ea |
* (Keeps track of whether it was last checked or unchecked).
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
g_simple_action_set_state (simple, new_state);
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
if (active)
|
|
Packit |
1470ea |
g_print ("You unchecked \"Awesome\"\n");
|
|
Packit |
1470ea |
else
|
|
Packit |
1470ea |
g_print ("You checked \"Awesome\"\n");
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Startup function for the menu we are creating in this sample */
|
|
Packit |
1470ea |
static void
|
|
Packit |
1470ea |
startup (GApplication *app,
|
|
Packit |
1470ea |
gpointer user_data)
|
|
Packit |
1470ea |
{
|
|
Packit |
1470ea |
/* Initialize variables */
|
|
Packit |
1470ea |
GSimpleAction *new_action;
|
|
Packit |
1470ea |
GSimpleAction *quit_action;
|
|
Packit |
1470ea |
GSimpleAction *state_action;
|
|
Packit |
1470ea |
GSimpleAction *awesome_action;
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
GtkBuilder *builder;
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
GError *error = NULL;
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Begin creating the "new" action.
|
|
Packit |
1470ea |
* Note that it is an action without a state.
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
new_action = g_simple_action_new ("new", NULL);
|
|
Packit |
1470ea |
g_signal_connect (new_action, "activate", G_CALLBACK (new_callback), app);
|
|
Packit |
1470ea |
/* It is added to the overall application */
|
|
Packit |
1470ea |
g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (new_action));
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Begin creating the "quit" action.
|
|
Packit |
1470ea |
* Note that it is an action without a state.
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
quit_action = g_simple_action_new ("quit", NULL);
|
|
Packit |
1470ea |
g_signal_connect (quit_action, "activate", G_CALLBACK (quit_callback), app);
|
|
Packit |
1470ea |
/* It is added to the overall application */
|
|
Packit |
1470ea |
g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (quit_action));
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Begin creating the "state" action.
|
|
Packit |
1470ea |
* Note that it is an action with a state.
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
GVariantType *type_string2 = g_variant_type_new ("s");
|
|
Packit |
1470ea |
state_action = g_simple_action_new_stateful ("state", type_string2,
|
|
Packit |
1470ea |
g_variant_new_string ("off"));
|
|
Packit |
1470ea |
g_signal_connect (state_action, "activate", G_CALLBACK (state_callback), app);
|
|
Packit |
1470ea |
/* It is added to the overall application */
|
|
Packit |
1470ea |
g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (state_action));
|
|
Packit |
1470ea |
g_variant_type_free (type_string2);
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Begin creating the "awesome" action.
|
|
Packit |
1470ea |
* Note that it is an action with a state.
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
awesome_action = g_simple_action_new_stateful ("awesome", NULL, g_variant_new_boolean (FALSE));
|
|
Packit |
1470ea |
g_signal_connect (awesome_action, "activate", G_CALLBACK (awesome_callback), app);
|
|
Packit |
1470ea |
/* It is added to the overall application */
|
|
Packit |
1470ea |
g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (awesome_action));
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* A builder to add the User Interface designed with GLADE to the grid: */
|
|
Packit |
1470ea |
builder = gtk_builder_new ();
|
|
Packit |
1470ea |
/* Get the file (if it is there):
|
|
Packit |
1470ea |
* Note: you must make sure that the file is in the current directory for
|
|
Packit |
1470ea |
* this to work. The function used here returns a non-null value within
|
|
Packit |
1470ea |
* our variable "error" if an error is indeed found.
|
|
Packit |
1470ea |
*/
|
|
Packit |
1470ea |
gtk_builder_add_from_file (builder, "menubar.ui", &error);
|
|
Packit |
1470ea |
if (error != NULL) {
|
|
Packit |
1470ea |
g_print ("%s\n", error->message);
|
|
Packit |
1470ea |
g_error_free (error);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Extract the menubar */
|
|
Packit |
1470ea |
GObject *menubar = gtk_builder_get_object (builder, "menubar");
|
|
Packit |
1470ea |
gtk_application_set_menubar (GTK_APPLICATION (app), G_MENU_MODEL (menubar));
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Extract the appmenu */
|
|
Packit |
1470ea |
GObject *appmenu = gtk_builder_get_object (builder, "appmenu");
|
|
Packit |
1470ea |
gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (appmenu));
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
/* Startup function for the application */
|
|
Packit |
1470ea |
int
|
|
Packit |
1470ea |
main (int argc, char **argv)
|
|
Packit |
1470ea |
{
|
|
Packit |
1470ea |
GtkApplication *app;
|
|
Packit |
1470ea |
int status;
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
|
Packit |
1470ea |
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
|
Packit |
1470ea |
g_signal_connect (app, "startup", G_CALLBACK (startup), NULL);
|
|
Packit |
1470ea |
status = g_application_run (G_APPLICATION (app), argc, argv);
|
|
Packit |
1470ea |
g_object_unref (app);
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
return status;
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
Dans cet exemple, les éléments suivants sont utilisés :
|
|
Packit |
1470ea |
<list>
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/gtk3/stable/GtkApplication.html">GtkApplication</link> </item>
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/gtk3/stable/GtkWindow.html">GtkWindow</link> </item>
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/gio/stable/GSimpleAction.html">GSimpleAction</link> </item>
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/gtk/stable/GtkAboutDialog.html">GtkAboutDialog</link> </item>
|
|
Packit |
1470ea |
<item><link href="http://developer.gnome.org/glib/stable/glib-GVariantType.html">GtkVariantType</link> </item>
|
|
Packit |
1470ea |
</list>
|
|
Packit |
1470ea |
</page>
|