GTK+2 panel 

GTK+2 panel Git Source Tree

Root/gladepanel.c

1#include "gladepanel.h"
2
3
4static GtkWidget *gp_panel_new(const gchar*xml_file,
5 const gchar*name);
6
7
8int
9main (int argc,
10 char **argv)
11{
12 gchar *xml_file;
13 GtkWidget *panel;
14
15 gtk_init (&argc, &argv);
16 gp_init ();
17
18 xml_file = g_strdup_printf ("%s/.config/gladepanel/default.glade", g_get_home_dir ());
19 panel = gp_panel_new (xml_file, "GpPanel");
20 if (!panel)
21 return -1;
22
23 gtk_widget_show_all (panel);
24 gtk_main ();
25 gtk_widget_destroy (panel);
26
27 return 0;
28}
29
30
31static GtkWidget *
32gp_panel_new (const gchar *xml_file,
33 const gchar *name)
34{
35 GladeXML *xml;
36 GtkWidget *widget;
37
38 xml = glade_xml_new (xml_file, name, NULL);
39 if (!xml)
40 {
41 g_warning ("Error parsing libglade file `%s'", xml_file);
42 return NULL;
43 }
44
45 widget = glade_xml_get_widget (xml, name);
46 if (!widget)
47 {
48 g_warning ("Widget `%s' not found", name);
49 g_object_unref (xml);
50 return NULL;
51 }
52
53 gtk_window_set_wmclass (GTK_WINDOW (widget), "panel", "gladepanel");
54 gtk_window_stick (GTK_WINDOW (widget));
55 g_signal_connect (widget, "realize", G_CALLBACK (_gp_panel_realize), NULL);
56 glade_xml_signal_autoconnect (xml);
57
58 g_object_unref (xml);
59
60 return widget;
61}

Archive Download this file

Branches

Tags