[Xfce4-commits] <thunar:master> Allow thunar_show_create_dialog() take a GdkScreen or GtkWidget parent.
Jannis Pohlmann
noreply at xfce.org
Tue Oct 19 13:06:01 CEST 2010
Updating branch refs/heads/master
to ec96d9f50b2c9d39fc07948d5beabc8fc90ffea8 (commit)
from d06ae5418ce434dd83579b2a21e56e00355bc572 (commit)
commit ec96d9f50b2c9d39fc07948d5beabc8fc90ffea8
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Tue Oct 19 13:01:38 2010 +0200
Allow thunar_show_create_dialog() take a GdkScreen or GtkWidget parent.
thunar/thunar-create-dialog.c | 25 ++++++++++++++++---------
thunar/thunar-create-dialog.h | 4 ++--
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/thunar/thunar-create-dialog.c b/thunar/thunar-create-dialog.c
index 8698e80..055ac17 100644
--- a/thunar/thunar-create-dialog.c
+++ b/thunar/thunar-create-dialog.c
@@ -1,7 +1,7 @@
/* $Id$ */
/*-
* Copyright (c) 2005-2006 Benedikt Meurer <benny at xfce.org>
- * Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.org>
+ * Copyright (c) 2009-2010 Jannis Pohlmann <jannis at xfce.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -29,6 +29,7 @@
#include <thunar/thunar-gtk-extensions.h>
#include <thunar/thunar-icon-factory.h>
#include <thunar/thunar-private.h>
+#include <thunar/thunar-util.h>
@@ -415,7 +416,7 @@ thunar_create_dialog_set_content_type (ThunarCreateDialog *dialog,
/**
* thunar_show_create_dialog:
- * @parent : the parent widget or %NULL.
+ * @parent : a #GdkScreen, a #GtkWidget or %NULL.
* @content_type : the content type of the file or folder to create.
* @filename : the suggested filename or %NULL.
* @title : the dialog title.
@@ -431,20 +432,21 @@ thunar_create_dialog_set_content_type (ThunarCreateDialog *dialog,
* cancelled the dialog.
**/
gchar*
-thunar_show_create_dialog (GtkWidget *parent,
+thunar_show_create_dialog (gpointer parent,
const gchar *content_type,
const gchar *filename,
const gchar *title)
{
GtkWidget *dialog;
- GtkWidget *window;
+ GtkWindow *window;
+ GdkScreen *screen;
GError *error = NULL;
gchar *name = NULL;
- _thunar_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL);
+ _thunar_return_val_if_fail (parent == NULL || GDK_IS_SCREEN (parent) || GTK_IS_WIDGET (parent), NULL);
- /* determine the toplevel window */
- window = (parent != NULL) ? gtk_widget_get_toplevel (parent) : NULL;
+ /* parse the parent window and screen */
+ screen = thunar_util_parse_parent (parent, &window);
/* display the create dialog */
dialog = g_object_new (THUNAR_TYPE_CREATE_DIALOG,
@@ -454,8 +456,13 @@ thunar_show_create_dialog (GtkWidget *parent,
"modal", TRUE,
"title", title,
NULL);
- if (G_LIKELY (window != NULL))
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
+
+ if (screen != NULL)
+ gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+
+ if (window != NULL)
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), window);
+
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
{
/* determine the chosen filename */
diff --git a/thunar/thunar-create-dialog.h b/thunar/thunar-create-dialog.h
index 2d3d30b..62b1a22 100644
--- a/thunar/thunar-create-dialog.h
+++ b/thunar/thunar-create-dialog.h
@@ -1,7 +1,7 @@
/* $Id$ */
/*-
* Copyright (c) 2005-2006 Benedikt Meurer <benny at xfce.org>
- * Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.org>
+ * Copyright (c) 2009-2010 Jannis Pohlmann <jannis at xfce.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -47,7 +47,7 @@ const gchar *thunar_create_dialog_get_content_type (const ThunarCreateDial
void thunar_create_dialog_set_content_type (ThunarCreateDialog *dialog,
const gchar *content_type);
-gchar *thunar_show_create_dialog (GtkWidget *parent,
+gchar *thunar_show_create_dialog (gpointer parent,
const gchar *content_type,
const gchar *filename,
const gchar *title) G_GNUC_MALLOC;
More information about the Xfce4-commits
mailing list