diff options
author | Murray Cumming <murrayc@murrayc.com> | 2006-04-19 17:21:55 +0000 |
---|---|---|
committer | Murray Cumming <murrayc@src.gnome.org> | 2006-04-19 17:21:55 +0000 |
commit | 5cb13a7512b3a9b81b8a8fc97fab6e818ce90f97 (patch) | |
tree | 441e6cda1aaa54ee6536a53443f186cc90e0cce3 /gtk/gtkfilechooserbutton.c | |
parent | 36c93d25d3d0f2d05b9e26f895c1952e74c80cce (diff) | |
download | gtk+-5cb13a7512b3a9b81b8a8fc97fab6e818ce90f97.tar.gz |
_GtkFileChooserButtonPrivate: Added has_title flag so we can remember
2006-04-19 Murray Cumming <murrayc@murrayc.com>
* 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.
Diffstat (limited to 'gtk/gtkfilechooserbutton.c')
-rw-r--r-- | gtk/gtkfilechooserbutton.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index 4a5180c942..390ded1b14 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -156,6 +156,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; @@ -648,6 +651,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) { @@ -786,6 +793,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: |