aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-11-04 23:39:10 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-11-04 23:39:10 +0800
commit90d4156ad06c297cb0030c5d3def03c771a5a78f (patch)
treed2ea3ceb81b745ca9b108850fa2ed3dfd9429d6e /calendar/gui
parent2460ca1d162dbd596e6e0a7d7a9f5aedc1bc4287 (diff)
downloadgsoc2013-evolution-90d4156ad06c297cb0030c5d3def03c771a5a78f.tar.gz
gsoc2013-evolution-90d4156ad06c297cb0030c5d3def03c771a5a78f.tar.zst
gsoc2013-evolution-90d4156ad06c297cb0030c5d3def03c771a5a78f.zip
** Fix for bug #558354
2008-11-04 Milan Crha <mcrha@redhat.com> ** Fix for bug #558354 * gui/alarm-notify/alarm-notify.glade: * gui/alarm-notify/alarm-notify-dialog.h: (enum AlarmNotifyResult): * gui/alarm-notify/alarm-notify-dialog.c: (struct AlarmNotify), (dismiss_pressed_cb), (notified_alarms_dialog_new): * gui/alarm-notify/alarm-queue.c: (notify_dialog_cb): Changed "Close" button to "Dismiss All" and added a "Dismiss" button to the alarm notification dialog to be able to dismiss only some of the alarms shown in the dialog. svn path=/trunk/; revision=36740
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/alarm-notify/alarm-notify-dialog.c28
-rw-r--r--calendar/gui/alarm-notify/alarm-notify-dialog.h3
-rw-r--r--calendar/gui/alarm-notify/alarm-notify.glade144
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c9
4 files changed, 179 insertions, 5 deletions
diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c
index 61eea70f52..ee09c0dde4 100644
--- a/calendar/gui/alarm-notify/alarm-notify-dialog.c
+++ b/calendar/gui/alarm-notify/alarm-notify-dialog.c
@@ -67,6 +67,7 @@ typedef struct {
GtkWidget *snooze_time_min;
GtkWidget *snooze_time_hrs;
GtkWidget *snooze_btn;
+ GtkWidget *dismiss_btn;
GtkWidget *minutes_label;
GtkWidget *hrs_label;
GtkWidget *description;
@@ -191,7 +192,30 @@ snooze_pressed_cb (GtkButton *button, gpointer user_data)
if (!snooze_timeout)
snooze_timeout = DEFAULT_SNOOZE_MINS;
(* funcinfo->func) (ALARM_NOTIFY_SNOOZE, snooze_timeout, funcinfo->func_data);
+}
+
+static void
+dismiss_pressed_cb (GtkButton *button, gpointer user_data)
+{
+ AlarmNotify *an = user_data;
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (an->treeview));
+
+ g_return_if_fail (model != NULL);
+ if (gtk_tree_model_iter_n_children (model, NULL) <= 1) {
+ gtk_dialog_response (GTK_DIALOG (an->dialog), GTK_RESPONSE_CLOSE);
+ } else {
+ GtkTreeIter iter;
+ 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);
+
+ g_return_if_fail (funcinfo);
+
+ (* funcinfo->func) (ALARM_NOTIFY_DISMISS, -1, funcinfo->func_data);
+ }
}
static void
@@ -256,10 +280,11 @@ notified_alarms_dialog_new (void)
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;
+ an->dismiss_btn = glade_xml_get_widget (an->xml, "dismiss-button");
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
- && an->description && an->location && edit_btn && snooze_btn)) {
+ && an->description && an->location && edit_btn && snooze_btn && an->dismiss_btn)) {
g_message ("alarm_notify_dialog(): Could not find all widgets in Glade file!");
g_object_unref (an->xml);
g_free (an);
@@ -292,6 +317,7 @@ notified_alarms_dialog_new (void)
g_signal_connect (edit_btn, "clicked", G_CALLBACK (edit_pressed_cb), an);
g_signal_connect (snooze_btn, "clicked", G_CALLBACK (snooze_pressed_cb), an);
+ g_signal_connect (an->dismiss_btn, "clicked", G_CALLBACK (dismiss_pressed_cb), an);
g_signal_connect (G_OBJECT (an->dialog), "response", G_CALLBACK (dialog_response_cb), an);
g_signal_connect (G_OBJECT (an->dialog), "destroy", G_CALLBACK (dialog_destroyed_cb), an);
diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.h b/calendar/gui/alarm-notify/alarm-notify-dialog.h
index 4b2a3d9c95..7a94793eaa 100644
--- a/calendar/gui/alarm-notify/alarm-notify-dialog.h
+++ b/calendar/gui/alarm-notify/alarm-notify-dialog.h
@@ -32,7 +32,8 @@
typedef enum {
ALARM_NOTIFY_CLOSE,
ALARM_NOTIFY_SNOOZE,
- ALARM_NOTIFY_EDIT
+ ALARM_NOTIFY_EDIT,
+ ALARM_NOTIFY_DISMISS
} AlarmNotifyResult;
typedef struct _AlarmNotificationsDialog AlarmNotificationsDialog;
diff --git a/calendar/gui/alarm-notify/alarm-notify.glade b/calendar/gui/alarm-notify/alarm-notify.glade
index 539bd66269..df1b1f92a2 100644
--- a/calendar/gui/alarm-notify/alarm-notify.glade
+++ b/calendar/gui/alarm-notify/alarm-notify.glade
@@ -37,11 +37,73 @@
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
- <property name="label">gtk-close</property>
- <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox9">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image6">
+ <property name="visible">True</property>
+ <property name="stock">gtk-close</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label19">
+ <property name="visible">True</property>
+ <property name="label">Dismiss _All</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
</widget>
</child>
</widget>
@@ -527,6 +589,84 @@
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkButton" id="dismiss-button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment5">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox10">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image7">
+ <property name="visible">True</property>
+ <property name="stock">gtk-apply</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label20">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Dismiss</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index f320ccc42b..22b7766b4d 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -1248,6 +1248,13 @@ notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data)
break;
+ case ALARM_NOTIFY_DISMISS:
+ if (alarm_notifications_dialog) {
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (alarm_notifications_dialog->treeview));
+ gtk_list_store_remove (GTK_LIST_STORE (model), &tray_data->iter);
+ }
+ break;
+
case ALARM_NOTIFY_CLOSE:
d(printf("%s:%d (notify_dialog_cb) - Dialog close\n",__FILE__, __LINE__));
if (alarm_notifications_dialog) {
@@ -1268,7 +1275,7 @@ notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data)
/* Task to remove the tray icons */
tray_list_remove_icons ();
- }
+ }
break;