[gnome-software/wip/jrocha/abstract-app-tiles: 2/3] Make GsPopularTile a subclass of GsAppTile
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/jrocha/abstract-app-tiles: 2/3] Make GsPopularTile a subclass of GsAppTile
- Date: Thu, 23 Jun 2016 12:58:18 +0000 (UTC)
commit f6679c080538cb596562ad4b45971ae478bc4f53
Author: Joaquim Rocha <jrocha endlessm com>
Date: Thu Jun 23 13:36:16 2016 +0200
Make GsPopularTile a subclass of GsAppTile
Also adapt the code in gs-shell-overview accordingly.
src/gs-popular-tile.c | 8 +++-----
src/gs-popular-tile.h | 6 ++----
src/gs-popular-tile.ui | 2 +-
src/gs-shell-overview.c | 8 ++++----
4 files changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/src/gs-popular-tile.c b/src/gs-popular-tile.c
index 341251f..49130b4 100644
--- a/src/gs-popular-tile.c
+++ b/src/gs-popular-tile.c
@@ -30,7 +30,7 @@
struct _GsPopularTile
{
- GtkButton parent_instance;
+ GsAppTile parent_instance;
GsApp *app;
GtkWidget *label;
@@ -43,11 +43,9 @@ struct _GsPopularTile
G_DEFINE_TYPE (GsPopularTile, gs_popular_tile, GS_TYPE_APP_TILE)
static GsApp *
-gs_popular_tile_get_app (GsAppTile *app_tile)
+gs_popular_tile_get_app (GsAppTile *tile)
{
- GsPopularTile *tile = GS_POPULAR_TILE (app_tile);
-
- return tile->app;
+ return GS_POPULAR_TILE (tile)->app;
}
static gboolean
diff --git a/src/gs-popular-tile.h b/src/gs-popular-tile.h
index 564acfe..3c00581 100644
--- a/src/gs-popular-tile.h
+++ b/src/gs-popular-tile.h
@@ -25,17 +25,15 @@
#include <gtk/gtk.h>
#include "gs-app.h"
+#include "gs-app-tile.h"
G_BEGIN_DECLS
#define GS_TYPE_POPULAR_TILE (gs_popular_tile_get_type ())
-G_DECLARE_FINAL_TYPE (GsPopularTile, gs_popular_tile, GS, POPULAR_TILE, GtkButton)
+G_DECLARE_FINAL_TYPE (GsPopularTile, gs_popular_tile, GS, POPULAR_TILE, GsAppTile)
GtkWidget *gs_popular_tile_new (GsApp *app);
-GsApp *gs_popular_tile_get_app (GsPopularTile *tile);
-void gs_popular_tile_set_app (GsPopularTile *tile,
- GsApp *app);
G_END_DECLS
diff --git a/src/gs-popular-tile.ui b/src/gs-popular-tile.ui
index 8bc428a..0fdfabb 100644
--- a/src/gs-popular-tile.ui
+++ b/src/gs-popular-tile.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.10 -->
- <template class="GsPopularTile" parent="GtkButton">
+ <template class="GsPopularTile" parent="GsAppTile">
<property name="visible">True</property>
<style>
<class name="view"/>
diff --git a/src/gs-shell-overview.c b/src/gs-shell-overview.c
index 4820be4..217a1e7 100644
--- a/src/gs-shell-overview.c
+++ b/src/gs-shell-overview.c
@@ -103,13 +103,13 @@ gs_shell_overview_invalidate (GsShellOverview *self)
}
static void
-popular_tile_clicked (GsPopularTile *tile, gpointer data)
+app_tile_clicked (GsAppTile *tile, gpointer data)
{
GsShellOverview *self = GS_SHELL_OVERVIEW (data);
GsShellOverviewPrivate *priv = gs_shell_overview_get_instance_private (self);
GsApp *app;
- app = gs_popular_tile_get_app (tile);
+ app = gs_app_tile_get_app (tile);
gs_shell_show_app (priv->shell, app);
}
@@ -157,7 +157,7 @@ gs_shell_overview_get_popular_cb (GObject *source_object,
app = gs_app_list_index (list, i);
tile = gs_popular_tile_new (app);
g_signal_connect (tile, "clicked",
- G_CALLBACK (popular_tile_clicked), self);
+ G_CALLBACK (app_tile_clicked), self);
gtk_container_add (GTK_CONTAINER (priv->box_popular), tile);
}
@@ -214,7 +214,7 @@ gs_shell_overview_get_popular_rotating_cb (GObject *source_object,
app = gs_app_list_index (list, i);
tile = gs_popular_tile_new (app);
g_signal_connect (tile, "clicked",
- G_CALLBACK (popular_tile_clicked), self);
+ G_CALLBACK (app_tile_clicked), self);
gtk_container_add (GTK_CONTAINER (priv->box_popular_rotating), tile);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]