summaryrefslogtreecommitdiff
path: root/components/services/install-view/nautilus-service-install-view.c
blob: b8a5f2491b465385828d64ab5465faf222828cb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
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
210
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
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
533
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
562
563
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
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */

/* 
 * Copyright (C) 2000 Eazel, 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.
 *
 * Author: J Shane Culpepper <pepper@eazel.com>
 */

#include <config.h>

#include "nautilus-service-install-view.h"
#include "nautilus-service-install.h"
#include <libeazelinstall.h>

#include <rpm/rpmlib.h>
#include <gnome-xml/tree.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libnautilus-extensions/nautilus-background.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-font-factory.h>
#include <libnautilus-extensions/nautilus-image.h>
#include <libnautilus-extensions/nautilus-gdk-extensions.h>
#include <stdio.h>
#include <fcntl.h>
#include <dirent.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>

#define SERVICE_VIEW_DEFAULT_BACKGROUND_COLOR	"rgb:FFFF/FFFF/FFFF"
#define SERVICE_DOMAIN_NAME			"testmachine.eazel.com"
#define NEXT_VIEW				"http://eazel1.eazel.com/services/control2.html"

static void       nautilus_service_install_view_initialize_class (NautilusServiceInstallViewClass *klass);
static void       nautilus_service_install_view_initialize       (NautilusServiceInstallView      *view);
static void       nautilus_service_install_view_destroy          (GtkObject                       *object);
static void       service_install_load_location_callback         (NautilusView                    *nautilus_view,
								  const char                      *location,
								  NautilusServiceInstallView      *view);
static void       generate_install_form                          (NautilusServiceInstallView      *view);
static void       fake_overall_install_progress                  (NautilusServiceInstallView      *view);
static void       generate_current_progress                      (NautilusServiceInstallView      *view,
								  char                            *progress_message);
static void       nautilus_service_install_view_update_from_uri  (NautilusServiceInstallView      *view,
								  const char                      *uri);
static void       show_overall_feedback                          (NautilusServiceInstallView      *view,
								  char                            *progress_message);
static GtkWidget* create_title_widget                            (const char                      *title_text);
static GtkWidget* create_middle_title_widget                     (const char                      *left_text,
								  const char                      *right_text);
static GtkWidget* create_image_widget                            (const char                      *icon_name,
								  const char                      *background_color_spec,
								  NautilusImagePlacementType       placement);
static void       go_to_uri                                      (NautilusServiceInstallView      *view,
								  char                            *uri);

NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusServiceInstallView, nautilus_service_install_view, GTK_TYPE_EVENT_BOX)

static void
generate_install_form (NautilusServiceInstallView	*view) 
{
	GdkFont		*font;
	GtkWidget	*temp_box;
	GtkWidget	*title;
	GtkWidget	*middle_title;

	/* allocate the parent box to hold everything */
	view->details->form = gtk_vbox_new (FALSE, 0);
	gtk_container_add (GTK_CONTAINER (view), view->details->form);
	gtk_widget_show (view->details->form);

	/* Setup the title */
	title = create_title_widget ("Easy Install");
        gtk_box_pack_start (GTK_BOX (view->details->form), title, FALSE, FALSE, 0);
        gtk_widget_show (title);

	/* Add package information */

	/* Package Name */
	view->details->package_name = gtk_label_new (_("Installing \"The Gimp\""));
	gtk_misc_set_alignment (GTK_MISC (view->details->package_name), 0.1, 0.1);
	gtk_box_pack_start (GTK_BOX (view->details->form), view->details->package_name, FALSE, FALSE, 2);
	font = nautilus_font_factory_get_font_from_preferences (20);
	nautilus_gtk_widget_set_font (view->details->package_name, font);
	gtk_widget_show (view->details->package_name);
	gdk_font_unref (font);

	/* Package Description */
	view->details->package_details = gtk_label_new ("Description: The GIMP is the GNU Image Manipulation Program.  It is a freely distributed piece of software suitable for such tasks as photo retouching, image composition, and image authoring.");
	gtk_misc_set_alignment (GTK_MISC (view->details->package_details), 0.25, 0.6);
	gtk_label_set_line_wrap (GTK_LABEL (view->details->package_details), TRUE);
	gtk_box_pack_start (GTK_BOX (view->details->form), view->details->package_details, FALSE, FALSE, 0);
	font = nautilus_font_factory_get_font_from_preferences (12);
	nautilus_gtk_widget_set_font (view->details->package_details, font);
	gtk_widget_show (view->details->package_details);
	gdk_font_unref (font);

	/* Package Version */
	view->details->package_version = gtk_label_new ("Version 1.0.4-1");
	gtk_misc_set_alignment (GTK_MISC (view->details->package_version), 0.1, 0.1);
	gtk_box_pack_start (GTK_BOX (view->details->form), view->details->package_version, FALSE, FALSE, 2);
	font = nautilus_font_factory_get_font_from_preferences (13);
	nautilus_gtk_widget_set_font (view->details->package_version, font);
	gtk_widget_show (view->details->package_version);
	gdk_font_unref (font);

	/* generate the overall progress bar */
	temp_box = gtk_alignment_new (0.1, 0.1, 0, 0);
	gtk_box_pack_start (GTK_BOX (view->details->form), temp_box, FALSE, FALSE, 4);
	gtk_widget_show (temp_box);
	view->details->total_progress_bar = gtk_progress_bar_new ();
	gtk_container_add (GTK_CONTAINER (temp_box), view->details->total_progress_bar);
	gtk_widget_show (view->details->total_progress_bar);

	/* add a label for progress messages, but don't show it until there's a message */
	view->details->overall_feedback_text = gtk_label_new ("");
	gtk_misc_set_alignment (GTK_MISC (view->details->overall_feedback_text), 0.1, 0.1);
	font = nautilus_font_factory_get_font_from_preferences (12);
	nautilus_gtk_widget_set_font (view->details->overall_feedback_text, font);
	gtk_box_pack_start (GTK_BOX (view->details->form), view->details->overall_feedback_text, FALSE, FALSE, 8);

	/* Setup the title */
	middle_title = create_middle_title_widget ("Messages", "Progress");
        gtk_box_pack_start (GTK_BOX (view->details->form), middle_title, FALSE, FALSE, 0);
	gtk_widget_show (middle_title);

	/* add an hbox at the bottom of the screen to hold current progress but don't show it yet */
        view->details->message_box = gtk_vbox_new (FALSE, 0);
        gtk_box_pack_end (GTK_BOX (view->details->form), view->details->message_box, FALSE, FALSE, 4);
	gtk_widget_show (view->details->message_box);

}

static GtkWidget*
create_image_widget (const char			*icon_name,
		     const char			*background_color_spec,
		     NautilusImagePlacementType	placement)
{
	char		*path;
	GtkWidget	*image;
	GdkPixbuf	*pixbuf;
	guint32		background_rgb;

	g_return_val_if_fail (icon_name != NULL, NULL);
	g_return_val_if_fail (background_color_spec != NULL, NULL);

	image = nautilus_image_new();
	
	path = nautilus_pixmap_file (icon_name);
	
	pixbuf = gdk_pixbuf_new_from_file (path);
	g_free (path);

	if (pixbuf != NULL) {
		nautilus_image_set_pixbuf (NAUTILUS_IMAGE (image), pixbuf);
		gdk_pixbuf_unref (pixbuf);
	}
	else {
		g_warning ("Could not find the requested icon.");
	}
	
	nautilus_image_set_background_type (NAUTILUS_IMAGE (image),
					    NAUTILUS_IMAGE_BACKGROUND_SOLID);
	
	background_rgb = nautilus_parse_rgb_with_white_default (background_color_spec);
	
	nautilus_image_set_background_color (NAUTILUS_IMAGE (image),
					     background_rgb);

	nautilus_image_set_placement_type (NAUTILUS_IMAGE (image), placement);

	return image;
}

static GtkWidget*
create_title_widget (const char *title_text) 
{
        GtkWidget	*title_hbox;
        GtkWidget	*logo_image;
        GtkWidget	*filler_image;
        GtkWidget	*text_image;
	GdkFont		*font;

	g_assert (title_text != NULL);

        title_hbox = gtk_hbox_new (FALSE, 0);

	logo_image = create_image_widget ("eazel-services-logo.png",
					      SERVICE_VIEW_DEFAULT_BACKGROUND_COLOR,
					      NAUTILUS_IMAGE_PLACEMENT_CENTER);

	filler_image = create_image_widget ("eazel-services-logo-tile.png",
						SERVICE_VIEW_DEFAULT_BACKGROUND_COLOR,
						NAUTILUS_IMAGE_PLACEMENT_TILE);

	text_image = create_image_widget ("eazel-services-logo-tile.png",
					      SERVICE_VIEW_DEFAULT_BACKGROUND_COLOR,
					      NAUTILUS_IMAGE_PLACEMENT_TILE);

	font = nautilus_font_factory_get_font_by_family ("helvetica", 20);

	nautilus_image_set_label_text (NAUTILUS_IMAGE (text_image), title_text);
	nautilus_image_set_label_font (NAUTILUS_IMAGE (text_image), font);
	nautilus_image_set_extra_width (NAUTILUS_IMAGE (text_image), 8);
	nautilus_image_set_right_offset (NAUTILUS_IMAGE (text_image), 8);
	nautilus_image_set_top_offset (NAUTILUS_IMAGE (text_image), 3);

	gdk_font_unref (font);

	gtk_widget_show (logo_image);
	gtk_widget_show (filler_image);
	gtk_widget_show (text_image);

        gtk_box_pack_start (GTK_BOX (title_hbox), logo_image, FALSE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX (title_hbox), filler_image, TRUE, TRUE, 0);
        gtk_box_pack_end (GTK_BOX (title_hbox), text_image, FALSE, FALSE, 0);

	return title_hbox;
}

static GtkWidget*
create_middle_title_widget (const char *left_text,
			    const char *right_text)
{
        GtkWidget	*title_hbox;
        GtkWidget	*left_image;
        GtkWidget	*right_image;
        GtkWidget	*filler_image;
	GdkFont		*font;
	
	g_assert (left_text != NULL);
	g_assert (right_text != NULL);

        title_hbox = gtk_hbox_new (FALSE, 0);

	left_image = create_image_widget ("eazel-services-logo-tile.png",
					  SERVICE_VIEW_DEFAULT_BACKGROUND_COLOR,
					  NAUTILUS_IMAGE_PLACEMENT_TILE);
	
	filler_image = create_image_widget ("eazel-services-logo-tile.png",
					    SERVICE_VIEW_DEFAULT_BACKGROUND_COLOR,
					    NAUTILUS_IMAGE_PLACEMENT_TILE);

	right_image = create_image_widget ("eazel-services-logo-tile.png",
					   SERVICE_VIEW_DEFAULT_BACKGROUND_COLOR,
					   NAUTILUS_IMAGE_PLACEMENT_TILE);

	font = nautilus_font_factory_get_font_by_family ("helvetica", 18);

	nautilus_image_set_label_text (NAUTILUS_IMAGE (left_image), left_text);
	nautilus_image_set_label_font (NAUTILUS_IMAGE (left_image), font);

	nautilus_image_set_extra_width (NAUTILUS_IMAGE (left_image), 8);
	nautilus_image_set_left_offset (NAUTILUS_IMAGE (left_image), 8);
	nautilus_image_set_top_offset (NAUTILUS_IMAGE (left_image), 1);

	nautilus_image_set_label_text (NAUTILUS_IMAGE (right_image), right_text);
	nautilus_image_set_label_font (NAUTILUS_IMAGE (right_image), font);

	nautilus_image_set_extra_width (NAUTILUS_IMAGE (right_image), 8);
	nautilus_image_set_right_offset (NAUTILUS_IMAGE (right_image), 8);
	nautilus_image_set_top_offset (NAUTILUS_IMAGE (right_image), 1);

	gdk_font_unref (font);

	gtk_widget_show (left_image);
	gtk_widget_show (filler_image);
	gtk_widget_show (right_image);

        gtk_box_pack_start (GTK_BOX (title_hbox), left_image, FALSE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX (title_hbox), filler_image, TRUE, TRUE, 0);
        gtk_box_pack_end (GTK_BOX (title_hbox), right_image, FALSE, FALSE, 0);

	return title_hbox;
}

static void
fake_overall_install_progress (NautilusServiceInstallView	*view) {

	int 	counter;

	for (counter = 1; counter <= 20000; counter++) {
		float value;

		value = (float) counter / 20000;

		if (counter == 1) {
			show_overall_feedback (view, "Installing package 1 of 4 ...");
		}
		if (counter == 5000) {
			show_overall_feedback (view, "Installing package 2 of 4 ...");
		}
		if (counter == 10000) {
			show_overall_feedback (view, "Installing package 3 of 4 ...");
		}
		if (counter == 15000) {
			show_overall_feedback (view, "Installing package 4 of 4 ...");
		}
		if (counter == 20000) {
			break;
		}
		else {
			gtk_progress_bar_update (GTK_PROGRESS_BAR (view->details->total_progress_bar), value);
			while (gtk_events_pending ()) {
				gtk_main_iteration ();
			}
		}
	}

}

static void
generate_current_progress (NautilusServiceInstallView	*view, char	*progress_message) {

	GtkWidget	*temp_container;
	GtkWidget	*temp_box;
	GdkFont		*font;
	int		counter;
     
	temp_container = gtk_hbox_new (TRUE, 0);
	gtk_box_pack_start (GTK_BOX (view->details->message_box), temp_container, 0, 0, 4);
	gtk_widget_show (temp_container);

	/* add a label for progress messages, but don't show it until there's a message */
	view->details->current_feedback_text = gtk_label_new ("");
	font = nautilus_font_factory_get_font_from_preferences (16);
	nautilus_gtk_widget_set_font (view->details->current_feedback_text, font);
	gtk_box_pack_start (GTK_BOX (temp_container), view->details->current_feedback_text, 0, 0, 8);
	gtk_label_set_line_wrap (GTK_LABEL (view->details->current_feedback_text), TRUE);

	/* Create a center alignment object */
	temp_box = gtk_alignment_new (0.5, 0.5, 0, 0);
	gtk_box_pack_end (GTK_BOX (temp_container), temp_box, FALSE, FALSE, 8);
			    gtk_widget_show (temp_box);
	gtk_widget_show (temp_box);
	view->details->current_progress_bar = gtk_progress_bar_new ();
	gtk_container_add (GTK_CONTAINER (temp_box), view->details->current_progress_bar);
	gtk_widget_show (view->details->current_progress_bar);

	/* bogus current progress loop */
	for (counter = 1; counter <= 5000; counter++) {
		float value;

		value = (float) counter / 5000;

		if (counter == 1) {
			gtk_label_set_text (GTK_LABEL (view->details->current_feedback_text), progress_message);
			gtk_widget_show (view->details->current_feedback_text);
		}
		if (counter == 5000) {
			gtk_label_set_text (GTK_LABEL (view->details->current_feedback_text), "Complete!");
			gtk_widget_show (view->details->current_feedback_text);
			break;
		}
		else {
			gtk_progress_bar_update (GTK_PROGRESS_BAR (view->details->current_progress_bar), value);
			while (gtk_events_pending ()) {
				gtk_main_iteration ();
			}
		}
	}

}

/* utility routine to show an error message */
static void
show_overall_feedback (NautilusServiceInstallView	*view, char	*progress_message) {

	gtk_label_set_text (GTK_LABEL (view->details->overall_feedback_text), progress_message);
	gtk_widget_show (view->details->overall_feedback_text);

}

/* utility routine to go to another uri */

static void
go_to_uri (NautilusServiceInstallView	*view, char	*uri) {

	nautilus_view_open_location (view->details->nautilus_view, uri);

}


static void
nautilus_service_install_view_initialize_class (NautilusServiceInstallViewClass *klass) {

	GtkObjectClass	*object_class;
	GtkWidgetClass	*widget_class;
	
	object_class = GTK_OBJECT_CLASS (klass);
	widget_class = GTK_WIDGET_CLASS (klass);
	parent_class = gtk_type_class (gtk_event_box_get_type ());
	object_class->destroy = nautilus_service_install_view_destroy;
}

static void
nautilus_service_install_view_initialize (NautilusServiceInstallView *view) {

	NautilusBackground	*background;

	view->details = g_new0 (NautilusServiceInstallViewDetails, 1);
	view->details->nautilus_view = nautilus_view_new (GTK_WIDGET (view));
	gtk_signal_connect (GTK_OBJECT (view->details->nautilus_view), 
			    "load_location",
			    GTK_SIGNAL_FUNC (service_install_load_location_callback), 
			    view);

	background = nautilus_get_widget_background (GTK_WIDGET (view));
	nautilus_background_set_color (background, SERVICE_VIEW_DEFAULT_BACKGROUND_COLOR);

	gtk_widget_show (GTK_WIDGET (view));
}

static void
nautilus_service_install_view_destroy (GtkObject *object) {

	NautilusServiceInstallView	*view;
	
	view = NAUTILUS_SERVICE_INSTALL_VIEW (object);

	if (view->details->uri) {
		g_free (view->details->uri);
	}
	g_free (view->details);
	
	NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));

}

NautilusView *
nautilus_service_install_view_get_nautilus_view (NautilusServiceInstallView *view) {

	return view->details->nautilus_view;

}

/* here's where we do most of the real work of populating the view with info from the package */
/* open the package and copy the information, and then set up the appropriate views with it */
/* FIXME bugzilla.eazel.com 725: use gnome-vfs to open the package */

static void
nautilus_service_install_view_update_from_uri (NautilusServiceInstallView	*view, const char	*uri) {

	/* open the package */
	HeaderIterator		iterator;
	Header			header_info;
	Header			signature;
	int			iterator_tag;
	int			type;
	int			data_size;
	int			result;
	char			*data_ptr;
	char			*temp_str;
	FD_t			file_descriptor;
	int			*integer_ptr;
	PackageData		*pack;

	char			*temp_version = NULL;
	char			*temp_release = NULL;
	char			*package_name = NULL;

	const char		*path_name = uri + 7;

	file_descriptor = fdOpen (path_name, O_RDONLY, 0644);

	if (file_descriptor != NULL) {

		/* read out the appropriate fields, and set them up in the view */
		result = rpmReadPackageInfo (file_descriptor, &signature, &header_info);
		if (result) {
			g_message ("couldn't read package!");
			return;
		}

		iterator = headerInitIterator (header_info);
		while (headerNextIterator (iterator, &iterator_tag, &type, (void**) &data_ptr, &data_size)) {
			integer_ptr = (int*) data_ptr;
			switch (iterator_tag) {
				case RPMTAG_NAME:
					package_name = g_strdup (data_ptr);
					temp_str = g_strdup_printf (_("Installing \"%s\" "), data_ptr);
					gtk_label_set (GTK_LABEL (view->details->package_name), temp_str);
					g_free (temp_str);
					break;
				case RPMTAG_VERSION:
					temp_version = g_strdup (data_ptr);
					break;
				case RPMTAG_RELEASE:
					temp_release = g_strdup (data_ptr);
					break;
				case RPMTAG_SUMMARY:
					gtk_label_set (GTK_LABEL (view->details->package_summary), data_ptr+4);
					break;
				case RPMTAG_DESCRIPTION:
					gtk_label_set (GTK_LABEL (view->details->package_details), data_ptr+4);
					break;
				case RPMTAG_SIZE:
					break;
				case RPMTAG_DISTRIBUTION:
					break;
				case RPMTAG_GROUP:
					break;
				case RPMTAG_ICON:
					break;
				case RPMTAG_LICENSE:
					break;
				case RPMTAG_BUILDTIME:
					break;
				case RPMTAG_INSTALLTIME:
					break;
				case RPMTAG_VENDOR:
					break;
				case RPMTAG_GIF:
					break;
				case RPMTAG_XPM:
					break;
			}

		}

		if (temp_version) {
			temp_str = g_strdup_printf (_("Version %s-%s"), temp_version, temp_release);
			gtk_label_set (GTK_LABEL (view->details->package_version), temp_str);
			g_free (temp_str);
		}

		headerFreeIterator (iterator);

		/* close the package */
		fdClose (file_descriptor);
	}

	/* NOTE: This adds a libeazelinstall packagedata object to the view */
	pack = (PackageData*) gtk_object_get_data (GTK_OBJECT (view), "packagedata");
	if (pack != NULL) {
		/* Destroy the old */
			packagedata_destroy (pack);
	}
	pack = packagedata_new ();
	pack->name = g_strdup (package_name);
	pack->version = g_strdup (temp_version);
	pack->minor = g_strdup (temp_release);
	gtk_object_set_data (GTK_OBJECT (view), "packagedata", pack);

	if (package_name) {
		g_free (package_name);
	}
	if (temp_version) {
		g_free (temp_version);
	}
	if (temp_release) {
		g_free (temp_release);
	}

	/* Ad hock crap to fake a full install */
	show_overall_feedback (view, "Checking Dependancies");
	show_overall_feedback (view, "Waiting for downloads");
	generate_current_progress (view, "Downloading png image libraries ...");
	show_overall_feedback (view, "Checking Dependancies");
	show_overall_feedback (view, "Waiting for downloads");
	generate_current_progress (view, "Downloading gnome core libraries ...");		
	show_overall_feedback (view, "Checking Dependancies");
	show_overall_feedback (view, "Waiting for downloads");
	generate_current_progress (view, "Downloading gtk+ libraries ...");
	show_overall_feedback (view, "Checking Dependancies");
	show_overall_feedback (view, "Waiting for downloads");
	generate_current_progress (view, "Downloading glib libraries ...");		
	fake_overall_install_progress (view);
	go_to_uri (view, NEXT_VIEW);

}

void
nautilus_service_install_view_load_uri (NautilusServiceInstallView	*view,
			     	        const char			*uri) {

	/* dispose of any old uri and copy in the new one */	
	g_free (view->details->uri);
	view->details->uri = g_strdup (uri);

	/* dispose of any old form that was installed */
	if (view->details->form != NULL) {
		gtk_widget_destroy (view->details->form);
		view->details->form = NULL;
	}

	generate_install_form (view);
	nautilus_service_install_view_update_from_uri (view, uri);
}

static void
service_install_load_location_callback (NautilusView			*nautilus_view, 
			  	        const char			*location,
			       		NautilusServiceInstallView	*view) {

	g_assert (nautilus_view == view->details->nautilus_view);
	
	nautilus_view_report_load_underway (nautilus_view);
	
	nautilus_service_install_view_load_uri (view, location);
	
	nautilus_view_report_load_complete (nautilus_view);

}