[gnome-software] Show the screenshots in the application detail panel
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Show the screenshots in the application detail panel
- Date: Sun, 6 Oct 2013 19:34:20 +0000 (UTC)
commit 71b4202c13832dd47066a4106dd8bc410c7d7728
Author: Richard Hughes <richard hughsie com>
Date: Sun Oct 6 20:33:55 2013 +0100
Show the screenshots in the application detail panel
src/gnome-software.ui | 436 +++++++++++++++++++++++++++++++++++++++++-------
src/gs-screenshot.h | 5 +
src/gs-shell-details.c | 103 +++++++++++-
3 files changed, 480 insertions(+), 64 deletions(-)
---
diff --git a/src/gnome-software.ui b/src/gnome-software.ui
index fff2c4b..bd00eb3 100644
--- a/src/gnome-software.ui
+++ b/src/gnome-software.ui
@@ -692,16 +692,28 @@
<property name="can_focus">False</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">automatic</property>
+
+
+
+
+ <child>
+ <object class="GtkViewport" id="viewport1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox" id="box_details">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="margin_top">24</property>
+ <property name="margin_bottom">24</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">16</property>
<child>
- <object class="GtkGrid" id="grid2">
+ <object class="GtkBox" id="box_details_header">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="margin_top">64</property>
- <property name="margin_bottom">64</property>
- <property name="margin_left">64</property>
- <property name="margin_right">64</property>
- <property name="hexpand">False</property>
+ <property name="spacing">3</property>
<child>
<object class="GtkImage" id="application_details_icon">
<property name="visible">True</property>
@@ -710,29 +722,227 @@
<property name="valign">start</property>
<property name="pixel_size">96</property>
<property name="icon_name">gimp</property>
- <property name="margin_bottom">24</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box_details_header2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkLabel" id="application_details_title">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Shotwell</property>
+ <style>
+ <class name="application-details-title"/>
+ </style>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="foreground" value="#555557575353"/>
+ <attribute name="size" value="15000"/>
+ </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="application_details_summary">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Open source photo management for
GNOME</property>
+ <style>
+ <class name="application-details-summary"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <property name="stock">gtk-cdrom</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box_details_screenshot">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">9</property>
+ <child>
+ <object class="GtkBox" id="box_details_screenshot_main">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box_details_screenshot_thumbnails">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">7</property>
+ <child>
+ <placeholder/>
+ </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">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="application_details_description_header">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Description</property>
+ <style>
+ <class name="application-details-title"/>
+ </style>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="foreground" value="#555557575353"/>
+ <attribute name="size" value="15000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="application_details_description">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Long description</property>
+ <property name="wrap">True</property>
+ <property name="max_width_chars">80</property>
+ <style>
+ <class name="application-details-description"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="application_details_details_title">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Details</property>
+ <style>
+ <class name="application-details-title"/>
+ </style>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="foreground" value="#555557575353"/>
+ <attribute name="size" value="15000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid_details_details">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="row_spacing">3</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="label_details_version_title">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Version</property>
+ <property name="ellipsize">end</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
- <property name="height">4</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="application_details_title">
+ <object class="GtkLabel" id="label_details_version_value">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="valign">start</property>
- <property name="margin_left">24</property>
- <property name="margin_right">24</property>
- <property name="margin_bottom">4</property>
- <property name="hexpand">True</property>
<property name="xalign">0</property>
- <style>
- <class name="application-details-title"/>
- </style>
+ <property name="label">0.12.3</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -742,60 +952,67 @@
</packing>
</child>
<child>
- <object class="GtkLinkButton" id="application_details_url">
- <property name="label" translatable="yes">Visit _Website</property>
- <property name="use_underline">True</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="xalign">0</property>
- <property name="halign">start</property>
- <property name="relief">none</property>
- <property name="margin_bottom">32</property>
+ <object class="GtkLabel" id="label_details_licence_title">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Licence</property>
+ <property name="ellipsize">end</property>
<style>
- <class name="text-button"/>
+ <class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">4</property>
- <property name="width">2</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="button_history">
- <property name="label" translatable="yes">_History</property>
- <property name="use_underline">True</property>
- <property name="vexpand">True</property>
- <property name="halign">start</property>
- <property name="valign">end</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
+ <object class="GtkLabel" id="label_details_size_title">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Size</property>
+ <property name="ellipsize">end</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">5</property>
+ <property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="application_details_summary">
+ <object class="GtkLabel" id="label_details_developer_title">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="valign">start</property>
- <property name="hexpand">True</property>
- <property name="margin_left">24</property>
- <property name="margin_right">24</property>
- <property name="margin_bottom">24</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Developer</property>
+ <property name="ellipsize">end</property>
<style>
- <class name="application-details-summary"/>
+ <class name="dim-label"/>
</style>
</object>
<packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_details_licence_value">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">GPL</property>
+ </object>
+ <packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
@@ -803,26 +1020,127 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="application_details_description">
+ <object class="GtkLabel" id="label_details_size_value">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">30 MB</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_details_developer_value">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="wrap">True</property>
- <property name="max-width-chars">80</property>
- <property name="margin_bottom">32</property>
- <style>
- <class name="application-details-description"/>
- </style>
+ <property name="label">Yorba</property>
</object>
<packing>
- <property name="left_attach">0</property>
+ <property name="left_attach">1</property>
<property name="top_attach">3</property>
- <property name="width">2</property>
+ <property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
</child>
+ <child>
+ <object class="GtkLabel" id="application_details_support_title">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Support</property>
+ <style>
+ <class name="application-details-title"/>
+ </style>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="foreground" value="#555557575353"/>
+ <attribute name="size" value="15000"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box_details_support">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkLinkButton" id="application_details_url">
+ <property name="label" translatable="yes">Visit _Website</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">start</property>
+ <property name="valign">end</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <style>
+ <class name="text-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_history">
+ <property name="label" translatable="yes">_History</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="valign">end</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+
+
+
+
+
+
+
+
+
+
</object>
<packing>
<property name="name">details</property>
diff --git a/src/gs-screenshot.h b/src/gs-screenshot.h
index f253f62..90ca16f 100644
--- a/src/gs-screenshot.h
+++ b/src/gs-screenshot.h
@@ -50,6 +50,11 @@ GType gs_screenshot_get_type (void);
GsScreenshot *gs_screenshot_new (void);
+#define GS_SCREENSHOT_SIZE_SMALL_WIDTH 112
+#define GS_SCREENSHOT_SIZE_SMALL_HEIGHT 63
+#define GS_SCREENSHOT_SIZE_LARGE_WIDTH 624
+#define GS_SCREENSHOT_SIZE_LARGE_HEIGHT 351
+
gboolean gs_screenshot_get_is_default (GsScreenshot *screenshot);
void gs_screenshot_set_is_default (GsScreenshot *screenshot,
gboolean is_default);
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 19774bb..ab830d1 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -28,6 +28,7 @@
#include "gs-utils.h"
#include "gs-shell-details.h"
+#include "gs-screenshot-image.h"
static void gs_shell_details_finalize (GObject *object);
@@ -177,18 +178,49 @@ gs_shell_details_app_state_changed_cb (GsApp *app, GsShellDetails *shell_details
}
/**
+ * gs_shell_details_screenshot_clicked_cb:
+ **/
+static void
+gs_shell_details_screenshot_clicked_cb (GsScreenshotImage *ssthumb,
+ GsShellDetails *shell_details)
+{
+ GList *children;
+ GsScreenshot *ss;
+ GsScreenshotImage *ssmain;
+ GsShellDetailsPrivate *priv = shell_details->priv;
+ GtkWidget *widget;
+
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "box_details_screenshot_main"));
+ children = gtk_container_get_children (GTK_CONTAINER (widget));
+ ssmain = GS_SCREENSHOT_IMAGE (children->data);
+ ss = gs_screenshot_image_get_screenshot (ssthumb);
+ g_debug ("Button pressed, show %s",
+ gs_screenshot_get_url (ss, G_MAXUINT, G_MAXUINT));
+ gs_screenshot_image_set_screenshot (ssmain,
+ ss,
+ GS_SCREENSHOT_SIZE_LARGE_WIDTH,
+ GS_SCREENSHOT_SIZE_LARGE_HEIGHT);
+ g_list_free (children);
+}
+
+/**
* gs_shell_details_set_app:
**/
void
gs_shell_details_set_app (GsShellDetails *shell_details, GsApp *app)
{
- const gchar *tmp;
- gchar *app_dump;
- GdkPixbuf *pixbuf;
- GtkWidget *widget;
- GtkWidget *widget2;
GPtrArray *history;
+ GPtrArray *screenshots;
+ GdkPixbuf *pixbuf;
+ GsScreenshot *ss;
GsShellDetailsPrivate *priv = shell_details->priv;
+ GtkWidget *ssimg;
+ GtkWidget *widget2;
+ GtkWidget *widget;
+ const gchar *tmp;
+ gchar *app_dump;
+ guint i;
/* show some debugging */
app_dump = gs_app_to_string (app);
@@ -250,6 +282,67 @@ gs_shell_details_set_app (GsShellDetails *shell_details, GsApp *app)
gtk_widget_set_visible (widget, FALSE);
}
+ /* set screenshots */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "box_details_screenshot_main"));
+ gs_container_remove_all (GTK_CONTAINER (widget));
+ screenshots = gs_app_get_screenshots (app);
+ if (screenshots->len > 0) {
+ ss = g_ptr_array_index (screenshots, 0);
+ ssimg = gs_screenshot_image_new ();
+ gs_screenshot_image_set_cachedir (GS_SCREENSHOT_IMAGE (ssimg), g_get_user_cache_dir ());
+ gs_screenshot_image_set_screenshot (GS_SCREENSHOT_IMAGE (ssimg),
+ ss,
+ GS_SCREENSHOT_SIZE_LARGE_WIDTH,
+ GS_SCREENSHOT_SIZE_LARGE_HEIGHT);
+ gtk_box_pack_start (GTK_BOX (widget), ssimg, FALSE, FALSE, 0);
+ gtk_widget_set_visible (ssimg, TRUE);
+ }
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "box_details_screenshot_thumbnails"));
+ gs_container_remove_all (GTK_CONTAINER (widget));
+ if (screenshots->len > 1) {
+ for (i = 0; i < screenshots->len; i++) {
+ ss = g_ptr_array_index (screenshots, i);
+ ssimg = gs_screenshot_image_new ();
+ g_signal_connect (ssimg, "clicked",
+ G_CALLBACK (gs_shell_details_screenshot_clicked_cb),
+ shell_details);
+ gs_screenshot_image_set_cachedir (GS_SCREENSHOT_IMAGE (ssimg), g_get_user_cache_dir
());
+ gs_screenshot_image_set_screenshot (GS_SCREENSHOT_IMAGE (ssimg),
+ ss,
+ GS_SCREENSHOT_SIZE_SMALL_WIDTH,
+ GS_SCREENSHOT_SIZE_SMALL_HEIGHT);
+ gtk_box_pack_start (GTK_BOX (widget), ssimg, FALSE, FALSE, 0);
+ gtk_widget_set_visible (ssimg, TRUE);
+ }
+ }
+
+ /* set the project group */
+ tmp = gs_app_get_project_group (app);
+ if (tmp == NULL) {
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_details_developer_title"));
+ gtk_widget_set_visible (widget, FALSE);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_details_developer_value"));
+ gtk_widget_set_visible (widget, FALSE);
+ } else {
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_details_developer_title"));
+ gtk_widget_set_visible (widget, TRUE);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_details_developer_value"));
+ gtk_label_set_label (GTK_LABEL (widget), tmp);
+ gtk_widget_set_visible (widget, TRUE);
+ }
+
+ /* set version */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_details_version_value"));
+ gtk_label_set_label (GTK_LABEL (widget), gs_app_get_version (app));
+
+ /* FIXME: This isn't ready yet */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_details_title"));
+ gtk_widget_set_visible (widget, FALSE);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "grid_details_details"));
+ gtk_widget_set_visible (widget, FALSE);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_details_support_title"));
+ gtk_widget_set_visible (widget, FALSE);
+
/* make history button insensitive if there is none */
history = gs_app_get_history (app);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_history"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]