[gnome-software] Add 4 different infobars to show for local package types



commit fb959bd317adfebcb3118bbf2a497382322ce541
Author: Richard Hughes <richard hughsie com>
Date:   Fri Feb 7 21:24:13 2014 +0100

    Add 4 different infobars to show for local package types
    
    For instance, we will soon show a warning when adding a repo, although this
    is currently blocked on GetFilesLocal() and rh#1062703.

 src/gnome-software.ui  |  258 +++++++++++++++++++++++++++++++++++++++++++++++-
 src/gs-app.c           |    2 +
 src/gs-app.h           |    1 +
 src/gs-shell-details.c |   58 +++++++++++
 4 files changed, 316 insertions(+), 3 deletions(-)
---
diff --git a/src/gnome-software.ui b/src/gnome-software.ui
index 94138e7..9c2d6b5 100644
--- a/src/gnome-software.ui
+++ b/src/gnome-software.ui
@@ -1313,6 +1313,258 @@
                                 <property name="position">2</property>
                               </packing>
                             </child>
+
+
+                            <child>
+                              <object class="GtkInfoBar" id="infobar_details_app_repo">
+                                <property name="visible">True</property>
+                                <property name="app_paintable">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="message_type">info</property>
+                                <property name="margin_top">20</property>
+                                <child internal-child="content_area">
+                                  <object class="GtkBox" id="infobar-content_area1">
+                                    <property name="can_focus">False</property>
+                                    <property name="spacing">16</property>
+                                    <child>
+                                      <object class="GtkGrid" id="grid_details_app_repo">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="row_spacing">6</property>
+                                        <child>
+                                          <object class="GtkLabel" id="label_header_details_app_repo">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label" translatable="yes">Software Source 
Detected</property>
+                                            <attributes>
+                                              <attribute name="weight" value="bold"/>
+                                            </attributes>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">0</property>
+                                            <property name="top_attach">0</property>
+                                            <property name="width">1</property>
+                                            <property name="height">1</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label_details_app_repo">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label" translatable="yes">This application 
includes a software source which provides updates, as well as access to other software.</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">0</property>
+                                            <property name="top_attach">1</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">0</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">3</property>
+                              </packing>
+                            </child>
+
+                            <child>
+                              <object class="GtkInfoBar" id="infobar_details_app_norepo">
+                                <property name="visible">True</property>
+                                <property name="app_paintable">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="message_type">info</property>
+                                <property name="margin_top">20</property>
+                                <child internal-child="content_area">
+                                  <object class="GtkBox" id="infobar-content_area2">
+                                    <property name="can_focus">False</property>
+                                    <property name="spacing">16</property>
+                                    <child>
+                                      <object class="GtkGrid" id="grid_details_app_norepo">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="row_spacing">6</property>
+                                        <child>
+                                          <object class="GtkLabel" id="label_header_details_app_norepo">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label" translatable="yes">No Update Source 
Detected</property>
+                                            <attributes>
+                                              <attribute name="weight" value="bold"/>
+                                            </attributes>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">0</property>
+                                            <property name="top_attach">0</property>
+                                            <property name="width">1</property>
+                                            <property name="height">1</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label_details_app_norepo">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label" translatable="yes">This application does 
not include a software source. It will not be updated with new versions.</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">0</property>
+                                            <property name="top_attach">1</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">0</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">4</property>
+                              </packing>
+                            </child>
+
+                            <child>
+                              <object class="GtkInfoBar" id="infobar_details_package_baseos">
+                                <property name="visible">True</property>
+                                <property name="app_paintable">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="message_type">warning</property>
+                                <property name="margin_top">20</property>
+                                <child internal-child="content_area">
+                                  <object class="GtkBox" id="infobar-content_area3">
+                                    <property name="can_focus">False</property>
+                                    <property name="spacing">16</property>
+                                    <child>
+                                      <object class="GtkLabel" id="label_header_details_package_baseos">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes">This software is already 
provided by your distribution and should not be replaced.</property>
+                                        <attributes>
+                                          <attribute name="weight" value="bold"/>
+                                        </attributes>
+                                      </object>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">5</property>
+                              </packing>
+                            </child>
+
+                            <child>
+                              <object class="GtkInfoBar" id="infobar_details_repo">
+                                <property name="visible">True</property>
+                                <property name="app_paintable">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="message_type">warning</property>
+                                <property name="margin_top">20</property>
+                                <child internal-child="content_area">
+                                  <object class="GtkBox" id="infobar-content_area4">
+                                    <property name="can_focus">False</property>
+                                    <property name="spacing">16</property>
+                                    <child>
+                                      <object class="GtkGrid" id="grid_details_repo">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="row_spacing">6</property>
+                                        <child>
+                                          <object class="GtkLabel" id="label_header_details_repo">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label" translatable="yes">Software Source 
Identified</property>
+                                            <attributes>
+                                              <attribute name="weight" value="bold"/>
+                                            </attributes>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">0</property>
+                                            <property name="top_attach">0</property>
+                                            <property name="width">1</property>
+                                            <property name="height">1</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label_details_repo">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label" translatable="yes">Adding this software 
source will give you access to additional software and upgrades.</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">0</property>
+                                            <property name="top_attach">1</property>
+                                            <property name="width">1</property>
+                                            <property name="height">1</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkLabel" id="label_details_repo2">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label" translatable="yes">Only use software 
sources that you trust.</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">0</property>
+                                            <property name="top_attach">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">0</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">6</property>
+                              </packing>
+                            </child>
+
                             <child>
                               <object class="GtkBox" id="box_details_support">
                                 <property name="visible">True</property>
@@ -1369,7 +1621,7 @@
                               <packing>
                                 <property name="expand">False</property>
                                 <property name="fill">False</property>
-                                <property name="position">3</property>
+                                <property name="position">7</property>
                               </packing>
                             </child>
                             <child>
@@ -1390,7 +1642,7 @@
                               <packing>
                                 <property name="expand">False</property>
                                 <property name="fill">True</property>
-                                <property name="position">4</property>
+                                <property name="position">8</property>
                               </packing>
                             </child>
                             <child>
@@ -1621,7 +1873,7 @@
                               <packing>
                                 <property name="expand">False</property>
                                 <property name="fill">True</property>
-                                <property name="position">5</property>
+                                <property name="position">9</property>
                               </packing>
                             </child>
                           </object>
diff --git a/src/gs-app.c b/src/gs-app.c
index 0ceb98f..ec8c626 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -142,6 +142,8 @@ gs_app_kind_to_string (GsAppKind kind)
                return "os-update";
        if (kind == GS_APP_KIND_MISSING)
                return "missing";
+       if (kind == GS_APP_KIND_SOURCE)
+               return "source";
        return NULL;
 }
 
diff --git a/src/gs-app.h b/src/gs-app.h
index 473647b..bcd7bda 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -62,6 +62,7 @@ typedef enum {
        GS_APP_KIND_PACKAGE,    /* can be updated, but not installed or removed */
        GS_APP_KIND_OS_UPDATE,  /* can be updated, but not installed or removed */
        GS_APP_KIND_MISSING,    /* you can't do anything to this */
+       GS_APP_KIND_SOURCE,     /* can be installed, but not updated or removed */
        GS_APP_KIND_LAST
 } GsAppKind;
 
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index c827b44..97c62a8 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -692,6 +692,64 @@ gs_shell_details_refresh_all (GsShellDetails *shell_details)
                gtk_widget_set_visible (widget, TRUE);
                break;
        }
+
+       /* are we trying to replace something in the baseos */
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "infobar_details_package_baseos"));
+       switch (gs_app_get_kind (priv->app)) {
+       case GS_APP_KIND_OS_UPDATE:
+               gtk_widget_set_visible (widget, TRUE);
+               break;
+       default:
+               gtk_widget_set_visible (widget, FALSE);
+               break;
+       }
+
+       /* is this a repo-release */
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "infobar_details_repo"));
+       switch (gs_app_get_kind (priv->app)) {
+       case GS_APP_KIND_SOURCE:
+               gtk_widget_set_visible (widget, gs_app_get_state (priv->app) == GS_APP_STATE_LOCAL);
+               break;
+       default:
+               gtk_widget_set_visible (widget, FALSE);
+               break;
+       }
+
+       /* an application */
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "infobar_details_repo"));
+       switch (gs_app_get_kind (priv->app)) {
+       case GS_APP_KIND_SOURCE:
+               gtk_widget_set_visible (widget, gs_app_get_state (priv->app) == GS_APP_STATE_LOCAL);
+               break;
+       default:
+               gtk_widget_set_visible (widget, FALSE);
+               break;
+       }
+
+       /* installing a app with a repo file */
+       tmp = gs_app_get_metadata_item (priv->app, "PackageKit::has-source");
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "infobar_details_app_repo"));
+       switch (gs_app_get_kind (priv->app)) {
+       case GS_APP_KIND_NORMAL:
+       case GS_APP_KIND_SYSTEM:
+               gtk_widget_set_visible (widget, tmp != NULL && gs_app_get_state (priv->app) == 
GS_APP_STATE_LOCAL);
+               break;
+       default:
+               gtk_widget_set_visible (widget, FALSE);
+               break;
+       }
+
+       /* installing a app without a repo file */
+       widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "infobar_details_app_norepo"));
+       switch (gs_app_get_kind (priv->app)) {
+       case GS_APP_KIND_NORMAL:
+       case GS_APP_KIND_SYSTEM:
+               gtk_widget_set_visible (widget, tmp == NULL && gs_app_get_state (priv->app) == 
GS_APP_STATE_LOCAL);
+               break;
+       default:
+               gtk_widget_set_visible (widget, FALSE);
+               break;
+       }
 }
 
 /**


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