]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/dirdlg.cpp
[ 1493802 ] Allow multiple wxComboCtrl::SetPopupControl calls.
[wxWidgets.git] / src / gtk / dirdlg.cpp
index bfd86d0b3956ae3815e8ca0f32e42410d1ada2bc..c75c1ceb9eaf60612215cfe85409d5db8ab3d5c9 100644 (file)
@@ -48,7 +48,7 @@ extern void wxapp_install_idle_handler();
 //-----------------------------------------------------------------------------
 
 extern "C" {
-static void gtk_filedialog_ok_callback(GtkWidget *widget, wxDirDialogGTK *dialog)
+static void gtk_dirdialog_ok_callback(GtkWidget *widget, wxDirDialogGTK *dialog)
 {
     gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
 
@@ -69,7 +69,7 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxDirDialogGTK *dialog
 //-----------------------------------------------------------------------------
 
 extern "C" {
-static void gtk_filedialog_cancel_callback(GtkWidget *WXUNUSED(w),
+static void gtk_dirdialog_cancel_callback(GtkWidget *WXUNUSED(w),
                                            wxDirDialogGTK *dialog)
 {
     wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
@@ -79,19 +79,19 @@ static void gtk_filedialog_cancel_callback(GtkWidget *WXUNUSED(w),
 }
 
 extern "C" {
-static void gtk_filedialog_response_callback(GtkWidget *w,
+static void gtk_dirdialog_response_callback(GtkWidget *w,
                                              gint response,
                                              wxDirDialogGTK *dialog)
 {
     wxapp_install_idle_handler();
 
     if (response == GTK_RESPONSE_ACCEPT)
-        gtk_filedialog_ok_callback(w, dialog);
+        gtk_dirdialog_ok_callback(w, dialog);
     else if (response == GTK_RESPONSE_CANCEL)
-        gtk_filedialog_cancel_callback(w, dialog);
+        gtk_dirdialog_cancel_callback(w, dialog);
     else // "delete"
     {
-        gtk_filedialog_cancel_callback(w, dialog);
+        gtk_dirdialog_cancel_callback(w, dialog);
         dialog->m_destroyed_by_delete = true;
     }
 }
@@ -123,7 +123,7 @@ wxDirDialogGTK::wxDirDialogGTK(wxWindow* parent, const wxString& title,
 
         if (!PreCreation(parent, pos, wxDefaultSize) ||
             !CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
-                    wxDefaultValidator, wxT("filedialog")))
+                    wxDefaultValidator, wxT("dirdialog")))
         {
             wxFAIL_MSG( wxT("wxDirDialogGTK creation failed") );
             return;
@@ -146,6 +146,8 @@ wxDirDialogGTK::wxDirDialogGTK(wxWindow* parent, const wxString& title,
                        GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
                        NULL);
 
+        gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
+
         // local-only property could be set to false to allow non-local files to be loaded.
         // In that case get/set_uri(s) should be used instead of get/set_filename(s) everywhere
         // and the GtkFileChooserDialog should probably also be created with a backend,
@@ -153,8 +155,8 @@ wxDirDialogGTK::wxDirDialogGTK(wxWindow* parent, const wxString& title,
         // Currently local-only is kept as the default - true:
         // gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(m_widget), true);
 
-        g_signal_connect(G_OBJECT(m_widget), "response",
-            GTK_SIGNAL_FUNC(gtk_filedialog_response_callback), (gpointer)this);
+        g_signal_connect (m_widget, "response",
+            G_CALLBACK (gtk_dirdialog_response_callback), this);
 
         if ( !defaultPath.empty() )
             gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),