Commit 6dea3cae authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

finish conversion to g_signal_* functions by using G_OBJECT and G_CALLBACK

2002-02-19  Sven Neumann  <sven@gimp.org>

	* examples/*/*.c: finish conversion to g_signal_* functions by
	using G_OBJECT and G_CALLBACK and other assorted changes.
parent 601302c7
2002-02-19 Sven Neumann <sven@gimp.org>
* examples/*/*.c: finish conversion to g_signal_* functions by
using G_OBJECT and G_CALLBACK and other assorted changes.
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
......
2002-02-19 Sven Neumann <sven@gimp.org>
* examples/*/*.c: finish conversion to g_signal_* functions by
using G_OBJECT and G_CALLBACK and other assorted changes.
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
......
2002-02-19 Sven Neumann <sven@gimp.org>
* examples/*/*.c: finish conversion to g_signal_* functions by
using G_OBJECT and G_CALLBACK and other assorted changes.
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
......
2002-02-19 Sven Neumann <sven@gimp.org>
* examples/*/*.c: finish conversion to g_signal_* functions by
using G_OBJECT and G_CALLBACK and other assorted changes.
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
......
2002-02-19 Sven Neumann <sven@gimp.org>
* examples/*/*.c: finish conversion to g_signal_* functions by
using G_OBJECT and G_CALLBACK and other assorted changes.
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
......
2002-02-19 Sven Neumann <sven@gimp.org>
* examples/*/*.c: finish conversion to g_signal_* functions by
using G_OBJECT and G_CALLBACK and other assorted changes.
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
......
2002-02-19 Sven Neumann <sven@gimp.org>
* examples/*/*.c: finish conversion to g_signal_* functions by
using G_OBJECT and G_CALLBACK and other assorted changes.
Tue Feb 19 17:36:31 2002 Kristian Rietveld <kris@gtk.org>
* gtktreeprivate.h, gtktreeviewcolumn.[ch], gtktreeview.c: change
......
......@@ -37,8 +37,8 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Arrow Buttons");
/* It's a good idea to do this for all windows. */
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
......
......@@ -11,8 +11,8 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
g_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Create an aspect_frame and add it to our toplevel window */
......
......@@ -9,7 +9,7 @@ int main( int argc,
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window);
gtk_widget_show (window);
gtk_main ();
......
......@@ -28,13 +28,13 @@ GtkWidget *create_bbox( gint horizontal,
gtk_box_set_spacing (GTK_BOX (bbox), spacing);
/*gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h);*/
button = gtk_button_new_with_label ("OK");
button = gtk_button_new_from_stock (GTK_STOCK_OK);
gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_with_label ("Cancel");
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_with_label ("Help");
button = gtk_button_new_from_stock (GTK_STOCK_HELP);
gtk_container_add (GTK_CONTAINER (bbox), button);
return frame;
......@@ -56,8 +56,8 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes");
g_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit),
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
......
......@@ -67,14 +67,12 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Pixmap'd Buttons!");
#if 1
/* It's a good idea to do this for all windows. */
g_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (exit), NULL);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (exit), NULL);
#endif
g_signal_connect (G_OBJECT (window), "delete_event",
G_CALLBACK (gtk_main_quit), NULL);
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
......@@ -84,8 +82,8 @@ int main( int argc,
button = gtk_button_new ();
/* Connect the "clicked" signal of the button to our callback */
g_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (callback), (gpointer) "cool button");
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (callback), (gpointer) "cool button");
/* This calls our box creating function */
box1 = xpm_label_box(window, "info.xpm", "cool button");
......
......@@ -218,17 +218,17 @@ void calendar_select_font( GtkWidget *button,
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
g_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_widget_destroyed),
&calendar->font_dialog);
g_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button),
"clicked", GTK_SIGNAL_FUNC (calendar_font_selection_ok),
g_signal_connect (G_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button),
"clicked", G_CALLBACK (calendar_font_selection_ok),
calendar);
g_signal_connect_swapped (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button),
g_signal_connect_swapped (G_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button),
"clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (calendar->font_dialog));
G_CALLBACK (gtk_widget_destroy),
calendar->font_dialog);
}
window=calendar->font_dialog;
if (!GTK_WIDGET_VISIBLE (window))
......@@ -277,11 +277,11 @@ void create_calendar()
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "GtkCalendar Example");
gtk_container_set_border_width (GTK_CONTAINER (window), 5);
g_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit),
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
g_signal_connect (GTK_OBJECT (window), "delete-event",
GTK_SIGNAL_FUNC (gtk_false),
g_signal_connect (G_OBJECT (window), "delete-event",
G_CALLBACK (gtk_false),
NULL);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
......@@ -308,26 +308,26 @@ void create_calendar()
calendar_set_flags (&calendar_data);
gtk_calendar_mark_day (GTK_CALENDAR (calendar), 19);
gtk_container_add( GTK_CONTAINER (frame), calendar);
g_signal_connect (GTK_OBJECT (calendar), "month_changed",
GTK_SIGNAL_FUNC (calendar_month_changed),
g_signal_connect (G_OBJECT (calendar), "month_changed",
G_CALLBACK (calendar_month_changed),
&calendar_data);
g_signal_connect (GTK_OBJECT (calendar), "day_selected",
GTK_SIGNAL_FUNC (calendar_day_selected),
g_signal_connect (G_OBJECT (calendar), "day_selected",
G_CALLBACK (calendar_day_selected),
&calendar_data);
g_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click",
GTK_SIGNAL_FUNC (calendar_day_selected_double_click),
g_signal_connect (G_OBJECT (calendar), "day_selected_double_click",
G_CALLBACK (calendar_day_selected_double_click),
&calendar_data);
g_signal_connect (GTK_OBJECT (calendar), "prev_month",
GTK_SIGNAL_FUNC (calendar_prev_month),
g_signal_connect (G_OBJECT (calendar), "prev_month",
G_CALLBACK (calendar_prev_month),
&calendar_data);
g_signal_connect (GTK_OBJECT (calendar), "next_month",
GTK_SIGNAL_FUNC (calendar_next_month),
g_signal_connect (G_OBJECT (calendar), "next_month",
G_CALLBACK (calendar_next_month),
&calendar_data);
g_signal_connect (GTK_OBJECT (calendar), "prev_year",
GTK_SIGNAL_FUNC (calendar_prev_year),
g_signal_connect (G_OBJECT (calendar), "prev_year",
G_CALLBACK (calendar_prev_year),
&calendar_data);
g_signal_connect (GTK_OBJECT (calendar), "next_year",
GTK_SIGNAL_FUNC (calendar_next_year),
g_signal_connect (G_OBJECT (calendar), "next_year",
G_CALLBACK (calendar_next_year),
&calendar_data);
......@@ -347,18 +347,18 @@ void create_calendar()
for (i = 0; i < 5; i++)
{
toggle = gtk_check_button_new_with_label (flags[i].label);
g_signal_connect (GTK_OBJECT (toggle),
g_signal_connect (G_OBJECT (toggle),
"toggled",
GTK_SIGNAL_FUNC (calendar_toggle_flag),
G_CALLBACK (calendar_toggle_flag),
&calendar_data);
gtk_box_pack_start (GTK_BOX (vbox3), toggle, TRUE, TRUE, 0);
calendar_data.flag_checkboxes[i] = toggle;
}
/* Build the right font-button */
button = gtk_button_new_with_label ("Font...");
g_signal_connect (GTK_OBJECT (button),
g_signal_connect (G_OBJECT (button),
"clicked",
GTK_SIGNAL_FUNC (calendar_select_font),
G_CALLBACK (calendar_select_font),
&calendar_data);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
......@@ -398,8 +398,8 @@ void create_calendar()
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
button = gtk_button_new_with_label ("Close");
g_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_main_quit),
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (gtk_main_quit),
NULL);
gtk_container_add (GTK_CONTAINER (bbox), button);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
......
......@@ -92,10 +92,9 @@ int main( int argc,
gtk_widget_set_size_request (GTK_WIDGET (window), 300, 150);
gtk_window_set_title (GTK_WINDOW (window), "GtkCList Example");
gtk_signal_connect (GTK_OBJECT (window),
"destroy",
GTK_SIGNAL_FUNC (gtk_main_quit),
NULL);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit),
NULL);
vbox=gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
......@@ -115,9 +114,9 @@ int main( int argc,
/* When a selection is made, we want to know about it. The callback
* used is selection_made, and its code can be found further down */
gtk_signal_connect(GTK_OBJECT (clist), "select_row",
GTK_SIGNAL_FUNC (selection_made),
NULL);
g_signal_connect (G_OBJECT (clist), "select_row",
G_CALLBACK (selection_made),
NULL);
/* It isn't necessary to shadow the border, but it looks nice :) */
gtk_clist_set_shadow_type (GTK_CLIST (clist), GTK_SHADOW_OUT);
......@@ -148,15 +147,15 @@ int main( int argc,
gtk_box_pack_start (GTK_BOX (hbox), button_hide_show, TRUE, TRUE, 0);
/* Connect our callbacks to the three buttons */
gtk_signal_connect_object (GTK_OBJECT (button_add), "clicked",
GTK_SIGNAL_FUNC (button_add_clicked),
(gpointer) clist);
gtk_signal_connect_object (GTK_OBJECT (button_clear), "clicked",
GTK_SIGNAL_FUNC (button_clear_clicked),
(gpointer) clist);
gtk_signal_connect_object (GTK_OBJECT (button_hide_show), "clicked",
GTK_SIGNAL_FUNC (button_hide_show_clicked),
(gpointer) clist);
g_signal_connect_swapped (G_OBJECT (button_add), "clicked",
G_CALLBACK (button_add_clicked),
clist);
g_signal_connect_swapped (G_OBJECT (button_clear), "clicked",
G_CALLBACK (button_clear_clicked),
clist);
g_signal_connect_swapped (G_OBJECT (button_hide_show), "clicked",
G_CALLBACK (button_hide_show_clicked),
clist);
gtk_widget_show (button_add);
gtk_widget_show (button_clear);
......
......@@ -42,8 +42,11 @@ int main( int argc,
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
gtk_window_set_title (GTK_WINDOW (window), "GTK Entry");
g_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (exit), NULL);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect_swapped (G_OBJECT (window), "delete_event",
G_CALLBACK (gtk_widget_destroy),
window);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
......@@ -51,8 +54,8 @@ int main( int argc,
entry = gtk_entry_new ();
gtk_entry_set_max_length (GTK_ENTRY (entry), 50);
g_signal_connect (GTK_OBJECT (entry), "activate",
GTK_SIGNAL_FUNC (enter_callback),
g_signal_connect (G_OBJECT (entry), "activate",
G_CALLBACK (enter_callback),
entry);
gtk_entry_set_text (GTK_ENTRY (entry), "hello");
tmp_pos = GTK_ENTRY (entry)->text_length;
......@@ -68,22 +71,22 @@ int main( int argc,
check = gtk_check_button_new_with_label ("Editable");
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
g_signal_connect (GTK_OBJECT (check), "toggled",
GTK_SIGNAL_FUNC (entry_toggle_editable), entry);
g_signal_connect (G_OBJECT (check), "toggled",
G_CALLBACK (entry_toggle_editable), entry);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
gtk_widget_show (check);
check = gtk_check_button_new_with_label ("Visible");
gtk_box_pack_start (GTK_BOX (hbox), check, TRUE, TRUE, 0);
g_signal_connect (GTK_OBJECT (check), "toggled",
GTK_SIGNAL_FUNC (entry_toggle_visibility), entry);
g_signal_connect (G_OBJECT (check), "toggled",
G_CALLBACK (entry_toggle_visibility), entry);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
gtk_widget_show (check);
button = gtk_button_new_with_label ("Close");
g_signal_connect_swapped (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (exit),
GTK_OBJECT (window));
button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
g_signal_connect_swapped (G_OBJECT (button), "clicked",
G_CALLBACK (gtk_widget_destroy),
window);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_widget_grab_default (button);
......
......@@ -15,8 +15,8 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Event Box");
g_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (exit), NULL);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (exit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
......@@ -37,8 +37,8 @@ int main( int argc,
/* And bind an action to it */
gtk_widget_set_events (event_box, GDK_BUTTON_PRESS_MASK);
g_signal_connect (GTK_OBJECT (event_box), "button_press_event",
GTK_SIGNAL_FUNC (exit), NULL);
g_signal_connect (G_OBJECT (event_box), "button_press_event",
G_CALLBACK (exit), NULL);
/* Yet one more thing you need an X window for ... */
......
......@@ -8,12 +8,6 @@ void file_ok_sel( GtkWidget *w,
g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
}
void destroy( GtkWidget *widget,
gpointer data )
{
gtk_main_quit ();
}
int main( int argc,
char *argv[] )
{
......@@ -24,16 +18,17 @@ int main( int argc,
/* Create a new file selection widget */
filew = gtk_file_selection_new ("File selection");
g_signal_connect (GTK_OBJECT (filew), "destroy",
GTK_SIGNAL_FUNC (destroy), &filew);
g_signal_connect (G_OBJECT (filew), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
/* Connect the ok_button to file_ok_sel function */
g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
"clicked", GTK_SIGNAL_FUNC (file_ok_sel), filew );
g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
"clicked",
G_CALLBACK (file_ok_sel), filew);
/* Connect the cancel_button to destroy the widget */
g_signal_connect_swapped (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (filew));
g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
"clicked",
G_CALLBACK (gtk_widget_destroy), filew);
/* Lets set the filename, as if this were a save dialog, and we are giving
a default filename */
......
......@@ -34,8 +34,8 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Fixed Container");
/* Here we connect the "destroy" event to a signal handler */
g_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
/* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
......@@ -52,8 +52,8 @@ int main( int argc,
/* When the button receives the "clicked" signal, it will call the
* function move_button() passing it the Fixed Container as its
* argument. */
g_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (move_button), fixed);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (move_button), fixed);
/* This packs the button into the fixed containers window. */
gtk_fixed_put (GTK_FIXED (fixed), button, i*50, i*50);
......
......@@ -16,8 +16,8 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Frame Example");
/* Here we connect the "destroy" event to a signal handler */
g_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_set_size_request (window, 300, 300);
/* Sets the border width of the window. */
......
......@@ -28,8 +28,8 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "Dial");
g_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (exit), NULL);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (exit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
......@@ -55,8 +55,8 @@ int main( int argc,
gtk_box_pack_end (GTK_BOX (vbox), label, 0, 0, 0);
gtk_widget_show (label);
g_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (value_changed), label);
g_signal_connect (G_OBJECT (adjustment), "value_changed",
G_CALLBACK (value_changed), label);
gtk_widget_show (window);
......
<
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
......@@ -29,30 +28,30 @@
/* Forward declarations */
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_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_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_update_mouse (GtkDial *dial, gint x, gint y);
static void gtk_dial_update (GtkDial *dial);
static void gtk_dial_adjustment_changed (GtkAdjustment *adjustment,
gpointer data);
static void gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data);
static void gtk_dial_adjustment_changed (GtkAdjustment *adjustment,
gpointer data);
static void gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data);
/* Local data */
......@@ -141,13 +140,12 @@ gtk_dial_destroy (GtkObject *object)
{
GtkDial *dial;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_DIAL (object));
dial = GTK_DIAL (object);
if (dial->adjustment)
g_object_unref (GTK_OBJECT (dial->adjustment));
g_object_unref (G_OBJECT (dial->adjustment));
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
......@@ -156,7 +154,6 @@ gtk_dial_destroy (GtkObject *object)
GtkAdjustment*
gtk_dial_get_adjustment (GtkDial *dial)
{
g_return_val_if_fail (dial != NULL, NULL);
g_return_val_if_fail (GTK_IS_DIAL (dial), NULL);
return dial->adjustment;
......@@ -166,7 +163,6 @@ void
gtk_dial_set_update_policy (GtkDial *dial,
GtkUpdateType policy)
{
g_return_if_fail (dial != NULL);
g_return_if_fail (GTK_IS_DIAL (dial));
dial->policy = policy;
......@@ -176,24 +172,23 @@ void
gtk_dial_set_adjustment (GtkDial *dial,
GtkAdjustment *adjustment)
{
g_return_if_fail (dial != NULL);
g_return_if_fail (GTK_IS_DIAL (dial));
if (dial->adjustment)
{
g_signal_handlers_disconnect_by_func (GTK_OBJECT (dial->adjustment), NULL, (gpointer) dial);
g_object_unref (GTK_OBJECT (dial->adjustment));
g_signal_handlers_disconnect_by_func (G_OBJECT (dial->adjustment), NULL, (gpointer) dial);
g_object_unref (G_OBJECT (dial->adjustment));
}
dial->adjustment = adjustment;
g_object_ref (GTK_OBJECT (dial->adjustment));
g_object_ref (G_OBJECT (dial->adjustment));
g_signal_connect (GTK_OBJECT (adjustment), "changed",
GTK_SIGNAL_FUNC (gtk_dial_adjustment_changed),
(gpointer) dial);
g_signal_connect (GTK_OBJECT (adjustment), "value_changed",
GTK_SIGNAL_FUNC (gtk_dial_adjustment_value_changed),
(gpointer) dial);
g_signal_connect (G_OBJECT (adjustment), "changed",
G_CALLBACK (gtk_dial_adjustment_changed),
dial);
g_signal_connect (G_OBJECT (adjustment), "value_changed",
G_CALLBACK (gtk_dial_adjustment_value_changed),
dial);
dial->old_value = adjustment->value;
dial->old_lower = adjustment->lower;
......@@ -209,7 +204,6 @@ gtk_dial_realize (GtkWidget *widget)
GdkWindowAttr attributes;
gint attributes_mask;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_DIAL (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
......@@ -252,7 +246,6 @@ gtk_dial_size_allocate (GtkWidget *widget,
{
GtkDial *dial;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_DIAL (widget));
g_return_if_fail (allocation != NULL);
......@@ -285,7 +278,6 @@ gtk_dial_expose (GtkWidget *widget,
gint tick_length;
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 (event != NULL, FALSE);
......@@ -360,7 +352,7 @@ gtk_dial_expose (GtkWidget *widget,
for (i = 0; i <= inc; i++)
{
theta = ((gfloat)i*M_PI / (18*inc/24.) - M_PI/6.);
theta = ((gdouble)i*M_PI / (18*inc/24.) - M_PI/6.);
if ((theta - last) < (increment))
continue;
......@@ -420,7 +412,6 @@ gtk_dial_button_press (GtkWidget *widget,
double d_parallel;
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 (event != NULL, FALSE);
......@@ -460,7 +451,6 @@ gtk_dial_button_release (GtkWidget *widget,
{
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 (event != NULL, FALSE);
......@@ -477,7 +467,7 @@ gtk_dial_button_release (GtkWidget *widget,
if ((dial->policy != GTK_UPDATE_CONTINUOUS) &&
(dial->old_value != dial->adjustment->value))
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
gtk_adjustment_value_changed (dial->adjustment);
}
return FALSE;
......@@ -491,7 +481,6 @@ gtk_dial_motion_notify (GtkWidget *widget,
GdkModifierType mods;
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 (event != NULL, FALSE);
......@@ -531,11 +520,10 @@ gtk_dial_motion_notify (GtkWidget *widget,
static gint
gtk_dial_timer (GtkDial *dial)
{
g_return_val_if_fail (dial != NULL, FALSE);
g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE);
if (dial->policy == GTK_UPDATE_DELAYED)
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
gtk_adjustment_value_changed (dial->adjustment);
return FALSE;
}
......@@ -544,9 +532,8 @@ static void
gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
{
gint xc, yc;
gfloat old_value;
gdouble old_value;
g_return_if_fail (dial != NULL);
g_return_if_fail (GTK_IS_DIAL (dial));
xc = GTK_WIDGET(dial)->allocation.width / 2;
......@@ -571,7 +558,7 @@ gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
{
if (dial->policy == GTK_UPDATE_CONTINUOUS)
{