[gnome-control-center] shell: Add --search command-line option
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] shell: Add --search command-line option
- Date: Tue, 8 Jan 2013 08:50:05 +0000 (UTC)
commit 502569cc895b151944715546a046a35b13ac19ce
Author: Bastien Nocera <hadess hadess net>
Date: Mon Jan 7 18:10:48 2013 +0100
shell: Add --search command-line option
To set a particular search option in the search entry.
man/gnome-control-center.xml | 6 ++++++
shell/control-center.c | 8 +++++++-
shell/gnome-control-center.c | 9 +++++++++
shell/gnome-control-center.h | 3 +++
4 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/man/gnome-control-center.xml b/man/gnome-control-center.xml
index 07713d8..69ade17 100644
--- a/man/gnome-control-center.xml
+++ b/man/gnome-control-center.xml
@@ -286,6 +286,12 @@
<term><option>-o</option>, <option>--overview</option></term>
<listitem><para>Opens the overview.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-s</option> <replaceable>term</replaceable>, <option>--search</option> <replaceable>term</replaceable></term>
+
+ <listitem><para>Sets the following search term.</para></listitem>
</varlistentry>
</variablelist>
diff --git a/shell/control-center.c b/shell/control-center.c
index 607ccc6..c93a128 100644
--- a/shell/control-center.c
+++ b/shell/control-center.c
@@ -52,6 +52,7 @@ option_version_cb (const gchar *option_name,
}
static char **start_panels = NULL;
+static char *search_str = NULL;
static gboolean show_overview = FALSE;
static gboolean verbose = FALSE;
static gboolean show_help = FALSE;
@@ -62,6 +63,7 @@ const GOptionEntry all_options[] = {
{ "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_version_cb, NULL, NULL },
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, N_("Enable verbose mode"), NULL },
{ "overview", 'o', 0, G_OPTION_ARG_NONE, &show_overview, N_("Show the overview"), NULL },
+ { "search", 's', 0, G_OPTION_ARG_STRING, &search_str, N_("Search for the string"), "SEARCH" },
{ "help", 'h', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help, N_("Show help options"), NULL },
{ "help-all", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help_all, N_("Show help options"), NULL },
{ "help-gtk", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help_gtk, N_("Show help options"), NULL },
@@ -129,7 +131,11 @@ application_command_line_cb (GApplication *application,
gnome_control_center_show (shell, GTK_APPLICATION (application));
- if (show_overview)
+ if (search_str)
+ {
+ gnome_control_center_set_search_item (shell, search_str);
+ }
+ else if (show_overview)
{
gnome_control_center_set_overview_page (shell);
}
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
index e69215d..b71f156 100644
--- a/shell/gnome-control-center.c
+++ b/shell/gnome-control-center.c
@@ -274,6 +274,15 @@ gnome_control_center_set_overview_page (GnomeControlCenter *center)
shell_show_overview_page (center);
}
+void
+gnome_control_center_set_search_item (GnomeControlCenter *center,
+ const char *search)
+{
+ shell_show_overview_page (center);
+ gtk_entry_set_text (GTK_ENTRY (center->priv->search_entry), search);
+ gtk_editable_set_position (GTK_EDITABLE (center->priv->search_entry), -1);
+}
+
static void
item_activated_cb (CcShellCategoryView *view,
gchar *name,
diff --git a/shell/gnome-control-center.h b/shell/gnome-control-center.h
index 30b3fb7..c3e1e23 100644
--- a/shell/gnome-control-center.h
+++ b/shell/gnome-control-center.h
@@ -74,6 +74,9 @@ void gnome_control_center_show (GnomeControlCenter *center, GtkApplication *app)
void gnome_control_center_set_overview_page (GnomeControlCenter *center);
+void gnome_control_center_set_search_item (GnomeControlCenter *center,
+ const char *search);
+
G_END_DECLS
#endif /* _GNOME_CONTROL_CENTER_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]