summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2003-12-12 00:16:14 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2003-12-12 00:16:14 +0000
commitc819c45ea813d3375a41e0605a9d0c3972286a5c (patch)
tree25872de45e41a30c2db037b49d50fdd9a510f893 /examples
parent5d8f0a69c4ea52cccd471791660527c0ae7d476c (diff)
downloadgtk+-c819c45ea813d3375a41e0605a9d0c3972286a5c.tar.gz
Remove deprecated functions in examples. (#129074, Olexiy Avramchenko)
Fri Dec 12 01:13:34 2003 Matthias Clasen <maclas@gmx.de> * examples/gtkdial/gtkdial.c: * examples/menu/menu.c: * examples/scribble-xinput/scribble-xinput.c: * examples/progressbar/progressbar.c: * docs/tutorial/gtk-tut.sgml: Remove deprecated functions in examples. (#129074, Olexiy Avramchenko) * examples/calendar/Makefile: * examples/rangewidgets/Makefile: * examples/menu/Makefile: Allow deprecated functions in examples which use deprecated widgets.
Diffstat (limited to 'examples')
-rw-r--r--examples/calendar/Makefile3
-rw-r--r--examples/gtkdial/gtkdial.c14
-rw-r--r--examples/menu/Makefile3
-rw-r--r--examples/menu/menu.c2
-rw-r--r--examples/progressbar/progressbar.c10
-rw-r--r--examples/rangewidgets/Makefile3
-rw-r--r--examples/scribble-xinput/scribble-xinput.c8
7 files changed, 17 insertions, 26 deletions
diff --git a/examples/calendar/Makefile b/examples/calendar/Makefile
index a27b6a7940..476f98c2d7 100644
--- a/examples/calendar/Makefile
+++ b/examples/calendar/Makefile
@@ -4,8 +4,7 @@ CC = gcc
CFLAGS = -Wall \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
- -DGDK_PIXBUF_DISABLE_DEPRECATED \
- -DGTK_DISABLE_DEPRECATED
+ -DGDK_PIXBUF_DISABLE_DEPRECATED
calendar: calendar.c
$(CC) calendar.c -o calendar $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
diff --git a/examples/gtkdial/gtkdial.c b/examples/gtkdial/gtkdial.c
index 76526d673d..402472d425 100644
--- a/examples/gtkdial/gtkdial.c
+++ b/examples/gtkdial/gtkdial.c
@@ -45,7 +45,7 @@ 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 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);
@@ -476,7 +476,7 @@ gtk_dial_button_release (GtkWidget *widget,
dial->button = 0;
if (dial->policy == GTK_UPDATE_DELAYED)
- gtk_timeout_remove (dial->timer);
+ g_source_remove (dial->timer);
if ((dial->policy != GTK_UPDATE_CONTINUOUS) &&
(dial->old_value != dial->adjustment->value))
@@ -531,7 +531,7 @@ gtk_dial_motion_notify (GtkWidget *widget,
return FALSE;
}
-static gint
+static gboolean
gtk_dial_timer (GtkDial *dial)
{
g_return_val_if_fail (dial != NULL, FALSE);
@@ -583,11 +583,11 @@ gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
if (dial->policy == GTK_UPDATE_DELAYED)
{
if (dial->timer)
- gtk_timeout_remove (dial->timer);
+ g_source_remove (dial->timer);
- dial->timer = gtk_timeout_add (SCROLL_DELAY_LENGTH,
- (GtkFunction) gtk_dial_timer,
- (gpointer) dial);
+ dial->timer = g_timeout_add (SCROLL_DELAY_LENGTH,
+ (GtkFunction) gtk_dial_timer,
+ (gpointer) dial);
}
}
}
diff --git a/examples/menu/Makefile b/examples/menu/Makefile
index 290ac17922..1ce3218d8e 100644
--- a/examples/menu/Makefile
+++ b/examples/menu/Makefile
@@ -4,8 +4,7 @@ CC = gcc
CFLAGS = -Wall \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
- -DGDK_PIXBUF_DISABLE_DEPRECATED \
- -DGTK_DISABLE_DEPRECATED
+ -DGDK_PIXBUF_DISABLE_DEPRECATED
all: menu itemfactory
diff --git a/examples/menu/menu.c b/examples/menu/menu.c
index 970c2fe61e..94271df94d 100644
--- a/examples/menu/menu.c
+++ b/examples/menu/menu.c
@@ -69,7 +69,7 @@ int main( int argc,
/* Now we specify that we want our newly created "menu" to be the menu
* for the "root menu" */
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (root_menu), h);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (root_menu), menu);
/* A vbox to put a menu and a button in: */
vbox = gtk_vbox_new (FALSE, 0);
diff --git a/examples/progressbar/progressbar.c b/examples/progressbar/progressbar.c
index f4a9aec8ef..cec619ea5d 100644
--- a/examples/progressbar/progressbar.c
+++ b/examples/progressbar/progressbar.c
@@ -10,7 +10,7 @@ typedef struct _ProgressData {
/* Update the value of the progress bar so that we get
* some movement */
-gint progress_timeout( gpointer data )
+gboolean progress_timeout( gpointer data )
{
ProgressData *pdata = (ProgressData *)data;
gdouble new_val;
@@ -74,8 +74,8 @@ void toggle_orientation( GtkWidget *widget,
gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (pdata->pbar),
GTK_PROGRESS_LEFT_TO_RIGHT);
break;
- default:
- // do nothing
+ default: ;
+ /* do nothing */
}
}
@@ -84,7 +84,7 @@ void toggle_orientation( GtkWidget *widget,
void destroy_progress( GtkWidget *widget,
ProgressData *pdata)
{
- gtk_timeout_remove (pdata->timer);
+ g_source_remove (pdata->timer);
pdata->timer = 0;
pdata->window = NULL;
g_free (pdata);
@@ -133,7 +133,7 @@ int main( int argc,
gtk_widget_show (pdata->pbar);
/* Add a timer callback to update the value of the progress bar */
- pdata->timer = gtk_timeout_add (100, progress_timeout, pdata);
+ pdata->timer = g_timeout_add (100, progress_timeout, pdata);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
diff --git a/examples/rangewidgets/Makefile b/examples/rangewidgets/Makefile
index 4ca6e0dd3d..f018f81ec9 100644
--- a/examples/rangewidgets/Makefile
+++ b/examples/rangewidgets/Makefile
@@ -4,8 +4,7 @@ CC = gcc
CFLAGS = -Wall \
-DG_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
- -DGDK_PIXBUF_DISABLE_DEPRECATED \
- -DGTK_DISABLE_DEPRECATED
+ -DGDK_PIXBUF_DISABLE_DEPRECATED
rangewidgets: rangewidgets.c
$(CC) rangewidgets.c -o rangewidgets $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
diff --git a/examples/scribble-xinput/scribble-xinput.c b/examples/scribble-xinput/scribble-xinput.c
index 2a2909b103..ed1b3d715d 100644
--- a/examples/scribble-xinput/scribble-xinput.c
+++ b/examples/scribble-xinput/scribble-xinput.c
@@ -176,12 +176,6 @@ create_input_dialog ()
}
}
-void
-quit ()
-{
- exit (0);
-}
-
int
main (int argc, char *argv[])
{
@@ -201,7 +195,7 @@ main (int argc, char *argv[])
gtk_widget_show (vbox);
g_signal_connect (G_OBJECT (window), "destroy",
- G_CALLBACK (quit), NULL);
+ G_CALLBACK (gtk_main_quit), NULL);
/* Create the drawing area */