static void mex_search_plugin_search_cb (MexSearchPlugin *self) { MexSearchPluginPrivate *priv = self->priv; const gchar *search = mx_entry_get_text (MX_ENTRY (priv->search_entry)); /* don't run a search if the search entry was empty */ if (!search || search[0] == '\0') return; /* Stop the suggestions search */ if (priv->suggest_timeout) { g_source_remove (priv->suggest_timeout); priv->suggest_timeout = 0; } /* Start a new search */ mex_search_plugin_search (self, search); /* Update the history list */ mex_search_plugin_update_history (self, search); /* Present the search model */ mex_model_provider_present_model (MEX_MODEL_PROVIDER (self), priv->search_model); /* Hide the search page, if it was visible */ if (CLUTTER_ACTOR_IS_VISIBLE (priv->search_page)) mex_tool_provider_remove_actor (MEX_TOOL_PROVIDER (self), priv->search_page); /* TODO: Maybe use weak references to stop the search if the application * didn't use it? */ }
static void mex_search_plugin_search_cb (MexSearchPlugin *self) { MexModelInfo *info; MexSearchPluginPrivate *priv = self->priv; const gchar *search = mx_entry_get_text (MX_ENTRY (priv->search_entry)); /* Stop the suggestions search */ if (priv->suggest_timeout) { g_source_remove (priv->suggest_timeout); priv->suggest_timeout = 0; } /* Start a new search */ mex_search_plugin_search (self, search); /* Update the history list */ mex_search_plugin_update_history (self, search); /* Present the search model */ info = mex_model_info_new_with_sort_funcs (priv->search_model, "search-results", 0); mex_model_provider_present_model (MEX_MODEL_PROVIDER (self), info); mex_model_info_free (info); /* Hide the search page, if it was visible */ if (CLUTTER_ACTOR_IS_VISIBLE (priv->search_page)) mex_tool_provider_remove_actor (MEX_TOOL_PROVIDER (self), priv->search_page); /* TODO: Maybe use weak references to stop the search if the application * didn't use it? */ }