*/
#include <config.h>
-#include "gtkalias.h"
+#include "gtkfilechooserprivate.h"
#include "gtkfilechooserdialog.h"
#include "gtkfilechooserwidget.h"
#include "gtkfilechooserutils.h"
#include "gtkfilechooserembed.h"
#include "gtkfilesystem.h"
#include "gtktypebuiltins.h"
+#include "gtkintl.h"
+#include "gtkalias.h"
#include <stdarg.h>
-struct _GtkFileChooserDialogPrivate
-{
- GtkWidget *widget;
-
- char *file_system;
-
- /* for use with GtkFileChooserEmbed */
- gint default_width;
- gint default_height;
- gboolean resize_horizontally;
- gboolean resize_vertically;
-};
-
#define GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE(o) (GTK_FILE_CHOOSER_DIALOG (o)->priv)
static void gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class);
GValue *value,
GParamSpec *pspec);
+static void gtk_file_chooser_dialog_map (GtkWidget *widget);
+static void gtk_file_chooser_dialog_unmap (GtkWidget *widget);
static void gtk_file_chooser_dialog_style_set (GtkWidget *widget,
GtkStyle *previous_style);
NULL /* interface_data */
};
- file_chooser_dialog_type = g_type_register_static (GTK_TYPE_DIALOG, "GtkFileChooserDialog",
+ file_chooser_dialog_type = g_type_register_static (GTK_TYPE_DIALOG, I_("GtkFileChooserDialog"),
&file_chooser_dialog_info, 0);
g_type_add_interface_static (file_chooser_dialog_type,
GTK_TYPE_FILE_CHOOSER,
gobject_class->get_property = gtk_file_chooser_dialog_get_property;
gobject_class->finalize = gtk_file_chooser_dialog_finalize;
+ widget_class->map = gtk_file_chooser_dialog_map;
+ widget_class->unmap = gtk_file_chooser_dialog_unmap;
widget_class->style_set = gtk_file_chooser_dialog_style_set;
_gtk_file_chooser_install_properties (gobject_class);
int response_id;
widget = GTK_WIDGET (l->data);
- response_id = _gtk_dialog_get_response_for_widget (GTK_DIALOG (dialog), widget);
+ response_id = gtk_dialog_get_response_for_widget (GTK_DIALOG (dialog), widget);
if (response_id == GTK_RESPONSE_ACCEPT
|| response_id == GTK_RESPONSE_OK
|| response_id == GTK_RESPONSE_YES
_gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (object),
GTK_FILE_CHOOSER (priv->widget));
- _gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget));
-
gtk_widget_pop_composite_child ();
return object;
}
#endif
+/* GtkWidget::map handler */
+static void
+gtk_file_chooser_dialog_map (GtkWidget *widget)
+{
+ GtkFileChooserDialog *dialog = GTK_FILE_CHOOSER_DIALOG (widget);
+ GtkFileChooserDialogPrivate *priv = GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE (dialog);
+
+ if (!GTK_WIDGET_MAPPED (priv->widget))
+ gtk_widget_map (priv->widget);
+
+ _gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget));
+
+ GTK_WIDGET_CLASS (parent_class)->map (widget);
+}
+
+/* GtkWidget::unmap handler */
+static void
+gtk_file_chooser_dialog_unmap (GtkWidget *widget)
+{
+ GtkFileChooserDialog *dialog = GTK_FILE_CHOOSER_DIALOG (widget);
+ GtkFileChooserDialogPrivate *priv = GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE (dialog);
+
+ GTK_WIDGET_CLASS (parent_class)->unmap (widget);
+
+ /* See bug #145470. We unmap the GtkFileChooserWidget so that if the dialog
+ * is remapped, the widget will be remapped as well. Implementations should
+ * refresh their contents when this happens, as some applications keep a
+ * single file chooser alive and map/unmap it as needed, rather than creating
+ * a new file chooser every time they need one.
+ */
+ gtk_widget_unmap (priv->widget);
+}
+
static void
gtk_file_chooser_dialog_style_set (GtkWidget *widget,
GtkStyle *previous_style)
* gtk_file_chooser_dialog_new_with_backend:
* @title: Title of the dialog, or %NULL
* @parent: Transient parent of the dialog, or %NULL
- * @backend: The name of the specific filesystem backend to use.
* @action: Open or save mode for the dialog
+ * @backend: The name of the specific filesystem backend to use.
* @first_button_text: stock ID or text to go in the first button, or %NULL
* @Varargs: response ID for the first button, then additional (button, id) pairs, ending with %NULL
*
return result;
}
+
+#define __GTK_FILE_CHOOSER_DIALOG_C__
+#include "gtkaliasdef.c"