GTK+2 panel 

GTK+2 panel Git Source Tree

Root/gladepanel.c

1#include "gppanel.h"
2
3
4static gbooleangp_parse_arguments(gint*p_argc,
5 gchar ***p_argv);
6
7
8static gchar *config_file = NULL;
9static gchar *top_id = NULL;
10static gchar *bottom_id = NULL;
11
12
13int
14main (int argc,
15 char **argv)
16{
17 GpPanel *panel;
18
19 gtk_init (&argc, &argv);
20
21 if (!gp_parse_arguments (&argc, &argv))
22 return -1;
23
24 panel = gp_panel_new (config_file, top_id, bottom_id);
25 if (panel == NULL)
26 return -2;
27
28 if (!gp_panel_show (panel))
29 {
30 gp_panel_destroy (panel);
31 return -3;
32 }
33
34 gtk_main ();
35
36 gp_panel_destroy (panel);
37 return 0;
38}
39
40
41static gboolean
42gp_parse_arguments (gint *p_argc,
43 gchar ***p_argv)
44{
45 GOptionContext *context;
46 GError *error;
47 GOptionEntry entries[] =
48 {
49 { "config", 'c', 0, G_OPTION_ARG_FILENAME, &config_file, "Read panel structure from FILE", "FILE" },
50 { "top", 't', 0, G_OPTION_ARG_STRING, &top_id, "Open WIDGET as a top edge panel", "WIDGET" },
51 { "bottom", 'b', 0, G_OPTION_ARG_STRING, &bottom_id, "Open WIDGET as a bottom edge panel", "WIDGET" },
52 { NULL }
53 };
54
55 context = g_option_context_new ("\n\nA lightweight Gtk2 panel based on libglade.");
56 error = NULL;
57
58 g_option_context_add_main_entries (context, entries, NULL);
59 g_option_context_add_group (context, gtk_get_option_group (TRUE));
60 g_option_context_parse (context, p_argc, p_argv, &error);
61 g_option_context_free (context);
62
63 if (error != NULL)
64 {
65 g_warning (error->message);
66 g_error_free (error);
67 return FALSE;
68 }
69
70 return TRUE;
71}

Archive Download this file

Branches

Tags