[gnome-software] Allow moderating unknown applications



commit 0779986145658edcb5fcf47073385055fa0b1c63
Author: Richard Hughes <richard hughsie com>
Date:   Tue Feb 23 20:44:29 2016 +0000

    Allow moderating unknown applications

 src/gs-shell-moderate.c                 |   14 ++++++++++++++
 src/plugins/gs-plugin-xdg-app-reviews.c |   19 ++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-shell-moderate.c b/src/gs-shell-moderate.c
index b92e4af..4925d93 100644
--- a/src/gs-shell-moderate.c
+++ b/src/gs-shell-moderate.c
@@ -84,6 +84,17 @@ gs_shell_moderate_review_clicked_cb (GsReviewRow *row,
        gtk_widget_set_visible (GTK_WIDGET (row), FALSE);
 }
 
+
+static void
+gs_shell_moderate_selection_changed_cb (GtkListBox *listbox,
+                                       GsAppRow *app_row,
+                                       GsShellModerate *self)
+{
+       g_autofree gchar *tmp = NULL;
+       tmp = gs_app_to_string (gs_app_row_get_app (app_row));
+       g_print ("%s", tmp);
+}
+
 static void
 gs_shell_moderate_add_app (GsShellModerate *self, GsApp *app)
 {
@@ -302,6 +313,9 @@ gs_shell_moderate_init (GsShellModerate *self)
 {
        gtk_widget_init_template (GTK_WIDGET (self));
 
+       g_signal_connect (self->list_box_install, "row-activated",
+                         G_CALLBACK (gs_shell_moderate_selection_changed_cb), self);
+
        self->sizegroup_image = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
        self->sizegroup_name = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 }
diff --git a/src/plugins/gs-plugin-xdg-app-reviews.c b/src/plugins/gs-plugin-xdg-app-reviews.c
index 568492c..7d57c57 100644
--- a/src/plugins/gs-plugin-xdg-app-reviews.c
+++ b/src/plugins/gs-plugin-xdg-app-reviews.c
@@ -957,6 +957,23 @@ gs_plugin_review_remove (GsPlugin *plugin,
 }
 
 /**
+ * gs_plugin_create_app_dummy:
+ */
+static GsApp *
+gs_plugin_create_app_dummy (const gchar *id)
+{
+       GsApp *app = gs_app_new (id);
+       g_autoptr(GString) str = NULL;
+       str = g_string_new (id);
+       gs_string_replace (str, ".desktop", "");
+       g_string_prepend (str, "No description is available for ");
+       gs_app_set_name (app, GS_APP_QUALITY_LOWEST, "Unknown Application");
+       gs_app_set_summary (app, GS_APP_QUALITY_LOWEST, "Application not found");
+       gs_app_set_description (app, GS_APP_QUALITY_LOWEST, str->str);
+       return app;
+}
+
+/**
  * gs_plugin_add_unvoted_reviews:
  */
 gboolean
@@ -1010,7 +1027,7 @@ gs_plugin_add_unvoted_reviews (GsPlugin *plugin,
                app_id = gs_review_get_metadata_item (review, "app_id");
                if (g_strcmp0 (app_id, app_id_last) != 0) {
                        g_clear_object (&app_current);
-                       app_current = gs_app_new (app_id);
+                       app_current = gs_plugin_create_app_dummy (app_id);
                        gs_plugin_add_app (list, app_current);
                        app_id_last = app_id;
                }


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