diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-09-05 09:18:15 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-09-05 09:18:15 +0800 |
commit | e9fe87ee9923aaa3bcb29e162d823267337ab274 (patch) | |
tree | 0d6c8e8c0a652c4f355a5ea7f203da52beb8747f /e-util/e-dialog-utils.c | |
parent | 54b282cf4fbac0d4dfbbe90caa2a206eb088f76d (diff) | |
download | gsoc2013-evolution-e9fe87ee9923aaa3bcb29e162d823267337ab274.tar.gz gsoc2013-evolution-e9fe87ee9923aaa3bcb29e162d823267337ab274.tar.zst gsoc2013-evolution-e9fe87ee9923aaa3bcb29e162d823267337ab274.zip |
Remove some obsolete utility functions.
Diffstat (limited to 'e-util/e-dialog-utils.c')
-rw-r--r-- | e-util/e-dialog-utils.c | 169 |
1 files changed, 1 insertions, 168 deletions
diff --git a/e-util/e-dialog-utils.c b/e-util/e-dialog-utils.c index d02a42572b..14f12e2f4c 100644 --- a/e-util/e-dialog-utils.c +++ b/e-util/e-dialog-utils.c @@ -71,178 +71,11 @@ e_notice (gpointer parent, GtkMessageType type, const gchar *format, ...) g_free (str); if (parent) - e_dialog_set_transient_for (GTK_WINDOW (dialog), parent); + gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } -/** - * e_notice_with_xid: - * @parent: the dialog's parent window, or %NULL - * @type: the type of dialog (%GTK_MESSAGE_INFO, %GTK_MESSAGE_WARNING, - * or %GTK_MESSAGE_ERROR) - * @format: printf-style format string, followed by arguments - * - * Like e_notice(), but takes a GdkNativeWindow for the parent - * window argument. - **/ -void -e_notice_with_xid (GdkNativeWindow parent, GtkMessageType type, const gchar *format, ...) -{ - GtkWidget *dialog; - va_list args; - gchar *str; - - va_start (args, format); - str = g_strdup_vprintf (format, args); - dialog = gtk_message_dialog_new (NULL, - GTK_DIALOG_DESTROY_WITH_PARENT, - type, - GTK_BUTTONS_OK, - "%s", - str); - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); - va_end (args); - g_free (str); - - if (parent) - e_dialog_set_transient_for_xid (GTK_WINDOW (dialog), parent); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); -} - - -#ifdef GDK_WINDOWING_X11 -/* Tests whether or not an X Window is being managed by the - * window manager. - */ -static gboolean -window_is_wm_toplevel (Display *display, Window window) -{ - static Atom WM_STATE = None; - unsigned long nitems, after; - guchar *data = NULL; - Atom type = None; - gint format; - - if (!WM_STATE) - WM_STATE = XInternAtom (display, "WM_STATE", False); - - if (XGetWindowProperty (display, window, WM_STATE, 0, 0, False, - AnyPropertyType, &type, &format, - &nitems, &after, &data) == Success) { - if (data) - XFree((gchar *)data); - if (type) - return TRUE; - } - return FALSE; -} - -#endif - -/** - * e_dialog_set_transient_for: - * @dialog: a dialog window - * @parent_widget: the parent for @dialog - * - * This sets the parent for @dialog to be @parent_widget. Unlike - * gtk_window_set_transient_for (), this doesn't need @parent_widget to - * be the actual toplevel, and also works if @parent_widget is - * embedded as a Bonobo control by an out-of-process container. - * @parent_widget must already be realized before calling this - * function, but @dialog does not need to be. - **/ -void -e_dialog_set_transient_for (GtkWindow *dialog, - GtkWidget *parent_widget) -{ - GtkWidget *toplevel; -#ifdef GDK_WINDOWING_X11 - Window parent, root_ret, *children; - guint numchildren; - Display *display; - Status status; -#endif - g_return_if_fail (GTK_IS_WINDOW (dialog)); - g_return_if_fail (GTK_IS_WIDGET (parent_widget)); - - toplevel = gtk_widget_get_toplevel (parent_widget); - if (toplevel == NULL) - return; - - if (!GTK_IS_PLUG (toplevel)) { - gtk_window_set_transient_for (GTK_WINDOW (dialog), - GTK_WINDOW (toplevel)); - return; - } -#ifdef GDK_WINDOWING_X11 - /* Find the top-level windowmanager-managed X Window */ - display = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (parent_widget)); - parent = GDK_WINDOW_XID (gtk_widget_get_window (parent_widget)); - - while (parent && !window_is_wm_toplevel (display, parent)) { - status = XQueryTree (display, parent, &root_ret, - &parent, &children, &numchildren); - if (status != 0) - XFree (children); - } - - e_dialog_set_transient_for_xid (dialog, parent); -#endif -#ifdef GDK_WINDOWING_WIN32 - g_warning ("Not implemented on Win32: e_dialog_set_transient_for () for plug windows"); -#endif -} - -static void -dialog_realized (GtkWindow *dialog, gpointer xid) -{ - e_dialog_set_transient_for_xid (dialog, (GdkNativeWindow)GPOINTER_TO_INT(xid)); -} - -/** - * e_dialog_set_transient_for_xid: - * @dialog: a dialog window - * @xid: the X Window parent - * - * Like e_dialog_set_transient_for (), but use an XID to specify the - * parent window. - **/ -void -e_dialog_set_transient_for_xid (GtkWindow *dialog, - GdkNativeWindow xid) -{ -#ifdef GDK_MULTIHEAD_SAFE - GdkDisplay *display; -#endif - GdkWindow *parent; - - g_return_if_fail (GTK_IS_WINDOW (dialog)); - - if (!GTK_WIDGET_REALIZED (dialog)) { - g_signal_connect (dialog, "realize", - G_CALLBACK (dialog_realized), - GINT_TO_POINTER(xid)); - return; - } - -#ifdef GDK_MULTIHEAD_SAFE - display = gdk_drawable_get_display (GDK_DRAWABLE (gtk_widget_get_window (GTK_WIDGET (dialog)))); - parent = gdk_window_lookup_for_display (display, xid); - if (!parent) - parent = gdk_window_foreign_new_for_display (display, xid); -#else - parent = gdk_window_lookup (xid); - if (!parent) - parent = gdk_window_foreign_new (xid); -#endif - g_return_if_fail (parent != NULL); - - gdk_window_set_transient_for (gtk_widget_get_window (GTK_WIDGET (dialog)), parent); -} - - static void save_ok (GtkWidget *widget, gpointer data) { |