aboutsummaryrefslogtreecommitdiffstats
path: root/trace-dialog.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-06-14 23:05:02 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-06-14 23:05:02 -0400
commit45c1116397ec5fdcc81bb3fcfcc9290f8d257cf1 (patch)
tree931af0899ae0cc8ba1f90d3c8239dce78e2e5824 /trace-dialog.c
parente857f27f62317e180dd583f8b6e1b76d97ffaaec (diff)
kernel-shark: Only warn in file dialog if file exists
The warning of the file dialog will happen everytime even if the file does not exist. Fix that. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'trace-dialog.c')
-rw-r--r--trace-dialog.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/trace-dialog.c b/trace-dialog.c
index 795c608..73da046 100644
--- a/trace-dialog.c
+++ b/trace-dialog.c
@@ -24,6 +24,7 @@
24#include <stdarg.h> 24#include <stdarg.h>
25#include <errno.h> 25#include <errno.h>
26#include <ctype.h> 26#include <ctype.h>
27#include <sys/stat.h>
27 28
28#include "trace-compat.h" 29#include "trace-compat.h"
29#include "trace-cmd.h" 30#include "trace-cmd.h"
@@ -306,6 +307,7 @@ GtkResponseType trace_dialog(GtkWindow *parent, enum trace_dialog_type type,
306gchar *trace_get_file_dialog(const gchar *title, const char *open, 307gchar *trace_get_file_dialog(const gchar *title, const char *open,
307 gboolean warn) 308 gboolean warn)
308{ 309{
310 struct stat st;
309 GtkWidget *dialog; 311 GtkWidget *dialog;
310 GtkResponseType ret; 312 GtkResponseType ret;
311 gchar *filename = NULL; 313 gchar *filename = NULL;
@@ -325,7 +327,7 @@ gchar *trace_get_file_dialog(const gchar *title, const char *open,
325 327
326 if (ret == GTK_RESPONSE_ACCEPT) { 328 if (ret == GTK_RESPONSE_ACCEPT) {
327 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); 329 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
328 if (warn) { 330 if (filename && warn && (stat(filename, &st) >= 0)) {
329 ret = trace_dialog(GTK_WINDOW(dialog), TRACE_GUI_ASK, 331 ret = trace_dialog(GTK_WINDOW(dialog), TRACE_GUI_ASK,
330 "The file '%s' already exists.\n" 332 "The file '%s' already exists.\n"
331 "Are you sure you want to replace it", 333 "Are you sure you want to replace it",