[gnome-software] Give tiles a meaningful empty state
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Give tiles a meaningful empty state
- Date: Sat, 21 Sep 2013 04:32:46 +0000 (UTC)
commit 486b698728a693bc02b02e4f96030b862db29a82
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Sep 21 00:25:01 2013 -0400
Give tiles a meaningful empty state
This will be used to prepopulate grids with empty tiles.
src/gs-app-tile.c | 13 +++++++++++--
src/gs-feature-tile.c | 11 +++++++++--
src/gs-popular-tile.c | 9 +++++++--
3 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/src/gs-app-tile.c b/src/gs-app-tile.c
index 3defad6..6ba86f6 100644
--- a/src/gs-app-tile.c
+++ b/src/gs-app-tile.c
@@ -100,11 +100,16 @@ gs_app_tile_set_app (GsAppTile *tile, GsApp *app)
const gchar *summary;
g_return_if_fail (GS_IS_APP_TILE (tile));
- g_return_if_fail (GS_IS_APP (app));
+ g_return_if_fail (GS_IS_APP (app) || app == NULL);
priv = gs_app_tile_get_instance_private (tile);
+ gtk_image_clear (GTK_IMAGE (priv->image));
+ gtk_image_set_pixel_size (GTK_IMAGE (priv->image), 64);
+
g_clear_object (&priv->app);
+ if (!app)
+ return;
priv->app = g_object_ref (app);
g_signal_connect (priv->app, "notify::state",
@@ -134,7 +139,11 @@ gs_app_tile_destroy (GtkWidget *widget)
static void
button_clicked (GsAppTile *tile)
{
- g_signal_emit (tile, signals[SIGNAL_CLICKED], 0);
+ GsAppTilePrivate *priv;
+
+ priv = gs_app_tile_get_instance_private (tile);
+ if (priv->app)
+ g_signal_emit (tile, signals[SIGNAL_CLICKED], 0);
}
static void
diff --git a/src/gs-feature-tile.c b/src/gs-feature-tile.c
index 90b5b7f..642e8ea 100644
--- a/src/gs-feature-tile.c
+++ b/src/gs-feature-tile.c
@@ -95,11 +95,14 @@ gs_feature_tile_set_app (GsFeatureTile *tile, GsApp *app)
gchar *data;
g_return_if_fail (GS_IS_FEATURE_TILE (tile));
- g_return_if_fail (GS_IS_APP (app));
+ g_return_if_fail (GS_IS_APP (app) || app == NULL);
priv = gs_feature_tile_get_instance_private (tile);
g_clear_object (&priv->app);
+ if (!app)
+ return;
+
priv->app = g_object_ref (app);
g_signal_connect (priv->app, "notify::state",
@@ -148,7 +151,11 @@ gs_feature_tile_destroy (GtkWidget *widget)
static void
button_clicked (GsFeatureTile *tile)
{
- g_signal_emit (tile, signals[SIGNAL_CLICKED], 0);
+ GsFeatureTilePrivate *priv;
+
+ priv = gs_feature_tile_get_instance_private (tile);
+ if (priv->app)
+ g_signal_emit (tile, signals[SIGNAL_CLICKED], 0);
}
static void
diff --git a/src/gs-popular-tile.c b/src/gs-popular-tile.c
index 78c0ddf..c272d48 100644
--- a/src/gs-popular-tile.c
+++ b/src/gs-popular-tile.c
@@ -98,11 +98,13 @@ gs_popular_tile_set_app (GsPopularTile *tile, GsApp *app)
GsPopularTilePrivate *priv;
g_return_if_fail (GS_IS_POPULAR_TILE (tile));
- g_return_if_fail (GS_IS_APP (app));
+ g_return_if_fail (GS_IS_APP (app) || app == NULL);
priv = gs_popular_tile_get_instance_private (tile);
g_clear_object (&priv->app);
+ if (!app)
+ return;
priv->app = g_object_ref (app);
g_signal_connect (priv->app, "notify::state",
@@ -130,7 +132,10 @@ gs_popular_tile_destroy (GtkWidget *widget)
static void
button_clicked (GsPopularTile *tile)
{
- g_signal_emit (tile, signals[SIGNAL_CLICKED], 0);
+ GsPopularTilePrivate *priv;
+ priv = gs_popular_tile_get_instance_private (tile);
+ if (priv->app)
+ g_signal_emit (tile, signals[SIGNAL_CLICKED], 0);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]