From: Mathieu Desnoyers Date: Wed, 17 Nov 2010 20:39:55 +0000 (-0500) Subject: Use the prettier GtkFileChooser dialog. X-Git-Tag: v0.12.36~1^2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ba01343213d0be590b9a567254f0f182304b7bf9;p=lttv.git Use the prettier GtkFileChooser dialog. (instead of the GtkFileSelector for the Add Trace menu and toolbar button action) Signed-off-by: Yannick Brosseau Signed-off-by: Mathieu Desnoyers --- diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index d58c3137..12296888 100644 --- a/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -1845,25 +1845,29 @@ void add_trace(GtkWidget * widget, gpointer user_data) tab = ptab->tab; } - //GtkDirSelection * file_selector = (GtkDirSelection *)gtk_dir_selection_new("Select a trace"); - GtkFileSelection * file_selector = (GtkFileSelection *)gtk_file_selection_new("Select a trace"); - gtk_widget_hide( (file_selector)->file_list->parent) ; - gtk_file_selection_hide_fileop_buttons(file_selector); - gtk_window_set_transient_for(GTK_WINDOW(file_selector), - GTK_WINDOW(mw_data->mwindow)); - + /* File open dialog management */ + GtkFileChooser * file_chooser = + GTK_FILE_CHOOSER( + gtk_file_chooser_dialog_new ("Select a trace", + GTK_WINDOW(mw_data->mwindow), + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL)); + + gtk_file_chooser_set_show_hidden (file_chooser, TRUE); if(remember_trace_dir[0] != '\0') - gtk_file_selection_set_filename(file_selector, remember_trace_dir); - - id = gtk_dialog_run(GTK_DIALOG(file_selector)); + gtk_file_chooser_set_filename(file_chooser, remember_trace_dir); + + id = gtk_dialog_run(GTK_DIALOG(file_chooser)); + switch(id){ case GTK_RESPONSE_ACCEPT: case GTK_RESPONSE_OK: - dir = gtk_file_selection_get_filename (file_selector); + dir = gtk_file_chooser_get_filename (file_chooser); strncpy(remember_trace_dir, dir, PATH_MAX); strncat(remember_trace_dir, "/", PATH_MAX); if(!dir || strlen(dir) == 0){ - gtk_widget_destroy((GtkWidget*)file_selector); break; } get_absolute_pathname(dir, abs_path); @@ -1893,7 +1897,6 @@ void add_trace(GtkWidget * widget, gpointer user_data) lttvwindow_add_trace(tab, trace_v); } - gtk_widget_destroy((GtkWidget*)file_selector); //update current tab //update_traceset(mw_data); @@ -1909,9 +1912,10 @@ void add_trace(GtkWidget * widget, gpointer user_data) case GTK_RESPONSE_REJECT: case GTK_RESPONSE_CANCEL: default: - gtk_widget_destroy((GtkWidget*)file_selector); - break; + break; } + gtk_widget_destroy((GtkWidget*)file_chooser); + } /* remove_trace removes a trace from the current traceset if all viewers in