diff --git a/data/interfaces/xfpm-settings.ui b/data/interfaces/xfpm-settings.ui index 216b882a443f3c909943481f74b293b91aefea82..37171afb2e5a08bd265089b408e9ef7a2594587e 100644 --- a/data/interfaces/xfpm-settings.ui +++ b/data/interfaces/xfpm-settings.ui @@ -1176,7 +1176,7 @@ </packing> </child> <child> - <object class="GtkMenuButton"> + <object class="GtkMenuButton" id="critical-warning-button"> <property name="visible">True</property> <property name="can-focus">True</property> <property name="image">image4</property> diff --git a/settings/xfpm-settings.c b/settings/xfpm-settings.c index 9e31b12ab4a444b74e87a646350b00ca26f290d3..47f3207a97f844c93db4985f191e397958f11967 100644 --- a/settings/xfpm-settings.c +++ b/settings/xfpm-settings.c @@ -811,9 +811,7 @@ xfpm_settings_others (XfconfChannel *channel, { GtkTreeIter iter; GtkTreeModel *model; - GtkWidget *label; const gchar *action; - gchar *text; critical_level = GTK_WIDGET (gtk_builder_get_object (xml, "critical-power-level-spin")); gtk_widget_set_tooltip_text (critical_level, _("When all the power sources of the computer reach this charge level")); @@ -835,11 +833,18 @@ xfpm_settings_others (XfconfChannel *channel, break; } while (gtk_tree_model_iter_next (model, &iter)); - label = GTK_WIDGET (gtk_builder_get_object (xml, "critical-warning-label")); action = upower != NULL ? up_client_get_critical_action (upower) : "Unknown"; - text = g_strdup_printf (_("Make sure you set a sufficiently high value here, otherwise the system will trigger its own action before xfce4-power-manager, without being able to prevent it or know exactly when it will do so. The action triggered by the system in this case will be: %s."), action); - gtk_label_set_text (GTK_LABEL (label), text); - g_free (text); + if (g_strcmp0 (action, "Ignore") == 0) + { + gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (xml, "critical-warning-button"))); + } + else + { + GtkWidget *label = GTK_WIDGET (gtk_builder_get_object (xml, "critical-warning-label")); + gchar *text = g_strdup_printf (_("Make sure you set a sufficiently high value here, otherwise the system will trigger its own action before xfce4-power-manager, without being able to prevent it or know exactly when it will do so. The action triggered by the system in this case will be: %s."), action); + gtk_label_set_text (GTK_LABEL (label), text); + g_free (text); + } } else {