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>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkEntry" id="spawn_entry">
|
<object class="GtkEntry" id="spawn_entry">
|
||||||
|
<property name="secondary-icon-activatable">false</property>
|
||||||
<property name="visible">true</property>
|
<property name="visible">true</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|||||||
@ -779,7 +779,7 @@ sp_profiler_menu_button_validate_spawn (SpProfilerMenuButton *self,
|
|||||||
{
|
{
|
||||||
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
|
SpProfilerMenuButtonPrivate *priv = sp_profiler_menu_button_get_instance_private (self);
|
||||||
g_auto(GStrv) argv = NULL;
|
g_auto(GStrv) argv = NULL;
|
||||||
const gchar *icon_name = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
const gchar *text;
|
const gchar *text;
|
||||||
gint argc;
|
gint argc;
|
||||||
|
|
||||||
@ -788,17 +788,22 @@ sp_profiler_menu_button_validate_spawn (SpProfilerMenuButton *self,
|
|||||||
|
|
||||||
text = gtk_entry_get_text (entry);
|
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);
|
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
|
else
|
||||||
sp_profiler_set_spawn_argv (priv->profiler, (const gchar * const *)argv);
|
{
|
||||||
|
sp_profiler_set_spawn_argv (priv->profiler, (const gchar * const *)argv);
|
||||||
gtk_entry_set_icon_from_icon_name (entry,
|
g_object_set (entry,
|
||||||
GTK_ENTRY_ICON_SECONDARY,
|
"secondary-icon-name", NULL,
|
||||||
icon_name);
|
"secondary-icon-tooltip-text", NULL,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user