[gnome-software/wip/hughsie/appstream-editor: 8/12] trivial: Allow using app tiles when no GsApp has been assigned



commit b0ab43d8133e1332525ed887e22ef0cebeba6524
Author: Richard Hughes <richard hughsie com>
Date:   Mon May 8 11:08:34 2017 +0100

    trivial: Allow using app tiles when no GsApp has been assigned

 src/gs-feature-tile.c |    4 ++++
 src/gs-popular-tile.c |    3 ++-
 src/gs-summary-tile.c |    4 ++++
 3 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-feature-tile.c b/src/gs-feature-tile.c
index 0bc8587..59d9773 100644
--- a/src/gs-feature-tile.c
+++ b/src/gs-feature-tile.c
@@ -52,6 +52,10 @@ app_state_changed_idle (gpointer user_data)
        AtkObject *accessible;
        g_autofree gchar *name = NULL;
 
+       /* nothing set yet */
+       if (tile->app == NULL)
+               return G_SOURCE_REMOVE;
+
        /* update text */
        gtk_label_set_label (GTK_LABEL (tile->title), gs_app_get_name (tile->app));
        gtk_label_set_label (GTK_LABEL (tile->subtitle), gs_app_get_summary (tile->app));
diff --git a/src/gs-popular-tile.c b/src/gs-popular-tile.c
index 534546a..272c538 100644
--- a/src/gs-popular-tile.c
+++ b/src/gs-popular-tile.c
@@ -186,7 +186,8 @@ gs_popular_tile_new (GsApp *app)
        GsPopularTile *tile;
 
        tile = g_object_new (GS_TYPE_POPULAR_TILE, NULL);
-       gs_app_tile_set_app (GS_APP_TILE (tile), app);
+       if (app != NULL)
+               gs_app_tile_set_app (GS_APP_TILE (tile), app);
 
        return GTK_WIDGET (tile);
 }
diff --git a/src/gs-summary-tile.c b/src/gs-summary-tile.c
index ddbe541..2fd6f90 100644
--- a/src/gs-summary-tile.c
+++ b/src/gs-summary-tile.c
@@ -61,6 +61,10 @@ app_state_changed_idle (gpointer user_data)
        gboolean installed;
        g_autofree gchar *name = NULL;
 
+       /* nothing set yet */
+       if (tile->app == NULL)
+               return G_SOURCE_REMOVE;
+
        accessible = gtk_widget_get_accessible (GTK_WIDGET (tile));
 
        switch (gs_app_get_state (tile->app)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]