From 2247fc6659fc9ffeb7d169f01d7e9c11e68f239c Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Mon, 8 Mar 2004 22:21:47 +0000 Subject: [PATCH] Fixes #136105. 2004-03-08 Federico Mena Quintero Fixes #136105. * gtk/gtkfilechooserembed.h (struct _GtkFileChooserEmbedIface): Added an ::initial_focus() method. * gtk/gtkfilechooserembed.c (_gtk_file_chooser_embed_delegate_iface_init): Set the initial_focus method. (delegate_initial_focus): Implement. (_gtk_file_chooser_embed_initial_focus): New function. * gtk/gtkfilechooserdialog.c (gtk_file_chooser_dialog_constructor): Call _gtk_file_chooser_embed_initial_focus(). * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init): Install the ::initial_focus() handler. (gtk_file_chooser_default_initial_focus): Implement. --- ChangeLog | 21 +++++++++++++++++++++ ChangeLog.pre-2-10 | 21 +++++++++++++++++++++ ChangeLog.pre-2-4 | 21 +++++++++++++++++++++ ChangeLog.pre-2-6 | 21 +++++++++++++++++++++ ChangeLog.pre-2-8 | 21 +++++++++++++++++++++ gtk/gtkfilechooserdefault.c | 26 ++++++++++++++++++++++++++ gtk/gtkfilechooserdialog.c | 2 ++ gtk/gtkfilechooserembed.c | 16 ++++++++++++++++ gtk/gtkfilechooserembed.h | 4 ++++ 9 files changed, 153 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1e9420462..0dba3d325 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2004-03-08 Federico Mena Quintero + + Fixes #136105. + + * gtk/gtkfilechooserembed.h (struct _GtkFileChooserEmbedIface): + Added an ::initial_focus() method. + + * gtk/gtkfilechooserembed.c + (_gtk_file_chooser_embed_delegate_iface_init): Set the + initial_focus method. + (delegate_initial_focus): Implement. + (_gtk_file_chooser_embed_initial_focus): New function. + + * gtk/gtkfilechooserdialog.c + (gtk_file_chooser_dialog_constructor): Call + _gtk_file_chooser_embed_initial_focus(). + + * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init): + Install the ::initial_focus() handler. + (gtk_file_chooser_default_initial_focus): Implement. + 2004-03-08 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (update_from_entry): Return a diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 1e9420462..0dba3d325 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,24 @@ +2004-03-08 Federico Mena Quintero + + Fixes #136105. + + * gtk/gtkfilechooserembed.h (struct _GtkFileChooserEmbedIface): + Added an ::initial_focus() method. + + * gtk/gtkfilechooserembed.c + (_gtk_file_chooser_embed_delegate_iface_init): Set the + initial_focus method. + (delegate_initial_focus): Implement. + (_gtk_file_chooser_embed_initial_focus): New function. + + * gtk/gtkfilechooserdialog.c + (gtk_file_chooser_dialog_constructor): Call + _gtk_file_chooser_embed_initial_focus(). + + * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init): + Install the ::initial_focus() handler. + (gtk_file_chooser_default_initial_focus): Implement. + 2004-03-08 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (update_from_entry): Return a diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 1e9420462..0dba3d325 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,24 @@ +2004-03-08 Federico Mena Quintero + + Fixes #136105. + + * gtk/gtkfilechooserembed.h (struct _GtkFileChooserEmbedIface): + Added an ::initial_focus() method. + + * gtk/gtkfilechooserembed.c + (_gtk_file_chooser_embed_delegate_iface_init): Set the + initial_focus method. + (delegate_initial_focus): Implement. + (_gtk_file_chooser_embed_initial_focus): New function. + + * gtk/gtkfilechooserdialog.c + (gtk_file_chooser_dialog_constructor): Call + _gtk_file_chooser_embed_initial_focus(). + + * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init): + Install the ::initial_focus() handler. + (gtk_file_chooser_default_initial_focus): Implement. + 2004-03-08 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (update_from_entry): Return a diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 1e9420462..0dba3d325 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,24 @@ +2004-03-08 Federico Mena Quintero + + Fixes #136105. + + * gtk/gtkfilechooserembed.h (struct _GtkFileChooserEmbedIface): + Added an ::initial_focus() method. + + * gtk/gtkfilechooserembed.c + (_gtk_file_chooser_embed_delegate_iface_init): Set the + initial_focus method. + (delegate_initial_focus): Implement. + (_gtk_file_chooser_embed_initial_focus): New function. + + * gtk/gtkfilechooserdialog.c + (gtk_file_chooser_dialog_constructor): Call + _gtk_file_chooser_embed_initial_focus(). + + * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init): + Install the ::initial_focus() handler. + (gtk_file_chooser_default_initial_focus): Implement. + 2004-03-08 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (update_from_entry): Return a diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 1e9420462..0dba3d325 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,24 @@ +2004-03-08 Federico Mena Quintero + + Fixes #136105. + + * gtk/gtkfilechooserembed.h (struct _GtkFileChooserEmbedIface): + Added an ::initial_focus() method. + + * gtk/gtkfilechooserembed.c + (_gtk_file_chooser_embed_delegate_iface_init): Set the + initial_focus method. + (delegate_initial_focus): Implement. + (_gtk_file_chooser_embed_initial_focus): New function. + + * gtk/gtkfilechooserdialog.c + (gtk_file_chooser_dialog_constructor): Call + _gtk_file_chooser_embed_initial_focus(). + + * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init): + Install the ::initial_focus() handler. + (gtk_file_chooser_default_initial_focus): Implement. + 2004-03-08 Federico Mena Quintero * gtk/gtkfilechooserdefault.c (update_from_entry): Return a diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 84f6d8604..e24d3edd8 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -274,6 +274,7 @@ static void gtk_file_chooser_default_get_resizable_hints (GtkFileCh gboolean *resize_horizontally, gboolean *resize_vertically); static gboolean gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed); +static void gtk_file_chooser_default_initial_focus (GtkFileChooserEmbed *chooser_embed); static void location_popup_handler (GtkFileChooserDefault *impl); static void up_folder_handler (GtkFileChooserDefault *impl); @@ -496,6 +497,7 @@ gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface) iface->get_default_size = gtk_file_chooser_default_get_default_size; iface->get_resizable_hints = gtk_file_chooser_default_get_resizable_hints; iface->should_respond = gtk_file_chooser_default_should_respond; + iface->initial_focus = gtk_file_chooser_default_initial_focus; } static void gtk_file_chooser_default_init (GtkFileChooserDefault *impl) @@ -3561,6 +3563,30 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed) return FALSE; } +/* Implementation for GtkFileChooserEmbed::initial_focus() */ +static void +gtk_file_chooser_default_initial_focus (GtkFileChooserEmbed *chooser_embed) +{ + GtkFileChooserDefault *impl; + GtkWidget *widget; + + impl = GTK_FILE_CHOOSER_DEFAULT (chooser_embed); + + if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN + || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) + widget = impl->browse_files_tree_view; + else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE + || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER) + widget = impl->save_file_name_entry; + else + { + g_assert_not_reached (); + widget = NULL; + } + + gtk_widget_grab_focus (widget); +} + static void set_current_filter (GtkFileChooserDefault *impl, GtkFileFilter *filter) diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c index 2835b062e..14f4b8b90 100644 --- a/gtk/gtkfilechooserdialog.c +++ b/gtk/gtkfilechooserdialog.c @@ -331,6 +331,8 @@ gtk_file_chooser_dialog_constructor (GType type, else priv->widget = g_object_new (GTK_TYPE_FILE_CHOOSER_WIDGET, NULL); + _gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget)); + g_signal_connect (priv->widget, "file-activated", G_CALLBACK (file_chooser_widget_file_activated), object); g_signal_connect (priv->widget, "default-size-changed", diff --git a/gtk/gtkfilechooserembed.c b/gtk/gtkfilechooserembed.c index 0705ff8f4..3e3b62503 100644 --- a/gtk/gtkfilechooserembed.c +++ b/gtk/gtkfilechooserembed.c @@ -10,6 +10,7 @@ static void delegate_get_resizable_hints (GtkFileChooserEmbed *chooser_embe gboolean *resize_horizontally, gboolean *resize_vertically); static gboolean delegate_should_respond (GtkFileChooserEmbed *chooser_embed); +static void delegate_initial_focus (GtkFileChooserEmbed *chooser_embed); static void delegate_default_size_changed (GtkFileChooserEmbed *chooser_embed, gpointer data); @@ -34,6 +35,7 @@ _gtk_file_chooser_embed_delegate_iface_init (GtkFileChooserEmbedIface *iface) iface->get_default_size = delegate_get_default_size; iface->get_resizable_hints = delegate_get_resizable_hints; iface->should_respond = delegate_should_respond; + iface->initial_focus = delegate_initial_focus; } /** @@ -83,6 +85,12 @@ delegate_should_respond (GtkFileChooserEmbed *chooser_embed) return _gtk_file_chooser_embed_should_respond (get_delegate (chooser_embed)); } +static void +delegate_initial_focus (GtkFileChooserEmbed *chooser_embed) +{ + return _gtk_file_chooser_embed_initial_focus (get_delegate (chooser_embed)); +} + static void delegate_default_size_changed (GtkFileChooserEmbed *chooser_embed, gpointer data) @@ -152,6 +160,14 @@ _gtk_file_chooser_embed_should_respond (GtkFileChooserEmbed *chooser_embed) return GTK_FILE_CHOOSER_EMBED_GET_IFACE (chooser_embed)->should_respond (chooser_embed); } +void +_gtk_file_chooser_embed_initial_focus (GtkFileChooserEmbed *chooser_embed) +{ + g_return_if_fail (GTK_IS_FILE_CHOOSER_EMBED (chooser_embed)); + + GTK_FILE_CHOOSER_EMBED_GET_IFACE (chooser_embed)->initial_focus (chooser_embed); +} + void _gtk_file_chooser_embed_get_resizable_hints (GtkFileChooserEmbed *chooser_embed, gboolean *resize_horizontally, diff --git a/gtk/gtkfilechooserembed.h b/gtk/gtkfilechooserembed.h index 7c6d6bb31..4a02e947a 100644 --- a/gtk/gtkfilechooserembed.h +++ b/gtk/gtkfilechooserembed.h @@ -48,6 +48,8 @@ struct _GtkFileChooserEmbedIface gboolean *resize_vertically); gboolean (*should_respond) (GtkFileChooserEmbed *chooser_embed); + + void (*initial_focus) (GtkFileChooserEmbed *chooser_embed); /* Signals */ void (*default_size_changed) (GtkFileChooserEmbed *chooser_embed); @@ -64,6 +66,8 @@ void _gtk_file_chooser_embed_get_resizable_hints (GtkFileChooserEmbed *chooser_ gboolean _gtk_file_chooser_embed_should_respond (GtkFileChooserEmbed *chooser_embed); +void _gtk_file_chooser_embed_initial_focus (GtkFileChooserEmbed *chooser_embed); + void _gtk_file_chooser_embed_delegate_iface_init (GtkFileChooserEmbedIface *iface); void _gtk_file_chooser_embed_set_delegate (GtkFileChooserEmbed *receiver, GtkFileChooserEmbed *delegate); -- 2.43.2