More GTK+ 2.0 updates.

* docs/tutorial/gtk-tut.sgml, docs/tutorial/images/*, examples/*: More
	 GTK+ 2.0 updates.

	* docs/tutorial/Makefile.am: build and dist the new tutorial, not
	the old Linuxdoc one.
This commit is contained in:
Matthias Clasen 2002-02-25 01:47:44 +00:00
parent 4d06c9d09f
commit 9f1363013f
14 changed files with 740 additions and 1600 deletions

View File

@ -1,156 +1,68 @@
TUTORIAL_FR_FILES=html/gtk_tut_fr-1.html \ .PHONY: html pdf
html/gtk_tut_fr-2.html \
html/gtk_tut_fr-3.html \
html/gtk_tut_fr-4.html \
html/gtk_tut_fr-5.html \
html/gtk_tut_fr-6.html \
html/gtk_tut_fr-7.html \
html/gtk_tut_fr-8.html \
html/gtk_tut_fr-9.html \
html/gtk_tut_fr-10.html \
html/gtk_tut_fr-11.html \
html/gtk_tut_fr-12.html \
html/gtk_tut_fr-13.html \
html/gtk_tut_fr-14.html \
html/gtk_tut_fr-15.html \
html/gtk_tut_fr-16.html \
html/gtk_tut_fr-17.html \
html/gtk_tut_fr-18.html \
html/gtk_tut_fr-19.html \
html/gtk_tut_fr-20.html \
html/gtk_tut_fr-21.html \
html/gtk_tut_fr-22.html \
html/gtk_tut_fr-23.html \
html/gtk_tut_fr-24.html \
html/gtk_tut_fr.html text/gtk_tut_fr.txt
TUTORIAL_FILES=text/gtk_tut.txt html/gtk_tut.html \
html/gtk_tut.html \
html/gtk_tut-1.html \
html/gtk_tut-2.html \
html/gtk_tut-3.html \
html/gtk_tut-4.html \
html/gtk_tut-5.html \
html/gtk_tut-6.html \
html/gtk_tut-7.html \
html/gtk_tut-8.html \
html/gtk_tut-9.html \
html/gtk_tut-10.html \
html/gtk_tut-11.html \
html/gtk_tut-12.html \
html/gtk_tut-13.html \
html/gtk_tut-14.html \
html/gtk_tut-15.html \
html/gtk_tut-16.html \
html/gtk_tut-17.html \
html/gtk_tut-18.html \
html/gtk_tut-19.html \
html/gtk_tut-20.html \
html/gtk_tut-21.html \
html/gtk_tut-22.html \
html/gtk_tut-23.html \
html/gtk_tut-24.html \
html/gtk_tut-25.html \
html/gtk_tut-26.html \
html/gtk_tut-27.html \
html/gtk_tut-28.html \
html/gtk_tut-29.html \
html/gtk_tut-30.html \
html/gtk_tut-31.html
TUTORIAL_IT_FILES= html/gtk_tut_it.html \
html/gtk_tut_it-1.html \
html/gtk_tut_it-2.html \
html/gtk_tut_it-3.html \
html/gtk_tut_it-4.html \
html/gtk_tut_it-5.html \
html/gtk_tut_it-6.html \
html/gtk_tut_it-7.html \
html/gtk_tut_it-8.html \
html/gtk_tut_it-9.html \
html/gtk_tut_it-10.html \
html/gtk_tut_it-11.html \
html/gtk_tut_it-12.html \
html/gtk_tut_it-13.html \
html/gtk_tut_it-14.html \
html/gtk_tut_it-15.html \
html/gtk_tut_it-16.html \
html/gtk_tut_it-17.html \
html/gtk_tut_it-18.html \
html/gtk_tut_it-19.html \
html/gtk_tut_it-20.html \
html/gtk_tut_it-21.html \
html/gtk_tut_it-22.html \
html/gtk_tut_it-23.html \
html/gtk_tut_it-24.html \
text/gtk_tut_it.txt
GTKDOCS_FIX=$(srcdir)/../gtkdocs_fix
.PHONY: htmldir textdir tutorial tutorial_it tutorial_fr
htmldir:
(cd $(srcdir); mkdir -p html; cp gtk_tut*gif html)
textdir:
mkdir -p $(srcdir)/text
$(TUTORIAL_FILES): tutorial
$(TUTORIAL_FR_FILES): tutorial_fr
$(TUTORIAL_IT_FILES): tutorial_it
tutorial: htmldir textdir
(cd $(srcdir); sgml2html gtk_tut.sgml; \
perl $(GTKDOCS_FIX) gtk_tut*html; \
mv gtk_tut*html html/; \
sgml2txt gtk_tut.sgml; \
mv gtk_tut.txt text/)
tutorial_it: htmldir textdir
(cd $(srcdir); sgml2html --language=it gtk_tut_it.sgml; \
perl $(GTKDOCS_FIX) gtk_tut_it*html; \
mv gtk_tut_it*html html/; \
sgml2txt --language=it gtk_tut_it.sgml; \
mv gtk_tut_it.txt text/)
tutorial_fr: htmldir textdir
(cd $(srcdir); sgml2html --language=fr gtk_tut_fr.sgml; \
perl $(GTKDOCS_FIX) gtk_tut_fr*html; \
mv gtk_tut_fr*html html/; \
sgml2txt --language=fr gtk_tut_fr.sgml; \
mv gtk_tut_fr.txt text/)
EXTRA_DIST = \ EXTRA_DIST = \
gtk_tut.sgml \ gtk-tut.sgml \
gtk_tut_12.es.sgml \ images/arrow.png \
gtk_tut_it.sgml \ images/aspectframe.png \
gtk_tut_fr.sgml \ images/base.png \
gtk_tut_packbox1.gif \ images/buttonbox.png \
gtk_tut_packbox1.eps \ images/buttons.png \
gtk_tut_packbox1.jpg \ images/calendar.png \
gtk_tut_packbox2.gif \ images/colorsel.png \
gtk_tut_packbox2.eps \ images/entry.png \
gtk_tut_packbox2.jpg \ images/eventbox.png \
gtk_tut_table.gif \ images/filesel.png \
gtk_tut_table.eps \ images/fixed.png \
gtk_tut_table.jpg \ images/frame.png \
package_tutorial.sh \ images/gtkdial.png \
package-db-tutorial.sh images/helloworld.png \
images/helloworld2.png \
images/label.png \
images/menu.png \
images/notebook.png \
images/packbox1.png \
images/packbox2.png \
images/paned.png \
images/progressbar.png \
images/radiobuttons.png \
images/rangewidgets.png \
images/rulers.png \
images/scribble.png \
images/scrolledwin.png \
images/spinbutton.png \
images/statusbar.png \
images/table.png \
images/tictactoe.png
if HAVE_SGML2HTML if HAVE_DOCBOOK
dist-hook: tutorial tutorial_it tutorial_fr html:
mkdir $(distdir)/html (cd $(srcdir); \
cp -p $(srcdir)/html/*.html $(distdir)/html db2html gtk-tut.sgml; \
cp -p $(srcdir)/html/*.gif $(distdir)/html mv gtk-tut html; \
mkdir $(distdir)/text mkdir html/images; \
cp -p $(srcdir)/text/*.txt $(distdir)/text cp images/*.png html/images)
pdf:
(cd $(srcdir); db2pdf gtk-tut.sgml)
dist-hook: html pdf
cp -Rp $(srcdir)/html $(distdir)
cp -p $(srcdir)/gtk-tut.pdf $(distdir)
else else
html:
echo "***"
echo "*** Warning: Tutorial not built"
echo "***"
pdf:
echo "***"
echo "*** Warning: Tutorial not built"
echo "***"
dist-hook: dist-hook:
echo "***" echo "***"
echo "*** Warning: Tutorial not built" echo "*** Warning: Tutorial not built"
echo "*** DISTRIBUTION IS INCOMPLETE" echo "*** DISTRIBUTION IS INCOMPLETE"
echo "***" echo "***"
endif endif

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -9,7 +9,7 @@ int main( int argc,
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window); gtk_widget_show (window);
gtk_main (); gtk_main ();

View File

@ -1,7 +1,7 @@
CC = gcc CC = gcc
CFLAGS = -Wall \ CFLAGS = -Wall -Wunused \
-DG_DISABLE_DEPRECATED \ -DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \ -DGDK_DISABLE_DEPRECATED \
-DGDK_PIXBUF_DISABLE_DEPRECATED \ -DGDK_PIXBUF_DISABLE_DEPRECATED \

View File

@ -5,44 +5,31 @@
/* Create a new hbox with an image and a label packed into it /* Create a new hbox with an image and a label packed into it
* and return the box. */ * and return the box. */
GtkWidget *xpm_label_box( GtkWidget *parent, GtkWidget *xpm_label_box( gchar *xpm_filename,
gchar *xpm_filename,
gchar *label_text ) gchar *label_text )
{ {
GtkWidget *box1; GtkWidget *box;
GtkWidget *label; GtkWidget *label;
GtkWidget *pixmapwid; GtkWidget *image;
GdkPixmap *pixmap;
GdkBitmap *mask;
GtkStyle *style;
/* Create box for xpm and label */ /* Create box for image and label */
box1 = gtk_hbox_new (FALSE, 0); box = gtk_hbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (box1), 2); gtk_container_set_border_width (GTK_CONTAINER (box), 2);
/* Get the style of the button to get the /* Now on to the image stuff */
* background color. */ image = gtk_image_new_from_file (xpm_filename);
style = gtk_widget_get_style (parent);
/* Now on to the xpm stuff */
pixmap = gdk_pixmap_create_from_xpm (parent->window, &mask,
&style->bg[GTK_STATE_NORMAL],
xpm_filename);
pixmapwid = gtk_image_new_from_file (xpm_filename);
/* Create a label for the button */ /* Create a label for the button */
label = gtk_label_new (label_text); label = gtk_label_new (label_text);
/* Pack the pixmap and label into the box */ /* Pack the image and label into the box */
gtk_box_pack_start (GTK_BOX (box1), gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 3);
pixmapwid, FALSE, FALSE, 3); gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 3);
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 3); gtk_widget_show (image);
gtk_widget_show (pixmapwid);
gtk_widget_show (label); gtk_widget_show (label);
return box1; return box;
} }
/* Our usual callback function */ /* Our usual callback function */
@ -58,7 +45,7 @@ int main( int argc,
/* GtkWidget is the storage type for widgets */ /* GtkWidget is the storage type for widgets */
GtkWidget *window; GtkWidget *window;
GtkWidget *button; GtkWidget *button;
GtkWidget *box1; GtkWidget *box;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
@ -76,7 +63,6 @@ int main( int argc,
/* Sets the border width of the window. */ /* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_widget_realize (window);
/* Create a new button */ /* Create a new button */
button = gtk_button_new (); button = gtk_button_new ();
@ -86,12 +72,12 @@ int main( int argc,
G_CALLBACK (callback), (gpointer) "cool button"); G_CALLBACK (callback), (gpointer) "cool button");
/* This calls our box creating function */ /* This calls our box creating function */
box1 = xpm_label_box(window, "info.xpm", "cool button"); box = xpm_label_box ("info.xpm", "cool button");
/* Pack and show all our widgets */ /* Pack and show all our widgets */
gtk_widget_show (box1); gtk_widget_show (box);
gtk_container_add (GTK_CONTAINER (button), box1); gtk_container_add (GTK_CONTAINER (button), box);
gtk_widget_show (button); gtk_widget_show (button);

View File

@ -1,3 +1,4 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>

View File

@ -1,3 +1,4 @@
/* GTK - The GIMP Toolkit /* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
* *
@ -28,30 +29,30 @@
/* Forward declarations */ /* Forward declarations */
static void gtk_dial_class_init (GtkDialClass *klass); static void gtk_dial_class_init (GtkDialClass *klass);
static void gtk_dial_init (GtkDial *dial); static void gtk_dial_init (GtkDial *dial);
static void gtk_dial_destroy (GtkObject *object); static void gtk_dial_destroy (GtkObject *object);
static void gtk_dial_realize (GtkWidget *widget); static void gtk_dial_realize (GtkWidget *widget);
static void gtk_dial_size_request (GtkWidget *widget, static void gtk_dial_size_request (GtkWidget *widget,
GtkRequisition *requisition); GtkRequisition *requisition);
static void gtk_dial_size_allocate (GtkWidget *widget, static void gtk_dial_size_allocate (GtkWidget *widget,
GtkAllocation *allocation); GtkAllocation *allocation);
static gint gtk_dial_expose (GtkWidget *widget, static gint gtk_dial_expose (GtkWidget *widget,
GdkEventExpose *event); GdkEventExpose *event);
static gint gtk_dial_button_press (GtkWidget *widget, static gint gtk_dial_button_press (GtkWidget *widget,
GdkEventButton *event); GdkEventButton *event);
static gint gtk_dial_button_release (GtkWidget *widget, static gint gtk_dial_button_release (GtkWidget *widget,
GdkEventButton *event); GdkEventButton *event);
static gint gtk_dial_motion_notify (GtkWidget *widget, static gint gtk_dial_motion_notify (GtkWidget *widget,
GdkEventMotion *event); GdkEventMotion *event);
static gint gtk_dial_timer (GtkDial *dial); static gint gtk_dial_timer (GtkDial *dial);
static void gtk_dial_update_mouse (GtkDial *dial, gint x, gint y); static void gtk_dial_update_mouse (GtkDial *dial, gint x, gint y);
static void gtk_dial_update (GtkDial *dial); static void gtk_dial_update (GtkDial *dial);
static void gtk_dial_adjustment_changed (GtkAdjustment *adjustment, static void gtk_dial_adjustment_changed (GtkAdjustment *adjustment,
gpointer data); gpointer data);
static void gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment, static void gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data); gpointer data);
/* Local data */ /* Local data */
@ -140,12 +141,13 @@ gtk_dial_destroy (GtkObject *object)
{ {
GtkDial *dial; GtkDial *dial;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_DIAL (object)); g_return_if_fail (GTK_IS_DIAL (object));
dial = GTK_DIAL (object); dial = GTK_DIAL (object);
if (dial->adjustment) if (dial->adjustment)
g_object_unref (G_OBJECT (dial->adjustment)); g_object_unref (GTK_OBJECT (dial->adjustment));
if (GTK_OBJECT_CLASS (parent_class)->destroy) if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object); (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@ -154,6 +156,7 @@ gtk_dial_destroy (GtkObject *object)
GtkAdjustment* GtkAdjustment*
gtk_dial_get_adjustment (GtkDial *dial) gtk_dial_get_adjustment (GtkDial *dial)
{ {
g_return_val_if_fail (dial != NULL, NULL);
g_return_val_if_fail (GTK_IS_DIAL (dial), NULL); g_return_val_if_fail (GTK_IS_DIAL (dial), NULL);
return dial->adjustment; return dial->adjustment;
@ -163,6 +166,7 @@ void
gtk_dial_set_update_policy (GtkDial *dial, gtk_dial_set_update_policy (GtkDial *dial,
GtkUpdateType policy) GtkUpdateType policy)
{ {
g_return_if_fail (dial != NULL);
g_return_if_fail (GTK_IS_DIAL (dial)); g_return_if_fail (GTK_IS_DIAL (dial));
dial->policy = policy; dial->policy = policy;
@ -172,23 +176,24 @@ void
gtk_dial_set_adjustment (GtkDial *dial, gtk_dial_set_adjustment (GtkDial *dial,
GtkAdjustment *adjustment) GtkAdjustment *adjustment)
{ {
g_return_if_fail (dial != NULL);
g_return_if_fail (GTK_IS_DIAL (dial)); g_return_if_fail (GTK_IS_DIAL (dial));
if (dial->adjustment) if (dial->adjustment)
{ {
g_signal_handlers_disconnect_by_func (G_OBJECT (dial->adjustment), NULL, (gpointer) dial); g_signal_handlers_disconnect_by_func (GTK_OBJECT (dial->adjustment), NULL, (gpointer) dial);
g_object_unref (G_OBJECT (dial->adjustment)); g_object_unref (GTK_OBJECT (dial->adjustment));
} }
dial->adjustment = adjustment; dial->adjustment = adjustment;
g_object_ref (G_OBJECT (dial->adjustment)); g_object_ref (GTK_OBJECT (dial->adjustment));
g_signal_connect (G_OBJECT (adjustment), "changed", g_signal_connect (GTK_OBJECT (adjustment), "changed",
G_CALLBACK (gtk_dial_adjustment_changed), GTK_SIGNAL_FUNC (gtk_dial_adjustment_changed),
dial); (gpointer) dial);
g_signal_connect (G_OBJECT (adjustment), "value_changed", g_signal_connect (GTK_OBJECT (adjustment), "value_changed",
G_CALLBACK (gtk_dial_adjustment_value_changed), GTK_SIGNAL_FUNC (gtk_dial_adjustment_value_changed),
dial); (gpointer) dial);
dial->old_value = adjustment->value; dial->old_value = adjustment->value;
dial->old_lower = adjustment->lower; dial->old_lower = adjustment->lower;
@ -204,6 +209,7 @@ gtk_dial_realize (GtkWidget *widget)
GdkWindowAttr attributes; GdkWindowAttr attributes;
gint attributes_mask; gint attributes_mask;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_DIAL (widget)); g_return_if_fail (GTK_IS_DIAL (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
@ -246,6 +252,7 @@ gtk_dial_size_allocate (GtkWidget *widget,
{ {
GtkDial *dial; GtkDial *dial;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_DIAL (widget)); g_return_if_fail (GTK_IS_DIAL (widget));
g_return_if_fail (allocation != NULL); g_return_if_fail (allocation != NULL);
@ -278,6 +285,7 @@ gtk_dial_expose (GtkWidget *widget,
gint tick_length; gint tick_length;
gint i, inc; gint i, inc;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE); g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE); g_return_val_if_fail (event != NULL, FALSE);
@ -352,7 +360,7 @@ gtk_dial_expose (GtkWidget *widget,
for (i = 0; i <= inc; i++) for (i = 0; i <= inc; i++)
{ {
theta = ((gdouble)i*M_PI / (18*inc/24.) - M_PI/6.); theta = ((gfloat)i*M_PI / (18*inc/24.) - M_PI/6.);
if ((theta - last) < (increment)) if ((theta - last) < (increment))
continue; continue;
@ -412,6 +420,7 @@ gtk_dial_button_press (GtkWidget *widget,
double d_parallel; double d_parallel;
double d_perpendicular; double d_perpendicular;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE); g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE); g_return_val_if_fail (event != NULL, FALSE);
@ -451,6 +460,7 @@ gtk_dial_button_release (GtkWidget *widget,
{ {
GtkDial *dial; GtkDial *dial;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE); g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE); g_return_val_if_fail (event != NULL, FALSE);
@ -467,7 +477,7 @@ gtk_dial_button_release (GtkWidget *widget,
if ((dial->policy != GTK_UPDATE_CONTINUOUS) && if ((dial->policy != GTK_UPDATE_CONTINUOUS) &&
(dial->old_value != dial->adjustment->value)) (dial->old_value != dial->adjustment->value))
gtk_adjustment_value_changed (dial->adjustment); g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
} }
return FALSE; return FALSE;
@ -481,6 +491,7 @@ gtk_dial_motion_notify (GtkWidget *widget,
GdkModifierType mods; GdkModifierType mods;
gint x, y, mask; gint x, y, mask;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE); g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE); g_return_val_if_fail (event != NULL, FALSE);
@ -520,10 +531,11 @@ gtk_dial_motion_notify (GtkWidget *widget,
static gint static gint
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); g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE);
if (dial->policy == GTK_UPDATE_DELAYED) if (dial->policy == GTK_UPDATE_DELAYED)
gtk_adjustment_value_changed (dial->adjustment); g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
return FALSE; return FALSE;
} }
@ -532,8 +544,9 @@ 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; gint xc, yc;
gdouble old_value; gfloat old_value;
g_return_if_fail (dial != NULL);
g_return_if_fail (GTK_IS_DIAL (dial)); g_return_if_fail (GTK_IS_DIAL (dial));
xc = GTK_WIDGET(dial)->allocation.width / 2; xc = GTK_WIDGET(dial)->allocation.width / 2;
@ -558,7 +571,7 @@ gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
{ {
if (dial->policy == GTK_UPDATE_CONTINUOUS) if (dial->policy == GTK_UPDATE_CONTINUOUS)
{ {
gtk_adjustment_value_changed (dial->adjustment); g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
} }
else else
{ {
@ -580,8 +593,9 @@ gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
static void static void
gtk_dial_update (GtkDial *dial) gtk_dial_update (GtkDial *dial)
{ {
gdouble new_value; gfloat new_value;
g_return_if_fail (dial != NULL);
g_return_if_fail (GTK_IS_DIAL (dial)); g_return_if_fail (GTK_IS_DIAL (dial));
new_value = dial->adjustment->value; new_value = dial->adjustment->value;
@ -594,7 +608,8 @@ gtk_dial_update (GtkDial *dial)
if (new_value != dial->adjustment->value) if (new_value != dial->adjustment->value)
{ {
gtk_adjustment_set_value (dial->adjustment, new_value); dial->adjustment->value = new_value;
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
} }
dial->angle = 7.*M_PI/6. - (new_value - dial->adjustment->lower) * 4.*M_PI/3. / dial->angle = 7.*M_PI/6. - (new_value - dial->adjustment->lower) * 4.*M_PI/3. /
@ -605,12 +620,12 @@ gtk_dial_update (GtkDial *dial)
static void static void
gtk_dial_adjustment_changed (GtkAdjustment *adjustment, gtk_dial_adjustment_changed (GtkAdjustment *adjustment,
gpointer data) gpointer data)
{ {
GtkDial *dial; GtkDial *dial;
g_return_if_fail (adjustment != NULL); g_return_if_fail (adjustment != NULL);
g_return_if_fail (GTK_IS_DIAL (data)); g_return_if_fail (data != NULL);
dial = GTK_DIAL (data); dial = GTK_DIAL (data);
@ -633,7 +648,7 @@ gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
GtkDial *dial; GtkDial *dial;
g_return_if_fail (adjustment != NULL); g_return_if_fail (adjustment != NULL);
g_return_if_fail (GTK_IS_DIAL (data)); g_return_if_fail (data != NULL);
dial = GTK_DIAL (data); dial = GTK_DIAL (data);

View File

@ -1,7 +1,4 @@
/* Include the GTK header files
* Include stdio.h, we need that for the printf() function
*/
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <stdio.h> #include <stdio.h>

View File

@ -14,11 +14,11 @@ gint delete_event( GtkWidget *widget,
/* Make a new hbox filled with button-labels. Arguments for the /* Make a new hbox filled with button-labels. Arguments for the
* variables we're interested are passed in to this function. * variables we're interested are passed in to this function.
* We do not show the box, but do show everything inside. */ * We do not show the box, but do show everything inside. */
GtkWidget *make_box( gint homogeneous, GtkWidget *make_box( gboolean homogeneous,
gint spacing, gint spacing,
gint expand, gboolean expand,
gint fill, gboolean fill,
gint padding ) guint padding )
{ {
GtkWidget *box; GtkWidget *box;
GtkWidget *button; GtkWidget *button;
@ -285,7 +285,7 @@ int main( int argc,
gtk_main (); gtk_main ();
/* Control returns here when gtk_main_quit() is called, but not when /* Control returns here when gtk_main_quit() is called, but not when
* gtk_exit is used. */ * exit() is used. */
return 0; return 0;
} }

View File

@ -57,8 +57,8 @@ int main( int argc,
the application */ the application */
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (G_OBJECT (window), "delete_event", g_signal_connect (G_OBJECT (window), "delete_event",
G_CALLBACK (close_application), NULL); G_CALLBACK (close_application), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_widget_show (window); gtk_widget_show (window);

View File

@ -20,7 +20,7 @@ int main( int argc,
GtkWidget *separator; GtkWidget *separator;
GSList *group; GSList *group;
gtk_init (&argc,&argv); gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@ -50,9 +50,8 @@ int main( int argc,
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
gtk_widget_show (button); gtk_widget_show (button);
button = gtk_radio_button_new_with_label( button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button),
gtk_radio_button_get_group (GTK_RADIO_BUTTON (button)), "button3");
"button3");
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
gtk_widget_show (button); gtk_widget_show (button);

View File

@ -217,3 +217,4 @@ int main( int argc,
return 0; return 0;
} }

View File

@ -1,6 +1,4 @@
/* text.c */
#define GTK_ENABLE_BROKEN #define GTK_ENABLE_BROKEN
#include <stdio.h> #include <stdio.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>