mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
menu-button: improve error reporting on argv command line
This commit is contained in:
@ -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>
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user