Clear chart icon view before loading the list

Fixes #94
This commit is contained in:
Gergely Polonkai 2014-09-29 23:40:44 +02:00
parent 078a26dc8f
commit e3bd75ef0d
5 changed files with 17 additions and 5 deletions

View File

@ -113,7 +113,7 @@ new_window_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
AgWindow *window = AG_WINDOW(ag_app_create_window(AG_APP(user_data)));
ag_window_load_chart_list(window);
ag_window_reload_chart_list(window);
ag_window_change_tab(window, "list");
}

View File

@ -470,3 +470,11 @@ ag_icon_view_remove_selected(AgIconView *icon_view)
ag_icon_view_selection_changed(icon_view);
}
void
ag_icon_view_remove_all(AgIconView *icon_view)
{
AgIconViewPrivate *priv = ag_icon_view_get_instance_private(icon_view);
gtk_list_store_clear(priv->model);
}

View File

@ -65,6 +65,8 @@ void ag_icon_view_unselect_all(AgIconView *icon_view);
void ag_icon_view_remove_selected(AgIconView *icon_view);
void ag_icon_view_remove_all(AgIconView *icon_view);
G_END_DECLS
#endif /* __AG_ICON_VIEW_H__ */

View File

@ -1666,7 +1666,7 @@ ag_window_back_action(GSimpleAction *action,
ag_db_chart_save_unref(priv->saved_data);
priv->saved_data = NULL;
ag_window_load_chart_list(window);
ag_window_reload_chart_list(window);
gtk_stack_set_visible_child_name(GTK_STACK(priv->stack), "list");
gtk_header_bar_set_subtitle(GTK_HEADER_BAR(priv->header_bar), NULL);
}
@ -1677,7 +1677,7 @@ ag_window_refresh_action(GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
ag_window_load_chart_list(AG_WINDOW(user_data));
ag_window_reload_chart_list(AG_WINDOW(user_data));
}
static void
@ -2862,7 +2862,7 @@ ag_window_cleanup_load_items(LoadIdleData *idle_data)
}
gboolean
ag_window_load_chart_list(AgWindow *window)
ag_window_reload_chart_list(AgWindow *window)
{
LoadIdleData *idle_data;
AgDb *db = ag_db_get();
@ -2870,6 +2870,8 @@ ag_window_load_chart_list(AgWindow *window)
GList *chart_list = ag_db_chart_get_list(db, &err);
AgWindowPrivate *priv = ag_window_get_instance_private(window);
ag_icon_view_remove_all(AG_ICON_VIEW(priv->chart_list));
/* Lazy loading of charts with previews. Idea is from
* http://blogs.gnome.org/ebassi/documentation/lazy-loading/ */

View File

@ -75,7 +75,7 @@ void ag_window_settings_save(GtkWindow *window,
void ag_window_change_tab(AgWindow *window, const gchar *tab_name);
gboolean ag_window_load_chart_list(AgWindow *window);
gboolean ag_window_reload_chart_list(AgWindow *window);
gboolean ag_window_is_usable(AgWindow *window);