From: Christian Dywan Date: Mon, 1 Jun 2009 06:11:50 +0000 (+0200) Subject: Create completion model in one place and thaw/ freeze only new model X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ddf55ccc32b6e7025bf26d824bb8532a48109d4;p=midori Create completion model in one place and thaw/ freeze only new model --- diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c index d1a6ca2b..3e3f1a4b 100644 --- a/midori/midori-locationaction.c +++ b/midori/midori-locationaction.c @@ -323,6 +323,15 @@ midori_location_action_thaw (MidoriLocationAction* location_action) } } +static GtkTreeModel* +midori_location_action_create_model (void) +{ + GtkTreeModel* model = (GtkTreeModel*)gtk_list_store_new (N_COLS, + GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_INT, G_TYPE_BOOLEAN); + return model; +} + static void midori_location_action_init (MidoriLocationAction* location_action) { @@ -332,9 +341,7 @@ midori_location_action_init (MidoriLocationAction* location_action) location_action->secondary_icon = NULL; location_action->default_icon = NULL; - location_action->model = (GtkTreeModel*)gtk_list_store_new (N_COLS, - GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INT, G_TYPE_BOOLEAN); + location_action->model = midori_location_action_create_model (); location_action->filter_model = NULL; location_action->sort_model = NULL; @@ -435,7 +442,6 @@ midori_location_action_set_property (GObject* object, history = g_value_dup_object (value); katze_assign (location_action->history, g_object_ref (history)); model = g_object_get_data (G_OBJECT (history), "midori-location-model"); - midori_location_action_freeze (location_action); if (model != NULL) { katze_object_assign (location_action->model, g_object_ref (model)); @@ -443,17 +449,16 @@ midori_location_action_set_property (GObject* object, else { g_object_unref (location_action->model); - location_action->model = (GtkTreeModel*)gtk_list_store_new (N_COLS, - GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INT, G_TYPE_BOOLEAN); + location_action->model = midori_location_action_create_model (); + midori_location_action_freeze (location_action); /* FIXME: MidoriBrowser is essentially making up for the lack of synchronicity of newly added items. */ midori_location_action_insert_history_item (location_action, KATZE_ITEM (g_value_get_object (value))); + midori_location_action_thaw (location_action); g_object_set_data (G_OBJECT (history), "midori-location-model", location_action->model); } - midori_location_action_thaw (location_action); break; } default: