Commit 50949001 authored by Alexander Larsson's avatar Alexander Larsson

GtkFileChooserNative: Fallback and win32 implementation

This is a subclass on GtkNativeDialog that uses GtkFileChooserDialog
as a fallback, but also has support for the win32 file chooser dialog.
parent 693db082
......@@ -204,6 +204,7 @@
<xi:include href="xml/gtkfilechooser.xml" />
<xi:include href="xml/gtkfilechooserbutton.xml" />
<xi:include href="xml/gtknativedialog.xml" />
<xi:include href="xml/gtkfilechoosernative.xml" />
<xi:include href="xml/gtkfilechooserdialog.xml" />
<xi:include href="xml/gtkfilechooserwidget.xml" />
<xi:include href="xml/gtkfilefilter.xml" />
......
......@@ -1432,6 +1432,25 @@ gtk_file_chooser_error_quark
gtk_file_chooser_get_type
</SECTION>
<SECTION>
<FILE>gtkfilechoosernative</FILE>
<TITLE>GtkFileChooserNative</TITLE>
gtk_file_chooser_native_new
gtk_file_chooser_native_get_accept_label
gtk_file_chooser_native_set_accept_label
gtk_file_chooser_native_get_cancel_label
gtk_file_chooser_native_set_cancel_label
<SUBSECTION Standard>
GTK_FILE_CHOOSER_NATIVE
GTK_IS_FILE_CHOOSER_NATIVE
GTK_TYPE_FILE_CHOOSER_NATIVE
GTK_FILE_CHOOSER_NATIVE_CLASS
GTK_IS_FILE_CHOOSER_NATIVE_CLASS
GTK_FILE_CHOOSER_NATIVE_GET_CLASS
<SUBSECTION Private>
gtk_file_chooser_native_get_type
</SECTION>
<SECTION>
<FILE>gtkfilechooserdialog</FILE>
<TITLE>GtkFileChooserDialog</TITLE>
......
......@@ -180,6 +180,7 @@ gtk_public_h_sources = \
gtkfilechooser.h \
gtkfilechooserbutton.h \
gtkfilechooserdialog.h \
gtkfilechoosernative.h \
gtkfilechooserwidget.h \
gtkfilefilter.h \
gtkfixed.h \
......@@ -440,6 +441,7 @@ gtk_private_h_sources = \
gtkfilechooserembed.h \
gtkfilechooserentry.h \
gtkfilechooserprivate.h \
gtkfilechoosernativeprivate.h \
gtkfilechooserwidgetprivate.h \
gtkfilechooserutils.h \
gtkfilefilterprivate.h \
......@@ -696,6 +698,7 @@ gtk_base_c_sources = \
gtkfilechooserdialog.c \
gtkfilechooserembed.c \
gtkfilechooserentry.c \
gtkfilechoosernative.c \
gtkfilechooserutils.c \
gtkfilechooserwidget.c \
gtkfilefilter.c \
......@@ -940,6 +943,7 @@ endif
gtk_os_win32_c_sources = \
gtkprint-win32.c \
gtkprintoperation-win32.c \
gtkfilechoosernativewin32.c \
gtkwin32.c
if OS_WIN32
gtk_private_h_sources += gtkprint-win32.h
......
......@@ -97,6 +97,7 @@
#include <gtk/gtkfilechooser.h>
#include <gtk/gtkfilechooserbutton.h>
#include <gtk/gtkfilechooserdialog.h>
#include <gtk/gtkfilechoosernative.h>
#include <gtk/gtkfilechooserwidget.h>
#include <gtk/gtkfilefilter.h>
#include <gtk/gtkflowbox.h>
......
......@@ -45,7 +45,7 @@
* SECTION:gtkfilechooserdialog
* @Short_description: A file chooser dialog, suitable for “File/Open” or “File/Save” commands
* @Title: GtkFileChooserDialog
* @See_also: #GtkFileChooser, #GtkDialog
* @See_also: #GtkFileChooser, #GtkDialog, GtkFileChooserNative
*
* #GtkFileChooserDialog is a dialog box suitable for use with
* “File/Open” or “File/Save as” commands. This widget works by
......@@ -58,6 +58,11 @@
* own. Instead, you should use the functions that work on a
* #GtkFileChooser.
*
* If you want to integrate well with the platform you should use the
* #GtkFileChooserNative API, which will use a platform-specific
* dialog if available and fall back to GtkFileChooserDialog
* otherwise.
*
* ## Typical usage ## {#gtkfilechooser-typical-usage}
*
* In the simplest of cases, you can the following code to use
......
This diff is collapsed.
/* GTK - The GIMP Toolkit
* gtkfilechoosernative.h: Native File selector dialog
* Copyright (C) 2015, Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_FILE_CHOOSER_NATIVE_H__
#define __GTK_FILE_CHOOSER_NATIVE_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkfilechooser.h>
#include <gtk/gtknativedialog.h>
G_BEGIN_DECLS
#define GTK_TYPE_FILE_CHOOSER_NATIVE (gtk_file_chooser_native_get_type ())
GDK_AVAILABLE_IN_3_20
G_DECLARE_FINAL_TYPE (GtkFileChooserNative, gtk_file_chooser_native, GTK, FILE_CHOOSER_NATIVE, GtkNativeDialog)
GDK_AVAILABLE_IN_3_20
GtkFileChooserNative *gtk_file_chooser_native_new (const gchar *title,
GtkWindow *parent,
GtkFileChooserAction action,
const gchar *accept_label,
const gchar *cancel_label);
GDK_AVAILABLE_IN_3_20
const char *gtk_file_chooser_native_get_accept_label (GtkFileChooserNative *self);
GDK_AVAILABLE_IN_3_20
void gtk_file_chooser_native_set_accept_label (GtkFileChooserNative *self,
const char *accept_label);
GDK_AVAILABLE_IN_3_20
const char *gtk_file_chooser_native_get_cancel_label (GtkFileChooserNative *self);
GDK_AVAILABLE_IN_3_20
void gtk_file_chooser_native_set_cancel_label (GtkFileChooserNative *self,
const char *cancel_label);
G_END_DECLS
#endif /* __GTK_FILE_CHOOSER_NATIVE_H__ */
/* GTK - The GIMP Toolkit
* gtkfilechoosernativeprivate.h: Native File selector dialog
* Copyright (C) 2015, Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_FILE_CHOOSER_NATIVE_PRIVATE_H__
#define __GTK_FILE_CHOOSER_NATIVE_PRIVATE_H__
#include <gtk/gtkfilechoosernative.h>
G_BEGIN_DECLS
struct _GtkFileChooserNative
{
GtkNativeDialog parent_instance;
char *accept_label;
char *cancel_label;
int mode;
GSList *custom_files;
GFile *current_folder;
GFile *current_file;
char *current_name;
/* Fallback mode */
GtkWidget *dialog;
GtkWidget *accept_button;
GtkWidget *cancel_button;
gpointer mode_data;
};
gboolean gtk_file_chooser_native_win32_show (GtkFileChooserNative *self);
void gtk_file_chooser_native_win32_hide (GtkFileChooserNative *self);
G_END_DECLS
#endif /* __GTK_FILE_CHOOSER_NATIVE_PRIVATE_H__ */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment