/usr/share/gtk-3.0/demo/builder.c is in gtk-3-examples 3.4.2-0ubuntu0.9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | /* Builder
*
* Demonstrates an interface loaded from a XML description.
*/
#include <gtk/gtk.h>
#include "demo-common.h"
static GtkBuilder *builder;
G_MODULE_EXPORT void
quit_activate (GtkAction *action)
{
GtkWidget *window;
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_widget_destroy (window);
}
G_MODULE_EXPORT void
about_activate (GtkAction *action)
{
GtkWidget *about_dlg;
about_dlg = GTK_WIDGET (gtk_builder_get_object (builder, "aboutdialog1"));
gtk_dialog_run (GTK_DIALOG (about_dlg));
gtk_widget_hide (about_dlg);
}
GtkWidget *
do_builder (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GError *err = NULL;
gchar *filename;
if (!window)
{
builder = gtk_builder_new ();
filename = demo_find_file ("demo.ui", NULL);
gtk_builder_add_from_file (builder, filename, &err);
g_free (filename);
if (err)
{
g_error ("ERROR: %s\n", err->message);
return NULL;
}
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
}
if (!gtk_widget_get_visible (window))
{
gtk_widget_show_all (window);
}
else
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}
|