5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
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.
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.
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.
28 #ifdef HAVE_SYS_TYPES_H
29 #include <sys/types.h>
35 #include <epan/prefs.h>
40 #include "capture-pcap-util.h"
41 #include "capture_opts.h"
42 #include "capture_ui_utils.h"
45 #include <wsutil/file_util.h>
47 #include "ui/recent.h"
48 #include "ui/simple_dialog.h"
50 #include "ui/gtk/gui_utils.h"
51 #include "ui/gtk/color_utils.h"
52 #include "ui/gtk/gtkglobals.h"
53 #include "ui/gtk/main.h"
54 #include "ui/gtk/menus.h"
55 #include "ui/gtk/main_welcome.h"
56 #include "ui/gtk/help_dlg.h"
57 #include "ui/gtk/capture_file_dlg.h"
58 #include "ui/gtk/stock_icons.h"
59 #include "ui/gtk/utf8_entities.h"
61 #include "ui/gtk/capture_dlg.h"
62 #include "ui/gtk/capture_if_dlg.h"
63 #include "ui/gtk/capture_globals.h"
64 #if GTK_CHECK_VERSION(2,18,0)
65 #include "ui/gtk/webbrowser.h"
67 #endif /* HAVE_LIBPCAP */
68 #include "../../image/wssplash-dev.xpm"
69 #include "../version_info.h"
78 #include "airpcap_loader.h"
79 #include "airpcap_gui_utils.h"
81 #if defined(HAVE_AIRPCAP)
82 #include "../../image/toolbar/capture_airpcap_16.xpm"
84 #if defined(HAVE_PCAP_REMOTE)
85 #include "ui/gtk/remote_icons.h"
89 static GtkWidget *welcome_hb = NULL;
90 static GtkWidget *header_lb = NULL;
91 /* Foreground colors are set using Pango markup */
92 #if GTK_CHECK_VERSION(3,0,0)
93 static GdkRGBA rgba_welcome_bg = {0.901, 0.901, 0.901, 1.0 };
94 static GdkRGBA rgba_header_bar_bg = { 0.094, 0.360, 0.792, 1.0 };
95 static GdkRGBA rgba_topic_header_bg = { 0.004, 0.224, 0.745, 1.0 };
96 static GdkRGBA rgba_topic_content_bg = { 1, 1, 1, 1.0 };
97 static GdkRGBA rgba_topic_item_idle_bg;
98 static GdkRGBA rgba_topic_item_entered_bg = { 0.827, 0.847, 0.854, 1.0 };
100 static GdkColor welcome_bg = { 0, 0xe6e6, 0xe6e6, 0xe6e6 };
101 static GdkColor header_bar_bg = { 0, 0x1818, 0x5c5c, 0xcaca };
102 static GdkColor topic_header_bg = { 0, 0x0101, 0x3939, 0xbebe };
103 static GdkColor topic_content_bg = { 0, 0xffff, 0xffff, 0xffff };
104 static GdkColor topic_item_idle_bg;
105 static GdkColor topic_item_entered_bg = { 0, 0xd3d3, 0xd8d8, 0xdada };
107 static GtkWidget *welcome_file_panel_vb = NULL;
109 static GtkWidget *if_view = NULL;
110 static GtkWidget *swindow;
113 static GSList *status_messages = NULL;
115 static GMutex *recent_mtx;
118 static void capture_if_start(GtkWidget *w _U_, gpointer data _U_);
119 static gboolean activate_link_cb(GtkLabel *label _U_, gchar *uri, gpointer user_data _U_);
120 static void welcome_if_tree_load(void);
123 /* The "scroll box dynamic" is a (complicated) pseudo widget to */
124 /* place a vertically list of widgets in (currently the interfaces and recent files). */
125 /* Once this list get's higher than a specified amount, */
126 /* it is moved into a scrolled_window. */
127 /* This is all complicated, the scrolled window is a bit ugly, */
128 /* the sizes might not be the same on all systems, ... */
129 /* ... but that's the best what we currently have */
130 #define SCROLL_BOX_CHILD_BOX "ScrollBoxDynamic_ChildBox"
131 #define SCROLL_BOX_MAX_CHILDS "ScrollBoxDynamic_MaxChilds"
132 #define SCROLL_BOX_SCROLLW_Y_SIZE "ScrollBoxDynamic_Scrollw_Y_Size"
133 #define SCROLL_BOX_SCROLLW "ScrollBoxDynamic_Scrollw"
134 #define TREE_VIEW_INTERFACES "TreeViewInterfaces"
135 #define CAPTURE_VIEW "CaptureView"
136 #define CAPTURE_LABEL "CaptureLabel"
137 #define CAPTURE_HB_BOX_INTERFACE_LIST "CaptureHorizontalBoxInterfaceList"
138 #define CAPTURE_HB_BOX_START "CaptureHorizontalBoxStart"
139 #define CAPTURE_HB_BOX_CAPTURE "CaptureHorizontalBoxCapture"
143 scroll_box_dynamic_new(GtkWidget *child_box, guint max_childs, guint scrollw_y_size) {
144 GtkWidget * parent_box;
147 parent_box = gtk_vbox_new(FALSE, 0);
148 gtk_box_pack_start(GTK_BOX(parent_box), GTK_WIDGET(child_box), TRUE, TRUE, 0);
149 g_object_set_data(G_OBJECT(parent_box), SCROLL_BOX_CHILD_BOX, child_box);
150 g_object_set_data(G_OBJECT(parent_box), SCROLL_BOX_MAX_CHILDS, GINT_TO_POINTER(max_childs));
151 g_object_set_data(G_OBJECT(parent_box), SCROLL_BOX_SCROLLW_Y_SIZE, GINT_TO_POINTER(scrollw_y_size));
152 gtk_widget_show_all(parent_box);
159 scroll_box_dynamic_add(GtkWidget *parent_box)
161 GtkWidget *child_box;
165 guint scrollw_y_size;
168 child_box = g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_CHILD_BOX);
169 max_cnt = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_MAX_CHILDS));
171 /* get the current number of children */
172 childs = gtk_container_get_children(GTK_CONTAINER(child_box));
173 curr_cnt = g_list_length(childs);
176 /* have we just reached the max? */
177 if(curr_cnt == max_cnt) {
178 /* create the scrolled window */
179 /* XXX - there's no way to get rid of the shadow frame - except for creating an own widget :-( */
180 scrollw = scrolled_window_new(NULL, NULL);
181 scrollw_y_size = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_SCROLLW_Y_SIZE));
182 gtk_widget_set_size_request(scrollw, -1, scrollw_y_size);
184 g_object_set_data(G_OBJECT(parent_box), SCROLL_BOX_SCROLLW, scrollw);
185 gtk_box_pack_start(GTK_BOX(parent_box), scrollw, TRUE, TRUE, 0);
187 /* move child_box from parent_box into scrolled window */
188 g_object_ref(child_box);
189 gtk_container_remove(GTK_CONTAINER(parent_box), child_box);
190 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollw),
192 gtk_widget_show_all(scrollw);
200 scroll_box_dynamic_reset(GtkWidget *parent_box)
202 GtkWidget *child_box, *scrollw;
205 child_box = g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_CHILD_BOX);
206 scrollw = g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_SCROLLW);
208 if(scrollw != NULL) {
209 /* move the child_box back from scrolled window into the parent_box */
210 g_object_ref(child_box);
211 gtk_container_remove(GTK_CONTAINER(parent_box), scrollw);
212 g_object_set_data(G_OBJECT(parent_box), SCROLL_BOX_SCROLLW, NULL);
213 gtk_box_pack_start(GTK_BOX(parent_box), child_box, TRUE, TRUE, 0);
220 /* mouse entered this widget - change background color */
222 welcome_item_enter_cb(GtkWidget *eb, GdkEventCrossing *event _U_, gpointer user_data _U_)
224 #if GTK_CHECK_VERSION(3,0,0)
225 gtk_widget_override_background_color(eb, GTK_STATE_NORMAL, &rgba_topic_item_entered_bg);
227 gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_entered_bg);
233 /* mouse has left this widget - change background color */
235 welcome_item_leave_cb(GtkWidget *eb, GdkEventCrossing *event _U_, gpointer user_data _U_)
237 #if GTK_CHECK_VERSION(3,0,0)
238 gtk_widget_override_background_color(eb, GTK_STATE_NORMAL, &rgba_topic_item_idle_bg);
240 gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_idle_bg);
246 typedef gboolean (*welcome_button_callback_t) (GtkWidget *widget,
247 GdkEventButton *event,
250 /* create a "button widget" */
252 welcome_button(const gchar *stock_item,
253 const gchar *title, const gchar *subtitle, const gchar *tooltip,
254 welcome_button_callback_t welcome_button_callback, gpointer welcome_button_callback_data)
256 GtkWidget *eb, *w, *item_hb, *text_vb;
257 gchar *formatted_text;
259 item_hb = gtk_hbox_new(FALSE, 1);
261 /* event box (for background color and events) */
262 eb = gtk_event_box_new();
263 gtk_container_add(GTK_CONTAINER(eb), item_hb);
264 #if GTK_CHECK_VERSION(3,0,0)
265 gtk_widget_override_background_color(eb, GTK_STATE_NORMAL, &rgba_topic_item_idle_bg);
267 gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_idle_bg);
269 if(tooltip != NULL) {
270 gtk_widget_set_tooltip_text(eb, tooltip);
273 g_signal_connect(eb, "enter-notify-event", G_CALLBACK(welcome_item_enter_cb), NULL);
274 g_signal_connect(eb, "leave-notify-event", G_CALLBACK(welcome_item_leave_cb), NULL);
275 g_signal_connect(eb, "button-release-event", G_CALLBACK(welcome_button_callback), welcome_button_callback_data);
278 w = gtk_image_new_from_stock(stock_item, GTK_ICON_SIZE_LARGE_TOOLBAR);
279 gtk_box_pack_start(GTK_BOX(item_hb), w, FALSE, FALSE, 5);
281 text_vb = gtk_vbox_new(FALSE, 3);
284 w = gtk_label_new(title);
285 gtk_misc_set_alignment (GTK_MISC(w), 0.0f, 0.5f);
286 formatted_text = g_strdup_printf("<span weight=\"bold\" size=\"x-large\" foreground=\"black\">%s</span>", title);
287 gtk_label_set_markup(GTK_LABEL(w), formatted_text);
288 g_free(formatted_text);
289 gtk_box_pack_start(GTK_BOX(text_vb), w, FALSE, FALSE, 1);
292 w = gtk_label_new(subtitle);
293 gtk_misc_set_alignment (GTK_MISC(w), 0.0f, 0.5f);
294 formatted_text = g_strdup_printf("<span size=\"small\" foreground=\"black\">%s</span>", subtitle);
295 gtk_label_set_markup(GTK_LABEL(w), formatted_text);
296 g_free(formatted_text);
297 gtk_box_pack_start(GTK_BOX(text_vb), w, FALSE, FALSE, 1);
299 gtk_box_pack_start(GTK_BOX(item_hb), text_vb, TRUE, TRUE, 5);
305 /* Hack to handle welcome-button "button-release-event" callback */
306 /* 1. Dispatch to desired actual callback */
307 /* 2. Return TRUE for the event callback. */
308 /* user_data: actual (no arg) callback fcn to be invoked. */
310 welcome_button_callback_helper(GtkWidget *w, GdkEventButton *event _U_, gpointer user_data)
312 void (*funct)(GtkWidget *, gpointer) = user_data;
319 welcome_header_set_message(gchar *msg) {
321 time_t secs = time(NULL);
322 struct tm *now = localtime(&secs);
324 message = g_string_new("<span weight=\"bold\" size=\"x-large\" foreground=\"white\">");
327 g_string_append(message, msg);
328 } else { /* Use our default header */
329 if ((now->tm_mon == 3 && now->tm_mday == 1) || (now->tm_mon == 6 && now->tm_mday == 14)) {
330 g_string_append(message, "Sniffing the glue that holds the Internet together");
332 g_string_append(message, prefs.gui_start_title);
335 if (prefs.gui_version_in_start_page) {
336 g_string_append_printf(message, "</span>\n<span size=\"large\" foreground=\"white\">Version " VERSION "%s",
337 wireshark_svnversion);
341 g_string_append(message, "</span>");
343 gtk_label_set_markup(GTK_LABEL(header_lb), message->str);
344 g_string_free(message, TRUE);
348 /* create the banner "above our heads" */
350 welcome_header_new(void)
357 item_vb = gtk_vbox_new(FALSE, 0);
360 eb = gtk_event_box_new();
361 gtk_container_add(GTK_CONTAINER(eb), item_vb);
362 #if GTK_CHECK_VERSION(3,0,0)
363 gtk_widget_override_background_color(eb, GTK_STATE_NORMAL, &rgba_header_bar_bg);
365 gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &header_bar_bg);
367 item_hb = gtk_hbox_new(FALSE, 0);
368 gtk_box_pack_start(GTK_BOX(item_vb), item_hb, FALSE, FALSE, 10);
370 /*icon = xpm_to_widget_from_parent(top_level, wssplash_xpm);*/
371 icon = xpm_to_widget(wssplash_xpm);
372 gtk_box_pack_start(GTK_BOX(item_hb), icon, FALSE, FALSE, 10);
374 header_lb = gtk_label_new(NULL);
375 welcome_header_set_message(NULL);
376 gtk_label_set_selectable(GTK_LABEL(header_lb), TRUE);
377 gtk_misc_set_alignment(GTK_MISC(header_lb), 0.0f, 0.5f);
378 gtk_box_pack_start(GTK_BOX(item_hb), header_lb, TRUE, TRUE, 5);
380 gtk_widget_show_all(eb);
387 welcome_header_push_msg(const gchar *msg) {
388 gchar *msg_copy = g_strdup(msg);
390 status_messages = g_slist_append(status_messages, msg_copy);
392 welcome_header_set_message(msg_copy);
394 gtk_widget_hide(welcome_hb);
399 welcome_header_pop_msg(void) {
402 if (status_messages) {
403 g_free(status_messages->data);
404 status_messages = g_slist_delete_link(status_messages, status_messages);
407 if (status_messages) {
408 msg = status_messages->data;
411 welcome_header_set_message(msg);
413 if (!status_messages) {
414 gtk_widget_show(welcome_hb);
419 /* create a "topic header widget" */
421 welcome_topic_header_new(const char *header)
425 gchar *formatted_message;
428 w = gtk_label_new(header);
429 formatted_message = g_strdup_printf("<span weight=\"bold\" size=\"x-large\" foreground=\"white\">%s</span>", header);
430 gtk_label_set_markup(GTK_LABEL(w), formatted_message);
431 g_free(formatted_message);
434 eb = gtk_event_box_new();
435 gtk_container_add(GTK_CONTAINER(eb), w);
436 #if GTK_CHECK_VERSION(3,0,0)
437 gtk_widget_override_background_color(eb, GTK_STATE_NORMAL, &rgba_topic_header_bg);
439 gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_header_bg);
445 /* create a "topic widget" */
447 welcome_topic_new(const char *header, GtkWidget **to_fill)
450 GtkWidget *layout_vb;
452 GtkWidget *topic_header;
455 topic_vb = gtk_vbox_new(FALSE, 0);
457 topic_header = welcome_topic_header_new(header);
458 gtk_box_pack_start(GTK_BOX(topic_vb), topic_header, FALSE, FALSE, 0);
460 layout_vb = gtk_vbox_new(FALSE, 5);
461 gtk_container_set_border_width(GTK_CONTAINER(layout_vb), 10);
462 gtk_box_pack_start(GTK_BOX(topic_vb), layout_vb, FALSE, FALSE, 0);
464 /* colorize vbox (we need an event box for this!) */
465 topic_eb = gtk_event_box_new();
466 gtk_container_add(GTK_CONTAINER(topic_eb), topic_vb);
467 #if GTK_CHECK_VERSION(3,0,0)
468 gtk_widget_override_background_color(topic_eb, GTK_STATE_NORMAL, &rgba_topic_content_bg);
470 gtk_widget_modify_bg(topic_eb, GTK_STATE_NORMAL, &topic_content_bg);
472 *to_fill = layout_vb;
478 /* a file link was pressed */
480 welcome_filename_link_press_cb(GtkWidget *widget _U_, GdkEventButton *event _U_, gpointer data)
482 menu_open_filename(data);
487 typedef struct _recent_item_status {
495 } recent_item_status;
498 * Fetch the status of a file.
499 * This function might be called as a thread. We can't use any drawing
500 * routines here: http://developer.gnome.org/gdk/2.24/gdk-Threads.html
502 static void *get_recent_item_status(void *data)
504 recent_item_status *ri_stat = (recent_item_status *) data;
513 * Add file size. We use binary prefixes instead of IEC because that's what
516 err = ws_stat64(ri_stat->filename, &stat_buf);
517 g_mutex_lock(recent_mtx);
520 if (stat_buf.st_size/1024/1024/1024 > 10) {
521 g_string_append_printf(ri_stat->str, " (%" G_GINT64_MODIFIER "d GB)", (gint64) (stat_buf.st_size/1024/1024/1024));
522 } else if (stat_buf.st_size/1024/1024 > 10) {
523 g_string_append_printf(ri_stat->str, " (%" G_GINT64_MODIFIER "d MB)", (gint64) (stat_buf.st_size/1024/1024));
524 } else if (stat_buf.st_size/1024 > 10) {
525 g_string_append_printf(ri_stat->str, " (%" G_GINT64_MODIFIER "d KB)", (gint64) (stat_buf.st_size/1024));
527 g_string_append_printf(ri_stat->str, " (%" G_GINT64_MODIFIER "d Bytes)", (gint64) (stat_buf.st_size));
529 /* pango format string */
530 g_string_prepend(ri_stat->str, "<span foreground='blue'>");
531 g_string_append(ri_stat->str, "</span>");
533 g_string_append(ri_stat->str, " [not found]");
536 if (!ri_stat->label) { /* The widget went away while we were busy. */
537 g_free(ri_stat->filename);
538 g_string_free(ri_stat->str, TRUE);
541 ri_stat->stat_done = TRUE;
543 g_mutex_unlock(recent_mtx);
548 /* Timeout callback for recent items */
550 update_recent_items(gpointer data)
552 recent_item_status *ri_stat = (recent_item_status *) data;
553 gboolean again = TRUE;
559 g_mutex_lock(recent_mtx);
560 if (ri_stat->stat_done) {
562 gtk_label_set_markup(GTK_LABEL(ri_stat->label), ri_stat->str->str);
563 if (ri_stat->err == 0) {
564 gtk_widget_set_sensitive(ri_stat->label, TRUE);
565 gtk_action_set_sensitive((GtkAction *) ri_stat->menu_item, TRUE);
569 /* Else append some sort of Unicode or ASCII animation to the label? */
570 g_mutex_unlock(recent_mtx);
574 static void welcome_filename_destroy_cb(GtkWidget *w _U_, gpointer data) {
575 recent_item_status *ri_stat = (recent_item_status *) data;
581 g_mutex_lock(recent_mtx);
582 if (ri_stat->timer) {
583 g_source_remove(ri_stat->timer);
587 g_object_unref(ri_stat->menu_item);
589 if (ri_stat->stat_done) {
590 g_free(ri_stat->filename);
591 g_string_free(ri_stat->str, TRUE);
594 ri_stat->label = NULL;
596 g_mutex_unlock(recent_mtx);
599 /* create a "file link widget" */
601 welcome_filename_link_new(const gchar *filename, GtkWidget **label, GObject *menu_item)
608 gsize uni_start, uni_end;
609 const glong max = 60;
610 recent_item_status *ri_stat;
613 str = g_string_new(filename);
614 uni_len = g_utf8_strlen(str->str, str->len);
616 /* cut max filename length */
618 uni_start = g_utf8_offset_to_pointer(str->str, 20) - str->str;
619 uni_end = g_utf8_offset_to_pointer(str->str, uni_len - max) - str->str;
620 g_string_erase(str, uni_start, uni_end);
621 g_string_insert(str, uni_start, " " UTF8_HORIZONTAL_ELLIPSIS " ");
624 /* escape the possibly shortened filename before adding pango language */
625 str_escaped=g_markup_escape_text(str->str, -1);
626 g_string_free(str, TRUE);
629 w = gtk_label_new(str_escaped);
631 gtk_misc_set_padding(GTK_MISC(w), 5, 2);
632 gtk_misc_set_alignment (GTK_MISC(w), 0.0f, 0.0f);
633 gtk_widget_set_sensitive(w, FALSE);
635 ri_stat = g_malloc(sizeof(recent_item_status));
636 ri_stat->filename = g_strdup(filename);
638 ri_stat->menu_item = menu_item;
639 ri_stat->str = g_string_new(str_escaped);
640 ri_stat->stat_done = FALSE;
642 g_object_ref(G_OBJECT(menu_item));
643 g_signal_connect(w, "destroy", G_CALLBACK(welcome_filename_destroy_cb), ri_stat);
646 #if GLIB_CHECK_VERSION(2,31,0)
647 /* XXX - Add the filename here? */
648 g_thread_new("Recent item status", get_recent_item_status, ri_stat);
650 g_thread_create(get_recent_item_status, ri_stat, FALSE, NULL);
652 ri_stat->timer = g_timeout_add(200, update_recent_items, ri_stat);
655 eb = gtk_event_box_new();
656 #if GTK_CHECK_VERSION(3,0,0)
657 gtk_widget_override_background_color(eb, GTK_STATE_NORMAL, &rgba_topic_item_idle_bg);
659 gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_idle_bg);
661 gtk_container_add(GTK_CONTAINER(eb), w);
662 gtk_widget_set_tooltip_text(eb, filename);
664 g_signal_connect(eb, "enter-notify-event", G_CALLBACK(welcome_item_enter_cb), w);
665 g_signal_connect(eb, "leave-notify-event", G_CALLBACK(welcome_item_leave_cb), w);
666 g_signal_connect(eb, "button-press-event", G_CALLBACK(welcome_filename_link_press_cb), (gchar *) filename);
672 /* reset the list of recent files */
674 main_welcome_reset_recent_capture_files(void)
676 GtkWidget *child_box;
678 GList* child_list_item;
681 if(welcome_file_panel_vb) {
682 child_box = scroll_box_dynamic_reset(welcome_file_panel_vb);
683 child_list = gtk_container_get_children(GTK_CONTAINER(child_box));
684 child_list_item = child_list;
686 while(child_list_item) {
687 gtk_container_remove(GTK_CONTAINER(child_box), child_list_item->data);
688 child_list_item = g_list_next(child_list_item);
691 g_list_free(child_list);
696 /* add a new file to the list of recent files */
698 main_welcome_add_recent_capture_file(const char *widget_cf_name, GObject *menu_item)
701 GtkWidget *child_box;
705 w = welcome_filename_link_new(widget_cf_name, &label, menu_item);
706 child_box = scroll_box_dynamic_add(welcome_file_panel_vb);
707 gtk_box_pack_start(GTK_BOX(child_box), w, FALSE, FALSE, 0);
708 gtk_widget_show_all(w);
709 gtk_widget_show_all(child_box);
713 static gboolean select_current_ifaces(GtkTreeModel *model,
722 GtkTreeSelection *selection = (GtkTreeSelection *)userdata;
724 gtk_tree_model_get (model, iter, IFACE_NAME, &if_name, -1);
725 for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
726 device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
727 if (strcmp(device.name, if_name) == 0) {
728 if (device.selected && !gtk_tree_selection_path_is_selected(selection, path)) {
729 gtk_tree_selection_select_iter(selection, iter);
731 gtk_tree_selection_unselect_iter(selection, iter);
739 gboolean on_selection_changed(GtkTreeSelection *selection _U_,
742 gboolean path_currently_selected,
750 gtk_tree_model_get_iter (model, &iter, path);
751 gtk_tree_model_get (model, &iter, IFACE_NAME, &if_name, -1);
752 for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
753 device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
754 if (strcmp(device.name, if_name) == 0) {
755 if (!device.locked) {
756 if (path_currently_selected) {
757 if (device.selected) {
758 device.selected = FALSE;
759 device.locked = TRUE;
760 global_capture_opts.num_selected--;
763 if (!device.selected) {
764 device.selected = TRUE;
765 device.locked = TRUE;
766 global_capture_opts.num_selected++;
769 global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
770 g_array_insert_val(global_capture_opts.all_ifaces, i, device);
772 if (dlg_window_present()) {
773 enable_selected_interface(g_strdup(if_name), device.selected);
775 if (interfaces_dialog_window_present()) {
776 update_selected_interface(g_strdup(if_name));
778 device.locked = FALSE;
779 global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
780 g_array_insert_val(global_capture_opts.all_ifaces, i, device);
788 static gboolean activate_ifaces(GtkTreeModel *model,
789 GtkTreePath *path _U_,
795 GtkTreeSelection *selection;
796 selected_name_t *entry = (selected_name_t *)userdata;
798 view = g_object_get_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES);
799 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
800 gtk_tree_model_get (model, iter, IFACE_NAME, &if_name, -1);
801 if (strcmp(if_name, entry->name) == 0) {
802 if (entry->activate) {
803 gtk_tree_selection_select_iter(selection, iter);
805 gtk_tree_selection_unselect_iter(selection, iter);
812 void change_interface_selection(gchar* name, gboolean activate)
816 selected_name_t entry;
818 view = g_object_get_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES);
819 model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
820 entry.name = g_strdup(name);
821 entry.activate = activate;
822 gtk_tree_model_foreach(GTK_TREE_MODEL(model), (GtkTreeModelForeachFunc)(activate_ifaces), (gpointer) &entry);
825 void change_selection_for_all(gboolean enable)
829 for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
830 change_interface_selection(g_array_index(global_capture_opts.all_ifaces, interface_t, i).name, enable);
841 GtkTreeSelection *entry;
843 if (global_capture_opts.num_selected > 0 && swindow) {
844 view = g_object_get_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES);
845 model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
846 entry = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
847 gtk_tree_model_foreach(GTK_TREE_MODEL(model), select_current_ifaces, (gpointer) entry);
848 gtk_widget_grab_focus(view);
855 change_interface_name(gchar *oldname, guint index)
861 GtkTreeSelection *entry;
864 view = g_object_get_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES);
865 entry = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
866 model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
868 device = g_array_index(global_capture_opts.all_ifaces, interface_t, index);
869 if (gtk_tree_model_get_iter_first (model, &iter)) {
871 gtk_tree_model_get(model, &iter, IFACE_NAME, &optname, -1);
872 if (strcmp(optname, oldname) == 0) {
873 gtk_list_store_set(GTK_LIST_STORE(model), &iter, ICON, gtk_image_get_pixbuf(GTK_IMAGE(capture_get_if_icon(&device))), IFACE_DESCR, device.display_name, IFACE_NAME, device.name, -1);
874 if (device.selected) {
875 gtk_tree_selection_select_iter(entry, &iter);
879 } while (gtk_tree_model_iter_next(model, &iter));
885 #ifdef HAVE_PCAP_REMOTE
887 add_interface_to_list(guint index)
889 GtkWidget *view, *icon;
896 device = g_array_index(global_capture_opts.all_ifaces, interface_t, index);
897 icon = pixbuf_to_widget(remote_sat_pb_data);
898 view = g_object_get_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES);
899 model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
900 size = gtk_tree_model_iter_n_children(model, NULL);
901 lines = g_strdup_printf("%d", size-1);
902 if (gtk_tree_model_get_iter_from_string(model, &iter, lines)) {
903 gtk_list_store_append (GTK_LIST_STORE(model), &iter);
904 gtk_list_store_set(GTK_LIST_STORE(model), &iter, ICON, gtk_image_get_pixbuf(GTK_IMAGE(icon)), IFACE_DESCR, device.display_name, IFACE_NAME, device.name, -1);
911 clear_capture_box(void)
915 item_hb = g_object_get_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_INTERFACE_LIST);
917 gtk_widget_destroy(item_hb);
919 item_hb = g_object_get_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_START);
921 gtk_widget_destroy(item_hb);
923 item_hb = g_object_get_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_CAPTURE);
925 gtk_widget_destroy(item_hb);
928 gtk_widget_destroy(swindow);
934 static void fill_capture_box(void)
936 GtkWidget *box_to_fill;
937 GtkWidget *item_hb_interface_list, *item_hb_capture, *item_hb_start, *label, *w;
941 GtkTreeSelection *selection;
942 GtkCellRenderer *renderer;
943 GtkTreeViewColumn *column;
948 DWORD chimney_enabled = 0;
949 DWORD ce_size = sizeof(chimney_enabled);
952 label = g_object_get_data(G_OBJECT(welcome_hb), CAPTURE_LABEL);
954 gtk_widget_destroy(label);
956 box_to_fill = g_object_get_data(G_OBJECT(welcome_hb), CAPTURE_VIEW);
957 if (global_capture_opts.all_ifaces->len > 0) {
958 item_hb_interface_list = welcome_button(WIRESHARK_STOCK_CAPTURE_INTERFACES,
960 "Live list of the capture interfaces\n(counts incoming packets)",
961 "Same as Capture/Interfaces menu or toolbar item",
962 welcome_button_callback_helper, capture_if_cb);
963 gtk_box_pack_start(GTK_BOX(box_to_fill), item_hb_interface_list, FALSE, FALSE, 5);
964 swindow = gtk_scrolled_window_new (NULL, NULL);
965 gtk_widget_set_size_request(swindow, FALSE, 100);
966 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(swindow), GTK_SHADOW_IN);
967 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
968 g_object_set_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_INTERFACE_LIST, item_hb_interface_list);
970 if_view = gtk_tree_view_new ();
971 g_object_set(G_OBJECT(if_view), "headers-visible", FALSE, NULL);
972 g_signal_connect(if_view, "row-activated", G_CALLBACK(options_interface_cb), (gpointer)welcome_hb);
973 g_object_set_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES, if_view);
974 column = gtk_tree_view_column_new();
975 renderer = gtk_cell_renderer_pixbuf_new();
976 gtk_tree_view_column_pack_start(column, renderer, FALSE);
977 gtk_tree_view_column_set_attributes(column, renderer, "pixbuf", ICON, NULL);
978 renderer = gtk_cell_renderer_text_new();
979 gtk_tree_view_column_pack_start(column, renderer, TRUE);
980 gtk_tree_view_column_set_attributes(column, renderer, "text", IFACE_DESCR, NULL);
981 gtk_tree_view_append_column(GTK_TREE_VIEW(if_view), column);
982 gtk_tree_view_column_set_resizable(gtk_tree_view_get_column(GTK_TREE_VIEW(if_view), 0), TRUE);
983 renderer = gtk_cell_renderer_text_new();
984 column = gtk_tree_view_column_new_with_attributes ("",
985 GTK_CELL_RENDERER(renderer),
988 gtk_tree_view_append_column(GTK_TREE_VIEW(if_view), column);
989 gtk_tree_view_column_set_visible(column, FALSE);
990 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(if_view));
991 gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
992 item_hb_start = welcome_button(WIRESHARK_STOCK_CAPTURE_START,
994 "Choose one or more interfaces to capture from, then <b>Start</b>",
995 "Same as Capture/Interfaces with default options",
996 (welcome_button_callback_t)capture_if_start, (gpointer)if_view);
997 gtk_box_pack_start(GTK_BOX(box_to_fill), item_hb_start, FALSE, FALSE, 5);
998 welcome_if_tree_load();
999 gtk_container_add (GTK_CONTAINER (swindow), if_view);
1000 gtk_container_add(GTK_CONTAINER(box_to_fill), swindow);
1001 g_object_set_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_START, item_hb_start);
1003 item_hb_capture = welcome_button(WIRESHARK_STOCK_CAPTURE_OPTIONS,
1005 "Start a capture with detailed options",
1006 "Same as Capture/Options menu or toolbar item",
1007 welcome_button_callback_helper, capture_prep_cb);
1008 gtk_box_pack_start(GTK_BOX(box_to_fill), item_hb_capture, FALSE, FALSE, 5);
1009 g_object_set_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_CAPTURE, item_hb_capture);
1011 /* Check for chimney offloading */
1012 reg_ret = RegQueryValueEx(HKEY_LOCAL_MACHINE,
1013 _T("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\EnableTCPChimney"),
1014 NULL, NULL, (LPBYTE) &chimney_enabled, &ce_size);
1015 if (reg_ret == ERROR_SUCCESS && chimney_enabled) {
1016 item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
1017 "Offloading Detected",
1018 "TCP Chimney offloading is enabled. You \nmight not capture much data.",
1019 topic_online_url(ONLINEPAGE_CHIMNEY),
1020 topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_CHIMNEY));
1021 gtk_box_pack_start(GTK_BOX(box_to_fill), item_hb_capture, FALSE, FALSE, 5);
1026 clear_capture_box();
1028 if (error != NO_INTERFACES_FOUND) {
1029 if (error == CANT_GET_INTERFACE_LIST) {
1030 label_text = g_strdup("No interface can be used for capturing in "
1031 "this system with the current configuration.\n"
1033 "See Capture Help below for details.");
1035 label_text = g_strdup("WinPcap doesn't appear to be installed. "
1036 "In order to capture packets, WinPcap "
1037 "must be installed; see\n"
1039 #if GTK_CHECK_VERSION(2,18,0)
1040 " <a href=\"http://www.winpcap.org/\">http://www.winpcap.org/</a>\n"
1042 " http://www.winpcap.org/\n"
1045 "or the mirror at\n"
1047 #if GTK_CHECK_VERSION(2,18,0)
1048 " <a href=\"http://www.mirrors.wiretapped.net/security/packet-capture/winpcap/\">http://www.mirrors.wiretapped.net/security/packet-capture/winpcap/</a>\n"
1050 " http://www.mirrors.wiretapped.net/security/packet-capture/winpcap/\n"
1053 "or the mirror at\n"
1055 #if GTK_CHECK_VERSION(2,18,0)
1056 " <a href=\"http://winpcap.cs.pu.edu.tw/\">http://winpcap.cs.pu.edu.tw/</a>\n"
1058 " http://winpcap.cs.pu.edu.tw/\n"
1061 "for a downloadable version of WinPcap "
1062 "and for instructions on how to install "
1066 label_text = g_strdup("No interface can be used for capturing in "
1067 "this system with the current configuration.\n"
1069 "See Capture Help below for details.");
1071 w = gtk_label_new(label_text);
1072 gtk_label_set_markup(GTK_LABEL(w), label_text);
1073 gtk_label_set_line_wrap(GTK_LABEL(w), TRUE);
1074 g_free (label_text);
1075 gtk_misc_set_alignment (GTK_MISC(w), 0.0f, 0.0f);
1076 gtk_box_pack_start(GTK_BOX(box_to_fill), w, FALSE, FALSE, 5);
1077 #if GTK_CHECK_VERSION(2,18,0)
1078 g_signal_connect(w, "activate-link", G_CALLBACK(activate_link_cb), NULL);
1080 g_object_set_data(G_OBJECT(welcome_hb), CAPTURE_LABEL, w);
1085 /* list the interfaces */
1087 welcome_if_tree_load(void)
1091 GtkListStore *store = NULL;
1093 GtkTreeSelection *entry;
1095 gboolean changed = FALSE;
1098 if (if_view && swindow) {
1099 entry = gtk_tree_view_get_selection(GTK_TREE_VIEW(if_view));
1100 gtk_tree_selection_unselect_all(GTK_TREE_SELECTION(entry));
1101 store = gtk_list_store_new(NUMCOLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
1103 gtk_list_store_clear(store);
1104 gtk_tree_view_set_model(GTK_TREE_VIEW(if_view), GTK_TREE_MODEL (store));
1105 /* LOAD THE INTERFACES */
1106 if (global_capture_opts.all_ifaces->len == 0) {
1107 scan_local_interfaces(&global_capture_opts, &error);
1108 if (global_capture_opts.all_ifaces->len == 0) {
1112 for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
1113 device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
1114 if (!device.hidden) {
1115 gtk_list_store_append (store, &iter);
1116 gtk_list_store_set (store, &iter, ICON, gtk_image_get_pixbuf(GTK_IMAGE(capture_get_if_icon(&device))), IFACE_DESCR, device.display_name, IFACE_NAME, device.name, -1);
1117 if (device.selected) {
1118 gtk_tree_selection_select_iter(entry, &iter);
1123 gtk_tree_selection_set_select_function(GTK_TREE_SELECTION(entry), on_selection_changed, (gpointer)&changed, NULL);
1124 if (gtk_widget_is_focus(GTK_WIDGET(if_view)) && dlg_window_present()) {
1131 #endif /* HAVE_LIBPCAP */
1135 /* reload the list of interfaces */
1137 welcome_if_panel_reload(void)
1141 welcome_if_tree_load();
1142 gtk_widget_show_all(welcome_hb);
1144 #endif /* HAVE_LIBPCAP */
1148 static void capture_if_start(GtkWidget *w _U_, gpointer data _U_)
1154 if (global_capture_opts.num_selected == 0) {
1155 simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
1156 "You didn't specify an interface on which to capture packets.");
1160 /* XXX - remove this? */
1161 if (global_capture_opts.save_file) {
1162 g_free(global_capture_opts.save_file);
1163 global_capture_opts.save_file = NULL;
1165 #ifdef HAVE_AIRPCAP /* TODO: don't let it depend on interface_opts */
1166 for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
1167 device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
1168 airpcap_if_active = get_airpcap_if_from_name(airpcap_if_list, device.name);
1169 airpcap_if_selected = airpcap_if_active;
1170 if (airpcap_if_selected) {
1174 airpcap_set_toolbar_start_capture(airpcap_if_active);
1176 capture_start_cb(NULL, NULL);
1181 #if GTK_CHECK_VERSION(2,18,0)
1183 activate_link_cb(GtkLabel *label _U_, gchar *uri, gpointer user_data _U_)
1185 return browser_open_url(uri);
1190 /* create the welcome page */
1194 GtkWidget *welcome_scrollw;
1195 GtkWidget *welcome_eb;
1196 GtkWidget *welcome_vb;
1197 GtkWidget *column_vb;
1201 GtkWidget *topic_vb;
1202 GtkWidget *topic_to_fill;
1203 GtkWidget *topic_capture_to_fill;
1205 GtkWidget *file_child_box;
1210 DWORD chimney_enabled = 0;
1211 DWORD ce_size = sizeof(chimney_enabled);
1213 /* prepare colors */
1215 /* Allocating color isn't necessary? */
1217 /* "page" background */
1218 get_color(&welcome_bg);
1220 /* header bar background color */
1221 get_color(&header_bar_bg);
1223 /* topic header background color */
1224 get_color(&topic_header_bg);
1226 /* topic content background color */
1227 get_color(&topic_content_bg);
1229 #if GTK_CHECK_VERSION(3,0,0)
1230 rgba_topic_item_idle_bg = rgba_topic_content_bg;
1232 topic_item_idle_bg = topic_content_bg;
1235 /* Allocating collor isn't necessary? */
1236 /* topic item entered color */
1237 get_color(&topic_item_entered_bg);
1239 welcome_scrollw = scrolled_window_new(NULL, NULL);
1241 welcome_vb = gtk_vbox_new(FALSE, 0);
1243 welcome_eb = gtk_event_box_new();
1244 gtk_container_add(GTK_CONTAINER(welcome_eb), welcome_vb);
1245 #if GTK_CHECK_VERSION(3,0,0)
1246 gtk_widget_override_background_color(welcome_eb, GTK_STATE_NORMAL, &rgba_welcome_bg);
1248 gtk_widget_modify_bg(welcome_eb, GTK_STATE_NORMAL, &welcome_bg);
1251 header = welcome_header_new();
1252 gtk_box_pack_start(GTK_BOX(welcome_vb), header, FALSE, FALSE, 0);
1255 welcome_hb = gtk_hbox_new(FALSE, 10);
1256 gtk_container_set_border_width(GTK_CONTAINER(welcome_hb), 10);
1257 gtk_box_pack_start(GTK_BOX(welcome_vb), welcome_hb, TRUE, TRUE, 0);
1260 /* column capture */
1261 column_vb = gtk_vbox_new(FALSE, 10);
1262 #if GTK_CHECK_VERSION(3,0,0)
1263 gtk_widget_override_background_color(column_vb, GTK_STATE_NORMAL, &rgba_welcome_bg);
1265 gtk_widget_modify_bg(column_vb, GTK_STATE_NORMAL, &welcome_bg);
1267 gtk_box_pack_start(GTK_BOX(welcome_hb), column_vb, TRUE, TRUE, 0);
1270 topic_vb = welcome_topic_new("Capture", &topic_capture_to_fill);
1271 gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
1272 g_object_set_data(G_OBJECT(welcome_hb), CAPTURE_VIEW, topic_capture_to_fill);
1275 if (global_capture_opts.all_ifaces->len == 0) {
1276 scan_local_interfaces(&global_capture_opts, &error);
1281 /* capture help topic */
1282 topic_vb = welcome_topic_new("Capture Help", &topic_to_fill);
1283 gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
1285 item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
1287 "Step by step to a successful capture setup",
1288 topic_online_url(ONLINEPAGE_CAPTURE_SETUP),
1289 topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_CAPTURE_SETUP));
1290 gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
1292 item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
1294 "Specific information for capturing on:\nEthernet, WLAN, ...",
1295 topic_online_url(ONLINEPAGE_NETWORK_MEDIA),
1296 topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_NETWORK_MEDIA));
1297 gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
1299 label_text = g_strdup("<span foreground=\"black\">Capturing is not compiled into\nthis version of Wireshark!</span>");
1300 w = gtk_label_new(label_text);
1301 gtk_label_set_markup(GTK_LABEL(w), label_text);
1302 g_free (label_text);
1303 gtk_misc_set_alignment (GTK_MISC(w), 0.0f, 0.0f);
1304 gtk_box_pack_start(GTK_BOX(topic_capture_to_fill), w, FALSE, FALSE, 5);
1305 #endif /* HAVE_LIBPCAP */
1307 /* fill bottom space */
1308 w = gtk_label_new("");
1309 gtk_box_pack_start(GTK_BOX(topic_capture_to_fill), w, TRUE, TRUE, 0);
1313 topic_vb = welcome_topic_new("Files", &topic_to_fill);
1314 gtk_box_pack_start(GTK_BOX(welcome_hb), topic_vb, TRUE, TRUE, 0);
1316 item_hb = welcome_button(GTK_STOCK_OPEN,
1318 "Open a previously captured file",
1319 "Same as File/Open menu or toolbar item",
1320 welcome_button_callback_helper, file_open_cmd_cb);
1321 gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
1323 /* prepare list of recent files (will be filled in later) */
1324 label_text = g_strdup("<span foreground=\"black\">Open Recent:</span>");
1325 w = gtk_label_new(label_text);
1326 gtk_label_set_markup(GTK_LABEL(w), label_text);
1327 g_free (label_text);
1328 gtk_misc_set_alignment (GTK_MISC(w), 0.0f, 0.0f);
1329 gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 5);
1331 file_child_box = gtk_vbox_new(FALSE, 1);
1332 /* 17 file items or 300 pixels height is about the size */
1333 /* that still fits on a screen of about 1000*700 */
1334 welcome_file_panel_vb = scroll_box_dynamic_new(GTK_WIDGET(file_child_box), 17, 300);
1335 gtk_box_pack_start(GTK_BOX(topic_to_fill), welcome_file_panel_vb, FALSE, FALSE, 0);
1337 item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
1339 "A rich assortment of example capture files on the wiki",
1340 topic_online_url(ONLINEPAGE_SAMPLE_CAPTURES),
1341 topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_SAMPLE_CAPTURES));
1342 gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
1344 /* fill bottom space */
1345 w = gtk_label_new("");
1346 gtk_box_pack_start(GTK_BOX(topic_to_fill), w, TRUE, TRUE, 0);
1350 column_vb = gtk_vbox_new(FALSE, 10);
1351 gtk_box_pack_start(GTK_BOX(welcome_hb), column_vb, TRUE, TRUE, 0);
1354 topic_vb = welcome_topic_new("Online", &topic_to_fill);
1355 gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
1357 item_hb = welcome_button(GTK_STOCK_HOME,
1359 "Visit the project's website",
1360 topic_online_url(ONLINEPAGE_HOME),
1361 topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_HOME));
1362 gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
1365 item_hb = welcome_button(GTK_STOCK_HELP,
1368 "(local version, if installed)",
1369 "Locally installed (if installed) otherwise online version",
1370 topic_menu_cb, GINT_TO_POINTER(HELP_CONTENT));
1372 item_hb = welcome_button(GTK_STOCK_HELP,
1376 topic_online_url(ONLINEPAGE_USERGUIDE),
1377 topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_USERGUIDE));
1379 gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
1381 item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
1383 "Work with Wireshark as securely as possible",
1384 topic_online_url(ONLINEPAGE_SECURITY),
1385 topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_SECURITY));
1386 gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
1389 /* XXX - add this, once the Windows update functionality is implemented */
1391 topic_vb = welcome_topic_new("Updates", &topic_to_fill);
1392 gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
1394 label_text = g_strdup("<span foreground=\"black\">No updates available!</span>");
1395 w = gtk_label_new(label_text);
1396 gtk_label_set_markup(GTK_LABEL(w), label_text);
1397 g_free (label_text);
1398 gtk_box_pack_start(GTK_BOX(topic_to_fill), w, TRUE, TRUE, 0);
1403 gtk_widget_show_all(welcome_eb);
1405 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(welcome_scrollw),
1407 gtk_widget_show_all(welcome_scrollw);
1409 #if GLIB_CHECK_VERSION(2,31,0)
1410 recent_mtx = g_malloc(sizeof(GMutex));
1411 g_mutex_init(recent_mtx);
1413 recent_mtx = g_mutex_new();
1416 return welcome_scrollw;
1419 GtkWidget* get_welcome_window(void)