[gok] Remove deprecated GTK+ symbols - bgo#572686



commit d360f68dc5c5066dfcffe7137d8aa280e1a7e0fa
Author: Gerd Kohlberger <gerdk src gnome org>
Date:   Sun Apr 26 19:25:56 2009 +0200

    Remove deprecated GTK+ symbols - bgo#572686
    
    - gtk_signal_connect
    - GTK_SIGNAL_FUNC
---
 gok/gok-control.c           |   76 ++++++++++++++++++++-----------------------
 gok/gok-editor.c            |    9 ++---
 gok/gok-keyboard.c          |   45 +++++++++----------------
 gok/gok-page-accessmethod.c |    8 ++--
 gok/main.c                  |   46 +++++++++----------------
 5 files changed, 76 insertions(+), 108 deletions(-)

diff --git a/gok/gok-control.c b/gok/gok-control.c
index 5853825..9f8a96d 100644
--- a/gok/gok-control.c
+++ b/gok/gok-control.c
@@ -1,7 +1,7 @@
 /* gok-control.h
 *
-* Copyright 2001,2002 Sun Microsystems, Inc.,
-* Copyright 2001,2002 University Of Toronto
+* Copyright 2001-2009 Sun Microsystems, Inc.,
+* Copyright 2001-2009 University Of Toronto
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
@@ -199,6 +199,30 @@ void gok_control_button_callback_close ()
 	}
 }
 
+/*
+ * gok_control_show_error:
+ * @title:   Title of the dialog
+ * @message: Error message
+ *
+ * Display an error message to the user.
+ **/
+static void
+gok_control_show_error (const gchar *title,
+		        const gchar *message)
+{
+	GtkWidget *dialog, *settings;
+
+	settings = gok_settingsdialog_get_window ();
+	dialog = gtk_message_dialog_new (GTK_WINDOW (settings),
+					 GTK_DIALOG_DESTROY_WITH_PARENT,
+					 GTK_MESSAGE_ERROR,
+					 GTK_BUTTONS_CLOSE,
+					 "%s", message);
+	gtk_window_set_title (GTK_WINDOW (dialog), title);
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	gtk_widget_destroy (dialog);
+}
+
 /**
 * gok_control_button_handler
 *
@@ -208,7 +232,6 @@ void gok_control_button_callback_close ()
 void gok_control_button_handler (GtkButton* pButton, gpointer user_data)
 {
 	GokControlCallback* pCallback;
-	GtkWidget* pDialog;
 
 	/* find the appropriate callback for this button */
 	pCallback = m_pControlCallbackFirst;
@@ -219,54 +242,25 @@ void gok_control_button_handler (GtkButton* pButton, gpointer user_data)
 			switch (pCallback->HandlerType)
 			{
 				case CONTROL_HANDLER_BROWSESOUND:
-	
-pDialog = gtk_message_dialog_new ((GtkWindow*)gok_settingsdialog_get_window(),
-		GTK_DIALOG_DESTROY_WITH_PARENT,
-		GTK_MESSAGE_ERROR,
-		GTK_BUTTONS_CLOSE,
-		_("Sorry, browse for sound file not implemented yet."));
-	
-gtk_window_set_title (GTK_WINDOW (pDialog), _("GOK Browse for sound file"));
-gtk_dialog_run (GTK_DIALOG (pDialog));
-gtk_widget_destroy (pDialog);
-				
-
-/*
-					pFileSelectorDialog = gtk_file_selection_new (_("Select Sound File"));
-					g_signal_connect_swapped (GTK_OBJECT(GTK_FILE_SELECTION(pFileSelectorDialog)->ok_button),
-											"clicked", 
-											G_CALLBACK (gtk_widget_destroy),
-											(gpointer)pFileSelectorDialog);
-					g_signal_connect_swapped (GTK_OBJECT(GTK_FILE_SELECTION(pFileSelectorDialog)->cancel_button),
-											"clicked", 
-											G_CALLBACK (gtk_widget_destroy),
-											(gpointer)pFileSelectorDialog);
-					gtk_widget_show (pFileSelectorDialog);
-*/
+					gok_control_show_error (
+						_("GOK Browse for sound file"),
+						_("Sorry, browse for sound file not implemented yet."));
 					break;
 					
 				case CONTROL_HANDLER_ADVANCED:
-pDialog = gtk_message_dialog_new ((GtkWindow*)gok_settingsdialog_get_window(),
-		GTK_DIALOG_DESTROY_WITH_PARENT,
-		GTK_MESSAGE_ERROR,
-		GTK_BUTTONS_CLOSE,
-		_("Sorry, advanced settings not implemented yet."));
-	
-gtk_window_set_title (GTK_WINDOW (pDialog), _("GOK Inverse Scanning Advanced"));
-gtk_dialog_run (GTK_DIALOG (pDialog));
-gtk_widget_destroy (pDialog);
+					gok_control_show_error (
+						_("GOK Inverse Scanning Advanced"),
+						_("Sorry, advanced settings not implemented yet."));
 					break;
 					
 				default:
 					gok_log_x ("Default hit!");
 					break;
 			}
-			
 			break;
 		}
 		pCallback = pCallback->pControlCallbackNext;
 	}
-	
 	if (pCallback == NULL)
 	{
 		gok_log_x ("Can't find this button in our callback list!");
@@ -305,9 +299,9 @@ void gok_control_add_handler (GtkWidget* pWidget, gint HandlerType)
 		pCallback->pControlCallbackNext = pCallbackNew;
 	}
 	
-	/* connect a GTK signal handler to the widget */
-	gtk_signal_connect (GTK_OBJECT (pWidget), "clicked",
-			GTK_SIGNAL_FUNC (gok_control_button_handler), NULL);
+	/* connect a signal handler to the widget */
+	g_signal_connect (pWidget, "clicked",
+			  G_CALLBACK (gok_control_button_handler), NULL);
 
 }
 
diff --git a/gok/gok-editor.c b/gok/gok-editor.c
index 10715d5..b9341d2 100644
--- a/gok/gok-editor.c
+++ b/gok/gok-editor.c
@@ -1,8 +1,8 @@
 /*
 * gok-editor.c
 *
-* Copyright 2001,2002 Sun Microsystems, Inc.,
-* Copyright 2001,2002 University Of Toronto
+* Copyright 2001-2009 Sun Microsystems, Inc.,
+* Copyright 2001-2009 University Of Toronto
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
@@ -98,9 +98,8 @@ void gok_editor_run()
 	*/
 
 	/* handle the 'delete' event so the keyboard window will not close */
-	gtk_signal_connect (GTK_OBJECT (m_pWindowKeyboard), "delete_event",
-                      GTK_SIGNAL_FUNC (on_editor_keyboard_delete_event),
-                      NULL);
+	g_signal_connect (m_pWindowKeyboard, "delete_event",
+			  G_CALLBACK (on_editor_keyboard_delete_event), NULL);
 	
 	/* TODO - do not allow the user to resize the keyboard window */
 
diff --git a/gok/gok-keyboard.c b/gok/gok-keyboard.c
index f321712..8da1482 100644
--- a/gok/gok-keyboard.c
+++ b/gok/gok-keyboard.c
@@ -1,7 +1,7 @@
 /* gok-keyboard.c
 *
-* Copyright 2001,2002 Sun Microsystems, Inc.,
-* Copyright 2001,2002 University Of Toronto
+* Copyright 2001-2009 Sun Microsystems, Inc.,
+* Copyright 2001-2009 University Of Toronto
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
@@ -1976,37 +1976,24 @@ gboolean gok_keyboard_display (GokKeyboard* pKeyboard, GokKeyboard* pKeyboardCur
 			/* add these signal handlers to the button */
 			if (CallbackScanner == TRUE) /* button is used by GOK */
 			{
-				gtk_signal_connect (GTK_OBJECT (pNewButton), "button_press_event",
-	                      GTK_SIGNAL_FUNC (on_window1_button_press_event),
-	                      pKey);
-
-				gtk_signal_connect (GTK_OBJECT (pNewButton), "button_release_event",
-	                      GTK_SIGNAL_FUNC (on_window1_button_release_event),
-	                      pKey);
-
+				g_signal_connect (pNewButton, "button_press_event",
+						  G_CALLBACK (on_window1_button_press_event), pKey);
+				g_signal_connect (pNewButton, "button_release_event",
+						  G_CALLBACK (on_window1_button_release_event), pKey);
 				/* this next signal never occurs? */
-				gtk_signal_connect (GTK_OBJECT (pNewButton), "toggled",
-	                      GTK_SIGNAL_FUNC (on_window1_button_toggle_event),
-	                      pKey);
-	
-				gtk_signal_connect (GTK_OBJECT (pNewButton), "enter_notify_event",
-	                      GTK_SIGNAL_FUNC (gok_button_enter_notify),
-	                      NULL);
-
-				gtk_signal_connect (GTK_OBJECT (pNewButton), "leave_notify_event",
-	                      GTK_SIGNAL_FUNC (gok_button_leave_notify),
-	                      NULL);
-
-				gtk_signal_connect (GTK_OBJECT (pNewButton), "state_changed",
-						GTK_SIGNAL_FUNC (gok_button_state_changed),
-						NULL);
-
+				g_signal_connect (pNewButton, "toggled",
+						  G_CALLBACK (on_window1_button_toggle_event), pKey);
+				g_signal_connect (pNewButton, "enter_notify_event",
+						  G_CALLBACK (gok_button_enter_notify), NULL);
+				g_signal_connect (pNewButton, "leave_notify_event",
+						G_CALLBACK (gok_button_leave_notify), NULL);
+				g_signal_connect (pNewButton, "state_changed",
+						  G_CALLBACK (gok_button_state_changed), NULL);
 			}
 			else /* button is used by editor */
 			{
-				gtk_signal_connect (GTK_OBJECT (pNewButton), "button_press_event",
-	                      GTK_SIGNAL_FUNC (on_editor_button_press_event),
-	                      NULL);
+				g_signal_connect (pNewButton, "button_press_event",
+						  G_CALLBACK (on_editor_button_press_event), NULL);
 			}
 
 			/* set the 'name' of the button */
diff --git a/gok/gok-page-accessmethod.c b/gok/gok-page-accessmethod.c
index d99472e..de2aa19 100644
--- a/gok/gok-page-accessmethod.c
+++ b/gok/gok-page-accessmethod.c
@@ -1,7 +1,7 @@
 /* gok-page-accessmethod.c
 *
-* Copyright 2002 Sun Microsystems, Inc.,
-* Copyright 2002 University Of Toronto
+* Copyright 2002-2009 Sun Microsystems, Inc.,
+* Copyright 2002-2009 University Of Toronto
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
@@ -729,8 +729,8 @@ void gok_page_accessmethod_draw_controls (gchar* NameAccessMethod, GokControl* p
 						/* connect this signal so we get notified when the control changes state */
 						/* note: This is only done for checkboxes. If you have associated controls
 						   for other controls then add a handler for them. */
-						gtk_signal_connect (GTK_OBJECT (pWidget), "toggled",
-						GTK_SIGNAL_FUNC (gok_page_accessmethod_checkbox_changed),NULL);
+						g_signal_connect (pWidget, "toggled",
+								  G_CALLBACK (gok_page_accessmethod_checkbox_changed), NULL);
 						break;
 						
 					case CONTROL_TYPE_RADIOBUTTON:
diff --git a/gok/main.c b/gok/main.c
index 1846358..5447ef7 100644
--- a/gok/main.c
+++ b/gok/main.c
@@ -3,8 +3,8 @@
 *
 * Main file for the mighty GOK
 *
-* Copyright 2001 - 2004 Sun Microsystems, Inc.,
-* Copyright 2001 - 2004 University Of Toronto*
+* Copyright 2001-2009 Sun Microsystems, Inc.,
+* Copyright 2001-2009 University Of Toronto*
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
@@ -1944,37 +1944,25 @@ GtkWidget* gok_main_create_window (struct gok_window_realize_data *window_realiz
 	gtk_widget_show (fixed1);
 	gtk_container_add (GTK_CONTAINER (window1), fixed1);
 
-	gtk_signal_connect (GTK_OBJECT (window1), "motion_notify_event",
-                      GTK_SIGNAL_FUNC (on_window1_motion_notify_event),
-                      NULL);
-
-	gtk_signal_connect (GTK_OBJECT (window1), "leave_notify_event",
-                      GTK_SIGNAL_FUNC (on_window1_leave_notify_event),
-                      NULL);
-
-	gtk_signal_connect (GTK_OBJECT (window1), "enter_notify_event",
-                      GTK_SIGNAL_FUNC (on_window1_enter_notify_event),
-                      NULL);
-
 	gtk_widget_add_events (window1, GDK_POINTER_MOTION_MASK);
 
-	gtk_signal_connect (GTK_OBJECT (window1), "size_allocate",
-                      GTK_SIGNAL_FUNC (on_window1_size_allocate),
-                      NULL);
-                      
-	gtk_signal_connect (GTK_OBJECT (window1), "delete_event",
-                      GTK_SIGNAL_FUNC (on_window1_delete_event),
-                      NULL);
-
-	gtk_signal_connect (GTK_OBJECT (window1), "configure_event",
-                      GTK_SIGNAL_FUNC (on_window1_configure_event),
-                      NULL);
-					  
-	gtk_signal_connect (GTK_OBJECT (window1), "window_state_event",
-                      GTK_SIGNAL_FUNC (on_gok_window_state_event),
-                      NULL);
+	g_signal_connect (window1, "motion_notify_event",
+			  G_CALLBACK (on_window1_motion_notify_event), NULL);
+	g_signal_connect (window1, "leave_notify_event",
+			  G_CALLBACK (on_window1_leave_notify_event), NULL);
+	g_signal_connect (window1, "enter_notify_event",
+			  G_CALLBACK (on_window1_enter_notify_event), NULL);
+	g_signal_connect (window1, "size_allocate",
+			  G_CALLBACK (on_window1_size_allocate), NULL);
+	g_signal_connect (window1, "delete_event",
+			  G_CALLBACK (on_window1_delete_event), NULL);
+	g_signal_connect (window1, "configure_event",
+			  G_CALLBACK (on_window1_configure_event), NULL);
+	g_signal_connect (window1, "window_state_event",
+			  G_CALLBACK (on_gok_window_state_event), NULL);
 
 	gok_log_leave();
+
 	return window1;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]