1 /*
2  * alarms-list.h -- Alarm list window
3  *
4  * Copyright (C) 2007-2008 Johannes H. Jensen <joh@pseudoberries.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19  *
20  * Authors:
21  * 		Johannes H. Jensen <joh@pseudoberries.com>
22  */
23 
24 #ifndef ALARM_LIST_WINDOW_H_
25 #define ALARM_LIST_WINDOW_H_
26 
27 #include <gtk/gtk.h>
28 
29 typedef struct _AlarmListWindow AlarmListWindow;
30 
31 #include "alarm-applet.h"
32 #include "alarm.h"
33 
34 typedef enum {
35     COLUMN_ALARM = 0,
36     COLUMN_TYPE,
37     COLUMN_TIME,
38     COLUMN_LABEL,
39     COLUMN_ACTIVE,
40     COLUMN_TRIGGERED,
41     COLUMN_SHOW_ICON,
42     ALARMS_N_COLUMNS
43 } AlarmListColumn;
44 
45 typedef enum {
46     SORTID_TIME_REMAINING = 0,
47 } AlarmSortID;
48 
49 struct _AlarmListWindow {
50 	AlarmApplet *applet;
51 
52     Alarm *selected_alarm;
53     gboolean reordered;         // Indicates that rows have just been reordered
54     gboolean toggled;           // Indicates that an alarm has just been toggled
55 
56 	GtkWindow *window;
57 	GtkListStore *model;
58 	GtkTreeView *tree_view;
59 
60     GtkWidget *new_button;
61     GtkWidget *edit_button;
62     GtkWidget *delete_button;
63     GtkWidget *enable_button;
64     GtkWidget *stop_button;
65     GtkWidget *snooze_button;
66     GtkWidget *snooze_menu;
67 
68     GtkAccelGroup *accel_group;
69 
70     gint window_pos_x;
71     gint window_pos_y;
72 };
73 
74 //#define TIME_COL_FORMAT "<span font='Bold 11'>%H:%M:%S</span>"
75 // TODO: Does fixing the font size give a11y problems?
76 #define TIME_COL_CLOCK_FORMAT "<span font='Bold 11'> %H:%M</span><span font='Bold 7'>:%S</span>"
77 #define TIME_COL_TIMER_FORMAT "<span font='Bold 11'>-%H:%M</span><span font='Bold 7'>:%S</span>"
78 #define TIME_COL_REPEAT_FORMAT "\n <sup>%s</sup>"
79 #define LABEL_COL_FORMAT "%s"
80 #define LABEL_COL_TRIGGERED_FORMAT "<b>%s</b>"
81 
82 #define CLOCK_FORMAT "%H:%M"
83 #define TIMER_FORMAT "-%H:%M"
84 
85 #define DELETE_DIALOG_TITLE     _("Delete %s?")
86 #define DELETE_DIALOG_TEXT      _("<big>Delete %s <b>%s</b>?</big>")
87 #define DELETE_DIALOG_SECONDARY _("Are you sure you want to delete the %s labeled <b>%s</b> scheduled at <b>%s</b>? This action cannot be undone.")
88 
89 AlarmListWindow *
90 alarm_list_window_new (AlarmApplet *applet);
91 
92 void
93 alarm_list_window_show (AlarmListWindow *list_window);
94 
95 void
96 alarm_list_window_hide (AlarmListWindow *list_window);
97 
98 void
99 alarm_list_window_toggle (AlarmListWindow *list_window);
100 
101 void
102 alarm_list_window_alarm_add (AlarmListWindow *list_window, Alarm *alarm);
103 
104 void
105 alarm_list_window_alarm_update (AlarmListWindow *list_window, Alarm *alarm);
106 
107 void
108 alarm_list_window_alarm_remove (AlarmListWindow *list_window, Alarm *alarm);
109 
110 void
111 alarm_list_window_alarms_add (AlarmListWindow *list_window, GList *alarms);
112 
113 gboolean
114 alarm_list_window_find_alarm (GtkTreeModel *model, Alarm *alarm, GtkTreeIter *iter);
115 
116 gboolean
117 alarm_list_window_contains (AlarmListWindow *list_window, Alarm *alarm);
118 
119 Alarm *
120 alarm_list_window_get_selected_alarm (AlarmListWindow *list_window);
121 
122 #endif /*ALARM_LIST_WINDOW_H_*/
123