PageRenderTime 23ms CodeModel.GetById 15ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gtk/examples/gtk-demo/changedisplay.e

http://github.com/tybor/Liberty
Specman e | 654 lines | 21 code | 110 blank | 523 comment | 2 complexity | b5937243dd9471b3d2c19a1b0d16d57c MD5 | raw file
  1indexing
  2	description: "."
  3	copyright: "[
  4					Copyright (C) 2006 Paolo Redaelli, GTK+ team
  5					
  6					This library is free software; you can redistribute it and/or
  7					modify it under the terms of the GNU Lesser General Public License
  8					as published by the Free Software Foundation; either version 2.1 of
  9					the License, or (at your option) any later version.
 10					
 11					This library is distributed in the hope that it will be useful, but
 12					WITHOUT ANY WARRANTY; without even the implied warranty of
 13					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14					Lesser General Public License for more details.
 15
 16					You should have received a copy of the GNU Lesser General Public
 17					License along with this library; if not, write to the Free Software
 18					Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 19					02110-1301 USA
 20			]"
 21
 22class CHANGEDISPLAY
 23
 24creation make
 25
 26feature
 27-- /* Change Display
 28--  * 
 29--  * Demonstrates migrating a window between different displays and
 30--  * screens. A display is a mouse and keyboard with some number of
 31--  * associated monitors. A screen is a set of monitors grouped
 32--  * into a single physical work area. The neat thing about having
 33--  * multiple displays is that they can be on a completely separate
 34--  * computers, as long as there is a network connection to the
 35--  * computer where the application is running.
 36--  *
 37--  * Only some of the windowing systems where GTK+ runs have the
 38--  * concept of multiple displays and screens. (The X Window System
 39--  * is the main example.) Other windowing systems can only
 40--  * handle one keyboard and mouse, and combine all monitors into
 41--  * a single screen.
 42--  *
 43--  * This is a moderately complex example, and demonstrates:
 44--  *
 45--  *  - Tracking the currently open displays and screens
 46--  *
 47--  *  - Changing the screen for a window
 48--  *
 49--  *  - Letting the user choose a window by clicking on it
 50--  * 
 51--  *  - Using GtkListStore and GtkTreeView
 52--  *
 53--  *  - Using GtkDialog
 54--  */
 55-- #include <string.h>
 56-- #include <gtk/gtk.h>
 57-- #include "demo-common.h"
 58
 59-- /* The ChangeDisplayInfo structure corresponds to a toplevel window and
 60--  * holds pointers to widgets inside the toplevel window along with other
 61--  * information about the contents of the window.
 62--  * This is a common organizational structure in real applications.
 63--  */
 64-- typedef struct _ChangeDisplayInfo ChangeDisplayInfo;
 65
 66-- struct _ChangeDisplayInfo
 67-- {
 68--   GtkWidget *window;
 69--   GtkSizeGroup *size_group;
 70
 71--   GtkTreeModel *display_model;
 72--   GtkTreeModel *screen_model;
 73--   GtkTreeSelection *screen_selection;
 74  
 75--   GdkDisplay *current_display;
 76--   GdkScreen *current_screen;
 77-- };
 78
 79-- /* These enumerations provide symbolic names for the columns
 80--  * in the two GtkListStore models.
 81--  */
 82-- enum
 83-- {
 84--   DISPLAY_COLUMN_NAME,
 85--   DISPLAY_COLUMN_DISPLAY,
 86--   DISPLAY_NUM_COLUMNS
 87-- };
 88
 89-- enum
 90-- {
 91--   SCREEN_COLUMN_NUMBER,
 92--   SCREEN_COLUMN_SCREEN,
 93--   SCREEN_NUM_COLUMNS
 94-- };
 95
 96-- /* Finds the toplevel window under the mouse pointer, if any.
 97--  */
 98-- static GtkWidget *
 99-- find_toplevel_at_pointer (GdkDisplay *display)
100-- {
101--   GdkWindow *pointer_window;
102--   GtkWidget *widget = NULL;
103
104--   pointer_window = gdk_display_get_window_at_pointer (display, NULL, NULL);
105
106--   /* The user data field of a GdkWindow is used to store a pointer
107--    * to the widget that created it.
108--    */
109--   if (pointer_window)
110--     gdk_window_get_user_data (pointer_window, (gpointer*) &widget);
111
112--   return widget ? gtk_widget_get_toplevel (widget) : NULL;
113-- }
114
115-- static gboolean
116-- button_release_event_cb (GtkWidget       *widget,
117-- 			 GdkEventButton  *event,
118-- 			 gboolean        *clicked)
119-- {
120--   *clicked = TRUE;
121--   return TRUE;
122-- }
123
124-- /* Asks the user to click on a window, then waits for them click
125--  * the mouse. When the mouse is released, returns the toplevel
126--  * window under the pointer, or NULL, if there is none.
127--  */
128-- static GtkWidget *
129-- query_for_toplevel (GdkScreen  *screen,
130-- 		    const char *prompt)
131-- {
132--   GdkDisplay *display = gdk_screen_get_display (screen);
133--   GtkWidget *popup, *label, *frame;
134--   GdkCursor *cursor;
135--   GtkWidget *toplevel = NULL;
136  
137--   popup = gtk_window_new (GTK_WINDOW_POPUP);
138--   gtk_window_set_screen (GTK_WINDOW (popup), screen);
139--   gtk_window_set_modal (GTK_WINDOW (popup), TRUE);
140--   gtk_window_set_position (GTK_WINDOW (popup), GTK_WIN_POS_CENTER);
141  
142--   frame = gtk_frame_new (NULL);
143--   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
144--   gtk_container_add (GTK_CONTAINER (popup), frame);
145  
146--   label = gtk_label_new (prompt);
147--   gtk_misc_set_padding (GTK_MISC (label), 10, 10);
148--   gtk_container_add (GTK_CONTAINER (frame), label);
149  
150--   gtk_widget_show_all (popup);
151--   cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR);
152  
153--   if (gdk_pointer_grab (popup->window, FALSE,
154-- 			GDK_BUTTON_RELEASE_MASK,
155-- 			NULL,
156-- 			cursor,
157-- 			GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)
158--     {
159--       gboolean clicked = FALSE;
160		
161--       g_signal_connect (popup, "button-release-event",
162-- 			G_CALLBACK (button_release_event_cb), &clicked);
163		
164--       /* Process events until clicked is set by button_release_event_cb.
165--        * We pass in may_block=TRUE since we want to wait if there
166--        * are no events currently.
167--        */
168--       while (!clicked)
169-- 	g_main_context_iteration (NULL, TRUE);
170		
171--       toplevel = find_toplevel_at_pointer (gdk_screen_get_display (screen));
172--       if (toplevel == popup)
173-- 	toplevel = NULL;
174--     }
175		
176--   gdk_cursor_unref (cursor);
177--   gtk_widget_destroy (popup);
178--   gdk_flush ();			/* Really release the grab */
179  
180--   return toplevel;
181-- }
182
183-- /* Prompts the user for a toplevel window to move, and then moves
184--  * that window to the currently selected display
185--  */
186-- static void
187-- query_change_display (ChangeDisplayInfo *info)
188-- {
189--   GdkScreen *screen = gtk_widget_get_screen (info->window);
190--   GtkWidget *toplevel;
191
192--   toplevel = query_for_toplevel (screen,
193-- 				 "Please select the toplevel\n"
194-- 				 "to move to the new screen");
195
196--   if (toplevel)
197--     gtk_window_set_screen (GTK_WINDOW (toplevel), info->current_screen);
198--   else
199--     gdk_display_beep (gdk_screen_get_display (screen));
200-- }
201
202-- /* Fills in the screen list based on the current display
203--  */
204-- static void
205-- fill_screens (ChangeDisplayInfo *info)
206-- {
207--   gtk_list_store_clear (GTK_LIST_STORE (info->screen_model));
208
209--   if (info->current_display)
210--     {
211--       gint n_screens = gdk_display_get_n_screens (info->current_display);
212--       gint i;
213		
214--       for (i = 0; i < n_screens; i++)
215-- 	{
216-- 	  GdkScreen *screen = gdk_display_get_screen (info->current_display, i);
217-- 	  GtkTreeIter iter;
218	
219-- 	  gtk_list_store_append (GTK_LIST_STORE (info->screen_model), &iter);
220-- 	  gtk_list_store_set (GTK_LIST_STORE (info->screen_model), &iter,
221-- 			      SCREEN_COLUMN_NUMBER, i,
222-- 			      SCREEN_COLUMN_SCREEN, screen,
223-- 			      -1);
224
225-- 	  if (i == 0)
226-- 	    gtk_tree_selection_select_iter (info->screen_selection, &iter);
227-- 	}
228--     }
229-- }
230
231-- /* Called when the user clicks on a button in our dialog or
232--  * closes the dialog through the window manager. Unless the
233--  * "Change" button was clicked, we destroy the dialog.
234--  */
235-- static void
236-- response_cb (GtkDialog         *dialog,
237-- 	     gint               response_id,
238-- 	     ChangeDisplayInfo *info)
239-- {
240--   if (response_id == GTK_RESPONSE_OK)
241--     query_change_display (info);
242--   else
243--     gtk_widget_destroy (GTK_WIDGET (dialog));
244-- }
245
246-- /* Called when the user clicks on "Open..." in the display
247--  * frame. Prompts for a new display, and then opens a connection
248--  * to that display.
249--  */
250-- static void
251-- open_display_cb (GtkWidget         *button,
252-- 		 ChangeDisplayInfo *info)
253-- {
254--   GtkWidget *dialog;
255--   GtkWidget *display_entry;
256--   GtkWidget *dialog_label;
257--   gchar *new_screen_name = NULL;
258--   GdkDisplay *result = NULL;
259  
260--   dialog = gtk_dialog_new_with_buttons ("Open Display",
261-- 					GTK_WINDOW (info->window),
262-- 					GTK_DIALOG_MODAL,
263-- 					GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
264-- 					GTK_STOCK_OK, GTK_RESPONSE_OK,
265-- 					NULL);
266
267--   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
268--   display_entry = gtk_entry_new ();
269--   gtk_entry_set_activates_default (GTK_ENTRY (display_entry), TRUE);
270--   dialog_label =
271--     gtk_label_new ("Please enter the name of\nthe new display\n");
272
273--   gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog_label);
274--   gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), display_entry);
275
276--   gtk_widget_grab_focus (display_entry);
277--   gtk_widget_show_all (GTK_BIN (dialog)->child);
278  
279--   while (!result)
280--     {
281--       gint response_id = gtk_dialog_run (GTK_DIALOG (dialog));
282--       if (response_id != GTK_RESPONSE_OK)
283-- 	break;
284		
285--       new_screen_name = gtk_editable_get_chars (GTK_EDITABLE (display_entry),
286-- 						0, -1);
287
288--       if (strcmp (new_screen_name, "") != 0)
289-- 	{
290-- 	  result = gdk_display_open (new_screen_name);
291-- 	  if (!result)
292-- 	    {
293-- 	      gchar *error_msg =
294-- 		g_strdup_printf  ("Can't open display :\n\t%s\nplease try another one\n",
295-- 				  new_screen_name);
296-- 	      gtk_label_set_text (GTK_LABEL (dialog_label), error_msg);
297-- 	      g_free (error_msg);
298-- 	    }
299
300-- 	  g_free (new_screen_name);
301-- 	}
302--     }
303  
304--   gtk_widget_destroy (dialog);
305-- }
306
307-- /* Called when the user clicks on the "Close" button in the
308--  * "Display" frame. Closes the selected display.
309--  */
310-- static void
311-- close_display_cb (GtkWidget         *button,
312-- 		  ChangeDisplayInfo *info)
313-- {
314--   if (info->current_display)
315--     gdk_display_close (info->current_display);
316-- }
317
318-- /* Called when the selected row in the display list changes.
319--  * Updates info->current_display, then refills the list of
320--  * screens.
321--  */
322-- static void
323-- display_changed_cb (GtkTreeSelection  *selection,
324-- 		    ChangeDisplayInfo *info)
325-- {
326--   GtkTreeModel *model;
327--   GtkTreeIter iter;
328
329--   if (gtk_tree_selection_get_selected (selection, &model, &iter))
330--     gtk_tree_model_get (model, &iter,
331-- 			DISPLAY_COLUMN_DISPLAY, &info->current_display,
332-- 			-1);
333--   else
334--     info->current_display = NULL;
335
336--   fill_screens (info);
337-- }
338
339-- /* Called when the selected row in the sceen list changes.
340--  * Updates info->current_screen.
341--  */
342-- static void
343-- screen_changed_cb (GtkTreeSelection  *selection,
344-- 		   ChangeDisplayInfo *info)
345-- {
346--   GtkTreeModel *model;
347--   GtkTreeIter iter;
348
349--   if (gtk_tree_selection_get_selected (selection, &model, &iter))
350--     gtk_tree_model_get (model, &iter,
351-- 			SCREEN_COLUMN_SCREEN, &info->current_screen,
352-- 			-1);
353--   else
354--     info->current_screen = NULL;
355-- }
356
357-- /* This function is used both for creating the "Display" and
358--  * "Screen" frames, since they have a similar structure. The
359--  * caller hooks up the right context for the value returned
360--  * in tree_view, and packs any relevant buttons into button_vbox.
361--  */
362-- static void
363-- create_frame (ChangeDisplayInfo *info,
364-- 	      const char        *title,
365-- 	      GtkWidget        **frame,
366-- 	      GtkWidget        **tree_view,
367-- 	      GtkWidget        **button_vbox)
368-- {
369--   GtkTreeSelection *selection;
370--   GtkWidget *scrollwin;
371--   GtkWidget *hbox;
372  
373--   *frame = gtk_frame_new (title);
374
375--   hbox = gtk_hbox_new (FALSE, 8);
376--   gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
377--   gtk_container_add (GTK_CONTAINER (*frame), hbox);
378
379--   scrollwin = gtk_scrolled_window_new (NULL, NULL);
380--   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin),
381-- 				  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
382--   gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrollwin),
383-- 				       GTK_SHADOW_IN);
384--   gtk_box_pack_start (GTK_BOX (hbox), scrollwin, TRUE, TRUE, 0);
385
386--   *tree_view = gtk_tree_view_new ();
387--   gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (*tree_view), FALSE);
388--   gtk_container_add (GTK_CONTAINER (scrollwin), *tree_view);
389
390--   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (*tree_view));
391--   gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
392
393--   *button_vbox = gtk_vbox_new (FALSE, 5);
394--   gtk_box_pack_start (GTK_BOX (hbox), *button_vbox, FALSE, FALSE, 0);
395
396--   if (!info->size_group)
397--     info->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
398  
399--   gtk_size_group_add_widget (GTK_SIZE_GROUP (info->size_group), *button_vbox);
400-- }
401
402-- /* If we have a stack of buttons, it often looks better if their contents
403--  * are left-aligned, rather than centered. This function creates a button
404--  * and left-aligns it contents.
405--  */
406-- GtkWidget *
407-- left_align_button_new (const char *label)
408-- {
409--   GtkWidget *button = gtk_button_new_with_mnemonic (label);
410--   GtkWidget *child = gtk_bin_get_child (GTK_BIN (button));
411
412--   gtk_misc_set_alignment (GTK_MISC (child), 0., 0.5);
413
414--   return button;
415-- }
416
417-- /* Creates the "Display" frame in the main window.
418--  */
419-- GtkWidget *
420-- create_display_frame (ChangeDisplayInfo *info)
421-- {
422--   GtkWidget *frame;
423--   GtkWidget *tree_view;
424--   GtkWidget *button_vbox;
425--   GtkTreeViewColumn *column;
426--   GtkTreeSelection *selection;
427--   GtkWidget *button;
428
429--   create_frame (info, "Display", &frame, &tree_view, &button_vbox);
430
431--   button = left_align_button_new ("_Open...");
432--   g_signal_connect (button, "clicked",  G_CALLBACK (open_display_cb), info);
433--   gtk_box_pack_start (GTK_BOX (button_vbox), button, FALSE, FALSE, 0);
434  
435--   button = left_align_button_new ("_Close");
436--   g_signal_connect (button, "clicked",  G_CALLBACK (close_display_cb), info);
437--   gtk_box_pack_start (GTK_BOX (button_vbox), button, FALSE, FALSE, 0);
438
439--   info->display_model = (GtkTreeModel *)gtk_list_store_new (DISPLAY_NUM_COLUMNS,
440-- 							    G_TYPE_STRING,
441-- 							    GDK_TYPE_DISPLAY);
442
443--   gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), info->display_model);
444
445--   column = gtk_tree_view_column_new_with_attributes ("Name",
446-- 						     gtk_cell_renderer_text_new (),
447-- 						     "text", DISPLAY_COLUMN_NAME,
448-- 						     NULL);
449--   gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
450
451--   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
452--   g_signal_connect (selection, "changed",
453-- 		    G_CALLBACK (display_changed_cb), info);
454
455--   return frame;
456-- }
457
458-- /* Creates the "Screen" frame in the main window.
459--  */
460-- GtkWidget *
461-- create_screen_frame (ChangeDisplayInfo *info)
462-- {
463--   GtkWidget *frame;
464--   GtkWidget *tree_view;
465--   GtkWidget *button_vbox;
466--   GtkTreeViewColumn *column;
467
468--   create_frame (info, "Screen", &frame, &tree_view, &button_vbox);
469
470--   info->screen_model = (GtkTreeModel *)gtk_list_store_new (SCREEN_NUM_COLUMNS,
471-- 							   G_TYPE_INT,
472-- 							   GDK_TYPE_SCREEN);
473
474--   gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), info->screen_model);
475
476--   column = gtk_tree_view_column_new_with_attributes ("Number",
477-- 						     gtk_cell_renderer_text_new (),
478-- 						     "text", SCREEN_COLUMN_NUMBER,
479-- 						     NULL);
480--   gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
481
482--   info->screen_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
483--   g_signal_connect (info->screen_selection, "changed",
484-- 		    G_CALLBACK (screen_changed_cb), info);
485
486--   return frame;
487-- }
488
489-- /* Called when one of the currently open displays is closed.
490--  * Remove it from our list of displays.
491--  */
492-- static void
493-- display_closed_cb (GdkDisplay        *display,
494-- 		   gboolean           is_error,
495-- 		   ChangeDisplayInfo *info)
496-- {
497--   GtkTreeIter iter;
498--   gboolean valid;
499
500--   for (valid = gtk_tree_model_get_iter_first (info->display_model, &iter);
501--        valid;
502--        valid = gtk_tree_model_iter_next (info->display_model, &iter))
503--     {
504--       GdkDisplay *tmp_display;
505		
506--       gtk_tree_model_get (info->display_model, &iter,
507-- 			  DISPLAY_COLUMN_DISPLAY, &tmp_display,
508-- 			  -1);
509--       if (tmp_display == display)
510-- 	{
511-- 	  gtk_list_store_remove (GTK_LIST_STORE (info->display_model), &iter);
512-- 	  break;
513-- 	}
514--     }
515-- }
516
517-- /* Adds a new display to our list of displays, and connects
518--  * to the "closed" signal so that we can remove it from the
519--  * list of displays again.
520--  */
521-- static void
522-- add_display (ChangeDisplayInfo *info,
523-- 	     GdkDisplay        *display)
524-- {
525--   const gchar *name = gdk_display_get_name (display);
526--   GtkTreeIter iter;
527  
528--   gtk_list_store_append (GTK_LIST_STORE (info->display_model), &iter);
529--   gtk_list_store_set (GTK_LIST_STORE (info->display_model), &iter,
530-- 		      DISPLAY_COLUMN_NAME, name,
531-- 		      DISPLAY_COLUMN_DISPLAY, display,
532-- 		      -1);
533
534--   g_signal_connect (display, "closed",
535-- 		    G_CALLBACK (display_closed_cb), info); 
536-- }
537
538-- /* Called when a new display is opened
539--  */
540-- static void
541-- display_opened_cb (GdkDisplayManager *manager,
542-- 		   GdkDisplay        *display,
543-- 		   ChangeDisplayInfo *info)
544-- {
545--   add_display (info, display);
546-- }
547
548-- /* Adds all currently open displays to our list of displays,
549--  * and set up a signal connection so that we'll be notified
550--  * when displays are opened in the future as well.
551--  */
552-- static void
553-- initialize_displays (ChangeDisplayInfo *info)
554-- {
555--   GdkDisplayManager *manager = gdk_display_manager_get ();
556--   GSList *displays = gdk_display_manager_list_displays (manager);
557--   GSList *tmp_list;
558
559--   for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
560--     add_display (info, tmp_list->data);
561
562--   g_slist_free (tmp_list);
563
564--   g_signal_connect (manager, "display_opened",
565-- 		    G_CALLBACK (display_opened_cb), info);
566-- }
567
568-- /* Cleans up when the toplevel is destroyed; we remove the
569--  * connections we use to track currently open displays, then
570--  * free the ChangeDisplayInfo structure.
571--  */
572-- static void
573-- destroy_info (ChangeDisplayInfo *info)
574-- {
575--   GdkDisplayManager *manager = gdk_display_manager_get ();
576--   GSList *displays = gdk_display_manager_list_displays (manager);
577--   GSList *tmp_list;
578
579--   g_signal_handlers_disconnect_by_func (manager,
580-- 					display_opened_cb,
581-- 					info);
582
583--   for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
584--     g_signal_handlers_disconnect_by_func (tmp_list->data,
585-- 					  display_closed_cb,
586-- 					  info);
587  
588--   g_slist_free (tmp_list);
589
590--   g_object_unref (info->size_group);
591--   g_free (info);
592-- }
593
594-- static void
595-- destroy_cb (GtkObject          *object,
596-- 	    ChangeDisplayInfo **info)
597-- {
598--   destroy_info (*info);
599--   *info = NULL;
600-- }
601
602-- /* Main entry point. If the dialog for this demo doesn't yet exist, creates
603--  * it. Otherwise, destroys it.
604--  */
605-- GtkWidget *
606-- do_changedisplay (GtkWidget *do_widget)
607-- {
608--   static ChangeDisplayInfo *info = NULL;
609
610--   if (!info)
611--     {
612--       GtkWidget *vbox;
613--       GtkWidget *frame;
614
615--       info = g_new0 (ChangeDisplayInfo, 1);
616
617--       info->window = gtk_dialog_new_with_buttons ("Change Screen or display",
618-- 					    GTK_WINDOW (do_widget), 
619-- 					    GTK_DIALOG_NO_SEPARATOR,
620-- 					    GTK_STOCK_CLOSE,  GTK_RESPONSE_CLOSE,
621-- 					    "Change",         GTK_RESPONSE_OK,
622-- 					    NULL);
623
624--       gtk_window_set_default_size (GTK_WINDOW (info->window), 300, 400);
625
626--       g_signal_connect (info->window, "response",
627-- 			G_CALLBACK (response_cb), info);
628--       g_signal_connect (info->window, "destroy",
629-- 			G_CALLBACK (destroy_cb), &info);
630
631--       vbox = gtk_vbox_new (FALSE, 5);
632--       gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
633	
634--       gtk_box_pack_start (GTK_BOX (GTK_DIALOG (info->window)->vbox), vbox,
635-- 			  TRUE, TRUE, 0);
636
637--       frame = create_display_frame (info);
638--       gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
639		
640--       frame = create_screen_frame (info);
641--       gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
642
643--       initialize_displays (info);
644
645--       gtk_widget_show_all (info->window);
646--       return info->window;
647--     }
648--   else
649--     {
650--       gtk_widget_destroy (info->window);
651--       return NULL;
652--     }
653-- }
654end