2008-04-04 23:16:07 +00:00
|
|
|
/* main_welcome.c
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* 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
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-04-04 23:16:07 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 01:48:30 +00:00
|
|
|
#include "config.h"
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2008-04-17 23:59:56 +00:00
|
|
|
#include <time.h>
|
2008-04-16 00:17:51 +00:00
|
|
|
|
2008-04-04 23:16:07 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
#include <epan/prefs.h>
|
|
|
|
|
2008-04-15 02:14:22 +00:00
|
|
|
#include "../color.h"
|
2010-05-14 01:39:02 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2008-04-15 22:46:35 +00:00
|
|
|
#include "capture.h"
|
|
|
|
#include "capture-pcap-util.h"
|
|
|
|
#include "capture_opts.h"
|
2008-04-18 14:29:54 +00:00
|
|
|
#include "capture_ui_utils.h"
|
2010-05-14 01:39:02 +00:00
|
|
|
#endif
|
2012-01-16 01:07:52 +00:00
|
|
|
|
2008-05-22 15:46:27 +00:00
|
|
|
#include <wsutil/file_util.h>
|
2012-10-10 19:17:31 +00:00
|
|
|
#include <wsutil/str_util.h>
|
2008-04-15 02:14:22 +00:00
|
|
|
|
2012-08-03 23:30:47 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2012-08-01 22:32:14 +00:00
|
|
|
#include "ui/iface_lists.h"
|
2012-08-03 23:30:47 +00:00
|
|
|
#include "ui/capture_globals.h"
|
|
|
|
#endif
|
2012-01-18 19:38:34 +00:00
|
|
|
#include "ui/recent.h"
|
2012-01-16 01:07:52 +00:00
|
|
|
#include "ui/simple_dialog.h"
|
2012-08-01 19:18:49 +00:00
|
|
|
#include "ui/utf8_entities.h"
|
2012-01-16 01:07:52 +00:00
|
|
|
|
2012-01-15 21:59:11 +00:00
|
|
|
#include "ui/gtk/gui_utils.h"
|
|
|
|
#include "ui/gtk/color_utils.h"
|
|
|
|
#include "ui/gtk/gtkglobals.h"
|
|
|
|
#include "ui/gtk/main.h"
|
|
|
|
#include "ui/gtk/menus.h"
|
|
|
|
#include "ui/gtk/main_welcome.h"
|
2013-04-12 11:56:00 +00:00
|
|
|
#include "ui/gtk/main_toolbar.h"
|
2012-01-15 21:59:11 +00:00
|
|
|
#include "ui/gtk/help_dlg.h"
|
|
|
|
#include "ui/gtk/capture_file_dlg.h"
|
|
|
|
#include "ui/gtk/stock_icons.h"
|
2013-03-27 21:29:44 +00:00
|
|
|
#include "ui/gtk/wssplash.h"
|
2010-05-14 01:39:02 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2012-01-15 21:59:11 +00:00
|
|
|
#include "ui/gtk/capture_dlg.h"
|
|
|
|
#include "ui/gtk/capture_if_dlg.h"
|
2011-12-30 07:07:20 +00:00
|
|
|
#if GTK_CHECK_VERSION(2,18,0)
|
2012-01-15 21:59:11 +00:00
|
|
|
#include "ui/gtk/webbrowser.h"
|
2010-05-14 01:39:02 +00:00
|
|
|
#endif
|
2011-12-30 07:07:20 +00:00
|
|
|
#endif /* HAVE_LIBPCAP */
|
2008-09-02 17:41:47 +00:00
|
|
|
#include "../version_info.h"
|
2008-04-15 02:14:22 +00:00
|
|
|
|
2009-09-16 19:23:15 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include <tchar.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
2008-10-15 22:51:17 +00:00
|
|
|
#ifdef HAVE_AIRPCAP
|
|
|
|
#include "airpcap.h"
|
|
|
|
#include "airpcap_loader.h"
|
|
|
|
#include "airpcap_gui_utils.h"
|
2011-08-05 17:41:31 +00:00
|
|
|
#endif
|
2011-09-24 12:39:09 +00:00
|
|
|
#if defined(HAVE_PCAP_REMOTE)
|
2012-01-15 21:59:11 +00:00
|
|
|
#include "ui/gtk/remote_icons.h"
|
2011-09-24 12:39:09 +00:00
|
|
|
#endif
|
2008-04-15 02:14:22 +00:00
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* XXX */
|
2009-04-29 22:42:33 +00:00
|
|
|
static GtkWidget *welcome_hb = NULL;
|
|
|
|
static GtkWidget *header_lb = NULL;
|
2009-12-02 00:31:04 +00:00
|
|
|
/* Foreground colors are set using Pango markup */
|
2011-08-18 06:37:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
2011-08-23 07:36:41 +00:00
|
|
|
static GdkRGBA rgba_welcome_bg = {0.901, 0.901, 0.901, 1.0 };
|
|
|
|
static GdkRGBA rgba_header_bar_bg = { 0.094, 0.360, 0.792, 1.0 };
|
|
|
|
static GdkRGBA rgba_topic_header_bg = { 0.004, 0.224, 0.745, 1.0 };
|
2011-08-18 13:59:53 +00:00
|
|
|
static GdkRGBA rgba_topic_content_bg = { 1, 1, 1, 1.0 };
|
2011-08-18 06:37:28 +00:00
|
|
|
static GdkRGBA rgba_topic_item_idle_bg;
|
2011-08-23 07:36:41 +00:00
|
|
|
static GdkRGBA rgba_topic_item_entered_bg = { 0.827, 0.847, 0.854, 1.0 };
|
2011-08-18 06:37:28 +00:00
|
|
|
#else
|
2009-12-02 00:31:04 +00:00
|
|
|
static GdkColor welcome_bg = { 0, 0xe6e6, 0xe6e6, 0xe6e6 };
|
|
|
|
static GdkColor header_bar_bg = { 0, 0x1818, 0x5c5c, 0xcaca };
|
|
|
|
static GdkColor topic_header_bg = { 0, 0x0101, 0x3939, 0xbebe };
|
|
|
|
static GdkColor topic_content_bg = { 0, 0xffff, 0xffff, 0xffff };
|
2008-06-18 20:14:28 +00:00
|
|
|
static GdkColor topic_item_idle_bg;
|
2009-12-02 00:31:04 +00:00
|
|
|
static GdkColor topic_item_entered_bg = { 0, 0xd3d3, 0xd8d8, 0xdada };
|
2011-08-18 06:37:28 +00:00
|
|
|
#endif
|
2008-06-18 20:14:28 +00:00
|
|
|
static GtkWidget *welcome_file_panel_vb = NULL;
|
2012-03-21 00:01:42 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
From Mike Garratt:
Friendly Names for interfaces on Windows
Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
+ Win32: "dumpcap -D" shows friendly_name in place of descript if known
+ All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
+ When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name).
+ console_display_name is used as the basis of the autogenerated temp
filenames
+ console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
+ Can now specify the interface using its name and friendly_name
+ Interface name matching is case insenstive
+ Name matching first attempts exact matching, then falls back to prefix
matching
(e.g. dumpcap -i local)
+ Validates interface names, instead of blindly sending them off to
winpcap/libpcap
+ Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
+ Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
+ Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name. Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
+ void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
+ Now uses wireshark_pcapng_* or wireshark_pcap_* depending on file format
+ Basis temp filename format on console_display_name
+ Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing)
GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
+ "Friendly Name" renamed to "NDIS Friendly Name"
+ Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
+ The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces.
+ Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"
svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
|
|
|
static GtkWidget *if_view = NULL; /* contains a view (list) of all the interfaces */
|
|
|
|
static GtkWidget *if_scrolled_window; /* a scrolled window that contains the if_view */
|
2012-03-21 00:01:42 +00:00
|
|
|
#endif
|
2008-04-15 22:46:35 +00:00
|
|
|
|
2009-04-29 22:42:33 +00:00
|
|
|
static GSList *status_messages = NULL;
|
2008-04-19 13:33:42 +00:00
|
|
|
|
2011-11-09 23:43:50 +00:00
|
|
|
static GMutex *recent_mtx;
|
2011-07-14 23:18:02 +00:00
|
|
|
|
2012-03-20 21:13:28 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
|
|
|
static void capture_if_start(GtkWidget *w _U_, gpointer data _U_);
|
2012-03-21 02:42:11 +00:00
|
|
|
#if GTK_CHECK_VERSION(2,18,0)
|
2012-03-20 21:13:28 +00:00
|
|
|
static gboolean activate_link_cb(GtkLabel *label _U_, gchar *uri, gpointer user_data _U_);
|
2012-03-21 02:42:11 +00:00
|
|
|
#endif
|
2012-03-20 21:13:28 +00:00
|
|
|
#endif
|
|
|
|
|
2008-04-19 13:33:42 +00:00
|
|
|
/* The "scroll box dynamic" is a (complicated) pseudo widget to */
|
|
|
|
/* place a vertically list of widgets in (currently the interfaces and recent files). */
|
|
|
|
/* Once this list get's higher than a specified amount, */
|
|
|
|
/* it is moved into a scrolled_window. */
|
|
|
|
/* This is all complicated, the scrolled window is a bit ugly, */
|
|
|
|
/* the sizes might not be the same on all systems, ... */
|
|
|
|
/* ... but that's the best what we currently have */
|
2012-03-20 21:13:28 +00:00
|
|
|
#define SCROLL_BOX_CHILD_BOX "ScrollBoxDynamic_ChildBox"
|
|
|
|
#define SCROLL_BOX_MAX_CHILDS "ScrollBoxDynamic_MaxChilds"
|
|
|
|
#define SCROLL_BOX_SCROLLW_Y_SIZE "ScrollBoxDynamic_Scrollw_Y_Size"
|
|
|
|
#define SCROLL_BOX_SCROLLW "ScrollBoxDynamic_Scrollw"
|
|
|
|
#define TREE_VIEW_INTERFACES "TreeViewInterfaces"
|
|
|
|
#define CAPTURE_VIEW "CaptureView"
|
|
|
|
#define CAPTURE_LABEL "CaptureLabel"
|
|
|
|
#define CAPTURE_HB_BOX_INTERFACE_LIST "CaptureHorizontalBoxInterfaceList"
|
|
|
|
#define CAPTURE_HB_BOX_START "CaptureHorizontalBoxStart"
|
|
|
|
#define CAPTURE_HB_BOX_CAPTURE "CaptureHorizontalBoxCapture"
|
2012-08-08 07:53:57 +00:00
|
|
|
#define CAPTURE_HB_BOX_REFRESH "CaptureHorizontalBoxRefresh"
|
2012-03-20 21:13:28 +00:00
|
|
|
|
2008-04-19 13:33:42 +00:00
|
|
|
|
|
|
|
static GtkWidget *
|
2011-07-06 09:17:06 +00:00
|
|
|
scroll_box_dynamic_new(GtkWidget *child_box, guint max_childs, guint scrollw_y_size) {
|
2008-04-19 13:33:42 +00:00
|
|
|
GtkWidget * parent_box;
|
|
|
|
|
|
|
|
|
2012-06-02 23:53:04 +00:00
|
|
|
parent_box = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 0, FALSE);
|
2008-04-19 13:33:42 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(parent_box), GTK_WIDGET(child_box), TRUE, TRUE, 0);
|
|
|
|
g_object_set_data(G_OBJECT(parent_box), SCROLL_BOX_CHILD_BOX, child_box);
|
|
|
|
g_object_set_data(G_OBJECT(parent_box), SCROLL_BOX_MAX_CHILDS, GINT_TO_POINTER(max_childs));
|
|
|
|
g_object_set_data(G_OBJECT(parent_box), SCROLL_BOX_SCROLLW_Y_SIZE, GINT_TO_POINTER(scrollw_y_size));
|
|
|
|
gtk_widget_show_all(parent_box);
|
|
|
|
|
|
|
|
return parent_box;
|
|
|
|
}
|
|
|
|
|
2010-08-19 15:02:23 +00:00
|
|
|
|
2008-04-19 13:33:42 +00:00
|
|
|
static GtkWidget *
|
|
|
|
scroll_box_dynamic_add(GtkWidget *parent_box)
|
|
|
|
{
|
|
|
|
GtkWidget *child_box;
|
|
|
|
GtkWidget *scrollw;
|
|
|
|
guint max_cnt;
|
|
|
|
guint curr_cnt;
|
|
|
|
guint scrollw_y_size;
|
|
|
|
GList *childs;
|
|
|
|
|
2013-03-21 02:29:09 +00:00
|
|
|
child_box = (GtkWidget *)g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_CHILD_BOX);
|
2008-04-19 13:33:42 +00:00
|
|
|
max_cnt = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_MAX_CHILDS));
|
2008-05-22 15:46:27 +00:00
|
|
|
|
2008-04-19 13:33:42 +00:00
|
|
|
/* get the current number of children */
|
|
|
|
childs = gtk_container_get_children(GTK_CONTAINER(child_box));
|
|
|
|
curr_cnt = g_list_length(childs);
|
|
|
|
g_list_free(childs);
|
|
|
|
|
|
|
|
/* have we just reached the max? */
|
|
|
|
if(curr_cnt == max_cnt) {
|
|
|
|
/* create the scrolled window */
|
|
|
|
/* XXX - there's no way to get rid of the shadow frame - except for creating an own widget :-( */
|
|
|
|
scrollw = scrolled_window_new(NULL, NULL);
|
|
|
|
scrollw_y_size = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_SCROLLW_Y_SIZE));
|
2010-08-19 15:02:23 +00:00
|
|
|
gtk_widget_set_size_request(scrollw, -1, scrollw_y_size);
|
2008-04-19 13:33:42 +00:00
|
|
|
|
|
|
|
g_object_set_data(G_OBJECT(parent_box), SCROLL_BOX_SCROLLW, scrollw);
|
|
|
|
gtk_box_pack_start(GTK_BOX(parent_box), scrollw, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
/* move child_box from parent_box into scrolled window */
|
2009-04-09 05:51:56 +00:00
|
|
|
g_object_ref(child_box);
|
2008-04-19 13:33:42 +00:00
|
|
|
gtk_container_remove(GTK_CONTAINER(parent_box), child_box);
|
2013-03-04 19:20:39 +00:00
|
|
|
#if ! GTK_CHECK_VERSION(3,8,0)
|
|
|
|
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollw), child_box);
|
|
|
|
#else
|
|
|
|
gtk_container_add(GTK_CONTAINER(scrollw), child_box);
|
|
|
|
#endif
|
2008-04-19 18:39:58 +00:00
|
|
|
gtk_widget_show_all(scrollw);
|
2008-04-19 13:33:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return child_box;
|
|
|
|
}
|
|
|
|
|
2010-08-19 15:02:23 +00:00
|
|
|
|
2008-04-19 13:33:42 +00:00
|
|
|
static GtkWidget *
|
|
|
|
scroll_box_dynamic_reset(GtkWidget *parent_box)
|
|
|
|
{
|
|
|
|
GtkWidget *child_box, *scrollw;
|
|
|
|
|
|
|
|
|
2013-03-21 02:29:09 +00:00
|
|
|
child_box = (GtkWidget *)g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_CHILD_BOX);
|
|
|
|
scrollw = (GtkWidget *)g_object_get_data(G_OBJECT(parent_box), SCROLL_BOX_SCROLLW);
|
2008-04-19 13:33:42 +00:00
|
|
|
|
|
|
|
if(scrollw != NULL) {
|
|
|
|
/* move the child_box back from scrolled window into the parent_box */
|
2009-04-09 05:51:56 +00:00
|
|
|
g_object_ref(child_box);
|
2008-04-19 13:33:42 +00:00
|
|
|
gtk_container_remove(GTK_CONTAINER(parent_box), scrollw);
|
|
|
|
g_object_set_data(G_OBJECT(parent_box), SCROLL_BOX_SCROLLW, NULL);
|
|
|
|
gtk_box_pack_start(GTK_BOX(parent_box), child_box, TRUE, TRUE, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return child_box;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* mouse entered this widget - change background color */
|
2008-04-15 02:14:22 +00:00
|
|
|
static gboolean
|
2008-04-15 22:46:35 +00:00
|
|
|
welcome_item_enter_cb(GtkWidget *eb, GdkEventCrossing *event _U_, gpointer user_data _U_)
|
2008-04-15 02:14:22 +00:00
|
|
|
{
|
2011-08-18 06:37:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
2012-07-20 11:10:29 +00:00
|
|
|
gtk_widget_override_background_color(eb, GTK_STATE_FLAG_NORMAL, &rgba_topic_item_entered_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#else
|
2012-01-25 13:04:32 +00:00
|
|
|
gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_entered_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#endif
|
2008-04-15 02:14:22 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-08-19 15:02:23 +00:00
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* mouse has left this widget - change background color */
|
2008-04-15 02:14:22 +00:00
|
|
|
static gboolean
|
2010-08-19 15:02:23 +00:00
|
|
|
welcome_item_leave_cb(GtkWidget *eb, GdkEventCrossing *event _U_, gpointer user_data _U_)
|
2008-04-15 02:14:22 +00:00
|
|
|
{
|
2011-08-18 06:37:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
2012-07-20 11:10:29 +00:00
|
|
|
gtk_widget_override_background_color(eb, GTK_STATE_FLAG_NORMAL, &rgba_topic_item_idle_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#else
|
2008-04-17 00:31:38 +00:00
|
|
|
gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_idle_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#endif
|
2008-04-15 02:14:22 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-19 15:02:23 +00:00
|
|
|
typedef gboolean (*welcome_button_callback_t) (GtkWidget *widget,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* create a "button widget" */
|
2008-06-18 20:14:28 +00:00
|
|
|
static GtkWidget *
|
2008-04-17 23:59:56 +00:00
|
|
|
welcome_button(const gchar *stock_item,
|
2010-08-19 15:02:23 +00:00
|
|
|
const gchar *title, const gchar *subtitle, const gchar *tooltip,
|
|
|
|
welcome_button_callback_t welcome_button_callback, gpointer welcome_button_callback_data)
|
2008-04-04 23:16:07 +00:00
|
|
|
{
|
2008-04-15 02:14:22 +00:00
|
|
|
GtkWidget *eb, *w, *item_hb, *text_vb;
|
|
|
|
gchar *formatted_text;
|
2008-04-17 03:24:24 +00:00
|
|
|
|
2012-06-02 23:53:04 +00:00
|
|
|
item_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1, FALSE);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* event box (for background color and events) */
|
2008-04-15 02:14:22 +00:00
|
|
|
eb = gtk_event_box_new();
|
|
|
|
gtk_container_add(GTK_CONTAINER(eb), item_hb);
|
2011-08-18 06:37:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
2012-07-20 11:10:29 +00:00
|
|
|
gtk_widget_override_background_color(eb, GTK_STATE_FLAG_NORMAL, &rgba_topic_item_idle_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#else
|
2008-04-17 00:31:38 +00:00
|
|
|
gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_idle_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#endif
|
2008-04-17 03:24:24 +00:00
|
|
|
if(tooltip != NULL) {
|
2012-01-25 13:04:32 +00:00
|
|
|
gtk_widget_set_tooltip_text(eb, tooltip);
|
2008-05-22 15:46:27 +00:00
|
|
|
}
|
2008-04-15 02:14:22 +00:00
|
|
|
|
|
|
|
g_signal_connect(eb, "enter-notify-event", G_CALLBACK(welcome_item_enter_cb), NULL);
|
|
|
|
g_signal_connect(eb, "leave-notify-event", G_CALLBACK(welcome_item_leave_cb), NULL);
|
2010-08-19 15:02:23 +00:00
|
|
|
g_signal_connect(eb, "button-release-event", G_CALLBACK(welcome_button_callback), welcome_button_callback_data);
|
2008-04-15 02:14:22 +00:00
|
|
|
|
|
|
|
/* icon */
|
|
|
|
w = gtk_image_new_from_stock(stock_item, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
|
|
|
gtk_box_pack_start(GTK_BOX(item_hb), w, FALSE, FALSE, 5);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2012-06-02 23:53:04 +00:00
|
|
|
text_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 3, FALSE);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2008-04-15 02:14:22 +00:00
|
|
|
/* title */
|
|
|
|
w = gtk_label_new(title);
|
2009-04-21 16:57:52 +00:00
|
|
|
gtk_misc_set_alignment (GTK_MISC(w), 0.0f, 0.5f);
|
2008-05-14 10:56:31 +00:00
|
|
|
formatted_text = g_strdup_printf("<span weight=\"bold\" size=\"x-large\" foreground=\"black\">%s</span>", title);
|
2008-04-15 02:14:22 +00:00
|
|
|
gtk_label_set_markup(GTK_LABEL(w), formatted_text);
|
|
|
|
g_free(formatted_text);
|
|
|
|
gtk_box_pack_start(GTK_BOX(text_vb), w, FALSE, FALSE, 1);
|
2008-04-17 23:59:56 +00:00
|
|
|
|
2008-04-15 02:14:22 +00:00
|
|
|
/* subtitle */
|
|
|
|
w = gtk_label_new(subtitle);
|
2009-04-21 16:57:52 +00:00
|
|
|
gtk_misc_set_alignment (GTK_MISC(w), 0.0f, 0.5f);
|
2008-05-14 10:56:31 +00:00
|
|
|
formatted_text = g_strdup_printf("<span size=\"small\" foreground=\"black\">%s</span>", subtitle);
|
2008-04-15 02:14:22 +00:00
|
|
|
gtk_label_set_markup(GTK_LABEL(w), formatted_text);
|
|
|
|
g_free(formatted_text);
|
|
|
|
gtk_box_pack_start(GTK_BOX(text_vb), w, FALSE, FALSE, 1);
|
2008-04-17 23:59:56 +00:00
|
|
|
|
2008-04-15 02:14:22 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(item_hb), text_vb, TRUE, TRUE, 5);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2008-04-15 02:14:22 +00:00
|
|
|
return eb;
|
2008-04-04 23:16:07 +00:00
|
|
|
}
|
|
|
|
|
2010-08-19 15:02:23 +00:00
|
|
|
|
|
|
|
/* Hack to handle welcome-button "button-release-event" callback */
|
|
|
|
/* 1. Dispatch to desired actual callback */
|
|
|
|
/* 2. Return TRUE for the event callback. */
|
|
|
|
/* user_data: actual (no arg) callback fcn to be invoked. */
|
|
|
|
static gboolean
|
|
|
|
welcome_button_callback_helper(GtkWidget *w, GdkEventButton *event _U_, gpointer user_data)
|
|
|
|
{
|
2013-03-21 02:29:09 +00:00
|
|
|
void (*funct)(GtkWidget *, gpointer) = (void (*)(GtkWidget *,gpointer))user_data;
|
2010-08-19 15:02:23 +00:00
|
|
|
(*funct)(w, NULL);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-03 22:19:58 +00:00
|
|
|
void
|
2009-04-29 22:42:33 +00:00
|
|
|
welcome_header_set_message(gchar *msg) {
|
|
|
|
GString *message;
|
|
|
|
time_t secs = time(NULL);
|
|
|
|
struct tm *now = localtime(&secs);
|
2010-08-16 18:32:27 +00:00
|
|
|
|
2009-12-02 00:31:04 +00:00
|
|
|
message = g_string_new("<span weight=\"bold\" size=\"x-large\" foreground=\"white\">");
|
2010-08-16 18:32:27 +00:00
|
|
|
|
2009-04-29 22:42:33 +00:00
|
|
|
if (msg) {
|
2010-08-19 15:02:23 +00:00
|
|
|
g_string_append(message, msg);
|
2009-04-29 22:42:33 +00:00
|
|
|
} else { /* Use our default header */
|
2010-08-19 15:02:23 +00:00
|
|
|
if ((now->tm_mon == 3 && now->tm_mday == 1) || (now->tm_mon == 6 && now->tm_mday == 14)) {
|
|
|
|
g_string_append(message, "Sniffing the glue that holds the Internet together");
|
|
|
|
} else {
|
|
|
|
g_string_append(message, prefs.gui_start_title);
|
|
|
|
}
|
|
|
|
|
2012-07-31 07:27:39 +00:00
|
|
|
if ((prefs.gui_version_placement == version_welcome_only) ||
|
|
|
|
(prefs.gui_version_placement == version_both)) {
|
2010-08-19 15:02:23 +00:00
|
|
|
g_string_append_printf(message, "</span>\n<span size=\"large\" foreground=\"white\">Version " VERSION "%s",
|
|
|
|
wireshark_svnversion);
|
|
|
|
}
|
2009-04-29 22:42:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_string_append(message, "</span>");
|
|
|
|
|
|
|
|
gtk_label_set_markup(GTK_LABEL(header_lb), message->str);
|
|
|
|
g_string_free(message, TRUE);
|
|
|
|
}
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2010-08-19 15:02:23 +00:00
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* create the banner "above our heads" */
|
2008-06-18 20:14:28 +00:00
|
|
|
static GtkWidget *
|
2008-04-04 23:16:07 +00:00
|
|
|
welcome_header_new(void)
|
|
|
|
{
|
|
|
|
GtkWidget *item_vb;
|
|
|
|
GtkWidget *item_hb;
|
|
|
|
GtkWidget *eb;
|
|
|
|
GtkWidget *icon;
|
|
|
|
|
2012-06-02 23:53:04 +00:00
|
|
|
item_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 0, FALSE);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
|
|
|
/* colorize vbox */
|
|
|
|
eb = gtk_event_box_new();
|
|
|
|
gtk_container_add(GTK_CONTAINER(eb), item_vb);
|
2011-08-18 06:37:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
2012-07-20 11:10:29 +00:00
|
|
|
gtk_widget_override_background_color(eb, GTK_STATE_FLAG_NORMAL, &rgba_header_bar_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#else
|
2008-04-15 02:14:22 +00:00
|
|
|
gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &header_bar_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#endif
|
2012-06-02 23:53:04 +00:00
|
|
|
item_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0, FALSE);
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(item_vb), item_hb, FALSE, FALSE, 10);
|
|
|
|
|
2013-03-27 21:29:44 +00:00
|
|
|
icon = pixbuf_to_widget(wssplash_pb_data);
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(item_hb), icon, FALSE, FALSE, 10);
|
|
|
|
|
2009-04-29 22:42:33 +00:00
|
|
|
header_lb = gtk_label_new(NULL);
|
|
|
|
welcome_header_set_message(NULL);
|
2011-07-14 16:54:44 +00:00
|
|
|
gtk_label_set_selectable(GTK_LABEL(header_lb), TRUE);
|
|
|
|
gtk_misc_set_alignment(GTK_MISC(header_lb), 0.0f, 0.5f);
|
2009-04-29 22:42:33 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(item_hb), header_lb, TRUE, TRUE, 5);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
|
|
|
gtk_widget_show_all(eb);
|
|
|
|
|
|
|
|
return eb;
|
|
|
|
}
|
|
|
|
|
2010-08-19 15:02:23 +00:00
|
|
|
|
2009-04-29 22:42:33 +00:00
|
|
|
void
|
2010-11-27 23:06:14 +00:00
|
|
|
welcome_header_push_msg(const gchar *msg) {
|
2009-04-29 22:42:33 +00:00
|
|
|
gchar *msg_copy = g_strdup(msg);
|
2010-08-16 18:32:27 +00:00
|
|
|
|
2009-04-29 22:42:33 +00:00
|
|
|
status_messages = g_slist_append(status_messages, msg_copy);
|
2010-08-16 18:32:27 +00:00
|
|
|
|
2009-04-29 22:42:33 +00:00
|
|
|
welcome_header_set_message(msg_copy);
|
2010-08-16 18:32:27 +00:00
|
|
|
|
2009-04-29 22:42:33 +00:00
|
|
|
gtk_widget_hide(welcome_hb);
|
|
|
|
}
|
|
|
|
|
2010-08-19 15:02:23 +00:00
|
|
|
|
2009-04-29 22:42:33 +00:00
|
|
|
void
|
2009-05-08 15:16:07 +00:00
|
|
|
welcome_header_pop_msg(void) {
|
2010-08-16 18:32:27 +00:00
|
|
|
gchar *msg = NULL;
|
2009-04-29 22:42:33 +00:00
|
|
|
|
|
|
|
if (status_messages) {
|
2010-08-19 15:02:23 +00:00
|
|
|
g_free(status_messages->data);
|
2009-04-29 22:42:33 +00:00
|
|
|
status_messages = g_slist_delete_link(status_messages, status_messages);
|
|
|
|
}
|
2010-08-16 18:32:27 +00:00
|
|
|
|
2009-04-29 22:42:33 +00:00
|
|
|
if (status_messages) {
|
2013-03-21 02:29:09 +00:00
|
|
|
msg = (gchar *)status_messages->data;
|
2009-04-29 22:42:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
welcome_header_set_message(msg);
|
2010-08-16 18:32:27 +00:00
|
|
|
|
2009-04-29 22:42:33 +00:00
|
|
|
if (!status_messages) {
|
|
|
|
gtk_widget_show(welcome_hb);
|
|
|
|
}
|
|
|
|
}
|
2008-04-15 02:14:22 +00:00
|
|
|
|
2010-08-19 15:02:23 +00:00
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* create a "topic header widget" */
|
2008-06-18 20:14:28 +00:00
|
|
|
static GtkWidget *
|
2008-04-04 23:16:07 +00:00
|
|
|
welcome_topic_header_new(const char *header)
|
|
|
|
{
|
|
|
|
GtkWidget *w;
|
|
|
|
GtkWidget *eb;
|
|
|
|
gchar *formatted_message;
|
|
|
|
|
|
|
|
|
|
|
|
w = gtk_label_new(header);
|
2009-12-02 00:31:04 +00:00
|
|
|
formatted_message = g_strdup_printf("<span weight=\"bold\" size=\"x-large\" foreground=\"white\">%s</span>", header);
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_label_set_markup(GTK_LABEL(w), formatted_message);
|
|
|
|
g_free(formatted_message);
|
|
|
|
|
|
|
|
/* colorize vbox */
|
|
|
|
eb = gtk_event_box_new();
|
|
|
|
gtk_container_add(GTK_CONTAINER(eb), w);
|
2011-08-18 06:37:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
2012-07-20 11:10:29 +00:00
|
|
|
gtk_widget_override_background_color(eb, GTK_STATE_FLAG_NORMAL, &rgba_topic_header_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#else
|
2008-04-15 02:14:22 +00:00
|
|
|
gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_header_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#endif
|
2008-04-04 23:16:07 +00:00
|
|
|
return eb;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* create a "topic widget" */
|
2008-06-18 20:14:28 +00:00
|
|
|
static GtkWidget *
|
2008-04-04 23:16:07 +00:00
|
|
|
welcome_topic_new(const char *header, GtkWidget **to_fill)
|
|
|
|
{
|
|
|
|
GtkWidget *topic_vb;
|
|
|
|
GtkWidget *layout_vb;
|
|
|
|
GtkWidget *topic_eb;
|
|
|
|
GtkWidget *topic_header;
|
|
|
|
|
|
|
|
|
2012-06-02 23:53:04 +00:00
|
|
|
topic_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 0, FALSE);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
|
|
|
topic_header = welcome_topic_header_new(header);
|
|
|
|
gtk_box_pack_start(GTK_BOX(topic_vb), topic_header, FALSE, FALSE, 0);
|
|
|
|
|
2012-06-02 23:53:04 +00:00
|
|
|
layout_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 5, FALSE);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(layout_vb), 10);
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_vb), layout_vb, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* colorize vbox (we need an event box for this!) */
|
|
|
|
topic_eb = gtk_event_box_new();
|
|
|
|
gtk_container_add(GTK_CONTAINER(topic_eb), topic_vb);
|
2011-08-18 06:37:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
2012-07-20 11:10:29 +00:00
|
|
|
gtk_widget_override_background_color(topic_eb, GTK_STATE_FLAG_NORMAL, &rgba_topic_content_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#else
|
2008-04-15 02:14:22 +00:00
|
|
|
gtk_widget_modify_bg(topic_eb, GTK_STATE_NORMAL, &topic_content_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#endif
|
2008-04-04 23:16:07 +00:00
|
|
|
*to_fill = layout_vb;
|
|
|
|
|
|
|
|
return topic_eb;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* a file link was pressed */
|
2008-04-04 23:16:07 +00:00
|
|
|
static gboolean
|
2010-08-19 15:02:23 +00:00
|
|
|
welcome_filename_link_press_cb(GtkWidget *widget _U_, GdkEventButton *event _U_, gpointer data)
|
2008-04-15 22:46:35 +00:00
|
|
|
{
|
2013-03-21 02:29:09 +00:00
|
|
|
menu_open_filename((gchar *)data);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-07-14 23:18:02 +00:00
|
|
|
typedef struct _recent_item_status {
|
|
|
|
gchar *filename;
|
|
|
|
GtkWidget *label;
|
|
|
|
GObject *menu_item;
|
|
|
|
GString *str;
|
|
|
|
gboolean stat_done;
|
|
|
|
int err;
|
|
|
|
guint timer;
|
|
|
|
} recent_item_status;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fetch the status of a file.
|
|
|
|
* This function might be called as a thread. We can't use any drawing
|
|
|
|
* routines here: http://developer.gnome.org/gdk/2.24/gdk-Threads.html
|
|
|
|
*/
|
|
|
|
static void *get_recent_item_status(void *data)
|
|
|
|
{
|
|
|
|
recent_item_status *ri_stat = (recent_item_status *) data;
|
|
|
|
ws_statb64 stat_buf;
|
2012-10-10 19:17:31 +00:00
|
|
|
gchar *size_str;
|
2011-07-14 23:18:02 +00:00
|
|
|
int err;
|
|
|
|
|
|
|
|
if (!ri_stat) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Add file size. We use binary prefixes instead of IEC because that's what
|
|
|
|
* most OSes use.
|
|
|
|
*/
|
|
|
|
err = ws_stat64(ri_stat->filename, &stat_buf);
|
|
|
|
g_mutex_lock(recent_mtx);
|
|
|
|
ri_stat->err = err;
|
|
|
|
if(err == 0) {
|
2013-03-21 02:29:09 +00:00
|
|
|
size_str = format_size(stat_buf.st_size, (format_size_flags_e)(format_size_unit_bytes|format_size_prefix_si));
|
2012-10-10 19:17:31 +00:00
|
|
|
|
2011-07-14 23:18:02 +00:00
|
|
|
/* pango format string */
|
|
|
|
g_string_prepend(ri_stat->str, "<span foreground='blue'>");
|
2012-10-10 19:17:31 +00:00
|
|
|
g_string_append_printf(ri_stat->str, " (%s)</span>", size_str);
|
|
|
|
g_free(size_str);
|
2011-07-14 23:18:02 +00:00
|
|
|
} else {
|
|
|
|
g_string_append(ri_stat->str, " [not found]");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ri_stat->label) { /* The widget went away while we were busy. */
|
2011-08-05 07:19:17 +00:00
|
|
|
g_free(ri_stat->filename);
|
|
|
|
g_string_free(ri_stat->str, TRUE);
|
|
|
|
g_free(ri_stat);
|
2011-07-14 23:18:02 +00:00
|
|
|
} else {
|
|
|
|
ri_stat->stat_done = TRUE;
|
|
|
|
}
|
|
|
|
g_mutex_unlock(recent_mtx);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Timeout callback for recent items */
|
|
|
|
static gboolean
|
|
|
|
update_recent_items(gpointer data)
|
|
|
|
{
|
|
|
|
recent_item_status *ri_stat = (recent_item_status *) data;
|
|
|
|
gboolean again = TRUE;
|
|
|
|
|
|
|
|
if (!ri_stat) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_mutex_lock(recent_mtx);
|
|
|
|
if (ri_stat->stat_done) {
|
|
|
|
again = FALSE;
|
|
|
|
gtk_label_set_markup(GTK_LABEL(ri_stat->label), ri_stat->str->str);
|
2011-08-05 07:19:17 +00:00
|
|
|
if (ri_stat->err == 0) {
|
|
|
|
gtk_widget_set_sensitive(ri_stat->label, TRUE);
|
|
|
|
gtk_action_set_sensitive((GtkAction *) ri_stat->menu_item, TRUE);
|
|
|
|
}
|
2011-07-14 23:18:02 +00:00
|
|
|
ri_stat->timer = 0;
|
|
|
|
}
|
|
|
|
/* Else append some sort of Unicode or ASCII animation to the label? */
|
|
|
|
g_mutex_unlock(recent_mtx);
|
|
|
|
return again;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void welcome_filename_destroy_cb(GtkWidget *w _U_, gpointer data) {
|
|
|
|
recent_item_status *ri_stat = (recent_item_status *) data;
|
|
|
|
|
|
|
|
if (!ri_stat) {
|
2011-08-05 07:19:17 +00:00
|
|
|
return;
|
2011-07-14 23:18:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_mutex_lock(recent_mtx);
|
|
|
|
if (ri_stat->timer) {
|
2012-01-25 13:04:32 +00:00
|
|
|
g_source_remove(ri_stat->timer);
|
|
|
|
ri_stat->timer = 0;
|
2011-07-14 23:18:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_object_unref(ri_stat->menu_item);
|
|
|
|
|
|
|
|
if (ri_stat->stat_done) {
|
2012-01-25 13:04:32 +00:00
|
|
|
g_free(ri_stat->filename);
|
|
|
|
g_string_free(ri_stat->str, TRUE);
|
|
|
|
g_free(ri_stat);
|
2011-07-14 23:18:02 +00:00
|
|
|
} else {
|
|
|
|
ri_stat->label = NULL;
|
|
|
|
}
|
|
|
|
g_mutex_unlock(recent_mtx);
|
|
|
|
}
|
2008-04-15 22:46:35 +00:00
|
|
|
|
|
|
|
/* create a "file link widget" */
|
2008-06-18 20:14:28 +00:00
|
|
|
static GtkWidget *
|
2011-07-14 23:18:02 +00:00
|
|
|
welcome_filename_link_new(const gchar *filename, GtkWidget **label, GObject *menu_item)
|
2008-04-04 23:16:07 +00:00
|
|
|
{
|
2010-08-19 15:02:23 +00:00
|
|
|
GtkWidget *w;
|
|
|
|
GtkWidget *eb;
|
|
|
|
GString *str;
|
|
|
|
gchar *str_escaped;
|
2010-08-16 17:53:43 +00:00
|
|
|
glong uni_len;
|
|
|
|
gsize uni_start, uni_end;
|
2010-08-16 18:32:27 +00:00
|
|
|
const glong max = 60;
|
2011-07-14 23:18:02 +00:00
|
|
|
recent_item_status *ri_stat;
|
2008-04-15 22:46:35 +00:00
|
|
|
|
2011-07-14 23:18:02 +00:00
|
|
|
/* filename */
|
2008-04-15 22:46:35 +00:00
|
|
|
str = g_string_new(filename);
|
2010-08-16 17:53:43 +00:00
|
|
|
uni_len = g_utf8_strlen(str->str, str->len);
|
2008-04-15 22:46:35 +00:00
|
|
|
|
2008-04-17 00:31:38 +00:00
|
|
|
/* cut max filename length */
|
2010-08-16 17:53:43 +00:00
|
|
|
if (uni_len > max) {
|
2010-08-19 15:02:23 +00:00
|
|
|
uni_start = g_utf8_offset_to_pointer(str->str, 20) - str->str;
|
|
|
|
uni_end = g_utf8_offset_to_pointer(str->str, uni_len - max) - str->str;
|
2010-08-16 17:53:43 +00:00
|
|
|
g_string_erase(str, uni_start, uni_end);
|
|
|
|
g_string_insert(str, uni_start, " " UTF8_HORIZONTAL_ELLIPSIS " ");
|
2008-04-15 22:46:35 +00:00
|
|
|
}
|
|
|
|
|
2009-05-22 23:09:31 +00:00
|
|
|
/* escape the possibly shortened filename before adding pango language */
|
|
|
|
str_escaped=g_markup_escape_text(str->str, -1);
|
|
|
|
g_string_free(str, TRUE);
|
2008-04-15 22:46:35 +00:00
|
|
|
|
2008-04-17 00:31:38 +00:00
|
|
|
/* label */
|
2011-07-14 23:18:02 +00:00
|
|
|
w = gtk_label_new(str_escaped);
|
2008-04-04 23:16:07 +00:00
|
|
|
*label = w;
|
2008-04-15 22:46:35 +00:00
|
|
|
gtk_misc_set_padding(GTK_MISC(w), 5, 2);
|
2011-07-14 23:18:02 +00:00
|
|
|
gtk_misc_set_alignment (GTK_MISC(w), 0.0f, 0.0f);
|
|
|
|
gtk_widget_set_sensitive(w, FALSE);
|
|
|
|
|
2013-03-21 02:29:09 +00:00
|
|
|
ri_stat = (recent_item_status *)g_malloc(sizeof(recent_item_status));
|
2011-07-14 23:18:02 +00:00
|
|
|
ri_stat->filename = g_strdup(filename);
|
|
|
|
ri_stat->label = w;
|
|
|
|
ri_stat->menu_item = menu_item;
|
|
|
|
ri_stat->str = g_string_new(str_escaped);
|
|
|
|
ri_stat->stat_done = FALSE;
|
|
|
|
ri_stat->timer = 0;
|
|
|
|
g_object_ref(G_OBJECT(menu_item));
|
|
|
|
g_signal_connect(w, "destroy", G_CALLBACK(welcome_filename_destroy_cb), ri_stat);
|
|
|
|
g_free(str_escaped);
|
|
|
|
|
2011-11-09 23:43:50 +00:00
|
|
|
#if GLIB_CHECK_VERSION(2,31,0)
|
|
|
|
/* XXX - Add the filename here? */
|
|
|
|
g_thread_new("Recent item status", get_recent_item_status, ri_stat);
|
|
|
|
#else
|
2011-07-14 23:18:02 +00:00
|
|
|
g_thread_create(get_recent_item_status, ri_stat, FALSE, NULL);
|
2011-11-09 23:43:50 +00:00
|
|
|
#endif
|
2011-07-14 23:18:02 +00:00
|
|
|
ri_stat->timer = g_timeout_add(200, update_recent_items, ri_stat);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2009-05-22 23:09:31 +00:00
|
|
|
/* event box */
|
2008-04-04 23:16:07 +00:00
|
|
|
eb = gtk_event_box_new();
|
2011-08-18 06:37:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
2012-07-20 11:10:29 +00:00
|
|
|
gtk_widget_override_background_color(eb, GTK_STATE_FLAG_NORMAL, &rgba_topic_item_idle_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#else
|
2011-07-14 23:18:02 +00:00
|
|
|
gtk_widget_modify_bg(eb, GTK_STATE_NORMAL, &topic_item_idle_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#endif
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_container_add(GTK_CONTAINER(eb), w);
|
2011-07-14 23:18:02 +00:00
|
|
|
gtk_widget_set_tooltip_text(eb, filename);
|
2008-04-17 23:59:56 +00:00
|
|
|
|
2008-04-15 02:14:22 +00:00
|
|
|
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);
|
2008-04-15 22:46:35 +00:00
|
|
|
g_signal_connect(eb, "button-press-event", G_CALLBACK(welcome_filename_link_press_cb), (gchar *) filename);
|
|
|
|
|
2008-04-04 23:16:07 +00:00
|
|
|
return eb;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* reset the list of recent files */
|
|
|
|
void
|
2008-12-02 08:11:23 +00:00
|
|
|
main_welcome_reset_recent_capture_files(void)
|
2008-04-15 22:46:35 +00:00
|
|
|
{
|
2008-04-19 13:33:42 +00:00
|
|
|
GtkWidget *child_box;
|
2008-04-15 22:46:35 +00:00
|
|
|
GList* child_list;
|
|
|
|
GList* child_list_item;
|
2008-04-17 23:59:56 +00:00
|
|
|
|
2008-04-19 13:33:42 +00:00
|
|
|
|
2008-04-19 18:39:58 +00:00
|
|
|
if(welcome_file_panel_vb) {
|
|
|
|
child_box = scroll_box_dynamic_reset(welcome_file_panel_vb);
|
|
|
|
child_list = gtk_container_get_children(GTK_CONTAINER(child_box));
|
|
|
|
child_list_item = child_list;
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2008-04-19 18:39:58 +00:00
|
|
|
while(child_list_item) {
|
2013-03-21 02:29:09 +00:00
|
|
|
gtk_container_remove(GTK_CONTAINER(child_box), (GtkWidget *)child_list_item->data);
|
2008-04-19 18:39:58 +00:00
|
|
|
child_list_item = g_list_next(child_list_item);
|
|
|
|
}
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2008-04-19 18:39:58 +00:00
|
|
|
g_list_free(child_list);
|
|
|
|
}
|
2008-04-04 23:16:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* add a new file to the list of recent files */
|
|
|
|
void
|
2011-07-14 23:18:02 +00:00
|
|
|
main_welcome_add_recent_capture_file(const char *widget_cf_name, GObject *menu_item)
|
2008-04-15 22:46:35 +00:00
|
|
|
{
|
|
|
|
GtkWidget *w;
|
2008-04-19 13:33:42 +00:00
|
|
|
GtkWidget *child_box;
|
2008-04-15 22:46:35 +00:00
|
|
|
GtkWidget *label;
|
2008-04-15 02:14:22 +00:00
|
|
|
|
2008-04-19 13:33:42 +00:00
|
|
|
|
2011-07-14 23:18:02 +00:00
|
|
|
w = welcome_filename_link_new(widget_cf_name, &label, menu_item);
|
2008-04-19 13:33:42 +00:00
|
|
|
child_box = scroll_box_dynamic_add(welcome_file_panel_vb);
|
|
|
|
gtk_box_pack_start(GTK_BOX(child_box), w, FALSE, FALSE, 0);
|
2008-04-15 22:46:35 +00:00
|
|
|
gtk_widget_show_all(w);
|
2008-04-19 13:33:42 +00:00
|
|
|
gtk_widget_show_all(child_box);
|
2008-04-15 22:46:35 +00:00
|
|
|
}
|
2008-04-15 02:14:22 +00:00
|
|
|
|
2011-07-08 09:26:34 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2011-07-18 16:20:19 +00:00
|
|
|
gboolean on_selection_changed(GtkTreeSelection *selection _U_,
|
|
|
|
GtkTreeModel *model,
|
|
|
|
GtkTreePath *path,
|
|
|
|
gboolean path_currently_selected,
|
|
|
|
gpointer data _U_)
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gchar *if_name;
|
2012-01-25 13:04:32 +00:00
|
|
|
guint i;
|
|
|
|
interface_t device;
|
2012-01-25 14:26:09 +00:00
|
|
|
|
2011-07-18 16:20:19 +00:00
|
|
|
gtk_tree_model_get_iter (model, &iter, path);
|
|
|
|
gtk_tree_model_get (model, &iter, IFACE_NAME, &if_name, -1);
|
2012-01-25 13:04:32 +00:00
|
|
|
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
|
|
|
|
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
|
|
|
|
if (strcmp(device.name, if_name) == 0) {
|
|
|
|
if (!device.locked) {
|
2011-08-05 07:19:17 +00:00
|
|
|
if (path_currently_selected) {
|
2012-01-25 13:04:32 +00:00
|
|
|
if (device.selected) {
|
|
|
|
device.selected = FALSE;
|
|
|
|
global_capture_opts.num_selected--;
|
2012-01-24 16:05:26 +00:00
|
|
|
}
|
2012-01-24 17:12:56 +00:00
|
|
|
} else {
|
2012-01-25 13:04:32 +00:00
|
|
|
if (!device.selected) {
|
|
|
|
device.selected = TRUE;
|
|
|
|
global_capture_opts.num_selected++;
|
|
|
|
}
|
2012-01-24 17:12:56 +00:00
|
|
|
}
|
2012-12-05 22:22:52 +00:00
|
|
|
device.locked = TRUE;
|
2012-01-25 13:04:32 +00:00
|
|
|
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
|
|
|
|
g_array_insert_val(global_capture_opts.all_ifaces, i, device);
|
2011-08-05 07:19:17 +00:00
|
|
|
|
2012-06-28 01:54:42 +00:00
|
|
|
if (capture_dlg_window_present()) {
|
2012-01-25 13:04:32 +00:00
|
|
|
enable_selected_interface(g_strdup(if_name), device.selected);
|
2011-08-05 17:33:47 +00:00
|
|
|
}
|
2012-01-25 13:04:32 +00:00
|
|
|
if (interfaces_dialog_window_present()) {
|
|
|
|
update_selected_interface(g_strdup(if_name));
|
2011-08-05 17:33:47 +00:00
|
|
|
}
|
2012-01-25 13:04:32 +00:00
|
|
|
device.locked = FALSE;
|
|
|
|
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, i);
|
|
|
|
g_array_insert_val(global_capture_opts.all_ifaces, i, device);
|
2011-08-05 17:33:47 +00:00
|
|
|
}
|
2012-01-25 13:04:32 +00:00
|
|
|
break;
|
2011-08-05 07:19:17 +00:00
|
|
|
}
|
2011-07-20 12:51:57 +00:00
|
|
|
}
|
2013-04-12 11:56:00 +00:00
|
|
|
set_sensitivity_for_start_icon();
|
2011-07-20 12:51:57 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-04-12 11:56:00 +00:00
|
|
|
void
|
2013-04-12 12:12:04 +00:00
|
|
|
set_sensitivity_for_start_icon(void)
|
2013-04-12 11:56:00 +00:00
|
|
|
{
|
2013-04-12 13:33:22 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2013-04-12 11:56:00 +00:00
|
|
|
gboolean enable = (global_capture_opts.num_selected > 0);
|
|
|
|
|
|
|
|
set_start_button_sensitive(enable);
|
|
|
|
set_menus_capture_start_sensitivity(enable);
|
2013-04-12 13:33:22 +00:00
|
|
|
#endif
|
2013-04-12 11:56:00 +00:00
|
|
|
}
|
|
|
|
|
2011-07-20 12:51:57 +00:00
|
|
|
static gboolean activate_ifaces(GtkTreeModel *model,
|
2012-01-25 13:04:32 +00:00
|
|
|
GtkTreePath *path _U_,
|
|
|
|
GtkTreeIter *iter,
|
|
|
|
gpointer userdata)
|
2011-07-20 12:51:57 +00:00
|
|
|
{
|
2012-01-25 13:04:32 +00:00
|
|
|
gchar *if_name;
|
|
|
|
GtkWidget *view;
|
|
|
|
GtkTreeSelection *selection;
|
|
|
|
selected_name_t *entry = (selected_name_t *)userdata;
|
|
|
|
|
2013-03-21 02:29:09 +00:00
|
|
|
view = (GtkWidget *)g_object_get_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES);
|
2012-01-25 13:04:32 +00:00
|
|
|
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
|
|
|
|
gtk_tree_model_get (model, iter, IFACE_NAME, &if_name, -1);
|
|
|
|
if (strcmp(if_name, entry->name) == 0) {
|
|
|
|
if (entry->activate) {
|
|
|
|
gtk_tree_selection_select_iter(selection, iter);
|
|
|
|
} else {
|
|
|
|
gtk_tree_selection_unselect_iter(selection, iter);
|
|
|
|
}
|
|
|
|
return TRUE;
|
2011-07-18 16:20:19 +00:00
|
|
|
}
|
2012-01-25 13:04:32 +00:00
|
|
|
return FALSE;
|
2011-07-20 12:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void change_interface_selection(gchar* name, gboolean activate)
|
|
|
|
{
|
|
|
|
GtkWidget *view;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
selected_name_t entry;
|
2011-08-05 07:19:17 +00:00
|
|
|
|
2013-03-21 02:29:09 +00:00
|
|
|
view = (GtkWidget *)g_object_get_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES);
|
2011-07-20 12:51:57 +00:00
|
|
|
model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
|
2011-07-20 13:53:00 +00:00
|
|
|
entry.name = g_strdup(name);
|
2011-07-20 12:51:57 +00:00
|
|
|
entry.activate = activate;
|
|
|
|
gtk_tree_model_foreach(GTK_TREE_MODEL(model), (GtkTreeModelForeachFunc)(activate_ifaces), (gpointer) &entry);
|
2011-07-18 16:20:19 +00:00
|
|
|
}
|
2011-08-05 07:19:17 +00:00
|
|
|
|
|
|
|
void change_selection_for_all(gboolean enable)
|
|
|
|
{
|
2012-01-25 13:04:32 +00:00
|
|
|
guint i;
|
2013-04-11 12:08:48 +00:00
|
|
|
gboolean all = FALSE;
|
|
|
|
interface_t device;
|
2011-08-05 07:19:17 +00:00
|
|
|
|
2012-01-25 13:04:32 +00:00
|
|
|
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
|
2013-04-11 12:08:48 +00:00
|
|
|
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
|
|
|
|
all = strcmp(device.name, "any");
|
|
|
|
if (all) {
|
|
|
|
change_interface_selection(device.name, enable);
|
|
|
|
} else {
|
|
|
|
change_interface_selection(device.name, FALSE);
|
|
|
|
}
|
2011-10-20 19:44:40 +00:00
|
|
|
}
|
2011-08-05 07:19:17 +00:00
|
|
|
}
|
2011-07-08 09:26:34 +00:00
|
|
|
#endif
|
2008-04-15 02:14:22 +00:00
|
|
|
|
2012-02-21 11:59:41 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
|
|
|
void
|
2012-12-05 15:56:36 +00:00
|
|
|
change_interface_name(gchar *oldname, guint indx)
|
2012-02-21 11:59:41 +00:00
|
|
|
{
|
|
|
|
GtkWidget *view;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
interface_t device;
|
|
|
|
GtkTreeSelection *entry;
|
|
|
|
gchar *optname;
|
|
|
|
|
2013-03-21 02:29:09 +00:00
|
|
|
view = (GtkWidget *)g_object_get_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES);
|
2012-02-21 11:59:41 +00:00
|
|
|
entry = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
|
|
|
|
model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
|
|
|
|
|
2012-12-05 15:56:36 +00:00
|
|
|
device = g_array_index(global_capture_opts.all_ifaces, interface_t, indx);
|
2012-03-20 21:13:28 +00:00
|
|
|
if (gtk_tree_model_get_iter_first (model, &iter)) {
|
|
|
|
do {
|
|
|
|
gtk_tree_model_get(model, &iter, IFACE_NAME, &optname, -1);
|
|
|
|
if (strcmp(optname, oldname) == 0) {
|
|
|
|
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);
|
|
|
|
if (device.selected) {
|
|
|
|
gtk_tree_selection_select_iter(entry, &iter);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (gtk_tree_model_iter_next(model, &iter));
|
|
|
|
g_free(optname);
|
2012-02-21 11:59:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-08-05 07:19:17 +00:00
|
|
|
#ifdef HAVE_PCAP_REMOTE
|
|
|
|
void
|
2012-12-05 15:56:36 +00:00
|
|
|
add_interface_to_list(guint indx)
|
2011-08-05 07:19:17 +00:00
|
|
|
{
|
|
|
|
GtkWidget *view, *icon;
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gint size;
|
|
|
|
gchar *lines;
|
2012-01-25 13:04:32 +00:00
|
|
|
interface_t device;
|
|
|
|
|
2012-12-05 15:56:36 +00:00
|
|
|
device = g_array_index(global_capture_opts.all_ifaces, interface_t, indx);
|
2011-09-24 12:39:09 +00:00
|
|
|
icon = pixbuf_to_widget(remote_sat_pb_data);
|
2011-08-05 07:19:17 +00:00
|
|
|
view = g_object_get_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES);
|
|
|
|
model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
|
|
|
|
size = gtk_tree_model_iter_n_children(model, NULL);
|
|
|
|
lines = g_strdup_printf("%d", size-1);
|
|
|
|
if (gtk_tree_model_get_iter_from_string(model, &iter, lines)) {
|
|
|
|
gtk_list_store_append (GTK_LIST_STORE(model), &iter);
|
2012-01-25 13:04:32 +00:00
|
|
|
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);
|
2011-08-05 07:19:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-03-20 23:03:48 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2012-03-20 21:13:28 +00:00
|
|
|
static void
|
|
|
|
clear_capture_box(void)
|
|
|
|
{
|
|
|
|
GtkWidget *item_hb;
|
2012-03-21 01:22:40 +00:00
|
|
|
|
2013-03-21 02:29:09 +00:00
|
|
|
item_hb = (GtkWidget *)g_object_get_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_INTERFACE_LIST);
|
2012-03-20 21:13:28 +00:00
|
|
|
if (item_hb) {
|
|
|
|
gtk_widget_destroy(item_hb);
|
|
|
|
}
|
2013-03-21 02:29:09 +00:00
|
|
|
item_hb = (GtkWidget *)g_object_get_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_START);
|
2012-03-20 21:13:28 +00:00
|
|
|
if (item_hb) {
|
|
|
|
gtk_widget_destroy(item_hb);
|
|
|
|
}
|
2013-03-21 02:29:09 +00:00
|
|
|
item_hb = (GtkWidget *)g_object_get_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_CAPTURE);
|
2012-03-20 21:13:28 +00:00
|
|
|
if (item_hb) {
|
|
|
|
gtk_widget_destroy(item_hb);
|
|
|
|
}
|
2013-03-21 02:29:09 +00:00
|
|
|
item_hb = (GtkWidget *)g_object_get_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_REFRESH);
|
2012-08-08 07:53:57 +00:00
|
|
|
if (item_hb) {
|
|
|
|
gtk_widget_destroy(item_hb);
|
|
|
|
}
|
From Mike Garratt:
Friendly Names for interfaces on Windows
Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
+ Win32: "dumpcap -D" shows friendly_name in place of descript if known
+ All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
+ When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name).
+ console_display_name is used as the basis of the autogenerated temp
filenames
+ console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
+ Can now specify the interface using its name and friendly_name
+ Interface name matching is case insenstive
+ Name matching first attempts exact matching, then falls back to prefix
matching
(e.g. dumpcap -i local)
+ Validates interface names, instead of blindly sending them off to
winpcap/libpcap
+ Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
+ Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
+ Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name. Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
+ void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
+ Now uses wireshark_pcapng_* or wireshark_pcap_* depending on file format
+ Basis temp filename format on console_display_name
+ Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing)
GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
+ "Friendly Name" renamed to "NDIS Friendly Name"
+ Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
+ The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces.
+ Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"
svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
|
|
|
if (if_scrolled_window) {
|
|
|
|
gtk_widget_destroy(if_scrolled_window);
|
|
|
|
if_scrolled_window = NULL;
|
2012-03-20 21:13:28 +00:00
|
|
|
if_view = NULL;
|
|
|
|
}
|
|
|
|
}
|
2012-03-20 23:37:23 +00:00
|
|
|
|
From Mike Garratt:
Friendly Names for interfaces on Windows
Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
+ Win32: "dumpcap -D" shows friendly_name in place of descript if known
+ All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
+ When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name).
+ console_display_name is used as the basis of the autogenerated temp
filenames
+ console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
+ Can now specify the interface using its name and friendly_name
+ Interface name matching is case insenstive
+ Name matching first attempts exact matching, then falls back to prefix
matching
(e.g. dumpcap -i local)
+ Validates interface names, instead of blindly sending them off to
winpcap/libpcap
+ Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
+ Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
+ Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name. Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
+ void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
+ Now uses wireshark_pcapng_* or wireshark_pcap_* depending on file format
+ Basis temp filename format on console_display_name
+ Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing)
GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
+ "Friendly Name" renamed to "NDIS Friendly Name"
+ Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
+ The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces.
+ Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"
svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
|
|
|
static void update_interface_scrolled_window_height(void)
|
|
|
|
{
|
2012-11-29 22:58:16 +00:00
|
|
|
/* set the height of the scroll window that shows the interfaces
|
From Mike Garratt:
Friendly Names for interfaces on Windows
Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
+ Win32: "dumpcap -D" shows friendly_name in place of descript if known
+ All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
+ When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name).
+ console_display_name is used as the basis of the autogenerated temp
filenames
+ console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
+ Can now specify the interface using its name and friendly_name
+ Interface name matching is case insenstive
+ Name matching first attempts exact matching, then falls back to prefix
matching
(e.g. dumpcap -i local)
+ Validates interface names, instead of blindly sending them off to
winpcap/libpcap
+ Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
+ Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
+ Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name. Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
+ void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
+ Now uses wireshark_pcapng_* or wireshark_pcap_* depending on file format
+ Basis temp filename format on console_display_name
+ Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing)
GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
+ "Friendly Name" renamed to "NDIS Friendly Name"
+ Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
+ The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces.
+ Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"
svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
|
|
|
* based on the number of visible interfaces - up to a maximum of 10 interfaces */
|
|
|
|
guint i;
|
|
|
|
interface_t device;
|
|
|
|
int visible_interface_count=0;
|
2012-11-29 22:58:16 +00:00
|
|
|
|
From Mike Garratt:
Friendly Names for interfaces on Windows
Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
+ Win32: "dumpcap -D" shows friendly_name in place of descript if known
+ All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
+ When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name).
+ console_display_name is used as the basis of the autogenerated temp
filenames
+ console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
+ Can now specify the interface using its name and friendly_name
+ Interface name matching is case insenstive
+ Name matching first attempts exact matching, then falls back to prefix
matching
(e.g. dumpcap -i local)
+ Validates interface names, instead of blindly sending them off to
winpcap/libpcap
+ Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
+ Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
+ Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name. Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
+ void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
+ Now uses wireshark_pcapng_* or wireshark_pcap_* depending on file format
+ Basis temp filename format on console_display_name
+ Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing)
GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
+ "Friendly Name" renamed to "NDIS Friendly Name"
+ Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
+ The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces.
+ Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"
svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
|
|
|
if(if_scrolled_window==NULL){
|
|
|
|
return;
|
|
|
|
}
|
2012-11-29 22:58:16 +00:00
|
|
|
|
From Mike Garratt:
Friendly Names for interfaces on Windows
Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
+ Win32: "dumpcap -D" shows friendly_name in place of descript if known
+ All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
+ When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name).
+ console_display_name is used as the basis of the autogenerated temp
filenames
+ console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
+ Can now specify the interface using its name and friendly_name
+ Interface name matching is case insenstive
+ Name matching first attempts exact matching, then falls back to prefix
matching
(e.g. dumpcap -i local)
+ Validates interface names, instead of blindly sending them off to
winpcap/libpcap
+ Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
+ Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
+ Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name. Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
+ void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
+ Now uses wireshark_pcapng_* or wireshark_pcap_* depending on file format
+ Basis temp filename format on console_display_name
+ Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing)
GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
+ "Friendly Name" renamed to "NDIS Friendly Name"
+ Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
+ The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces.
+ Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"
svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
|
|
|
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
|
|
|
|
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
|
|
|
|
if (!device.hidden) {
|
|
|
|
visible_interface_count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(visible_interface_count>10){
|
|
|
|
/* up to 10 interfaces will be visible at one time */
|
|
|
|
visible_interface_count=10;
|
|
|
|
}
|
|
|
|
if(visible_interface_count<2){
|
|
|
|
/* minimum space for two interfaces */
|
|
|
|
visible_interface_count=2;
|
|
|
|
}
|
|
|
|
gtk_widget_set_size_request(if_scrolled_window, FALSE, visible_interface_count*21+4);
|
|
|
|
}
|
|
|
|
|
Detangle the code that manages the interface list on the welcome screen:
fill_capture_box():
if there are interfaces on which to capture, constructs the
interface list, otherwise destroys the interface list and puts
up a message.
update_capture_box():
updates the interface list to reflect current reality.
welcome_if_panel_reload():
if there is an interface list, and if there are interfaces on
which to capture (so that we still want that list), updates the
list by calling update_capture_box(), otherwise creates or
destroys it by calling fill_capture_box() (as either it doesn't
exist but now needs to or does exist but needs to go away).
Have refresh_local_interface_lists(), which re-fetches the list of local
interfaces and updates every interface list that includes local
interfaces, and refresh_non_local_interface_lists(), which only updates
interface lists that (also) include interfaces other than local
interfaces (such as pipes and remote interfaces). Call them in the
apprpriate places (if we know the list of local interfaces has been
updated, call refresh_local_interface_lists(), otherwise, if we know
interfaces other than local interfaces have been added or removed, call
refresh_non_local_interface_lists()).
Don't have any routine that updates the interface list for one widget
update the interface list for any other widget; leave the global
updating of interface lists up to refresh_local_interface_lists() and
refresh_non_local_interface_lists() - only call one of them if any
interface lists are to be updated.
svn path=/trunk/; revision=43517
2012-06-28 08:13:21 +00:00
|
|
|
static void
|
|
|
|
update_capture_box(void)
|
|
|
|
{
|
|
|
|
guint i;
|
2012-12-22 21:14:13 +00:00
|
|
|
GtkListStore *store;
|
Detangle the code that manages the interface list on the welcome screen:
fill_capture_box():
if there are interfaces on which to capture, constructs the
interface list, otherwise destroys the interface list and puts
up a message.
update_capture_box():
updates the interface list to reflect current reality.
welcome_if_panel_reload():
if there is an interface list, and if there are interfaces on
which to capture (so that we still want that list), updates the
list by calling update_capture_box(), otherwise creates or
destroys it by calling fill_capture_box() (as either it doesn't
exist but now needs to or does exist but needs to go away).
Have refresh_local_interface_lists(), which re-fetches the list of local
interfaces and updates every interface list that includes local
interfaces, and refresh_non_local_interface_lists(), which only updates
interface lists that (also) include interfaces other than local
interfaces (such as pipes and remote interfaces). Call them in the
apprpriate places (if we know the list of local interfaces has been
updated, call refresh_local_interface_lists(), otherwise, if we know
interfaces other than local interfaces have been added or removed, call
refresh_non_local_interface_lists()).
Don't have any routine that updates the interface list for one widget
update the interface list for any other widget; leave the global
updating of interface lists up to refresh_local_interface_lists() and
refresh_non_local_interface_lists() - only call one of them if any
interface lists are to be updated.
svn path=/trunk/; revision=43517
2012-06-28 08:13:21 +00:00
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeSelection *entry;
|
|
|
|
interface_t device;
|
|
|
|
gboolean changed = FALSE;
|
|
|
|
|
|
|
|
store = gtk_list_store_new(NUMCOLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
|
|
|
|
|
2012-11-29 22:58:16 +00:00
|
|
|
gtk_list_store_clear(store);
|
Detangle the code that manages the interface list on the welcome screen:
fill_capture_box():
if there are interfaces on which to capture, constructs the
interface list, otherwise destroys the interface list and puts
up a message.
update_capture_box():
updates the interface list to reflect current reality.
welcome_if_panel_reload():
if there is an interface list, and if there are interfaces on
which to capture (so that we still want that list), updates the
list by calling update_capture_box(), otherwise creates or
destroys it by calling fill_capture_box() (as either it doesn't
exist but now needs to or does exist but needs to go away).
Have refresh_local_interface_lists(), which re-fetches the list of local
interfaces and updates every interface list that includes local
interfaces, and refresh_non_local_interface_lists(), which only updates
interface lists that (also) include interfaces other than local
interfaces (such as pipes and remote interfaces). Call them in the
apprpriate places (if we know the list of local interfaces has been
updated, call refresh_local_interface_lists(), otherwise, if we know
interfaces other than local interfaces have been added or removed, call
refresh_non_local_interface_lists()).
Don't have any routine that updates the interface list for one widget
update the interface list for any other widget; leave the global
updating of interface lists up to refresh_local_interface_lists() and
refresh_non_local_interface_lists() - only call one of them if any
interface lists are to be updated.
svn path=/trunk/; revision=43517
2012-06-28 08:13:21 +00:00
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(if_view), GTK_TREE_MODEL (store));
|
2013-03-13 12:38:08 +00:00
|
|
|
entry = gtk_tree_view_get_selection(GTK_TREE_VIEW(if_view));
|
Detangle the code that manages the interface list on the welcome screen:
fill_capture_box():
if there are interfaces on which to capture, constructs the
interface list, otherwise destroys the interface list and puts
up a message.
update_capture_box():
updates the interface list to reflect current reality.
welcome_if_panel_reload():
if there is an interface list, and if there are interfaces on
which to capture (so that we still want that list), updates the
list by calling update_capture_box(), otherwise creates or
destroys it by calling fill_capture_box() (as either it doesn't
exist but now needs to or does exist but needs to go away).
Have refresh_local_interface_lists(), which re-fetches the list of local
interfaces and updates every interface list that includes local
interfaces, and refresh_non_local_interface_lists(), which only updates
interface lists that (also) include interfaces other than local
interfaces (such as pipes and remote interfaces). Call them in the
apprpriate places (if we know the list of local interfaces has been
updated, call refresh_local_interface_lists(), otherwise, if we know
interfaces other than local interfaces have been added or removed, call
refresh_non_local_interface_lists()).
Don't have any routine that updates the interface list for one widget
update the interface list for any other widget; leave the global
updating of interface lists up to refresh_local_interface_lists() and
refresh_non_local_interface_lists() - only call one of them if any
interface lists are to be updated.
svn path=/trunk/; revision=43517
2012-06-28 08:13:21 +00:00
|
|
|
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
|
|
|
|
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
|
|
|
|
if (!device.hidden) {
|
|
|
|
gtk_list_store_append (store, &iter);
|
|
|
|
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);
|
|
|
|
if (device.selected) {
|
|
|
|
gtk_tree_selection_select_iter(entry, &iter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
From Mike Garratt:
Friendly Names for interfaces on Windows
Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
+ Win32: "dumpcap -D" shows friendly_name in place of descript if known
+ All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
+ When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name).
+ console_display_name is used as the basis of the autogenerated temp
filenames
+ console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
+ Can now specify the interface using its name and friendly_name
+ Interface name matching is case insenstive
+ Name matching first attempts exact matching, then falls back to prefix
matching
(e.g. dumpcap -i local)
+ Validates interface names, instead of blindly sending them off to
winpcap/libpcap
+ Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
+ Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
+ Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name. Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
+ void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
+ Now uses wireshark_pcapng_* or wireshark_pcap_* depending on file format
+ Basis temp filename format on console_display_name
+ Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing)
GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
+ "Friendly Name" renamed to "NDIS Friendly Name"
+ Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
+ The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces.
+ Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"
svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
|
|
|
update_interface_scrolled_window_height();
|
Detangle the code that manages the interface list on the welcome screen:
fill_capture_box():
if there are interfaces on which to capture, constructs the
interface list, otherwise destroys the interface list and puts
up a message.
update_capture_box():
updates the interface list to reflect current reality.
welcome_if_panel_reload():
if there is an interface list, and if there are interfaces on
which to capture (so that we still want that list), updates the
list by calling update_capture_box(), otherwise creates or
destroys it by calling fill_capture_box() (as either it doesn't
exist but now needs to or does exist but needs to go away).
Have refresh_local_interface_lists(), which re-fetches the list of local
interfaces and updates every interface list that includes local
interfaces, and refresh_non_local_interface_lists(), which only updates
interface lists that (also) include interfaces other than local
interfaces (such as pipes and remote interfaces). Call them in the
apprpriate places (if we know the list of local interfaces has been
updated, call refresh_local_interface_lists(), otherwise, if we know
interfaces other than local interfaces have been added or removed, call
refresh_non_local_interface_lists()).
Don't have any routine that updates the interface list for one widget
update the interface list for any other widget; leave the global
updating of interface lists up to refresh_local_interface_lists() and
refresh_non_local_interface_lists() - only call one of them if any
interface lists are to be updated.
svn path=/trunk/; revision=43517
2012-06-28 08:13:21 +00:00
|
|
|
changed = TRUE;
|
|
|
|
gtk_tree_selection_set_select_function(GTK_TREE_SELECTION(entry), on_selection_changed, (gpointer)&changed, NULL);
|
|
|
|
}
|
|
|
|
|
2012-08-08 07:53:57 +00:00
|
|
|
static void
|
|
|
|
refresh_interfaces_cb(GtkWidget *w _U_, gpointer user_data _U_)
|
|
|
|
{
|
|
|
|
clear_capture_box();
|
|
|
|
refresh_local_interface_lists();
|
|
|
|
}
|
|
|
|
|
2012-03-20 21:13:28 +00:00
|
|
|
static void fill_capture_box(void)
|
|
|
|
{
|
2012-08-08 07:53:57 +00:00
|
|
|
GtkWidget *box_to_fill, *item_hb_refresh;
|
2012-03-21 00:36:44 +00:00
|
|
|
GtkWidget *item_hb_interface_list, *item_hb_capture, *item_hb_start, *label, *w;
|
2012-03-20 21:13:28 +00:00
|
|
|
GtkTreeSelection *selection;
|
|
|
|
GtkCellRenderer *renderer;
|
|
|
|
GtkTreeViewColumn *column;
|
2012-03-20 22:40:10 +00:00
|
|
|
int error = 0;
|
2012-03-21 09:54:05 +00:00
|
|
|
gchar *label_text, *err_str;
|
2012-03-20 22:40:10 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
DWORD reg_ret;
|
|
|
|
DWORD chimney_enabled = 0;
|
|
|
|
DWORD ce_size = sizeof(chimney_enabled);
|
|
|
|
#endif
|
2012-03-21 01:22:40 +00:00
|
|
|
|
2013-03-21 02:29:09 +00:00
|
|
|
label = (GtkWidget *)g_object_get_data(G_OBJECT(welcome_hb), CAPTURE_LABEL);
|
2012-03-20 21:13:28 +00:00
|
|
|
if (label) {
|
|
|
|
gtk_widget_destroy(label);
|
|
|
|
}
|
2013-03-21 02:29:09 +00:00
|
|
|
box_to_fill = (GtkWidget *)g_object_get_data(G_OBJECT(welcome_hb), CAPTURE_VIEW);
|
2012-03-20 21:13:28 +00:00
|
|
|
if (global_capture_opts.all_ifaces->len > 0) {
|
|
|
|
item_hb_interface_list = welcome_button(WIRESHARK_STOCK_CAPTURE_INTERFACES,
|
|
|
|
"Interface List",
|
|
|
|
"Live list of the capture interfaces\n(counts incoming packets)",
|
|
|
|
"Same as Capture/Interfaces menu or toolbar item",
|
|
|
|
welcome_button_callback_helper, capture_if_cb);
|
|
|
|
gtk_box_pack_start(GTK_BOX(box_to_fill), item_hb_interface_list, FALSE, FALSE, 5);
|
2012-11-29 22:58:16 +00:00
|
|
|
if_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
From Mike Garratt:
Friendly Names for interfaces on Windows
Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
+ Win32: "dumpcap -D" shows friendly_name in place of descript if known
+ All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
+ When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name).
+ console_display_name is used as the basis of the autogenerated temp
filenames
+ console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
+ Can now specify the interface using its name and friendly_name
+ Interface name matching is case insenstive
+ Name matching first attempts exact matching, then falls back to prefix
matching
(e.g. dumpcap -i local)
+ Validates interface names, instead of blindly sending them off to
winpcap/libpcap
+ Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
+ Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
+ Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name. Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
+ void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
+ Now uses wireshark_pcapng_* or wireshark_pcap_* depending on file format
+ Basis temp filename format on console_display_name
+ Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing)
GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
+ "Friendly Name" renamed to "NDIS Friendly Name"
+ Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
+ The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces.
+ Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"
svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
|
|
|
update_interface_scrolled_window_height();
|
|
|
|
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(if_scrolled_window), GTK_SHADOW_IN);
|
|
|
|
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(if_scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
2012-03-20 21:13:28 +00:00
|
|
|
g_object_set_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_INTERFACE_LIST, item_hb_interface_list);
|
|
|
|
|
|
|
|
if_view = gtk_tree_view_new ();
|
|
|
|
g_object_set(G_OBJECT(if_view), "headers-visible", FALSE, NULL);
|
|
|
|
g_signal_connect(if_view, "row-activated", G_CALLBACK(options_interface_cb), (gpointer)welcome_hb);
|
|
|
|
g_object_set_data(G_OBJECT(welcome_hb), TREE_VIEW_INTERFACES, if_view);
|
|
|
|
column = gtk_tree_view_column_new();
|
|
|
|
renderer = gtk_cell_renderer_pixbuf_new();
|
|
|
|
gtk_tree_view_column_pack_start(column, renderer, FALSE);
|
|
|
|
gtk_tree_view_column_set_attributes(column, renderer, "pixbuf", ICON, NULL);
|
|
|
|
renderer = gtk_cell_renderer_text_new();
|
|
|
|
gtk_tree_view_column_pack_start(column, renderer, TRUE);
|
|
|
|
gtk_tree_view_column_set_attributes(column, renderer, "text", IFACE_DESCR, NULL);
|
|
|
|
gtk_tree_view_append_column(GTK_TREE_VIEW(if_view), column);
|
|
|
|
gtk_tree_view_column_set_resizable(gtk_tree_view_get_column(GTK_TREE_VIEW(if_view), 0), TRUE);
|
|
|
|
renderer = gtk_cell_renderer_text_new();
|
|
|
|
column = gtk_tree_view_column_new_with_attributes ("",
|
|
|
|
GTK_CELL_RENDERER(renderer),
|
|
|
|
"text", IFACE_NAME,
|
|
|
|
NULL);
|
|
|
|
gtk_tree_view_append_column(GTK_TREE_VIEW(if_view), column);
|
|
|
|
gtk_tree_view_column_set_visible(column, FALSE);
|
|
|
|
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(if_view));
|
|
|
|
gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
|
|
|
|
item_hb_start = welcome_button(WIRESHARK_STOCK_CAPTURE_START,
|
|
|
|
"Start",
|
|
|
|
"Choose one or more interfaces to capture from, then <b>Start</b>",
|
|
|
|
"Same as Capture/Interfaces with default options",
|
|
|
|
(welcome_button_callback_t)capture_if_start, (gpointer)if_view);
|
|
|
|
gtk_box_pack_start(GTK_BOX(box_to_fill), item_hb_start, FALSE, FALSE, 5);
|
Detangle the code that manages the interface list on the welcome screen:
fill_capture_box():
if there are interfaces on which to capture, constructs the
interface list, otherwise destroys the interface list and puts
up a message.
update_capture_box():
updates the interface list to reflect current reality.
welcome_if_panel_reload():
if there is an interface list, and if there are interfaces on
which to capture (so that we still want that list), updates the
list by calling update_capture_box(), otherwise creates or
destroys it by calling fill_capture_box() (as either it doesn't
exist but now needs to or does exist but needs to go away).
Have refresh_local_interface_lists(), which re-fetches the list of local
interfaces and updates every interface list that includes local
interfaces, and refresh_non_local_interface_lists(), which only updates
interface lists that (also) include interfaces other than local
interfaces (such as pipes and remote interfaces). Call them in the
apprpriate places (if we know the list of local interfaces has been
updated, call refresh_local_interface_lists(), otherwise, if we know
interfaces other than local interfaces have been added or removed, call
refresh_non_local_interface_lists()).
Don't have any routine that updates the interface list for one widget
update the interface list for any other widget; leave the global
updating of interface lists up to refresh_local_interface_lists() and
refresh_non_local_interface_lists() - only call one of them if any
interface lists are to be updated.
svn path=/trunk/; revision=43517
2012-06-28 08:13:21 +00:00
|
|
|
update_capture_box();
|
From Mike Garratt:
Friendly Names for interfaces on Windows
Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
+ Win32: "dumpcap -D" shows friendly_name in place of descript if known
+ All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
+ When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name).
+ console_display_name is used as the basis of the autogenerated temp
filenames
+ console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
+ Can now specify the interface using its name and friendly_name
+ Interface name matching is case insenstive
+ Name matching first attempts exact matching, then falls back to prefix
matching
(e.g. dumpcap -i local)
+ Validates interface names, instead of blindly sending them off to
winpcap/libpcap
+ Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
+ Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
+ Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name. Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
+ void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
+ Now uses wireshark_pcapng_* or wireshark_pcap_* depending on file format
+ Basis temp filename format on console_display_name
+ Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing)
GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
+ "Friendly Name" renamed to "NDIS Friendly Name"
+ Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
+ The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces.
+ Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"
svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (if_scrolled_window), if_view);
|
|
|
|
gtk_container_add(GTK_CONTAINER(box_to_fill), if_scrolled_window);
|
2012-03-20 21:13:28 +00:00
|
|
|
g_object_set_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_START, item_hb_start);
|
|
|
|
|
|
|
|
item_hb_capture = welcome_button(WIRESHARK_STOCK_CAPTURE_OPTIONS,
|
|
|
|
"Capture Options",
|
|
|
|
"Start a capture with detailed options",
|
|
|
|
"Same as Capture/Options menu or toolbar item",
|
|
|
|
welcome_button_callback_helper, capture_prep_cb);
|
|
|
|
gtk_box_pack_start(GTK_BOX(box_to_fill), item_hb_capture, FALSE, FALSE, 5);
|
|
|
|
g_object_set_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_CAPTURE, item_hb_capture);
|
|
|
|
#ifdef _WIN32
|
|
|
|
/* Check for chimney offloading */
|
|
|
|
reg_ret = RegQueryValueEx(HKEY_LOCAL_MACHINE,
|
|
|
|
_T("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\EnableTCPChimney"),
|
|
|
|
NULL, NULL, (LPBYTE) &chimney_enabled, &ce_size);
|
|
|
|
if (reg_ret == ERROR_SUCCESS && chimney_enabled) {
|
2012-09-29 14:15:20 +00:00
|
|
|
welcome_button(WIRESHARK_STOCK_WIKI,
|
|
|
|
"Offloading Detected",
|
|
|
|
"TCP Chimney offloading is enabled. You \nmight not capture much data.",
|
|
|
|
topic_online_url(ONLINEPAGE_CHIMNEY),
|
|
|
|
topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_CHIMNEY));
|
2012-03-20 21:13:28 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(box_to_fill), item_hb_capture, FALSE, FALSE, 5);
|
|
|
|
}
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
} else {
|
|
|
|
if (if_view) {
|
|
|
|
clear_capture_box();
|
|
|
|
}
|
2012-11-29 22:58:16 +00:00
|
|
|
|
From Mike Garratt:
Friendly Names for interfaces on Windows
Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
+ Win32: "dumpcap -D" shows friendly_name in place of descript if known
+ All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
+ When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name).
+ console_display_name is used as the basis of the autogenerated temp
filenames
+ console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
+ Can now specify the interface using its name and friendly_name
+ Interface name matching is case insenstive
+ Name matching first attempts exact matching, then falls back to prefix
matching
(e.g. dumpcap -i local)
+ Validates interface names, instead of blindly sending them off to
winpcap/libpcap
+ Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
+ Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
+ Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name. Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
+ void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
+ Now uses wireshark_pcapng_* or wireshark_pcap_* depending on file format
+ Basis temp filename format on console_display_name
+ Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing)
GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
+ "Friendly Name" renamed to "NDIS Friendly Name"
+ Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
+ The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces.
+ Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"
svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
|
|
|
/* run capture_interface_list(), not to get the interfaces, but to detect
|
|
|
|
* any errors, if there is an error, display an appropriate message in the gui */
|
2012-03-21 09:54:05 +00:00
|
|
|
capture_interface_list(&error, &err_str);
|
2012-03-21 06:20:01 +00:00
|
|
|
switch (error) {
|
|
|
|
|
|
|
|
case CANT_GET_INTERFACE_LIST:
|
2012-04-15 23:03:58 +00:00
|
|
|
label_text = g_strdup_printf("No interface can be used for capturing in "
|
|
|
|
"this system with the current configuration.\n\n"
|
|
|
|
"(%s)\n"
|
|
|
|
"\n"
|
|
|
|
"See Capture Help below for details.",
|
|
|
|
err_str);
|
2012-03-21 06:20:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NO_INTERFACES_FOUND:
|
|
|
|
label_text = g_strdup("No interface can be used for capturing in "
|
|
|
|
"this system with the current configuration.\n"
|
|
|
|
"\n"
|
|
|
|
"See Capture Help below for details.");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DONT_HAVE_PCAP:
|
|
|
|
label_text = g_strdup("WinPcap doesn't appear to be installed. "
|
|
|
|
"In order to capture packets, WinPcap "
|
|
|
|
"must be installed; see\n"
|
|
|
|
"\n"
|
2012-03-20 21:13:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(2,18,0)
|
2012-03-21 06:20:01 +00:00
|
|
|
" <a href=\"http://www.winpcap.org/\">http://www.winpcap.org/</a>\n"
|
2012-03-20 21:13:28 +00:00
|
|
|
#else
|
2012-03-21 06:20:01 +00:00
|
|
|
" http://www.winpcap.org/\n"
|
2012-03-20 21:13:28 +00:00
|
|
|
#endif
|
2012-03-21 06:20:01 +00:00
|
|
|
"\n"
|
|
|
|
"or the mirror at\n"
|
|
|
|
"\n"
|
2012-03-20 21:13:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(2,18,0)
|
2012-03-21 06:20:01 +00:00
|
|
|
" <a href=\"http://www.mirrors.wiretapped.net/security/packet-capture/winpcap/\">http://www.mirrors.wiretapped.net/security/packet-capture/winpcap/</a>\n"
|
2012-03-20 21:13:28 +00:00
|
|
|
#else
|
2012-03-21 06:20:01 +00:00
|
|
|
" http://www.mirrors.wiretapped.net/security/packet-capture/winpcap/\n"
|
2012-03-20 21:13:28 +00:00
|
|
|
#endif
|
2012-03-21 06:20:01 +00:00
|
|
|
"\n"
|
|
|
|
"or the mirror at\n"
|
|
|
|
"\n"
|
2012-03-20 21:13:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(2,18,0)
|
2012-03-21 06:20:01 +00:00
|
|
|
" <a href=\"http://winpcap.cs.pu.edu.tw/\">http://winpcap.cs.pu.edu.tw/</a>\n"
|
2012-03-20 21:13:28 +00:00
|
|
|
#else
|
2012-03-21 06:20:01 +00:00
|
|
|
" http://winpcap.cs.pu.edu.tw/\n"
|
2012-03-20 21:13:28 +00:00
|
|
|
#endif
|
|
|
|
"\n"
|
2012-03-21 06:20:01 +00:00
|
|
|
"for a downloadable version of WinPcap "
|
|
|
|
"and for instructions on how to install "
|
|
|
|
"WinPcap.");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
label_text = g_strdup_printf("Error = %d; this \"can't happen\".", error);
|
|
|
|
break;
|
2012-03-20 21:13:28 +00:00
|
|
|
}
|
2012-04-15 23:03:58 +00:00
|
|
|
if (err_str != NULL)
|
|
|
|
g_free(err_str);
|
2012-03-20 21:13:28 +00:00
|
|
|
w = gtk_label_new(label_text);
|
|
|
|
gtk_label_set_markup(GTK_LABEL(w), label_text);
|
|
|
|
gtk_label_set_line_wrap(GTK_LABEL(w), TRUE);
|
|
|
|
g_free (label_text);
|
|
|
|
gtk_misc_set_alignment (GTK_MISC(w), 0.0f, 0.0f);
|
|
|
|
gtk_box_pack_start(GTK_BOX(box_to_fill), w, FALSE, FALSE, 5);
|
|
|
|
#if GTK_CHECK_VERSION(2,18,0)
|
|
|
|
g_signal_connect(w, "activate-link", G_CALLBACK(activate_link_cb), NULL);
|
|
|
|
#endif
|
|
|
|
g_object_set_data(G_OBJECT(welcome_hb), CAPTURE_LABEL, w);
|
2012-08-08 07:53:57 +00:00
|
|
|
if (error == CANT_GET_INTERFACE_LIST || error == NO_INTERFACES_FOUND) {
|
|
|
|
item_hb_refresh = welcome_button(GTK_STOCK_REFRESH,
|
|
|
|
"Refresh Interfaces",
|
|
|
|
"Get a new list of the local interfaces.",
|
|
|
|
"Click the title to get a new list of interfaces",
|
|
|
|
welcome_button_callback_helper, refresh_interfaces_cb);
|
|
|
|
gtk_box_pack_start(GTK_BOX(box_to_fill), item_hb_refresh, FALSE, FALSE, 5);
|
|
|
|
g_object_set_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_REFRESH, item_hb_refresh);
|
|
|
|
}
|
2012-03-20 21:13:28 +00:00
|
|
|
}
|
|
|
|
}
|
2012-03-21 01:22:40 +00:00
|
|
|
#endif /* HAVE_LIBPCAP */
|
2008-04-15 02:14:22 +00:00
|
|
|
|
2010-08-19 15:02:23 +00:00
|
|
|
|
2008-06-18 20:14:28 +00:00
|
|
|
/* reload the list of interfaces */
|
|
|
|
void
|
|
|
|
welcome_if_panel_reload(void)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_LIBPCAP
|
2012-01-25 13:04:32 +00:00
|
|
|
if (welcome_hb) {
|
Detangle the code that manages the interface list on the welcome screen:
fill_capture_box():
if there are interfaces on which to capture, constructs the
interface list, otherwise destroys the interface list and puts
up a message.
update_capture_box():
updates the interface list to reflect current reality.
welcome_if_panel_reload():
if there is an interface list, and if there are interfaces on
which to capture (so that we still want that list), updates the
list by calling update_capture_box(), otherwise creates or
destroys it by calling fill_capture_box() (as either it doesn't
exist but now needs to or does exist but needs to go away).
Have refresh_local_interface_lists(), which re-fetches the list of local
interfaces and updates every interface list that includes local
interfaces, and refresh_non_local_interface_lists(), which only updates
interface lists that (also) include interfaces other than local
interfaces (such as pipes and remote interfaces). Call them in the
apprpriate places (if we know the list of local interfaces has been
updated, call refresh_local_interface_lists(), otherwise, if we know
interfaces other than local interfaces have been added or removed, call
refresh_non_local_interface_lists()).
Don't have any routine that updates the interface list for one widget
update the interface list for any other widget; leave the global
updating of interface lists up to refresh_local_interface_lists() and
refresh_non_local_interface_lists() - only call one of them if any
interface lists are to be updated.
svn path=/trunk/; revision=43517
2012-06-28 08:13:21 +00:00
|
|
|
/* If we have a list of interfaces, and if the current interface
|
|
|
|
list is non-empty, just update the interface list. Otherwise,
|
|
|
|
create it (as we didn't have it) or destroy it (as we won't
|
|
|
|
have it). */
|
From Mike Garratt:
Friendly Names for interfaces on Windows
Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
+ Win32: "dumpcap -D" shows friendly_name in place of descript if known
+ All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
+ When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name).
+ console_display_name is used as the basis of the autogenerated temp
filenames
+ console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
+ Can now specify the interface using its name and friendly_name
+ Interface name matching is case insenstive
+ Name matching first attempts exact matching, then falls back to prefix
matching
(e.g. dumpcap -i local)
+ Validates interface names, instead of blindly sending them off to
winpcap/libpcap
+ Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
+ Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
+ Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name. Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
+ void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
+ Now uses wireshark_pcapng_* or wireshark_pcap_* depending on file format
+ Basis temp filename format on console_display_name
+ Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing)
GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
+ "Friendly Name" renamed to "NDIS Friendly Name"
+ Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
+ The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces.
+ Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"
svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
|
|
|
if (if_view && if_scrolled_window && global_capture_opts.all_ifaces->len > 0) {
|
Detangle the code that manages the interface list on the welcome screen:
fill_capture_box():
if there are interfaces on which to capture, constructs the
interface list, otherwise destroys the interface list and puts
up a message.
update_capture_box():
updates the interface list to reflect current reality.
welcome_if_panel_reload():
if there is an interface list, and if there are interfaces on
which to capture (so that we still want that list), updates the
list by calling update_capture_box(), otherwise creates or
destroys it by calling fill_capture_box() (as either it doesn't
exist but now needs to or does exist but needs to go away).
Have refresh_local_interface_lists(), which re-fetches the list of local
interfaces and updates every interface list that includes local
interfaces, and refresh_non_local_interface_lists(), which only updates
interface lists that (also) include interfaces other than local
interfaces (such as pipes and remote interfaces). Call them in the
apprpriate places (if we know the list of local interfaces has been
updated, call refresh_local_interface_lists(), otherwise, if we know
interfaces other than local interfaces have been added or removed, call
refresh_non_local_interface_lists()).
Don't have any routine that updates the interface list for one widget
update the interface list for any other widget; leave the global
updating of interface lists up to refresh_local_interface_lists() and
refresh_non_local_interface_lists() - only call one of them if any
interface lists are to be updated.
svn path=/trunk/; revision=43517
2012-06-28 08:13:21 +00:00
|
|
|
update_capture_box();
|
|
|
|
} else {
|
2012-08-08 07:53:57 +00:00
|
|
|
GtkWidget *item_hb;
|
2013-03-21 02:29:09 +00:00
|
|
|
item_hb = (GtkWidget *)g_object_get_data(G_OBJECT(welcome_hb), CAPTURE_HB_BOX_REFRESH);
|
2012-08-08 07:53:57 +00:00
|
|
|
if (item_hb) {
|
|
|
|
gtk_widget_destroy(item_hb);
|
|
|
|
}
|
Detangle the code that manages the interface list on the welcome screen:
fill_capture_box():
if there are interfaces on which to capture, constructs the
interface list, otherwise destroys the interface list and puts
up a message.
update_capture_box():
updates the interface list to reflect current reality.
welcome_if_panel_reload():
if there is an interface list, and if there are interfaces on
which to capture (so that we still want that list), updates the
list by calling update_capture_box(), otherwise creates or
destroys it by calling fill_capture_box() (as either it doesn't
exist but now needs to or does exist but needs to go away).
Have refresh_local_interface_lists(), which re-fetches the list of local
interfaces and updates every interface list that includes local
interfaces, and refresh_non_local_interface_lists(), which only updates
interface lists that (also) include interfaces other than local
interfaces (such as pipes and remote interfaces). Call them in the
apprpriate places (if we know the list of local interfaces has been
updated, call refresh_local_interface_lists(), otherwise, if we know
interfaces other than local interfaces have been added or removed, call
refresh_non_local_interface_lists()).
Don't have any routine that updates the interface list for one widget
update the interface list for any other widget; leave the global
updating of interface lists up to refresh_local_interface_lists() and
refresh_non_local_interface_lists() - only call one of them if any
interface lists are to be updated.
svn path=/trunk/; revision=43517
2012-06-28 08:13:21 +00:00
|
|
|
fill_capture_box();
|
|
|
|
}
|
2012-01-25 13:04:32 +00:00
|
|
|
gtk_widget_show_all(welcome_hb);
|
2008-06-18 20:14:28 +00:00
|
|
|
}
|
|
|
|
#endif /* HAVE_LIBPCAP */
|
|
|
|
}
|
|
|
|
|
2011-07-06 11:22:38 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2011-07-19 12:42:18 +00:00
|
|
|
static void capture_if_start(GtkWidget *w _U_, gpointer data _U_)
|
2011-07-06 09:17:06 +00:00
|
|
|
{
|
2011-07-19 12:42:18 +00:00
|
|
|
#ifdef HAVE_AIRPCAP
|
2012-01-25 13:04:32 +00:00
|
|
|
interface_t device;
|
|
|
|
guint i;
|
2011-07-06 14:56:42 +00:00
|
|
|
#endif
|
2012-01-25 13:04:32 +00:00
|
|
|
if (global_capture_opts.num_selected == 0) {
|
|
|
|
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
|
|
|
|
"You didn't specify an interface on which to capture packets.");
|
|
|
|
return;
|
|
|
|
}
|
2011-10-20 19:44:40 +00:00
|
|
|
|
2012-01-25 13:04:32 +00:00
|
|
|
/* XXX - remove this? */
|
|
|
|
if (global_capture_opts.save_file) {
|
|
|
|
g_free(global_capture_opts.save_file);
|
|
|
|
global_capture_opts.save_file = NULL;
|
|
|
|
}
|
|
|
|
#ifdef HAVE_AIRPCAP /* TODO: don't let it depend on interface_opts */
|
|
|
|
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
|
|
|
|
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
|
|
|
|
airpcap_if_active = get_airpcap_if_from_name(airpcap_if_list, device.name);
|
|
|
|
airpcap_if_selected = airpcap_if_active;
|
|
|
|
if (airpcap_if_selected) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-04-02 17:15:58 +00:00
|
|
|
if (airpcap_if_active)
|
|
|
|
airpcap_set_toolbar_start_capture(airpcap_if_active);
|
2011-07-06 09:17:06 +00:00
|
|
|
#endif
|
2012-01-25 13:04:32 +00:00
|
|
|
capture_start_cb(NULL, NULL);
|
2011-07-06 11:22:38 +00:00
|
|
|
}
|
|
|
|
#endif
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2011-12-30 07:31:18 +00:00
|
|
|
#ifdef HAVE_LIBPCAP
|
2011-12-30 07:07:20 +00:00
|
|
|
#if GTK_CHECK_VERSION(2,18,0)
|
|
|
|
static gboolean
|
|
|
|
activate_link_cb(GtkLabel *label _U_, gchar *uri, gpointer user_data _U_)
|
|
|
|
{
|
2012-01-25 13:04:32 +00:00
|
|
|
return browser_open_url(uri);
|
2011-12-30 07:07:20 +00:00
|
|
|
}
|
|
|
|
#endif
|
2011-12-30 07:31:18 +00:00
|
|
|
#endif
|
2011-12-30 07:07:20 +00:00
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* create the welcome page */
|
2008-04-04 23:16:07 +00:00
|
|
|
GtkWidget *
|
|
|
|
welcome_new(void)
|
|
|
|
{
|
|
|
|
GtkWidget *welcome_scrollw;
|
2009-12-02 00:31:04 +00:00
|
|
|
GtkWidget *welcome_eb;
|
2008-04-04 23:16:07 +00:00
|
|
|
GtkWidget *welcome_vb;
|
|
|
|
GtkWidget *column_vb;
|
|
|
|
GtkWidget *item_hb;
|
|
|
|
GtkWidget *w;
|
|
|
|
GtkWidget *header;
|
|
|
|
GtkWidget *topic_vb;
|
|
|
|
GtkWidget *topic_to_fill;
|
2012-03-20 21:13:28 +00:00
|
|
|
GtkWidget *topic_capture_to_fill;
|
2012-01-25 13:04:32 +00:00
|
|
|
gchar *label_text;
|
2012-03-20 21:13:28 +00:00
|
|
|
GtkWidget *file_child_box;
|
2012-07-22 15:58:36 +00:00
|
|
|
|
2008-04-15 02:14:22 +00:00
|
|
|
/* prepare colors */
|
2011-08-17 10:53:46 +00:00
|
|
|
#if 0
|
2012-03-20 21:13:28 +00:00
|
|
|
/* Allocating color isn't necessary? */
|
2009-12-02 00:31:04 +00:00
|
|
|
|
|
|
|
/* "page" background */
|
|
|
|
get_color(&welcome_bg);
|
|
|
|
|
2008-04-15 02:14:22 +00:00
|
|
|
/* header bar background color */
|
|
|
|
get_color(&header_bar_bg);
|
|
|
|
|
|
|
|
/* topic header background color */
|
|
|
|
get_color(&topic_header_bg);
|
|
|
|
|
2008-05-14 10:56:31 +00:00
|
|
|
/* topic content background color */
|
2008-04-15 02:14:22 +00:00
|
|
|
get_color(&topic_content_bg);
|
2011-08-17 10:53:46 +00:00
|
|
|
#endif
|
2011-08-18 06:43:35 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
|
|
|
rgba_topic_item_idle_bg = rgba_topic_content_bg;
|
|
|
|
#else
|
2008-04-17 00:31:38 +00:00
|
|
|
topic_item_idle_bg = topic_content_bg;
|
2011-08-18 06:43:35 +00:00
|
|
|
#endif
|
2011-08-17 10:53:46 +00:00
|
|
|
#if 0
|
2012-01-25 13:04:32 +00:00
|
|
|
/* Allocating collor isn't necessary? */
|
2008-05-14 10:56:31 +00:00
|
|
|
/* topic item entered color */
|
2008-04-17 00:31:38 +00:00
|
|
|
get_color(&topic_item_entered_bg);
|
2011-08-17 10:53:46 +00:00
|
|
|
#endif
|
2008-04-04 23:16:07 +00:00
|
|
|
welcome_scrollw = scrolled_window_new(NULL, NULL);
|
|
|
|
|
2012-06-02 23:53:04 +00:00
|
|
|
welcome_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 0, FALSE);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2009-12-02 00:31:04 +00:00
|
|
|
welcome_eb = gtk_event_box_new();
|
|
|
|
gtk_container_add(GTK_CONTAINER(welcome_eb), welcome_vb);
|
2011-08-18 06:37:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
2012-07-20 11:10:29 +00:00
|
|
|
gtk_widget_override_background_color(welcome_eb, GTK_STATE_FLAG_NORMAL, &rgba_welcome_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#else
|
2012-01-25 13:04:32 +00:00
|
|
|
gtk_widget_modify_bg(welcome_eb, GTK_STATE_NORMAL, &welcome_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#endif
|
2008-04-04 23:16:07 +00:00
|
|
|
/* header */
|
|
|
|
header = welcome_header_new();
|
|
|
|
gtk_box_pack_start(GTK_BOX(welcome_vb), header, FALSE, FALSE, 0);
|
|
|
|
|
|
|
|
/* content */
|
2012-06-02 23:53:04 +00:00
|
|
|
welcome_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10, FALSE);
|
2008-06-29 15:51:43 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(welcome_hb), 10);
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(welcome_vb), welcome_hb, TRUE, TRUE, 0);
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
|
2008-04-04 23:16:07 +00:00
|
|
|
/* column capture */
|
2012-06-02 23:53:04 +00:00
|
|
|
column_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 10, FALSE);
|
2011-08-18 06:37:28 +00:00
|
|
|
#if GTK_CHECK_VERSION(3,0,0)
|
2012-07-20 11:10:29 +00:00
|
|
|
gtk_widget_override_background_color(column_vb, GTK_STATE_FLAG_NORMAL, &rgba_welcome_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#else
|
2009-12-02 00:31:04 +00:00
|
|
|
gtk_widget_modify_bg(column_vb, GTK_STATE_NORMAL, &welcome_bg);
|
2011-08-18 06:37:28 +00:00
|
|
|
#endif
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(welcome_hb), column_vb, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
/* capture topic */
|
2012-03-20 21:13:28 +00:00
|
|
|
topic_vb = welcome_topic_new("Capture", &topic_capture_to_fill);
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
|
2012-03-20 21:13:28 +00:00
|
|
|
g_object_set_data(G_OBJECT(welcome_hb), CAPTURE_VIEW, topic_capture_to_fill);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBPCAP
|
2012-08-01 22:32:14 +00:00
|
|
|
fill_in_local_interfaces();
|
2012-03-20 21:13:28 +00:00
|
|
|
fill_capture_box();
|
2011-07-14 23:18:02 +00:00
|
|
|
|
2008-04-04 23:16:07 +00:00
|
|
|
/* capture help topic */
|
|
|
|
topic_vb = welcome_topic_new("Capture Help", &topic_to_fill);
|
|
|
|
gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
|
2010-08-19 15:02:23 +00:00
|
|
|
"How to Capture",
|
|
|
|
"Step by step to a successful capture setup",
|
2008-04-17 03:24:24 +00:00
|
|
|
topic_online_url(ONLINEPAGE_CAPTURE_SETUP),
|
2010-08-19 15:02:23 +00:00
|
|
|
topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_CAPTURE_SETUP));
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
|
2010-08-19 15:02:23 +00:00
|
|
|
"Network Media",
|
2010-10-05 06:59:11 +00:00
|
|
|
"Specific information for capturing on:\nEthernet, WLAN, ...",
|
2008-04-17 03:24:24 +00:00
|
|
|
topic_online_url(ONLINEPAGE_NETWORK_MEDIA),
|
2010-08-19 15:02:23 +00:00
|
|
|
topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_NETWORK_MEDIA));
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
|
2008-04-15 02:14:22 +00:00
|
|
|
#else
|
2011-08-30 12:47:24 +00:00
|
|
|
label_text = g_strdup("<span foreground=\"black\">Capturing is not compiled into\nthis version of Wireshark!</span>");
|
2008-05-14 10:56:31 +00:00
|
|
|
w = gtk_label_new(label_text);
|
|
|
|
gtk_label_set_markup(GTK_LABEL(w), label_text);
|
|
|
|
g_free (label_text);
|
2009-04-22 00:49:00 +00:00
|
|
|
gtk_misc_set_alignment (GTK_MISC(w), 0.0f, 0.0f);
|
2012-03-20 21:13:28 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_capture_to_fill), w, FALSE, FALSE, 5);
|
2008-04-15 22:46:35 +00:00
|
|
|
#endif /* HAVE_LIBPCAP */
|
2008-04-04 23:16:07 +00:00
|
|
|
|
|
|
|
/* fill bottom space */
|
|
|
|
w = gtk_label_new("");
|
2012-03-20 21:13:28 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_capture_to_fill), w, TRUE, TRUE, 0);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* column files */
|
|
|
|
topic_vb = welcome_topic_new("Files", &topic_to_fill);
|
|
|
|
gtk_box_pack_start(GTK_BOX(welcome_hb), topic_vb, TRUE, TRUE, 0);
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
item_hb = welcome_button(GTK_STOCK_OPEN,
|
2008-04-15 02:14:22 +00:00
|
|
|
"Open",
|
2010-08-19 15:02:23 +00:00
|
|
|
"Open a previously captured file",
|
2008-04-17 03:24:24 +00:00
|
|
|
"Same as File/Open menu or toolbar item",
|
2010-08-19 15:02:23 +00:00
|
|
|
welcome_button_callback_helper, file_open_cmd_cb);
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
/* prepare list of recent files (will be filled in later) */
|
2009-03-12 07:56:42 +00:00
|
|
|
label_text = g_strdup("<span foreground=\"black\">Open Recent:</span>");
|
2008-05-14 10:56:31 +00:00
|
|
|
w = gtk_label_new(label_text);
|
|
|
|
gtk_label_set_markup(GTK_LABEL(w), label_text);
|
|
|
|
g_free (label_text);
|
2009-04-21 16:57:52 +00:00
|
|
|
gtk_misc_set_alignment (GTK_MISC(w), 0.0f, 0.0f);
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_to_fill), w, FALSE, FALSE, 5);
|
|
|
|
|
2012-06-02 23:53:04 +00:00
|
|
|
file_child_box = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 1, FALSE);
|
2008-04-19 13:33:42 +00:00
|
|
|
/* 17 file items or 300 pixels height is about the size */
|
|
|
|
/* that still fits on a screen of about 1000*700 */
|
2011-07-06 09:17:06 +00:00
|
|
|
welcome_file_panel_vb = scroll_box_dynamic_new(GTK_WIDGET(file_child_box), 17, 300);
|
2008-04-15 22:46:35 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_to_fill), welcome_file_panel_vb, FALSE, FALSE, 0);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
|
2008-04-15 02:14:22 +00:00
|
|
|
"Sample Captures",
|
2010-08-19 15:02:23 +00:00
|
|
|
"A rich assortment of example capture files on the wiki",
|
2008-04-17 03:24:24 +00:00
|
|
|
topic_online_url(ONLINEPAGE_SAMPLE_CAPTURES),
|
2010-08-19 15:02:23 +00:00
|
|
|
topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_SAMPLE_CAPTURES));
|
2008-04-15 02:14:22 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
|
|
|
|
|
|
|
|
/* fill bottom space */
|
2008-04-04 23:16:07 +00:00
|
|
|
w = gtk_label_new("");
|
|
|
|
gtk_box_pack_start(GTK_BOX(topic_to_fill), w, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
|
|
|
|
/* column online */
|
2012-06-02 23:53:04 +00:00
|
|
|
column_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 10, FALSE);
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(welcome_hb), column_vb, TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
/* topic online */
|
|
|
|
topic_vb = welcome_topic_new("Online", &topic_to_fill);
|
|
|
|
gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
item_hb = welcome_button(GTK_STOCK_HOME,
|
2008-04-15 02:14:22 +00:00
|
|
|
"Website",
|
2010-08-19 15:02:23 +00:00
|
|
|
"Visit the project's website",
|
2008-04-17 03:24:24 +00:00
|
|
|
topic_online_url(ONLINEPAGE_HOME),
|
2010-08-19 15:02:23 +00:00
|
|
|
topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_HOME));
|
2008-04-15 02:14:22 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
|
|
|
|
|
2010-08-19 15:02:23 +00:00
|
|
|
#ifdef HHC_DIR
|
2008-04-15 22:46:35 +00:00
|
|
|
item_hb = welcome_button(GTK_STOCK_HELP,
|
2008-04-15 02:14:22 +00:00
|
|
|
"User's Guide",
|
2010-08-19 15:02:23 +00:00
|
|
|
"The User's Guide "
|
2010-06-20 16:27:03 +00:00
|
|
|
"(local version, if installed)",
|
2008-04-17 03:24:24 +00:00
|
|
|
"Locally installed (if installed) otherwise online version",
|
2010-08-19 15:02:23 +00:00
|
|
|
topic_menu_cb, GINT_TO_POINTER(HELP_CONTENT));
|
2010-06-20 16:27:03 +00:00
|
|
|
#else
|
2010-08-19 15:02:23 +00:00
|
|
|
item_hb = welcome_button(GTK_STOCK_HELP,
|
|
|
|
"User's Guide",
|
|
|
|
"The User's Guide "
|
2010-06-20 16:27:03 +00:00
|
|
|
"(online version)",
|
|
|
|
topic_online_url(ONLINEPAGE_USERGUIDE),
|
2010-08-19 15:02:23 +00:00
|
|
|
topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_USERGUIDE));
|
2010-06-20 16:27:03 +00:00
|
|
|
#endif
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
|
|
|
|
|
2008-04-15 22:46:35 +00:00
|
|
|
item_hb = welcome_button(WIRESHARK_STOCK_WIKI,
|
2008-04-15 02:14:22 +00:00
|
|
|
"Security",
|
2010-08-19 15:02:23 +00:00
|
|
|
"Work with Wireshark as securely as possible",
|
2008-04-17 03:24:24 +00:00
|
|
|
topic_online_url(ONLINEPAGE_SECURITY),
|
2010-08-19 15:02:23 +00:00
|
|
|
topic_menu_cb, GINT_TO_POINTER(ONLINEPAGE_SECURITY));
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_to_fill), item_hb, FALSE, FALSE, 5);
|
|
|
|
|
2008-04-15 02:14:22 +00:00
|
|
|
#if 0
|
|
|
|
/* XXX - add this, once the Windows update functionality is implemented */
|
2008-04-04 23:16:07 +00:00
|
|
|
/* topic updates */
|
|
|
|
topic_vb = welcome_topic_new("Updates", &topic_to_fill);
|
|
|
|
gtk_box_pack_start(GTK_BOX(column_vb), topic_vb, TRUE, TRUE, 0);
|
|
|
|
|
2009-03-12 07:56:42 +00:00
|
|
|
label_text = g_strdup("<span foreground=\"black\">No updates available!</span>");
|
2008-05-14 10:56:31 +00:00
|
|
|
w = gtk_label_new(label_text);
|
|
|
|
gtk_label_set_markup(GTK_LABEL(w), label_text);
|
|
|
|
g_free (label_text);
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(topic_to_fill), w, TRUE, TRUE, 0);
|
2008-04-15 02:14:22 +00:00
|
|
|
#endif
|
2008-04-04 23:16:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* the end */
|
2009-12-02 00:31:04 +00:00
|
|
|
gtk_widget_show_all(welcome_eb);
|
2008-04-04 23:16:07 +00:00
|
|
|
|
2013-03-04 19:20:39 +00:00
|
|
|
#if ! GTK_CHECK_VERSION(3,8,0)
|
|
|
|
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(welcome_scrollw), welcome_eb);
|
|
|
|
#else
|
|
|
|
gtk_container_add(GTK_CONTAINER(welcome_scrollw), welcome_eb);
|
|
|
|
#endif
|
2008-04-04 23:16:07 +00:00
|
|
|
gtk_widget_show_all(welcome_scrollw);
|
|
|
|
|
2011-11-09 23:43:50 +00:00
|
|
|
#if GLIB_CHECK_VERSION(2,31,0)
|
2013-03-21 02:29:09 +00:00
|
|
|
recent_mtx = (GMutex *)g_malloc(sizeof(GMutex));
|
2011-11-10 04:01:09 +00:00
|
|
|
g_mutex_init(recent_mtx);
|
2011-11-09 23:43:50 +00:00
|
|
|
#else
|
2011-07-14 23:18:02 +00:00
|
|
|
recent_mtx = g_mutex_new();
|
2011-11-09 23:43:50 +00:00
|
|
|
#endif
|
2011-07-14 23:18:02 +00:00
|
|
|
|
2008-04-04 23:16:07 +00:00
|
|
|
return welcome_scrollw;
|
|
|
|
}
|
2011-07-20 12:51:57 +00:00
|
|
|
|
|
|
|
GtkWidget* get_welcome_window(void)
|
|
|
|
{
|
2012-01-25 13:04:32 +00:00
|
|
|
return welcome_hb;
|
2011-07-20 12:51:57 +00:00
|
|
|
}
|