1
/* GIMP - The GNU Image Manipulation Program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
#include "libgimpwidgets/gimpwidgets.h"
27
#include "actions-types.h"
29
#include "widgets/gimpmessagebox.h"
30
#include "widgets/gimpmessagedialog.h"
33
#include "window-commands.h"
36
/* public functions */
39
window_close_cmd_callback (GtkAction *action,
43
return_if_no_widget (widget, data);
45
if (! GTK_WIDGET_TOPLEVEL (widget))
46
widget = gtk_widget_get_toplevel (widget);
48
if (widget && widget->window)
50
GdkEvent *event = gdk_event_new (GDK_DELETE);
52
event->any.window = g_object_ref (widget->window);
53
event->any.send_event = TRUE;
55
gtk_main_do_event (event);
56
gdk_event_free (event);
61
window_open_display_cmd_callback (GtkAction *action,
67
return_if_no_widget (widget, data);
69
dialog = gimp_message_dialog_new ("Open Display", GIMP_STOCK_WILBER_EEK,
70
widget, GTK_DIALOG_MODAL,
73
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
74
GTK_STOCK_OK, GTK_RESPONSE_OK,
78
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
80
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
81
"Experimental multi-display stuff!\n"
82
"Click OK and have fun crashing GIMP...");
84
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
85
"Please enter the name of the new display:");
87
entry = gtk_entry_new ();
88
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
89
gtk_container_add (GTK_CONTAINER (GIMP_MESSAGE_DIALOG (dialog)->box), entry);
91
gtk_widget_grab_focus (entry);
92
gtk_widget_show_all (dialog);
94
while (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
98
screen_name = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
100
if (strcmp (screen_name, ""))
104
gtk_widget_set_sensitive (dialog, FALSE);
106
display = gdk_display_open (screen_name);
109
gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
110
"Can't open display '%s'. "
111
"Please try another one:",
114
g_free (screen_name);
116
gtk_widget_set_sensitive (dialog, TRUE);
122
gtk_widget_grab_focus (entry);
125
gtk_widget_destroy (dialog);
129
window_move_to_screen_cmd_callback (GtkAction *action,
135
return_if_no_widget (widget, data);
137
if (! GTK_WIDGET_TOPLEVEL (widget))
138
widget = gtk_widget_get_toplevel (widget);
140
screen = g_object_get_data (G_OBJECT (current), "screen");
142
if (GDK_IS_SCREEN (screen) && screen != gtk_widget_get_screen (widget))
144
gtk_window_set_screen (GTK_WINDOW (widget), screen);