[gtk+] Remove deprecated gtk_quit_* API
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Remove deprecated gtk_quit_* API
- Date: Tue, 4 Jan 2011 19:51:55 +0000 (UTC)
commit 7e7d8c4ccc5f269bc998dc59d8af4973fe567d1b
Author: Javier Jardón <jjardon gnome org>
Date: Tue Jan 4 13:39:35 2011 -0500
Remove deprecated gtk_quit_* API
docs/reference/gtk/gtk3-sections.txt | 5 -
docs/reference/gtk/tmpl/gtkmain.sgml | 74 +-------------
gtk/gtkmain.c | 193 +---------------------------------
gtk/gtkmain.h | 15 ---
4 files changed, 2 insertions(+), 285 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 00d5bef..b5b947e 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -5318,13 +5318,8 @@ gtk_device_grab_remove
<SUBSECTION>
GtkFunction
-gtk_quit_add_destroy
-gtk_quit_add
GtkCallbackMarshal
GtkArg
-gtk_quit_add_full
-gtk_quit_remove
-gtk_quit_remove_by_data
<SUBSECTION>
GTK_PRIORITY_RESIZE
diff --git a/docs/reference/gtk/tmpl/gtkmain.sgml b/docs/reference/gtk/tmpl/gtkmain.sgml
index c49a5d9..1d02af9 100644
--- a/docs/reference/gtk/tmpl/gtkmain.sgml
+++ b/docs/reference/gtk/tmpl/gtkmain.sgml
@@ -202,8 +202,7 @@ of the main loop return.
<!-- ##### FUNCTION gtk_main_level ##### -->
<para>
-Asks for the current nesting level of the main loop. This can be useful
-when calling gtk_quit_add().
+Asks for the current nesting level of the main loop.
</para>
@void:
@@ -439,33 +438,6 @@ If @widget does not have the grab, this function does nothing.
@Returns:
-<!-- ##### FUNCTION gtk_quit_add_destroy ##### -->
-<para>
-Trigger destruction of @object in case the mainloop at level @main_level
-is quit.
-</para>
-
- main_level: Level of the mainloop which shall trigger the destruction.
- object: Object to be destroyed.
- Deprecated: This function is going to be removed in GTK+ 3.0
-
-
-<!-- ##### FUNCTION gtk_quit_add ##### -->
-<para>
-Registers a function to be called when an instance of the mainloop is left.
-</para>
-
- main_level: Level at which termination the function shall be called. You
- can pass 0 here to have the function run at the termination of the current
- mainloop.
- function: The function to call. This should return 0 to be removed from the
- list of quit handlers. Otherwise the function might be called again.
- data: Pointer to pass when calling @function.
- Returns: A handle for this quit handler (you need this for gtk_quit_remove())
- or 0 if you passed a %NULL pointer in @function.
- Deprecated: This function is going to be removed in GTK+ 3.0
-
-
<!-- ##### USER_FUNCTION GtkCallbackMarshal ##### -->
<para>
@@ -485,50 +457,6 @@ Registers a function to be called when an instance of the mainloop is left.
@type:
@name:
-<!-- ##### FUNCTION gtk_quit_add_full ##### -->
-<para>
-Registers a function to be called when an instance of the mainloop is left.
-In comparison to gtk_quit_add() this function adds the possibility to
-pass a marshaller and a function to be called when the quit handler is freed.
-</para>
-<para>
-The former can be used to run interpreted code instead of a compiled function
-while the latter can be used to free the information stored in @data (while
-you can do this in @function as well)... So this function will mostly be
-used by GTK+ wrappers for languages other than C.
-</para>
-
- main_level: Level at which termination the function shall be called. You
- can pass 0 here to have the function run at the termination of the current
- mainloop.
- function: The function to call. This should return 0 to be removed from the
- list of quit handlers. Otherwise the function might be called again.
- marshal: The marshaller to be used. If this is non-%NULL, @function is
- ignored.
- data: Pointer to pass when calling @function.
- destroy: Function to call to destruct @data. Gets @data as argument.
- Returns: A handle for this quit handler (you need this for gtk_quit_remove())
- or 0 if you passed a %NULL pointer in @function.
- Deprecated: This function is going to be removed in GTK+ 3.0
-
-
-<!-- ##### FUNCTION gtk_quit_remove ##### -->
-<para>
-Removes a quit handler by its identifier.
-</para>
-
- quit_handler_id: Identifier for the handler returned when installing it.
- Deprecated: This function is going to be removed in GTK+ 3.0
-
-
-<!-- ##### FUNCTION gtk_quit_remove_by_data ##### -->
-<para>
-Removes a quit handler identified by its @data field.
-</para>
-
- data: The pointer passed as @data to gtk_quit_add() or gtk_quit_add_full().
- Deprecated: This function is going to be removed in GTK+ 3.0
-
<!-- ##### MACRO GTK_PRIORITY_RESIZE ##### -->
<para>
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 860adbb..f16c8fa 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -143,19 +143,8 @@ _gtk_get_localedir (void)
/* Private type definitions
*/
-typedef struct _GtkQuitFunction GtkQuitFunction;
typedef struct _GtkKeySnooperData GtkKeySnooperData;
-struct _GtkQuitFunction
-{
- guint id;
- guint main_level;
- GtkCallbackMarshal marshal;
- GtkFunction function;
- gpointer data;
- GDestroyNotify destroy;
-};
-
struct _GtkKeySnooperData
{
GtkKeySnoopFunc func;
@@ -163,8 +152,6 @@ struct _GtkKeySnooperData
guint id;
};
-static gint gtk_quit_invoke_function (GtkQuitFunction *quitf);
-static void gtk_quit_destroy (GtkQuitFunction *quitf);
static gint gtk_invoke_key_snoopers (GtkWidget *grab_widget,
GdkEvent *event);
@@ -177,8 +164,6 @@ static GList *current_events = NULL;
static GSList *main_loops = NULL; /* stack of currently executing main loops */
-static GList *quit_functions = NULL; /* A list of quit functions.
- */
static GSList *key_snoopers = NULL;
static guint debug_flags = 0; /* Global GTK debug flag */
@@ -1256,11 +1241,10 @@ gtk_get_default_language (void)
void
gtk_main (void)
{
- GList *tmp_list;
GMainLoop *loop;
gtk_main_loop_level++;
-
+
loop = g_main_loop_new (NULL, TRUE);
main_loops = g_slist_prepend (main_loops, loop);
@@ -1272,43 +1256,6 @@ gtk_main (void)
gdk_flush ();
}
- if (quit_functions)
- {
- GList *reinvoke_list = NULL;
- GtkQuitFunction *quitf;
-
- while (quit_functions)
- {
- quitf = quit_functions->data;
-
- tmp_list = quit_functions;
- quit_functions = g_list_remove_link (quit_functions, quit_functions);
- g_list_free_1 (tmp_list);
-
- if ((quitf->main_level && quitf->main_level != gtk_main_loop_level) ||
- gtk_quit_invoke_function (quitf))
- {
- reinvoke_list = g_list_prepend (reinvoke_list, quitf);
- }
- else
- {
- gtk_quit_destroy (quitf);
- }
- }
- if (reinvoke_list)
- {
- GList *work;
-
- work = g_list_last (reinvoke_list);
- if (quit_functions)
- quit_functions->prev = work;
- work->next = quit_functions;
- quit_functions = work;
- }
-
- gdk_flush ();
- }
-
main_loops = g_slist_remove (main_loops, loop);
g_main_loop_unref (loop);
@@ -2132,124 +2079,6 @@ gtk_invoke_key_snoopers (GtkWidget *grab_widget,
return return_val;
}
-guint
-gtk_quit_add_full (guint main_level,
- GtkFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GDestroyNotify destroy)
-{
- static guint quit_id = 1;
- GtkQuitFunction *quitf;
-
- g_return_val_if_fail ((function != NULL) || (marshal != NULL), 0);
-
- quitf = g_slice_new (GtkQuitFunction);
-
- quitf->id = quit_id++;
- quitf->main_level = main_level;
- quitf->function = function;
- quitf->marshal = marshal;
- quitf->data = data;
- quitf->destroy = destroy;
-
- quit_functions = g_list_prepend (quit_functions, quitf);
-
- return quitf->id;
-}
-
-static void
-gtk_quit_destroy (GtkQuitFunction *quitf)
-{
- if (quitf->destroy)
- quitf->destroy (quitf->data);
- g_slice_free (GtkQuitFunction, quitf);
-}
-
-static gint
-gtk_quit_destructor (GtkWidget **object_p)
-{
- if (*object_p)
- gtk_widget_destroy (*object_p);
- g_free (object_p);
-
- return FALSE;
-}
-
-void
-gtk_quit_add_destroy (guint main_level,
- GtkWidget *object)
-{
- GtkWidget **object_p;
-
- g_return_if_fail (main_level > 0);
- g_return_if_fail (GTK_IS_WIDGET (object));
-
- object_p = g_new (GtkWidget*, 1);
- *object_p = object;
- g_signal_connect (object,
- "destroy",
- G_CALLBACK (gtk_widget_destroyed),
- object_p);
- gtk_quit_add (main_level, (GtkFunction) gtk_quit_destructor, object_p);
-}
-
-guint
-gtk_quit_add (guint main_level,
- GtkFunction function,
- gpointer data)
-{
- return gtk_quit_add_full (main_level, function, NULL, data, NULL);
-}
-
-void
-gtk_quit_remove (guint id)
-{
- GtkQuitFunction *quitf;
- GList *tmp_list;
-
- tmp_list = quit_functions;
- while (tmp_list)
- {
- quitf = tmp_list->data;
-
- if (quitf->id == id)
- {
- quit_functions = g_list_remove_link (quit_functions, tmp_list);
- g_list_free (tmp_list);
- gtk_quit_destroy (quitf);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-}
-
-void
-gtk_quit_remove_by_data (gpointer data)
-{
- GtkQuitFunction *quitf;
- GList *tmp_list;
-
- tmp_list = quit_functions;
- while (tmp_list)
- {
- quitf = tmp_list->data;
-
- if (quitf->data == data)
- {
- quit_functions = g_list_remove_link (quit_functions, tmp_list);
- g_list_free (tmp_list);
- gtk_quit_destroy (quitf);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-}
-
/**
* gtk_get_current_event:
*
@@ -2356,26 +2185,6 @@ gtk_get_event_widget (GdkEvent *event)
return widget;
}
-static gint
-gtk_quit_invoke_function (GtkQuitFunction *quitf)
-{
- if (!quitf->marshal)
- return quitf->function (quitf->data);
- else
- {
- GtkArg args[1];
- gint ret_val = FALSE;
-
- args[0].name = NULL;
- args[0].type = G_TYPE_BOOLEAN;
- args[0].d.pointer_data = &ret_val;
- ((GtkCallbackMarshal) quitf->marshal) (NULL,
- quitf->data,
- 0, args);
- return ret_val;
- }
-}
-
/**
* gtk_propagate_event:
* @widget: a #GtkWidget
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index 050b18c..82a7392 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -141,21 +141,6 @@ void gtk_device_grab_add (GtkWidget *widget,
void gtk_device_grab_remove (GtkWidget *widget,
GdkDevice *device);
-#if !defined (GTK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
-void gtk_quit_add_destroy (guint main_level,
- GtkWidget *object);
-guint gtk_quit_add (guint main_level,
- GtkFunction function,
- gpointer data);
-guint gtk_quit_add_full (guint main_level,
- GtkFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GDestroyNotify destroy);
-void gtk_quit_remove (guint quit_handler_id);
-void gtk_quit_remove_by_data (gpointer data);
-#endif
-
guint gtk_key_snooper_install (GtkKeySnoopFunc snooper,
gpointer func_data);
void gtk_key_snooper_remove (guint snooper_handler_id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]