diff options
author | Michael Catanzaro <mcatanzaro@igalia.com> | 2016-03-21 23:13:34 -0500 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@igalia.com> | 2016-03-21 23:55:15 -0500 |
commit | c5d5bd28f071b3734b0f07af7e802f902263d6f0 (patch) | |
tree | 32a2bf0127ac7732e4afa4dd65da6c81b17585ee /src/ephy-search-provider.c | |
parent | 17c9805c3b7901d17666c71a2163de980eb5c774 (diff) | |
download | epiphany-uncrustify.tar.gz |
Uncrustifyuncrustify
For a better future. Apologies when your 'git blame' resolves to this.
I'm actually really impressed how well uncrustify works. This required
only a little one-time manual work to avoid extra space in 'else {'.
This breaks function prototype alignment, but we should get rid of most
of those anyway.
We decided to start aligning function parameters, like other GNOME
applications. It looks nicer this way, and I couldn't teach uncrustify
the previous Epiphany style.
Diffstat (limited to 'src/ephy-search-provider.c')
-rw-r--r-- | src/ephy-search-provider.c | 179 |
1 files changed, 88 insertions, 91 deletions
diff --git a/src/ephy-search-provider.c b/src/ephy-search-provider.c index 3db9817be..e1231dc8a 100644 --- a/src/ephy-search-provider.c +++ b/src/ephy-search-provider.c @@ -30,8 +30,7 @@ #include <gio/gdesktopappinfo.h> #include <libsoup/soup.h> -struct _EphySearchProvider -{ +struct _EphySearchProvider { GApplication parent_instance; EphyShellSearchProvider2 *skeleton; @@ -43,8 +42,7 @@ struct _EphySearchProvider EphyCompletionModel *model; }; -struct _EphySearchProviderClass -{ +struct _EphySearchProviderClass { GApplicationClass parent_class; }; @@ -54,9 +52,9 @@ G_DEFINE_TYPE (EphySearchProvider, ephy_search_provider, G_TYPE_APPLICATION) static void on_model_updated (EphyHistoryService *service, - gboolean success, - gpointer result_data, - gpointer user_data) + gboolean success, + gpointer result_data, + gpointer user_data) { GTask *task = user_data; EphySearchProvider *self = g_task_get_source_object (task); @@ -84,7 +82,7 @@ on_model_updated (EphyHistoryService *service, g_task_return_pointer (task, g_ptr_array_free (results, FALSE), - (GDestroyNotify) g_strfreev); + (GDestroyNotify)g_strfreev); } static char ** @@ -96,11 +94,11 @@ gather_results_finish (EphySearchProvider *self, } static void -gather_results_async (EphySearchProvider *self, - char **terms, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +gather_results_async (EphySearchProvider *self, + char **terms, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { GTask *task; char *search_string; @@ -139,10 +137,10 @@ complete_request (GObject *object, } static gboolean -handle_get_initial_result_set (EphyShellSearchProvider2 *skeleton, - GDBusMethodInvocation *invocation, - char **terms, - EphySearchProvider *self) +handle_get_initial_result_set (EphyShellSearchProvider2 *skeleton, + GDBusMethodInvocation *invocation, + char **terms, + EphySearchProvider *self) { g_application_hold (G_APPLICATION (self)); g_cancellable_reset (self->cancellable); @@ -154,11 +152,11 @@ handle_get_initial_result_set (EphyShellSearchProvider2 *skeleton, } static gboolean -handle_get_subsearch_result_set (EphyShellSearchProvider2 *skeleton, - GDBusMethodInvocation *invocation, - char **previous_results, - char **terms, - EphySearchProvider *self) +handle_get_subsearch_result_set (EphyShellSearchProvider2 *skeleton, + GDBusMethodInvocation *invocation, + char **previous_results, + char **terms, + EphySearchProvider *self) { g_application_hold (G_APPLICATION (self)); g_cancellable_reset (self->cancellable); @@ -170,10 +168,10 @@ handle_get_subsearch_result_set (EphyShellSearchProvider2 *skeleton, } static gboolean -handle_get_result_metas (EphyShellSearchProvider2 *skeleton, - GDBusMethodInvocation *invocation, - char **results, - EphySearchProvider *self) +handle_get_result_metas (EphyShellSearchProvider2 *skeleton, + GDBusMethodInvocation *invocation, + char **results, + EphySearchProvider *self) { GtkTreeModel *model = GTK_TREE_MODEL (self->model); GtkTreeIter iter; @@ -188,68 +186,67 @@ handle_get_result_metas (EphyShellSearchProvider2 *skeleton, g_variant_builder_init (&builder, G_VARIANT_TYPE ("aa{sv}")); - for (i = 0; results[i]; i++) - { - if (g_str_has_prefix (results[i], "special:search:")) { - g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}")); - g_variant_builder_add (&builder, "{sv}", - "id", g_variant_new_string ("special:search")); - g_variant_builder_add (&builder, "{sv}", - "name", g_variant_new_take_string (g_strdup_printf(_("Search the Web for %s"), - results[i] + strlen("special:search:")))); - g_variant_builder_add (&builder, "{sv}", - "gicon", g_variant_new_string ("web-browser")); - g_variant_builder_close (&builder); - continue; - } - - if (!gtk_tree_model_get_iter_from_string (model, &iter, results[i])) - continue; - - gtk_tree_model_get (model, &iter, - EPHY_COMPLETION_TEXT_COL, &name, - EPHY_COMPLETION_URL_COL, &url, - EPHY_COMPLETION_FAVICON_COL, &favicon, - EPHY_COMPLETION_EXTRA_COL, &is_bookmark, - -1); - + for (i = 0; results[i]; i++) { + if (g_str_has_prefix (results[i], "special:search:")) { g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_add (&builder, "{sv}", - "id", g_variant_new_string (url)); + "id", g_variant_new_string ("special:search")); + g_variant_builder_add (&builder, "{sv}", + "name", g_variant_new_take_string (g_strdup_printf (_("Search the Web for %s"), + results[i] + strlen ("special:search:")))); g_variant_builder_add (&builder, "{sv}", - "name", g_variant_new_string (name)); + "gicon", g_variant_new_string ("web-browser")); + g_variant_builder_close (&builder); + continue; + } - if (favicon == NULL) { - char *type; + if (!gtk_tree_model_get_iter_from_string (model, &iter, results[i])) + continue; - type = g_content_type_from_mime_type ("text/html"); - favicon = g_content_type_get_icon (type); + gtk_tree_model_get (model, &iter, + EPHY_COMPLETION_TEXT_COL, &name, + EPHY_COMPLETION_URL_COL, &url, + EPHY_COMPLETION_FAVICON_COL, &favicon, + EPHY_COMPLETION_EXTRA_COL, &is_bookmark, + -1); - if (is_bookmark) { - GEmblem *emblem; - GIcon *emblem_icon, *emblemed; + g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}")); + g_variant_builder_add (&builder, "{sv}", + "id", g_variant_new_string (url)); + g_variant_builder_add (&builder, "{sv}", + "name", g_variant_new_string (name)); - emblem_icon = g_themed_icon_new ("emblem-favorite"); - emblem = g_emblem_new (emblem_icon); + if (favicon == NULL) { + char *type; - emblemed = g_emblemed_icon_new (favicon, emblem); + type = g_content_type_from_mime_type ("text/html"); + favicon = g_content_type_get_icon (type); - g_object_unref (emblem); - g_object_unref (emblem_icon); - g_object_unref (favicon); - favicon = emblemed; - } - } + if (is_bookmark) { + GEmblem *emblem; + GIcon *emblem_icon, *emblemed; - g_variant_builder_add (&builder, "{sv}", - "icon", g_icon_serialize (favicon)); - g_variant_builder_close (&builder); + emblem_icon = g_themed_icon_new ("emblem-favorite"); + emblem = g_emblem_new (emblem_icon); + + emblemed = g_emblemed_icon_new (favicon, emblem); - g_object_unref (favicon); - g_free (name); - g_free (url); + g_object_unref (emblem); + g_object_unref (emblem_icon); + g_object_unref (favicon); + favicon = emblemed; + } } + g_variant_builder_add (&builder, "{sv}", + "icon", g_icon_serialize (favicon)); + g_variant_builder_close (&builder); + + g_object_unref (favicon); + g_free (name); + g_free (url); + } + ephy_shell_search_provider2_complete_get_result_metas (skeleton, invocation, g_variant_builder_end (&builder)); @@ -260,8 +257,8 @@ handle_get_result_metas (EphyShellSearchProvider2 *skeleton, } static void -launch_uri (const char *uri, - guint timestamp) +launch_uri (const char *uri, + guint timestamp) { char *str; @@ -272,9 +269,9 @@ launch_uri (const char *uri, } static void -launch_search (EphySearchProvider *self, - char **terms, - guint timestamp) +launch_search (EphySearchProvider *self, + char **terms, + guint timestamp) { char *search_string, *url_search, *query_param, *effective_url; @@ -305,12 +302,12 @@ launch_search (EphySearchProvider *self, } static gboolean -handle_activate_result (EphyShellSearchProvider2 *skeleton, - GDBusMethodInvocation *invocation, - char *identifier, - char **terms, - guint timestamp, - EphySearchProvider *self) +handle_activate_result (EphyShellSearchProvider2 *skeleton, + GDBusMethodInvocation *invocation, + char *identifier, + char **terms, + guint timestamp, + EphySearchProvider *self) { g_application_hold (G_APPLICATION (self)); g_cancellable_cancel (self->cancellable); @@ -327,11 +324,11 @@ handle_activate_result (EphyShellSearchProvider2 *skeleton, } static gboolean -handle_launch_search (EphyShellSearchProvider2 *skeleton, - GDBusMethodInvocation *invocation, - char **terms, - guint timestamp, - EphySearchProvider *self) +handle_launch_search (EphyShellSearchProvider2 *skeleton, + GDBusMethodInvocation *invocation, + char **terms, + guint timestamp, + EphySearchProvider *self) { g_application_hold (G_APPLICATION (self)); g_cancellable_cancel (self->cancellable); |