aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-10-29 04:05:27 +0000
committerGerald Combs <gerald@wireshark.org>2013-10-29 04:05:27 +0000
commitba49d9bcf01a597ebec66c3d65c4813ebf174806 (patch)
tree24a8dc06b7825a9b8d252a148eeb0809d75201e6 /ui
parent58d01512b16728b357b2f6481c592a71c7ab8435 (diff)
Revert part of 52896 and (for now) all of 52935. As Jeff pointed out,
the PortableApps version relies on U3_-prefixed environment variables. svn path=/trunk/; revision=52941
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/file_dlg.c11
-rw-r--r--ui/gtk/main.c13
-rw-r--r--ui/gtk/main_menubar.c12
-rw-r--r--ui/qt/main.cpp7
-rw-r--r--ui/qt/wireshark_application.cpp5
-rw-r--r--ui/recent.c12
6 files changed, 55 insertions, 5 deletions
diff --git a/ui/gtk/file_dlg.c b/ui/gtk/file_dlg.c
index e215f9fc90..88b3f84660 100644
--- a/ui/gtk/file_dlg.c
+++ b/ui/gtk/file_dlg.c
@@ -75,6 +75,9 @@ file_selection_new(const gchar *title, GtkWindow *parent,
{
GtkWidget *win;
GtkFileChooserAction gtk_action;
+#ifdef _WIN32
+ char *u3devicedocumentpath;
+#endif
const gchar *ok_button_text;
switch (action) {
@@ -125,6 +128,14 @@ file_selection_new(const gchar *title, GtkWindow *parent,
in which that file resided. */
if (last_open_dir)
file_selection_set_current_folder(win, last_open_dir);
+#ifdef _WIN32
+ else {
+ u3devicedocumentpath = getenv_utf8("U3_DEVICE_DOCUMENT_PATH");
+ if(u3devicedocumentpath != NULL)
+ file_selection_set_current_folder(win, u3devicedocumentpath);
+
+ }
+#endif
return win;
}
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index 5a0cae40b8..bad98e4873 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -64,6 +64,7 @@
#endif /* HAVE_LIBPORTAUDIO */
#include <wsutil/crash_info.h>
+#include <wsutil/u3.h>
#include <wsutil/privileges.h>
#include <wsutil/file_util.h>
@@ -1948,6 +1949,11 @@ get_gui_runtime_info(GString *str)
g_string_append(str, ", ");
get_runtime_airpcap_version(str);
#endif
+
+ if(u3_active()) {
+ g_string_append(str, ", ");
+ u3_runtime_info(str);
+ }
}
static e_prefs *
@@ -3185,6 +3191,10 @@ main(int argc, char *argv[])
main_filter_packets(&cfile, dfilter, FALSE);
}
+
+ /* register our pid if we are being run from a U3 device */
+ u3_register_pid();
+
profile_store_persconffiles (FALSE);
#ifdef HAVE_GTKOSXAPPLICATION
@@ -3209,6 +3219,9 @@ main(int argc, char *argv[])
gtk_iface_mon_stop();
#endif
+ /* deregister our pid */
+ u3_deregister_pid();
+
epan_cleanup();
AirPDcapDestroyContext(&airpdcap_ctx);
diff --git a/ui/gtk/main_menubar.c b/ui/gtk/main_menubar.c
index 8491e5fa5e..e30b1cdbb5 100644
--- a/ui/gtk/main_menubar.c
+++ b/ui/gtk/main_menubar.c
@@ -28,6 +28,8 @@
#include <stdio.h>
#include <string.h>
+#include <wsutil/u3.h>
+
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#include <epan/prefs.h>
@@ -4403,7 +4405,10 @@ menu_recent_file_write_all(FILE *rf)
while (list != NULL) {
cf_name = (gchar *)list->data;
if (cf_name) {
- fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
+ if(u3_active())
+ fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
+ else
+ fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
}
list = g_list_previous(list);
}
@@ -4419,7 +4424,10 @@ menu_recent_file_write_all(FILE *rf)
/* get capture filename from the menu item label */
cf_name = (gchar *)g_object_get_data(G_OBJECT(child->data), MENU_RECENT_FILES_KEY);
if (cf_name) {
- fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
+ if(u3_active())
+ fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
+ else
+ fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name);
}
child = g_list_previous(child);
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index 4385e2beb2..9cc27d5d1f 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -37,6 +37,7 @@
#endif
#include <wsutil/crash_info.h>
+#include <wsutil/u3.h>
#include <wsutil/file_util.h>
#include <wiretap/merge.h>
@@ -434,6 +435,12 @@ get_gui_runtime_info(GString *str)
get_runtime_airpcap_version(str);
#endif
+
+ if(u3_active()) {
+ g_string_append(str, ", ");
+ u3_runtime_info(str);
+ }
+
}
/* And now our feature presentation... [ fade to music ] */
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 1579723682..cc8990a377 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -146,7 +146,10 @@ extern "C" void menu_recent_file_write_all(FILE *rf) {
/* get capture filename from the menu item label */
cf_name = rii.previous()->filename;
if (cf_name != NULL) {
- fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name.toUtf8().constData());
+// if(u3_active())
+// fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", u3_contract_device_path(cf_name));
+// else
+ fprintf (rf, RECENT_KEY_CAPTURE_FILE ": %s\n", cf_name.toUtf8().constData());
}
}
}
diff --git a/ui/recent.c b/ui/recent.c
index 480b99e275..41f5f93263 100644
--- a/ui/recent.c
+++ b/ui/recent.c
@@ -44,6 +44,7 @@
#include "ui/simple_dialog.h"
#include "ui/ui_util.h"
+#include <wsutil/u3.h>
#include <wsutil/file_util.h>
#include <wsutil/str_util.h>
@@ -663,7 +664,11 @@ write_profile_recent(void)
if (get_last_open_dir() != NULL) {
fprintf(rf, "\n# Last directory navigated to in File Open dialog.\n");
- fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", get_last_open_dir());
+
+ if(u3_active())
+ fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", u3_contract_device_path(get_last_open_dir()));
+ else
+ fprintf(rf, RECENT_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n", get_last_open_dir());
}
fclose(rf);
@@ -985,7 +990,10 @@ read_set_recent_pair_dynamic(gchar *key, const gchar *value,
return PREFS_SET_SYNTAX_ERR;
}
if (strcmp(key, RECENT_KEY_CAPTURE_FILE) == 0) {
- add_menu_recent_capture_file(value);
+ if (u3_active())
+ add_menu_recent_capture_file(u3_expand_device_path(value));
+ else
+ add_menu_recent_capture_file(value);
} else if (strcmp(key, RECENT_KEY_DISPLAY_FILTER) == 0) {
dfilter_combo_add_recent(value);
} else if (strcmp(key, RECENT_KEY_CAPTURE_FILTER) == 0) {