glade-project-window.c 16.4 KB
Newer Older
Jose Maria Celorio's avatar
Jose Maria Celorio committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
 * Copyright (C) 2001 Ximian, Inc.
 *
 * 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 Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
 *
 * Authors:
 *   Chema Celorio <chema@celorio.com>
 */

23 24 25 26
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

Jose Maria Celorio's avatar
Jose Maria Celorio committed
27 28 29 30 31 32 33 34 35 36 37
#include "glade.h"
#include "glade-palette.h"
#include "glade-editor.h"
#include "glade-widget.h"
#include "glade-widget-class.h"
#include "glade-parameter.h"
#include "glade-property.h"
#include "glade-property-class.h"
#include "glade-project.h"
#include "glade-project-view.h"
#include "glade-project-window.h"
Jose Maria Celorio's avatar
Jose Maria Celorio committed
38
#include <gdk/gdkkeysyms.h>
Jose Maria Celorio's avatar
Jose Maria Celorio committed
39 40 41 42 43 44 45 46 47

static void gpw_new_cb (void);
static void gpw_open_cb (void);
static void gpw_save_cb (void);
static void gpw_save_as_cb (void);
static void gpw_quit_cb (void);

static void gpw_show_palette_cb (void);
static void gpw_show_editor_cb (void);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
48
static void gpw_show_widget_tree_cb (void);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
49 50
static void gpw_show_clipboard_cb (void) {};

51 52
static void gpw_undo_cb (void);
static void gpw_redo_cb (void);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
53 54 55 56 57
static void gpw_about_cb (void) {};

static void
gpw_open_cb (void)
{
58
	glade_project_open ();
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
}

static void
gpw_delete_cb (void)
{
	GladeProject *project;
	GList *selection;
	GList *free_me;
	GList *list;

	project = glade_project_window_get_project ();
	if (!project) {
		g_warning ("Why is delete sensitive ? it shouldn't not be because "
			   "we don't have a project");
		return;
	}
	
	selection = glade_project_selection_get (project);

	/* We have to be carefull when deleting widgets from the selection
	 * because when we delete each widget, the ->selection pointer changes
	 * by the g_list_remove. Copy the list and freee it after we are done
	 */
	list = g_list_copy (selection);
	free_me = list;
	for (; list; list = list->next)
		glade_widget_delete (list->data);
	g_list_free (free_me);

	/* Right now deleting widgets like this is not a problem, cause we
	 * don't support multiple selection. When we do, it would be nice
	 * to have glade_project_selction_freeze the remove all the widgets
	 * and then call glade_project_selection_thaw. This will trigger
	 * only one selection changed signal rather than multiple ones
	 * Chema
	 */
Jose Maria Celorio's avatar
Jose Maria Celorio committed
95 96 97 98 99 100 101 102
}

static void
gpw_new_cb (void)
{
	GladeProjectWindow *gpw;
	GladeProject *project;

103
	project = glade_project_new (TRUE);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
104 105 106 107 108 109 110
	gpw = glade_project_window_get ();
	glade_project_window_add_project (gpw, project);
}

static void
gpw_save_cb (void)
{
Chema Celorio's avatar
Chema Celorio committed
111 112 113 114
	GladeProject *project;

	project = glade_project_window_get_project ();
	glade_project_save (project);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
115 116 117 118 119
}

static void
gpw_save_as_cb (void)
{
120
	glade_implement_me ();
Jose Maria Celorio's avatar
Jose Maria Celorio committed
121 122 123 124 125 126 127 128
}

static void
gpw_quit_cb (void)
{
	gtk_main_quit ();
}

129 130 131
static void
gpw_copy_cb (void)
{
132
	glade_implement_me ();
133 134 135 136 137
}

static void
gpw_cut_cb (void)
{
138
	glade_implement_me ();
139 140 141 142 143
}

static void
gpw_paste_cb (void)
{
144
	glade_implement_me ();
145 146
}

147 148 149
static void
gpw_undo_cb (void)
{
150
	glade_implement_me ();
151 152 153 154 155
}

static void
gpw_redo_cb (void)
{
156
	glade_implement_me ();
157 158
}

Jose Maria Celorio's avatar
Jose Maria Celorio committed
159 160 161 162 163 164
static void
gpw_delete_event (GtkWindow *w, gpointer not_used)
{
	gpw_quit_cb ();
}

165

Jose Maria Celorio's avatar
Jose Maria Celorio committed
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
static GtkItemFactoryEntry menu_items[] =
{
  /* ============ FILE ===================== */
  { "/_File",            NULL,         0,              0, "<Branch>" },
  { "/File/_New",        "<control>N", gpw_new_cb,     0, "<StockItem>", GTK_STOCK_NEW },
  { "/File/_Open",       "<control>O", gpw_open_cb,    0, "<StockItem>", GTK_STOCK_OPEN },
  { "/File/_Save",       "<control>S", gpw_save_cb,    0, "<StockItem>", GTK_STOCK_SAVE },
  { "/File/Save _As...", NULL,         gpw_save_as_cb, 0, "<StockItem>", GTK_STOCK_SAVE },
  { "/File/sep1",        NULL,         NULL,           0, "<Separator>" },
  { "/File/_Quit",       "<control>Q", gpw_quit_cb,    0, "<StockItem>", GTK_STOCK_QUIT },

  /* ============ EDIT ===================== */
  { "/Edit",        NULL, 0, 0, "<Branch>" },
  { "/Edit/_Undo",   "<control>Z", gpw_undo_cb,   0, "<StockItem>", GTK_STOCK_UNDO },
  { "/Edit/_Redo",   "<control>R", gpw_redo_cb,   0, "<StockItem>", GTK_STOCK_REDO },
  { "/Edit/sep1",    NULL,         NULL,          0, "<Separator>" },
  { "/Edit/C_ut",    NULL,         gpw_cut_cb,    0, "<StockItem>", GTK_STOCK_CUT },
  { "/Edit/_Copy",   NULL,         gpw_copy_cb,   0, "<StockItem>", GTK_STOCK_COPY },
  { "/Edit/_Paste",  NULL,         gpw_paste_cb,  0, "<StockItem>", GTK_STOCK_PASTE },
  { "/Edit/_Delete", NULL,         gpw_delete_cb, 0, "<StockItem>", GTK_STOCK_DELETE },

  /* ============ VIEW ===================== */
  { "/View", NULL, 0, 0, "<Branch>" },
  { "/View/Show _Palette",         NULL, gpw_show_palette_cb,     0, "<Item>" },
  { "/View/Show Property _Editor", NULL, gpw_show_editor_cb,      0, "<Item>" },
  { "/View/Show _Widget Tree",     NULL, gpw_show_widget_tree_cb, 0, "<Item>" },
  { "/View/Show _Clipboard",       NULL, gpw_show_clipboard_cb,   0, "<Item>" },

  /* ============ PROJECT=================== */
  { "/Project", NULL, 0, 0, "<Branch>" },

  /* ============ HELP ===================== */
  { "/_Help",       NULL, NULL, 0, "<LastBranch>" },
  { "/Help/_About", NULL, gpw_about_cb, 0 },
};

static void
glade_project_window_construct_menu (GladeProjectWindow *gpw)
{
	GtkItemFactory *item_factory;
	GtkAccelGroup *accel_group;

	/* Accelerators */
	accel_group = gtk_accel_group_new ();
210
	gtk_window_add_accel_group (GTK_WINDOW (gpw->window), accel_group);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
      
	/* Item factory */
	item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
	gpw->item_factory = item_factory;
	gtk_object_ref (GTK_OBJECT (item_factory));
	gtk_object_sink (GTK_OBJECT (item_factory));
	g_object_set_data_full (G_OBJECT (gpw->window),
				"<main>",
				item_factory,
				(GDestroyNotify) g_object_unref);
	
	/* create menu items */
	gtk_item_factory_create_items (item_factory, G_N_ELEMENTS (menu_items),
				       menu_items, gpw->window);
	gtk_box_pack_start_defaults (GTK_BOX (gpw->main_vbox),
				     gtk_item_factory_get_widget (item_factory, "<main>"));
}


static void
glade_project_window_construct_toolbar (GladeProjectWindow *gpw)
{
	GtkWidget *toolbar;

	toolbar = gtk_toolbar_new ();

	gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
				  GTK_STOCK_OPEN,
				  "Open project",
				  NULL,
				  G_CALLBACK (gpw_open_cb),
				  gpw, -1);
	gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
				  GTK_STOCK_SAVE,
				  "Save the current project",
				  NULL,
				  G_CALLBACK (gpw_save_cb),
				  gpw, -1);
	gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
	gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
				  GTK_STOCK_QUIT,
				  "Quit glade",
				  NULL,
				  G_CALLBACK (gpw_quit_cb),
				  gpw, -1);

	gtk_widget_show (toolbar);
	
	gtk_box_pack_start_defaults (GTK_BOX (gpw->main_vbox),
				     toolbar);
}
	

static GtkWidget *
glade_project_window_create (GladeProjectWindow *gpw, GladeProjectView *view)
{
	GtkWidget *app;
	GtkWidget *vbox;

	g_return_val_if_fail (GLADE_IS_PROJECT_VIEW (view), NULL);

	app = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gpw->window = app;
	vbox = gtk_vbox_new (FALSE, 0);
	gtk_container_add (GTK_CONTAINER (app), vbox);
	gpw->main_vbox = vbox;

	glade_project_window_construct_menu (gpw);
	glade_project_window_construct_toolbar (gpw);
	
	gtk_signal_connect (GTK_OBJECT (app), "delete_event",
			    GTK_SIGNAL_FUNC (gpw_delete_event), NULL);

	return app;
}

GladeProjectWindow * glade_project_window = NULL;

GladeProjectWindow *
glade_project_window_get ()
{
	return glade_project_window;
}

static void
glade_project_window_set_view (GladeProjectWindow *gpw, GladeProjectView *view)
{
	if (gpw->active_view == view)
		return;
	
	gpw->active_view = view;

	gtk_box_pack_start_defaults (GTK_BOX (gpw->main_vbox),
				     glade_project_view_get_widget (view));

}

GladeProjectWindow *
309
glade_project_window_new (GList *catalog)
Jose Maria Celorio's avatar
Jose Maria Celorio committed
310 311 312 313
{
	GladeProjectWindow *gpw;
	GladeProjectView *view;

Jose Maria Celorio's avatar
Jose Maria Celorio committed
314
	view = glade_project_view_new (GLADE_PROJECT_VIEW_LIST);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
315 316 317 318 319 320 321 322 323
	
	gpw = g_new0 (GladeProjectWindow, 1);
	glade_project_window_create (gpw, view);
	gpw->catalog = catalog;
	gpw->views = g_list_prepend (NULL, view);
	gpw->add_class = NULL;

	glade_project_window_set_view (gpw, view);

324
	glade_project_window = gpw;
Jose Maria Celorio's avatar
Jose Maria Celorio committed
325 326 327 328 329
	glade_palette_create (gpw);
	glade_editor_create  (gpw);
	
	return gpw;
}
Jose Maria Celorio's avatar
Jose Maria Celorio committed
330

Jose Maria Celorio's avatar
Jose Maria Celorio committed
331 332 333 334 335 336 337 338 339 340 341
static gboolean 
gpw_key_press_widget_tree_cb (GtkWidget *widget_tree, GdkEventKey *event,
		gpointer not_used)
{
	if (event->keyval == GDK_Escape) {
		gtk_widget_hide (widget_tree);
		return TRUE;
	}
	return FALSE;
}

Jose Maria Celorio's avatar
Jose Maria Celorio committed
342 343 344 345 346
static gboolean
gpw_delete_widget_tree_cb (GtkWidget *widget_tree, gpointer not_used)
{
	gtk_widget_hide (widget_tree);

Jose Maria Celorio's avatar
Jose Maria Celorio committed
347 348
	/* return true so that the widget tree is not destroyed */
	return TRUE;
Jose Maria Celorio's avatar
Jose Maria Celorio committed
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364
}

static GtkWidget* 
glade_project_window_widget_tree_create (GladeProjectWindow *gpw)
{
	GtkWidget* widget_tree;
	GladeProjectView *view;
	
	widget_tree = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title (GTK_WINDOW (widget_tree), _("Widget Tree"));
	view = glade_project_view_new (GLADE_PROJECT_VIEW_TREE);
	gtk_container_add (GTK_CONTAINER (widget_tree),
			   glade_project_view_get_widget (view));
	gpw->views = g_list_prepend (gpw->views, view);
	glade_project_view_set_project (view, gpw->project);
	gtk_signal_connect (GTK_OBJECT (widget_tree), "delete_event",
Jose Maria Celorio's avatar
Jose Maria Celorio committed
365 366 367
			GTK_SIGNAL_FUNC (gpw_delete_widget_tree_cb), NULL);
	gtk_signal_connect (GTK_OBJECT (widget_tree), "key_press_event",
			GTK_SIGNAL_FUNC (gpw_key_press_widget_tree_cb), NULL);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387

	return widget_tree;
}

static void 
gpw_show_widget_tree (GladeProjectWindow *gpw) 
{
	if (gpw->widget_tree == NULL) 
		gpw->widget_tree = glade_project_window_widget_tree_create (gpw);
	
	gtk_widget_show_all (gpw->widget_tree);
}

static void 
gpw_show_widget_tree_cb (void) 
{
	GladeProjectWindow *gpw = glade_project_window_get ();

	gpw_show_widget_tree (gpw);
}
Jose Maria Celorio's avatar
Jose Maria Celorio committed
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404

static void
gpw_show_palette_cb (void)
{
	GladeProjectWindow *gpw = glade_project_window_get ();

	glade_palette_show (gpw);
}

static void
gpw_show_editor_cb (void)
{
	GladeProjectWindow *gpw = glade_project_window_get ();

	glade_editor_show (gpw);
}

405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
static void
glade_project_window_selection_changed_cb (GladeProject *project,
					   GladeProjectWindow *gpw)
{
	GList *list;
	gint num;

	g_return_if_fail (GLADE_IS_PROJECT (project));
	g_return_if_fail (GLADE_IS_PROJECT_WINDOW (gpw));

	if (gpw->editor) {
		list = project->selection;
		num = g_list_length (list);
		if (num == 1)
			glade_editor_select_widget (gpw->editor, list->data);
		else
			glade_editor_select_widget (gpw->editor, NULL);
	}

}

Jose Maria Celorio's avatar
Jose Maria Celorio committed
426 427 428 429 430 431
void
glade_project_window_set_project (GladeProjectWindow *gpw, GladeProject *project)
{
	GladeProjectView *view;
	GList *list;
	gchar *title;
432 433 434 435 436 437

	if (g_list_find (gpw->projects, project) == NULL) {
		g_warning ("Could not set project because it could not "
			   " be found in the gpw->project list\n");
		return;
	}
Jose Maria Celorio's avatar
Jose Maria Celorio committed
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453
	
	gpw->project = project;
	if (project) {
		title = g_strdup_printf ("glade2 : %s", project->name);
		gtk_window_set_title (GTK_WINDOW (gpw->window), title);
		g_free (title);
	} else {
		gtk_window_set_title (GTK_WINDOW (gpw->window), "glade 2");
	}

	list = gpw->views;
	for (; list != NULL; list = list->next) {
		view = list->data;
		glade_project_view_set_project (view, project);
	}

454 455 456 457
	gpw->project_selection_changed_signal =
		gtk_signal_connect (GTK_OBJECT (project), "selection_changed",
				    GTK_SIGNAL_FUNC (glade_project_window_selection_changed_cb),
				    gpw);
458 459
	
	glade_project_selection_changed (project);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475
}

static void
glade_project_window_set_project_cb (GladeProject *project)
{
	GladeProjectWindow *gpw;

	gpw = glade_project_window_get ();
	glade_project_window_set_project (gpw, project);
}
		
void
glade_project_window_add_project (GladeProjectWindow *gpw, GladeProject *project)
{
	GtkItemFactoryEntry entry;

476 477 478
	g_return_if_fail (GLADE_IS_PROJECT_WINDOW (gpw));
	g_return_if_fail (GLADE_IS_PROJECT (project));
	
Jose Maria Celorio's avatar
Jose Maria Celorio committed
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501
	gpw->projects = g_list_prepend (gpw->projects, project);
	
	entry.path = g_strdup_printf ("/Project/%s", project->name);
	entry.accelerator = NULL;
	entry.callback = glade_project_window_set_project_cb;
	entry.callback_action = 0;
	entry.item_type = g_strdup ("<Item>");
	
	gtk_item_factory_create_item (gpw->item_factory,
				      &entry,
				      project,
				      1);

	g_free (entry.path);
	g_free (entry.item_type);

	glade_project_window_set_project (gpw, project);
}

void
glade_project_window_set_add_class (GladeProjectWindow *gpw, GladeWidgetClass *class)
{
	gpw->add_class = class;
502 503 504 505

	if (!class && gpw->palette)
		glade_palette_clear (gpw);
	
Jose Maria Celorio's avatar
Jose Maria Celorio committed
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532
}

static GtkWidget *
glade_project_append_query (GtkWidget *table, GladePropertyClass *property_class, gint row)
{
	GladePropertyQuery *query;
	GtkAdjustment *adjustment;
	GtkWidget *label;
	GtkWidget *spin;
	gchar *text;

	query = property_class->query;
	
	if (property_class->type != GLADE_PROPERTY_TYPE_INTEGER) {
		g_warning ("We can only query integer types for now. FIXME please ;-)");
		return NULL;
	}
	
	/* Label */
	text = g_strdup_printf ("%s :", query->question);
	label = gtk_label_new (text);
	g_free (text);
	gtk_widget_show (label);
	gtk_table_attach_defaults (GTK_TABLE (table), label,
				   0, 1, row, row +1);

	/* Spin/Entry */
533
	adjustment = glade_parameter_adjustment_new (property_class->parameters, property_class->def);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561
	spin = gtk_spin_button_new (adjustment, 1, 0);
	gtk_widget_show (spin);
	gtk_table_attach_defaults (GTK_TABLE (table), spin,
				   1, 2, row, row +1);

	return spin;
}

void
glade_project_window_query_properties_set (gpointer key_,
					   gpointer value_,
					   gpointer user_data)
{
	GladePropertyQueryResult *result = user_data;
	GtkWidget *spin = value_;
	const gchar *key = key_;
	gint num;

	num = (gint) gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin));
	glade_property_query_result_set_int (result, key, num);
}

/**
 * glade_project_window_query_properties:
 * @class: 
 * @result: 
 * 
 * Queries the user for some property values before a GladeWidget creation
562 563
 * for example before creating a GtkVBox we want to ask the user the number
 * of columns he wants.
Jose Maria Celorio's avatar
Jose Maria Celorio committed
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
 * 
 * Return Value: FALSE if the query was canceled
 **/
gboolean 
glade_project_window_query_properties (GladeWidgetClass *class,
				       GladePropertyQueryResult *result)
{
	GladePropertyClass *property_class;
	GHashTable *hash;
	GtkWidget *dialog;
	GtkWidget *table;
	GtkWidget *vbox;
	GtkWidget *spin = NULL;
	GList *list;
	gint response;
	gint row = 0;

	g_return_val_if_fail (class  != NULL, FALSE);
	g_return_val_if_fail (result != NULL, FALSE);

	dialog = gtk_dialog_new_with_buttons (NULL /* name */,
					      NULL /* parent, FIXME: parent should be the project window */,
					      GTK_DIALOG_MODAL,
					      GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
					      GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
					      NULL);
590
	gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);	
591
	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);	
Jose Maria Celorio's avatar
Jose Maria Celorio committed
592 593 594 595 596 597 598 599 600 601 602 603 604

	vbox = GTK_DIALOG (dialog)->vbox;
	table = gtk_table_new (0, 0, FALSE);
	gtk_widget_show (table);
	gtk_box_pack_start_defaults (GTK_BOX (vbox), table);
	
	hash = g_hash_table_new (g_str_hash, g_str_equal);

	list = class->properties;
	for (; list != NULL; list = list->next) {
		property_class = list->data;
		if (property_class->query) {
			spin = glade_project_append_query (table, property_class, row++);
605
			g_hash_table_insert (hash, property_class->id, spin);
Jose Maria Celorio's avatar
Jose Maria Celorio committed
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629
		}
	}
	if (spin == NULL)
		return TRUE;

	response = gtk_dialog_run (GTK_DIALOG (dialog));
	switch (response) {
	case GTK_RESPONSE_ACCEPT:
		g_hash_table_foreach (hash,
				      glade_project_window_query_properties_set,
				      result);
		break;
	case GTK_RESPONSE_REJECT:
		gtk_widget_destroy (dialog);
		return TRUE;
	default:
		g_warning ("Dunno what to do, unexpected GtkResponse");
	}

	g_hash_table_destroy (hash);
	gtk_widget_destroy (dialog);
	
	return FALSE;
}
630 631


Chema Celorio's avatar
Chema Celorio committed
632 633 634 635 636 637 638 639 640 641
GladeProject *
glade_project_window_get_project (void)
{
	GladeProjectWindow *gpw;

	gpw = glade_project_window_get ();
	g_return_val_if_fail (GLADE_IS_PROJECT_WINDOW (gpw), NULL);

	return gpw->project;
}
642 643 644 645 646 647 648 649 650 651



void
glade_project_window_show_all (GladeProjectWindow *gpw)
{
	gtk_widget_show_all (gpw->window);
	glade_palette_show (gpw);
	glade_editor_show (gpw);
}