summaryrefslogtreecommitdiff
path: root/docs/tutorial
diff options
context:
space:
mode:
authorGMT 2003 Tony Gale <gale@gtk.org>2003-02-02 16:50:48 +0000
committerTony Gale <gale@src.gnome.org>2003-02-02 16:50:48 +0000
commit69e13666670477dee5fce25b6f28bef03e481630 (patch)
treea4551d91b2d25cd48f551200d0baa2b8c8d62b47 /docs/tutorial
parentec9429b84da422084c8295f5b6a4dca65fea5dc5 (diff)
downloadgdk-pixbuf-69e13666670477dee5fce25b6f28bef03e481630.tar.gz
cleanups from Sebastian Rittau (#104832)
Sun Feb 2 16:45:57 GMT 2003 Tony Gale <gale@gtk.org> * docs/tutorial/gtk-tut.sgml: cleanups from Sebastian Rittau (#104832)
Diffstat (limited to 'docs/tutorial')
-rwxr-xr-xdocs/tutorial/gtk-tut.sgml653
1 files changed, 334 insertions, 319 deletions
diff --git a/docs/tutorial/gtk-tut.sgml b/docs/tutorial/gtk-tut.sgml
index bc9e47950..c326f3e17 100755
--- a/docs/tutorial/gtk-tut.sgml
+++ b/docs/tutorial/gtk-tut.sgml
@@ -309,15 +309,15 @@ hello world a la GTK.</para>
/* This is a callback function. The data arguments are ignored
* in this example. More on callbacks below. */
-void hello( GtkWidget *widget,
- gpointer data )
+static void hello( GtkWidget *widget,
+ gpointer data )
{
g_print ("Hello World\n");
}
-gint delete_event( GtkWidget *widget,
- GdkEvent *event,
- gpointer data )
+static gboolean delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
{
/* If you return FALSE in the "delete_event" signal handler,
* GTK will emit the "destroy" signal. Returning TRUE means
@@ -334,8 +334,8 @@ gint delete_event( GtkWidget *widget,
}
/* Another callback */
-void destroy( GtkWidget *widget,
- gpointer data )
+static void destroy( GtkWidget *widget,
+ gpointer data )
{
gtk_main_quit ();
}
@@ -705,9 +705,9 @@ mouse is over the button and a mouse button is pressed, the function
button_press_callback() will be called. This function may be declared as:</para>
<programlisting role="C">
-static gint button_press_callback( GtkWidget *widget,
- GdkEventButton *event,
- gpointer data );
+static gboolean button_press_callback( GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer data );
</programlisting>
<para>Note that we can declare the second argument as type
@@ -767,8 +767,8 @@ it is not hard to do things with them. The next example will use the
data argument to tell us which button was pressed.</para>
<programlisting role="C">
-void hello( GtkWidget *widget,
- gpointer data )
+static void hello( GtkWidget *widget,
+ gpointer data )
{
g_print ("Hello World\n");
}
@@ -787,9 +787,9 @@ call our "destroy" signal handler.</para>
<programlisting role="C">
-gint delete_event( GtkWidget *widget,
- GdkEvent *event,
- gpointer data )
+static gboolean delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
{
g_print ("delete event occurred\n");
@@ -802,8 +802,8 @@ calling gtk_main_quit(). This function tells GTK that it is to exit
from gtk_main when control is returned to it.</para>
<programlisting role="C">
-void destroy( GtkWidget *widget,
- gpointer data )
+static void destroy( GtkWidget *widget,
+ gpointer data )
{
gtk_main_quit ();
}
@@ -1072,16 +1072,16 @@ topic, packing widgets.</para>
/* Our new improved callback. The data passed to this function
* is printed to stdout. */
-void callback( GtkWidget *widget,
- gpointer data )
+static void callback( GtkWidget *widget,
+ gpointer data )
{
g_print ("Hello again - %s was pressed\n", (gchar *) data);
}
/* another callback */
-gint delete_event( GtkWidget *widget,
- GdkEvent *event,
- gpointer data )
+static gboolean delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
{
gtk_main_quit ();
return FALSE;
@@ -1313,9 +1313,9 @@ it. Compile it yourself and play with it.</para>
#include &lt;stdlib.h&gt;
#include "gtk/gtk.h"
-gint delete_event( GtkWidget *widget,
- GdkEvent *event,
- gpointer data )
+static gboolean delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
{
gtk_main_quit ();
return FALSE;
@@ -1324,11 +1324,11 @@ gint delete_event( GtkWidget *widget,
/* Make a new hbox filled with button-labels. Arguments for the
* variables we're interested are passed in to this function.
* We do not show the box, but do show everything inside. */
-GtkWidget *make_box( gboolean homogeneous,
- gint spacing,
- gboolean expand,
- gboolean fill,
- guint padding )
+static GtkWidget *make_box( gboolean homogeneous,
+ gint spacing,
+ gboolean expand,
+ gboolean fill,
+ guint padding )
{
GtkWidget *box;
GtkWidget *button;
@@ -1790,16 +1790,16 @@ Which means it should look something like this:</para>
/* Our callback.
* The data passed to this function is printed to stdout */
-void callback( GtkWidget *widget,
- gpointer data )
+static void callback( GtkWidget *widget,
+ gpointer data )
{
g_print ("Hello again - %s was pressed\n", (char *) data);
}
/* This callback quits the program */
-gint delete_event( GtkWidget *widget,
- GdkEvent *event,
- gpointer data )
+static gboolean delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
{
gtk_main_quit ();
return FALSE;
@@ -2161,8 +2161,8 @@ later in the tutorial.</para>
/* Create a new hbox with an image and a label packed into it
* and return the box. */
-GtkWidget *xpm_label_box( gchar *xpm_filename,
- gchar *label_text )
+static GtkWidget *xpm_label_box( gchar *xpm_filename,
+ gchar *label_text )
{
GtkWidget *box;
GtkWidget *label;
@@ -2189,8 +2189,8 @@ GtkWidget *xpm_label_box( gchar *xpm_filename,
}
/* Our usual callback function */
-void callback( GtkWidget *widget,
- gpointer data )
+static void callback( GtkWidget *widget,
+ gpointer data )
{
g_print ("Hello again - %s was pressed\n", (char *) data);
}
@@ -2477,9 +2477,9 @@ the second will emit its "toggled" signal (to report becoming active).</para>
#include &lt;glib.h&gt;
#include &lt;gtk/gtk.h&gt;
-gint close_application( GtkWidget *widget,
- GdkEvent *event,
- gpointer data )
+static gboolean close_application( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
{
gtk_main_quit ();
return FALSE;
@@ -3093,31 +3093,31 @@ these widgets work for the user.</para>
GtkWidget *hscale, *vscale;
-void cb_pos_menu_select( GtkWidget *item,
- GtkPositionType pos )
+static void cb_pos_menu_select( GtkWidget *item,
+ GtkPositionType pos )
{
/* Set the value position on both scale widgets */
gtk_scale_set_value_pos (GTK_SCALE (hscale), pos);
gtk_scale_set_value_pos (GTK_SCALE (vscale), pos);
}
-void cb_update_menu_select( GtkWidget *item,
- GtkUpdateType policy )
+static void cb_update_menu_select( GtkWidget *item,
+ GtkUpdateType policy )
{
/* Set the update policy for both scale widgets */
gtk_range_set_update_policy (GTK_RANGE (hscale), policy);
gtk_range_set_update_policy (GTK_RANGE (vscale), policy);
}
-void cb_digits_scale( GtkAdjustment *adj )
+static void cb_digits_scale( GtkAdjustment *adj )
{
/* Set the number of decimal places to which adj->value is rounded */
gtk_scale_set_digits (GTK_SCALE (hscale), (gint) adj->value);
gtk_scale_set_digits (GTK_SCALE (vscale), (gint) adj->value);
}
-void cb_page_size( GtkAdjustment *get,
- GtkAdjustment *set )
+static void cb_page_size( GtkAdjustment *get,
+ GtkAdjustment *set )
{
/* Set the page size and page increment size of the sample
* adjustment to the value specified by the "Page Size" scale */
@@ -3132,7 +3132,7 @@ void cb_page_size( GtkAdjustment *get,
g_signal_emit_by_name(G_OBJECT(set), "changed");
}
-void cb_draw_value( GtkToggleButton *button )
+static void cb_draw_value( GtkToggleButton *button )
{
/* Turn the value display on the scale widgets off or on depending
* on the state of the checkbutton */
@@ -3142,9 +3142,9 @@ void cb_draw_value( GtkToggleButton *button )
/* Convenience functions */
-GtkWidget *make_menu_item (gchar *name,
- GCallback callback,
- gpointer data)
+static GtkWidget *make_menu_item ( gchar *name,
+ GCallback callback,
+ gpointer data )
{
GtkWidget *item;
@@ -3156,7 +3156,7 @@ GtkWidget *make_menu_item (gchar *name,
return item;
}
-void scale_set_default_values( GtkScale *scale )
+static void scale_set_default_values( GtkScale *scale )
{
gtk_range_set_update_policy (GTK_RANGE (scale),
GTK_UPDATE_CONTINUOUS);
@@ -3167,7 +3167,7 @@ void scale_set_default_values( GtkScale *scale )
/* makes the sample window */
-void create_range_controls( void )
+static void create_range_controls( void )
{
GtkWidget *window;
GtkWidget *box1, *box2, *box3;
@@ -3665,8 +3665,8 @@ point. The <literal>shadow_type</literal> argument may take one of these values:
/* Create an Arrow widget with the specified parameters
* and pack it into a button */
-GtkWidget *create_arrow_button( GtkArrowType arrow_type,
- GtkShadowType shadow_type )
+static GtkWidget *create_arrow_button( GtkArrowType arrow_type,
+ GtkShadowType shadow_type )
{
GtkWidget *button;
GtkWidget *arrow;
@@ -3929,7 +3929,7 @@ typedef struct _ProgressData {
/* Update the value of the progress bar so that we get
* some movement */
-gint progress_timeout( gpointer data )
+static gboolean progress_timeout( gpointer data )
{
ProgressData *pdata = (ProgressData *)data;
gdouble new_val;
@@ -3956,8 +3956,8 @@ gint progress_timeout( gpointer data )
}
/* Callback that toggles the text display within the progress bar trough */
-void toggle_show_text( GtkWidget *widget,
- ProgressData *pdata )
+static void toggle_show_text( GtkWidget *widget,
+ ProgressData *pdata )
{
const gchar *text;
@@ -3969,8 +3969,8 @@ void toggle_show_text( GtkWidget *widget,
}
/* Callback that toggles the activity mode of the progress bar */
-void toggle_activity_mode( GtkWidget *widget,
- ProgressData *pdata )
+static void toggle_activity_mode( GtkWidget *widget,
+ ProgressData *pdata )
{
pdata-&gt;activity_mode = !pdata-&gt;activity_mode;
if (pdata-&gt;activity_mode)
@@ -3981,8 +3981,8 @@ void toggle_activity_mode( GtkWidget *widget,
/* Callback that toggles the orientation of the progress bar */
-void toggle_orientation( GtkWidget *widget,
- ProgressData *pdata )
+static void toggle_orientation( GtkWidget *widget,
+ ProgressData *pdata )
{
switch (gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (pdata-&gt;pbar))) {
case GTK_PROGRESS_LEFT_TO_RIGHT:
@@ -4000,8 +4000,8 @@ void toggle_orientation( GtkWidget *widget,
/* Clean up allocated memory and remove the timer */
-void destroy_progress( GtkWidget *widget,
- ProgressData *pdata)
+static void destroy_progress( GtkWidget *widget,
+ ProgressData *pdata)
{
gtk_timeout_remove (pdata-&gt;timer);
pdata-&gt;timer = 0;
@@ -4312,9 +4312,9 @@ Placement of the drawing area and the rulers is done using a table.</para>
#define YSIZE 400
/* This routine gets control when the close button is clicked */
-gint close_application( GtkWidget *widget,
- GdkEvent *event,
- gpointer data )
+static gboolean close_application( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
{
gtk_main_quit ();
return FALSE;
@@ -4468,23 +4468,21 @@ back off.</para>
GtkWidget *status_bar;
-void push_item( GtkWidget *widget,
- gpointer data )
+static void push_item( GtkWidget *widget,
+ gpointer data )
{
static int count = 1;
- char buff[20];
+ gchar *buff;
- g_snprintf (buff, 20, "Item %d", count++);
+ buff = g_strdup_printf ("Item %d", count++);
gtk_statusbar_push (GTK_STATUSBAR (status_bar), GPOINTER_TO_INT (data), buff);
-
- return;
+ g_free (buff);
}
-void pop_item( GtkWidget *widget,
- gpointer data )
+static void pop_item( GtkWidget *widget,
+ gpointer data )
{
gtk_statusbar_pop (GTK_STATUSBAR (status_bar), GPOINTER_TO_INT (data));
- return;
}
int main( int argc,
@@ -4634,23 +4632,23 @@ removed.</para>
#include &lt;stdlib.h&gt;
#include &lt;gtk/gtk.h&gt;
-void enter_callback( GtkWidget *widget,
- GtkWidget *entry )
+static void enter_callback( GtkWidget *widget,
+ GtkWidget *entry )
{
const gchar *entry_text;
entry_text = gtk_entry_get_text (GTK_ENTRY (entry));
- printf("Entry contents: %s\n", entry_text);
+ printf ("Entry contents: %s\n", entry_text);
}
-void entry_toggle_editable( GtkWidget *checkbutton,
- GtkWidget *entry )
+static void entry_toggle_editable( GtkWidget *checkbutton,
+ GtkWidget *entry )
{
gtk_editable_set_editable (GTK_EDITABLE (entry),
GTK_TOGGLE_BUTTON (checkbutton)-&gt;active);
}
-void entry_toggle_visibility( GtkWidget *checkbutton,
- GtkWidget *entry )
+static void entry_toggle_visibility( GtkWidget *checkbutton,
+ GtkWidget *entry )
{
gtk_entry_set_visibility (GTK_ENTRY (entry),
GTK_TOGGLE_BUTTON (checkbutton)-&gt;active);
@@ -4928,7 +4926,7 @@ function:</para>
<programlisting role="C">
void gtk_spin_button_set_update_policy( GtkSpinButton *spin_button,
- GtkSpinButtonUpdatePolicy policy );
+ GtkSpinButtonUpdatePolicy policy );
</programlisting>
<para>The possible values of <literal>policy</literal> are either <literal>GTK_UPDATE_ALWAYS</literal> or
@@ -4970,40 +4968,41 @@ void gtk_spin_button_update( GtkSpinButton *spin_button );
static GtkWidget *spinner1;
-void toggle_snap( GtkWidget *widget,
- GtkSpinButton *spin )
+static void toggle_snap( GtkWidget *widget,
+ GtkSpinButton *spin )
{
gtk_spin_button_set_snap_to_ticks (spin, GTK_TOGGLE_BUTTON (widget)-&gt;active);
}
-void toggle_numeric( GtkWidget *widget,
- GtkSpinButton *spin )
+static void toggle_numeric( GtkWidget *widget,
+ GtkSpinButton *spin )
{
gtk_spin_button_set_numeric (spin, GTK_TOGGLE_BUTTON (widget)-&gt;active);
}
-void change_digits( GtkWidget *widget,
- GtkSpinButton *spin )
+static void change_digits( GtkWidget *widget,
+ GtkSpinButton *spin )
{
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinner1),
gtk_spin_button_get_value_as_int (spin));
}
-void get_value( GtkWidget *widget,
- gpointer data )
+static void get_value( GtkWidget *widget,
+ gpointer data )
{
- gchar buf[32];
+ gchar *buf;
GtkLabel *label;
GtkSpinButton *spin;
spin = GTK_SPIN_BUTTON (spinner1);
label = GTK_LABEL (g_object_get_data (G_OBJECT (widget), "user_data"));
if (GPOINTER_TO_INT (data) == 1)
- sprintf (buf, "%d", gtk_spin_button_get_value_as_int (spin));
+ buf = g_strdup_printf ("%d", gtk_spin_button_get_value_as_int (spin));
else
- sprintf (buf, "%0.*f", spin-&gt;digits,
- gtk_spin_button_get_value (spin));
+ buf = g_strdup_printf ("%0.*f", spin-&gt;digits,
+ gtk_spin_button_get_value (spin));
gtk_label_set_text (label, buf);
+ g_free (buf);
}
@@ -5593,23 +5592,22 @@ enum {
* GtkCalendar
*/
-void calendar_date_to_string (CalendarData *data,
- char *buffer,
- gint buff_len)
+static void calendar_date_to_string( CalendarData *data,
+ char *buffer,
+ gint buff_len )
{
- GDate *date;
+ GDate date;
guint year, month, day;
gtk_calendar_get_date (GTK_CALENDAR (data-&gt;window),
&amp;year, &amp;month, &amp;day);
- date = g_date_new_dmy (day, month + 1, year);
- g_date_strftime (buffer, buff_len - 1, "%x", date);
+ g_date_set_dmy (&date, day, month + 1, year);
+ g_date_strftime (buffer, buff_len - 1, "%x", &date);
- g_date_free (date);
}
-void calendar_set_signal_strings (char *sig_str,
- CalendarData *data)
+static void calendar_set_signal_strings( char *sig_str,
+ CalendarData *data )
{
const gchar *prev_sig;
@@ -5621,8 +5619,8 @@ void calendar_set_signal_strings (char *sig_str,
gtk_label_set_text (GTK_LABEL (data-&gt;last_sig), sig_str);
}
-void calendar_month_changed (GtkWidget *widget,
- CalendarData *data)
+static void calendar_month_changed( GtkWidget *widget,
+ CalendarData *data )
{
char buffer[256] = "month_changed: ";
@@ -5630,8 +5628,8 @@ void calendar_month_changed (GtkWidget *widget,
calendar_set_signal_strings (buffer, data);
}
-void calendar_day_selected (GtkWidget *widget,
- CalendarData *data)
+static void calendar_day_selected( GtkWidget *widget,
+ CalendarData *data )
{
char buffer[256] = "day_selected: ";
@@ -5639,8 +5637,8 @@ void calendar_day_selected (GtkWidget *widget,
calendar_set_signal_strings (buffer, data);
}
-void calendar_day_selected_double_click (GtkWidget *widget,
- CalendarData *data)
+static void calendar_day_selected_double_click ( GtkWidget *widget,
+ CalendarData *data )
{
char buffer[256] = "day_selected_double_click: ";
guint day;
@@ -5658,8 +5656,8 @@ void calendar_day_selected_double_click (GtkWidget *widget,
}
}
-void calendar_prev_month (GtkWidget *widget,
- CalendarData *data)
+static void calendar_prev_month( GtkWidget *widget,
+ CalendarData *data )
{
char buffer[256] = "prev_month: ";
@@ -5667,8 +5665,8 @@ void calendar_prev_month (GtkWidget *widget,
calendar_set_signal_strings (buffer, data);
}
-void calendar_next_month (GtkWidget *widget,
- CalendarData *data)
+static void calendar_next_month( GtkWidget *widget,
+ CalendarData *data )
{
char buffer[256] = "next_month: ";
@@ -5676,8 +5674,8 @@ void calendar_next_month (GtkWidget *widget,
calendar_set_signal_strings (buffer, data);
}
-void calendar_prev_year (GtkWidget *widget,
- CalendarData *data)
+static void calendar_prev_year( GtkWidget *widget,
+ CalendarData *data )
{
char buffer[256] = "prev_year: ";
@@ -5685,8 +5683,8 @@ void calendar_prev_year (GtkWidget *widget,
calendar_set_signal_strings (buffer, data);
}
-void calendar_next_year (GtkWidget *widget,
- CalendarData *data)
+static void calendar_next_year( GtkWidget *widget,
+ CalendarData *data )
{
char buffer[256] = "next_year: ";
@@ -5695,7 +5693,7 @@ void calendar_next_year (GtkWidget *widget,
}
-void calendar_set_flags (CalendarData *calendar)
+static void calendar_set_flags( CalendarData *calendar )
{
gint i;
gint options = 0;
@@ -5708,8 +5706,8 @@ void calendar_set_flags (CalendarData *calendar)
gtk_calendar_display_options (GTK_CALENDAR (calendar-&gt;window), options);
}
-void calendar_toggle_flag (GtkWidget *toggle,
- CalendarData *calendar)
+static void calendar_toggle_flag( GtkWidget *toggle,
+ CalendarData *calendar)
{
gint i;
gint j;
@@ -5723,8 +5721,8 @@ void calendar_toggle_flag (GtkWidget *toggle,
}
-void calendar_font_selection_ok (GtkWidget *button,
- CalendarData *calendar)
+static void calendar_font_selection_ok( GtkWidget *button,
+ CalendarData *calendar )
{
GtkRcStyle *style;
char *font_name;
@@ -5745,8 +5743,8 @@ void calendar_font_selection_ok (GtkWidget *button,
gtk_widget_destroy (calendar-&gt;font_dialog);
}
-void calendar_select_font (GtkWidget *button,
- CalendarData *calendar)
+static void calendar_select_font( GtkWidget *button,
+ CalendarData *calendar )
{
GtkWidget *window;
@@ -5776,7 +5774,7 @@ void calendar_select_font (GtkWidget *button,
}
-void create_calendar ()
+static void create_calendar( void )
{
GtkWidget *window;
GtkWidget *vbox, *vbox2, *vbox3;
@@ -6079,8 +6077,8 @@ GdkColor color;
/* Color changed handler */
-void color_changed_cb( GtkWidget *widget,
- GtkColorSelection *colorsel )
+static void color_changed_cb( GtkWidget *widget,
+ GtkColorSelection *colorsel )
{
GdkColor ncolor;
@@ -6090,9 +6088,9 @@ void color_changed_cb( GtkWidget *widget,
/* Drawingarea event handler */
-gint area_event( GtkWidget *widget,
- GdkEvent *event,
- gpointer client_data )
+static gboolean area_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer client_data )
{
gint handled = FALSE;
gint response;
@@ -6136,9 +6134,9 @@ gint area_event( GtkWidget *widget,
/* Close down and exit handler */
-gint destroy_window( GtkWidget *widget,
- GdkEvent *event,
- gpointer client_data )
+static gboolean destroy_window( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer client_data )
{
gtk_main_quit ();
return TRUE;
@@ -6267,8 +6265,8 @@ screen, it does nothing as there is not a signal attached to it.</para>
#include &lt;gtk/gtk.h&gt;
/* Get the selected filename and print it to the console */
-void file_ok_sel( GtkWidget *w,
- GtkFileSelection *fs )
+static void file_ok_sel( GtkWidget *w,
+ GtkFileSelection *fs )
{
g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
}
@@ -6533,8 +6531,8 @@ gint y = 50;
/* This callback function moves the button to a new position
* in the Fixed container. */
-void move_button( GtkWidget *widget,
- GtkWidget *fixed )
+static void move_button( GtkWidget *widget,
+ GtkWidget *fixed )
{
x = (x + 30) % 300;
y = (y + 50) % 300;
@@ -6937,7 +6935,7 @@ window.</para>
#include &lt;gtk/gtk.h&gt;
/* Create the list of "messages" */
-GtkWidget *create_list( void )
+static GtkWidget *create_list( void )
{
GtkWidget *scrolled_window;
@@ -6991,7 +6989,7 @@ when our window is realized. We could also force our window to be
realized with gtk_widget_realize, but it would have to be part of
a hierarchy first */
-void insert_text (GtkTextBuffer *buffer)
+static void insert_text( GtkTextBuffer *buffer )
{
GtkTextIter iter;
@@ -7009,7 +7007,7 @@ void insert_text (GtkTextBuffer *buffer)
}
/* Create a scrolled text area that displays a "message" */
-GtkWidget *create_text( void )
+static GtkWidget *create_text( void )
{
GtkWidget *scrolled_window;
GtkWidget *view;
@@ -7103,9 +7101,9 @@ its own if you pass NULL as the value of the arguments.</para>
using the following four functions:</para>
<programlisting role="C">
-GtkAdjustment *gtk_viewport_get_hadjustment (GtkViewport *viewport );
+GtkAdjustment *gtk_viewport_get_hadjustment( GtkViewport *viewport );
-GtkAdjustment *gtk_viewport_get_vadjustment (GtkViewport *viewport );
+GtkAdjustment *gtk_viewport_get_vadjustment( GtkViewport *viewport );
void gtk_viewport_set_hadjustment( GtkViewport *viewport,
GtkAdjustment *adjustment );
@@ -7194,8 +7192,8 @@ new to you.</para>
#include &lt;stdio.h&gt;
#include &lt;gtk/gtk.h&gt;
-void destroy( GtkWidget *widget,
- gpointer data )
+static void destroy( GtkWidget *widget,
+ gpointer data )
{
gtk_main_quit ();
}
@@ -7330,12 +7328,12 @@ for Button Boxes.</para>
#include &lt;gtk/gtk.h&gt;
/* Create a Button Box with the specified parameters */
-GtkWidget *create_bbox( gint horizontal,
- char *title,
- gint spacing,
- gint child_w,
- gint child_h,
- gint layout )
+static GtkWidget *create_bbox( gint horizontal,
+ char *title,
+ gint spacing,
+ gint child_w,
+ gint child_h,
+ gint layout )
{
GtkWidget *frame;
GtkWidget *bbox;
@@ -7550,7 +7548,9 @@ additional explanations):</para>
/* This function is connected to the Close button or
* closing the window from the WM */
-gint delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
+static gboolean delete_event( GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
{
gtk_main_quit ();
return FALSE;
@@ -7580,7 +7580,8 @@ clearer I put them all together.</para>
* check which one is active and set the style of the toolbar
* accordingly
* ATTENTION: our toolbar is passed as data to callback ! */
-void radio_event (GtkWidget *widget, gpointer data)
+static void radio_event( GtkWidget *widget,
+ gpointer data )
{
if (GTK_TOGGLE_BUTTON (text_button)->active)
gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_TEXT);
@@ -7592,7 +7593,8 @@ void radio_event (GtkWidget *widget, gpointer data)
/* even easier, just check given toggle button and enable/disable
* tooltips */
-void toggle_event (GtkWidget *widget, gpointer data)
+static void toggle_event( GtkWidget *widget,
+ gpointer data )
{
gtk_toolbar_set_tooltips (GTK_TOOLBAR (data),
GTK_TOGGLE_BUTTON (widget)->active );
@@ -8018,15 +8020,15 @@ backward manner, and exit the program.</para>
#include &lt;gtk/gtk.h&gt;
/* This function rotates the position of the tabs */
-void rotate_book( GtkButton *button,
- GtkNotebook *notebook )
+static void rotate_book( GtkButton *button,
+ GtkNotebook *notebook )
{
gtk_notebook_set_tab_pos (notebook, (notebook-&gt;tab_pos + 1) % 4);
}
/* Add/Remove the page tabs and the borders */
-void tabsborder_book( GtkButton *button,
- GtkNotebook *notebook )
+static void tabsborder_book( GtkButton *button,
+ GtkNotebook *notebook )
{
gint tval = FALSE;
gint bval = FALSE;
@@ -8040,8 +8042,8 @@ void tabsborder_book( GtkButton *button,
}
/* Remove a page from the notebook */
-void remove_book( GtkButton *button,
- GtkNotebook *notebook )
+static void remove_book( GtkButton *button,
+ GtkNotebook *notebook )
{
gint page;
@@ -8052,9 +8054,9 @@ void remove_book( GtkButton *button,
gtk_widget_queue_draw (GTK_WIDGET (notebook));
}
-gint delete( GtkWidget *widget,
- GtkWidget *event,
- gpointer data )
+static gboolean delete( GtkWidget *widget,
+ GtkWidget *event,
+ gpointer data )
{
gtk_main_quit ();
return FALSE;
@@ -8408,8 +8410,8 @@ example. Take these steps:</para>
<listitem><simpara>Create an event handling function. It needs to have the
prototype</simpara>
<programlisting role="C">
-static gint handler (GtkWidget *widget,
- GdkEvent *event);
+static gboolean handler( GtkWidget *widget,
+ GdkEvent *event );
</programlisting>
<simpara>and it will use the event to find out where to pop up the menu.</simpara>
</listitem>
@@ -8454,7 +8456,7 @@ by a menu bar, as shown in the sample code.</simpara>
#include &lt;stdio.h&gt;
#include &lt;gtk/gtk.h&gt;
-static gint button_press (GtkWidget *, GdkEvent *);
+static gboolean button_press (GtkWidget *, GdkEvent *);
static void menuitem_response (gchar *);
int main( int argc,
@@ -8560,8 +8562,8 @@ int main( int argc,
* the button that was pressed.
*/
-static gint button_press( GtkWidget *widget,
- GdkEvent *event )
+static gboolean button_press( GtkWidget *widget,
+ GdkEvent *event )
{
if (event-&gt;type == GDK_BUTTON_PRESS) {
@@ -8701,15 +8703,15 @@ The callback for an ItemFactory entry can take two forms. If
form:</para>
<programlisting role="C">
-void callback(void)
+void callback( void )
</programlisting>
<para>otherwise it is of the form:</para>
<programlisting role="C">
-void callback(gpointer callback_data,
- guint callback_action,
- GtkWidget *widget)
+void callback( gpointer callback_data,
+ guint callback_action,
+ GtkWidget *widget )
</programlisting>
<para>
@@ -8759,9 +8761,9 @@ Since <literal>callback_action</literal> is not zero print_state() is of the
form:</para>
<programlisting role="C">
-void print_state(gpointer callback_data,
- guint callback_action,
- GtkWidget *widget)
+void print_state( gpointer callback_data,
+ guint callback_action,
+ GtkWidget *widget )
</programlisting>
<para>with <literal>callback_action</literal> equal to 7.</para>
@@ -8944,47 +8946,47 @@ static void print_hello( GtkWidget *w,
}
/* For the check button */
-static void print_toggle(gpointer callback_data,
- guint callback_action,
- GtkWidget *menu_item)
+static void print_toggle( gpointer callback_data,
+ guint callback_action,
+ GtkWidget *menu_item )
{
g_message ("Check button state - %d\n",
- GTK_CHECK_MENU_ITEM(menu_item)-&amp;gt;active);
+ GTK_CHECK_MENU_ITEM (menu_item)-&gt;active);
}
/* For the radio buttons */
-static void print_selected(gpointer callback_data,
- guint callback_action,
- GtkWidget *menu_item)
+static void print_selected( gpointer callback_data,
+ guint callback_action,
+ GtkWidget *menu_item )
{
- if(GTK_CHECK_MENU_ITEM(menu_item)-&amp;gt;active)
- g_message("Radio button %d selected\n", callback_action);
+ if(GTK_CHECK_MENU_ITEM(menu_item)-&gt;active)
+ g_message ("Radio button %d selected\n", callback_action);
}
/* Our menu, an array of GtkItemFactoryEntry structures that defines each menu item */
static GtkItemFactoryEntry menu_items[] = {
- { "/_File", NULL, NULL, 0, "&amp;lt;Branch&amp;gt;" },
- { "/File/_New", "&amp;lt;control&amp;gt;N", print_hello, 0, "&lt;StockItem&gt;", GTK_STOCK_NEW },
- { "/File/_Open", "&amp;lt;control&amp;gt;O", print_hello, 0, "&lt;StockItem&gt;", GTK_STOCK_OPEN },
- { "/File/_Save", "&amp;lt;control&amp;gt;S", print_hello, 0, "&lt;StockItem&gt;", GTK_STOCK_SAVE },
+ { "/_File", NULL, NULL, 0, "&lt;Branch&gt;" },
+ { "/File/_New", "&lt;control&gt;N", print_hello, 0, "&lt;StockItem&gt;", GTK_STOCK_NEW },
+ { "/File/_Open", "&lt;control&gt;O", print_hello, 0, "&lt;StockItem&gt;", GTK_STOCK_OPEN },
+ { "/File/_Save", "&lt;control&gt;S", print_hello, 0, "&lt;StockItem&gt;", GTK_STOCK_SAVE },
{ "/File/Save _As", NULL, NULL, 0, "&lt;Item&gt;" },
- { "/File/sep1", NULL, NULL, 0, "&amp;lt;Separator&amp;gt;" },
+ { "/File/sep1", NULL, NULL, 0, "&lt;Separator&gt;" },
{ "/File/_Quit", "&lt;CTRL&gt;Q", gtk_main_quit, 0, "&lt;StockItem&gt;", GTK_STOCK_QUIT },
- { "/_Options", NULL, NULL, 0, "&amp;lt;Branch&amp;gt;" },
- { "/Options/tear", NULL, NULL, 0, "&amp;lt;Tearoff&amp;gt;" },
- { "/Options/Check", NULL, print_toggle, 1, "&amp;lt;CheckItem&amp;gt;" },
- { "/Options/sep", NULL, NULL, 0, "&amp;lt;Separator&amp;gt;" },
- { "/Options/Rad1", NULL, print_selected, 1, "&amp;lt;RadioItem&amp;gt;" },
+ { "/_Options", NULL, NULL, 0, "&lt;Branch&gt;" },
+ { "/Options/tear", NULL, NULL, 0, "&lt;Tearoff&gt;" },
+ { "/Options/Check", NULL, print_toggle, 1, "&lt;CheckItem&gt;" },
+ { "/Options/sep", NULL, NULL, 0, "&lt;Separator&gt;" },
+ { "/Options/Rad1", NULL, print_selected, 1, "&lt;RadioItem&gt;" },
{ "/Options/Rad2", NULL, print_selected, 2, "/Options/Rad1" },
{ "/Options/Rad3", NULL, print_selected, 3, "/Options/Rad1" },
- { "/_Help", NULL, NULL, 0, "&amp;lt;LastBranch&amp;gt;" },
+ { "/_Help", NULL, NULL, 0, "&lt;LastBranch&gt;" },
{ "/_Help/About", NULL, NULL, 0, "&lt;Item&gt;" },
};
static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
/* Returns a menubar widget made from the above menu */
-GtkWidget *get_menubar_menu( GtkWidget *window)
+static GtkWidget *get_menubar_menu( GtkWidget *window )
{
GtkItemFactory *item_factory;
GtkAccelGroup *accel_group;
@@ -8993,7 +8995,7 @@ GtkWidget *get_menubar_menu( GtkWidget *window)
accel_group = gtk_accel_group_new ();
/* Make an ItemFactory (that makes a menubar) */
- item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "&amp;lt;main&amp;gt;",
+ item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "&lt;main&gt;",
accel_group);
/* This function generates the menu items. Pass the item factory,
@@ -9005,60 +9007,62 @@ GtkWidget *get_menubar_menu( GtkWidget *window)
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
/* Finally, return the actual menu bar created by the item factory. */
- return gtk_item_factory_get_widget (item_factory, "&amp;lt;main&amp;gt;");
+ return gtk_item_factory_get_widget (item_factory, "&lt;main&gt;");
}
/* Popup the menu when the popup button is pressed */
-static gint popup_cb(GtkWidget *widget, GdkEvent *event, GtkWidget *menu)
+static gboolean popup_cb( GtkWidget *widget,
+ GdkEvent *event,
+ GtkWidget *menu )
{
GdkEventButton *bevent = (GdkEventButton *)event;
/* Only take button presses */
- if(event-&amp;gt;type != GDK_BUTTON_PRESS)
+ if (event-&gt;type != GDK_BUTTON_PRESS)
return FALSE;
/* Show the menu */
- gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
- NULL, NULL, bevent-&amp;gt;button, bevent-&amp;gt;time);
+ gtk_menu_popup (GTK_MENU(menu), NULL, NULL,
+ NULL, NULL, bevent-&gt;button, bevent-&gt;time);
return TRUE;
}
/* Same as with get_menubar_menu() but just return a button with a signal to
call a popup menu */
-GtkWidget *get_popup_menu(void)
+GtkWidget *get_popup_menu( void )
{
GtkItemFactory *item_factory;
GtkWidget *button, *menu;
/* Same as before but don't bother with the accelerators */
- item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "&amp;lt;main&amp;gt;",
+ item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "&lt;main&gt;",
NULL);
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
- menu = gtk_item_factory_get_widget(item_factory, "&amp;lt;main&amp;gt;");
+ menu = gtk_item_factory_get_widget (item_factory, "&lt;main&gt;");
/* Make a button to activate the popup menu */
- button = gtk_button_new_with_label("Popup");
+ button = gtk_button_new_with_label ("Popup");
/* Make the menu popup when clicked */
- g_signal_connect(G_OBJECT(button),
- "event",
- G_CALLBACK(popup_cb),
- (gpointer) menu);
+ g_signal_connect (G_OBJECT(button),
+ "event",
+ G_CALLBACK(popup_cb),
+ (gpointer) menu);
return button;
}
/* Same again but return an option menu */
-GtkWidget *get_option_menu(void)
+GtkWidget *get_option_menu( void )
{
GtkItemFactory *item_factory;
GtkWidget *option_menu;
/* Same again, not bothering with the accelerators */
- item_factory = gtk_item_factory_new (GTK_TYPE_OPTION_MENU, "&amp;lt;main&amp;gt;",
+ item_factory = gtk_item_factory_new (GTK_TYPE_OPTION_MENU, "&lt;main&gt;",
NULL);
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
- option_menu = gtk_item_factory_get_widget(item_factory, "&amp;lt;main&amp;gt;");
+ option_menu = gtk_item_factory_get_widget (item_factory, "&lt;main&gt;");
return option_menu;
}
@@ -9091,8 +9095,8 @@ int main( int argc,
/* Note: all three menus are separately created, so they are not the
same menu */
menubar = get_menubar_menu (window);
- popup_button = get_popup_menu();
- option_menu = get_option_menu();
+ popup_button = get_popup_menu ();
+ option_menu = get_option_menu ();
/* Pack it all together */
gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
@@ -9105,7 +9109,7 @@ int main( int argc,
/* Finished! */
gtk_main ();
- return(0);
+ return 0;
}
<!-- example-end -->
</programlisting>
@@ -9279,9 +9283,9 @@ GtkStyle *gtk_widget_get_style( GtkWidget *widget );
GtkStyle *gtk_widget_get_default_style( void );
-void gtk_widget_set_size_request ( GtkWidget *widget,
- gint width,
- gint height );
+void gtk_widget_set_size_request( GtkWidget *widget,
+ gint width,
+ gint height );
void gtk_widget_grab_focus( GtkWidget *widget );
@@ -9359,7 +9363,7 @@ may be one of:</para>
ready for reading on your file descriptor.</simpara>
</listitem>
-<listitem><simpara>><literal>GDK_INPUT_WRITE</literal> - Call your function when the file
+<listitem><simpara><literal>GDK_INPUT_WRITE</literal> - Call your function when the file
descriptor is ready for writing.</simpara>
</listitem>
</itemizedlist>
@@ -9666,13 +9670,13 @@ converted.</para>
#include &lt;stdlib.h&gt;
#include &lt;gtk/gtk.h&gt;
-void selection_received( GtkWidget *widget,
- GtkSelectionData *selection_data,
- gpointer data );
+static void selection_received( GtkWidget *widget,
+ GtkSelectionData *selection_data,
+ gpointer data );
/* Signal handler invoked when user clicks on the "Get Targets" button */
-void get_targets( GtkWidget *widget,
- gpointer data )
+static void get_targets( GtkWidget *widget,
+ gpointer data )
{
static GdkAtom targets_atom = GDK_NONE;
GtkWidget *window = (GtkWidget *)data;
@@ -9687,9 +9691,9 @@ void get_targets( GtkWidget *widget,
}
/* Signal handler called when the selections owner returns the data */
-void selection_received( GtkWidget *widget,
- GtkSelectionData *selection_data,
- gpointer data )
+static void selection_received( GtkWidget *widget,
+ GtkSelectionData *selection_data,
+ gpointer data )
{
GdkAtom *atoms;
GList *item_list;
@@ -9772,10 +9776,10 @@ handlers that will be called when your selection is requested. For
each selection/target pair you will handle, you make a call to:</para>
<programlisting role="C">
-void gtk_selection_add_target (GtkWidget *widget,
+void gtk_selection_add_target( GtkWidget *widget,
GdkAtom selection,
GdkAtom target,
- guint info);
+ guint info );
</programlisting>
<para><literal>widget</literal>, <literal>selection</literal>, and <literal>target</literal> identify the requests
@@ -9786,10 +9790,10 @@ enumerator to identify the specific target within the callback function.</para>
<para>The callback function has the signature:</para>
<programlisting role="C">
-void "selection_get" (GtkWidget *widget,
+void "selection_get"( GtkWidget *widget,
GtkSelectionData *selection_data,
guint info,
- guint time);
+ guint time );
</programlisting>
<para>The GtkSelectionData is the same as above, but this time, we're
@@ -9843,8 +9847,8 @@ GtkWidget *selection_button;
GtkWidget *selection_widget;
/* Callback when the user toggles the selection */
-void selection_toggled( GtkWidget *widget,
- gint *have_selection )
+static void selection_toggled( GtkWidget *widget,
+ gint *have_selection )
{
if (GTK_TOGGLE_BUTTON (widget)-&gt;active)
{
@@ -9871,9 +9875,9 @@ void selection_toggled( GtkWidget *widget,
}
/* Called when another application claims the selection */
-gint selection_clear( GtkWidget *widget,
- GdkEventSelection *event,
- gint *have_selection )
+static gboolean selection_clear( GtkWidget *widget,
+ GdkEventSelection *event,
+ gint *have_selection )
{
*have_selection = FALSE;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (selection_button), FALSE);
@@ -9882,11 +9886,11 @@ gint selection_clear( GtkWidget *widget,
}
/* Supplies the current time as the selection. */
-void selection_handle( GtkWidget *widget,
- GtkSelectionData *selection_data,
- guint info,
- guint time_stamp,
- gpointer data )
+static void selection_handle( GtkWidget *widget,
+ GtkSelectionData *selection_data,
+ guint info,
+ guint time_stamp,
+ gpointer data )
{
gchar *timestr;
time_t current_time;
@@ -10259,10 +10263,16 @@ G_MINDOUBLE
G_MAXDOUBLE
G_MINSHORT
G_MAXSHORT
+G_MAXUSHORT
G_MININT
G_MAXINT
+G_MAXUINT
G_MINLONG
G_MAXLONG
+G_MAXULONG
+G_MININT64
+G_MAXINT64
+G_MAXUINT64
</programlisting>
<para>Also, the following typedefs. The ones left unspecified are dynamically set
@@ -10275,7 +10285,7 @@ char gchar;
short gshort;
long glong;
int gint;
-char gboolean;
+int gboolean;
unsigned char guchar;
unsigned short gushort;
@@ -10284,9 +10294,12 @@ unsigned int guint;
float gfloat;
double gdouble;
-long double gldouble;
-void* gpointer;
+unsigned int gsize;
+signed int gssize;
+
+void* gpointer;
+const void* gconstpointer;
gint8
guint8
@@ -10294,6 +10307,8 @@ gint16
guint16
gint32
guint32
+gint64
+guint64
</programlisting>
</sect1>
@@ -11236,7 +11251,7 @@ enum {
};
-static gint tictactoe_signals[LAST_SIGNAL] = { 0 };
+static guint tictactoe_signals[LAST_SIGNAL] = { 0 };
static void
tictactoe_class_init (TictactoeClass *klass)
@@ -11561,7 +11576,7 @@ window for the widget if it has one.</simpara>
<listitem><simpara> <literal>WIDGETNAME_map()</literal> is invoked after the user calls
<literal>gtk_widget_show()</literal>. It is responsible for making sure the widget
is actually drawn on the screen (<emphasis>mapped</emphasis>). For a container class,
-it must also make calls to <literal>map()</literal>> functions of any child widgets.</simpara>
+it must also make calls to <literal>map()</literal> functions of any child widgets.</simpara>
</listitem>
<listitem><simpara> <literal>WIDGETNAME_draw()</literal> is invoked when <literal>gtk_widget_draw()</literal>
is called for the widget or one of its ancestors. It makes the actual
@@ -12034,9 +12049,9 @@ three dimensional shading according to the colors stored in the
widget's style.</para>
<programlisting role="C">
-static gint
-gtk_dial_expose (GtkWidget *widget,
- GdkEventExpose *event)
+static gboolean
+gtk_dial_expose( GtkWidget *widget,
+ GdkEventExpose *event )
{
GtkDial *dial;
GdkPoint points[3];
@@ -12131,9 +12146,9 @@ set, "value_changed" events are either generated instantly
button is released (<literal>GTK_UPDATE_DISCONTINUOUS</literal>).</para>
<programlisting role="C">
-static gint
-gtk_dial_button_press (GtkWidget *widget,
- GdkEventButton *event)
+static gboolean
+gtk_dial_button_press( GtkWidget *widget,
+ GdkEventButton *event )
{
GtkDial *dial;
gint dx, dy;
@@ -12175,9 +12190,9 @@ gtk_dial_button_press (GtkWidget *widget,
return FALSE;
}
-static gint
-gtk_dial_button_release (GtkWidget *widget,
- GdkEventButton *event)
+static gboolean
+gtk_dial_button_release( GtkWidget *widget,
+ GdkEventButton *event )
{
GtkDial *dial;
@@ -12204,9 +12219,9 @@ gtk_dial_button_release (GtkWidget *widget,
return FALSE;
}
-static gint
-gtk_dial_motion_notify (GtkWidget *widget,
- GdkEventMotion *event)
+static gboolean
+gtk_dial_motion_notify( GtkWidget *widget,
+ GdkEventMotion *event )
{
GtkDial *dial;
GdkModifierType mods;
@@ -12249,8 +12264,8 @@ gtk_dial_motion_notify (GtkWidget *widget,
return FALSE;
}
-static gint
-gtk_dial_timer (GtkDial *dial)
+static gboolean
+gtk_dial_timer( GtkDial *dial )
{
g_return_val_if_fail (dial != NULL, FALSE);
g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE);
@@ -12653,8 +12668,8 @@ later. The "motion_notify_event" and "button_press_event" handlers
are pretty simple:</para>
<programlisting role="C">
-static gint
-button_press_event (GtkWidget *widget, GdkEventButton *event)
+static gboolean
+button_press_event( GtkWidget *widget, GdkEventButton *event )
{
if (event->button == 1 &amp;&amp; pixmap != NULL)
draw_brush (widget, event->x, event->y);
@@ -12662,8 +12677,8 @@ button_press_event (GtkWidget *widget, GdkEventButton *event)
return TRUE;
}
-static gint
-motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
+static gboolean
+motion_notify_event( GtkWidget *widget, GdkEventMotion *event )
{
int x, y;
GdkModifierType state;
@@ -12753,8 +12768,8 @@ is originally created.</para>
static GdkPixmap *pixmap = NULL;
/* Create a new backing pixmap of the appropriate size */
-static gint
-configure_event (GtkWidget *widget, GdkEventConfigure *event)
+static gboolean
+configure_event( GtkWidget *widget, GdkEventConfigure *event )
{
if (pixmap)
gdk_pixmap_unref(pixmap);
@@ -12783,8 +12798,8 @@ to redraw by using the event->area field of the exposure event):</para>
<programlisting role="C">
/* Redraw the screen from the backing pixmap */
-static gint
-expose_event (GtkWidget *widget, GdkEventExpose *event)
+static gboolean
+expose_event( GtkWidget *widget, GdkEventExpose *event )
{
gdk_draw_pixmap(widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
@@ -13081,8 +13096,8 @@ doesn't change much - we just need to add code to deal with the
extended information.</para>
<programlisting role="C">
-static gint
-button_press_event (GtkWidget *widget, GdkEventButton *event)
+static gboolean
+button_press_event( GtkWidget *widget, GdkEventButton *event )
{
print_button_press (event->deviceid);
@@ -13092,8 +13107,8 @@ button_press_event (GtkWidget *widget, GdkEventButton *event)
return TRUE;
}
-static gint
-motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
+static gboolean
+motion_notify_event( GtkWidget *widget, GdkEventMotion *event )
{
gdouble x, y;
gdouble pressure;
@@ -14593,7 +14608,7 @@ static void tictactoe_class_init (TictactoeClass *klass);
static void tictactoe_init (Tictactoe *ttt);
static void tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt);
-static gint tictactoe_signals[LAST_SIGNAL] = { 0 };
+static guint tictactoe_signals[LAST_SIGNAL] = { 0 };
GType
tictactoe_get_type (void)
@@ -14923,23 +14938,23 @@ void gtk_dial_set_adjustment (GtkDial *dial,
/* Forward declarations */
-static void gtk_dial_class_init (GtkDialClass *klass);
-static void gtk_dial_init (GtkDial *dial);
+static void gtk_dial_class_init (GtkDialClass *klass);
+static void gtk_dial_init (GtkDial *dial);
static void gtk_dial_destroy (GtkObject *object);
static void gtk_dial_realize (GtkWidget *widget);
-static void gtk_dial_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_dial_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint gtk_dial_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_dial_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_dial_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_dial_motion_notify (GtkWidget *widget,
- GdkEventMotion *event);
-static gint gtk_dial_timer (GtkDial *dial);
+static void gtk_dial_size_request (GtkWidget *widget,
+ GtkRequisition *requisition);
+static void gtk_dial_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation);
+static gboolean gtk_dial_expose (GtkWidget *widget,
+ GdkEventExpose *event);
+static gboolean gtk_dial_button_press (GtkWidget *widget,
+ GdkEventButton *event);
+static gboolean gtk_dial_button_release (GtkWidget *widget,
+ GdkEventButton *event);
+static gboolean gtk_dial_motion_notify (GtkWidget *widget,
+ GdkEventMotion *event);
+static gboolean gtk_dial_timer (GtkDial *dial);
static void gtk_dial_update_mouse (GtkDial *dial, gint x, gint y);
static void gtk_dial_update (GtkDial *dial);
@@ -15168,9 +15183,9 @@ gtk_dial_size_allocate (GtkWidget *widget,
dial-&gt;pointer_width = dial-&gt;radius / 5;
}
-static gint
-gtk_dial_expose (GtkWidget *widget,
- GdkEventExpose *event)
+static gboolean
+gtk_dial_expose( GtkWidget *widget,
+ GdkEventExpose *event )
{
GtkDial *dial;
GdkPoint points[6];
@@ -15307,9 +15322,9 @@ gtk_dial_expose (GtkWidget *widget,
return FALSE;
}
-static gint
-gtk_dial_button_press (GtkWidget *widget,
- GdkEventButton *event)
+static gboolean
+gtk_dial_button_press( GtkWidget *widget,
+ GdkEventButton *event )
{
GtkDial *dial;
gint dx, dy;
@@ -15351,9 +15366,9 @@ gtk_dial_button_press (GtkWidget *widget,
return FALSE;
}
-static gint
-gtk_dial_button_release (GtkWidget *widget,
- GdkEventButton *event)
+static gboolean
+gtk_dial_button_release( GtkWidget *widget,
+ GdkEventButton *event )
{
GtkDial *dial;
@@ -15380,9 +15395,9 @@ gtk_dial_button_release (GtkWidget *widget,
return FALSE;
}
-static gint
-gtk_dial_motion_notify (GtkWidget *widget,
- GdkEventMotion *event)
+static gboolean
+gtk_dial_motion_notify( GtkWidget *widget,
+ GdkEventMotion *event )
{
GtkDial *dial;
GdkModifierType mods;
@@ -15425,8 +15440,8 @@ gtk_dial_motion_notify (GtkWidget *widget,
return FALSE;
}
-static gint
-gtk_dial_timer (GtkDial *dial)
+static gboolean
+gtk_dial_timer( GtkDial *dial )
{
g_return_val_if_fail (dial != NULL, FALSE);
g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE);
@@ -15438,7 +15453,7 @@ gtk_dial_timer (GtkDial *dial)
}
static void
-gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
+gtk_dial_update_mouse( GtkDial *dial, gint x, gint y )
{
gint xc, yc;
gfloat old_value;
@@ -15677,8 +15692,8 @@ int main( int argc,
static GdkPixmap *pixmap = NULL;
/* Create a new backing pixmap of the appropriate size */
-static gint configure_event( GtkWidget *widget,
- GdkEventConfigure *event )
+static gboolean configure_event( GtkWidget *widget,
+ GdkEventConfigure *event )
{
if (pixmap)
g_object_unref (pixmap);
@@ -15698,8 +15713,8 @@ static gint configure_event( GtkWidget *widget,
}
/* Redraw the screen from the backing pixmap */
-static gint expose_event( GtkWidget *widget,
- GdkEventExpose *event )
+static gboolean expose_event( GtkWidget *widget,
+ GdkEventExpose *event )
{
gdk_draw_drawable (widget-&gt;window,
widget-&gt;style-&gt;fg_gc[GTK_WIDGET_STATE (widget)],
@@ -15732,8 +15747,8 @@ static void draw_brush( GtkWidget *widget,
update_rect.width, update_rect.height);
}
-static gint button_press_event( GtkWidget *widget,
- GdkEventButton *event )
+static gboolean button_press_event( GtkWidget *widget,
+ GdkEventButton *event )
{
if (event-&gt;button == 1 &amp;&amp; pixmap != NULL)
draw_brush (widget, event-&gt;x, event-&gt;y);
@@ -15741,8 +15756,8 @@ static gint button_press_event( GtkWidget *widget,
return TRUE;
}
-static gint motion_notify_event( GtkWidget *widget,
- GdkEventMotion *event )
+static gboolean motion_notify_event( GtkWidget *widget,
+ GdkEventMotion *event )
{
int x, y;
GdkModifierType state;
@@ -15868,7 +15883,7 @@ int main( int argc,
static GdkPixmap *pixmap = NULL;
/* Create a new backing pixmap of the appropriate size */
-static gint
+static gboolean
configure_event (GtkWidget *widget, GdkEventConfigure *event)
{
if (pixmap)
@@ -15889,7 +15904,7 @@ configure_event (GtkWidget *widget, GdkEventConfigure *event)
}
/* Redraw the screen from the backing pixmap */
-static gint
+static gboolean
expose_event (GtkWidget *widget, GdkEventExpose *event)
{
gdk_draw_drawable (widget-&gt;window,
@@ -15944,7 +15959,7 @@ print_button_press (GdkDevice *device)
g_print ("Button press on device '%s'\n", device-&gt;name);
}
-static gint
+static gboolean
button_press_event (GtkWidget *widget, GdkEventButton *event)
{
print_button_press (event-&gt;device);
@@ -15958,7 +15973,7 @@ button_press_event (GtkWidget *widget, GdkEventButton *event)
return TRUE;
}
-static gint
+static gboolean
motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
{
gdouble x, y;