From d356dc440b03da31a182bfee7ee6698e4cf8ae1c Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Tue, 23 May 2006 08:24:52 +0000 Subject: More alarm fixes svn path=/trunk/; revision=32015 --- calendar/gui/alarm-notify/alarm-notify-dialog.c | 24 +++++++++++++++++------- calendar/gui/alarm-notify/alarm-queue.c | 7 +++++-- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c index 959f93b4ea..5f3caec00f 100644 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.c +++ b/calendar/gui/alarm-notify/alarm-notify-dialog.c @@ -74,6 +74,7 @@ typedef struct { GtkWidget *dialog; GtkWidget *snooze_time_min; GtkWidget *snooze_time_hrs; + GtkWidget *snooze_btn; GtkWidget *minutes_label; GtkWidget *hrs_label; GtkWidget *description; @@ -140,12 +141,17 @@ dialog_response_cb (GtkDialog *dialog, guint response_id, gpointer user_data) GtkTreeModel *model = NULL; AlarmFuncInfo *funcinfo = NULL; GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (an->treeview)); + + if (gtk_tree_selection_get_selected (selection, &model, &iter)) { + gtk_tree_model_get (model, &iter, ALARM_FUNCINFO_COLUMN, &funcinfo, -1); + } - if (gtk_tree_selection_get_selected (selection, &model, &iter)) - gtk_tree_model_get (model, &iter, ALARM_FUNCINFO_COLUMN, &funcinfo, -1); - + if (!funcinfo) { + GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (an->treeview)); + gboolean valid = gtk_tree_model_get_iter_first (model, &iter); + gtk_tree_model_get (model, &iter, ALARM_FUNCINFO_COLUMN, &funcinfo, -1); + } g_return_if_fail (funcinfo); - switch (response_id) { case GTK_RESPONSE_CLOSE: case GTK_RESPONSE_DELETE_EVENT: @@ -253,6 +259,7 @@ notified_alarms_dialog_new (void) an->treeview = glade_xml_get_widget (an->xml, "appointments-treeview"); an->scrolledwindow = glade_xml_get_widget (an->xml, "treeview-scrolledwindow"); snooze_btn = glade_xml_get_widget (an->xml, "snooze-button"); + an->snooze_btn = snooze_btn; edit_btn = glade_xml_get_widget (an->xml, "edit-button"); if (!(an->dialog && an->scrolledwindow && an->treeview && an->snooze_time_min && an->snooze_time_hrs @@ -396,13 +403,14 @@ tree_selection_changed_cb (GtkTreeSelection *selection, gpointer user_data) { GtkTreeModel *model; GtkTreeIter iter; - + AlarmNotify *an = user_data; + if (gtk_tree_selection_get_selected (selection, &model, &iter)) { - AlarmNotify *an = user_data; gchar *summary, *description, *location; time_t occur_start, occur_end; - + + gtk_widget_set_sensitive (an->snooze_btn, TRUE); gtk_tree_model_get (model, &iter, ALARM_SUMMARY_COLUMN, &summary, -1); gtk_tree_model_get (model, &iter, ALARM_DESCRIPTION_COLUMN, &description, -1); gtk_tree_model_get (model, &iter, ALARM_LOCATION_COLUMN, &location, -1); @@ -411,6 +419,8 @@ tree_selection_changed_cb (GtkTreeSelection *selection, gpointer user_data) gtk_tree_model_get (model, &iter, ALARM_FUNCINFO_COLUMN, &an->cur_funcinfo, -1); fill_in_labels (an, summary, description, location, occur_start, occur_end); + } else { + gtk_widget_set_sensitive (an->snooze_btn, FALSE); } } diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index 9b27990f4b..25745d4fb0 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -192,6 +192,7 @@ static void remove_client_alarms (ClientAlarms *ca); static void update_cqa (CompQueuedAlarms *cqa, ECalComponent *comp); static void update_qa (ECalComponentAlarms *alarms, QueuedAlarm *qa); static void tray_list_remove_cqa (CompQueuedAlarms *cqa); +static void on_dialog_objs_removed_cb (ECal *client, GList *objects, gpointer data); /* Alarm queue engine */ @@ -708,7 +709,7 @@ query_objects_changed_async (EThread *e, AlarmMsg *msg, void *data) if (!found) { d(printf("%s:%d (query_objects_changed_async) - No Alarm found for client %d\n",__FILE__, __LINE__, ca->client)); - tray_list_remove_cqa (lookup_comp_queued_alarms (ca, l->data)); + tray_list_remove_cqa (lookup_comp_queued_alarms (ca, id)); remove_comp (ca, id); g_hash_table_remove (ca->uid_alarms_hash, id); e_cal_component_free_id (id); @@ -719,7 +720,7 @@ query_objects_changed_async (EThread *e, AlarmMsg *msg, void *data) cqa = lookup_comp_queued_alarms (ca, id); if (!cqa) { - d(printf("%s:%d (query_objects_changed_async) - No currently queued alarms for %s\n",__FILE__, __LINE__, id->uid)); + d(printf("%s:%d (query_objects_changed_async) - No currently queued alarms for %s\n",__FILE__, __LINE__, id->uid)); add_component_alarms (ca, alarms); g_object_unref (comp); comp = NULL; @@ -970,6 +971,8 @@ free_tray_icon_data (TrayIconData *tray_data) g_object_unref (tray_data->client); tray_data->client = NULL; + g_signal_handlers_disconnect_matched (tray_data->query, G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, on_dialog_objs_removed_cb, NULL); g_object_unref (tray_data->query); tray_data->query = NULL; -- cgit v1.2.3