[gnome-software] First cut at the application detail page



commit e77ab29466775750a3eaed132a4b7f8d11f2f2f4
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Aug 15 15:15:22 2013 -0400

    First cut at the application detail page
    
    We show this page when the user clicks on a featured, popular or
    other app tile in the main view. The install/remove buttons don't
    do anything yet, and the content of the page is hardcoded to the
    Gimp.

 src/gnome-software.ui                     |  448 ++++++++++++++++++++---------
 src/gs-main.c                             |   92 ++++--
 src/gtk-style.css                         |   57 ++++-
 src/plugins/gs-plugin-hardcoded-popular.c |    4 +
 4 files changed, 438 insertions(+), 163 deletions(-)
---
diff --git a/src/gnome-software.ui b/src/gnome-software.ui
index 08b5609..05e3fe9 100644
--- a/src/gnome-software.ui
+++ b/src/gnome-software.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.15.2 on Wed Aug 14 13:18:05 2013 -->
+<!-- Generated with glade 3.15.2 on Thu Aug 15 14:23:55 2013 -->
 <interface>
   <!-- interface-requires gtk+ 3.10 -->
   <object class="GtkListStore" id="liststore_update">
@@ -20,102 +20,123 @@
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">0</property>
         <child>
           <object class="GtkHeaderBar" id="header">
             <property name="visible">True</property>
-            <property name="show-close-button">True</property>
+            <property name="can_focus">False</property>
+            <property name="show_close_button">True</property>
             <child>
               <object class="GtkButton" id="button_back">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
                 <style>
                   <class name="image-button"/>
                 </style>
                 <child>
                   <object class="GtkImage" id="back_image">
                     <property name="visible">True</property>
-                    <property name="icon-name">go-previous-symbolic</property>
-                    <property name="icon-size">1</property>
+                    <property name="can_focus">False</property>
+                    <property name="icon_name">go-previous-symbolic</property>
+                    <property name="icon_size">1</property>
                   </object>
                 </child>
               </object>
-              <packing>
-                <property name="pack-type">start</property>
-              </packing>
             </child>
             <child type="title">
-              <object class="GtkButtonBox" id="buttonbox_main">
+              <object class="GtkBox" id="title_box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="layout_style">center</property>
-                <style>
-                  <class name="linked"/>
-                </style>
                 <child>
-                  <object class="GtkToggleButton" id="button_all">
+                  <object class="GtkButtonBox" id="buttonbox_main">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="layout_style">center</property>
                     <style>
-                      <class name="toolbar-primary-buttons-software"/>
+                      <class name="linked"/>
                     </style>
                     <child>
-                      <object class="GtkLabel" id="label_button_all">
+                      <object class="GtkToggleButton" id="button_all">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">All</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <style>
+                          <class name="toolbar-primary-buttons-software"/>
+                        </style>
+                        <child>
+                          <object class="GtkLabel" id="label_button_all">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">All</property>
+                          </object>
+                        </child>
                       </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
                     </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkToggleButton" id="button_installed">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <style>
-                      <class name="toolbar-primary-buttons-software"/>
-                    </style>
                     <child>
-                      <object class="GtkLabel" id="label_button_installed">
+                      <object class="GtkToggleButton" id="button_installed">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Installed</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <style>
+                          <class name="toolbar-primary-buttons-software"/>
+                        </style>
+                        <child>
+                          <object class="GtkLabel" id="label_button_installed">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Installed</property>
+                          </object>
+                        </child>
                       </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToggleButton" id="button_updates">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <style>
+                          <class name="toolbar-primary-buttons-software"/>
+                        </style>
+                        <child>
+                          <object class="GtkLabel" id="label_button_updates">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Updates</property>
+                          </object>
+                        </child>
+                      </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>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkToggleButton" id="button_updates">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <style>
-                      <class name="toolbar-primary-buttons-software"/>
-                    </style>
-                    <child>
-                      <object class="GtkLabel" id="label_button_updates">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Updates</property>
-                      </object>
-                    </child>
+                  <object class="GtkLabel" id="application_detail_header">
+                    <property name="can_focus">False</property>
+                    <property name="label">GNU Image Manipulation Program</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">2</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
@@ -131,13 +152,12 @@
                 </style>
               </object>
               <packing>
-                <property name="pack-type">end</property>
+                <property name="pack_type">end</property>
               </packing>
             </child>
             <child>
               <object class="GtkButton" id="button_install">
                 <property name="label" translatable="yes">Install</property>
-                <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <style>
@@ -145,10 +165,28 @@
                 </style>
               </object>
               <packing>
-                <property name="pack-type">end</property>
+                <property name="pack_type">end</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button_remove">
+                <property name="label" translatable="yes">Remove</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <style>
+                  <class name="destructive-action"/>
+                </style>
+              </object>
+              <packing>
+                <property name="pack_type">end</property>
               </packing>
             </child>
           </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
         </child>
         <child>
           <object class="GtkToolbar" id="search_bar">
@@ -169,9 +207,9 @@
                       <object class="GtkBox" id="box_left">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="orientation">vertical</property>
                         <property name="halign">start</property>
                         <property name="hexpand">True</property>
+                        <property name="orientation">vertical</property>
                         <child>
                           <placeholder/>
                         </child>
@@ -198,9 +236,9 @@
                       <object class="GtkBox" id="box_right">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="orientation">vertical</property>
                         <property name="halign">start</property>
                         <property name="hexpand">True</property>
+                        <property name="orientation">vertical</property>
                         <child>
                           <placeholder/>
                         </child>
@@ -222,6 +260,7 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
+            <property name="position">1</property>
           </packing>
         </child>
         <child>
@@ -233,8 +272,8 @@
               <object class="GtkScrolledWindow" id="scrolledwindow1">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">never</property>
                 <property name="shadow_type">in</property>
-                <property name="hscrollbar-policy">never</property>
                 <style>
                   <class name="main-scrolled-software"/>
                 </style>
@@ -272,65 +311,19 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkEventBox" id="gradient_box_software">
+                          <object class="GtkButton" id="featured_button">
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <style>
-                              <class name="gradient_box_software"/>
-                            </style>
+                            <property name="halign">center</property>
+                            <property name="relief">none</property>
                             <child>
-                              <object class="GtkBox" id="box4">
+                              <object class="GtkImage" id="featured_image">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="halign">center</property>
-                                <property name="spacing">5</property>
-                                <child>
-                                  <object class="GtkImage" id="image_featured1">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="ypad">5</property>
-                                    <property name="stock">gtk-delete</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkImage" id="image_featured2">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="ypad">5</property>
-                                    <property name="stock">gtk-delete</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkImage" id="image_featured3">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="ypad">5</property>
-                                    <property name="stock">gtk-delete</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">False</property>
-                                    <property name="position">2</property>
-                                  </packing>
-                                </child>
+                                <property name="ypad">5</property>
+                                <property name="stock">gtk-delete</property>
                               </object>
                             </child>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
                         </child>
                         <child>
                           <object class="GtkAlignment" id="alignment2">
@@ -360,13 +353,40 @@
                         <child>
                           <object class="GtkGrid" id="grid_popular">
                             <property name="visible">True</property>
-                            <property name="row-spacing">12</property>
-                            <property name="column-spacing">12</property>
-                            <property name="row-homogeneous">True</property>
-                            <property name="column-homogeneous">True</property>
-                            <property name="halign">fill</property>
-                            <property name="margin-left">12</property>
-                            <property name="margin-right">12</property>
+                            <property name="can_focus">False</property>
+                            <property name="margin_left">12</property>
+                            <property name="margin_right">12</property>
+                            <property name="row_spacing">12</property>
+                            <property name="column_spacing">12</property>
+                            <property name="row_homogeneous">True</property>
+                            <property name="column_homogeneous">True</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -402,13 +422,40 @@
                         <child>
                           <object class="GtkGrid" id="grid_categories">
                             <property name="visible">True</property>
-                            <property name="row-spacing">12</property>
-                            <property name="column-spacing">12</property>
-                            <property name="row-homogeneous">True</property>
-                            <property name="column-homogeneous">True</property>
-                            <property name="halign">fill</property>
-                            <property name="margin-left">12</property>
-                            <property name="margin-right">12</property>
+                            <property name="can_focus">False</property>
+                            <property name="margin_left">12</property>
+                            <property name="margin_right">12</property>
+                            <property name="row_spacing">12</property>
+                            <property name="column_spacing">12</property>
+                            <property name="row_homogeneous">True</property>
+                            <property name="column_homogeneous">True</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -426,7 +473,7 @@
               <object class="GtkLabel" id="label2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label">New</property>
+                <property name="label">All</property>
               </object>
               <packing>
                 <property name="tab_fill">False</property>
@@ -589,10 +636,10 @@
               </packing>
             </child>
             <child type="tab">
-              <object class="GtkLabel" id="label9">
+              <object class="GtkLabel" id="label8">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label">Detail Overview</property>
+                <property name="label">Waiting</property>
               </object>
               <packing>
                 <property name="position">2</property>
@@ -755,16 +802,154 @@
               </packing>
             </child>
             <child type="tab">
-              <object class="GtkLabel" id="label8">
+              <object class="GtkLabel" id="label9">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label">Waiting</property>
+                <property name="label">Detail Overview</property>
               </object>
               <packing>
                 <property name="position">2</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkGrid" id="grid2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">center</property>
+                <property name="margin_left">80</property>
+                <property name="margin_right">80</property>
+                <property name="margin_top">40</property>
+                <property name="margin_bottom">40</property>
+                <property name="hexpand">False</property>
+                <property name="column_spacing">20</property>
+                <child>
+                  <object class="GtkImage" id="application_details_icon">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="valign">start</property>
+                    <property name="pixel_size">96</property>
+                    <property name="icon_name">gimp</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">3</property>
+                  </packing>
+                </child>
+                <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="margin_bottom">10</property>
+                    <property name="hexpand">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">GNU Image Manipulation Program</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                      <attribute name="scale" value="1"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLinkButton" id="application_details_link">
+                    <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="relief">none</property>
+                    <property name="uri"> http://www.gimp.org/</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">4</property>
+                    <property name="width">2</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="application_details_subtitle">
+                    <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">The Gimp</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label12">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">GIMP (GNU Image Manipulation Program) is a 
powerful image composition and
+editing program, which can be extremely useful for creating logos and other
+graphics for webpages. GIMP has many of the tools and filters you would expect
+to find in similar commercial offerings, and some interesting extras as well.
+GIMP provides a large image manipulation toolbox, including channel operations
+and layers, effects, sub-pixel imaging and anti-aliasing, and conversions, all
+with multi-level undo.
+</property>
+                    <property name="wrap">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">3</property>
+                    <property name="width">2</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="position">5</property>
+              </packing>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="label7">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Application</property>
+              </object>
+              <packing>
+                <property name="position">5</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="category_detail_grid">
+              </object>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="label11">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Category</property>
+              </object>
+              <packing>
+                <property name="position">6</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">True</property>
@@ -961,7 +1146,6 @@
   </object>
   <object class="GtkSizeGroup" id="sizegroup_header_center"/>
   <object class="GtkSizeGroup" id="sizegroup_searchentry">
-    <property name="mode">horizontal</property>
     <widgets>
       <widget name="buttonbox_main"/>
       <widget name="entry_search"/>
diff --git a/src/gs-main.c b/src/gs-main.c
index 265ca83..38bf8b8 100644
--- a/src/gs-main.c
+++ b/src/gs-main.c
@@ -37,7 +37,9 @@ typedef enum {
        GS_MAIN_MODE_INSTALLED,
        GS_MAIN_MODE_UPDATES,
        GS_MAIN_MODE_WAITING,
-       GS_MAIN_MODE_DETAILS
+       GS_MAIN_MODE_DETAILS,
+        GS_MAIN_MODE_APPLICATION,
+        GS_MAIN_MODE_CATEGORY
 } GsMainMode;
 
 enum {
@@ -70,7 +72,9 @@ typedef struct {
        guint                    tab_back_id;
 } GsMainPrivate;
 
-static void gs_main_set_overview_mode_ui (GsMainPrivate *priv, GsMainMode mode);
+static void gs_main_set_overview_mode_ui (GsMainPrivate *priv, GsMainMode mode, GsApp *app);
+static void gs_main_set_overview_mode (GsMainPrivate *priv, GsMainMode mode, GsApp *app);
+static void app_tile_clicked (GtkButton *button, gpointer data);
 
 /**
  * gs_main_activate_cb:
@@ -91,7 +95,7 @@ static gboolean
 gs_main_show_waiting_tab_cb (gpointer user_data)
 {
        GsMainPrivate *priv = (GsMainPrivate *) user_data;
-       gs_main_set_overview_mode_ui (priv, GS_MAIN_MODE_WAITING);
+       gs_main_set_overview_mode_ui (priv, GS_MAIN_MODE_WAITING, NULL);
        priv->waiting_tab_id = 0;
        return FALSE;
 }
@@ -225,7 +229,7 @@ gs_main_progress_cb (PkProgress *progress,
        /* show the waiting panel if the delay is significant */
        if (status == PK_STATUS_ENUM_SETUP ||
            status == PK_STATUS_ENUM_FINISHED) {
-               gs_main_set_overview_mode_ui (priv, priv->mode);
+               gs_main_set_overview_mode_ui (priv, priv->mode, NULL);
                if (priv->waiting_tab_id > 0) {
                        g_source_remove (priv->waiting_tab_id);
                        priv->waiting_tab_id = 0;
@@ -284,7 +288,7 @@ gs_main_plugin_loader_status_changed_cb (GsPluginLoader *plugin_loader,
 
        /* show the waiting panel if the delay is significant */
        if (status == GS_PLUGIN_STATUS_FINISHED) {
-               gs_main_set_overview_mode_ui (priv, priv->mode);
+               gs_main_set_overview_mode_ui (priv, priv->mode, NULL);
                if (priv->waiting_tab_id > 0) {
                        g_source_remove (priv->waiting_tab_id);
                        priv->waiting_tab_id = 0;
@@ -739,8 +743,18 @@ gs_main_get_updates (GsMainPrivate *priv)
                                            (GAsyncReadyCallback) gs_main_get_updates_cb, priv);
 }
 
+static void
+app_tile_clicked (GtkButton *button, gpointer data)
+{
+        GsMainPrivate *priv = data;
+        GsApp *app;
+
+        app = g_object_get_data (button, "app");
+        gs_main_set_overview_mode (priv, GS_MAIN_MODE_APPLICATION, app);
+}
+
 static GtkWidget *
-create_popular_tile (GsApp *app)
+create_popular_tile (GsMainPrivate *priv, GsApp *app)
 {
         GtkWidget *button, *frame, *ebox, *box, *image, *label;
         GtkWidget *f;
@@ -768,6 +782,9 @@ create_popular_tile (GsApp *app)
         gtk_container_add (GTK_CONTAINER (button), frame);
         gtk_container_add (GTK_CONTAINER (f), button);
         gtk_widget_show_all (f);
+        g_object_set_data_full (button, "app", g_object_ref (app), g_object_unref);
+        g_signal_connect (button, "clicked",
+                          G_CALLBACK (app_tile_clicked), priv);
 
         return f;
 }
@@ -804,7 +821,7 @@ gs_main_get_popular_cb (GObject *source_object,
        for (l = list, i = 0; l != NULL; l = l->next, i++) {
                app = GS_APP (l->data);
                g_debug ("adding popular %s", gs_app_get_id (app));
-                tile = create_popular_tile (app);
+                tile = create_popular_tile (priv, app);
                 gtk_grid_attach (GTK_GRID (grid), tile, i, 0, 1, 1);
        }
 out:
@@ -895,9 +912,10 @@ gs_main_get_categories (GsMainPrivate *priv)
  * gs_main_set_overview_mode_ui:
  **/
 static void
-gs_main_set_overview_mode_ui (GsMainPrivate *priv, GsMainMode mode)
+gs_main_set_overview_mode_ui (GsMainPrivate *priv, GsMainMode mode, GsApp *app)
 {
        GtkWidget *widget;
+        GsAppState state;
 
        priv->ignore_primary_buttons = TRUE;
 
@@ -909,8 +927,12 @@ gs_main_set_overview_mode_ui (GsMainPrivate *priv, GsMainMode mode)
                gtk_widget_set_visible (widget, TRUE);
                widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
                gtk_widget_set_visible (widget, FALSE);
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_remove"));
+               gtk_widget_set_visible (widget, FALSE);
                widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_update_all"));
                gtk_widget_set_visible (widget, FALSE);
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_detail_header"));
+               gtk_widget_set_visible (widget, FALSE);
                break;
        case GS_MAIN_MODE_NEW:
        case GS_MAIN_MODE_INSTALLED:
@@ -922,6 +944,25 @@ gs_main_set_overview_mode_ui (GsMainPrivate *priv, GsMainMode mode)
                gtk_widget_set_visible (widget, FALSE);
                widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
                gtk_widget_set_visible (widget, FALSE);
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_remove"));
+               gtk_widget_set_visible (widget, FALSE);
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_detail_header"));
+               gtk_widget_set_visible (widget, FALSE);
+               break;
+       case GS_MAIN_MODE_APPLICATION:
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "buttonbox_main"));
+               gtk_widget_set_visible (widget, FALSE);
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "application_detail_header"));
+               gtk_widget_set_visible (widget, TRUE);
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_back"));
+               gtk_widget_set_visible (widget, TRUE);
+                state = gs_app_get_state (app);
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
+               gtk_widget_set_visible (widget, state != GS_APP_STATE_INSTALLED);
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_remove"));
+               gtk_widget_set_visible (widget, state == GS_APP_STATE_INSTALLED);
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "search_bar"));
+               gtk_widget_set_visible (widget, FALSE);
                break;
        default:
                break;
@@ -984,6 +1025,8 @@ gs_main_set_overview_mode_ui (GsMainPrivate *priv, GsMainMode mode)
                widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "image_detail_screenshot"));
                gtk_widget_hide (widget);
                break;
+       case GS_MAIN_MODE_APPLICATION:
+               break;
        default:
                g_assert_not_reached ();
        }
@@ -1009,7 +1052,7 @@ gs_main_set_overview_mode (GsMainPrivate *priv, GsMainMode mode, GsApp *app)
                return;
 
        /* set controls */
-       gs_main_set_overview_mode_ui (priv, mode);
+       gs_main_set_overview_mode_ui (priv, mode, app);
 
        /* do action for mode */
        priv->mode = mode;
@@ -1083,6 +1126,8 @@ gs_main_set_overview_mode (GsMainPrivate *priv, GsMainMode mode, GsApp *app)
                widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
                gtk_widget_set_visible (widget, gs_app_get_state (app) == GS_APP_STATE_AVAILABLE);
                break;
+       case GS_MAIN_MODE_APPLICATION:
+               break;
        default:
                g_assert_not_reached ();
        }
@@ -1128,9 +1173,11 @@ gs_main_setup_featured (GsMainPrivate *priv)
        GError *error = NULL;
        GdkPixbuf *pixbuf;
        GtkImage *image;
+        GtkButton *button;
+        GsApp *app;
 
        /* 1 : TODO: generate these automatically */
-       image = GTK_IMAGE (gtk_builder_get_object (priv->builder, "image_featured1"));
+       image = GTK_IMAGE (gtk_builder_get_object (priv->builder, "featured_image"));
        pixbuf = gdk_pixbuf_new_from_file_at_scale (DATADIR "/gnome-software/featured-firefox.png", -1, -1, 
TRUE, &error);
        if (pixbuf == NULL) {
                g_warning ("failed to load featured tile: %s", error->message);
@@ -1140,27 +1187,12 @@ gs_main_setup_featured (GsMainPrivate *priv)
        gtk_image_set_from_pixbuf (image, pixbuf);
        g_object_unref (pixbuf);
 
-       /* 2 */
-       image = GTK_IMAGE (gtk_builder_get_object (priv->builder, "image_featured2"));
-       pixbuf = gdk_pixbuf_new_from_file_at_scale (DATADIR "/gnome-software/featured-gimp.png", -1, -1, 
TRUE, &error);
-       if (pixbuf == NULL) {
-               g_warning ("failed to load featured tile: %s", error->message);
-               g_error_free (error);
-               goto out;
-       }
-       gtk_image_set_from_pixbuf (image, pixbuf);
-       g_object_unref (pixbuf);
+        button = GTK_WIDGET (gtk_builder_get_object (priv->builder, "featured_button"));
+        app = gs_app_new ("firefox");
+        g_object_set_data_full (G_OBJECT (button), "app", app, g_object_unref);
+        g_signal_connect (button, "clicked",
+                          G_CALLBACK (app_tile_clicked), priv);
 
-       /* 3 */
-       image = GTK_IMAGE (gtk_builder_get_object (priv->builder, "image_featured3"));
-       pixbuf = gdk_pixbuf_new_from_file_at_scale (DATADIR "/gnome-software/featured-xchat.png", -1, -1, 
TRUE, &error);
-       if (pixbuf == NULL) {
-               g_warning ("failed to load featured tile: %s", error->message);
-               g_error_free (error);
-               goto out;
-       }
-       gtk_image_set_from_pixbuf (image, pixbuf);
-       g_object_unref (pixbuf);
 out:
        return;
 }
diff --git a/src/gtk-style.css b/src/gtk-style.css
index 7321709..bd27ecd 100644
--- a/src/gtk-style.css
+++ b/src/gtk-style.css
@@ -33,7 +33,7 @@ GtkEventBox.gradient_box_software {
 .index-title-alignment-software > GtkLabel {
        font-weight: bold;
        color: #555753;
-       font-size: 14;
+       font-size: 14px;
 }
 
 
@@ -42,3 +42,58 @@ GtkNotebook.main-notebook-software > GtkScrolledWindow {
        border-left-width: 0px;
        border-right-width: 0px;
 }
+
+ define-color destructive_action_button_a #e03d3d;
+ define-color destructive_action_button_b #ef2929;
+ define-color destructive_action_button_border #9d4242;
+ define-color destructive_action_button_fg @theme_base_color;
+ define-color destructive_action_button_shadow shade(@destructive_action_button_border, 1.15);
+
+.destructive-action.button {
+    background-image: linear-gradient(to bottom,
+                                      @destructive_action_button_a,
+                                      @destructive_action_button_b);
+    border-image: none;
+    border-color: @destructive_action_button_border;
+    border-width: 1px;
+
+    color: @destructive_action_button_fg;
+}
+
+.destructive-action.button:hover {
+    background-image: linear-gradient(to bottom,
+                                      shade(@destructive_action_button_a, 1.10),
+                                      shade(@destructive_action_button_b, 1.05));
+}
+
+.destructive-action.button:active,
+.destructive-action.button:hover:active {
+    background-image: linear-gradient(to bottom,
+                                      @destructive_action_button_b,
+                                      @destructive_action_button_a);
+
+    color: @destructive_action_button_fg;
+}
+
+.destructive-action.button:backdrop {
+    background-image: none;
+    border-image: none;
+    border-color: @unfocused_borders;
+}
+
+.destructive-action.button {
+    text-shadow: 0 1px @destructive_action_button_shadow;
+    icon-shadow: 0 1px @destructive_action_button_shadow;
+}
+
+.destructive-action.button:active,
+.destructive-action.button:hover:active {
+    text-shadow: 0 1px shade(@destructive_action_button_shadow, 1.15);
+    icon-shadow: 0 1px shade(@destructive_action_button_shadow, 1.15);
+}
+
+.destructive-action.button:backdrop {
+    text-shadow: none;
+    icon-shadow: none;
+}
+
diff --git a/src/plugins/gs-plugin-hardcoded-popular.c b/src/plugins/gs-plugin-hardcoded-popular.c
index 3037156..e94f058 100644
--- a/src/plugins/gs-plugin-hardcoded-popular.c
+++ b/src/plugins/gs-plugin-hardcoded-popular.c
@@ -64,6 +64,10 @@ gs_plugin_add_popular (GsPlugin *plugin,
        /* just add each one */
        for (i = 0; apps[i] != NULL; i++) {
                app = gs_app_new (apps[i]);
+                if ((i % 2) == 0)
+                        gs_app_set_state (app, GS_APP_STATE_INSTALLED);
+                else
+                        gs_app_set_state (app, GS_APP_STATE_AVAILABLE);
                gs_plugin_add_app (list, app);
        }
        return TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]