[gtk+/font-chooser] GtkFontChooserDialog: Add parent window as a parameter in the constructor



commit 481efc0301fa10a79486f77e5ea5e238e851fede
Author: Alberto Ruiz <aruiz gnome org>
Date:   Mon Jul 25 17:14:49 2011 +0100

    GtkFontChooserDialog: Add parent window as a parameter in the constructor

 gtk/gtkfontchooserdialog.c    |   11 ++++++++---
 gtk/gtkfontchooserdialog.h    |    3 ++-
 tests/testfontchooserdialog.c |    2 +-
 3 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkfontchooserdialog.c b/gtk/gtkfontchooserdialog.c
index 08c529f..6d90e15 100644
--- a/gtk/gtkfontchooserdialog.c
+++ b/gtk/gtkfontchooserdialog.c
@@ -140,7 +140,8 @@ gtk_font_chooser_dialog_init (GtkFontChooserDialog *fontchooserdiag)
 
 /**
  * gtk_font_chooser_dialog_new:
- * @title: (allow-none): the title of the dialog window 
+ * @title: (allow-none): Title of the dialog, or %NULL
+ * @parent: (allow-none): Trasient parent of the dialog, or %NULL
  *
  * Creates a new #GtkFontChooserDialog.
  *
@@ -149,11 +150,15 @@ gtk_font_chooser_dialog_init (GtkFontChooserDialog *fontchooserdiag)
  * Since: 3.2
  */
 GtkWidget*
-gtk_font_chooser_dialog_new (const gchar *title)
+gtk_font_chooser_dialog_new (const gchar *title,
+                             GtkWindow   *parent)
 {
   GtkFontChooserDialog *dialog;
 
-  dialog = g_object_new (GTK_TYPE_FONT_CHOOSER_DIALOG, "title", title, NULL);
+  dialog = g_object_new (GTK_TYPE_FONT_CHOOSER_DIALOG,
+                         "title", title,
+                         "transient-for", parent,
+                         NULL);
 
   return GTK_WIDGET (dialog);
 }
diff --git a/gtk/gtkfontchooserdialog.h b/gtk/gtkfontchooserdialog.h
index 5a7b3d0..b127f66 100644
--- a/gtk/gtkfontchooserdialog.h
+++ b/gtk/gtkfontchooserdialog.h
@@ -59,7 +59,8 @@ struct _GtkFontChooserDialogClass
 };
 
 GType	     gtk_font_chooser_dialog_get_type           (void) G_GNUC_CONST;
-GtkWidget* gtk_font_chooser_dialog_new	              (const gchar            *title);
+GtkWidget* gtk_font_chooser_dialog_new	              (const gchar          *title,
+                                                       GtkWindow            *window);
 
 GtkWidget* gtk_font_chooser_dialog_get_font_chooser   (GtkFontChooserDialog *fcd);
 
diff --git a/tests/testfontchooserdialog.c b/tests/testfontchooserdialog.c
index b06ddb5..d242698 100644
--- a/tests/testfontchooserdialog.c
+++ b/tests/testfontchooserdialog.c
@@ -28,7 +28,7 @@ main (int argc, char *argv[])
 
   gtk_init (&argc, &argv);
 
-  dialog = gtk_font_chooser_dialog_new (NULL);
+  dialog = gtk_font_chooser_dialog_new (NULL, NULL);
 
   gtk_dialog_run (GTK_DIALOG (dialog));
 



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