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