[Xfce4-commits] [xfce/xfce4-power-manager] 01/01: panel-plugin: Handle out-of-bounds values of show-panel-label in config dialog
noreply at xfce.org
noreply at xfce.org
Sun Oct 29 23:32:34 CET 2017
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfce4-power-manager.
commit 469cc1e9aaf7cd3f74e57db578b63036d4e9ea8c
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Sun Oct 29 23:32:26 2017 +0100
panel-plugin: Handle out-of-bounds values of show-panel-label in config dialog
---
.../power-manager-plugin/xfce/xfce-power-manager-plugin.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/panel-plugins/power-manager-plugin/xfce/xfce-power-manager-plugin.c b/panel-plugins/power-manager-plugin/xfce/xfce-power-manager-plugin.c
index 28159fb..2c3f8d2 100644
--- a/panel-plugins/power-manager-plugin/xfce/xfce-power-manager-plugin.c
+++ b/panel-plugins/power-manager-plugin/xfce/xfce-power-manager-plugin.c
@@ -85,7 +85,7 @@ power_manager_plugin_configure_response (GtkWidget *dialog,
}
}
-/* Update xfconf property if combobox selection is changed */
+/* Update combo if property in channel changes */
static void
power_manager_plugin_panel_label_changed (XfconfChannel *channel,
const gchar *property,
@@ -99,6 +99,10 @@ power_manager_plugin_panel_label_changed (XfconfChannel *channel,
list_store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combo)));
current_setting = g_value_get_int (value);
+ /* If the value set in xfconf is invalid, treat it like 0 aka "None" */
+ if (current_setting < 0 ||
+ current_setting > 3)
+ current_setting = 0;
for (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list_store), &iter);
gtk_list_store_iter_is_valid (list_store, &iter);
@@ -111,7 +115,7 @@ power_manager_plugin_panel_label_changed (XfconfChannel *channel,
}
}
-/* Update combo if property in channel changes */
+/* Update xfconf property if combobox selection is changed */
static void
power_manager_plugin_combo_changed (GtkComboBox *combo,
gpointer user_data)
@@ -121,13 +125,13 @@ power_manager_plugin_combo_changed (GtkComboBox *combo,
GtkTreeIter iter;
int show_panel_label;
- if(!gtk_combo_box_get_active_iter(combo, &iter))
+ if (!gtk_combo_box_get_active_iter (combo, &iter))
return;
model = gtk_combo_box_get_model (combo);
gtk_tree_model_get (model, &iter, 0, &show_panel_label, -1);
- xfconf_channel_set_int(channel, PROPERTIES_PREFIX SHOW_PANEL_LABEL, show_panel_label);
+ xfconf_channel_set_int (channel, PROPERTIES_PREFIX SHOW_PANEL_LABEL, show_panel_label);
}
void
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list