[gnome-software] Fix assert when trying to show details of an upgradable package



commit 349600b1afb2e38d206895d966f8e9f57cfc9063
Author: Richard Hughes <richard hughsie com>
Date:   Fri Sep 6 13:35:38 2013 +0100

    Fix assert when trying to show details of an upgradable package

 src/gs-app.c           |    4 ++--
 src/gs-app.h           |    2 ++
 src/gs-shell-details.c |    6 ++++++
 3 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 2c3d205..ac245e8 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -89,7 +89,7 @@ gs_app_error_quark (void)
 /**
  * gs_app_kind_to_string:
  **/
-static const gchar *
+const gchar *
 gs_app_kind_to_string (GsAppKind kind)
 {
        if (kind == GS_APP_KIND_UNKNOWN)
@@ -108,7 +108,7 @@ gs_app_kind_to_string (GsAppKind kind)
 /**
  * gs_app_state_to_string:
  **/
-static const gchar *
+const gchar *
 gs_app_state_to_string (GsAppState state)
 {
        if (state == GS_APP_STATE_UNKNOWN)
diff --git a/src/gs-app.h b/src/gs-app.h
index 82c8fc5..1b76cd7 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -78,6 +78,8 @@ GType          gs_app_get_type                (void);
 
 GsApp          *gs_app_new                     (const gchar    *id);
 gchar          *gs_app_to_string               (GsApp          *app);
+const gchar    *gs_app_kind_to_string          (GsAppKind       kind);
+const gchar    *gs_app_state_to_string         (GsAppState      state);
 
 const gchar    *gs_app_get_id                  (GsApp          *app);
 void            gs_app_set_id                  (GsApp          *app,
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 892df86..0d4c469 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -92,9 +92,12 @@ gs_shell_details_refresh (GsShellDetails *shell_details)
                break;
        case GS_APP_STATE_INSTALLED:
        case GS_APP_STATE_REMOVING:
+       case GS_APP_STATE_UPDATABLE:
                gtk_widget_set_visible (widget, FALSE);
                break;
        default:
+               g_warning ("App unexpectedly in state %s",
+                          gs_app_state_to_string (state));
                g_assert_not_reached ();
        }
 
@@ -116,11 +119,14 @@ gs_shell_details_refresh (GsShellDetails *shell_details)
                         gtk_style_context_remove_class (gtk_widget_get_style_context (widget), 
"destructive-action");
                        gtk_button_set_label (GTK_BUTTON (widget), _("Removing"));
                        break;
+               case GS_APP_STATE_UPDATABLE:
                case GS_APP_STATE_AVAILABLE:
                case GS_APP_STATE_INSTALLING:
                        gtk_widget_set_visible (widget, FALSE);
                        break;
                default:
+                       g_warning ("App unexpectedly in state %s",
+                                  gs_app_state_to_string (state));
                        g_assert_not_reached ();
                }
        }


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