[gnome-software] Small cleanup
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Small cleanup
- Date: Mon, 26 Aug 2013 20:23:43 +0000 (UTC)
commit 910f1596a6ee31a54a5b00a44442c5677fedb6b6
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Aug 26 14:09:06 2013 -0400
Small cleanup
Break out the catgories in their own function, in preparation
of getting them from somewhere else.
src/gs-shell-overview.c | 48 +++++++++++++++++++++++++++++-----------------
1 files changed, 30 insertions(+), 18 deletions(-)
---
diff --git a/src/gs-shell-overview.c b/src/gs-shell-overview.c
index 33eac50..d7153e5 100644
--- a/src/gs-shell-overview.c
+++ b/src/gs-shell-overview.c
@@ -374,8 +374,8 @@ gs_shell_overview_set_category (GsShellOverview *shell_overview, const gchar *ca
**/
static void
gs_shell_overview_get_featured_cb (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
GdkPixbuf *pixbuf;
GError *error = NULL;
@@ -416,15 +416,12 @@ out:
return;
}
-/**
- * gs_shell_overview_refresh:
- **/
-void
-gs_shell_overview_refresh (GsShellOverview *shell_overview)
+static void
+gs_shell_overview_get_categories (GsShellOverview *shell_overview)
{
GsShellOverviewPrivate *priv = shell_overview->priv;
- /* FIXME get real categories */
GtkWidget *grid;
+ /* FIXME get real categories */
const gchar *categories[] = {
"Add-ons", "Books", "Business & Finance",
"Entertainment", "Education", "Games",
@@ -435,32 +432,47 @@ gs_shell_overview_refresh (GsShellOverview *shell_overview)
guint i;
GtkWidget *tile;
- /* no need to refresh */
- if (priv->cache_valid)
- return;
-
grid = GTK_WIDGET (gtk_builder_get_object (priv->builder, "grid_categories"));
- container_remove_all (GTK_CONTAINER (grid));
for (i = 0; i < G_N_ELEMENTS (categories); i++) {
tile = create_category_tile (shell_overview, categories[i]);
gtk_grid_attach (GTK_GRID (grid), tile, i % 3, i / 3, 1, 1);
}
+}
+
+/**
+ * gs_shell_overview_refresh:
+ **/
+void
+gs_shell_overview_refresh (GsShellOverview *shell_overview)
+{
+ GsShellOverviewPrivate *priv = shell_overview->priv;
+ GtkWidget *grid;
+
+ /* no need to refresh */
+ if (priv->cache_valid)
+ return;
grid = GTK_WIDGET (gtk_builder_get_object (priv->builder, "box_popular"));
container_remove_all (GTK_CONTAINER (grid));
+ /* get featured apps */
+ gs_plugin_loader_get_featured_async (priv->plugin_loader,
+ priv->cancellable,
+ gs_shell_overview_get_featured_cb,
+ shell_overview);
+
/* get popular apps */
gs_plugin_loader_get_popular_async (priv->plugin_loader,
priv->cancellable,
gs_shell_overview_get_popular_cb,
shell_overview);
- /* get featured apps */
- gs_plugin_loader_get_featured_async (priv->plugin_loader,
- priv->cancellable,
- gs_shell_overview_get_featured_cb,
- shell_overview);
+ grid = GTK_WIDGET (gtk_builder_get_object (priv->builder, "grid_categories"));
+ container_remove_all (GTK_CONTAINER (grid));
+
+ gs_shell_overview_get_categories (shell_overview);
+
priv->cache_valid = TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]