[evolution-data-server] Add helper to show the name selector with correct transience, to fix the umpteen bugs in its use in



commit 3ed2df25ed6caba4fa95a9a02e2993550601ad6e
Author: Michael Meeks <michael meeks novell com>
Date:   Tue Jun 29 11:05:53 2010 +0100

    Add helper to show the name selector with correct transience, to
    fix the umpteen bugs in its use in Evolution.

 libedataserverui/e-name-selector.c |   27 +++++++++++++++++++++++++++
 libedataserverui/e-name-selector.h |    2 ++
 2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/libedataserverui/e-name-selector.c b/libedataserverui/e-name-selector.c
index a910869..4726e23 100644
--- a/libedataserverui/e-name-selector.c
+++ b/libedataserverui/e-name-selector.c
@@ -301,6 +301,33 @@ e_name_selector_peek_dialog (ENameSelector *name_selector)
 }
 
 /**
+ * e_name_selector_show_dialog:
+ * @name_selector: an #ENameSelector
+ * @for_transient_widget: a widget parent or %NULL
+ *
+ * Shows the associated dialog, and sets the transient parent to the
+ * GtkWindow top-level of "for_transient_widget if set (it should be)
+ **/
+void
+e_name_selector_show_dialog (ENameSelector *name_selector,
+			     GtkWidget     *for_transient_widget)
+{
+	GtkWindow *top = NULL;
+	ENameSelectorDialog *dialog;
+
+	g_return_if_fail (E_IS_NAME_SELECTOR (name_selector));
+
+	dialog = e_name_selector_peek_dialog (name_selector);
+	if (for_transient_widget)
+		top = GTK_WINDOW (gtk_widget_get_toplevel (for_transient_widget));
+	if (top)
+		gtk_window_set_transient_for (GTK_WINDOW (dialog), top);
+
+	gtk_widget_show (GTK_WIDGET (dialog));
+}
+
+
+/**
  * e_name_selector_peek_section_entry:
  * @name_selector: an #ENameSelector
  * @name: the name of the section to peek
diff --git a/libedataserverui/e-name-selector.h b/libedataserverui/e-name-selector.h
index 1d12d37..2416661 100644
--- a/libedataserverui/e-name-selector.h
+++ b/libedataserverui/e-name-selector.h
@@ -79,6 +79,8 @@ ENameSelectorList *
 		e_name_selector_peek_section_list
 						(ENameSelector *name_selector,
 						 const gchar *name);
+void		e_name_selector_show_dialog	(ENameSelector *name_selector,
+						 GtkWidget     *for_transient_widget);
 
 G_END_DECLS
 



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