[gtk+/wip/tingping/remove-dialog-run: 3/6] Remove gtk_native_dialog_run()
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/tingping/remove-dialog-run: 3/6] Remove gtk_native_dialog_run()
- Date: Fri, 2 Jun 2017 23:10:49 +0000 (UTC)
commit 3a60a29346bd2448b6823ea75be6637fba3f0e78
Author: Patrick Griffis <tingping tingping se>
Date: Fri Jun 2 15:27:59 2017 -0400
Remove gtk_native_dialog_run()
gtk/gtknativedialog.c | 108 -------------------------------------------------
gtk/gtknativedialog.h | 3 -
2 files changed, 0 insertions(+), 111 deletions(-)
---
diff --git a/gtk/gtknativedialog.c b/gtk/gtknativedialog.c
index 6e1a0ec..48b0acc 100644
--- a/gtk/gtknativedialog.c
+++ b/gtk/gtknativedialog.c
@@ -56,10 +56,6 @@
* various common properties on the dialog, as well as show and hide
* it and get a #GtkNativeDialog::response signal when the user finished
* with the dialog.
- *
- * There is also a gtk_native_dialog_run() helper that makes it easy
- * to run any native dialog in a modal way with a recursive mainloop,
- * similar to gtk_dialog_run().
*/
typedef struct _GtkNativeDialogPrivate GtkNativeDialogPrivate;
@@ -71,10 +67,6 @@ struct _GtkNativeDialogPrivate
guint visible : 1;
guint modal : 1;
-
- /* Run state */
- gint run_response_id;
- GMainLoop *run_loop; /* Non-NULL when in run */
};
enum {
@@ -355,9 +347,6 @@ gtk_native_dialog_hide (GtkNativeDialog *self)
klass->hide (self);
- if (priv->run_loop && g_main_loop_is_running (priv->run_loop))
- g_main_loop_quit (priv->run_loop);
-
g_object_notify_by_pspec (G_OBJECT (self), native_props[PROP_VISIBLE]);
}
@@ -560,100 +549,3 @@ gtk_native_dialog_get_transient_for (GtkNativeDialog *self)
return priv->transient_for;
}
-
-static void
-run_response_cb (GtkNativeDialog *self,
- gint response_id,
- gpointer data)
-{
- GtkNativeDialogPrivate *priv = gtk_native_dialog_get_instance_private (self);
-
- priv->run_response_id = response_id;
- if (priv->run_loop && g_main_loop_is_running (priv->run_loop))
- g_main_loop_quit (priv->run_loop);
-}
-
-/**
- * gtk_native_dialog_run:
- * @self: a #GtkNativeDialog
- *
- * Blocks in a recursive main loop until @self emits the
- * #GtkNativeDialog::response signal. It then returns the response ID
- * from the ::response signal emission.
- *
- * Before entering the recursive main loop, gtk_native_dialog_run()
- * calls gtk_native_dialog_show() on the dialog for you.
- *
- * After gtk_native_dialog_run() returns, then dialog will be hidden.
- *
- * Typical usage of this function might be:
- * |[<!-- language="C" -->
- * gint result = gtk_native_dialog_run (GTK_NATIVE_DIALOG (dialog));
- * switch (result)
- * {
- * case GTK_RESPONSE_ACCEPT:
- * do_application_specific_something ();
- * break;
- * default:
- * do_nothing_since_dialog_was_cancelled ();
- * break;
- * }
- * g_object_unref (dialog);
- * ]|
- *
- * Note that even though the recursive main loop gives the effect of a
- * modal dialog (it prevents the user from interacting with other
- * windows in the same window group while the dialog is run), callbacks
- * such as timeouts, IO channel watches, DND drops, etc, will
- * be triggered during a gtk_nautilus_dialog_run() call.
- *
- * Returns: response ID
- *
- * Since: 3.20
- **/
-gint
-gtk_native_dialog_run (GtkNativeDialog *self)
-{
- GtkNativeDialogPrivate *priv = gtk_native_dialog_get_instance_private (self);
- gboolean was_modal;
- guint response_handler;
-
- g_return_val_if_fail (GTK_IS_NATIVE_DIALOG (self), -1);
- g_return_val_if_fail (!priv->visible, -1);
- g_return_val_if_fail (priv->run_loop == NULL, -1);
-
- if (priv->visible || priv->run_loop != NULL)
- return -1;
-
- g_object_ref (self);
-
- priv->run_response_id = GTK_RESPONSE_NONE;
- priv->run_loop = g_main_loop_new (NULL, FALSE);
-
- was_modal = priv->modal;
- gtk_native_dialog_set_modal (self, TRUE);
-
- response_handler =
- g_signal_connect (self,
- "response",
- G_CALLBACK (run_response_cb),
- NULL);
-
- gtk_native_dialog_show (self);
-
- gdk_threads_leave ();
- g_main_loop_run (priv->run_loop);
- gdk_threads_enter ();
-
- g_signal_handler_disconnect (self, response_handler);
-
- g_main_loop_unref (priv->run_loop);
- priv->run_loop = NULL;
-
- if (!was_modal)
- gtk_native_dialog_set_modal (self, FALSE);
-
- g_object_unref (self);
-
- return priv->run_response_id;
-}
diff --git a/gtk/gtknativedialog.h b/gtk/gtknativedialog.h
index de1a655..d53b389 100644
--- a/gtk/gtknativedialog.h
+++ b/gtk/gtknativedialog.h
@@ -73,9 +73,6 @@ void gtk_native_dialog_set_transient_for (GtkNativeDialog *self
GDK_AVAILABLE_IN_3_20
GtkWindow * gtk_native_dialog_get_transient_for (GtkNativeDialog *self);
-GDK_AVAILABLE_IN_3_20
-gint gtk_native_dialog_run (GtkNativeDialog *self);
-
G_END_DECLS
#endif /* __GTK_NATIVE_DIALOG_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]