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



commit 7d34d3abf6e4359201d47b4439830273cf4c2b78
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Oct 11 20:53:05 2013 -0400

    GsApplication: Add an action to start a search
    
    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
    via the launcher.

 src/gs-application.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 149b926..78538ab 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -219,10 +219,32 @@ set_mode_activated (GSimpleAction *action,
        }
 }
 
+static void
+search_activated (GSimpleAction *action,
+                 GVariant      *parameter,
+                 gpointer       data)
+{
+       GsApplication *app = GS_APPLICATION (data);
+       const gchar *search;
+       GList *windows;
+       GtkWindow *window = NULL;
+
+       gs_application_initialize_ui (app);
+       windows = gtk_application_get_windows (GTK_APPLICATION (app));
+       if (windows) {
+               window = windows->data;
+               gtk_window_present (window);
+       }
+
+       search = g_variant_get_string (parameter, NULL);
+       gs_shell_show_search (app->shell, search);
+}
+
 static GActionEntry actions[] = {
        { "about", about_activated, NULL, NULL, NULL },
        { "quit", quit_activated, NULL, NULL, NULL },
-       { "set-mode", set_mode_activated, "s", NULL, NULL }
+       { "set-mode", set_mode_activated, "s", NULL, NULL },
+       { "search", search_activated, "s", NULL, NULL }
 };
 
 static void


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