[sysprof] menu-button: improve error reporting on argv command line
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] menu-button: improve error reporting on argv command line
- Date: Sun, 17 Apr 2016 00:40:15 +0000 (UTC)
commit 4fdd7aca71b1069b0b7cae9c8a0203bf0518036d
Author: Christian Hergert <christian hergert me>
Date: Sat Apr 16 17:40:07 2016 -0700
menu-button: improve error reporting on argv command line
lib/resources/ui/sp-profiler-menu-button.ui | 1 +
lib/sp-profiler-menu-button.c | 21 +++++++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/lib/resources/ui/sp-profiler-menu-button.ui b/lib/resources/ui/sp-profiler-menu-button.ui
index bbb8d36..38a1537 100644
--- a/lib/resources/ui/sp-profiler-menu-button.ui
+++ b/lib/resources/ui/sp-profiler-menu-button.ui
@@ -128,6 +128,7 @@
</child>
<child>
<object class="GtkEntry" id="spawn_entry">
+ <property name="secondary-icon-activatable">false</property>
<property name="visible">true</property>
</object>
</child>
diff --git a/lib/sp-profiler-menu-button.c b/lib/sp-profiler-menu-button.c
index a91b8cd..b7971cc 100644
--- a/lib/sp-profiler-menu-button.c
+++ b/lib/sp-profiler-menu-button.c
@@ -779,7 +779,7 @@ sp_profiler_menu_button_validate_spawn (SpProfilerMenuButton *self,
{
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
g_auto(GStrv) argv = NULL;
- const gchar *icon_name = NULL;
+ g_autoptr(GError) error = NULL;
const gchar *text;
gint argc;
@@ -788,17 +788,22 @@ sp_profiler_menu_button_validate_spawn (SpProfilerMenuButton *self,
text = gtk_entry_get_text (entry);
- if (!g_shell_parse_argv (text, &argc, &argv, NULL))
+ if (text && *text && !g_shell_parse_argv (text, &argc, &argv, &error))
{
- icon_name = "dialog-warning-symbolic";
sp_profiler_set_spawn_argv (priv->profiler, NULL);
+ g_object_set (entry,
+ "secondary-icon-name", "dialog-warning-symbolic",
+ "secondary-icon-tooltip-text", _("The command line arguments provided are invalid"),
+ NULL);
}
else
- sp_profiler_set_spawn_argv (priv->profiler, (const gchar * const *)argv);
-
- gtk_entry_set_icon_from_icon_name (entry,
- GTK_ENTRY_ICON_SECONDARY,
- icon_name);
+ {
+ sp_profiler_set_spawn_argv (priv->profiler, (const gchar * const *)argv);
+ g_object_set (entry,
+ "secondary-icon-name", NULL,
+ "secondary-icon-tooltip-text", NULL,
+ NULL);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]