summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBST 2002 Tony Gale <gale@gtk.org>2002-08-25 11:28:42 +0000
committerTony Gale <gale@src.gnome.org>2002-08-25 11:28:42 +0000
commit992ea8e1d7a4673831b146e803578dda3a36d44c (patch)
tree869788fa12a1dc9bb945ef3611c94f2b4f3f4a84 /examples
parent2f31e7ed12099c8a6c54255867e9fc9dbb88dd89 (diff)
downloadgtk+-992ea8e1d7a4673831b146e803578dda3a36d44c.tar.gz
update packaging script for current tutorial
Sun Aug 25 11:58:27 BST 2002 Tony Gale <gale@gtk.org> * docs/tutorial/package-db-tutorial.sh: update packaging script for current tutorial * docs/tutorial/images/*.eps: New Files EPS versions of the tutorial images
Diffstat (limited to 'examples')
-rw-r--r--examples/scribble-simple/scribble-simple.c3
-rw-r--r--examples/scribble-xinput/scribble-xinput.c6
-rw-r--r--examples/scrolledwin/scrolledwin.c2
-rw-r--r--examples/selection/gettargets.c9
-rw-r--r--examples/selection/setselection.c22
-rw-r--r--examples/spinbutton/spinbutton.c8
-rw-r--r--examples/tictactoe/tictactoe.c2
7 files changed, 29 insertions, 23 deletions
diff --git a/examples/scribble-simple/scribble-simple.c b/examples/scribble-simple/scribble-simple.c
index 44c543a1d0..809a3675e6 100644
--- a/examples/scribble-simple/scribble-simple.c
+++ b/examples/scribble-simple/scribble-simple.c
@@ -18,6 +18,7 @@
* Boston, MA 02111-1307, USA.
*/
+#include <stdlib.h>
#include <gtk/gtk.h>
/* Backing pixmap for drawing area */
@@ -169,7 +170,7 @@ int main( int argc,
g_signal_connect_swapped (G_OBJECT (button), "clicked",
G_CALLBACK (gtk_widget_destroy),
- window);
+ G_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 59ee21aacf..2a2909b103 100644
--- a/examples/scribble-xinput/scribble-xinput.c
+++ b/examples/scribble-xinput/scribble-xinput.c
@@ -158,11 +158,11 @@ create_input_dialog ()
inputd = gtk_input_dialog_new();
g_signal_connect (G_OBJECT (inputd), "destroy",
- G_CALLBACK (input_dialog_destroy), &inputd);
+ G_CALLBACK (input_dialog_destroy), (gpointer) &inputd);
g_signal_connect_swapped (G_OBJECT (GTK_INPUT_DIALOG (inputd)->close_button),
"clicked",
G_CALLBACK (gtk_widget_hide),
- inputd);
+ G_OBJECT (inputd));
gtk_widget_hide (GTK_INPUT_DIALOG (inputd)->save_button);
gtk_widget_show (inputd);
@@ -248,7 +248,7 @@ main (int argc, char *argv[])
g_signal_connect_swapped (G_OBJECT (button), "clicked",
G_CALLBACK (gtk_widget_destroy),
- window);
+ G_OBJECT (window));
gtk_widget_show (button);
gtk_widget_show (window);
diff --git a/examples/scrolledwin/scrolledwin.c b/examples/scrolledwin/scrolledwin.c
index 3c8c8d8f0e..be4c82d681 100644
--- a/examples/scrolledwin/scrolledwin.c
+++ b/examples/scrolledwin/scrolledwin.c
@@ -73,7 +73,7 @@ int main( int argc,
button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (G_OBJECT (button), "clicked",
G_CALLBACK (gtk_widget_destroy),
- window);
+ G_OBJECT (window));
/* this makes it so the button is the default. */
diff --git a/examples/selection/gettargets.c b/examples/selection/gettargets.c
index 7c0cc276fd..bfc44a0ee6 100644
--- a/examples/selection/gettargets.c
+++ b/examples/selection/gettargets.c
@@ -11,13 +11,14 @@ void get_targets( GtkWidget *widget,
gpointer data )
{
static GdkAtom targets_atom = GDK_NONE;
+ GtkWidget *window = (GtkWidget *)data;
/* Get the atom corresponding to the string "TARGETS" */
if (targets_atom == GDK_NONE)
targets_atom = gdk_atom_intern ("TARGETS", FALSE);
/* And request the "TARGETS" target for the primary selection */
- gtk_selection_convert (widget, GDK_SELECTION_PRIMARY, targets_atom,
+ gtk_selection_convert (window, GDK_SELECTION_PRIMARY, targets_atom,
GDK_CURRENT_TIME);
}
@@ -82,9 +83,9 @@ int main( int argc,
button = gtk_button_new_with_label ("Get Targets");
gtk_container_add (GTK_CONTAINER (window), button);
- g_signal_connect (G_OBJECT(button), "clicked",
- G_CALLBACK (get_targets), NULL);
- g_signal_connect (G_OBJECT(button), "selection_received",
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (get_targets), (gpointer) window);
+ g_signal_connect (G_OBJECT (window), "selection_received",
G_CALLBACK (selection_received), NULL);
gtk_widget_show (button);
diff --git a/examples/selection/setselection.c b/examples/selection/setselection.c
index e79a09131b..3dcb3a53b5 100644
--- a/examples/selection/setselection.c
+++ b/examples/selection/setselection.c
@@ -2,6 +2,10 @@
#include <stdlib.h>
#include <gtk/gtk.h>
#include <time.h>
+#include <string.h>
+
+GtkWidget *selection_button;
+GtkWidget *selection_widget;
/* Callback when the user toggles the selection */
void selection_toggled( GtkWidget *widget,
@@ -9,7 +13,7 @@ void selection_toggled( GtkWidget *widget,
{
if (GTK_TOGGLE_BUTTON (widget)->active)
{
- *have_selection = gtk_selection_owner_set (widget,
+ *have_selection = gtk_selection_owner_set (selection_widget,
GDK_SELECTION_PRIMARY,
GDK_CURRENT_TIME);
/* if claiming the selection failed, we return the button to
@@ -37,7 +41,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 (selection_button), FALSE);
return TRUE;
}
@@ -65,7 +69,6 @@ int main( int argc,
char *argv[] )
{
GtkWidget *window;
- GtkWidget *selection_button;
static int have_selection = FALSE;
@@ -82,21 +85,22 @@ int main( int argc,
/* Create a toggle button to act as the selection */
+ selection_widget = gtk_invisible_new ();
selection_button = gtk_toggle_button_new_with_label ("Claim Selection");
gtk_container_add (GTK_CONTAINER (window), selection_button);
gtk_widget_show (selection_button);
g_signal_connect (G_OBJECT (selection_button), "toggled",
- G_CALLBACK (selection_toggled), &have_selection);
- g_signal_connect (G_OBJECT (selection_button), "selection_clear_event",
- G_CALLBACK (selection_clear), &have_selection);
+ G_CALLBACK (selection_toggled), (gpointer) &have_selection);
+ g_signal_connect (G_OBJECT (selection_widget), "selection_clear_event",
+ G_CALLBACK (selection_clear), (gpointer) &have_selection);
- gtk_selection_add_target (selection_button,
+ gtk_selection_add_target (selection_widget,
GDK_SELECTION_PRIMARY,
GDK_SELECTION_TYPE_STRING,
1);
- g_signal_connect (G_OBJECT (selection_button), "selection_get",
- G_CALLBACK (selection_handle), &have_selection);
+ g_signal_connect (G_OBJECT (selection_widget), "selection_get",
+ G_CALLBACK (selection_handle), (gpointer) &have_selection);
gtk_widget_show (selection_button);
gtk_widget_show (window);
diff --git a/examples/spinbutton/spinbutton.c b/examples/spinbutton/spinbutton.c
index 6247419ac5..ba54ed8d36 100644
--- a/examples/spinbutton/spinbutton.c
+++ b/examples/spinbutton/spinbutton.c
@@ -160,7 +160,7 @@ int main( int argc,
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner2), TRUE);
g_signal_connect (G_OBJECT (adj), "value_changed",
G_CALLBACK (change_digits),
- spinner2);
+ (gpointer) spinner2);
gtk_box_pack_start (GTK_BOX (vbox2), spinner2, FALSE, TRUE, 0);
hbox = gtk_hbox_new (FALSE, 0);
@@ -169,14 +169,14 @@ int main( int argc,
button = gtk_check_button_new_with_label ("Snap to 0.5-ticks");
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (toggle_snap),
- spinner1);
+ (gpointer) 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 (G_OBJECT (button), "clicked",
G_CALLBACK (toggle_numeric),
- spinner1);
+ (gpointer) spinner1);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
@@ -207,7 +207,7 @@ int main( int argc,
button = gtk_button_new_with_label ("Close");
g_signal_connect_swapped (G_OBJECT (button), "clicked",
G_CALLBACK (gtk_widget_destroy),
- window);
+ G_OBJECT (window));
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
gtk_widget_show_all (window);
diff --git a/examples/tictactoe/tictactoe.c b/examples/tictactoe/tictactoe.c
index 33ba849edc..bb17d3f5f1 100644
--- a/examples/tictactoe/tictactoe.c
+++ b/examples/tictactoe/tictactoe.c
@@ -96,7 +96,7 @@ tictactoe_init (Tictactoe *ttt)
gtk_table_attach_defaults (GTK_TABLE (table), ttt->buttons[i][j],
i, i+1, j, j+1);
g_signal_connect (G_OBJECT (ttt->buttons[i][j]), "toggled",
- G_CALLBACK (tictactoe_toggle), ttt);
+ G_CALLBACK (tictactoe_toggle), (gpointer) ttt);
gtk_widget_set_size_request (ttt->buttons[i][j], 20, 20);
gtk_widget_show (ttt->buttons[i][j]);
}