[gnome-software] Show tags next to search results
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Show tags next to search results
- Date: Wed, 9 Dec 2015 16:29:24 +0000 (UTC)
commit d8242f36bd9393ced47b881d8ffb8732360ba846
Author: Richard Hughes <richard hughsie com>
Date: Wed Dec 9 11:14:49 2015 +0000
Show tags next to search results
See https://wiki.gnome.org/Apps/Software/Tags for details.
src/gs-app-row.c | 32 ++++++++++++---
src/gs-app-row.ui | 105 +++++++++++++++++++++++++++++++++++++++++++++-----
src/gtk-style-hc.css | 9 ++++
src/gtk-style.css | 9 ++++
4 files changed, 138 insertions(+), 17 deletions(-)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index 6afd4e2..73bb0cc 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -47,6 +47,10 @@ typedef struct
GtkWidget *spinner;
GtkWidget *label;
GtkWidget *checkbox;
+ GtkWidget *label_tag_foreign;
+ GtkWidget *label_tag_warning;
+ GtkWidget *label_tag_webapp;
+ GtkWidget *label_tag_nonfree;
gboolean colorful;
gboolean show_codec;
gboolean show_update;
@@ -136,20 +140,30 @@ gs_app_row_refresh (GsAppRow *app_row)
break;
}
- /* join the lines*/
+ /* join the description lines */
str = gs_app_row_get_description (app_row);
gs_string_replace (str, "\n", " ");
+ gtk_label_set_markup (GTK_LABEL (priv->description_label), str->str);
+ g_string_free (str, TRUE);
/* add warning */
if (gs_app_get_kind (priv->app) == GS_APP_KIND_FIRMWARE_UPDATE) {
- g_string_append_printf (str, "\n\n<span foreground=\"red\" font_weight=\"bold\">%s</span>",
- /* TRANSLATORS: during the update the device
- * will restart into a special update-only mode */
- _("Device cannot be used during update."));
+ gtk_label_set_text (GTK_LABEL (priv->label_tag_warning),
+ /* TRANSLATORS: during the update the device
+ * will restart into a special update-only mode */
+ _("Device cannot be used during update."));
+ gtk_widget_show (priv->label_tag_warning);
}
- gtk_label_set_markup (GTK_LABEL (priv->description_label), str->str);
- g_string_free (str, TRUE);
+ /* add tags */
+ gtk_widget_set_visible (priv->label_tag_webapp,
+ gs_app_get_id_kind (priv->app) == AS_ID_KIND_WEB_APP);
+ if (gs_app_get_id_kind (priv->app) != AS_ID_KIND_WEB_APP) {
+ gtk_widget_set_visible (priv->label_tag_nonfree,
+ !gs_app_get_licence_is_free (priv->app));
+ gtk_widget_set_visible (priv->label_tag_foreign,
+ !gs_app_get_provenance (priv->app));
+ }
gtk_label_set_label (GTK_LABEL (priv->name_label),
gs_app_get_name (priv->app));
@@ -489,6 +503,10 @@ gs_app_row_class_init (GsAppRowClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, spinner);
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, label);
gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, checkbox);
+ gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, label_tag_warning);
+ gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, label_tag_foreign);
+ gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, label_tag_webapp);
+ gtk_widget_class_bind_template_child_private (widget_class, GsAppRow, label_tag_nonfree);
}
static void
diff --git a/src/gs-app-row.ui b/src/gs-app-row.ui
index a81bb26..9230185 100644
--- a/src/gs-app-row.ui
+++ b/src/gs-app-row.ui
@@ -99,17 +99,102 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="description_label">
+ <object class="GtkBox" id="box_description">
<property name="visible">True</property>
- <property name="halign">fill</property>
- <property name="valign">start</property>
- <property name="margin_start">20</property>
- <property name="margin_end">20</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="wrap">True</property>
- <property name="ellipsize">end</property>
- <property name="lines">3</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">3</property>
+ <child>
+ <object class="GtkLabel" id="description_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="margin_start">20</property>
+ <property name="margin_end">20</property>
+ <property name="wrap">True</property>
+ <property name="ellipsize">end</property>
+ <property name="lines">3</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box_tag">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <property name="margin_left">20</property>
+ <child>
+ <object class="GtkLabel" id="label_tag_warning">
+ <property name="can_focus">False</property>
+ <property name="label">warning-text</property>
+ <property name="margin_start">20</property>
+ <property name="margin_end">20</property>
+ <property name="ellipsize">middle</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="foreground" value="#cccc00000000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_tag_foreign">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" comments="This is shown in the search result
row as a tag">3rd party</property>
+ <style>
+ <class name="app-row-tag"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_tag_webapp">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" comments="This is shown in the search result
row as a tag">web app</property>
+ <style>
+ <class name="app-row-tag"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_tag_nonfree">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" comments="This is shown in the search result
row as a tag">nonfree</property>
+ <style>
+ <class name="app-row-tag"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">True</property>
diff --git a/src/gtk-style-hc.css b/src/gtk-style-hc.css
index e222160..d829816 100644
--- a/src/gtk-style-hc.css
+++ b/src/gtk-style-hc.css
@@ -35,6 +35,15 @@
font-size: 10px;
}
+.app-row-tag {
+ text-shadow: none;
+ color: white;
+ background-color: #999999;
+ font-size: smaller;
+ border-radius: 4px;
+ padding: 2px 10px;
+}
+
.view.tile {
padding: 0;
background-image: none;
diff --git a/src/gtk-style.css b/src/gtk-style.css
index 093f812..ead5e05 100644
--- a/src/gtk-style.css
+++ b/src/gtk-style.css
@@ -36,6 +36,15 @@
font-size: 10px;
}
+.app-row-tag {
+ text-shadow: none;
+ color: @theme_selected_fg_color;
+ background-color: #999999;
+ font-size: smaller;
+ border-radius: 4px;
+ padding: 2px 10px;
+}
+
.view.tile {
padding: 0;
box-shadow: inset 0 1px @theme_base_color, 0 1px 1px alpha(black,0.4);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]