aboutsummaryrefslogtreecommitdiffstats
path: root/trace-view-main.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace-view-main.c')
-rw-r--r--trace-view-main.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/trace-view-main.c b/trace-view-main.c
index 52678ce..7f1461b 100644
--- a/trace-view-main.c
+++ b/trace-view-main.c
@@ -28,6 +28,7 @@
28 28
29#include "trace-cmd.h" 29#include "trace-cmd.h"
30#include "trace-view.h" 30#include "trace-view.h"
31#include "trace-gui.h"
31 32
32#define version "0.1.1" 33#define version "0.1.1"
33 34
@@ -55,26 +56,19 @@ load_clicked (gpointer data)
55{ 56{
56 struct trace_tree_info *info = data; 57 struct trace_tree_info *info = data;
57 struct tracecmd_input *handle; 58 struct tracecmd_input *handle;
58 GtkWidget *dialog;
59 gchar *filename; 59 gchar *filename;
60 60
61 dialog = gtk_file_chooser_dialog_new("Load File", 61 filename = trace_get_file_dialog("Load File");
62 NULL, 62 if (!filename)
63 GTK_FILE_CHOOSER_ACTION_OPEN, 63 return;
64 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 64
65 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, 65 handle = tracecmd_open(filename);
66 NULL); 66 if (handle) {
67 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { 67 trace_view_reload(info->trace_tree, handle, info->spin);
68 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); 68 /* Free handle when freeing the trace tree */
69 handle = tracecmd_open(filename); 69 tracecmd_close(handle);
70 if (handle) {
71 trace_view_reload(info->trace_tree, handle, info->spin);
72 /* Free handle when freeing the trace tree */
73 tracecmd_close(handle);
74 }
75 g_free(filename);
76 } 70 }
77 gtk_widget_destroy(dialog); 71 g_free(filename);
78} 72}
79 73
80/* Callback for the clicked signal of the Exit button */ 74/* Callback for the clicked signal of the Exit button */