[devhelp] App: refactor a little search_cb()



commit 8276636f17eb749bef3488fe5601843c6fe6c76b
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Dec 17 19:28:22 2017 +0100

    App: refactor a little search_cb()

 src/dh-app.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/dh-app.c b/src/dh-app.c
index e8d6b84..b0e406b 100644
--- a/src/dh-app.c
+++ b/src/dh-app.c
@@ -126,18 +126,17 @@ search_cb (GSimpleAction *action,
            gpointer       user_data)
 {
         DhApp *app = DH_APP (user_data);
+        const gchar *keyword;
         GtkWindow *window;
-        const gchar *str;
 
-        window = dh_app_peek_first_window (app);
-        str = g_variant_get_string (parameter, NULL);
-        if (str[0] == '\0') {
-                g_warning ("Cannot search in application window: "
-                           "No keyword given");
+        keyword = g_variant_get_string (parameter, NULL);
+        if (keyword == NULL || keyword[0] == '\0') {
+                g_warning ("Cannot search in application window: no keyword given.");
                 return;
         }
 
-        dh_window_search (DH_WINDOW (window), str);
+        window = dh_app_peek_first_window (app);
+        dh_window_search (DH_WINDOW (window), keyword);
         gtk_window_present (window);
 }
 


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