Commit 44ec61dd authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Re-extract.

2005-01-03  Matthias Clasen  <mclasen@redhat.com>

	* examples/*: Re-extract.

	* docs/tutorial/gtk-tut.sgml: Small corrections.
parent 6803d93d
2005-01-03 Matthias Clasen <mclasen@redhat.com>
* examples/*: Re-extract.
* docs/tutorial/gtk-tut.sgml: Small corrections.
* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
section. (#161414, Robert Ancell)
......
2005-01-03 Matthias Clasen <mclasen@redhat.com>
* examples/*: Re-extract.
* docs/tutorial/gtk-tut.sgml: Small corrections.
* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
section. (#161414, Robert Ancell)
......
2005-01-03 Matthias Clasen <mclasen@redhat.com>
* examples/*: Re-extract.
* docs/tutorial/gtk-tut.sgml: Small corrections.
* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
section. (#161414, Robert Ancell)
......
2005-01-03 Matthias Clasen <mclasen@redhat.com>
* examples/*: Re-extract.
* docs/tutorial/gtk-tut.sgml: Small corrections.
* docs/tutorial/gtk-tut.sgml: Some updates for the drawing
section. (#161414, Robert Ancell)
......
......@@ -4048,6 +4048,7 @@ int main( int argc,
/* Create the GtkProgressBar */
pdata-&gt;pbar = gtk_progress_bar_new ();
pdata-&gt;activity_mode = FALSE;
gtk_container_add (GTK_CONTAINER (align), pdata-&gt;pbar);
gtk_widget_show (pdata-&gt;pbar);
......@@ -4214,7 +4215,7 @@ parent.</para></listitem>
<para>Ruler widgets are used to indicate the location of the mouse pointer
in a given window. A window can have a vertical ruler spanning across
the width and a horizontal ruler spanning down the height. A small
the height and a horizontal ruler spanning down the width. A small
triangular indicator on the ruler shows the exact location of the
pointer relative to the ruler.</para>
......
#include <config.h>
#include <gtk/gtk.h>
/* 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;
......
#include <config.h>
#include <gtk/gtk.h>
int main( int argc,
......
#include <config.h>
#include <gtk/gtk.h>
int main( int argc,
......
#include <config.h>
#include <gtk/gtk.h>
/* 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;
......
#include <config.h>
#include <stdlib.h>
#include <gtk/gtk.h>
/* 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;
......@@ -34,8 +33,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);
}
......
......@@ -17,7 +17,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
......@@ -50,23 +49,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->window),
&year, &month, &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;
......@@ -78,8 +76,8 @@ void calendar_set_signal_strings (char *sig_str,
gtk_label_set_text (GTK_LABEL (data->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: ";
......@@ -87,8 +85,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: ";
......@@ -96,8 +94,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;
......@@ -115,8 +113,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: ";
......@@ -124,8 +122,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: ";
......@@ -133,8 +131,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: ";
......@@ -142,8 +140,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: ";
......@@ -152,7 +150,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;
......@@ -165,8 +163,8 @@ void calendar_set_flags (CalendarData *calendar)
gtk_calendar_display_options (GTK_CALENDAR (calendar->window), options);
}
void calendar_toggle_flag (GtkWidget *toggle,
CalendarData *calendar)
static void calendar_toggle_flag( GtkWidget *toggle,
CalendarData *calendar)
{
gint i;
gint j;
......@@ -180,8 +178,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;
......@@ -202,8 +200,8 @@ void calendar_font_selection_ok (GtkWidget *button,
gtk_widget_destroy (calendar->font_dialog);
}
void calendar_select_font (GtkWidget *button,
CalendarData *calendar)
static void calendar_select_font( GtkWidget *button,
CalendarData *calendar )
{
GtkWidget *window;
......@@ -233,7 +231,7 @@ void calendar_select_font (GtkWidget *button,
}
void create_calendar ()
static void create_calendar( void )
{
GtkWidget *window;
GtkWidget *vbox, *vbox2, *vbox3;
......
#include <config.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
......@@ -10,8 +9,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;
......@@ -21,9 +20,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;
......@@ -49,7 +48,7 @@ gint area_event( GtkWidget *widget,
/* Connect to the "color_changed" signal, set the client-data
* to the colorsel widget */
g_signal_connect (G_OBJECT (colorsel), "color_changed",
G_CALLBACK (color_changed_cb), (gpointer)colorsel);
G_CALLBACK (color_changed_cb), (gpointer) colorsel);
/* Show the dialog */
response = gtk_dialog_run (GTK_DIALOG (colorseldlg));
......@@ -67,9 +66,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;
......@@ -95,7 +94,7 @@ gint main( gint argc,
/* Attach to the "delete" and "destroy" events so we can exit */
g_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (destroy_window), (gpointer)window);
GTK_SIGNAL_FUNC (destroy_window), (gpointer) window);
/* Create drawingarea, set size and catch button events */
......@@ -111,7 +110,7 @@ gint main( gint argc,
gtk_widget_set_events (drawingarea, GDK_BUTTON_PRESS_MASK);
g_signal_connect (GTK_OBJECT (drawingarea), "event",
GTK_SIGNAL_FUNC (area_event), (gpointer)drawingarea);
GTK_SIGNAL_FUNC (area_event), (gpointer) drawingarea);
/* Add drawingarea to window, then show them both */
......
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
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)->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)->active);
......
#include <config.h>
#include <stdlib.h>
#include <gtk/gtk.h>
......
#include <config.h>
#include <gtk/gtk.h>
/* 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)));
}
......
#include <config.h>
#include <gtk/gtk.h>
/* I'm going to be lazy and use some global variables to
......@@ -10,8 +9,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;
......
#include <config.h>
#include <gtk/gtk.h>
int main( int argc,
......
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
......
......@@ -17,7 +17,6 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <math.h>
#include <stdio.h>
#include <gtk/gtkmain.h>
......@@ -30,23 +29,23 @@
/* 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 gboolean 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);
......@@ -275,9 +274,9 @@ gtk_dial_size_allocate (GtkWidget *widget,
dial->pointer_width = dial->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];
......@@ -414,9 +413,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;
......@@ -458,9 +457,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;
......@@ -487,9 +486,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;
......@@ -533,7 +532,7 @@ gtk_dial_motion_notify (GtkWidget *widget,
}
static gboolean
gtk_dial_timer (GtkDial *dial)
gtk_dial_timer( GtkDial *dial )
{
g_return_val_if_fail (dial != NULL, FALSE);
g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE);
......@@ -545,7 +544,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;
......
#include <config.h>
#include <gtk/gtk.h>
/* 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
......@@ -29,8 +28,8 @@ gint delete_event( GtkWidget *widget,
}
/* Another callback */
void destroy( GtkWidget *widget,
gpointer data )
static void destroy( GtkWidget *widget,
gpointer data )
{
gtk_main_quit ();
}
......
#include <config.h>
#include <gtk/gtk.h>
/* 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;
......
#include <config.h>
#include <gtk/gtk.h>
int main( int argc,
......
#include <config.h>
#include <gtk/gtk.h>
/* Obligatory basic callback */
......@@ -10,21 +9,21 @@ 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)->active);
GTK_CHECK_MENU_ITEM (menu_item)->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)->active)
g_message("Radio button %d selected\n", callback_action);
g_message ("Radio button %d selected\n", callback_action);
}
/* Our menu, an array of GtkItemFactoryEntry structures that defines each menu item */
......@@ -50,7 +49,7 @@ static GtkItemFactoryEntry menu_items[] = {
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;
......@@ -75,24 +74,26 @@ GtkWidget *get_menubar_menu( GtkWidget *window)
}
/* 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->type != GDK_BUTTON_PRESS)
if (event->type != GDK_BUTTON_PRESS)
return FALSE;
/* Show the menu */
gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
NULL, NULL, bevent->button, bevent->time);
gtk_menu_popup (GTK_MENU(menu), NULL, NULL,
NULL, NULL, bevent->button, bevent->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;
......@@ -101,21 +102,21 @@ GtkWidget *get_popup_menu(void)
item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<main>",
NULL);
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
menu = gtk_item_factory_get_widget(item_factory, "<main>");
menu = gtk_item_factory_get_widget (item_factory, "<main>");
/* 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 */
</