[empathy/gnome-2-34] Calendar widget should be disabled if no contact selected (#645582)



commit 2195753a72fcdcfc0e3a51de67a00fe04a00ecb5
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Thu Mar 24 10:41:14 2011 +0100

    Calendar widget should be disabled if no contact selected (#645582)

 libempathy-gtk/empathy-log-window.c  |    9 +++++++++
 libempathy-gtk/empathy-log-window.ui |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 56b5e0c..8bb92b8 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -774,6 +774,12 @@ static void
 log_window_chats_changed_cb (GtkTreeSelection *selection,
 			     EmpathyLogWindow  *window)
 {
+	gboolean selected;
+
+	/* The calendar has to be sensitive only if there is something selected */
+	selected = log_window_chats_get_selected (window, NULL, NULL);
+	gtk_widget_set_sensitive (window->calendar_chats, selected);
+
 	/* Use last date by default */
 	gtk_calendar_clear_marks (GTK_CALENDAR (window->calendar_chats));
 
@@ -981,6 +987,9 @@ log_window_chats_accounts_changed_cb (GtkWidget       *combobox,
 	empathy_chat_view_clear (window->chatview_chats);
 
 	log_window_chats_populate (window);
+
+	/* No chat is selected as we just changed the account */
+	gtk_widget_set_sensitive (window->calendar_chats, FALSE);
 }
 
 static void
diff --git a/libempathy-gtk/empathy-log-window.ui b/libempathy-gtk/empathy-log-window.ui
index ab06231..499bff9 100644
--- a/libempathy-gtk/empathy-log-window.ui
+++ b/libempathy-gtk/empathy-log-window.ui
@@ -291,6 +291,7 @@
                         <property name="year">2011</property>
                         <property name="month">2</property>
                         <property name="day">15</property>
+                        <property name="sensitive">False</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]