aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Terry <mike@mterry.name>2011-02-22 13:58:50 -0500
committerMichael Terry <mike@mterry.name>2011-02-22 13:58:50 -0500
commit07c5056f4604b4294f42492e27ea3fcf85019dc3 (patch)
treee5a14420212c2bca72cb7a728ca8dc5be22244b2 /src
parent74cf8fa3465f955fc01fd3ac9b826079b0f5cdb6 (diff)
downloadayatana-indicator-datetime-07c5056f4604b4294f42492e27ea3fcf85019dc3.tar.gz
ayatana-indicator-datetime-07c5056f4604b4294f42492e27ea3fcf85019dc3.tar.bz2
ayatana-indicator-datetime-07c5056f4604b4294f42492e27ea3fcf85019dc3.zip
make remove button insensitive if nothing selected
Diffstat (limited to 'src')
-rw-r--r--src/datetime-prefs-locations.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/datetime-prefs-locations.c b/src/datetime-prefs-locations.c
index 90b6f97..7df41e7 100644
--- a/src/datetime-prefs-locations.c
+++ b/src/datetime-prefs-locations.c
@@ -130,6 +130,13 @@ save_to_settings (GtkWidget * dlg, GObject * store)
g_variant_unref (locations);
}
+static void
+selection_changed (GtkTreeSelection * selection, GtkWidget * remove_button)
+{
+ gint count = gtk_tree_selection_count_selected_rows (selection);
+ gtk_widget_set_sensitive (remove_button, count > 0);
+}
+
GtkWidget *
datetime_setup_locations_dialog (GtkWindow * parent)
{
@@ -164,7 +171,11 @@ datetime_setup_locations_dialog (GtkWindow * parent)
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1,
_("Time"), cell,
"text", 1, NULL);
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree)), GTK_SELECTION_MULTIPLE);
+
+ GtkTreeSelection * selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
+ g_signal_connect (selection, "changed", G_CALLBACK (selection_changed), WIG ("removeButton"));
+ selection_changed (selection, WIG ("removeButton"));
g_signal_connect (WIG ("addButton"), "clicked", G_CALLBACK (handle_add), tree);
g_signal_connect (WIG ("removeButton"), "clicked", G_CALLBACK (handle_remove), tree);