From 3f80f9a403aa2471261ea46797ae588479e2cd9d Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Thu, 20 Apr 2006 08:34:43 +0000 Subject: [PATCH] _GtkFileChooserButtonPrivate: Added has_title flag so we can remember 2006-04-19 Murray Cumming * gtk/gtkfilechooserbutton.c: _GtkFileChooserButtonPrivate: Added has_title flag so we can remember whether a title has been set. (gtk_file_chooser_button_constructor): If no title has been set then set it to the default title. This means that the default title will be used if the dialog was instantiated with g_object_new(), without using the gtk_file_chooser_button_new() convenience function. This helps language bindings. (gtk_file_chooser_button_set_property): Set has_title when setting the title. --- ChangeLog | 13 +++++++++++++ ChangeLog.pre-2-10 | 13 +++++++++++++ gtk/gtkfilechooserbutton.c | 10 ++++++++++ 3 files changed, 36 insertions(+) diff --git a/ChangeLog b/ChangeLog index 22e3c63691..7906a87714 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-04-19 Murray Cumming + + * gtk/gtkfilechooserbutton.c: _GtkFileChooserButtonPrivate: + Added has_title flag so we can remember whether a title has + been set. + (gtk_file_chooser_button_constructor): If no title has been + set then set it to the default title. This means that the + default title will be used if the dialog was instantiated with + g_object_new(), without using the gtk_file_chooser_button_new() + convenience function. This helps language bindings. + (gtk_file_chooser_button_set_property): Set has_title when + setting the title. + 2006-04-19 Tor Lillqvist * gdk/win32/gdkkeys-win32.c (handle_special): Map VK_NUMPAD[0-9] diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 22e3c63691..7906a87714 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +2006-04-19 Murray Cumming + + * gtk/gtkfilechooserbutton.c: _GtkFileChooserButtonPrivate: + Added has_title flag so we can remember whether a title has + been set. + (gtk_file_chooser_button_constructor): If no title has been + set then set it to the default title. This means that the + default title will be used if the dialog was instantiated with + g_object_new(), without using the gtk_file_chooser_button_new() + convenience function. This helps language bindings. + (gtk_file_chooser_button_set_property): Set has_title when + setting the title. + 2006-04-19 Tor Lillqvist * gdk/win32/gdkkeys-win32.c (handle_special): Map VK_NUMPAD[0-9] diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index 1d71c5611b..0ebbf55b81 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -155,6 +155,9 @@ struct _GtkFileChooserButtonPrivate /* Used for hiding/showing the dialog when the button is hidden */ guint8 active : 1; + /* Used to remember whether a title has been set yet, so we can use the default if it has not been set. */ + guint8 has_title : 1; + /* Used to track whether we need to set a default current folder on ::map() */ guint8 folder_has_been_set : 1; }; @@ -632,6 +635,10 @@ gtk_file_chooser_button_constructor (GType type, -1); } + /* Set the default title if necessary. We must wait until the dialog has been created to do this. */ + if (!priv->has_title) + gtk_file_chooser_button_set_title (button, _(DEFAULT_TITLE)); + current_folder = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (priv->dialog)); if (current_folder != NULL) { @@ -768,6 +775,9 @@ gtk_file_chooser_button_set_property (GObject *object, break; case PROP_TITLE: + /* Remember that a title has been set, so we do no try to set it to the default in _init(). */ + priv->has_title = TRUE; + /* Intentionally fall through instead of breaking here, to actually set the property. */ case GTK_FILE_CHOOSER_PROP_FILTER: case GTK_FILE_CHOOSER_PROP_LOCAL_ONLY: case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET: