[gnome-software] GsApplication: Add an action to show a search result



commit 6aeffe29b19d1a96f2f28db7712f834f11ff8a69
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Oct 17 22:44:03 2013 -0400

    GsApplication: Add an action to show a search result
    
    An action is the preferred way to make functionality in
    a GApplication available externally. In the future, this
    action will be made available from the commandline in
    the launcher.

 src/gs-application.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 78538ab..ebda4ba 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -240,11 +240,34 @@ search_activated (GSimpleAction *action,
        gs_shell_show_search (app->shell, search);
 }
 
+static void
+details_activated (GSimpleAction *action,
+                  GVariant      *parameter,
+                  gpointer       data)
+{
+       GsApplication *app = GS_APPLICATION (data);
+       GList *windows;
+       GtkWindow *window = NULL;
+       const gchar *id;
+       const gchar *search;
+
+       windows = gtk_application_get_windows (GTK_APPLICATION (app));
+       if (windows) {
+               window = windows->data;
+               gtk_window_present (window);
+       }
+       gs_application_initialize_ui (app);
+
+       g_variant_get (parameter, "(&s&s)", &id, &search);
+       gs_shell_show_search_result (app->shell, id, search);
+}
+
 static GActionEntry actions[] = {
        { "about", about_activated, NULL, NULL, NULL },
        { "quit", quit_activated, NULL, NULL, NULL },
        { "set-mode", set_mode_activated, "s", NULL, NULL },
-       { "search", search_activated, "s", NULL, NULL }
+       { "search", search_activated, "s", NULL, NULL },
+       { "details", details_activated, "(ss)", NULL, NULL }
 };
 
 static void


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