title: GTK+ 3 native file chooser - allowed file types and default file name
body: <p>I am using GTK+ to create a C++ program. For choosing files I used native file chooser as the gtk file chooser has a memory leak.</p>
  
  <p>Here is my question: How can I set a default file name for the native file chooser in GTK+ (while saving) and how can I setup a file filter for it - to be able to open or save only specific file extensions?</p>
  
  <p>My program works on Win32.
  Sample code:</p>
  
  <pre><code>static void cb_SaveFileAs(GtkWidget *caller)
  {
      GtkWindow *parent_window = GTK_WINDOW(caller);
      GtkFileChooserNative *native;
      GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE;
      gint res;
  
      native = gtk_file_chooser_native_new("Save File",
                                           parent_window,
                                           action,
                                           "_Save",
                                           "_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);
  
          // save the file 
          save_to_file(filename);
  
          g_free(filename);
      }
  
      g_object_unref(native);
  }
  </code></pre>