simplify the implementation of MyFileChooserButton::show_chooser
Do not try to show a native file dialog. I think this would be useless, since RT already uses non-native dialogs in other places, and I'm not sure it would be possible to replace all of them (e.g. in icmpanel.cc the dialog is customized by adding a checkbox for WB, and this is not possible with a native dialog).
This commit is contained in:
@@ -1190,7 +1190,6 @@ MyFileChooserButton::MyFileChooserButton(const Glib::ustring &title, Gtk::FileCh
|
|||||||
|
|
||||||
void MyFileChooserButton::show_chooser()
|
void MyFileChooserButton::show_chooser()
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
Gtk::FileChooserDialog dlg(*static_cast<Gtk::Window *>(get_toplevel()), title_, action_);
|
Gtk::FileChooserDialog dlg(*static_cast<Gtk::Window *>(get_toplevel()), title_, action_);
|
||||||
dlg.add_button("Cancel", Gtk::RESPONSE_CANCEL);
|
dlg.add_button("Cancel", Gtk::RESPONSE_CANCEL);
|
||||||
dlg.add_button("Ok", Gtk::RESPONSE_OK);
|
dlg.add_button("Ok", Gtk::RESPONSE_OK);
|
||||||
@@ -1215,33 +1214,6 @@ void MyFileChooserButton::show_chooser()
|
|||||||
lbl_.set_label(Glib::path_get_basename(filename_));
|
lbl_.set_label(Glib::path_get_basename(filename_));
|
||||||
selection_changed_.emit();
|
selection_changed_.emit();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
// TO BE COMPLETED!
|
|
||||||
GtkWindow *parent_window = static_cast<Gtk::Window *>(get_toplevel())->gobj();
|
|
||||||
GtkFileChooserNative *native;
|
|
||||||
GtkFileChooserAction action = action_;
|
|
||||||
gint res;
|
|
||||||
|
|
||||||
native = gtk_file_chooser_native_new (title_.c_str(),
|
|
||||||
parent_window,
|
|
||||||
action,
|
|
||||||
"_Ok",
|
|
||||||
"_Cancel");
|
|
||||||
|
|
||||||
res = gtk_native_dialog_run (GTK_NATIVE_DIALOG (native));
|
|
||||||
if (res == GTK_RESPONSE_ACCEPT)
|
|
||||||
{
|
|
||||||
char *filename;
|
|
||||||
GtkFileChooser *chooser = GTK_FILE_CHOOSER (native);
|
|
||||||
filename = gtk_file_chooser_get_filename (chooser);
|
|
||||||
filename_ = filename;
|
|
||||||
g_free (filename);
|
|
||||||
lbl_.set_label(Glib::path_get_basename(filename_));
|
|
||||||
selection_changed_.emit();
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref (native);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user