GTK+2 panel 

GTK+2 panel Commit Details

Date:2012-05-27 20:04:10 (8 years 5 months ago)
Author:Nicola Fontana
Branch:master
Commit:559d402f94bd781041438e2f721656ecd0f9945c
Parents: 33c27bbde566e7d0e08ea8b18ba8f8f148ed0cf5
Message:Improved build and code to be gnits compatible

Added --version to gtk2panel, improved code styling, enhanced build
system to support gnits mode and make distcheck.
Changes:
ATHANKS
MMakefile.am (1 diff)
Mconfigure.ac (3 diffs)
Mgtk2panel/gtk2panel.c (5 diffs)

File differences

Makefile.am
11
22
33
4
45
56
67
XSLTPROC=`which xsltproc`
ACLOCAL_AMFLAGS=-I build
DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
BUILT_SOURCES=ChangeLog \
README \
configure.ac
11
22
3
3
44
55
66
......
1212
1313
1414
15
15
16
1617
1718
1819
......
6263
6364
6465
65
66
6667
6768
6869
AC_PREREQ(2.58)
AC_INIT([GTK2 panel],[0.1.0],[gtk2panel-devel@lists.sourceforge.net],[gtk2panel])
AC_INIT([GTK2 panel],[0.1.0],[http://dev.entidi.com/p/gtk2panel/],[gtk2panel],[http://gtk2panel.entidi.com/])
m4_ifdef([LT_INIT],
[LT_INIT([disable-static])],
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([build])
AM_INIT_AUTOMAKE
dnl No idea which is the oldest automake supported: be optimistic
AM_INIT_AUTOMAKE([1.0 gnits no-dist-gzip dist-bzip2 -Wall -Wno-portability])
AC_DEFINE([PACKAGE_DESCRIPTION],
["A bleeding edge panel heavily based on the GTK+2 stack"],
dnl - no: glade support disabled
dnl - ...: explicit path to glade catalogs (check for gladeui disabled)
AC_ARG_WITH(glade_catalogdir,
[AC_HELP_STRING([--with-glade-catalogdir@<:@=DIR@:>@],
[AS_HELP_STRING([--with-glade-catalogdir@<:@=DIR@:>@],
[where to install the glade catalogs @<:@default=check@:>@])],
[],[with_glade_catalogdir=check])
gtk2panel/gtk2panel.c
1818
1919
2020
21
2122
2223
2324
24
25
26
27
28
29
30
31
32
33
34
25
26
3527
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
28
29
5630
5731
58
5932
60
33
6134
62
6335
6436
65
66
67
37
38
39
40
41
6842
6943
7044
71
7245
73
46
7447
7548
76
77
78
79
49
50
8051
8152
82
83
84
53
54
55
8556
8657
8758
......
11687
11788
11889
90
91
92
93
94
95
96
97
98
99
119100
120
101
121102
122103
123104
......
131112
132113
133114
134
115
135116
136117
137118
138119
139120
140
121
141122
142123
143124
......
153134
154135
155136
156
157
158
159
160
161
162
163
164
165
166137
167
138
168139
169140
170141
......
188159
189160
190161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
*/
#include <config.h>
#include <stdlib.h>
#include "gtk2panel.h"
static gboolean parse_args (Gtk2Panel *gtk2_panel,
gint *p_argc,
gchar ***p_argv);
static gboolean get_panels (Gtk2Panel *gtk2_panel);
static void append_if_gpw_panel (GObject *object,
GSList **p_list);
static gboolean merge_rc_file (Gtk2Panel *gtk2_panel);
int
main(int argc, char **argv)
static void
gtk2panel_version(void)
{
Gtk2Panel gtk2_panel;
if (!parse_args(&gtk2_panel, &argc, &argv))
return -1;
if (!get_panels(&gtk2_panel))
return -2;
if (!merge_rc_file(&gtk2_panel))
return -3;
g_free(gtk2_panel.xml_file);
g_slist_foreach(gtk2_panel.panels, (GFunc) gtk_widget_show, NULL);
gtk_main();
g_slist_foreach(gtk2_panel.panels, (GFunc) gtk_widget_destroy, NULL);
g_slist_free(gtk2_panel.panels);
return 0;
g_print("gtk-panel " PACKAGE_VERSION "\n");
exit(0);
}
static gboolean
parse_args(Gtk2Panel *gtk2_panel, gint *p_argc, gchar ***p_argv)
g2p_parse_args(Gtk2Panel *gtk2_panel, gint *p_argc, gchar **p_argv[])
{
GOptionContext *context;
GError *error;
GOptionEntry entries[] = {
{"config", 'c', 0, G_OPTION_ARG_FILENAME, NULL,
"Read panel structure from FILE", "FILE"},
{NULL}
{"version", 'V', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
(gpointer) gtk2panel_version, "Display version information", NULL},
{"config", 'c', 0, G_OPTION_ARG_FILENAME, NULL,
"Read panel structure from FILE", "FILE"},
{NULL}
};
gchar *tmp_str;
context = g_option_context_new("\n\n" PACKAGE_DESCRIPTION ".");
error = NULL;
entries[0].arg_data = &gtk2_panel->xml_file;
entries[1].arg_data = &gtk2_panel->xml_file;
gtk2_panel->xml_file = NULL;
g_option_context_add_main_entries(context, entries, NULL);
g_option_context_add_group(context, gtk_get_option_group(TRUE));
g_option_context_parse(context, p_argc, p_argv, &error);
g_option_context_free(context);
gtk_init_with_args(p_argc, p_argv, "\n\n" PACKAGE_DESCRIPTION ".",
entries, 0, &error);
if (error != NULL) {
g_warning(error->message);
g_error_free(error);
return FALSE;
g_warning(error->message);
g_error_free(error);
return FALSE;
}
/* Use default.xml if no XML file specified */
return FALSE;
}
static void
g2p_append_if_gpw_panel(GObject *object, GSList **p_list)
{
if (! GPW_IS_PANEL(object))
return;
g_object_ref(object);
*p_list = g_slist_append(*p_list, object);
}
static gboolean
get_panels(Gtk2Panel *gtk2_panel)
g2p_get_panels(Gtk2Panel *gtk2_panel)
{
GtkBuilder *builder;
GError *error;
if (error != NULL) {
/* Problem reading the XML file */
g_warning(error->message);
g_warning(error->message);
g_error_free(error);
result = FALSE;
} else {
GSList *objects = gtk_builder_get_objects(builder);
g_slist_foreach(objects, (GFunc) append_if_gpw_panel,
g_slist_foreach(objects, (GFunc) g2p_append_if_gpw_panel,
&gtk2_panel->panels);
g_slist_free(objects);
return result;
}
static void
append_if_gpw_panel(GObject *object, GSList **p_list)
{
if (! GPW_IS_PANEL(object))
return;
g_object_ref(object);
*p_list = g_slist_append(*p_list, object);
}
static gboolean
merge_rc_file(Gtk2Panel *gtk2_panel)
g2p_merge_rc_file(Gtk2Panel *gtk2_panel)
{
gchar *dir;
gchar *rc_file;
return TRUE;
}
int
main(gint argc, gchar *argv[])
{
Gtk2Panel gtk2_panel;
if (!g2p_parse_args(&gtk2_panel, &argc, &argv))
return -1;
if (!g2p_get_panels(&gtk2_panel))
return -2;
if (!g2p_merge_rc_file(&gtk2_panel))
return -3;
g_free(gtk2_panel.xml_file);
g_slist_foreach(gtk2_panel.panels, (GFunc) gtk_widget_show, NULL);
gtk_main();
g_slist_foreach(gtk2_panel.panels, (GFunc) gtk_widget_destroy, NULL);
g_slist_free(gtk2_panel.panels);
return 0;
}

Archive Download the corresponding diff file

Branches

Tags