Skip to content
Snippets Groups Projects
Commit ad739c46 authored by Jannis Pohlmann's avatar Jannis Pohlmann
Browse files

Make the parent passd to thunar_dialogs_show_rename_file() a gpointer.

This way we can pass a GdkScreen object to it as well as a GtkWindow,
just like we when calling some of the other dialog routines.
parent 2fa12015
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,9 @@
/**
* thunar_dialogs_show_rename_file:
* @parent : the parent #GtkWindow.
* @parent : a #GtkWidget on which the error dialog should be shown, or a #GdkScreen
* if no #GtkWidget is known. May also be %NULL, in which case the default
* #GdkScreen will be used.
* @file : the #ThunarFile we're going to rename.
*
* Displays the Thunar rename dialog for a single file rename.
......@@ -54,7 +56,7 @@
* %NULL if there was no renaming required.
**/
ThunarJob *
thunar_dialogs_show_rename_file (GtkWindow *parent,
thunar_dialogs_show_rename_file (gpointer parent,
ThunarFile *file)
{
ThunarIconFactory *icon_factory;
......@@ -67,21 +69,26 @@ thunar_dialogs_show_rename_file (GtkWindow *parent,
GtkWidget *label;
GtkWidget *image;
GtkWidget *table;
GtkWindow *window;
GdkPixbuf *icon;
GdkScreen *screen;
glong offset;
gchar *title;
gint response;
_thunar_return_val_if_fail (GTK_IS_WINDOW (parent), FALSE);
_thunar_return_val_if_fail (window == NULL || GDK_IS_SCREEN (parent) || GTK_IS_WINDOW (parent), FALSE);
_thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
/* parse the parent window and screen */
screen = thunar_util_parse_parent (parent, &window);
/* get the filename of the file */
filename = thunar_file_get_display_name (file);
/* create a new dialog window */
title = g_strdup_printf (_("Rename \"%s\""), filename);
dialog = gtk_dialog_new_with_buttons (title,
GTK_WINDOW (parent),
window,
GTK_DIALOG_MODAL
| GTK_DIALOG_NO_SEPARATOR
| GTK_DIALOG_DESTROY_WITH_PARENT,
......@@ -92,6 +99,10 @@ thunar_dialogs_show_rename_file (GtkWindow *parent,
gtk_window_set_default_size (GTK_WINDOW (dialog), 300, -1);
g_free (title);
/* move the dialog to the appropriate screen */
if (G_UNLIKELY (window == NULL && screen != NULL))
gtk_window_set_screen (GTK_WINDOW (dialog), screen);
table = g_object_new (GTK_TYPE_TABLE, "border-width", 6, "column-spacing", 6, "row-spacing", 3, NULL);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table, TRUE, TRUE, 0);
gtk_widget_show (table);
......
......@@ -26,7 +26,7 @@
G_BEGIN_DECLS;
ThunarJob *thunar_dialogs_show_rename_file (GtkWindow *parent,
ThunarJob *thunar_dialogs_show_rename_file (gpointer parent,
ThunarFile *file);
void thunar_dialogs_show_about (GtkWindow *parent,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment