[gnome-software/wip/folders: 3/10] Show folder in GsAppWidget
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/folders: 3/10] Show folder in GsAppWidget
- Date: Thu, 14 Nov 2013 02:05:31 +0000 (UTC)
commit a14cdb0ab15b9af088714fac05699ea562805ed9
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Nov 3 01:03:50 2013 -0400
Show folder in GsAppWidget
We show the folder name on a gray background.
src/app-widget.ui | 15 +++++++++++++++
src/gs-app-widget.c | 15 +++++++++++++++
src/gtk-style.css | 7 +++++++
3 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/app-widget.ui b/src/app-widget.ui
index c7ee9d8..1bdeb70 100644
--- a/src/app-widget.ui
+++ b/src/app-widget.ui
@@ -53,6 +53,21 @@
<property name="fill">False</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="folder_label">
+ <property name="visible">True</property>
+ <property name="xalign">0.0</property>
+ <property name="yalign">0.5</property>
+ <property name="halign">start</property>
+ <style>
+ <class name="folder-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/gs-app-widget.c b/src/gs-app-widget.c
index 77dd6a0..e3a2844 100644
--- a/src/gs-app-widget.c
+++ b/src/gs-app-widget.c
@@ -28,6 +28,7 @@
#include "gs-app-widget.h"
#include "gs-markdown.h"
#include "gs-utils.h"
+#include "gs-folders.h"
struct _GsAppWidgetPrivate
{
@@ -36,6 +37,7 @@ struct _GsAppWidgetPrivate
GtkWidget *name_box;
GtkWidget *name_label;
GtkWidget *version_label;
+ GtkWidget *folder_label;
GtkWidget *description_label;
GtkWidget *button_box;
GtkWidget *button;
@@ -65,6 +67,8 @@ gs_app_widget_refresh (GsAppWidget *app_widget)
const gchar *tmp = NULL;
GString *str = NULL;
gchar *update_desc = NULL;
+ GsFolders *folders;
+ const gchar *folder;
if (app_widget->priv->app == NULL)
return;
@@ -121,6 +125,16 @@ gs_app_widget_refresh (GsAppWidget *app_widget)
gtk_label_set_label (GTK_LABEL (priv->version_label),
gs_app_get_version_ui (priv->app));
}
+
+ folders = gs_folders_get ();
+ folder = gs_folders_get_app_folder (folders, gs_app_get_id (priv->app));
+ if (folder)
+ folder = gs_folders_get_folder_name (folders, folder);
+ gtk_label_set_label (GTK_LABEL (priv->folder_label), folder);
+ gtk_widget_set_visible (priv->folder_label, folder != NULL);
+
+ g_object_unref (folders);
+
if (gs_app_get_pixbuf (priv->app))
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image),
gs_app_get_pixbuf (priv->app));
@@ -261,6 +275,7 @@ gs_app_widget_class_init (GsAppWidgetClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, name_box);
gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, name_label);
gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, version_label);
+ gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, folder_label);
gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, description_label);
gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, button_box);
gtk_widget_class_bind_template_child_private (widget_class, GsAppWidget, button);
diff --git a/src/gtk-style.css b/src/gtk-style.css
index c963c1d..2f4d44f 100644
--- a/src/gtk-style.css
+++ b/src/gtk-style.css
@@ -82,6 +82,13 @@ GtkNotebook.main-notebook-software > GtkScrolledWindow {
text-shadow: none;
}
+.folder-label {
+ background-color: #999999;
+ border-radius: 5px;
+ padding: 5px;
+ color: white;
+}
+
.header-label {
font-size: 11px;
padding: 6px;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]