From: ulfl Date: Tue, 15 Apr 2008 22:46:35 +0000 (+0000) Subject: further work on the yet to come welcome page ... X-Git-Url: http://git.samba.org/samba.git/?p=obnox%2Fwireshark%2Fwip.git;a=commitdiff_plain;h=9a53207997273d475fae5d6d5de4bb496da01dc3;ds=sidebyside further work on the yet to come welcome page ... git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25057 f5534014-38df-0310-8fa8-9805f1628bb7 --- diff --git a/gtk/main_menu.c b/gtk/main_menu.c index 157c920a21..c770e9edd8 100644 --- a/gtk/main_menu.c +++ b/gtk/main_menu.c @@ -87,6 +87,7 @@ #include "gtk/main_menu.h" #include "gtk/main_packet_list.h" #include "gtk/main_toolbar.h" +#include "gtk/main_welcome.h" typedef struct _menu_item { @@ -1594,6 +1595,8 @@ set_menu_object_data (const gchar *path, const gchar *key, gpointer data) { #define MENU_RECENT_FILES_PATH "/File/Open Recent" #define MENU_RECENT_FILES_KEY "Recent File Name" + + static void update_menu_recent_capture_file1(GtkWidget *widget, gpointer cnt) { gchar *widget_cf_name; @@ -1603,15 +1606,20 @@ update_menu_recent_capture_file1(GtkWidget *widget, gpointer cnt) { /* if this menu item is a file, count it */ if (widget_cf_name) { (*(guint *)cnt)++; + main_welcome_add_recent_capture_files(widget_cf_name); } } + /* update the menu */ static void update_menu_recent_capture_file(GtkWidget *submenu_recent_files) { guint cnt = 0; + + main_welcome_reset_recent_capture_files(); + gtk_container_foreach(GTK_CONTAINER(submenu_recent_files), update_menu_recent_capture_file1, &cnt); @@ -1620,6 +1628,40 @@ update_menu_recent_capture_file(GtkWidget *submenu_recent_files) { } + +/* remove the capture filename from the "Recent Files" menu */ +static void +remove_menu_recent_capture_filename(gchar *cf_name) { + GtkWidget *submenu_recent_files; + GList* child_list; + GList* child_list_item; + GtkWidget *menu_item_child; + gchar *menu_item_cf_name; + + + /* get the submenu container item */ + submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH); + + /* find the corresponding menu item to be removed */ + child_list = gtk_container_get_children(GTK_CONTAINER(submenu_recent_files)); + child_list_item = child_list; + while(child_list_item) { + menu_item_child = (GTK_BIN(child_list_item->data))->child; + gtk_label_get(GTK_LABEL(menu_item_child), &menu_item_cf_name); + if(strcmp(menu_item_cf_name, cf_name) == 0) { + /* XXX: is this all we need to do, to free the menu item and its label? + The reference count of widget will go to 0, so it'll be freed; + will that free the label? */ + gtk_container_remove(GTK_CONTAINER(submenu_recent_files), child_list_item->data); + } + child_list_item = g_list_next(child_list_item); + } + g_list_free(child_list); + + update_menu_recent_capture_file(submenu_recent_files); +} + + /* remove the capture filename from the "Recent Files" menu */ static void remove_menu_recent_capture_file(GtkWidget *widget, gpointer unused _U_) { @@ -1640,7 +1682,7 @@ remove_menu_recent_capture_file(GtkWidget *widget, gpointer unused _U_) { } -/* callback, if the user pushed the item */ +/* callback, if the user pushed the menu item */ static void clear_menu_recent_capture_file_cmd_cb(GtkWidget *w _U_, gpointer unused _U_) { GtkWidget *submenu_recent_files; @@ -1655,6 +1697,29 @@ clear_menu_recent_capture_file_cmd_cb(GtkWidget *w _U_, gpointer unused _U_) { } +/* Open a file by it's name + (Beware: will not ask to close existing capture file!) */ +void +menu_open_filename(gchar *cf_name) +{ + GtkWidget *submenu_recent_files; + int err; + + submenu_recent_files = gtk_item_factory_get_widget(main_menu_factory, MENU_RECENT_FILES_PATH); + + /* open and read the capture file (this will close an existing file) */ + if (cf_open(&cfile, cf_name, FALSE, &err) == CF_OK) { + cf_read(&cfile); + } else { + /* the capture file isn't existing any longer, remove menu item */ + /* XXX: ask user to remove item, it's maybe only a temporary problem */ + remove_menu_recent_capture_filename(cf_name); + } + + update_menu_recent_capture_file(submenu_recent_files); +} + + /* callback, if the user pushed a recent file submenu item */ void menu_open_recent_file_cmd(GtkWidget *w) @@ -1682,7 +1747,7 @@ menu_open_recent_file_cmd(GtkWidget *w) update_menu_recent_capture_file(submenu_recent_files); } -static void menu_open_recent_file_answered_cb(gpointer dialog _U_, gint btn, gpointer data _U_) +static void menu_open_recent_file_answered_cb(gpointer dialog _U_, gint btn, gpointer data) { switch(btn) { case(ESD_BTN_YES): diff --git a/gtk/main_menu.h b/gtk/main_menu.h index c0503b093d..d68961ed82 100644 --- a/gtk/main_menu.h +++ b/gtk/main_menu.h @@ -33,6 +33,10 @@ extern "C" { (duplicates will be ignored) */ extern void add_menu_recent_capture_file(gchar *cf_name); +/* Open a file(name) + (will not ask to close existing capture file!) */ +extern void menu_open_filename(gchar *cf_name); + /** @file * Menubar and context menus. * @ingroup main_window_group diff --git a/gtk/main_welcome.c b/gtk/main_welcome.c index 0c2a5bb5be..a8514cedfb 100644 --- a/gtk/main_welcome.c +++ b/gtk/main_welcome.c @@ -28,12 +28,20 @@ #include +#include + #include "../color.h" +#include "capture.h" +#include "capture-pcap-util.h" +#include "capture_opts.h" +#include "simple_dialog.h" #include "gtk/gui_utils.h" #include "gtk/color_utils.h" #include "gtk/recent.h" #include "gtk/gtkglobals.h" +#include "gtk/main.h" +#include "gtk/main_menu.h" #include "gtk/main_welcome.h" #include "gtk/capture_dlg.h" #include "gtk/capture_file_dlg.h" @@ -41,6 +49,8 @@ #include "gtk/stock_icons.h" + + /* XXX - There seems to be some disagreement about if and how this feature should be implemented. As I currently don't have the time to continue this, it's temporarily disabled. - ULFL */ /*#define SHOW_WELCOME_PAGE*/ @@ -53,22 +63,31 @@ #ifdef SHOW_WELCOME_PAGE +/* XXX */ +extern gint if_list_comparator_alph (const void *first_arg, const void *second_arg); + + GdkColor topic_item_entered_bg; GdkColor topic_content_bg; GdkColor header_bar_bg; GdkColor topic_header_bg; +GtkWidget *welcome_file_panel_vb = NULL; + + +/* mouse entered this widget - change background color */ static gboolean -welcome_item_enter_cb(GtkWidget *eb, GdkEventCrossing *event _U_, gpointer user_data) +welcome_item_enter_cb(GtkWidget *eb, GdkEventCrossing *event _U_, gpointer user_data _U_) { gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_entered_bg); return FALSE; } +/* mouse has left this widget - change background color */ static gboolean -welcome_item_leave_cb(GtkWidget *eb, GdkEvent *event _U_, gpointer user_data) +welcome_item_leave_cb(GtkWidget *eb, GdkEvent *event _U_, gpointer user_data _U_) { gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_content_bg); @@ -76,19 +95,9 @@ welcome_item_leave_cb(GtkWidget *eb, GdkEvent *event _U_, gpointer user_data) } -static gboolean -welcome_item_press_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer data _U_) { - - g_warning("TBD: item pressed"); - - return FALSE; -} - - - - +/* create a "button widget" */ GtkWidget * -welcome_item(const gchar *stock_item, const gchar * title, const gchar * subtitle, +welcome_button(const gchar *stock_item, const gchar * title, const gchar * subtitle, GtkSignalFunc callback, void *callback_data) { GtkWidget *eb, *w, *item_hb, *text_vb; @@ -97,7 +106,7 @@ welcome_item(const gchar *stock_item, const gchar * title, const gchar * subtitl item_hb = gtk_hbox_new(FALSE, 1); - /* event box */ + /* event box (for background color and events) */ eb = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eb), item_hb); gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_content_bg); @@ -135,6 +144,7 @@ welcome_item(const gchar *stock_item, const gchar * title, const gchar * subtitl } +/* create the banner "above our heads" */ GtkWidget * welcome_header_new(void) { @@ -171,6 +181,7 @@ welcome_header_new(void) } +/* create a "topic header widget" */ GtkWidget * welcome_topic_header_new(const char *header) { @@ -193,6 +204,7 @@ welcome_topic_header_new(const char *header) } +/* create a "topic widget" */ GtkWidget * welcome_topic_new(const char *header, GtkWidget **to_fill) { @@ -221,26 +233,40 @@ welcome_topic_new(const char *header, GtkWidget **to_fill) } +/* a file link was pressed */ static gboolean -welcome_link_press_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer data _U_) { - - g_warning("TBD: link pressed"); +welcome_filename_link_press_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer data) +{ + menu_open_filename(data); return FALSE; } + +/* create a "file link widget" */ GtkWidget * -welcome_link_new(const gchar *text, GtkWidget **label /*, void *callback, void *private_data */) +welcome_filename_link_new(const gchar *filename, GtkWidget **label) { - gchar *message; GtkWidget *w; GtkWidget *eb; + GString *str; + const unsigned int max = 60; - message = g_strdup_printf("%s", text); - w = gtk_label_new(message); + + str = g_string_new(filename); + + if(str->len > max) { + g_string_erase(str, 0, str->len-max /*cut*/); + g_string_prepend(str, "... "); + } + + g_string_prepend(str, ""); + g_string_append(str, ""); + + w = gtk_label_new(str->str); *label = w; - gtk_label_set_markup(GTK_LABEL(w), message); - g_free(message); + gtk_label_set_markup(GTK_LABEL(w), str->str); + gtk_misc_set_padding(GTK_MISC(w), 5, 2); /* event box */ eb = gtk_event_box_new(); @@ -248,49 +274,53 @@ welcome_link_new(const gchar *text, GtkWidget **label /*, void *callback, void * g_signal_connect(eb, "enter-notify-event", G_CALLBACK(welcome_item_enter_cb), w); g_signal_connect(eb, "leave-notify-event", G_CALLBACK(welcome_item_leave_cb), w); - g_signal_connect(eb, "button-press-event", G_CALLBACK(welcome_link_press_cb), w); + g_signal_connect(eb, "button-press-event", G_CALLBACK(welcome_filename_link_press_cb), (gchar *) filename); + + g_string_free(str, TRUE); return eb; } -GtkWidget * -welcome_filename_link_new(const char *filename, GtkWidget **label) -{ - GString *str; - GtkWidget *w; - const unsigned int max = 60; - - str = g_string_new(filename); +/* reset the list of recent files */ +void +main_welcome_reset_recent_capture_files() +{ + GList* child_list; + GList* child_list_item; + + child_list = gtk_container_get_children(GTK_CONTAINER(welcome_file_panel_vb)); + child_list_item = child_list; - if(str->len > max) { - g_string_erase(str, 0, str->len-max /*cut*/); - g_string_prepend(str, "... "); + while(child_list_item) { + gtk_container_remove(GTK_CONTAINER(welcome_file_panel_vb), child_list_item->data); + child_list_item = g_list_next(child_list_item); } - w = welcome_link_new(str->str, label); - - g_string_free(str, TRUE); - - return w; + g_list_free(child_list); } -#include -#include "capture.h" -#include "capture-pcap-util.h" -#include "capture_opts.h" -#include "main.h" -#include "simple_dialog.h" +/* add a new file to the list of recent files */ +void +main_welcome_add_recent_capture_files(const char *widget_cf_name) +{ + GtkWidget *w; + GtkWidget *label; -extern gint if_list_comparator_alph (const void *first_arg, const void *second_arg); + w = welcome_filename_link_new(widget_cf_name, &label); + gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &topic_content_bg); + gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); + gtk_box_pack_start(GTK_BOX(welcome_file_panel_vb), w, FALSE, FALSE, 0); + gtk_widget_show_all(w); +} +#ifdef HAVE_LIBPCAP +/* user clicked on an interface button */ static gboolean -welcome_if_press_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer data) { - - //g_warning("TBD: start capture pressed"); - +welcome_if_press_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer data) +{ if (capture_opts->iface) g_free(capture_opts->iface); if (capture_opts->iface_descr) @@ -298,7 +328,8 @@ welcome_if_press_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer data) { capture_opts->iface = g_strdup(data); capture_opts->iface_descr = NULL; - //capture_opts->iface_descr = get_interface_descriptive_name(capture_opts->iface); + /* XXX - fix this */ + /*capture_opts->iface_descr = get_interface_descriptive_name(capture_opts->iface);*/ /* XXX - remove this? */ if (capture_opts->save_file) { @@ -312,8 +343,8 @@ welcome_if_press_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer data) { } -#ifdef HAVE_LIBPCAP -GtkWidget * +/* create a single interface entry */ +static GtkWidget * welcome_if_new(const char *if_name, GdkColor *topic_bg, gpointer interf) { GtkWidget *interface_hb; @@ -358,22 +389,7 @@ welcome_if_new(const char *if_name, GdkColor *topic_bg, gpointer interf) } -/* - * Sorts the Interface List in alphabetical order - */ -/*gint if_list_comparator_alph (const void *first_arg, const void *second_arg){ - const if_info_t *first = first_arg, *second = second_arg; - - if (first != NULL && first->description != NULL && - second != NULL && second->description != NULL) { - return g_ascii_strcasecmp(first->description, second->description); - } else { - return 0; - } -}*/ - - - +/* create the list of interfaces */ GtkWidget * welcome_if_panel_new(void) { @@ -386,7 +402,7 @@ int err; gchar *err_str; int ifs; GList *curr; - //if_dlg_data_t *if_dlg_data; + /*if_dlg_data_t *if_dlg_data;*/ panel_vb = gtk_vbox_new(FALSE, 0); @@ -415,7 +431,7 @@ int err; /* List the interfaces */ for(ifs = 0; (curr = g_list_nth(if_list, ifs)); ifs++) { - //g_string_assign(if_tool_str, ""); + /*g_string_assign(if_tool_str, "");*/ if_info = curr->data; /* Continue if capture device is hidden */ @@ -423,20 +439,20 @@ int err; continue; } - //if_dlg_data = g_malloc0(sizeof(if_dlg_data_t)); - //if_dlg_data->if_info = *if_info; + /*if_dlg_data = g_malloc0(sizeof(if_dlg_data_t));*/ + /*if_dlg_data->if_info = *if_info;*/ /* Kind of adaptor (icon) */ - //icon = xpm_to_widget(capture_ethernet_16_xpm); - //gtk_table_attach_defaults(GTK_TABLE(if_tb), icon, 0, 1, row, row+1); + /*icon = xpm_to_widget(capture_ethernet_16_xpm);*/ + /*gtk_table_attach_defaults(GTK_TABLE(if_tb), icon, 0, 1, row, row+1);*/ /* description */ - //if (if_info->description != NULL) - //if_dlg_data->descr_lb = gtk_label_new(if_info->description); - //else - //if_dlg_data->descr_lb = gtk_label_new(""); - //gtk_misc_set_alignment(GTK_MISC(if_dlg_data->descr_lb), 0.0, 0.5); - //gtk_table_attach_defaults(GTK_TABLE(if_tb), if_dlg_data->descr_lb, 2, 3, row, row+1); + /*if (if_info->description != NULL)*/ + /*if_dlg_data->descr_lb = gtk_label_new(if_info->description);*/ + /*else*/ + /*if_dlg_data->descr_lb = gtk_label_new("");*/ + /*gtk_misc_set_alignment(GTK_MISC(if_dlg_data->descr_lb), 0.0, 0.5);*/ + /*gtk_table_attach_defaults(GTK_TABLE(if_tb), if_dlg_data->descr_lb, 2, 3, row, row+1);*/ #if 0 if (if_info->description) { @@ -483,25 +499,12 @@ int err; free_interface_list(if_list); -#if 0 - /* Generic dialup */ - interface_hb = welcome_if_new("Generic dialup adapter", &topic_content_bg, TRUE); - gtk_box_pack_start(GTK_BOX(panel_vb), interface_hb, FALSE, FALSE, 2); - - /* Marvell interface */ - interface_hb = welcome_if_new("Marvell Gigabit Ethernet Controller", &topic_content_bg, TRUE); - gtk_box_pack_start(GTK_BOX(panel_vb), interface_hb, FALSE, FALSE, 2); - - /* Wireless interface */ - interface_hb = welcome_if_new("Intel(R) PRO/Wireless 3945ABG Network Connection", &topic_content_bg, TRUE); - gtk_box_pack_start(GTK_BOX(panel_vb), interface_hb, FALSE, FALSE, 2); -#endif - return panel_vb; } #endif /* HAVE_LIBPCAP */ +/* create the welcome page */ GtkWidget * welcome_new(void) { @@ -511,7 +514,6 @@ welcome_new(void) GtkWidget *column_vb; GtkWidget *item_hb; GtkWidget *w; - GtkWidget *label; GtkWidget *header; GtkWidget *topic_vb; GtkWidget *topic_to_fill; @@ -560,6 +562,7 @@ welcome_new(void) gtk_container_border_width(GTK_CONTAINER(welcome_hb), 10); gtk_box_pack_start(GTK_BOX(welcome_vb), welcome_hb, TRUE, TRUE, 0); + /* column capture */ column_vb = gtk_vbox_new(FALSE, 10); gtk_box_pack_start(GTK_BOX(welcome_hb), column_vb, TRUE, TRUE, 0); @@ -569,7 +572,7 @@ welcome_new(void) gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0); #ifdef HAVE_LIBPCAP - item_hb = welcome_item(WIRESHARK_STOCK_CAPTURE_INTERFACES, + item_hb = welcome_button(WIRESHARK_STOCK_CAPTURE_INTERFACES, "Interface List", "Life list of the capture interfaces (counts incoming packets)", GTK_SIGNAL_FUNC(capture_if_cb), NULL); @@ -582,7 +585,7 @@ welcome_new(void) w = welcome_if_panel_new(); gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 0); - item_hb = welcome_item(WIRESHARK_STOCK_CAPTURE_OPTIONS, + item_hb = welcome_button(WIRESHARK_STOCK_CAPTURE_OPTIONS, "Capture Options", "Start a capture with detailed options", GTK_SIGNAL_FUNC(capture_prep_cb), NULL); @@ -592,29 +595,23 @@ welcome_new(void) topic_vb = welcome_topic_new("Capture Help", &topic_to_fill); gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0); - item_hb = welcome_item(WIRESHARK_STOCK_WIKI, + item_hb = welcome_button(WIRESHARK_STOCK_WIKI, "How to Capture", "Step by step to a successful capture setup", GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(ONLINEPAGE_CAPTURE_SETUP)); gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5); - item_hb = welcome_item(WIRESHARK_STOCK_WIKI, + item_hb = welcome_button(WIRESHARK_STOCK_WIKI, "Network Media", "Specific infos for capturing on: Ethernet, WLAN, ...", GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(ONLINEPAGE_NETWORK_MEDIA)); gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5); - - /*item_hb = welcome_item(WIRESHARK_STOCK_WIKI, - "Capture Filters", - "Capture filter examples on the wiki", - GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(ONLINEPAGE_CAPTURE_FILTERS)); - gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);*/ #else /* place a note that capturing is not compiled in */ w = gtk_label_new("Capturing is not compiled into this version of Wireshark!"); gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 5); -#endif +#endif /* HAVE_LIBPCAP */ /* fill bottom space */ w = gtk_label_new(""); @@ -625,52 +622,23 @@ welcome_new(void) topic_vb = welcome_topic_new("Files", &topic_to_fill); gtk_box_pack_start(GTK_BOX(welcome_hb), topic_vb, TRUE, TRUE, 0); - item_hb = welcome_item(GTK_STOCK_OPEN, + item_hb = welcome_button(GTK_STOCK_OPEN, "Open", "Open a previously captured file", GTK_SIGNAL_FUNC(file_open_cmd_cb), NULL); gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5); - /* list of recent files */ + /* prepare list of recent files (will be filled in later) */ w = gtk_label_new("Open Recent:"); gtk_misc_set_alignment (GTK_MISC(w), 0.0, 0.0); gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 5); - w = welcome_link_new("C:\\Testfiles\\hello.pcap", &label); - gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &topic_content_bg); - gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); - gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 0); - - w = welcome_filename_link_new("C:\\Testfiles\\hello2.pcap", &label); - gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &topic_content_bg); - gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); - gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 0); - - w = welcome_filename_link_new("C:\\Testfiles\\hello3.pcap", &label); - gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &topic_content_bg); - gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); - gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 0); - - w = welcome_filename_link_new("C:\\Testfiles\\hello4.pcap", &label); - gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &topic_content_bg); - gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); - gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 0); - - w = welcome_filename_link_new("C:\\Testfiles\\hello5.pcap", &label); - gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &topic_content_bg); - gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); - gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 0); - - w = welcome_filename_link_new( - "C:\\Testfiles\\to avoid screen garbage\\Unfortunately this is a very long filename which had to be truncated.pcap", - &label); - gtk_widget_modify_bg(w, GTK_STATE_NORMAL, &topic_content_bg); - gtk_misc_set_alignment (GTK_MISC(label), 0.0, 0.0); - gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 0); + welcome_file_panel_vb = gtk_vbox_new(FALSE, 1); + gtk_box_pack_start(GTK_BOX(topic_to_fill), welcome_file_panel_vb, FALSE, FALSE, 0); - item_hb = welcome_item(WIRESHARK_STOCK_WIKI, + item_hb = welcome_button(WIRESHARK_STOCK_WIKI, "Sample Captures", - "A rich assortment of sample capture files on the wiki", + "A rich assortment of example capture files on the wiki", GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(ONLINEPAGE_SAMPLE_CAPTURES)); gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5); @@ -687,19 +655,19 @@ welcome_new(void) topic_vb = welcome_topic_new("Online", &topic_to_fill); gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0); - item_hb = welcome_item(GTK_STOCK_HOME, + item_hb = welcome_button(GTK_STOCK_HOME, "Website", "Visit the project's website", GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(ONLINEPAGE_HOME)); gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5); - item_hb = welcome_item(WIRESHARK_STOCK_WEB_SUPPORT, + item_hb = welcome_button(GTK_STOCK_HELP, "User's Guide", "The User's Guide (local version, if installed)", GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(HELP_CONTENT)); gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5); - item_hb = welcome_item(WIRESHARK_STOCK_WIKI, + item_hb = welcome_button(WIRESHARK_STOCK_WIKI, "Security", "Work with Wireshark as secure as possible", GTK_SIGNAL_FUNC(topic_menu_cb), GINT_TO_POINTER(ONLINEPAGE_SECURITY)); @@ -725,7 +693,18 @@ welcome_new(void) return welcome_scrollw; } -#else +#else /* SHOW_WELCOME_PAGE */ + +/* SOME DUMMY FUNCTIONS, UNTIL THE WELCOME PAGE GET'S LIVE */ +void main_welcome_reset_recent_capture_files(void) +{ +} + +/* add a new file to the list of recently used files */ +void main_welcome_add_recent_capture_files(const char *widget_cf_name _U_) +{ +} + GtkWidget * welcome_new(void) { diff --git a/gtk/main_welcome.h b/gtk/main_welcome.h index be50fe35ae..1af5dedb39 100644 --- a/gtk/main_welcome.h +++ b/gtk/main_welcome.h @@ -28,4 +28,11 @@ GtkWidget *welcome_new(void); +/* reset the list of recently used files */ +void main_welcome_reset_recent_capture_files(); + +/* add a new file to the list of recently used files */ +void main_welcome_add_recent_capture_files(const char *widget_cf_name); + + #endif /* __MAIN_WELCOME_H__ */