[gtk+/toplevel-embedding: 10/12] Fixed GtkFileChooserDefault to handle cases of being in an embedded dialog.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/toplevel-embedding: 10/12] Fixed GtkFileChooserDefault to handle cases of being in an embedded dialog.
- Date: Wed, 29 Dec 2010 08:16:21 +0000 (UTC)
commit 7cd20c30db10338b278ccf6b8aa5e6940098f240
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun Dec 26 19:13:19 2010 +0900
Fixed GtkFileChooserDefault to handle cases of being in an embedded dialog.
This involves checking the toplevelness of new toplevels before connecting
but not the *old* ones for disconnecting signals. Also take care of handling
a row_reference that becomes invalid over the course of reparenting the
filechooser into another parent.
gtk/gtkfilechooserdefault.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 9c36b8a..7e3ca2f 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -1180,11 +1180,14 @@ shortcuts_reload_icons_get_info_cb (GCancellable *cancellable,
pixbuf = _gtk_file_info_render_icon (info, GTK_WIDGET (data->impl), data->impl->icon_size);
path = gtk_tree_row_reference_get_path (data->row_ref);
- gtk_tree_model_get_iter (GTK_TREE_MODEL (data->impl->shortcuts_model), &iter, path);
- gtk_list_store_set (data->impl->shortcuts_model, &iter,
- SHORTCUTS_COL_PIXBUF, pixbuf,
- -1);
- gtk_tree_path_free (path);
+ if (path)
+ {
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (data->impl->shortcuts_model), &iter, path);
+ gtk_list_store_set (data->impl->shortcuts_model, &iter,
+ SHORTCUTS_COL_PIXBUF, pixbuf,
+ -1);
+ gtk_tree_path_free (path);
+ }
if (pixbuf)
g_object_unref (pixbuf);
@@ -5588,21 +5591,20 @@ gtk_file_chooser_default_hierarchy_changed (GtkWidget *widget,
GtkWidget *toplevel;
impl = GTK_FILE_CHOOSER_DEFAULT (widget);
+ toplevel = gtk_widget_get_toplevel (widget);
- if (previous_toplevel)
+ if (previous_toplevel &&
+ impl->toplevel_set_focus_id != 0)
{
- g_assert (impl->toplevel_set_focus_id != 0);
g_signal_handler_disconnect (previous_toplevel,
impl->toplevel_set_focus_id);
impl->toplevel_set_focus_id = 0;
impl->toplevel_last_focus_widget = NULL;
}
- else
- g_assert (impl->toplevel_set_focus_id == 0);
- toplevel = gtk_widget_get_toplevel (widget);
if (gtk_widget_is_toplevel (toplevel))
{
+ g_assert (impl->toplevel_set_focus_id == 0);
impl->toplevel_set_focus_id = g_signal_connect (toplevel, "set-focus",
G_CALLBACK (toplevel_set_focus_cb), impl);
impl->toplevel_last_focus_widget = gtk_window_get_focus (GTK_WINDOW (toplevel));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]