[gnome-software] Make the screenshot error state prettier
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Make the screenshot error state prettier
- Date: Tue, 8 Oct 2013 02:44:19 +0000 (UTC)
commit 9c0a34bcbc66de4d965b76f1377c73fe7a876594
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 7 22:20:10 2013 -0400
Make the screenshot error state prettier
We should use a symbolic icon here, avoid the text
shadow, and don't show the label if there's not enough
room.
src/gs-screenshot-image.c | 7 +++++++
src/gtk-style.css | 4 ++++
src/screenshot-image.ui | 7 +++++--
3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-screenshot-image.c b/src/gs-screenshot-image.c
index 041bc09..9faf568 100644
--- a/src/gs-screenshot-image.c
+++ b/src/gs-screenshot-image.c
@@ -83,6 +83,8 @@ static void
gs_screenshot_image_set_error (GsScreenshotImage *ssimg, const gchar *message)
{
GsScreenshotImagePrivate *priv;
+ gint width, height;
+
priv = gs_screenshot_image_get_instance_private (ssimg);
/* cancel the spinner timeout */
@@ -95,6 +97,11 @@ gs_screenshot_image_set_error (GsScreenshotImage *ssimg, const gchar *message)
gtk_widget_set_visible (priv->spinner, FALSE);
gtk_widget_set_visible (priv->box_error, TRUE);
gtk_label_set_label (GTK_LABEL (priv->label_error), message);
+ gtk_widget_get_size_request (priv->box, &width, &height);
+ if (width < 200)
+ gtk_widget_hide (priv->label_error);
+ else
+ gtk_widget_show (priv->label_error);
}
/**
diff --git a/src/gtk-style.css b/src/gtk-style.css
index 7de82d4..0937c43 100644
--- a/src/gtk-style.css
+++ b/src/gtk-style.css
@@ -64,3 +64,7 @@ GtkNotebook.main-notebook-software > GtkScrolledWindow {
.application-details-description {
}
+
+.error-label {
+ text-shadow: none;
+}
diff --git a/src/screenshot-image.ui b/src/screenshot-image.ui
index ffe57c6..45870a5 100644
--- a/src/screenshot-image.ui
+++ b/src/screenshot-image.ui
@@ -41,10 +41,11 @@
<object class="GtkBox" id="box_error">
<property name="visible">False</property>
<property name="orientation">vertical</property>
+ <property name="spacing">4</property>
<child>
<object class="GtkImage" id="image_error">
<property name="visible">True</property>
- <property name="stock">gtk-dialog-error</property>
+ <property name="icon-name">dialog-error-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
@@ -55,7 +56,9 @@
<child>
<object class="GtkLabel" id="label_error">
<property name="visible">True</property>
- <property name="label">label</property>
+ <style>
+ <class name="error-label"/>
+ </style>
</object>
<packing>
<property name="expand">False</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]