summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2002-02-19 01:25:26 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2002-02-19 01:25:26 +0000
commitbd73a312f06ad6d1a448cab873f309264ee24b46 (patch)
tree62afa03ae970e3260e0677d02a2391e1d0350a1d /examples
parentc3940d4a07a6855998e1d991afeb92f3253bef56 (diff)
downloadgdk-pixbuf-bd73a312f06ad6d1a448cab873f309264ee24b46.tar.gz
Trivial formatting fixes to all examples, simple functional fixes to
* docs/tutorial/gtk-tut.sgml, docs/examples/*: Trivial formatting fixes to all examples, simple functional fixes to rangewidgets example.
Diffstat (limited to 'examples')
-rw-r--r--examples/arrow/arrow.c20
-rw-r--r--examples/aspectframe/aspectframe.c4
-rw-r--r--examples/base/base.c2
-rw-r--r--examples/buttonbox/buttonbox.c8
-rw-r--r--examples/buttons/buttons.c16
-rw-r--r--examples/calendar/calendar.c131
-rw-r--r--examples/clist/clist.c103
-rw-r--r--examples/entry/entry.c45
-rw-r--r--examples/eventbox/eventbox.c8
-rw-r--r--examples/filesel/filesel.c13
-rw-r--r--examples/fixed/fixed.c24
-rw-r--r--examples/frame/frame.c18
-rw-r--r--examples/gtkdial/dial_test.c20
-rw-r--r--examples/gtkdial/gtkdial.c46
-rw-r--r--examples/helloworld/helloworld.c16
-rw-r--r--examples/helloworld2/helloworld2.c22
-rw-r--r--examples/label/label.c6
-rw-r--r--examples/list/list.c174
-rw-r--r--examples/menu/itemfactory.c7
-rw-r--r--examples/menu/menu.c8
-rw-r--r--examples/notebook/notebook.c78
-rw-r--r--examples/packbox/packbox.c8
-rw-r--r--examples/paned/paned.c4
-rw-r--r--examples/pixmap/pixmap.c40
-rw-r--r--examples/progressbar/progressbar.c54
-rw-r--r--examples/radiobuttons/radiobuttons.c16
-rw-r--r--examples/rangewidgets/rangewidgets.c45
-rw-r--r--examples/rulers/rulers.c68
-rw-r--r--examples/scribble-simple/scribble-simple.c36
-rw-r--r--examples/scribble-xinput/scribble-xinput.c58
-rw-r--r--examples/scrolledwin/scrolledwin.c8
-rw-r--r--examples/selection/gettargets.c8
-rw-r--r--examples/selection/setselection.c26
-rw-r--r--examples/spinbutton/spinbutton.c26
-rw-r--r--examples/statusbar/statusbar.c51
-rw-r--r--examples/table/table.c14
-rw-r--r--examples/text/Makefile12
-rw-r--r--examples/text/text.c48
-rw-r--r--examples/tictactoe/tictactoe.c28
-rw-r--r--examples/tictactoe/ttt_test.c4
-rw-r--r--examples/tree/Makefile12
-rw-r--r--examples/tree/tree.c86
-rw-r--r--examples/wheelbarrow/wheelbarrow.c25
43 files changed, 735 insertions, 711 deletions
diff --git a/examples/arrow/arrow.c b/examples/arrow/arrow.c
index 884bc4752..d62716a2a 100644
--- a/examples/arrow/arrow.c
+++ b/examples/arrow/arrow.c
@@ -9,15 +9,15 @@ GtkWidget *create_arrow_button( GtkArrowType arrow_type,
GtkWidget *button;
GtkWidget *arrow;
- button = gtk_button_new();
+ button = gtk_button_new ();
arrow = gtk_arrow_new (arrow_type, shadow_type);
gtk_container_add (GTK_CONTAINER (button), arrow);
- gtk_widget_show(button);
- gtk_widget_show(arrow);
+ gtk_widget_show (button);
+ gtk_widget_show (arrow);
- return(button);
+ return button;
}
int main( int argc,
@@ -49,18 +49,18 @@ int main( int argc,
gtk_container_add (GTK_CONTAINER (window), box);
/* Pack and show all our widgets */
- gtk_widget_show(box);
+ gtk_widget_show (box);
- button = create_arrow_button(GTK_ARROW_UP, GTK_SHADOW_IN);
+ button = create_arrow_button (GTK_ARROW_UP, GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);
- button = create_arrow_button(GTK_ARROW_DOWN, GTK_SHADOW_OUT);
+ button = create_arrow_button (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);
- button = create_arrow_button(GTK_ARROW_LEFT, GTK_SHADOW_ETCHED_IN);
+ button = create_arrow_button (GTK_ARROW_LEFT, GTK_SHADOW_ETCHED_IN);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);
- button = create_arrow_button(GTK_ARROW_RIGHT, GTK_SHADOW_ETCHED_OUT);
+ button = create_arrow_button (GTK_ARROW_RIGHT, GTK_SHADOW_ETCHED_OUT);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);
gtk_widget_show (window);
@@ -68,5 +68,5 @@ int main( int argc,
/* Rest in gtk_main and wait for the fun to begin! */
gtk_main ();
- return(0);
+ return 0;
}
diff --git a/examples/aspectframe/aspectframe.c b/examples/aspectframe/aspectframe.c
index 6f231188f..654f580f9 100644
--- a/examples/aspectframe/aspectframe.c
+++ b/examples/aspectframe/aspectframe.c
@@ -23,7 +23,7 @@ int main( int argc,
2, /* xsize/ysize = 2 */
FALSE /* ignore child's aspect */);
- gtk_container_add (GTK_CONTAINER(window), aspect_frame);
+ gtk_container_add (GTK_CONTAINER (window), aspect_frame);
gtk_widget_show (aspect_frame);
/* Now add a child widget to the aspect frame */
@@ -33,7 +33,7 @@ int main( int argc,
/* Ask for a 200x200 window, but the AspectFrame will give us a 200x100
* window since we are forcing a 2x1 aspect ratio */
gtk_widget_set_size_request (drawing_area, 200, 200);
- gtk_container_add (GTK_CONTAINER(aspect_frame), drawing_area);
+ gtk_container_add (GTK_CONTAINER (aspect_frame), drawing_area);
gtk_widget_show (drawing_area);
gtk_widget_show (window);
diff --git a/examples/base/base.c b/examples/base/base.c
index 94b5360ff..4dc29da62 100644
--- a/examples/base/base.c
+++ b/examples/base/base.c
@@ -13,5 +13,5 @@ int main( int argc,
gtk_main ();
- return(0);
+ return 0;
}
diff --git a/examples/buttonbox/buttonbox.c b/examples/buttonbox/buttonbox.c
index 45e71c94f..ff140a78b 100644
--- a/examples/buttonbox/buttonbox.c
+++ b/examples/buttonbox/buttonbox.c
@@ -37,7 +37,7 @@ GtkWidget *create_bbox( gint horizontal,
button = gtk_button_new_with_label ("Help");
gtk_container_add (GTK_CONTAINER (bbox), button);
- return(frame);
+ return frame;
}
int main( int argc,
@@ -51,13 +51,13 @@ int main( int argc,
GtkWidget *frame_vert;
/* Initialize GTK */
- gtk_init( &argc, &argv );
+ gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes");
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gtk_main_quit),
+ GTK_SIGNAL_FUNC (gtk_main_quit),
NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
@@ -116,5 +116,5 @@ int main( int argc,
/* Enter the event loop */
gtk_main ();
- return(0);
+ return 0;
}
diff --git a/examples/buttons/buttons.c b/examples/buttons/buttons.c
index 0f7864afa..607a77883 100644
--- a/examples/buttons/buttons.c
+++ b/examples/buttons/buttons.c
@@ -22,7 +22,7 @@ GtkWidget *xpm_label_box( GtkWidget *parent,
/* Get the style of the button to get the
* background color. */
- style = gtk_widget_get_style(parent);
+ style = gtk_widget_get_style (parent);
/* Now on to the xpm stuff */
pixmap = gdk_pixmap_create_from_xpm (parent->window, &mask,
@@ -39,10 +39,10 @@ GtkWidget *xpm_label_box( GtkWidget *parent,
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 3);
- gtk_widget_show(pixmapwid);
- gtk_widget_show(label);
+ gtk_widget_show (pixmapwid);
+ gtk_widget_show (label);
- return(box1);
+ return box1;
}
/* Our usual callback function */
@@ -78,7 +78,7 @@ int main( int argc,
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
- gtk_widget_realize(window);
+ gtk_widget_realize (window);
/* Create a new button */
button = gtk_button_new ();
@@ -91,11 +91,11 @@ int main( int argc,
box1 = xpm_label_box(window, "info.xpm", "cool button");
/* Pack and show all our widgets */
- gtk_widget_show(box1);
+ gtk_widget_show (box1);
gtk_container_add (GTK_CONTAINER (button), box1);
- gtk_widget_show(button);
+ gtk_widget_show (button);
gtk_container_add (GTK_CONTAINER (window), button);
@@ -104,5 +104,5 @@ int main( int argc,
/* Rest in gtk_main and wait for the fun to begin! */
gtk_main ();
- return(0);
+ return 0;
}
diff --git a/examples/calendar/calendar.c b/examples/calendar/calendar.c
index 5e395b915..ce1cb8199 100644
--- a/examples/calendar/calendar.c
+++ b/examples/calendar/calendar.c
@@ -59,11 +59,11 @@ void calendar_date_to_string( CalendarData *data,
time_t time;
memset (&tm, 0, sizeof (tm));
- gtk_calendar_get_date (GTK_CALENDAR(data->window),
+ gtk_calendar_get_date (GTK_CALENDAR (data->window),
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
tm.tm_year -= TM_YEAR_BASE;
- time = mktime(&tm);
- strftime (buffer, buff_len-1, "%x", gmtime(&time));
+ time = mktime (&tm);
+ strftime (buffer, buff_len-1, "%x", gmtime (&time));
}
void calendar_set_signal_strings( char *sig_str,
@@ -107,15 +107,18 @@ void calendar_day_selected_double_click( GtkWidget *widget,
calendar_set_signal_strings (buffer, data);
memset (&tm, 0, sizeof (tm));
- gtk_calendar_get_date (GTK_CALENDAR(data->window),
+ gtk_calendar_get_date (GTK_CALENDAR (data->window),
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
tm.tm_year -= TM_YEAR_BASE;
- if(GTK_CALENDAR(data->window)->marked_date[tm.tm_mday-1] == 0) {
- gtk_calendar_mark_day(GTK_CALENDAR(data->window),tm.tm_mday);
- } else {
- gtk_calendar_unmark_day(GTK_CALENDAR(data->window),tm.tm_mday);
- }
+ if (GTK_CALENDAR (data->window)->marked_date[tm.tm_mday-1] == 0)
+ {
+ gtk_calendar_mark_day (GTK_CALENDAR (data->window), tm.tm_mday);
+ }
+ else
+ {
+ gtk_calendar_unmark_day (GTK_CALENDAR (data->window), tm.tm_mday);
+ }
}
void calendar_prev_month( GtkWidget *widget,
@@ -158,8 +161,8 @@ void calendar_next_year( GtkWidget *widget,
void calendar_set_flags( CalendarData *calendar )
{
gint i;
- gint options=0;
- for (i=0;i<5;i++)
+ gint options = 0;
+ for (i = 0; i < 5; i++)
if (calendar->settings[i])
{
options=options + (1<<i);
@@ -173,13 +176,13 @@ void calendar_toggle_flag( GtkWidget *toggle,
{
gint i;
gint j;
- j=0;
- for (i=0; i<5; i++)
+ j = 0;
+ for (i = 0; i < 5; i++)
if (calendar->flag_checkboxes[i] == toggle)
j = i;
- calendar->settings[j]=!calendar->settings[j];
- calendar_set_flags(calendar);
+ calendar->settings[j] = !calendar->settings[j];
+ calendar_set_flags (calendar);
}
@@ -189,7 +192,7 @@ void calendar_font_selection_ok( GtkWidget *button,
GtkStyle *style;
PangoFontDescription *font_desc;
- calendar->font = gtk_font_selection_dialog_get_font_name(
+ calendar->font = gtk_font_selection_dialog_get_font_name (
GTK_FONT_SELECTION_DIALOG (calendar->font_dialog));
if (calendar->window)
{
@@ -210,7 +213,7 @@ void calendar_select_font( GtkWidget *button,
if (!calendar->font_dialog) {
window = gtk_font_selection_dialog_new ("Font Selection Dialog");
- g_return_if_fail(GTK_IS_FONT_SELECTION_DIALOG(window));
+ g_return_if_fail (GTK_IS_FONT_SELECTION_DIALOG (window));
calendar->font_dialog = window;
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
@@ -220,7 +223,7 @@ void calendar_select_font( GtkWidget *button,
&calendar->font_dialog);
g_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button),
- "clicked", GTK_SIGNAL_FUNC(calendar_font_selection_ok),
+ "clicked", GTK_SIGNAL_FUNC (calendar_font_selection_ok),
calendar);
g_signal_connect_swapped (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button),
"clicked",
@@ -267,44 +270,44 @@ void create_calendar()
calendar_data.font = NULL;
calendar_data.font_dialog = NULL;
- for (i=0; i<5; i++) {
- calendar_data.settings[i]=0;
+ for (i = 0; i < 5; i++) {
+ calendar_data.settings[i] = 0;
}
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window), "GtkCalendar Example");
+ gtk_window_set_title (GTK_WINDOW (window), "GtkCalendar Example");
gtk_container_set_border_width (GTK_CONTAINER (window), 5);
- g_signal_connect(GTK_OBJECT(window), "destroy",
- GTK_SIGNAL_FUNC(gtk_main_quit),
- NULL);
- g_signal_connect(GTK_OBJECT(window), "delete-event",
- GTK_SIGNAL_FUNC(gtk_false),
- NULL);
+ g_signal_connect (GTK_OBJECT (window), "destroy",
+ GTK_SIGNAL_FUNC (gtk_main_quit),
+ NULL);
+ g_signal_connect (GTK_OBJECT (window), "delete-event",
+ GTK_SIGNAL_FUNC (gtk_false),
+ NULL);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
- vbox = gtk_vbox_new(FALSE, DEF_PAD);
+ vbox = gtk_vbox_new (FALSE, DEF_PAD);
gtk_container_add (GTK_CONTAINER (window), vbox);
/*
* The top part of the window, Calendar, flags and fontsel.
*/
- hbox = gtk_hbox_new(FALSE, DEF_PAD);
- gtk_box_pack_start (GTK_BOX(vbox), hbox, TRUE, TRUE, DEF_PAD);
- hbbox = gtk_hbutton_box_new();
- gtk_box_pack_start(GTK_BOX(hbox), hbbox, FALSE, FALSE, DEF_PAD);
- gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_SPREAD);
+ hbox = gtk_hbox_new (FALSE, DEF_PAD);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, DEF_PAD);
+ hbbox = gtk_hbutton_box_new ();
+ gtk_box_pack_start (GTK_BOX (hbox), hbbox, FALSE, FALSE, DEF_PAD);
+ gtk_button_box_set_layout (GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_SPREAD);
gtk_box_set_spacing (GTK_BOX (hbbox), 5);
/* Calendar widget */
- frame = gtk_frame_new("Calendar");
- gtk_box_pack_start(GTK_BOX(hbbox), frame, FALSE, TRUE, DEF_PAD);
- calendar=gtk_calendar_new();
+ frame = gtk_frame_new ("Calendar");
+ gtk_box_pack_start (GTK_BOX (hbbox), frame, FALSE, TRUE, DEF_PAD);
+ calendar=gtk_calendar_new ();
calendar_data.window = calendar;
- calendar_set_flags(&calendar_data);
- gtk_calendar_mark_day ( GTK_CALENDAR(calendar), 19);
- gtk_container_add( GTK_CONTAINER( frame), calendar);
+ calendar_set_flags (&calendar_data);
+ gtk_calendar_mark_day (GTK_CALENDAR (calendar), 19);
+ gtk_container_add( GTK_CONTAINER (frame), calendar);
g_signal_connect (GTK_OBJECT (calendar), "month_changed",
GTK_SIGNAL_FUNC (calendar_month_changed),
&calendar_data);
@@ -331,43 +334,43 @@ void create_calendar()
separator = gtk_vseparator_new ();
gtk_box_pack_start (GTK_BOX (hbox), separator, FALSE, TRUE, 0);
- vbox2 = gtk_vbox_new(FALSE, DEF_PAD);
- gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, DEF_PAD);
+ vbox2 = gtk_vbox_new (FALSE, DEF_PAD);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, DEF_PAD);
/* Build the Right frame with the flags in */
- frame = gtk_frame_new("Flags");
- gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, DEF_PAD);
- vbox3 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
- gtk_container_add(GTK_CONTAINER(frame), vbox3);
+ frame = gtk_frame_new ("Flags");
+ gtk_box_pack_start (GTK_BOX (vbox2), frame, TRUE, TRUE, DEF_PAD);
+ vbox3 = gtk_vbox_new (TRUE, DEF_PAD_SMALL);
+ gtk_container_add (GTK_CONTAINER (frame), vbox3);
for (i = 0; i < 5; i++)
{
- toggle = gtk_check_button_new_with_label(flags[i].label);
+ toggle = gtk_check_button_new_with_label (flags[i].label);
g_signal_connect (GTK_OBJECT (toggle),
- "toggled",
- GTK_SIGNAL_FUNC(calendar_toggle_flag),
- &calendar_data);
+ "toggled",
+ GTK_SIGNAL_FUNC (calendar_toggle_flag),
+ &calendar_data);
gtk_box_pack_start (GTK_BOX (vbox3), toggle, TRUE, TRUE, 0);
- calendar_data.flag_checkboxes[i]=toggle;
+ calendar_data.flag_checkboxes[i] = toggle;
}
/* Build the right font-button */
- button = gtk_button_new_with_label("Font...");
+ button = gtk_button_new_with_label ("Font...");
g_signal_connect (GTK_OBJECT (button),
- "clicked",
- GTK_SIGNAL_FUNC(calendar_select_font),
- &calendar_data);
+ "clicked",
+ GTK_SIGNAL_FUNC (calendar_select_font),
+ &calendar_data);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
/*
* Build the Signal-event part.
*/
- frame = gtk_frame_new("Signal events");
- gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, DEF_PAD);
+ frame = gtk_frame_new ("Signal events");
+ gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, DEF_PAD);
- vbox2 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
- gtk_container_add(GTK_CONTAINER(frame), vbox2);
+ vbox2 = gtk_vbox_new (TRUE, DEF_PAD_SMALL);
+ gtk_container_add (GTK_CONTAINER (frame), vbox2);
hbox = gtk_hbox_new (FALSE, 3);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
@@ -392,17 +395,17 @@ void create_calendar()
bbox = gtk_hbutton_box_new ();
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
- gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
+ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
button = gtk_button_new_with_label ("Close");
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_main_quit),
- NULL);
+ GTK_SIGNAL_FUNC (gtk_main_quit),
+ NULL);
gtk_container_add (GTK_CONTAINER (bbox), button);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
- gtk_widget_show_all(window);
+ gtk_widget_show_all (window);
}
@@ -411,9 +414,9 @@ int main(int argc,
{
gtk_init (&argc, &argv);
- create_calendar();
+ create_calendar ();
- gtk_main();
+ gtk_main ();
return 0;
}
diff --git a/examples/clist/clist.c b/examples/clist/clist.c
index 1a2f25b97..1dd49658f 100644
--- a/examples/clist/clist.c
+++ b/examples/clist/clist.c
@@ -15,8 +15,8 @@ void button_add_clicked( gpointer data )
/* Here we do the actual adding of the text. It's done once for
* each row.
*/
- for ( indx=0 ; indx < 4 ; indx++ )
- gtk_clist_append( (GtkCList *) data, drink[indx]);
+ for (indx = 0; indx < 4; indx++)
+ gtk_clist_append ((GtkCList *)data, drink[indx]);
return;
}
@@ -27,7 +27,7 @@ void button_clear_clicked( gpointer data )
/* Clear the list using gtk_clist_clear. This is much faster than
* calling gtk_clist_remove once for each row.
*/
- gtk_clist_clear( (GtkCList *) data);
+ gtk_clist_clear ((GtkCList *)data);
return;
}
@@ -41,13 +41,13 @@ void button_hide_show_clicked( gpointer data )
if (flag == 0)
{
/* Hide the titles and set the flag to 1 */
- gtk_clist_column_titles_hide((GtkCList *) data);
+ gtk_clist_column_titles_hide ((GtkCList *)data);
flag++;
}
else
{
/* Show the titles and reset flag to 0 */
- gtk_clist_column_titles_show((GtkCList *) data);
+ gtk_clist_column_titles_show ((GtkCList *)data);
flag--;
}
@@ -67,12 +67,12 @@ void selection_made( GtkWidget *clist,
* which was clicked in. We will receive it as a pointer in the
* argument text.
*/
- gtk_clist_get_text(GTK_CLIST(clist), row, column, &text);
+ gtk_clist_get_text (GTK_CLIST (clist), row, column, &text);
/* Just prints some information about the selected row */
- g_print("You selected row %d. More specifically you clicked in "
- "column %d, and the text in this cell is %s\n\n",
- row, column, text);
+ g_print ("You selected row %d. More specifically you clicked in "
+ "column %d, and the text in this cell is %s\n\n",
+ row, column, text);
return;
}
@@ -88,85 +88,86 @@ int main( int argc,
gtk_init(&argc, &argv);
- window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ window=gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (GTK_WIDGET (window), 300, 150);
- gtk_window_set_title(GTK_WINDOW(window), "GtkCList Example");
- gtk_signal_connect(GTK_OBJECT(window),
- "destroy",
- GTK_SIGNAL_FUNC(gtk_main_quit),
- NULL);
+ gtk_window_set_title (GTK_WINDOW (window), "GtkCList Example");
+ gtk_signal_connect (GTK_OBJECT (window),
+ "destroy",
+ GTK_SIGNAL_FUNC (gtk_main_quit),
+ NULL);
- vbox=gtk_vbox_new(FALSE, 5);
- gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
- gtk_container_add(GTK_CONTAINER(window), vbox);
- gtk_widget_show(vbox);
+ vbox=gtk_vbox_new (FALSE, 5);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+ gtk_widget_show (vbox);
/* Create a scrolled window to pack the CList widget into */
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
- gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
gtk_widget_show (scrolled_window);
/* Create the CList. For this example we use 2 columns */
- clist = gtk_clist_new_with_titles( 2, titles);
+ clist = gtk_clist_new_with_titles (2, titles);
/* When a selection is made, we want to know about it. The callback
* used is selection_made, and its code can be found further down */
- gtk_signal_connect(GTK_OBJECT(clist), "select_row",
- GTK_SIGNAL_FUNC(selection_made),
+ gtk_signal_connect(GTK_OBJECT (clist), "select_row",
+ GTK_SIGNAL_FUNC (selection_made),
NULL);
/* It isn't necessary to shadow the border, but it looks nice :) */
- gtk_clist_set_shadow_type (GTK_CLIST(clist), GTK_SHADOW_OUT);
+ gtk_clist_set_shadow_type (GTK_CLIST (clist), GTK_SHADOW_OUT);
/* What however is important, is that we set the column widths as
* they will never be right otherwise. Note that the columns are
* numbered from 0 and up (to 1 in this case).
*/
- gtk_clist_set_column_width (GTK_CLIST(clist), 0, 150);
+ gtk_clist_set_column_width (GTK_CLIST (clist), 0, 150);
/* Add the CList widget to the vertical box and show it. */
- gtk_container_add(GTK_CONTAINER(scrolled_window), clist);
- gtk_widget_show(clist);
+ gtk_container_add (GTK_CONTAINER (scrolled_window), clist);
+ gtk_widget_show (clist);
/* Create the buttons and add them to the window. See the button
* tutorial for more examples and comments on this.
*/
- hbox = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
- gtk_widget_show(hbox);
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
+ gtk_widget_show (hbox);
- button_add = gtk_button_new_with_label("Add List");
- button_clear = gtk_button_new_with_label("Clear List");
- button_hide_show = gtk_button_new_with_label("Hide/Show titles");
+ button_add = gtk_button_new_with_label ("Add List");
+ button_clear = gtk_button_new_with_label ("Clear List");
+ button_hide_show = gtk_button_new_with_label ("Hide/Show titles");
- gtk_box_pack_start(GTK_BOX(hbox), button_add, TRUE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), button_clear, TRUE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), button_hide_show, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), button_add, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), button_clear, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), button_hide_show, TRUE, TRUE, 0);
/* Connect our callbacks to the three buttons */
- gtk_signal_connect_object(GTK_OBJECT(button_add), "clicked",
- GTK_SIGNAL_FUNC(button_add_clicked),
- (gpointer) clist);
- gtk_signal_connect_object(GTK_OBJECT(button_clear), "clicked",
- GTK_SIGNAL_FUNC(button_clear_clicked),
- (gpointer) clist);
- gtk_signal_connect_object(GTK_OBJECT(button_hide_show), "clicked",
- GTK_SIGNAL_FUNC(button_hide_show_clicked),
- (gpointer) clist);
-
- gtk_widget_show(button_add);
- gtk_widget_show(button_clear);
- gtk_widget_show(button_hide_show);
+ gtk_signal_connect_object (GTK_OBJECT (button_add), "clicked",
+ GTK_SIGNAL_FUNC (button_add_clicked),
+ (gpointer) clist);
+ gtk_signal_connect_object (GTK_OBJECT (button_clear), "clicked",
+ GTK_SIGNAL_FUNC (button_clear_clicked),
+ (gpointer) clist);
+ gtk_signal_connect_object (GTK_OBJECT (button_hide_show), "clicked",
+ GTK_SIGNAL_FUNC (button_hide_show_clicked),
+ (gpointer) clist);
+
+ gtk_widget_show (button_add);
+ gtk_widget_show (button_clear);
+ gtk_widget_show (button_hide_show);
/* The interface is completely set up so we show the window and
* enter the gtk_main loop.
*/
- gtk_widget_show(window);
+ gtk_widget_show (window);
+
gtk_main();
- return(0);
+ return 0;
}
diff --git a/examples/entry/entry.c b/examples/entry/entry.c
index 4de30711d..b0b323039 100644
--- a/examples/entry/entry.c
+++ b/examples/entry/entry.c
@@ -7,7 +7,7 @@ void enter_callback( GtkWidget *widget,
GtkWidget *entry )
{
const gchar *entry_text;
- entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
+ entry_text = gtk_entry_get_text (GTK_ENTRY (entry));
printf("Entry contents: %s\n", entry_text);
}
@@ -21,8 +21,8 @@ void entry_toggle_editable( GtkWidget *checkbutton,
void entry_toggle_visibility( GtkWidget *checkbutton,
GtkWidget *entry )
{
- gtk_entry_set_visibility(GTK_ENTRY(entry),
- GTK_TOGGLE_BUTTON(checkbutton)->active);
+ gtk_entry_set_visibility (GTK_ENTRY (entry),
+ GTK_TOGGLE_BUTTON (checkbutton)->active);
}
int main( int argc,
@@ -39,11 +39,11 @@ int main( int argc,
gtk_init (&argc, &argv);
/* create a new window */
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
- gtk_window_set_title(GTK_WINDOW (window), "GTK Entry");
- g_signal_connect(GTK_OBJECT (window), "delete_event",
- (GtkSignalFunc) exit, NULL);
+ gtk_window_set_title (GTK_WINDOW (window), "GTK Entry");
+ g_signal_connect (GTK_OBJECT (window), "delete_event",
+ GTK_SIGNAL_FUNC (exit), NULL);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -51,14 +51,14 @@ int main( int argc,
entry = gtk_entry_new ();
gtk_entry_set_max_length (GTK_ENTRY (entry), 50);
- g_signal_connect(GTK_OBJECT(entry), "activate",
- GTK_SIGNAL_FUNC(enter_callback),
- entry);
+ g_signal_connect (GTK_OBJECT (entry), "activate",
+ GTK_SIGNAL_FUNC (enter_callback),
+ entry);
gtk_entry_set_text (GTK_ENTRY (entry), "hello");
tmp_pos = GTK_ENTRY (entry)->text_length;
gtk_editable_insert_text (GTK_EDITABLE (entry), " world", -1, &tmp_pos);
gtk_editable_select_region (GTK_EDITABLE (entry),
- 0, GTK_ENTRY(entry)->text_length);
+ 0, GTK_ENTRY (entry)->text_length);
gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
gtk_widget_show (entry);
@@ -66,31 +66,32 @@ int main( int argc,
gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_widget_show (hbox);
- check = gtk_check_button_new_with_label("Editable");
+ check = gtk_check_button_new_with_label ("Editable");
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
- g_signal_connect (GTK_OBJECT(check), "toggled",
- GTK_SIGNAL_FUNC(entry_toggle_editable), entry);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
+ g_signal_connect (GTK_OBJECT (check), "toggled",
+ GTK_SIGNAL_FUNC (entry_toggle_editable), entry);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
gtk_widget_show (check);
- check = gtk_check_button_new_with_label("Visible");
+ check = gtk_check_button_new_with_label ("Visible");
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
- g_signal_connect (GTK_OBJECT(check), "toggled",
- GTK_SIGNAL_FUNC(entry_toggle_visibility), entry);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
+ g_signal_connect (GTK_OBJECT (check), "toggled",
+ GTK_SIGNAL_FUNC (entry_toggle_visibility), entry);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
gtk_widget_show (check);
button = gtk_button_new_with_label ("Close");
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(exit),
- GTK_OBJECT (window));
+ GTK_SIGNAL_FUNC (exit),
+ GTK_OBJECT (window));
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
gtk_widget_show (button);
- gtk_widget_show(window);
+ gtk_widget_show (window);
gtk_main();
+
return 0;
}
diff --git a/examples/eventbox/eventbox.c b/examples/eventbox/eventbox.c
index 85a886f91..8a56da831 100644
--- a/examples/eventbox/eventbox.c
+++ b/examples/eventbox/eventbox.c
@@ -16,14 +16,14 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (exit), NULL);
+ GTK_SIGNAL_FUNC (exit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Create an EventBox and add it to our toplevel window */
event_box = gtk_event_box_new ();
- gtk_container_add (GTK_CONTAINER(window), event_box);
+ gtk_container_add (GTK_CONTAINER (window), event_box);
gtk_widget_show (event_box);
/* Create a long label */
@@ -37,8 +37,8 @@ int main( int argc,
/* And bind an action to it */
gtk_widget_set_events (event_box, GDK_BUTTON_PRESS_MASK);
- g_signal_connect (GTK_OBJECT(event_box), "button_press_event",
- GTK_SIGNAL_FUNC (exit), NULL);
+ g_signal_connect (GTK_OBJECT (event_box), "button_press_event",
+ GTK_SIGNAL_FUNC (exit), NULL);
/* Yet one more thing you need an X window for ... */
diff --git a/examples/filesel/filesel.c b/examples/filesel/filesel.c
index 87daf1264..1ad8444b5 100644
--- a/examples/filesel/filesel.c
+++ b/examples/filesel/filesel.c
@@ -25,23 +25,22 @@ int main( int argc,
filew = gtk_file_selection_new ("File selection");
g_signal_connect (GTK_OBJECT (filew), "destroy",
- GTK_SIGNAL_FUNC (destroy), &filew);
+ GTK_SIGNAL_FUNC (destroy), &filew);
/* Connect the ok_button to file_ok_sel function */
g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
- "clicked", GTK_SIGNAL_FUNC (file_ok_sel), filew );
+ "clicked", GTK_SIGNAL_FUNC (file_ok_sel), filew );
/* Connect the cancel_button to destroy the widget */
- g_signal_connect_swapped (GTK_OBJECT (GTK_FILE_SELECTION
- (filew)->cancel_button),
- "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (filew));
+ g_signal_connect_swapped (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
+ "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
+ GTK_OBJECT (filew));
/* Lets set the filename, as if this were a save dialog, and we are giving
a default filename */
gtk_file_selection_set_filename (GTK_FILE_SELECTION(filew),
"penguin.png");
- gtk_widget_show(filew);
+ gtk_widget_show (filew);
gtk_main ();
return 0;
}
diff --git a/examples/fixed/fixed.c b/examples/fixed/fixed.c
index 83d6990d7..b1c5f20e1 100644
--- a/examples/fixed/fixed.c
+++ b/examples/fixed/fixed.c
@@ -4,17 +4,17 @@
/* I'm going to be lazy and use some global variables to
* store the position of the widget within the fixed
* container */
-gint x=50;
-gint y=50;
+gint x = 50;
+gint y = 50;
/* This callback function moves the button to a new position
* in the Fixed container. */
void move_button( GtkWidget *widget,
GtkWidget *fixed )
{
- x = (x+30)%300;
- y = (y+50)%300;
- gtk_fixed_move( GTK_FIXED(fixed), widget, x, y);
+ x = (x + 30) % 300;
+ y = (y + 50) % 300;
+ gtk_fixed_move (GTK_FIXED (fixed), widget, x, y);
}
int main( int argc,
@@ -27,23 +27,23 @@ int main( int argc,
gint i;
/* Initialise GTK */
- gtk_init(&argc, &argv);
+ gtk_init (&argc, &argv);
/* Create a new window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window), "Fixed Container");
+ gtk_window_set_title (GTK_WINDOW (window), "Fixed Container");
/* Here we connect the "destroy" event to a signal handler */
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+ GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Create a Fixed Container */
- fixed = gtk_fixed_new();
- gtk_container_add(GTK_CONTAINER(window), fixed);
- gtk_widget_show(fixed);
+ fixed = gtk_fixed_new ();
+ gtk_container_add (GTK_CONTAINER (window), fixed);
+ gtk_widget_show (fixed);
for (i = 1 ; i <= 3 ; i++) {
/* Creates a new button with the label "Press me" */
@@ -53,7 +53,7 @@ int main( int argc,
* function move_button() passing it the Fixed Container as its
* argument. */
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (move_button), fixed);
+ GTK_SIGNAL_FUNC (move_button), fixed);
/* This packs the button into the fixed containers window. */
gtk_fixed_put (GTK_FIXED (fixed), button, i*50, i*50);
diff --git a/examples/frame/frame.c b/examples/frame/frame.c
index 05afcd476..fc44ee09d 100644
--- a/examples/frame/frame.c
+++ b/examples/frame/frame.c
@@ -9,34 +9,34 @@ int main( int argc,
GtkWidget *frame;
/* Initialise GTK */
- gtk_init(&argc, &argv);
+ gtk_init (&argc, &argv);
/* Create a new window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window), "Frame Example");
+ gtk_window_set_title (GTK_WINDOW (window), "Frame Example");
/* Here we connect the "destroy" event to a signal handler */
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+ GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
gtk_widget_set_size_request (window, 300, 300);
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Create a Frame */
- frame = gtk_frame_new(NULL);
- gtk_container_add(GTK_CONTAINER(window), frame);
+ frame = gtk_frame_new (NULL);
+ gtk_container_add (GTK_CONTAINER (window), frame);
/* Set the frame's label */
- gtk_frame_set_label( GTK_FRAME(frame), "GTK Frame Widget" );
+ gtk_frame_set_label (GTK_FRAME (frame), "GTK Frame Widget");
/* Align the label at the right of the frame */
- gtk_frame_set_label_align( GTK_FRAME(frame), 1.0, 0.0);
+ gtk_frame_set_label_align (GTK_FRAME (frame), 1.0, 0.0);
/* Set the style of the frame */
- gtk_frame_set_shadow_type( GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
- gtk_widget_show(frame);
+ gtk_widget_show (frame);
/* Display the window */
gtk_widget_show (window);
diff --git a/examples/gtkdial/dial_test.c b/examples/gtkdial/dial_test.c
index e753cc198..55f57d71b 100644
--- a/examples/gtkdial/dial_test.c
+++ b/examples/gtkdial/dial_test.c
@@ -29,34 +29,34 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Dial");
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (exit), NULL);
+ GTK_SIGNAL_FUNC (exit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
vbox = gtk_vbox_new (FALSE, 5);
gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_widget_show(vbox);
+ gtk_widget_show (vbox);
frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (vbox), frame);
gtk_widget_show (frame);
- adjustment = GTK_ADJUSTMENT(gtk_adjustment_new (0, 0, 100, 0.01, 0.1, 0));
+ adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 0.01, 0.1, 0));
- dial = gtk_dial_new(adjustment);
- gtk_dial_set_update_policy (GTK_DIAL(dial), GTK_UPDATE_DELAYED);
+ dial = gtk_dial_new (adjustment);
+ gtk_dial_set_update_policy (GTK_DIAL (dial), GTK_UPDATE_DELAYED);
/* gtk_widget_set_size_request (dial, 100, 100); */
gtk_container_add (GTK_CONTAINER (frame), dial);
gtk_widget_show (dial);
- label = gtk_label_new("0.00");
- gtk_box_pack_end (GTK_BOX(vbox), label, 0, 0, 0);
+ label = gtk_label_new ("0.00");
+ gtk_box_pack_end (GTK_BOX (vbox), label, 0, 0, 0);
gtk_widget_show (label);
- g_signal_connect (GTK_OBJECT(adjustment), "value_changed",
- GTK_SIGNAL_FUNC (value_changed), label);
+ g_signal_connect (GTK_OBJECT (adjustment), "value_changed",
+ GTK_SIGNAL_FUNC (value_changed), label);
gtk_widget_show (window);
diff --git a/examples/gtkdial/gtkdial.c b/examples/gtkdial/gtkdial.c
index 0bd89fd13..f535081bd 100644
--- a/examples/gtkdial/gtkdial.c
+++ b/examples/gtkdial/gtkdial.c
@@ -189,11 +189,11 @@ gtk_dial_set_adjustment (GtkDial *dial,
g_object_ref (GTK_OBJECT (dial->adjustment));
g_signal_connect (GTK_OBJECT (adjustment), "changed",
- GTK_SIGNAL_FUNC (gtk_dial_adjustment_changed),
- (gpointer) dial);
+ GTK_SIGNAL_FUNC (gtk_dial_adjustment_changed),
+ (gpointer) dial);
g_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- GTK_SIGNAL_FUNC (gtk_dial_adjustment_value_changed),
- (gpointer) dial);
+ GTK_SIGNAL_FUNC (gtk_dial_adjustment_value_changed),
+ (gpointer) dial);
dial->old_value = adjustment->value;
dial->old_lower = adjustment->lower;
@@ -267,7 +267,7 @@ gtk_dial_size_allocate (GtkWidget *widget,
allocation->width, allocation->height);
}
- dial->radius = MIN(allocation->width,allocation->height) * 0.45;
+ dial->radius = MIN (allocation->width, allocation->height) * 0.45;
dial->pointer_width = dial->radius / 5;
}
@@ -299,16 +299,16 @@ gtk_dial_expose (GtkWidget *widget,
widget->allocation.width,
widget->allocation.height);
*/
- xc = widget->allocation.width/2;
- yc = widget->allocation.height/2;
+ xc = widget->allocation.width / 2;
+ yc = widget->allocation.height / 2;
upper = dial->adjustment->upper;
lower = dial->adjustment->lower;
/* Erase old pointer */
- s = sin(dial->last_angle);
- c = cos(dial->last_angle);
+ s = sin (dial->last_angle);
+ c = cos (dial->last_angle);
dial->last_angle = dial->angle;
points[0].x = xc + s*dial->pointer_width/2;
@@ -342,7 +342,7 @@ gtk_dial_expose (GtkWidget *widget,
points, 5,
FALSE);
- g_object_unref(blankstyle);
+ g_object_unref (blankstyle);
/* Draw ticks */
@@ -350,26 +350,26 @@ gtk_dial_expose (GtkWidget *widget,
if ((upper - lower) == 0)
return FALSE;
- increment = (100*M_PI)/(dial->radius*dial->radius);
+ increment = (100*M_PI) / (dial->radius*dial->radius);
inc = (upper - lower);
- while (inc < 100) inc *=10;
- while (inc >= 1000) inc /=10;
+ while (inc < 100) inc *= 10;
+ while (inc >= 1000) inc /= 10;
last = -1;
- for (i=0; i<=inc; i++)
+ for (i = 0; i <= inc; i++)
{
- theta = ((gfloat)i*M_PI/(18*inc/24.) - M_PI/6.);
+ theta = ((gfloat)i*M_PI / (18*inc/24.) - M_PI/6.);
if ((theta - last) < (increment))
continue;
last = theta;
- s = sin(theta);
- c = cos(theta);
+ s = sin (theta);
+ c = cos (theta);
- tick_length = (i%(inc/10) == 0) ? dial->pointer_width : dial->pointer_width/2;
+ tick_length = (i%(inc/10) == 0) ? dial->pointer_width : dial->pointer_width / 2;
gdk_draw_line (widget->window,
widget->style->fg_gc[widget->state],
@@ -381,8 +381,8 @@ gtk_dial_expose (GtkWidget *widget,
/* Draw pointer */
- s = sin(dial->angle);
- c = cos(dial->angle);
+ s = sin (dial->angle);
+ c = cos (dial->angle);
dial->last_angle = dial->angle;
points[0].x = xc + s*dial->pointer_width/2;
@@ -434,11 +434,11 @@ gtk_dial_button_press (GtkWidget *widget,
dx = event->x - widget->allocation.width / 2;
dy = widget->allocation.height / 2 - event->y;
- s = sin(dial->angle);
- c = cos(dial->angle);
+ s = sin (dial->angle);
+ c = cos (dial->angle);
d_parallel = s*dy + c*dx;
- d_perpendicular = fabs(s*dx - c*dy);
+ d_perpendicular = fabs (s*dx - c*dy);
if (!dial->button &&
(d_perpendicular < dial->pointer_width/2) &&
diff --git a/examples/helloworld/helloworld.c b/examples/helloworld/helloworld.c
index 64ac0f6bb..d956b6105 100644
--- a/examples/helloworld/helloworld.c
+++ b/examples/helloworld/helloworld.c
@@ -24,14 +24,14 @@ gint delete_event( GtkWidget *widget,
/* Change TRUE to FALSE and the main window will be destroyed with
* a "delete_event". */
- return(TRUE);
+ return TRUE;
}
/* Another callback */
void destroy( GtkWidget *widget,
gpointer data )
{
- gtk_main_quit();
+ gtk_main_quit ();
}
int main( int argc,
@@ -43,7 +43,7 @@ int main( int argc,
/* This is called in all GTK applications. Arguments are parsed
* from the command line and are returned to the application. */
- gtk_init(&argc, &argv);
+ gtk_init (&argc, &argv);
/* create a new window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -54,13 +54,13 @@ int main( int argc,
* as defined above. The data passed to the callback
* function is NULL and is ignored in the callback function. */
g_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (delete_event), NULL);
+ GTK_SIGNAL_FUNC (delete_event), NULL);
/* Here we connect the "destroy" event to a signal handler.
* This event occurs when we call gtk_widget_destroy() on the window,
* or if we return FALSE in the "delete_event" callback. */
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (destroy), NULL);
+ GTK_SIGNAL_FUNC (destroy), NULL);
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
@@ -72,14 +72,14 @@ int main( int argc,
* function hello() passing it NULL as its argument. The hello()
* function is defined above. */
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (hello), NULL);
+ GTK_SIGNAL_FUNC (hello), NULL);
/* This will cause the window to be destroyed by calling
* gtk_widget_destroy(window) when "clicked". Again, the destroy
* signal could come from here, or the window manager. */
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
+ GTK_SIGNAL_FUNC (gtk_widget_destroy),
+ GTK_OBJECT (window));
/* This packs the button into the window (a gtk container). */
gtk_container_add (GTK_CONTAINER (window), button);
diff --git a/examples/helloworld2/helloworld2.c b/examples/helloworld2/helloworld2.c
index 79bbd039d..6a55a33d0 100644
--- a/examples/helloworld2/helloworld2.c
+++ b/examples/helloworld2/helloworld2.c
@@ -14,8 +14,8 @@ gint delete_event( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
- gtk_main_quit();
- return(FALSE);
+ gtk_main_quit ();
+ return FALSE;
}
int main( int argc,
@@ -40,7 +40,7 @@ int main( int argc,
/* Here we just set a handler for delete_event that immediately
* exits GTK. */
g_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (delete_event), NULL);
+ GTK_SIGNAL_FUNC (delete_event), NULL);
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
@@ -48,7 +48,7 @@ int main( int argc,
/* We create a box to pack widgets into. This is described in detail
* in the "packing" section. The box is not really visible, it
* is just used as a tool to arrange widgets. */
- box1 = gtk_hbox_new(FALSE, 0);
+ box1 = gtk_hbox_new (FALSE, 0);
/* Put the box into the main window. */
gtk_container_add (GTK_CONTAINER (window), box1);
@@ -59,15 +59,15 @@ int main( int argc,
/* Now when the button is clicked, we call the "callback" function
* with a pointer to "button 1" as its argument */
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (callback), (gpointer) "button 1");
+ GTK_SIGNAL_FUNC (callback), (gpointer) "button 1");
/* Instead of gtk_container_add, we pack this button into the invisible
* box, which has been packed into the window. */
- gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX(box1), button, TRUE, TRUE, 0);
/* Always remember this step, this tells GTK that our preparation for
* this button is complete, and it can now be displayed. */
- gtk_widget_show(button);
+ gtk_widget_show (button);
/* Do these same steps again to create a second button */
button = gtk_button_new_with_label ("Button 2");
@@ -75,15 +75,15 @@ int main( int argc,
/* Call the same callback function with a different argument,
* passing a pointer to "button 2" instead. */
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (callback), (gpointer) "button 2");
+ GTK_SIGNAL_FUNC (callback), (gpointer) "button 2");
- gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX (box1), button, TRUE, TRUE, 0);
/* The order in which we show the buttons is not really important, but I
* recommend showing the window last, so it all pops up at once. */
- gtk_widget_show(button);
+ gtk_widget_show (button);
- gtk_widget_show(box1);
+ gtk_widget_show (box1);
gtk_widget_show (window);
diff --git a/examples/label/label.c b/examples/label/label.c
index 66420166a..7b5b41247 100644
--- a/examples/label/label.c
+++ b/examples/label/label.c
@@ -11,12 +11,12 @@ int main( int argc,
GtkWidget *label;
/* Initialise GTK */
- gtk_init(&argc, &argv);
+ gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gtk_main_quit),
- NULL);
+ GTK_SIGNAL_FUNC (gtk_main_quit),
+ NULL);
gtk_window_set_title (GTK_WINDOW (window), "Label");
vbox = gtk_vbox_new (FALSE, 5);
diff --git a/examples/list/list.c b/examples/list/list.c
index d797ae331..e56d1eb17 100644
--- a/examples/list/list.c
+++ b/examples/list/list.c
@@ -42,78 +42,78 @@ gint main( int argc,
/* Initialize GTK (and subsequently GDK) */
- gtk_init(&argc, &argv);
+ gtk_init (&argc, &argv);
/* Create a window to put all the widgets in
* connect gtk_main_quit() to the "destroy" event of
* the window to handle window manager close-window-events
*/
- window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window), "GtkList Example");
- g_signal_connect(GTK_OBJECT(window),
- "destroy",
- GTK_SIGNAL_FUNC(gtk_main_quit),
- NULL);
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title (GTK_WINDOW (window), "GtkList Example");
+ g_signal_connect (GTK_OBJECT (window),
+ "destroy",
+ GTK_SIGNAL_FUNC (gtk_main_quit),
+ NULL);
/* Inside the window we need a box to arrange the widgets
* vertically */
- vbox=gtk_vbox_new(FALSE, 5);
+ vbox=gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
- gtk_container_add(GTK_CONTAINER(window), vbox);
- gtk_widget_show(vbox);
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+ gtk_widget_show (vbox);
/* This is the scrolled window to put the List widget inside */
- scrolled_window=gtk_scrolled_window_new(NULL, NULL);
+ scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_size_request (scrolled_window, 250, 150);
- gtk_container_add(GTK_CONTAINER(vbox), scrolled_window);
- gtk_widget_show(scrolled_window);
+ gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
+ gtk_widget_show (scrolled_window);
/* Create thekList widget.
* Connect the sigh_print_selection() signal handler
* function to the "selection_changed" signal of the List
* to print out the selected items each time the selection
* has changed */
- gtklist=gtk_list_new();
- gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(scrolled_window),
+ gtklist=gtk_list_new ();
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
gtklist);
- gtk_widget_show(gtklist);
- gtk_signal_connect(GTK_OBJECT(gtklist),
- "selection_changed",
- GTK_SIGNAL_FUNC(sigh_print_selection),
- NULL);
+ gtk_widget_show (gtklist);
+ gtk_signal_connect (GTK_OBJECT (gtklist),
+ "selection_changed",
+ GTK_SIGNAL_FUNC (sigh_print_selection),
+ NULL);
/* We create a "Prison" to put a list item in ;) */
- frame=gtk_frame_new("Prison");
+ frame=gtk_frame_new ("Prison");
gtk_widget_set_size_request (frame, 200, 50);
gtk_container_set_border_width (GTK_CONTAINER (frame), 5);
- gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
- gtk_container_add(GTK_CONTAINER(vbox), frame);
- gtk_widget_show(frame);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
+ gtk_container_add (GTK_CONTAINER (vbox), frame);
+ gtk_widget_show (frame);
/* Connect the sigh_button_event() signal handler to the List
* which will handle the "arresting" of list items
*/
- gtk_signal_connect(GTK_OBJECT(gtklist),
- "button_release_event",
- GTK_SIGNAL_FUNC(sigh_button_event),
- frame);
+ gtk_signal_connect (GTK_OBJECT (gtklist),
+ "button_release_event",
+ GTK_SIGNAL_FUNC (sigh_button_event),
+ frame);
/* Create a separator */
- separator=gtk_hseparator_new();
- gtk_container_add(GTK_CONTAINER(vbox), separator);
- gtk_widget_show(separator);
+ separator=gtk_hseparator_new ();
+ gtk_container_add (GTK_CONTAINER (vbox), separator);
+ gtk_widget_show (separator);
/* Finally create a button and connect its "clicked" signal
* to the destruction of the window */
- button=gtk_button_new_with_label("Close");
- gtk_container_add(GTK_CONTAINER(vbox), button);
- gtk_widget_show(button);
- gtk_signal_connect_object(GTK_OBJECT(button),
- "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT(window));
+ button=gtk_button_new_with_label ("Close");
+ gtk_container_add (GTK_CONTAINER (vbox), button);
+ gtk_widget_show (button);
+ gtk_signal_connect_object (GTK_OBJECT (button),
+ "clicked",
+ GTK_SIGNAL_FUNC (gtk_widget_destroy),
+ GTK_OBJECT (window));
/* Now we create 5 list items, each having its own
@@ -121,21 +121,21 @@ gint main( int argc,
* Also we query the text string from the label and
* associate it with the list_item_data_key for each list item
*/
- for (i=0; i<5; i++) {
+ for (i = 0; i < 5; i++) {
GtkWidget *label;
gchar *string;
sprintf(buffer, "ListItemContainer with Label #%d", i);
- label=gtk_label_new(buffer);
- list_item=gtk_list_item_new();
- gtk_container_add(GTK_CONTAINER(list_item), label);
- gtk_widget_show(label);
- gtk_container_add(GTK_CONTAINER(gtklist), list_item);
- gtk_widget_show(list_item);
- gtk_label_get(GTK_LABEL(label), &string);
- gtk_object_set_data(GTK_OBJECT(list_item),
- list_item_data_key,
- string);
+ label=gtk_label_new (buffer);
+ list_item=gtk_list_item_new ();
+ gtk_container_add (GTK_CONTAINER (list_item), label);
+ gtk_widget_show (label);
+ gtk_container_add (GTK_CONTAINER (gtklist), list_item);
+ gtk_widget_show (list_item);
+ gtk_label_get (GTK_LABEL (label), &string);
+ gtk_object_set_data (GTK_OBJECT (list_item),
+ list_item_data_key,
+ string);
}
/* Here, we are creating another 5 labels, this time
* we use gtk_list_item_new_with_label() for the creation
@@ -150,28 +150,28 @@ gint main( int argc,
* doubly linked list, their order will be descending (instead
* of ascending when using g_list_append())
*/
- dlist=NULL;
- for (; i<10; i++) {
+ dlist = NULL;
+ for (; i < 10; i++) {
sprintf(buffer, "List Item with Label %d", i);
- list_item=gtk_list_item_new_with_label(buffer);
- dlist=g_list_prepend(dlist, list_item);
- gtk_widget_show(list_item);
- gtk_object_set_data(GTK_OBJECT(list_item),
- list_item_data_key,
- "ListItem with integrated Label");
+ list_item = gtk_list_item_new_with_label (buffer);
+ dlist = g_list_prepend (dlist, list_item);
+ gtk_widget_show (list_item);
+ gtk_object_set_data (GTK_OBJECT (list_item),
+ list_item_data_key,
+ "ListItem with integrated Label");
}
- gtk_list_append_items(GTK_LIST(gtklist), dlist);
+ gtk_list_append_items (GTK_LIST (gtklist), dlist);
/* Finally we want to see the window, don't we? ;) */
- gtk_widget_show(window);
+ gtk_widget_show (window);
/* Fire up the main event loop of gtk */
- gtk_main();
+ gtk_main ();
/* We get here after gtk_main_quit() has been called which
* happens if the main window gets destroyed
*/
- return(0);
+ return 0;
}
/* This is the signal handler that got connected to button
@@ -184,37 +184,37 @@ void sigh_button_event( GtkWidget *gtklist,
/* We only do something if the third (rightmost mouse button
* was released
*/
- if (event->type==GDK_BUTTON_RELEASE &&
- event->button==3) {
+ if (event->type == GDK_BUTTON_RELEASE &&
+ event->button == 3) {
GList *dlist, *free_list;
GtkWidget *new_prisoner;
/* Fetch the currently selected list item which
* will be our next prisoner ;)
*/
- dlist=GTK_LIST(gtklist)->selection;
+ dlist = GTK_LIST (gtklist)->selection;
if (dlist)
- new_prisoner=GTK_WIDGET(dlist->data);
+ new_prisoner = GTK_WIDGET (dlist->data);
else
- new_prisoner=NULL;
+ new_prisoner = NULL;
/* Look for already imprisoned list items, we
* will put them back into the list.
* Remember to free the doubly linked list that
* gtk_container_children() returns
*/
- dlist=gtk_container_children(GTK_CONTAINER(frame));
- free_list=dlist;
+ dlist = gtk_container_children (GTK_CONTAINER (frame));
+ free_list = dlist;
while (dlist) {
GtkWidget *list_item;
- list_item=dlist->data;
+ list_item = dlist->data;
- gtk_widget_reparent(list_item, gtklist);
+ gtk_widget_reparent (list_item, gtklist);
- dlist=dlist->next;
+ dlist = dlist->next;
}
- g_list_free(free_list);
+ g_list_free (free_list);
/* If we have a new prisoner, remove him from the
* List and put him into the frame "Prison".
@@ -223,13 +223,13 @@ void sigh_button_event( GtkWidget *gtklist,
if (new_prisoner) {
GList static_dlist;
- static_dlist.data=new_prisoner;
- static_dlist.next=NULL;
- static_dlist.prev=NULL;
+ static_dlist.data = new_prisoner;
+ static_dlist.next = NULL;
+ static_dlist.prev = NULL;
- gtk_list_unselect_child(GTK_LIST(gtklist),
- new_prisoner);
- gtk_widget_reparent(new_prisoner, frame);
+ gtk_list_unselect_child (GTK_LIST (gtklist),
+ new_prisoner);
+ gtk_widget_reparent (new_prisoner, frame);
}
}
}
@@ -245,18 +245,18 @@ void sigh_print_selection( GtkWidget *gtklist,
/* Fetch the doubly linked list of selected items
* of the List, remember to treat this as read-only!
*/
- dlist=GTK_LIST(gtklist)->selection;
+ dlist = GTK_LIST (gtklist)->selection;
/* If there are no selected items there is nothing more
* to do than just telling the user so
*/
if (!dlist) {
- g_print("Selection cleared\n");
+ g_print ("Selection cleared\n");
return;
}
/* Ok, we got a selection and so we print it
*/
- g_print("The selection is a ");
+ g_print ("The selection is a ");
/* Get the list item from the doubly linked list
* and then query the data associated with list_item_data_key.
@@ -265,12 +265,12 @@ void sigh_print_selection( GtkWidget *gtklist,
GtkObject *list_item;
gchar *item_data_string;
- list_item=GTK_OBJECT(dlist->data);
- item_data_string=g_object_get_data(G_OBJECT (list_item),
- list_item_data_key);
+ list_item = GTK_OBJECT (dlist->data);
+ item_data_string = g_object_get_data (G_OBJECT (list_item),
+ list_item_data_key);
g_print("%s ", item_data_string);
-
- dlist=dlist->next;
+
+ dlist = dlist->next;
}
- g_print("\n");
+ g_print ("\n");
}
diff --git a/examples/menu/itemfactory.c b/examples/menu/itemfactory.c
index e8932f37c..19c84a903 100644
--- a/examples/menu/itemfactory.c
+++ b/examples/menu/itemfactory.c
@@ -91,9 +91,9 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (gtk_main_quit),
- "WM destroy");
- gtk_window_set_title (GTK_WINDOW(window), "Item Factory");
+ GTK_SIGNAL_FUNC (gtk_main_quit),
+ "WM destroy");
+ gtk_window_set_title (GTK_WINDOW (window), "Item Factory");
gtk_widget_set_size_request (GTK_WIDGET (window), 300, 200);
main_vbox = gtk_vbox_new (FALSE, 1);
@@ -106,6 +106,7 @@ int main( int argc,
gtk_widget_show (menubar);
gtk_widget_show (window);
+
gtk_main ();
return 0;
diff --git a/examples/menu/menu.c b/examples/menu/menu.c
index c8479097c..2511cde04 100644
--- a/examples/menu/menu.c
+++ b/examples/menu/menu.c
@@ -26,7 +26,7 @@ int main( int argc,
gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
gtk_window_set_title (GTK_WINDOW (window), "GTK Menu Test");
g_signal_connect (GTK_OBJECT (window), "delete_event",
- (GtkSignalFunc) gtk_main_quit, NULL);
+ GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
/* Init the menu-widget, and remember -- never
* gtk_show_widget() the menu widget!!
@@ -53,7 +53,8 @@ int main( int argc,
/* Do something interesting when the menuitem is selected */
g_signal_connect_swapped (GTK_OBJECT (menu_items), "activate",
- GTK_SIGNAL_FUNC (menuitem_response), (gpointer) g_strdup (buf));
+ GTK_SIGNAL_FUNC (menuitem_response),
+ (gpointer) g_strdup (buf));
/* Show the widget */
gtk_widget_show (menu_items);
@@ -83,7 +84,8 @@ int main( int argc,
/* Create a button to which to attach menu as a popup */
button = gtk_button_new_with_label ("press me");
g_signal_connect_swapped (GTK_OBJECT (button), "event",
- GTK_SIGNAL_FUNC (button_press), GTK_OBJECT (menu));
+ GTK_SIGNAL_FUNC (button_press),
+ GTK_OBJECT (menu));
gtk_box_pack_end (GTK_BOX (vbox), button, TRUE, TRUE, 2);
gtk_widget_show (button);
diff --git a/examples/notebook/notebook.c b/examples/notebook/notebook.c
index 3a5808fcb..8d55d478a 100644
--- a/examples/notebook/notebook.c
+++ b/examples/notebook/notebook.c
@@ -6,7 +6,7 @@
void rotate_book( GtkButton *button,
GtkNotebook *notebook )
{
- gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos +1) %4);
+ gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos + 1) % 4);
}
/* Add/Remove the page tabs and the borders */
@@ -30,7 +30,7 @@ void remove_book( GtkButton *button,
{
gint page;
- page = gtk_notebook_get_current_page(notebook);
+ page = gtk_notebook_get_current_page (notebook);
gtk_notebook_remove_page (notebook, page);
/* Need to refresh the widget --
This forces the widget to redraw itself. */
@@ -64,23 +64,23 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (delete), NULL);
+ GTK_SIGNAL_FUNC (delete), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
- table = gtk_table_new(3,6,FALSE);
+ table = gtk_table_new (3, 6, FALSE);
gtk_container_add (GTK_CONTAINER (window), table);
/* Create a new notebook, place the position of the tabs */
notebook = gtk_notebook_new ();
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
- gtk_table_attach_defaults(GTK_TABLE(table), notebook, 0,6,0,1);
- gtk_widget_show(notebook);
+ gtk_table_attach_defaults (GTK_TABLE (table), notebook, 0, 6, 0, 1);
+ gtk_widget_show (notebook);
/* Let's append a bunch of pages to the notebook */
- for (i=0; i < 5; i++) {
- sprintf(bufferf, "Append Frame %d", i+1);
- sprintf(bufferl, "Page %d", i+1);
+ for (i = 0; i < 5; i++) {
+ sprintf(bufferf, "Append Frame %d", i + 1);
+ sprintf(bufferl, "Page %d", i + 1);
frame = gtk_frame_new (bufferf);
gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
@@ -104,9 +104,9 @@ int main( int argc,
gtk_notebook_insert_page (GTK_NOTEBOOK (notebook), checkbutton, label, 2);
/* Now finally let's prepend pages to the notebook */
- for (i=0; i < 5; i++) {
- sprintf(bufferf, "Prepend Frame %d", i+1);
- sprintf(bufferl, "PPage %d", i+1);
+ for (i = 0; i < 5; i++) {
+ sprintf (bufferf, "Prepend Frame %d", i + 1);
+ sprintf (bufferl, "PPage %d", i + 1);
frame = gtk_frame_new (bufferf);
gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
@@ -118,56 +118,56 @@ int main( int argc,
gtk_widget_show (label);
label = gtk_label_new (bufferl);
- gtk_notebook_prepend_page (GTK_NOTEBOOK(notebook), frame, label);
+ gtk_notebook_prepend_page (GTK_NOTEBOOK (notebook), frame, label);
}
/* Set what page to start at (page 4) */
- gtk_notebook_set_current_page (GTK_NOTEBOOK(notebook), 3);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 3);
/* Create a bunch of buttons */
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (delete), NULL);
- gtk_table_attach_defaults(GTK_TABLE(table), button, 0,1,1,2);
- gtk_widget_show(button);
+ GTK_SIGNAL_FUNC (delete), NULL);
+ gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 1, 2);
+ gtk_widget_show (button);
button = gtk_button_new_with_label ("next page");
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_notebook_next_page),
- GTK_OBJECT (notebook));
- gtk_table_attach_defaults(GTK_TABLE(table), button, 1,2,1,2);
- gtk_widget_show(button);
+ GTK_SIGNAL_FUNC (gtk_notebook_next_page),
+ GTK_OBJECT (notebook));
+ gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 1, 2);
+ gtk_widget_show (button);
button = gtk_button_new_with_label ("prev page");
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_notebook_prev_page),
- GTK_OBJECT (notebook));
- gtk_table_attach_defaults(GTK_TABLE(table), button, 2,3,1,2);
- gtk_widget_show(button);
+ GTK_SIGNAL_FUNC (gtk_notebook_prev_page),
+ GTK_OBJECT (notebook));
+ gtk_table_attach_defaults (GTK_TABLE (table), button, 2, 3, 1, 2);
+ gtk_widget_show (button);
button = gtk_button_new_with_label ("tab position");
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (rotate_book),
- GTK_OBJECT(notebook));
- gtk_table_attach_defaults(GTK_TABLE(table), button, 3,4,1,2);
- gtk_widget_show(button);
+ GTK_SIGNAL_FUNC (rotate_book),
+ GTK_OBJECT(notebook));
+ gtk_table_attach_defaults (GTK_TABLE (table), button, 3, 4, 1, 2);
+ gtk_widget_show (button);
button = gtk_button_new_with_label ("tabs/border on/off");
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (tabsborder_book),
- GTK_OBJECT (notebook));
- gtk_table_attach_defaults(GTK_TABLE(table), button, 4,5,1,2);
- gtk_widget_show(button);
+ GTK_SIGNAL_FUNC (tabsborder_book),
+ GTK_OBJECT (notebook));
+ gtk_table_attach_defaults (GTK_TABLE (table), button, 4, 5, 1, 2);
+ gtk_widget_show (button);
button = gtk_button_new_with_label ("remove page");
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (remove_book),
- GTK_OBJECT(notebook));
- gtk_table_attach_defaults(GTK_TABLE(table), button, 5,6,1,2);
- gtk_widget_show(button);
+ GTK_SIGNAL_FUNC (remove_book),
+ GTK_OBJECT (notebook));
+ gtk_table_attach_defaults (GTK_TABLE (table), button, 5, 6, 1, 2);
+ gtk_widget_show (button);
- gtk_widget_show(table);
- gtk_widget_show(window);
+ gtk_widget_show (table);
+ gtk_widget_show (window);
gtk_main ();
diff --git a/examples/packbox/packbox.c b/examples/packbox/packbox.c
index ed7fa7219..9621a57ba 100644
--- a/examples/packbox/packbox.c
+++ b/examples/packbox/packbox.c
@@ -7,7 +7,7 @@ gint delete_event( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
- gtk_main_quit();
+ gtk_main_quit ();
return FALSE;
}
@@ -96,7 +96,7 @@ int main( int argc,
* to the main window. This is very important for proper intuitive
* behavior */
g_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (delete_event), NULL);
+ GTK_SIGNAL_FUNC (delete_event), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* We create a vertical box (vbox) to pack the horizontal boxes into.
@@ -260,8 +260,8 @@ int main( int argc,
/* Setup the signal to terminate the program when the button is clicked */
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_main_quit),
- GTK_OBJECT (window));
+ GTK_SIGNAL_FUNC (gtk_main_quit),
+ GTK_OBJECT (window));
/* Pack the button into the quitbox.
* The last 3 arguments to gtk_box_pack_start are:
* expand, fill, padding. */
diff --git a/examples/paned/paned.c b/examples/paned/paned.c
index cd3beb819..24ad1f1b3 100644
--- a/examples/paned/paned.c
+++ b/examples/paned/paned.c
@@ -110,7 +110,7 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Paned Windows");
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+ GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_widget_set_size_request (GTK_WIDGET (window), 450, 400);
@@ -130,6 +130,8 @@ int main( int argc,
gtk_paned_add2 (GTK_PANED (vpaned), text);
gtk_widget_show (text);
gtk_widget_show (window);
+
gtk_main ();
+
return 0;
}
diff --git a/examples/pixmap/pixmap.c b/examples/pixmap/pixmap.c
index 71af08e58..97c7e83ac 100644
--- a/examples/pixmap/pixmap.c
+++ b/examples/pixmap/pixmap.c
@@ -32,8 +32,8 @@ gint close_application( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
- gtk_main_quit();
- return(FALSE);
+ gtk_main_quit ();
+ return FALSE;
}
@@ -41,7 +41,7 @@ gint close_application( GtkWidget *widget,
*/
void button_clicked( GtkWidget *widget,
gpointer data ) {
- g_print( "button clicked\n" );
+ g_print ("button clicked\n");
}
int main( int argc,
@@ -55,31 +55,31 @@ int main( int argc,
/* create the main window, and attach delete_event signal to terminating
the application */
- gtk_init( &argc, &argv );
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_signal_connect( GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (close_application), NULL );
- gtk_container_set_border_width( GTK_CONTAINER (window), 10 );
- gtk_widget_show( window );
+ gtk_init (&argc, &argv);
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_signal_connect (GTK_OBJECT (window), "delete_event",
+ GTK_SIGNAL_FUNC (close_application), NULL);
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+ gtk_widget_show (window);
/* now for the pixmap from gdk */
- style = gtk_widget_get_style( window );
- pixmap = gdk_pixmap_create_from_xpm_d( window->window, &mask,
+ style = gtk_widget_get_style (window);
+ pixmap = gdk_pixmap_create_from_xpm_d (window->window, &mask,
&style->bg[GTK_STATE_NORMAL],
- (gchar **)xpm_data );
+ (gchar **)xpm_data);
/* a pixmap widget to contain the pixmap */
- pixmapwid = gtk_pixmap_new( pixmap, mask );
- gtk_widget_show( pixmapwid );
+ pixmapwid = gtk_pixmap_new (pixmap, mask);
+ gtk_widget_show (pixmapwid);
/* a button to contain the pixmap widget */
- button = gtk_button_new();
- gtk_container_add( GTK_CONTAINER(button), pixmapwid );
- gtk_container_add( GTK_CONTAINER(window), button );
- gtk_widget_show( button );
+ button = gtk_button_new ();
+ gtk_container_add (GTK_CONTAINER (button), pixmapwid);
+ gtk_container_add (GTK_CONTAINER (window), button);
+ gtk_widget_show (button);
- gtk_signal_connect( GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC(button_clicked), NULL );
+ g_signal_connect (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC (button_clicked), NULL);
/* show the window */
gtk_main ();
diff --git a/examples/progressbar/progressbar.c b/examples/progressbar/progressbar.c
index 089df1404..eac838507 100644
--- a/examples/progressbar/progressbar.c
+++ b/examples/progressbar/progressbar.c
@@ -17,7 +17,7 @@ gint progress_timeout( gpointer data )
/* Calculate the value of the progress bar using the
* value range set in the adjustment object */
- new_val = gtk_progress_get_value( GTK_PROGRESS(data) ) + 1;
+ new_val = gtk_progress_get_value (GTK_PROGRESS (data)) + 1;
adj = GTK_PROGRESS (data)->adjustment;
if (new_val > adj->upper)
@@ -74,8 +74,8 @@ void destroy_progress( GtkWidget *widget,
gtk_timeout_remove (pdata->timer);
pdata->timer = 0;
pdata->window = NULL;
- g_free(pdata);
- gtk_main_quit();
+ g_free (pdata);
+ gtk_main_quit ();
}
int main( int argc,
@@ -92,27 +92,27 @@ int main( int argc,
gtk_init (&argc, &argv);
- /* Allocate memory for the data that is passwd to the callbacks */
- pdata = g_malloc( sizeof(ProgressData) );
+ /* Allocate memory for the data that is passed to the callbacks */
+ pdata = g_malloc (sizeof (ProgressData));
pdata->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_resizable (GTK_WINDOW (pdata->window), TRUE);
g_signal_connect (GTK_OBJECT (pdata->window), "destroy",
- GTK_SIGNAL_FUNC (destroy_progress),
- pdata);
+ GTK_SIGNAL_FUNC (destroy_progress),
+ pdata);
gtk_window_set_title (GTK_WINDOW (pdata->window), "GtkProgressBar");
gtk_container_set_border_width (GTK_CONTAINER (pdata->window), 0);
vbox = gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
gtk_container_add (GTK_CONTAINER (pdata->window), vbox);
- gtk_widget_show(vbox);
+ gtk_widget_show (vbox);
/* Create a centering alignment object */
align = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 5);
- gtk_widget_show(align);
+ gtk_widget_show (align);
/* Create a Adjusment object to hold the range of the
* progress bar */
@@ -130,19 +130,19 @@ int main( int argc,
gtk_progress_set_format_string (GTK_PROGRESS (pdata->pbar),
"%v from [%l-%u] (=%p%%)");
gtk_container_add (GTK_CONTAINER (align), pdata->pbar);
- gtk_widget_show(pdata->pbar);
+ gtk_widget_show (pdata->pbar);
/* Add a timer callback to update the value of the progress bar */
pdata->timer = gtk_timeout_add (100, progress_timeout, pdata->pbar);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
- gtk_widget_show(separator);
+ gtk_widget_show (separator);
/* rows, columns, homogeneous */
table = gtk_table_new (2, 3, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
- gtk_widget_show(table);
+ gtk_widget_show (table);
/* Add a check button to select displaying of the trough text */
check = gtk_check_button_new_with_label ("Show text");
@@ -150,9 +150,9 @@ int main( int argc,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
g_signal_connect (GTK_OBJECT (check), "clicked",
- GTK_SIGNAL_FUNC (toggle_show_text),
- pdata);
- gtk_widget_show(check);
+ GTK_SIGNAL_FUNC (toggle_show_text),
+ pdata);
+ gtk_widget_show (check);
/* Add a check button to toggle activity mode */
check = gtk_check_button_new_with_label ("Activity mode");
@@ -160,15 +160,15 @@ int main( int argc,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
g_signal_connect (GTK_OBJECT (check), "clicked",
- GTK_SIGNAL_FUNC (toggle_activity_mode),
- pdata);
- gtk_widget_show(check);
+ GTK_SIGNAL_FUNC (toggle_activity_mode),
+ pdata);
+ gtk_widget_show (check);
separator = gtk_vseparator_new ();
gtk_table_attach (GTK_TABLE (table), separator, 1, 2, 0, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
- gtk_widget_show(separator);
+ gtk_widget_show (separator);
/* Add a radio button to select continuous display mode */
button = gtk_radio_button_new_with_label (NULL, "Continuous");
@@ -176,8 +176,8 @@ int main( int argc,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (set_continuous_mode),
- pdata);
+ GTK_SIGNAL_FUNC (set_continuous_mode),
+ pdata);
gtk_widget_show (button);
/* Add a radio button to select discrete display mode */
@@ -188,19 +188,19 @@ int main( int argc,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (set_discrete_mode),
- pdata);
+ GTK_SIGNAL_FUNC (set_discrete_mode),
+ pdata);
gtk_widget_show (button);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
- gtk_widget_show(separator);
+ gtk_widget_show (separator);
/* Add a button to exit the program */
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_widget_destroy,
- GTK_OBJECT (pdata->window));
+ GTK_SIGNAL_FUNC (gtk_widget_destroy),
+ GTK_OBJECT (pdata->window));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
/* This makes it so the button is the default. */
@@ -209,7 +209,7 @@ int main( int argc,
/* This grabs this button to be the default button. Simply hitting
* the "Enter" key will cause this button to activate. */
gtk_widget_grab_default (button);
- gtk_widget_show(button);
+ gtk_widget_show (button);
gtk_widget_show (pdata->window);
diff --git a/examples/radiobuttons/radiobuttons.c b/examples/radiobuttons/radiobuttons.c
index 15399ba19..22e7301d4 100644
--- a/examples/radiobuttons/radiobuttons.c
+++ b/examples/radiobuttons/radiobuttons.c
@@ -6,7 +6,7 @@ gint close_application( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
- gtk_main_quit();
+ gtk_main_quit ();
return FALSE;
}
@@ -20,13 +20,13 @@ int main( int argc,
GtkWidget *separator;
GSList *group;
- gtk_init(&argc,&argv);
+ gtk_init (&argc,&argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(close_application),
- NULL);
+ GTK_SIGNAL_FUNC (close_application),
+ NULL);
gtk_window_set_title (GTK_WINDOW (window), "radio buttons");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
@@ -45,7 +45,7 @@ int main( int argc,
gtk_widget_show (button);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
- button = gtk_radio_button_new_with_label(group, "button2");
+ button = gtk_radio_button_new_with_label (group, "button2");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
gtk_widget_show (button);
@@ -67,15 +67,15 @@ int main( int argc,
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(close_application),
- GTK_OBJECT (window));
+ GTK_SIGNAL_FUNC (close_application),
+ GTK_OBJECT (window));
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
gtk_widget_show (button);
gtk_widget_show (window);
- gtk_main();
+ gtk_main ();
return 0;
}
diff --git a/examples/rangewidgets/rangewidgets.c b/examples/rangewidgets/rangewidgets.c
index 4c38e8c30..5f0450bd4 100644
--- a/examples/rangewidgets/rangewidgets.c
+++ b/examples/rangewidgets/rangewidgets.c
@@ -33,6 +33,11 @@ void cb_page_size( GtkAdjustment *get,
* adjustment to the value specified by the "Page Size" scale */
set->page_size = get->value;
set->page_increment = get->value;
+
+ gtk_adjustment_set_value (set, CLAMP (set->value,
+ set->lower,
+ (set->upper - set->page_size)));
+
/* Now emit the "changed" signal to reconfigure all the widgets that
* are attached to this adjustment */
g_signal_emit_by_name (GTK_OBJECT (set), "changed");
@@ -56,7 +61,7 @@ GtkWidget *make_menu_item( gchar *name,
item = gtk_menu_item_new_with_label (name);
g_signal_connect (GTK_OBJECT (item), "activate",
- callback, data);
+ callback, data);
gtk_widget_show (item);
return item;
@@ -88,8 +93,8 @@ void create_range_controls( void )
/* Standard window-creating stuff */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gtk_main_quit),
- NULL);
+ GTK_SIGNAL_FUNC (gtk_main_quit),
+ NULL);
gtk_window_set_title (GTK_WINDOW (window), "range controls");
box1 = gtk_vbox_new (FALSE, 0);
@@ -118,7 +123,7 @@ void create_range_controls( void )
/* Reuse the same adjustment */
hscale = gtk_hscale_new (GTK_ADJUSTMENT (adj1));
- gtk_widget_set_size_request (GTK_WIDGET (hscale), 200, 30);
+ gtk_widget_set_size_request (GTK_WIDGET (hscale), 200, -1);
scale_set_default_values (GTK_SCALE (hscale));
gtk_box_pack_start (GTK_BOX (box3), hscale, TRUE, TRUE, 0);
gtk_widget_show (hscale);
@@ -141,7 +146,7 @@ void create_range_controls( void )
button = gtk_check_button_new_with_label("Display value on scale widgets");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_signal_connect (GTK_OBJECT (button), "toggled",
- GTK_SIGNAL_FUNC(cb_draw_value), NULL);
+ GTK_SIGNAL_FUNC (cb_draw_value), NULL);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
gtk_widget_show (button);
@@ -153,11 +158,11 @@ void create_range_controls( void )
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
- opt = gtk_option_menu_new();
- menu = gtk_menu_new();
+ opt = gtk_option_menu_new ();
+ menu = gtk_menu_new ();
item = make_menu_item ("Top",
- GTK_SIGNAL_FUNC(cb_pos_menu_select),
+ GTK_SIGNAL_FUNC (cb_pos_menu_select),
GINT_TO_POINTER (GTK_POS_TOP));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
@@ -170,7 +175,7 @@ void create_range_controls( void )
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
item = make_menu_item ("Right", GTK_SIGNAL_FUNC (cb_pos_menu_select),
- GINT_TO_POINTER (GTK_POS_RIGHT));
+ GINT_TO_POINTER (GTK_POS_RIGHT));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu);
@@ -189,8 +194,8 @@ void create_range_controls( void )
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
- opt = gtk_option_menu_new();
- menu = gtk_menu_new();
+ opt = gtk_option_menu_new ();
+ menu = gtk_menu_new ();
item = make_menu_item ("Continuous",
GTK_SIGNAL_FUNC (cb_update_menu_select),
@@ -198,8 +203,8 @@ void create_range_controls( void )
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
item = make_menu_item ("Discontinuous",
- GTK_SIGNAL_FUNC (cb_update_menu_select),
- GINT_TO_POINTER (GTK_UPDATE_DISCONTINUOUS));
+ GTK_SIGNAL_FUNC (cb_update_menu_select),
+ GINT_TO_POINTER (GTK_UPDATE_DISCONTINUOUS));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
item = make_menu_item ("Delayed",
@@ -225,7 +230,7 @@ void create_range_controls( void )
adj2 = gtk_adjustment_new (1.0, 0.0, 5.0, 1.0, 1.0, 0.0);
g_signal_connect (GTK_OBJECT (adj2), "value_changed",
- GTK_SIGNAL_FUNC (cb_digits_scale), NULL);
+ GTK_SIGNAL_FUNC (cb_digits_scale), NULL);
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2));
gtk_scale_set_digits (GTK_SCALE (scale), 0);
gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0);
@@ -245,7 +250,7 @@ void create_range_controls( void )
adj2 = gtk_adjustment_new (1.0, 1.0, 101.0, 1.0, 1.0, 0.0);
g_signal_connect (GTK_OBJECT (adj2), "value_changed",
- GTK_SIGNAL_FUNC (cb_page_size), adj1);
+ GTK_SIGNAL_FUNC (cb_page_size), adj1);
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2));
gtk_scale_set_digits (GTK_SCALE (scale), 0);
gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0);
@@ -265,8 +270,8 @@ void create_range_controls( void )
button = gtk_button_new_with_label ("Quit");
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_main_quit),
- NULL);
+ GTK_SIGNAL_FUNC (gtk_main_quit),
+ NULL);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
@@ -278,11 +283,11 @@ void create_range_controls( void )
int main( int argc,
char *argv[] )
{
- gtk_init(&argc, &argv);
+ gtk_init (&argc, &argv);
- create_range_controls();
+ create_range_controls ();
- gtk_main();
+ gtk_main ();
return 0;
}
diff --git a/examples/rulers/rulers.c b/examples/rulers/rulers.c
index f001e9f82..bb216a353 100644
--- a/examples/rulers/rulers.c
+++ b/examples/rulers/rulers.c
@@ -11,7 +11,7 @@ gint close_application( GtkWidget *widget,
GdkEvent *event,
gpointer data )
{
- gtk_main_quit();
+ gtk_main_quit ();
return FALSE;
}
@@ -21,57 +21,55 @@ int main( int argc,
GtkWidget *window, *table, *area, *hrule, *vrule;
/* Initialize GTK and create the main window */
- gtk_init( &argc, &argv );
+ gtk_init (&argc, &argv);
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC( close_application ), NULL);
+ GTK_SIGNAL_FUNC (close_application), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Create a table for placing the ruler and the drawing area */
- table = gtk_table_new( 3, 2, FALSE );
- gtk_container_add( GTK_CONTAINER(window), table );
+ table = gtk_table_new (3, 2, FALSE);
+ gtk_container_add (GTK_CONTAINER (window), table);
- area = gtk_drawing_area_new();
+ area = gtk_drawing_area_new ();
gtk_widget_set_size_request (GTK_WIDGET (area), XSIZE, YSIZE);
- gtk_table_attach( GTK_TABLE(table), area, 1, 2, 1, 2,
- GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0 );
- gtk_widget_set_events( area, GDK_POINTER_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK );
+ gtk_table_attach (GTK_TABLE (table), area, 1, 2, 1, 2,
+ GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_set_events (area, GDK_POINTER_MOTION_MASK |
+ GDK_POINTER_MOTION_HINT_MASK);
/* The horizontal ruler goes on top. As the mouse moves across the
* drawing area, a motion_notify_event is passed to the
* appropriate event handler for the ruler. */
- hrule = gtk_hruler_new();
- gtk_ruler_set_metric( GTK_RULER(hrule), GTK_PIXELS );
- gtk_ruler_set_range( GTK_RULER(hrule), 7, 13, 0, 20 );
- g_signal_connect_swapped( GTK_OBJECT(area), "motion_notify_event",
- (GtkSignalFunc)EVENT_METHOD(hrule,
- motion_notify_event),
- GTK_OBJECT(hrule) );
- gtk_table_attach( GTK_TABLE(table), hrule, 1, 2, 0, 1,
- GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0 );
+ hrule = gtk_hruler_new ();
+ gtk_ruler_set_metric (GTK_RULER (hrule), GTK_PIXELS);
+ gtk_ruler_set_range (GTK_RULER (hrule), 7, 13, 0, 20);
+ g_signal_connect_swapped (GTK_OBJECT (area), "motion_notify_event",
+ GTK_SIGNAL_FUNC (EVENT_METHOD (hrule, motion_notify_event)),
+ GTK_OBJECT (hrule));
+ gtk_table_attach (GTK_TABLE (table), hrule, 1, 2, 0, 1,
+ GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0);
/* The vertical ruler goes on the left. As the mouse moves across
* the drawing area, a motion_notify_event is passed to the
* appropriate event handler for the ruler. */
- vrule = gtk_vruler_new();
- gtk_ruler_set_metric( GTK_RULER(vrule), GTK_PIXELS );
- gtk_ruler_set_range( GTK_RULER(vrule), 0, YSIZE, 10, YSIZE );
- g_signal_connect_swapped( GTK_OBJECT(area), "motion_notify_event",
- (GtkSignalFunc)EVENT_METHOD(vrule,
- motion_notify_event),
- GTK_OBJECT(vrule) );
- gtk_table_attach( GTK_TABLE(table), vrule, 0, 1, 1, 2,
- GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0 );
+ vrule = gtk_vruler_new ();
+ gtk_ruler_set_metric (GTK_RULER (vrule), GTK_PIXELS);
+ gtk_ruler_set_range (GTK_RULER (vrule), 0, YSIZE, 10, YSIZE );
+ g_signal_connect_swapped (GTK_OBJECT (area), "motion_notify_event",
+ GTK_SIGNAL_FUNC (EVENT_METHOD (vrule, motion_notify_event)),
+ GTK_OBJECT (vrule));
+ gtk_table_attach (GTK_TABLE (table), vrule, 0, 1, 1, 2,
+ GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0);
/* Now show everything */
- gtk_widget_show( area );
- gtk_widget_show( hrule );
- gtk_widget_show( vrule );
- gtk_widget_show( table );
- gtk_widget_show( window );
- gtk_main();
+ gtk_widget_show (area);
+ gtk_widget_show (hrule);
+ gtk_widget_show (vrule);
+ gtk_widget_show (table);
+ gtk_widget_show (window);
+ gtk_main ();
return 0;
}
diff --git a/examples/scribble-simple/scribble-simple.c b/examples/scribble-simple/scribble-simple.c
index 481c67058..8af153b6e 100644
--- a/examples/scribble-simple/scribble-simple.c
+++ b/examples/scribble-simple/scribble-simple.c
@@ -28,12 +28,12 @@ static gint configure_event( GtkWidget *widget,
GdkEventConfigure *event )
{
if (pixmap)
- g_object_unref(pixmap);
+ g_object_unref (pixmap);
- pixmap = gdk_pixmap_new(widget->window,
- widget->allocation.width,
- widget->allocation.height,
- -1);
+ pixmap = gdk_pixmap_new (widget->window,
+ widget->allocation.width,
+ widget->allocation.height,
+ -1);
gdk_draw_rectangle (pixmap,
widget->style->white_gc,
TRUE,
@@ -48,12 +48,12 @@ static gint configure_event( GtkWidget *widget,
static gint expose_event( GtkWidget *widget,
GdkEventExpose *event )
{
- gdk_draw_drawable(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
- pixmap,
- event->area.x, event->area.y,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
+ gdk_draw_drawable (widget->window,
+ widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+ pixmap,
+ event->area.x, event->area.y,
+ event->area.x, event->area.y,
+ event->area.width, event->area.height);
return FALSE;
}
@@ -146,16 +146,16 @@ int main( int argc,
/* Signals used to handle backing pixmap */
g_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
- (GtkSignalFunc) expose_event, NULL);
- g_signal_connect (GTK_OBJECT(drawing_area),"configure_event",
- (GtkSignalFunc) configure_event, NULL);
+ GTK_SIGNAL_FUNC (expose_event), NULL);
+ g_signal_connect (GTK_OBJECT (drawing_area),"configure_event",
+ GTK_SIGNAL_FUNC (configure_event), NULL);
/* Event signals */
g_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event",
- (GtkSignalFunc) motion_notify_event, NULL);
+ GTK_SIGNAL_FUNC (motion_notify_event), NULL);
g_signal_connect (GTK_OBJECT (drawing_area), "button_press_event",
- (GtkSignalFunc) button_press_event, NULL);
+ GTK_SIGNAL_FUNC (button_press_event), NULL);
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
| GDK_LEAVE_NOTIFY_MASK
@@ -168,8 +168,8 @@ int main( int argc,
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
+ GTK_SIGNAL_FUNC (gtk_widget_destroy),
+ GTK_OBJECT (window));
gtk_widget_show (button);
gtk_widget_show (window);
diff --git a/examples/scribble-xinput/scribble-xinput.c b/examples/scribble-xinput/scribble-xinput.c
index 3519b6249..0ef6411cb 100644
--- a/examples/scribble-xinput/scribble-xinput.c
+++ b/examples/scribble-xinput/scribble-xinput.c
@@ -28,12 +28,12 @@ static gint
configure_event (GtkWidget *widget, GdkEventConfigure *event)
{
if (pixmap)
- g_object_unref(pixmap);
+ g_object_unref (pixmap);
- pixmap = gdk_pixmap_new(widget->window,
- widget->allocation.width,
- widget->allocation.height,
- -1);
+ pixmap = gdk_pixmap_new (widget->window,
+ widget->allocation.width,
+ widget->allocation.height,
+ -1);
gdk_draw_rectangle (pixmap,
widget->style->white_gc,
TRUE,
@@ -48,12 +48,12 @@ configure_event (GtkWidget *widget, GdkEventConfigure *event)
static gint
expose_event (GtkWidget *widget, GdkEventExpose *event)
{
- gdk_draw_drawable(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
- pixmap,
- event->area.x, event->area.y,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
+ gdk_draw_drawable (widget->window,
+ widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+ pixmap,
+ event->area.x, event->area.y,
+ event->area.x, event->area.y,
+ event->area.width, event->area.height);
return FALSE;
}
@@ -97,7 +97,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
static void
print_button_press (GdkDevice *device)
{
- g_print("Button press on device '%s'\n", device->name);
+ g_print ("Button press on device '%s'\n", device->name);
}
static gint
@@ -157,22 +157,22 @@ create_input_dialog ()
{
inputd = gtk_input_dialog_new();
- g_signal_connect (GTK_OBJECT(inputd), "destroy",
- (GtkSignalFunc)input_dialog_destroy, &inputd);
- g_signal_connect_swapped (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->close_button),
- "clicked",
- (GtkSignalFunc)gtk_widget_hide,
- GTK_OBJECT(inputd));
- gtk_widget_hide ( GTK_INPUT_DIALOG(inputd)->save_button);
+ g_signal_connect (GTK_OBJECT (inputd), "destroy",
+ GTK_SIGNAL_FUNC (input_dialog_destroy), &inputd);
+ g_signal_connect_swapped (GTK_OBJECT (GTK_INPUT_DIALOG (inputd)->close_button),
+ "clicked",
+ GTK_SIGNAL_FUNC (gtk_widget_hide),
+ GTK_OBJECT (inputd));
+ gtk_widget_hide (GTK_INPUT_DIALOG (inputd)->save_button);
gtk_widget_show (inputd);
}
else
{
- if (!GTK_WIDGET_MAPPED(inputd))
- gtk_widget_show(inputd);
+ if (!GTK_WIDGET_MAPPED (inputd))
+ gtk_widget_show (inputd);
else
- gdk_window_raise(inputd->window);
+ gdk_window_raise (inputd->window);
}
}
@@ -201,7 +201,7 @@ main (int argc, char *argv[])
gtk_widget_show (vbox);
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (quit), NULL);
+ GTK_SIGNAL_FUNC (quit), NULL);
/* Create the drawing area */
@@ -214,16 +214,16 @@ main (int argc, char *argv[])
/* Signals used to handle backing pixmap */
g_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
- (GtkSignalFunc) expose_event, NULL);
+ GTK_SIGNAL_FUNC (expose_event), NULL);
g_signal_connect (GTK_OBJECT(drawing_area),"configure_event",
- (GtkSignalFunc) configure_event, NULL);
+ GTK_SIGNAL_FUNC (configure_event), NULL);
/* Event signals */
g_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event",
- (GtkSignalFunc) motion_notify_event, NULL);
+ GTK_SIGNAL_FUNC (motion_notify_event), NULL);
g_signal_connect (GTK_OBJECT (drawing_area), "button_press_event",
- (GtkSignalFunc) button_press_event, NULL);
+ GTK_SIGNAL_FUNC (button_press_event), NULL);
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
| GDK_LEAVE_NOTIFY_MASK
@@ -247,8 +247,8 @@ main (int argc, char *argv[])
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
+ GTK_SIGNAL_FUNC (gtk_widget_destroy),
+ GTK_OBJECT (window));
gtk_widget_show (button);
gtk_widget_show (window);
diff --git a/examples/scrolledwin/scrolledwin.c b/examples/scrolledwin/scrolledwin.c
index 3c9caef70..1081fb084 100644
--- a/examples/scrolledwin/scrolledwin.c
+++ b/examples/scrolledwin/scrolledwin.c
@@ -5,7 +5,7 @@
void destroy( GtkWidget *widget,
gpointer data )
{
- gtk_main_quit();
+ gtk_main_quit ();
}
int main( int argc,
@@ -24,7 +24,7 @@ int main( int argc,
* packed into. */
window = gtk_dialog_new ();
g_signal_connect (GTK_OBJECT (window), "destroy",
- (GtkSignalFunc) destroy, NULL);
+ GTK_SIGNAL_FUNC (destroy), NULL);
gtk_window_set_title (GTK_WINDOW (window), "GtkScrolledWindow example");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
gtk_widget_set_size_request (window, 300, 300);
@@ -72,8 +72,8 @@ int main( int argc,
/* Add a "close" button to the bottom of the dialog */
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_widget_destroy,
- GTK_OBJECT (window));
+ GTK_SIGNAL_FUNC (gtk_widget_destroy),
+ GTK_OBJECT (window));
/* this makes it so the button is the default. */
diff --git a/examples/selection/gettargets.c b/examples/selection/gettargets.c
index 45d6af4ae..7dee64ca0 100644
--- a/examples/selection/gettargets.c
+++ b/examples/selection/gettargets.c
@@ -47,7 +47,7 @@ void selection_received( GtkWidget *widget,
atoms = (GdkAtom *)selection_data->data;
item_list = NULL;
- for (i=0; i<selection_data->length/sizeof(GdkAtom); i++)
+ for (i = 0; i < selection_data->length / sizeof(GdkAtom); i++)
{
char *name;
name = gdk_atom_name (atoms[i]);
@@ -75,7 +75,7 @@ int main( int argc,
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (exit), NULL);
+ GTK_SIGNAL_FUNC (exit), NULL);
/* Create a button the user can click to get targets */
@@ -83,9 +83,9 @@ int main( int argc,
gtk_container_add (GTK_CONTAINER (window), button);
g_signal_connect (GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC (get_targets), NULL);
+ GTK_SIGNAL_FUNC (get_targets), NULL);
g_signal_connect (GTK_OBJECT(button), "selection_received",
- GTK_SIGNAL_FUNC (selection_received), NULL);
+ GTK_SIGNAL_FUNC (selection_received), NULL);
gtk_widget_show (button);
gtk_widget_show (window);
diff --git a/examples/selection/setselection.c b/examples/selection/setselection.c
index fe93c4489..105545bf2 100644
--- a/examples/selection/setselection.c
+++ b/examples/selection/setselection.c
@@ -7,7 +7,7 @@
void selection_toggled( GtkWidget *widget,
gint *have_selection )
{
- if (GTK_TOGGLE_BUTTON(widget)->active)
+ if (GTK_TOGGLE_BUTTON (widget)->active)
{
*have_selection = gtk_selection_owner_set (widget,
GDK_SELECTION_PRIMARY,
@@ -15,7 +15,7 @@ void selection_toggled( GtkWidget *widget,
/* if claiming the selection failed, we return the button to
the out state */
if (!*have_selection)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
}
else
{
@@ -37,7 +37,7 @@ gint selection_clear( GtkWidget *widget,
gint *have_selection )
{
*have_selection = FALSE;
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
return TRUE;
}
@@ -52,13 +52,13 @@ void selection_handle( GtkWidget *widget,
gchar *timestr;
time_t current_time;
- current_time = time(NULL);
- timestr = asctime (localtime(&current_time));
+ current_time = time (NULL);
+ timestr = asctime (localtime (&current_time));
/* When we return a single string, it should not be null terminated.
That will be done for us */
gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING,
- 8, timestr, strlen(timestr));
+ 8, timestr, strlen (timestr));
}
int main( int argc,
@@ -78,7 +78,7 @@ int main( int argc,
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (exit), NULL);
+ GTK_SIGNAL_FUNC (exit), NULL);
/* Create a toggle button to act as the selection */
@@ -86,17 +86,17 @@ int main( int argc,
gtk_container_add (GTK_CONTAINER (window), selection_button);
gtk_widget_show (selection_button);
- g_signal_connect (GTK_OBJECT(selection_button), "toggled",
- GTK_SIGNAL_FUNC (selection_toggled), &have_selection);
- g_signal_connect (GTK_OBJECT(selection_button), "selection_clear_event",
- GTK_SIGNAL_FUNC (selection_clear), &have_selection);
+ g_signal_connect (GTK_OBJECT (selection_button), "toggled",
+ GTK_SIGNAL_FUNC (selection_toggled), &have_selection);
+ g_signal_connect (GTK_OBJECT (selection_button), "selection_clear_event",
+ GTK_SIGNAL_FUNC (selection_clear), &have_selection);
gtk_selection_add_target (selection_button,
GDK_SELECTION_PRIMARY,
GDK_SELECTION_TYPE_STRING,
1);
- g_signal_connect (GTK_OBJECT(selection_button), "selection_get",
- GTK_SIGNAL_FUNC (selection_handle), &have_selection);
+ g_signal_connect (GTK_OBJECT (selection_button), "selection_get",
+ GTK_SIGNAL_FUNC (selection_handle), &have_selection);
gtk_widget_show (selection_button);
gtk_widget_show (window);
diff --git a/examples/spinbutton/spinbutton.c b/examples/spinbutton/spinbutton.c
index 7bd1d9188..95a961b64 100644
--- a/examples/spinbutton/spinbutton.c
+++ b/examples/spinbutton/spinbutton.c
@@ -58,13 +58,13 @@ int main( int argc,
GtkAdjustment *adj;
/* Initialise GTK */
- gtk_init(&argc, &argv);
+ gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (gtk_main_quit),
- NULL);
+ GTK_SIGNAL_FUNC (gtk_main_quit),
+ NULL);
gtk_window_set_title (GTK_WINDOW (window), "Spin Button");
@@ -159,8 +159,8 @@ int main( int argc,
spinner2 = gtk_spin_button_new (adj, 0.0, 0);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner2), TRUE);
g_signal_connect (GTK_OBJECT (adj), "value_changed",
- GTK_SIGNAL_FUNC (change_digits),
- (gpointer) spinner2);
+ GTK_SIGNAL_FUNC (change_digits),
+ (gpointer) spinner2);
gtk_box_pack_start (GTK_BOX (vbox2), spinner2, FALSE, TRUE, 0);
hbox = gtk_hbox_new (FALSE, 0);
@@ -168,15 +168,15 @@ int main( int argc,
button = gtk_check_button_new_with_label ("Snap to 0.5-ticks");
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (toggle_snap),
- spinner1);
+ GTK_SIGNAL_FUNC (toggle_snap),
+ spinner1);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
button = gtk_check_button_new_with_label ("Numeric only input mode");
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (toggle_numeric),
- spinner1);
+ GTK_SIGNAL_FUNC (toggle_numeric),
+ spinner1);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
@@ -187,15 +187,15 @@ int main( int argc,
button = gtk_button_new_with_label ("Value as Int");
g_object_set_data (G_OBJECT (button), "user_data", val_label);
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (get_value),
- GINT_TO_POINTER (1));
+ GTK_SIGNAL_FUNC (get_value),
+ GINT_TO_POINTER (1));
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
button = gtk_button_new_with_label ("Value as Float");
g_object_set_data (G_OBJECT (button), "user_data", val_label);
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (get_value),
- GINT_TO_POINTER (2));
+ GTK_SIGNAL_FUNC (get_value),
+ GINT_TO_POINTER (2));
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (vbox), val_label, TRUE, TRUE, 0);
diff --git a/examples/statusbar/statusbar.c b/examples/statusbar/statusbar.c
index 55e1bda9b..aae37198b 100644
--- a/examples/statusbar/statusbar.c
+++ b/examples/statusbar/statusbar.c
@@ -11,8 +11,8 @@ void push_item( GtkWidget *widget,
static int count = 1;
char buff[20];
- g_snprintf(buff, 20, "Item %d", count++);
- gtk_statusbar_push( GTK_STATUSBAR(status_bar), GPOINTER_TO_INT(data), buff);
+ g_snprintf (buff, 20, "Item %d", count++);
+ gtk_statusbar_push (GTK_STATUSBAR (status_bar), GPOINTER_TO_INT (data), buff);
return;
}
@@ -20,7 +20,7 @@ void push_item( GtkWidget *widget,
void pop_item( GtkWidget *widget,
gpointer data )
{
- gtk_statusbar_pop( GTK_STATUSBAR(status_bar), GPOINTER_TO_INT(data) );
+ gtk_statusbar_pop (GTK_STATUSBAR (status_bar), GPOINTER_TO_INT (data));
return;
}
@@ -37,33 +37,40 @@ int main( int argc,
gtk_init (&argc, &argv);
/* create a new window */
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
- gtk_window_set_title(GTK_WINDOW (window), "GTK Statusbar Example");
- g_signal_connect(GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (exit), NULL);
+ gtk_window_set_title (GTK_WINDOW (window), "GTK Statusbar Example");
+ g_signal_connect (GTK_OBJECT (window), "delete_event",
+ GTK_SIGNAL_FUNC (exit), NULL);
- vbox = gtk_vbox_new(FALSE, 1);
- gtk_container_add(GTK_CONTAINER(window), vbox);
- gtk_widget_show(vbox);
+ vbox = gtk_vbox_new (FALSE, 1);
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+ gtk_widget_show (vbox);
- status_bar = gtk_statusbar_new();
+ status_bar = gtk_statusbar_new ();
gtk_box_pack_start (GTK_BOX (vbox), status_bar, TRUE, TRUE, 0);
gtk_widget_show (status_bar);
context_id = gtk_statusbar_get_context_id(
- GTK_STATUSBAR(status_bar), "Statusbar example");
+ GTK_STATUSBAR (status_bar), "Statusbar example");
- button = gtk_button_new_with_label("push item");
- g_signal_connect(GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC (push_item), GINT_TO_POINTER(context_id) );
- gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 2);
- gtk_widget_show(button);
+ button = gtk_button_new_with_label ("push item");
+ g_signal_connect (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC (push_item), GINT_TO_POINTER (context_id));
+ gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 2);
+ gtk_widget_show (button);
- button = gtk_button_new_with_label("pop last item");
- g_signal_connect(GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC (pop_item), GINT_TO_POINTER(context_id) );
- gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 2);
- gtk_widget_show(button);
+ button = gtk_button_new_with_label ("pop last item");
+ g_signal_connect (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC (pop_item), GINT_TO_POINTER (context_id));
+ gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 2);
+ gtk_widget_show (button);
/* always display the window as the last step so it all splashes on
+ * the screen at once. */
+ gtk_widget_show (window);
+
+ gtk_main ();
+
+ return 0;
+}
diff --git a/examples/table/table.c b/examples/table/table.c
index 5311ff4db..c592efe6a 100644
--- a/examples/table/table.c
+++ b/examples/table/table.c
@@ -36,7 +36,7 @@ int main( int argc,
/* Set a handler for delete_event that immediately
* exits GTK. */
g_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (delete_event), NULL);
+ GTK_SIGNAL_FUNC (delete_event), NULL);
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 20);
@@ -53,11 +53,11 @@ int main( int argc,
/* When the button is clicked, we call the "callback" function
* with a pointer to "button 1" as its argument */
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (callback), (gpointer) "button 1");
+ GTK_SIGNAL_FUNC (callback), (gpointer) "button 1");
/* Insert button 1 into the upper left quadrant of the table */
- gtk_table_attach_defaults (GTK_TABLE(table), button, 0, 1, 0, 1);
+ gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 1);
gtk_widget_show (button);
@@ -68,9 +68,9 @@ int main( int argc,
/* When the button is clicked, we call the "callback" function
* with a pointer to "button 2" as its argument */
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (callback), (gpointer) "button 2");
+ GTK_SIGNAL_FUNC (callback), (gpointer) "button 2");
/* Insert button 2 into the upper right quadrant of the table */
- gtk_table_attach_defaults (GTK_TABLE(table), button, 1, 2, 0, 1);
+ gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 0, 1);
gtk_widget_show (button);
@@ -80,11 +80,11 @@ int main( int argc,
/* When the button is clicked, we call the "delete_event" function
* and the program exits */
g_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (delete_event), NULL);
+ GTK_SIGNAL_FUNC (delete_event), NULL);
/* Insert the quit button into the both
* lower quadrants of the table */
- gtk_table_attach_defaults (GTK_TABLE(table), button, 0, 2, 1, 2);
+ gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 2, 1, 2);
gtk_widget_show (button);
diff --git a/examples/text/Makefile b/examples/text/Makefile
index 59e77b6af..2632928f4 100644
--- a/examples/text/Makefile
+++ b/examples/text/Makefile
@@ -1,11 +1,13 @@
CC = gcc
-CFLAGS = -Wall \
- -DG_DISABLE_DEPRECATED \
- -DGDK_DISABLE_DEPRECATED \
- -DGDK_PIXBUF_DISABLE_DEPRECATED \
- -DGTK_DISABLE_DEPRECATED
+#CFLAGS = -Wall \
+# -DG_DISABLE_DEPRECATED \
+# -DGDK_DISABLE_DEPRECATED \
+# -DGDK_PIXBUF_DISABLE_DEPRECATED \
+# -DGTK_DISABLE_DEPRECATED
+
+CFLAGS =
text: text.c
$(CC) text.c -o text $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
diff --git a/examples/text/text.c b/examples/text/text.c
index 65e94a7d8..7c51f05d9 100644
--- a/examples/text/text.c
+++ b/examples/text/text.c
@@ -8,21 +8,21 @@
void text_toggle_editable (GtkWidget *checkbutton,
GtkWidget *text)
{
- gtk_text_set_editable(GTK_TEXT(text),
- GTK_TOGGLE_BUTTON(checkbutton)->active);
+ gtk_text_set_editable (GTK_TEXT (text),
+ GTK_TOGGLE_BUTTON (checkbutton)->active);
}
void text_toggle_word_wrap (GtkWidget *checkbutton,
GtkWidget *text)
{
- gtk_text_set_word_wrap(GTK_TEXT(text),
- GTK_TOGGLE_BUTTON(checkbutton)->active);
+ gtk_text_set_word_wrap (GTK_TEXT (text),
+ GTK_TOGGLE_BUTTON (checkbutton)->active);
}
void close_application( GtkWidget *widget,
gpointer data )
{
- gtk_main_quit();
+ gtk_main_quit ();
}
int main( int argc,
@@ -48,9 +48,9 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (window, 600, 500);
- gtk_window_set_policy (GTK_WINDOW(window), TRUE, TRUE, FALSE);
+ gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(close_application),
+ GTK_SIGNAL_FUNC (close_application),
NULL);
gtk_window_set_title (GTK_WINDOW (window), "Text Widget Example");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
@@ -88,12 +88,12 @@ int main( int argc,
gtk_widget_show (vscrollbar);
/* Get the system color map and allocate the color red */
- cmap = gdk_colormap_get_system();
+ cmap = gdk_colormap_get_system ();
color.red = 0xffff;
color.green = 0;
color.blue = 0;
- if (!gdk_color_alloc(cmap, &color)) {
- g_error("couldn't allocate color");
+ if (!gdk_color_alloc (cmap, &color)) {
+ g_error ("couldn't allocate color");
}
/* Load a fixed font */
@@ -118,7 +118,7 @@ int main( int argc,
/* Load the file text.c into the text window */
- infile = fopen("text.c", "r");
+ infile = fopen ("text.c", "r");
if (infile) {
char buffer[1024];
@@ -126,7 +126,7 @@ int main( int argc,
while (1)
{
- nchars = fread(buffer, 1, 1024, infile);
+ nchars = fread (buffer, 1, 1024, infile);
gtk_text_insert (GTK_TEXT (text), fixed_font, NULL,
NULL, buffer, nchars);
@@ -144,17 +144,17 @@ int main( int argc,
gtk_box_pack_start (GTK_BOX (box2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
- check = gtk_check_button_new_with_label("Editable");
+ check = gtk_check_button_new_with_label ("Editable");
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT(check), "toggled",
- GTK_SIGNAL_FUNC(text_toggle_editable), text);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
+ gtk_signal_connect (GTK_OBJECT (check), "toggled",
+ GTK_SIGNAL_FUNC (text_toggle_editable), text);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
gtk_widget_show (check);
- check = gtk_check_button_new_with_label("Wrap Words");
+ check = gtk_check_button_new_with_label ("Wrap Words");
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT(check), "toggled",
- GTK_SIGNAL_FUNC(text_toggle_word_wrap), text);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), FALSE);
+ gtk_signal_connect (GTK_OBJECT (check), "toggled",
+ GTK_SIGNAL_FUNC (text_toggle_word_wrap), text);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), FALSE);
gtk_widget_show (check);
separator = gtk_hseparator_new ();
@@ -167,9 +167,9 @@ int main( int argc,
gtk_widget_show (box2);
button = gtk_button_new_with_label ("close");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(close_application),
- NULL);
+ g_signal_connect (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC (close_application),
+ NULL);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
@@ -179,5 +179,5 @@ int main( int argc,
gtk_main ();
- return(0);
+ return 0;
}
diff --git a/examples/tictactoe/tictactoe.c b/examples/tictactoe/tictactoe.c
index 0625c5179..a97d319da 100644
--- a/examples/tictactoe/tictactoe.c
+++ b/examples/tictactoe/tictactoe.c
@@ -86,17 +86,17 @@ tictactoe_init (Tictactoe *ttt)
gint i,j;
table = gtk_table_new (3, 3, TRUE);
- gtk_container_add (GTK_CONTAINER(ttt), table);
+ gtk_container_add (GTK_CONTAINER (ttt), table);
gtk_widget_show (table);
- for (i=0;i<3; i++)
- for (j=0;j<3; j++)
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 3; j++)
{
ttt->buttons[i][j] = gtk_toggle_button_new ();
- gtk_table_attach_defaults (GTK_TABLE(table), ttt->buttons[i][j],
+ gtk_table_attach_defaults (GTK_TABLE (table), ttt->buttons[i][j],
i, i+1, j, j+1);
g_signal_connect (GTK_OBJECT (ttt->buttons[i][j]), "toggled",
- GTK_SIGNAL_FUNC (tictactoe_toggle), ttt);
+ GTK_SIGNAL_FUNC (tictactoe_toggle), ttt);
gtk_widget_set_size_request (ttt->buttons[i][j], 20, 20);
gtk_widget_show (ttt->buttons[i][j]);
}
@@ -113,13 +113,13 @@ tictactoe_clear (Tictactoe *ttt)
{
int i,j;
- for (i=0;i<3;i++)
- for (j=0;j<3;j++)
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 3; j++)
{
- g_signal_handlers_block_by_func (GTK_OBJECT(ttt->buttons[i][j]), NULL, ttt);
+ g_signal_handlers_block_by_func (GTK_OBJECT (ttt->buttons[i][j]), NULL, ttt);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ttt->buttons[i][j]),
- FALSE);
- g_signal_handlers_unblock_by_func (GTK_OBJECT(ttt->buttons[i][j]), NULL, ttt);
+ FALSE);
+ g_signal_handlers_unblock_by_func (GTK_OBJECT (ttt->buttons[i][j]), NULL, ttt);
}
}
@@ -137,15 +137,15 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt)
int success, found;
- for (k=0; k<8; k++)
+ for (k = 0; k < 8; k++)
{
success = TRUE;
found = FALSE;
- for (i=0;i<3;i++)
+ for (i = 0; i < 3; i++)
{
success = success &&
- GTK_TOGGLE_BUTTON(ttt->buttons[rwins[k][i]][cwins[k][i]])->active;
+ GTK_TOGGLE_BUTTON (ttt->buttons[rwins[k][i]][cwins[k][i]])->active;
found = found ||
ttt->buttons[rwins[k][i]][cwins[k][i]] == widget;
}
@@ -153,7 +153,7 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt)
if (success && found)
{
g_signal_emit (GTK_OBJECT (ttt),
- tictactoe_signals[TICTACTOE_SIGNAL], 0);
+ tictactoe_signals[TICTACTOE_SIGNAL], 0);
break;
}
}
diff --git a/examples/tictactoe/ttt_test.c b/examples/tictactoe/ttt_test.c
index 6d25f3857..78a7d396f 100644
--- a/examples/tictactoe/ttt_test.c
+++ b/examples/tictactoe/ttt_test.c
@@ -23,7 +23,7 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
g_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (exit), NULL);
+ GTK_SIGNAL_FUNC (exit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
@@ -33,7 +33,7 @@ int main( int argc,
gtk_widget_show (ttt);
g_signal_connect (GTK_OBJECT (ttt), "tictactoe",
- GTK_SIGNAL_FUNC (win), NULL);
+ GTK_SIGNAL_FUNC (win), NULL);
gtk_widget_show (window);
diff --git a/examples/tree/Makefile b/examples/tree/Makefile
index de510b9b8..bbeea5992 100644
--- a/examples/tree/Makefile
+++ b/examples/tree/Makefile
@@ -1,11 +1,13 @@
CC = gcc
-CFLAGS = -Wall \
- -DG_DISABLE_DEPRECATED \
- -DGDK_DISABLE_DEPRECATED \
- -DGDK_PIXBUF_DISABLE_DEPRECATED \
- -DGTK_DISABLE_DEPRECATED
+#CFLAGS = -Wall \
+# -DG_DISABLE_DEPRECATED \
+# -DGDK_DISABLE_DEPRECATED \
+# -DGDK_PIXBUF_DISABLE_DEPRECATED \
+# -DGTK_DISABLE_DEPRECATED
+
+CFLAGS =
tree: tree.c
$(CC) tree.c -o tree $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
diff --git a/examples/tree/tree.c b/examples/tree/tree.c
index acd431e13..5eb57c53c 100644
--- a/examples/tree/tree.c
+++ b/examples/tree/tree.c
@@ -44,8 +44,8 @@ static void cb_selection_changed( GtkWidget *tree )
g_print ("selection_change called for tree %p\n", tree);
g_print ("selected objects are:\n");
- i = GTK_TREE_SELECTION_OLD(tree);
- while (i){
+ i = GTK_TREE_SELECTION_OLD (tree);
+ while (i) {
gchar *name;
GtkLabel *label;
GtkWidget *item;
@@ -72,9 +72,9 @@ int main( int argc,
/* a generic toplevel window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_signal_connect (GTK_OBJECT(window), "delete_event",
+ gtk_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
- gtk_container_set_border_width (GTK_CONTAINER(window), 5);
+ gtk_container_set_border_width (GTK_CONTAINER (window), 5);
/* A generic scrolled window */
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
@@ -82,24 +82,24 @@ int main( int argc,
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_set_size_request (scrolled_win, 150, 200);
- gtk_container_add (GTK_CONTAINER(window), scrolled_win);
+ gtk_container_add (GTK_CONTAINER (window), scrolled_win);
gtk_widget_show (scrolled_win);
/* Create the root tree */
- tree = gtk_tree_new();
+ tree = gtk_tree_new ();
g_print ("root tree is %p\n", tree);
/* connect all GtkTree:: signals */
- gtk_signal_connect (GTK_OBJECT(tree), "select_child",
- GTK_SIGNAL_FUNC(cb_select_child), tree);
- gtk_signal_connect (GTK_OBJECT(tree), "unselect_child",
- GTK_SIGNAL_FUNC(cb_unselect_child), tree);
+ gtk_signal_connect (GTK_OBJECT (tree), "select_child",
+ GTK_SIGNAL_FUNC (cb_select_child), tree);
+ gtk_signal_connect (GTK_OBJECT (tree), "unselect_child",
+ GTK_SIGNAL_FUNC (cb_unselect_child), tree);
gtk_signal_connect (GTK_OBJECT(tree), "selection_changed",
GTK_SIGNAL_FUNC(cb_selection_changed), tree);
/* Add it to the scrolled window */
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(scrolled_win),
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win),
tree);
/* Set the selection mode */
- gtk_tree_set_selection_mode (GTK_TREE(tree),
+ gtk_tree_set_selection_mode (GTK_TREE (tree),
GTK_SELECTION_MULTIPLE);
/* Show it */
gtk_widget_show (tree);
@@ -111,44 +111,44 @@ int main( int argc,
/* Create a tree item */
item = gtk_tree_item_new_with_label (itemnames[i]);
/* Connect all GtkItem:: and GtkTreeItem:: signals */
- gtk_signal_connect (GTK_OBJECT(item), "select",
- GTK_SIGNAL_FUNC(cb_itemsignal), "select");
- gtk_signal_connect (GTK_OBJECT(item), "deselect",
- GTK_SIGNAL_FUNC(cb_itemsignal), "deselect");
- gtk_signal_connect (GTK_OBJECT(item), "toggle",
- GTK_SIGNAL_FUNC(cb_itemsignal), "toggle");
- gtk_signal_connect (GTK_OBJECT(item), "expand",
- GTK_SIGNAL_FUNC(cb_itemsignal), "expand");
- gtk_signal_connect (GTK_OBJECT(item), "collapse",
- GTK_SIGNAL_FUNC(cb_itemsignal), "collapse");
+ gtk_signal_connect (GTK_OBJECT (item), "select",
+ GTK_SIGNAL_FUNC (cb_itemsignal), "select");
+ gtk_signal_connect (GTK_OBJECT (item), "deselect",
+ GTK_SIGNAL_FUNC (cb_itemsignal), "deselect");
+ gtk_signal_connect (GTK_OBJECT (item), "toggle",
+ GTK_SIGNAL_FUNC (cb_itemsignal), "toggle");
+ gtk_signal_connect (GTK_OBJECT (item), "expand",
+ GTK_SIGNAL_FUNC (cb_itemsignal), "expand");
+ gtk_signal_connect (GTK_OBJECT (item), "collapse",
+ GTK_SIGNAL_FUNC (cb_itemsignal), "collapse");
/* Add it to the parent tree */
- gtk_tree_append (GTK_TREE(tree), item);
+ gtk_tree_append (GTK_TREE (tree), item);
/* Show it - this can be done at any time */
gtk_widget_show (item);
/* Create this item's subtree */
- subtree = gtk_tree_new();
+ subtree = gtk_tree_new ();
g_print ("-> item %s->%p, subtree %p\n", itemnames[i], item,
subtree);
/* This is still necessary if you want these signals to be called
for the subtree's children. Note that selection_change will be
signalled for the root tree regardless. */
- gtk_signal_connect (GTK_OBJECT(subtree), "select_child",
- GTK_SIGNAL_FUNC(cb_select_child), subtree);
- gtk_signal_connect (GTK_OBJECT(subtree), "unselect_child",
- GTK_SIGNAL_FUNC(cb_unselect_child), subtree);
+ gtk_signal_connect (GTK_OBJECT (subtree), "select_child",
+ GTK_SIGNAL_FUNC (cb_select_child), subtree);
+ gtk_signal_connect (GTK_OBJECT (subtree), "unselect_child",
+ GTK_SIGNAL_FUNC (cb_unselect_child), subtree);
/* This has absolutely no effect, because it is completely ignored
in subtrees */
- gtk_tree_set_selection_mode (GTK_TREE(subtree),
+ gtk_tree_set_selection_mode (GTK_TREE (subtree),
GTK_SELECTION_SINGLE);
/* Neither does this, but for a rather different reason - the
view_mode and view_line values of a tree are propagated to
subtrees when they are mapped. So, setting it later on would
actually have a (somewhat unpredictable) effect */
- gtk_tree_set_view_mode (GTK_TREE(subtree), GTK_TREE_VIEW_ITEM);
+ gtk_tree_set_view_mode (GTK_TREE (subtree), GTK_TREE_VIEW_ITEM);
/* Set this item's subtree - note that you cannot do this until
AFTER the item has been added to its parent tree! */
- gtk_tree_item_set_subtree (GTK_TREE_ITEM(item), subtree);
+ gtk_tree_item_set_subtree (GTK_TREE_ITEM (item), subtree);
for (j = 0; j < 5; j++){
GtkWidget *subitem;
@@ -156,19 +156,19 @@ int main( int argc,
/* Create a subtree item, in much the same way */
subitem = gtk_tree_item_new_with_label (itemnames[j]);
/* Connect all GtkItem:: and GtkTreeItem:: signals */
- gtk_signal_connect (GTK_OBJECT(subitem), "select",
- GTK_SIGNAL_FUNC(cb_itemsignal), "select");
- gtk_signal_connect (GTK_OBJECT(subitem), "deselect",
- GTK_SIGNAL_FUNC(cb_itemsignal), "deselect");
- gtk_signal_connect (GTK_OBJECT(subitem), "toggle",
- GTK_SIGNAL_FUNC(cb_itemsignal), "toggle");
- gtk_signal_connect (GTK_OBJECT(subitem), "expand",
- GTK_SIGNAL_FUNC(cb_itemsignal), "expand");
- gtk_signal_connect (GTK_OBJECT(subitem), "collapse",
- GTK_SIGNAL_FUNC(cb_itemsignal), "collapse");
+ gtk_signal_connect (GTK_OBJECT (subitem), "select",
+ GTK_SIGNAL_FUNC (cb_itemsignal), "select");
+ gtk_signal_connect (GTK_OBJECT (subitem), "deselect",
+ GTK_SIGNAL_FUNC (cb_itemsignal), "deselect");
+ gtk_signal_connect (GTK_OBJECT (subitem), "toggle",
+ GTK_SIGNAL_FUNC (cb_itemsignal), "toggle");
+ gtk_signal_connect (GTK_OBJECT (subitem), "expand",
+ GTK_SIGNAL_FUNC (cb_itemsignal), "expand");
+ gtk_signal_connect (GTK_OBJECT (subitem), "collapse",
+ GTK_SIGNAL_FUNC (cb_itemsignal), "collapse");
g_print ("-> -> item %s->%p\n", itemnames[j], subitem);
/* Add it to its parent tree */
- gtk_tree_append (GTK_TREE(subtree), subitem);
+ gtk_tree_append (GTK_TREE (subtree), subitem);
/* Show it */
gtk_widget_show (subitem);
}
@@ -176,6 +176,8 @@ int main( int argc,
/* Show the window and loop endlessly */
gtk_widget_show (window);
+
gtk_main();
+
return 0;
}
diff --git a/examples/wheelbarrow/wheelbarrow.c b/examples/wheelbarrow/wheelbarrow.c
index a0a7cd541..062f078f0 100644
--- a/examples/wheelbarrow/wheelbarrow.c
+++ b/examples/wheelbarrow/wheelbarrow.c
@@ -141,33 +141,32 @@ int main (int argc,
* the application. Note that the main window will not have a titlebar
* since we're making it a popup. */
gtk_init (&argc, &argv);
- window = gtk_window_new( GTK_WINDOW_POPUP );
+ window = gtk_window_new (GTK_WINDOW_POPUP);
g_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (close_application), NULL);
+ GTK_SIGNAL_FUNC (close_application), NULL);
gtk_widget_show (window);
/* Now for the pixmap and the pixmap widget */
style = gtk_widget_get_default_style();
gc = style->black_gc;
- gdk_pixmap = gdk_pixmap_create_from_xpm_d( window->window, &mask,
- &style->bg[GTK_STATE_NORMAL],
- WheelbarrowFull_xpm );
+ gdk_pixmap = gdk_pixmap_create_from_xpm_d (window->window, &mask,
+ &style->bg[GTK_STATE_NORMAL],
+ WheelbarrowFull_xpm);
pixmap = gtk_image_new_from_pixmap (gdk_pixmap, mask);
- gtk_widget_show( pixmap );
+ gtk_widget_show (pixmap);
/* To display the pixmap, we use a fixed widget to place the pixmap */
- fixed = gtk_fixed_new();
+ fixed = gtk_fixed_new ();
gtk_widget_set_size_request (fixed, 200, 200);
- gtk_fixed_put( GTK_FIXED(fixed), pixmap, 0, 0 );
- gtk_container_add( GTK_CONTAINER(window), fixed );
- gtk_widget_show( fixed );
+ gtk_fixed_put (GTK_FIXED (fixed), pixmap, 0, 0);
+ gtk_container_add (GTK_CONTAINER (window), fixed);
+ gtk_widget_show (fixed);
/* This masks out everything except for the image itself */
- gtk_widget_shape_combine_mask( window, mask, 0, 0 );
+ gtk_widget_shape_combine_mask (window, mask, 0, 0);
/* show the window */
- /*gtk_widget_set_uposition( window, 20, 400 );*/
- gtk_widget_show( window );
+ gtk_widget_show (window);
gtk_main ();
return 0;