add tooltips for the welcome page buttons
[obnox/wireshark/wip.git] / gtk / main_welcome.c
1 /* main_welcome.c
2  *
3  * $Id$
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22  */
23
24 #ifdef HAVE_CONFIG_H
25 # include "config.h"
26 #endif
27
28 #ifdef HAVE_SYS_TYPES_H
29 #include <sys/types.h>
30 #endif
31
32
33 #include <gtk/gtk.h>
34
35 #include <epan/prefs.h>
36
37 #include "../color.h"
38 #include "capture.h"
39 #include "capture-pcap-util.h"
40 #include "capture_opts.h"
41 #include "simple_dialog.h"
42 #include "wiretap/file_util.h"
43
44 #include "gtk/gui_utils.h"
45 #include "gtk/color_utils.h"
46 #include "gtk/recent.h"
47 #include "gtk/gtkglobals.h"
48 #include "gtk/main.h"
49 #include "gtk/main_menu.h"
50 #include "gtk/main_welcome.h"
51 #include "gtk/capture_dlg.h"
52 #include "gtk/capture_file_dlg.h"
53 #include "gtk/help_dlg.h"
54 #include "gtk/stock_icons.h"
55
56
57
58
59 /* XXX - There seems to be some disagreement about if and how this feature should be implemented.
60    As I currently don't have the time to continue this, it's temporarily disabled. - ULFL */
61 #define SHOW_WELCOME_PAGE
62
63 #ifdef SHOW_WELCOME_PAGE
64 #include "../image/wssplash.xpm"
65 #endif
66
67
68 #ifdef SHOW_WELCOME_PAGE
69
70
71 /* XXX */
72 extern gint if_list_comparator_alph (const void *first_arg, const void *second_arg);
73
74
75 GdkColor header_bar_bg;
76 GdkColor topic_header_bg;
77 GdkColor topic_content_bg;
78 GdkColor topic_item_idle_bg;
79 GdkColor topic_item_entered_bg;
80
81 GtkWidget *welcome_file_panel_vb = NULL;
82
83
84
85 /* mouse entered this widget - change background color */
86 static gboolean
87 welcome_item_enter_cb(GtkWidget *eb, GdkEventCrossing *event _U_, gpointer user_data _U_)
88 {
89     gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_entered_bg);
90
91     return FALSE;
92 }
93
94 /* mouse has left this widget - change background color  */
95 static gboolean
96 welcome_item_leave_cb(GtkWidget *eb, GdkEvent *event _U_, gpointer user_data _U_)
97 {
98     gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_idle_bg);
99
100     return FALSE;
101 }
102
103
104 /* create a "button widget" */
105 GtkWidget *
106 welcome_button(const gchar *stock_item, 
107                const gchar * title, const gchar * subtitle, const gchar *tooltip,
108                            GtkSignalFunc callback, void *callback_data)
109 {
110     GtkWidget *eb, *w, *item_hb, *text_vb;
111     gchar *formatted_text;
112     GtkTooltips *tooltips;
113
114
115     tooltips = gtk_tooltips_new();
116
117     item_hb = gtk_hbox_new(FALSE, 1);
118
119     /* event box (for background color and events) */
120     eb = gtk_event_box_new();
121     gtk_container_add(GTK_CONTAINER(eb), item_hb);
122     gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_idle_bg);
123     if(tooltip != NULL) {
124         gtk_tooltips_set_tip(tooltips, eb, tooltip, "");
125     }
126
127     g_signal_connect(eb, "enter-notify-event", G_CALLBACK(welcome_item_enter_cb), NULL);
128     g_signal_connect(eb, "leave-notify-event", G_CALLBACK(welcome_item_leave_cb), NULL);
129     g_signal_connect(eb, "button-press-event", G_CALLBACK(callback), callback_data);
130
131     /* icon */
132     w = gtk_image_new_from_stock(stock_item, GTK_ICON_SIZE_LARGE_TOOLBAR);
133     gtk_box_pack_start(GTK_BOX(item_hb), w, FALSE, FALSE, 5);
134
135     text_vb = gtk_vbox_new(FALSE, 3);
136
137     /* title */
138     w = gtk_label_new(title);
139     gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.5);
140     formatted_text = g_strdup_printf("<span weight=\"bold\" size=\"x-large\">%s</span>", title);
141     gtk_label_set_markup(GTK_LABEL(w), formatted_text);
142     g_free(formatted_text);
143     gtk_box_pack_start(GTK_BOX(text_vb), w, FALSE, FALSE, 1);
144     
145     /* subtitle */
146     w = gtk_label_new(subtitle);
147     gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.5);
148     formatted_text = g_strdup_printf("<span size=\"small\">%s</span>", subtitle);
149     gtk_label_set_markup(GTK_LABEL(w), formatted_text);
150     g_free(formatted_text);
151     gtk_box_pack_start(GTK_BOX(text_vb), w, FALSE, FALSE, 1);
152     
153     gtk_box_pack_start(GTK_BOX(item_hb), text_vb, TRUE, TRUE, 5);
154
155     return eb;
156 }
157
158
159 /* create the banner "above our heads" */
160 GtkWidget *
161 welcome_header_new(void)
162 {
163     GtkWidget *item_vb;
164     GtkWidget *item_hb;
165     GtkWidget *eb;
166     GtkWidget *icon;
167     gchar *message;
168     GtkWidget *w;
169
170
171     item_vb = gtk_vbox_new(FALSE, 0);
172
173     /* colorize vbox */
174     eb = gtk_event_box_new();
175     gtk_container_add(GTK_CONTAINER(eb), item_vb);
176     gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &header_bar_bg);
177
178     item_hb = gtk_hbox_new(FALSE, 0);
179     gtk_box_pack_start(GTK_BOX(item_vb), item_hb, FALSE, FALSE, 10);
180
181     icon = xpm_to_widget_from_parent(top_level, wssplash_xpm);
182     gtk_box_pack_start(GTK_BOX(item_hb), icon, FALSE, FALSE, 10);
183
184     message = "<span weight=\"bold\" size=\"x-large\">" "The World's Most Popular Network Protocol Analyzer" "</span>";
185     w = gtk_label_new(message);
186     gtk_label_set_markup(GTK_LABEL(w), message);
187     gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.5);
188     gtk_box_pack_start(GTK_BOX(item_hb), w, TRUE, TRUE, 5);
189
190     gtk_widget_show_all(eb);
191
192     return eb;
193 }
194
195
196 /* create a "topic header widget" */
197 GtkWidget *
198 welcome_topic_header_new(const char *header)
199 {
200     GtkWidget *w;
201     GtkWidget *eb;
202     gchar *formatted_message;
203
204
205     w = gtk_label_new(header);
206     formatted_message = g_strdup_printf("<span weight=\"bold\" size=\"x-large\">%s</span>", header);
207     gtk_label_set_markup(GTK_LABEL(w), formatted_message);
208     g_free(formatted_message);
209
210     /* colorize vbox */
211     eb = gtk_event_box_new();
212     gtk_container_add(GTK_CONTAINER(eb), w);
213     gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_header_bg);
214
215     return eb;
216 }
217
218
219 /* create a "topic widget" */
220 GtkWidget *
221 welcome_topic_new(const char *header, GtkWidget **to_fill)
222 {
223     GtkWidget *topic_vb;
224     GtkWidget *layout_vb;
225     GtkWidget *topic_eb;
226     GtkWidget *topic_header;
227
228
229     topic_vb = gtk_vbox_new(FALSE, 0);
230
231     topic_header = welcome_topic_header_new(header);
232     gtk_box_pack_start(GTK_BOX(topic_vb), topic_header, FALSE, FALSE, 0);
233
234     layout_vb = gtk_vbox_new(FALSE, 5);
235     gtk_container_border_width(GTK_CONTAINER(layout_vb), 10);
236     gtk_box_pack_start(GTK_BOX(topic_vb), layout_vb, FALSE, FALSE, 0);
237
238     /* colorize vbox (we need an event box for this!) */
239     topic_eb = gtk_event_box_new();
240     gtk_container_add(GTK_CONTAINER(topic_eb), topic_vb);
241     gtk_widget_modify_bg(topic_eb, GTK_STATE_NORMAL, &topic_content_bg);
242     *to_fill = layout_vb;
243
244     return topic_eb;
245 }
246
247
248 /* a file link was pressed */
249 static gboolean
250 welcome_filename_link_press_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer data)
251 {
252     menu_open_filename(data);
253
254     return FALSE;
255 }
256
257
258 /* create a "file link widget" */
259 GtkWidget *
260 welcome_filename_link_new(const gchar *filename, GtkWidget **label)
261 {
262     GtkWidget *w;
263     GtkWidget *eb;
264     GString             *str;
265     const unsigned int max = 60;
266     int err;
267     struct stat stat_buf;
268
269
270     /* filename */
271     str = g_string_new(filename);
272
273     /* cut max filename length */
274     if(str->len > max) {
275         g_string_erase(str, 0, str->len-max /*cut*/);
276         g_string_prepend(str, "... ");
277     }
278
279     /* add file size */
280     err = eth_stat(filename, &stat_buf);
281     if(err == 0) {
282         if (stat_buf.st_size/1024/1024 > 10) {
283             g_string_append_printf(str, " %" G_GINT64_MODIFIER "dMB", (gint64) (stat_buf.st_size/1024/1024));
284         } else if (stat_buf.st_size/1024 > 10) {
285             g_string_append_printf(str, " %" G_GINT64_MODIFIER "dKB", (gint64) (stat_buf.st_size/1024));
286         } else {
287             g_string_append_printf(str, " %" G_GINT64_MODIFIER "d Bytes", (gint64) (stat_buf.st_size));
288         }
289     } else {
290         g_string_append(str, " (not found)");
291     }
292
293     /* pango format string */
294     g_string_prepend(str, "<span foreground='blue'>");
295     g_string_append(str, "</span>");
296
297     /* label */
298     w = gtk_label_new(str->str);
299     *label = w;
300     gtk_label_set_markup(GTK_LABEL(w), str->str);
301     gtk_misc_set_padding(GTK_MISC(w), 5, 2);
302
303         /* event box */
304     eb = gtk_event_box_new();
305     gtk_container_add(GTK_CONTAINER(eb), w);
306     
307     g_signal_connect(eb, "enter-notify-event", G_CALLBACK(welcome_item_enter_cb), w);
308     g_signal_connect(eb, "leave-notify-event", G_CALLBACK(welcome_item_leave_cb), w);
309     g_signal_connect(eb, "button-press-event", G_CALLBACK(welcome_filename_link_press_cb), (gchar *) filename);
310
311     g_string_free(str, TRUE);
312
313     return eb;
314 }
315
316
317 /* reset the list of recent files */
318 void
319 main_welcome_reset_recent_capture_files()
320 {
321     GList* child_list;
322     GList* child_list_item;
323     
324     child_list = gtk_container_get_children(GTK_CONTAINER(welcome_file_panel_vb));
325     child_list_item = child_list;
326
327     while(child_list_item) {
328         gtk_container_remove(GTK_CONTAINER(welcome_file_panel_vb), child_list_item->data);
329         child_list_item = g_list_next(child_list_item);
330     }
331
332     g_list_free(child_list);
333 }
334
335
336 /* add a new file to the list of recent files */
337 void
338 main_welcome_add_recent_capture_files(const char *widget_cf_name)
339 {
340     GtkWidget *w;
341     GtkWidget *label;
342
343     w = welcome_filename_link_new(widget_cf_name, &label);
344     gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &topic_item_idle_bg);
345     gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0);
346     gtk_box_pack_start(GTK_BOX(welcome_file_panel_vb), w, FALSE, FALSE, 0);
347     gtk_widget_show_all(w);
348 }
349
350
351 #ifdef HAVE_LIBPCAP
352 /* user clicked on an interface button */
353 static gboolean
354 welcome_if_press_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer data)
355 {
356     if (capture_opts->iface)
357         g_free(capture_opts->iface);
358     if (capture_opts->iface_descr)
359         g_free(capture_opts->iface_descr);
360
361     capture_opts->iface = g_strdup(data);
362     capture_opts->iface_descr = NULL;
363     /* XXX - fix this */
364     /*capture_opts->iface_descr = get_interface_descriptive_name(capture_opts->iface);*/
365
366     /* XXX - remove this? */
367     if (capture_opts->save_file) {
368     g_free(capture_opts->save_file);
369     capture_opts->save_file = NULL;
370     }
371
372     capture_start_cb(NULL, NULL);
373
374     return FALSE;
375 }
376
377
378 /* create a single interface entry */
379 static GtkWidget *
380 welcome_if_new(const char *if_name, GdkColor *topic_bg _U_, gpointer interf)
381 {
382     GtkWidget *interface_hb;
383     GtkWidget *w;
384     GString   *message;
385     GtkWidget *eb;
386
387
388     /* event box */
389     eb = gtk_event_box_new();
390     gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_idle_bg);
391
392     g_signal_connect(eb, "enter-notify-event", G_CALLBACK(welcome_item_enter_cb), NULL);
393     g_signal_connect(eb, "leave-notify-event", G_CALLBACK(welcome_item_leave_cb), NULL);
394     g_signal_connect(eb, "button-press-event", G_CALLBACK(welcome_if_press_cb), interf);
395
396     interface_hb = gtk_hbox_new(FALSE, 5);
397     gtk_container_add(GTK_CONTAINER(eb), interface_hb);
398
399     /* icon */
400     w = gtk_image_new_from_stock(WIRESHARK_STOCK_CAPTURE_START, GTK_ICON_SIZE_SMALL_TOOLBAR);
401     gtk_box_pack_start(GTK_BOX(interface_hb), w, FALSE, FALSE, 5);
402
403     message = g_string_new(if_name);
404
405     /* truncate string if it's too long */
406     /* (the number of chars is a bit arbitrary, though) */
407     if(message->len > 48) {
408         g_string_truncate(message, 45);
409         g_string_append  (message, " ...");
410     }
411     g_string_prepend(message, "<span foreground='blue'>");
412     g_string_append (message, "</span>");
413     w = gtk_label_new(message->str);
414     gtk_label_set_markup(GTK_LABEL(w), message->str);
415     g_string_free(message, TRUE);
416
417     gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.0);
418     gtk_box_pack_start(GTK_BOX(interface_hb), w, FALSE, FALSE, 0);
419
420     return eb;
421 }
422
423
424 /* create the list of interfaces */
425 GtkWidget *
426 welcome_if_panel_new(void)
427 {
428     GtkWidget *interface_hb;
429     GtkWidget *panel_vb;
430
431   if_info_t     *if_info;
432   GList         *if_list;
433   int err;
434   gchar         *err_str;
435   int           ifs;
436   GList         *curr;
437
438
439   panel_vb = gtk_vbox_new(FALSE, 0);
440
441   /* LOAD THE INTERFACES */
442   if_list = capture_interface_list(&err, &err_str);
443   if_list = g_list_sort (if_list, if_list_comparator_alph);
444   if (if_list == NULL && err == CANT_GET_INTERFACE_LIST) {
445     simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_str);
446     g_free(err_str);
447     return NULL;
448   }
449
450   /* List the interfaces */
451   for(ifs = 0; (curr = g_list_nth(if_list, ifs)); ifs++) {
452       /*g_string_assign(if_tool_str, "");*/
453       if_info = curr->data;
454
455       /* Continue if capture device is hidden */
456       if (prefs_is_capture_device_hidden(if_info->name)) {
457           continue;
458       }
459
460     if (if_info->description != NULL)
461         interface_hb = welcome_if_new(if_info->description, &topic_content_bg, g_strdup(if_info->name));
462     else
463         interface_hb = welcome_if_new(if_info->name, &topic_content_bg, g_strdup(if_info->name));
464     gtk_box_pack_start(GTK_BOX(panel_vb), interface_hb, FALSE, FALSE, 2);
465   }
466
467   free_interface_list(if_list);
468
469   return panel_vb;
470 }
471 #endif  /* HAVE_LIBPCAP */
472
473
474 /* create the welcome page */
475 GtkWidget *
476 welcome_new(void)
477 {
478     GtkWidget *welcome_scrollw;
479     GtkWidget *welcome_vb;
480     GtkWidget *welcome_hb;
481     GtkWidget *column_vb;
482     GtkWidget *item_hb;
483     GtkWidget *w;
484     GtkWidget *header;
485     GtkWidget *topic_vb;
486     GtkWidget *topic_to_fill;
487
488
489     /* prepare colors */
490     /* header bar background color */
491     header_bar_bg.pixel = 0;
492     header_bar_bg.red = 154 * 255;
493     header_bar_bg.green = 210 * 255;
494     header_bar_bg.blue = 229 * 255;
495     get_color(&header_bar_bg);
496
497     /* topic header background color */
498     topic_header_bg.pixel = 0;
499     topic_header_bg.red = 24 * 255;
500     topic_header_bg.green = 151 * 255;
501     topic_header_bg.blue = 192 * 255;
502     get_color(&topic_header_bg);
503
504         /* topic content background color */
505     topic_content_bg.pixel = 0;
506     topic_content_bg.red = 221 * 255;
507     topic_content_bg.green = 226 * 255;
508     topic_content_bg.blue = 228 * 255;
509     get_color(&topic_content_bg);
510
511         /* topic item idle background color */
512     /*topic_item_idle_bg.pixel = 0;
513     topic_item_idle_bg.red = 216 * 255;
514     topic_item_idle_bg.green = 221 * 255;
515     topic_item_idle_bg.blue = 223 * 255;
516     get_color(&topic_item_idle_bg);*/
517
518     topic_item_idle_bg = topic_content_bg;
519
520         /* topic item entered color */
521     topic_item_entered_bg.pixel = 0;
522     topic_item_entered_bg.red = 211 * 255;
523     topic_item_entered_bg.green = 216 * 255;
524     topic_item_entered_bg.blue = 218 * 255;
525     get_color(&topic_item_entered_bg);
526
527     /*topic_item_entered_bg.pixel = 0;
528     topic_item_entered_bg.red = 216 * 255;
529     topic_item_entered_bg.green = 221 * 255;
530     topic_item_entered_bg.blue = 223 * 255;
531     get_color(&topic_item_entered_bg);*/
532
533     /*topic_item_entered_bg.pixel = 0;
534     topic_item_entered_bg.red = 154 * 255;
535     topic_item_entered_bg.green = 210 * 255;
536     topic_item_entered_bg.blue = 229 * 255;
537     get_color(&topic_item_entered_bg);*/
538
539
540     welcome_scrollw = scrolled_window_new(NULL, NULL);
541
542     welcome_vb = gtk_vbox_new(FALSE, 0);
543
544     /* header */
545     header = welcome_header_new();
546     gtk_box_pack_start(GTK_BOX(welcome_vb), header, FALSE, FALSE, 0);
547
548     /* content */
549     welcome_hb = gtk_hbox_new(FALSE, 10);
550     gtk_container_border_width(GTK_CONTAINER(welcome_hb), 10);
551     gtk_box_pack_start(GTK_BOX(welcome_vb), welcome_hb, TRUE, TRUE, 0);
552
553
554     /* column capture */
555     column_vb = gtk_vbox_new(FALSE, 10);
556     gtk_box_pack_start(GTK_BOX(welcome_hb), column_vb, TRUE, TRUE, 0);
557
558     /* capture topic */
559     topic_vb = welcome_topic_new("Capture", &topic_to_fill);
560     gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
561
562 #ifdef HAVE_LIBPCAP
563     item_hb = welcome_button(WIRESHARK_STOCK_CAPTURE_INTERFACES,
564         "Interface List",
565                 "Live list of the capture interfaces (counts incoming packets)",
566         "Same as Capture/Interfaces menu or toolbar item",
567         GTK_SIGNAL_FUNC(capture_if_cb), NULL);
568     gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
569
570     w = gtk_label_new("Start capture on interface:");
571     gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.0);
572     gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 5);
573
574     w = welcome_if_panel_new();
575     gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 0);
576
577     item_hb = welcome_button(WIRESHARK_STOCK_CAPTURE_OPTIONS,
578         "Capture Options",
579                 "Start a capture with detailed options",
580         "Same as Capture/Options menu or toolbar item",
581         GTK_SIGNAL_FUNC(capture_prep_cb), NULL);
582     gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
583
584     /* capture help topic */
585     topic_vb = welcome_topic_new("Capture Help", &topic_to_fill);
586     gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
587
588     item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
589                 "How to Capture",
590                 "Step by step to a successful capture setup",
591         topic_online_url(ONLINEPAGE_CAPTURE_SETUP),
592         GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(ONLINEPAGE_CAPTURE_SETUP));
593     gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
594
595     item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
596                 "Network Media",
597         "Specific infos for capturing on: Ethernet, WLAN, ...",
598         topic_online_url(ONLINEPAGE_NETWORK_MEDIA),
599         GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(ONLINEPAGE_NETWORK_MEDIA));
600     gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
601 #else
602     w = gtk_label_new("Capturing is not compiled into this version of Wireshark!");
603     gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.0);
604     gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 5);
605 #endif  /* HAVE_LIBPCAP */
606
607     /* fill bottom space */
608     w = gtk_label_new("");
609     gtk_box_pack_start(GTK_BOX(topic_to_fill), w, TRUE, TRUE, 0);
610
611
612     /* column files */
613     topic_vb = welcome_topic_new("Files", &topic_to_fill);
614     gtk_box_pack_start(GTK_BOX(welcome_hb), topic_vb, TRUE, TRUE, 0);
615
616     item_hb = welcome_button(GTK_STOCK_OPEN,
617         "Open",
618                 "Open a previously captured file",
619         "Same as File/Open menu or toolbar item",
620         GTK_SIGNAL_FUNC(file_open_cmd_cb), NULL);
621     gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
622
623     /* prepare list of recent files (will be filled in later) */
624     w = gtk_label_new("Open Recent:");
625     gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.0);
626     gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 5);
627
628     welcome_file_panel_vb = gtk_vbox_new(FALSE, 1);
629     gtk_box_pack_start(GTK_BOX(topic_to_fill), welcome_file_panel_vb, FALSE, FALSE, 0);
630
631     item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
632         "Sample Captures",
633                 "A rich assortment of example capture files on the wiki",
634         topic_online_url(ONLINEPAGE_SAMPLE_CAPTURES),
635         GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(ONLINEPAGE_SAMPLE_CAPTURES));
636     gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
637
638     /* fill bottom space */
639     w = gtk_label_new("");
640     gtk_box_pack_start(GTK_BOX(topic_to_fill), w, TRUE, TRUE, 0);
641
642
643     /* column online */
644     column_vb = gtk_vbox_new(FALSE, 10);
645     gtk_box_pack_start(GTK_BOX(welcome_hb), column_vb, TRUE, TRUE, 0);
646
647     /* topic online */
648     topic_vb = welcome_topic_new("Online", &topic_to_fill);
649     gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
650
651     item_hb = welcome_button(GTK_STOCK_HOME,
652         "Website",
653                 "Visit the project's website",
654         topic_online_url(ONLINEPAGE_HOME),
655         GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(ONLINEPAGE_HOME));
656     gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
657
658     item_hb = welcome_button(GTK_STOCK_HELP,
659         "User's Guide",
660                 "The User's Guide (local version, if installed)",
661         "Locally installed (if installed) otherwise online version",
662         GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(HELP_CONTENT));
663     gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
664
665     item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
666         "Security",
667                 "Work with Wireshark as securely as possible",
668         topic_online_url(ONLINEPAGE_SECURITY),
669         GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(ONLINEPAGE_SECURITY));
670     gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
671
672 #if 0
673     /* XXX - add this, once the Windows update functionality is implemented */
674     /* topic updates */
675     topic_vb = welcome_topic_new("Updates", &topic_to_fill);
676     gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
677
678     w = gtk_label_new("No updates available!");
679     gtk_box_pack_start(GTK_BOX(topic_to_fill), w, TRUE, TRUE, 0);
680 #endif
681
682
683     /* the end */
684     gtk_widget_show_all(welcome_vb);
685
686     gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(welcome_scrollw),
687                                           welcome_vb);
688     gtk_widget_show_all(welcome_scrollw);
689
690     return welcome_scrollw;
691 }
692 #else   /* SHOW_WELCOME_PAGE */
693
694 /* SOME DUMMY FUNCTIONS, UNTIL THE WELCOME PAGE GET'S LIVE */
695 void main_welcome_reset_recent_capture_files(void)
696 {
697 }
698
699 /* add a new file to the list of recently used files */
700 void main_welcome_add_recent_capture_files(const char *widget_cf_name _U_)
701 {
702 }
703
704 GtkWidget *
705 welcome_new(void)
706 {
707     /* this is just a dummy to fill up window space, simply showing nothing */
708     return scrolled_window_new(NULL, NULL);
709 }
710 #endif
711
712