rosfran@244
|
1 |
#include <gtk/gtk.h>
|
rosfran@244
|
2 |
#include <glib.h>
|
renatofilho@20
|
3 |
#include <sys/types.h>
|
renatofilho@20
|
4 |
#include <sys/stat.h>
|
renatofilho@20
|
5 |
#include <unistd.h>
|
renatofilho@20
|
6 |
#include <string.h>
|
renatofilho@20
|
7 |
#include <stdio.h>
|
renatofilho@20
|
8 |
#include <stdlib.h>
|
renatofilho@20
|
9 |
|
renatofilho@20
|
10 |
#include "mmyth_ui.h"
|
renatofilho@20
|
11 |
#include "mmyth_recordui.h"
|
renatofilho@20
|
12 |
|
renatofilho@20
|
13 |
/* GMyth library includes */
|
rosfran@244
|
14 |
#include <gmyth/gmyth_scheduler.h>
|
rosfran@244
|
15 |
#include <gmyth/gmyth_util.h>
|
renatofilho@20
|
16 |
|
renatofilho@20
|
17 |
enum {
|
renatofilho@20
|
18 |
START_DATE_COLUMN = 0,
|
renatofilho@20
|
19 |
TITLE_COLUMN,
|
renatofilho@20
|
20 |
CHAN_ID_COLUMN,
|
renatofilho@20
|
21 |
END_TIME_COLUMN,
|
renatofilho@20
|
22 |
RECORD_ID_COLUMN,
|
renatofilho@20
|
23 |
BASENAME_COLUMN,
|
renatofilho@20
|
24 |
N_COLUMNS
|
renatofilho@20
|
25 |
};
|
renatofilho@20
|
26 |
|
renatofilho@20
|
27 |
gboolean
|
renatofilho@20
|
28 |
mmyth_recordui_reload_all (MMythRecordUI *recordui)
|
renatofilho@20
|
29 |
{
|
renatofilho@20
|
30 |
gboolean res = FALSE;
|
renatofilho@20
|
31 |
|
renatofilho@20
|
32 |
res = mmyth_recordui_reload_schedule (recordui);
|
renatofilho@20
|
33 |
|
renatofilho@20
|
34 |
res = res & mmyth_recordui_reload_record (recordui);
|
renatofilho@20
|
35 |
|
renatofilho@20
|
36 |
|
renatofilho@20
|
37 |
if (!res)
|
renatofilho@20
|
38 |
g_warning ("[%s] Error while reloading schedule and recording content", __FUNCTION__);
|
renatofilho@20
|
39 |
|
renatofilho@20
|
40 |
return res;
|
renatofilho@20
|
41 |
}
|
renatofilho@20
|
42 |
|
renatofilho@20
|
43 |
gboolean
|
renatofilho@20
|
44 |
mmyth_recordui_reload_schedule (MMythRecordUI *recordui)
|
renatofilho@20
|
45 |
{
|
renatofilho@20
|
46 |
gint new_row = 0;
|
renatofilho@20
|
47 |
ScheduleInfo *schedule_info;
|
renatofilho@20
|
48 |
GList *schedule_list;
|
renatofilho@20
|
49 |
GtkTreeIter iter;
|
rosfran@244
|
50 |
gchar *start_date_time = NULL;
|
rosfran@244
|
51 |
gchar *end_date_time = NULL;
|
renatofilho@20
|
52 |
GString *str_aux = g_string_new("");
|
renatofilho@20
|
53 |
gint res;
|
renatofilho@20
|
54 |
|
renatofilho@20
|
55 |
gtk_tree_store_clear(recordui->sch_tree_store);
|
renatofilho@20
|
56 |
|
renatofilho@20
|
57 |
res = gmyth_scheduler_get_schedule_list(recordui->scheduler, &(schedule_list));
|
renatofilho@20
|
58 |
if (res < 0) {
|
renatofilho@20
|
59 |
g_warning ("[%s] Retrieved NULL list of scheduled data from database",
|
renatofilho@20
|
60 |
__FUNCTION__);
|
renatofilho@20
|
61 |
return FALSE;
|
renatofilho@20
|
62 |
}
|
renatofilho@20
|
63 |
|
renatofilho@20
|
64 |
for ( ; schedule_list; schedule_list = schedule_list->next) {
|
renatofilho@20
|
65 |
schedule_info = (ScheduleInfo*) schedule_list->data;
|
renatofilho@20
|
66 |
|
renatofilho@20
|
67 |
gtk_tree_store_insert(recordui->sch_tree_store, &iter, NULL, new_row++);
|
renatofilho@20
|
68 |
|
rosfran@244
|
69 |
start_date_time = gmyth_util_time_to_string_from_time_val(schedule_info->start_time);
|
rosfran@244
|
70 |
end_date_time = gmyth_util_time_to_string_from_time_val(schedule_info->end_time);
|
renatofilho@20
|
71 |
|
renatofilho@20
|
72 |
g_string_printf(str_aux, "%d", schedule_info->channel_id);
|
renatofilho@20
|
73 |
|
renatofilho@20
|
74 |
gtk_tree_store_set(recordui->sch_tree_store, &iter,
|
rosfran@244
|
75 |
START_DATE_COLUMN, start_date_time,
|
renatofilho@20
|
76 |
TITLE_COLUMN, schedule_info->title->str,
|
renatofilho@20
|
77 |
CHAN_ID_COLUMN, str_aux->str,
|
rosfran@244
|
78 |
END_TIME_COLUMN, end_date_time, //It doesn't appear
|
renatofilho@20
|
79 |
RECORD_ID_COLUMN, schedule_info->record_id,
|
renatofilho@20
|
80 |
-1); //the last line is a hidden item to be used in searching tasks
|
renatofilho@20
|
81 |
}
|
renatofilho@20
|
82 |
|
renatofilho@20
|
83 |
g_debug ("[%s] %d lines added to schedule list UI", __FUNCTION__, new_row);
|
renatofilho@20
|
84 |
|
renatofilho@20
|
85 |
/* free allocated memory */
|
renatofilho@20
|
86 |
if(!start_date_time)
|
rosfran@244
|
87 |
g_free(start_date_time);
|
renatofilho@20
|
88 |
if(!end_date_time)
|
rosfran@244
|
89 |
g_free(end_date_time);
|
renatofilho@20
|
90 |
g_string_free(str_aux, FALSE);
|
renatofilho@20
|
91 |
|
renatofilho@20
|
92 |
return TRUE;
|
renatofilho@20
|
93 |
}
|
renatofilho@20
|
94 |
|
renatofilho@20
|
95 |
gboolean
|
renatofilho@20
|
96 |
mmyth_recordui_reload_record (MMythRecordUI *recordui)
|
renatofilho@20
|
97 |
{
|
renatofilho@20
|
98 |
gint new_row = 0;
|
renatofilho@20
|
99 |
RecordedInfo *recorded_info;
|
renatofilho@20
|
100 |
GList *record_list = NULL;
|
renatofilho@20
|
101 |
GtkTreeIter iter;
|
rosfran@244
|
102 |
gchar *start_date_time = NULL;
|
rosfran@244
|
103 |
gchar *end_date_time = NULL;
|
renatofilho@20
|
104 |
GString *str_aux = g_string_new("");
|
renatofilho@20
|
105 |
gint res;
|
renatofilho@20
|
106 |
|
renatofilho@20
|
107 |
gtk_tree_store_clear(recordui->rec_tree_store);
|
renatofilho@20
|
108 |
|
renatofilho@20
|
109 |
res = gmyth_scheduler_get_recorded_list(recordui->scheduler, &record_list);
|
renatofilho@20
|
110 |
if (res < 0) {
|
renatofilho@20
|
111 |
g_warning ("[%s] Retrieved NULL list of recorded data from database", __FUNCTION__);
|
renatofilho@20
|
112 |
return FALSE;
|
renatofilho@20
|
113 |
}
|
renatofilho@20
|
114 |
|
renatofilho@20
|
115 |
for (; record_list; record_list = record_list->next) {
|
renatofilho@20
|
116 |
recorded_info = (RecordedInfo*) record_list->data;
|
renatofilho@20
|
117 |
|
renatofilho@20
|
118 |
gtk_tree_store_insert(recordui->rec_tree_store, &iter, NULL, new_row++);
|
renatofilho@20
|
119 |
|
rosfran@244
|
120 |
start_date_time = gmyth_util_time_to_string_from_time_val(recorded_info->start_time);
|
rosfran@244
|
121 |
end_date_time = gmyth_util_time_to_string_from_time_val(recorded_info->end_time);
|
renatofilho@20
|
122 |
|
renatofilho@20
|
123 |
g_string_printf(str_aux, "%d", recorded_info->channel_id);
|
renatofilho@20
|
124 |
|
renatofilho@20
|
125 |
gtk_tree_store_set(recordui->rec_tree_store, &iter,
|
rosfran@244
|
126 |
START_DATE_COLUMN, start_date_time,
|
renatofilho@20
|
127 |
TITLE_COLUMN, recorded_info->title->str,
|
renatofilho@20
|
128 |
CHAN_ID_COLUMN, str_aux->str,
|
rosfran@244
|
129 |
END_TIME_COLUMN, end_date_time, //It doesn't appear
|
renatofilho@20
|
130 |
RECORD_ID_COLUMN, recorded_info->record_id,
|
renatofilho@20
|
131 |
BASENAME_COLUMN, recorded_info->basename->str, -1);
|
renatofilho@20
|
132 |
//the last line is a hidden item to be used in searching tasks
|
renatofilho@20
|
133 |
}
|
renatofilho@20
|
134 |
|
renatofilho@20
|
135 |
g_debug ("[%s] %d lines added to record list UI", __FUNCTION__, new_row);
|
rosfran@244
|
136 |
|
rosfran@244
|
137 |
/* free allocated memory */
|
rosfran@244
|
138 |
if( NULL != start_date_time)
|
rosfran@244
|
139 |
g_free(start_date_time);
|
rosfran@244
|
140 |
if( NULL != end_date_time)
|
rosfran@244
|
141 |
g_free(end_date_time);
|
rosfran@244
|
142 |
g_string_free(str_aux, FALSE);
|
renatofilho@20
|
143 |
|
renatofilho@20
|
144 |
return TRUE;
|
renatofilho@20
|
145 |
}
|
renatofilho@20
|
146 |
|
renatofilho@20
|
147 |
|
renatofilho@20
|
148 |
MMythRecordUI*
|
rosfran@244
|
149 |
mmyth_recordui_new( GMythBackendInfo* backend_info )
|
renatofilho@20
|
150 |
{
|
renatofilho@20
|
151 |
MMythRecordUI *recordui = g_new0 (MMythRecordUI, 1);
|
rosfran@244
|
152 |
|
rosfran@244
|
153 |
g_return_val_if_fail( backend_info != NULL, NULL );
|
rosfran@244
|
154 |
|
rosfran@244
|
155 |
recordui->backend_info = backend_info;
|
renatofilho@20
|
156 |
|
renatofilho@20
|
157 |
recordui->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
renatofilho@20
|
158 |
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (recordui->scrolled_window),
|
renatofilho@20
|
159 |
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
renatofilho@20
|
160 |
|
renatofilho@20
|
161 |
recordui->viewport = gtk_viewport_new (NULL, NULL);
|
renatofilho@20
|
162 |
gtk_container_add (GTK_CONTAINER (recordui->scrolled_window), recordui->viewport);
|
renatofilho@20
|
163 |
|
renatofilho@20
|
164 |
recordui->notebook = gtk_notebook_new ();
|
renatofilho@20
|
165 |
gtk_container_set_border_width (GTK_CONTAINER (recordui->notebook), 1);
|
renatofilho@20
|
166 |
gtk_notebook_set_scrollable (GTK_NOTEBOOK (recordui->notebook), TRUE);
|
renatofilho@20
|
167 |
gtk_notebook_popup_enable (GTK_NOTEBOOK (recordui->notebook));
|
renatofilho@20
|
168 |
gtk_container_add (GTK_CONTAINER (recordui->viewport), recordui->notebook);
|
renatofilho@20
|
169 |
gtk_notebook_popup_disable(GTK_NOTEBOOK (recordui->notebook));
|
renatofilho@20
|
170 |
|
renatofilho@20
|
171 |
/* Schedule tab */
|
renatofilho@20
|
172 |
recordui->sch_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
renatofilho@20
|
173 |
gtk_container_add (GTK_CONTAINER (recordui->notebook), recordui->sch_scrolled_window);
|
renatofilho@20
|
174 |
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (recordui->sch_scrolled_window),
|
renatofilho@20
|
175 |
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
renatofilho@20
|
176 |
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (recordui->sch_scrolled_window),
|
renatofilho@20
|
177 |
GTK_SHADOW_IN);
|
renatofilho@20
|
178 |
|
renatofilho@20
|
179 |
/* The basename column in the sched_tree_store is not being used*/
|
renatofilho@20
|
180 |
recordui->sch_tree_store =
|
renatofilho@20
|
181 |
gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
|
renatofilho@20
|
182 |
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING );
|
renatofilho@20
|
183 |
|
renatofilho@20
|
184 |
recordui->sch_treeview =
|
renatofilho@20
|
185 |
gtk_tree_view_new_with_model(GTK_TREE_MODEL(recordui->sch_tree_store));
|
renatofilho@20
|
186 |
gtk_container_add (GTK_CONTAINER (recordui->sch_scrolled_window),
|
renatofilho@20
|
187 |
recordui->sch_treeview);
|
renatofilho@20
|
188 |
recordui->sch_renderer = gtk_cell_renderer_text_new();
|
renatofilho@20
|
189 |
//g_object_set(G_OBJECT(renderer1), "foreground", "green", "background", "black", NULL);
|
renatofilho@20
|
190 |
recordui->sch_column1 =
|
renatofilho@20
|
191 |
gtk_tree_view_column_new_with_attributes("Start time", recordui->sch_renderer,
|
renatofilho@20
|
192 |
"text", START_DATE_COLUMN, NULL);
|
renatofilho@20
|
193 |
gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview),
|
renatofilho@20
|
194 |
recordui->sch_column1);
|
renatofilho@20
|
195 |
recordui->sch_column2 =
|
renatofilho@20
|
196 |
gtk_tree_view_column_new_with_attributes("Title", recordui->sch_renderer,
|
renatofilho@20
|
197 |
"text", TITLE_COLUMN, NULL);
|
renatofilho@20
|
198 |
gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview),
|
renatofilho@20
|
199 |
recordui->sch_column2);
|
renatofilho@20
|
200 |
recordui->sch_column3 =
|
renatofilho@20
|
201 |
gtk_tree_view_column_new_with_attributes("Channel", recordui->sch_renderer,
|
renatofilho@20
|
202 |
"text", CHAN_ID_COLUMN, NULL);
|
renatofilho@20
|
203 |
gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview),
|
renatofilho@20
|
204 |
recordui->sch_column3);
|
renatofilho@20
|
205 |
gtk_tree_view_column_set_resizable(recordui->sch_column1, TRUE);
|
renatofilho@20
|
206 |
gtk_tree_view_column_set_resizable(recordui->sch_column2, TRUE);
|
renatofilho@20
|
207 |
gtk_tree_view_column_set_resizable(recordui->sch_column3, TRUE);
|
renatofilho@20
|
208 |
gtk_tree_view_column_set_reorderable(recordui->sch_column1, TRUE);
|
renatofilho@20
|
209 |
gtk_tree_view_column_set_reorderable(recordui->sch_column2, TRUE);
|
renatofilho@20
|
210 |
gtk_tree_view_column_set_reorderable(recordui->sch_column3, TRUE);
|
renatofilho@20
|
211 |
// recordui->sch_column4 =
|
renatofilho@20
|
212 |
// gtk_tree_view_column_new_with_attributes("", recordui->sch_renderer, "text", END_TIME_COLUMN, NULL);
|
renatofilho@20
|
213 |
// gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview),
|
renatofilho@20
|
214 |
// recordui->sch_column4);
|
renatofilho@20
|
215 |
|
renatofilho@20
|
216 |
recordui->sch_label = gtk_label_new (("Schedule"));
|
renatofilho@20
|
217 |
gtk_notebook_set_tab_label (GTK_NOTEBOOK (recordui->notebook),
|
renatofilho@20
|
218 |
gtk_notebook_get_nth_page (
|
renatofilho@20
|
219 |
GTK_NOTEBOOK (recordui->notebook), 0),
|
renatofilho@20
|
220 |
recordui->sch_label);
|
renatofilho@20
|
221 |
|
renatofilho@20
|
222 |
// Record items tab
|
renatofilho@20
|
223 |
// g_object_set(G_OBJECT(renderer2), "foreground", "blue", NULL);
|
renatofilho@20
|
224 |
recordui->rec_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
renatofilho@20
|
225 |
gtk_container_add (GTK_CONTAINER (recordui->notebook),
|
renatofilho@20
|
226 |
recordui->rec_scrolled_window);
|
renatofilho@20
|
227 |
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (recordui->rec_scrolled_window),
|
renatofilho@20
|
228 |
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
renatofilho@20
|
229 |
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (recordui->rec_scrolled_window),
|
renatofilho@20
|
230 |
GTK_SHADOW_IN);
|
renatofilho@20
|
231 |
|
renatofilho@20
|
232 |
recordui->rec_tree_store =
|
renatofilho@20
|
233 |
gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
|
renatofilho@20
|
234 |
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
|
renatofilho@20
|
235 |
recordui->rec_treeview =
|
renatofilho@20
|
236 |
gtk_tree_view_new_with_model(GTK_TREE_MODEL(recordui->rec_tree_store));
|
renatofilho@20
|
237 |
gtk_container_add (GTK_CONTAINER (recordui->rec_scrolled_window),
|
renatofilho@20
|
238 |
recordui->rec_treeview);
|
renatofilho@20
|
239 |
recordui->rec_renderer = gtk_cell_renderer_text_new();
|
renatofilho@20
|
240 |
//g_object_set(G_OBJECT(renderer1), "foreground", "green", "background", "black", NULL);
|
renatofilho@20
|
241 |
|
renatofilho@20
|
242 |
recordui->rec_column1 =
|
renatofilho@20
|
243 |
gtk_tree_view_column_new_with_attributes("Start time", recordui->rec_renderer,
|
renatofilho@20
|
244 |
"text", START_DATE_COLUMN, NULL);
|
renatofilho@20
|
245 |
gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview),
|
renatofilho@20
|
246 |
recordui->rec_column1);
|
renatofilho@20
|
247 |
recordui->rec_column2 =
|
renatofilho@20
|
248 |
gtk_tree_view_column_new_with_attributes("Title", recordui->rec_renderer,
|
renatofilho@20
|
249 |
"text", TITLE_COLUMN, NULL);
|
renatofilho@20
|
250 |
gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview),
|
renatofilho@20
|
251 |
recordui->rec_column2);
|
renatofilho@20
|
252 |
recordui->rec_column3 =
|
renatofilho@20
|
253 |
gtk_tree_view_column_new_with_attributes("Channel", recordui->rec_renderer,
|
renatofilho@20
|
254 |
"text", CHAN_ID_COLUMN, NULL);
|
renatofilho@20
|
255 |
gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview),
|
renatofilho@20
|
256 |
recordui->rec_column3);
|
renatofilho@20
|
257 |
gtk_tree_view_column_set_resizable(recordui->rec_column1, TRUE);
|
renatofilho@20
|
258 |
gtk_tree_view_column_set_resizable(recordui->rec_column2, TRUE);
|
renatofilho@20
|
259 |
gtk_tree_view_column_set_resizable(recordui->rec_column3, TRUE);
|
renatofilho@20
|
260 |
gtk_tree_view_column_set_reorderable(recordui->rec_column1, TRUE);
|
renatofilho@20
|
261 |
gtk_tree_view_column_set_reorderable(recordui->rec_column2, TRUE);
|
renatofilho@20
|
262 |
gtk_tree_view_column_set_reorderable(recordui->rec_column3, TRUE);
|
renatofilho@20
|
263 |
// recordui->rec_column4 = gtk_tree_view_column_new_with_attributes("", recordui->rec_renderer, "text", END_TIME_COLUMN, NULL);
|
renatofilho@20
|
264 |
// gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), recordui->rec_column4);
|
renatofilho@20
|
265 |
|
renatofilho@20
|
266 |
recordui->rec_label = gtk_label_new (("Recorded"));
|
renatofilho@20
|
267 |
gtk_notebook_set_tab_label (GTK_NOTEBOOK (recordui->notebook),
|
renatofilho@20
|
268 |
gtk_notebook_get_nth_page (
|
renatofilho@20
|
269 |
GTK_NOTEBOOK (recordui->notebook), 1),
|
renatofilho@20
|
270 |
recordui->rec_label);
|
renatofilho@20
|
271 |
|
renatofilho@20
|
272 |
// Gets the mmyth scheduler manager
|
rosfran@244
|
273 |
recordui->scheduler = gmyth_scheduler_new ( backend_info );
|
renatofilho@20
|
274 |
|
renatofilho@20
|
275 |
/* init connection to the backend */
|
rosfran@208
|
276 |
gmyth_scheduler_connect (recordui->scheduler, recordui->scheduler->backend_info);
|
renatofilho@20
|
277 |
|
renatofilho@20
|
278 |
return recordui;
|
renatofilho@20
|
279 |
}
|
renatofilho@20
|
280 |
|
renatofilho@20
|
281 |
void
|
renatofilho@20
|
282 |
mmyth_recordui_free (MMythRecordUI *recordui)
|
renatofilho@20
|
283 |
{
|
renatofilho@20
|
284 |
// FIXME: Release memory here!
|
renatofilho@20
|
285 |
/* close connection to the backend */
|
renatofilho@20
|
286 |
gmyth_scheduler_disconnect (recordui->scheduler);
|
renatofilho@20
|
287 |
}
|
renatofilho@20
|
288 |
|
renatofilho@20
|
289 |
void
|
renatofilho@20
|
290 |
mmyth_recordui_delete_selected (GtkButton *button, MMythRecordUI *recordui)
|
renatofilho@20
|
291 |
{
|
renatofilho@20
|
292 |
GtkTreeSelection *selection;
|
renatofilho@20
|
293 |
GtkTreeModel *list_store;
|
renatofilho@20
|
294 |
GtkTreeIter iter;
|
renatofilho@20
|
295 |
int index;
|
renatofilho@20
|
296 |
int curr_page = 0;
|
renatofilho@20
|
297 |
|
renatofilho@20
|
298 |
curr_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(recordui->notebook));
|
renatofilho@20
|
299 |
|
renatofilho@20
|
300 |
if ( curr_page == 0) {
|
renatofilho@20
|
301 |
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(recordui->sch_treeview));
|
renatofilho@20
|
302 |
if (selection != NULL) {
|
renatofilho@20
|
303 |
gtk_tree_selection_get_selected(selection, &list_store, &iter);
|
renatofilho@20
|
304 |
gtk_tree_model_get(list_store, &iter, RECORD_ID_COLUMN, &index, -1);
|
renatofilho@20
|
305 |
gmyth_scheduler_delete_schedule(recordui->scheduler, index);
|
renatofilho@20
|
306 |
mmyth_recordui_reload_schedule (recordui);
|
renatofilho@20
|
307 |
return;
|
renatofilho@20
|
308 |
}
|
renatofilho@20
|
309 |
|
renatofilho@20
|
310 |
} else if (curr_page == 1) {
|
renatofilho@20
|
311 |
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(recordui->rec_treeview));
|
renatofilho@20
|
312 |
if (selection != NULL) {
|
renatofilho@20
|
313 |
gtk_tree_selection_get_selected(selection, &list_store, &iter);
|
renatofilho@20
|
314 |
gtk_tree_model_get(list_store, &iter, RECORD_ID_COLUMN, &index, -1);
|
renatofilho@20
|
315 |
gmyth_scheduler_delete_recorded(recordui->scheduler, index);
|
renatofilho@20
|
316 |
mmyth_recordui_reload_record (recordui);
|
renatofilho@20
|
317 |
return;
|
renatofilho@20
|
318 |
}
|
renatofilho@20
|
319 |
}
|
renatofilho@20
|
320 |
|
renatofilho@20
|
321 |
g_warning ("[%s] None element was removed from the list", __FUNCTION__);
|
renatofilho@20
|
322 |
}
|
renatofilho@20
|
323 |
|
renatofilho@20
|
324 |
/* FIXME: change this function name, it is returning the
|
renatofilho@20
|
325 |
* basename_column that represents the nuv filename of
|
renatofilho@20
|
326 |
* the recorded content */
|
renatofilho@20
|
327 |
gchar*
|
renatofilho@20
|
328 |
mmyth_recordui_get_selected_recorded (MMythRecordUI *recordui)
|
renatofilho@20
|
329 |
{
|
renatofilho@20
|
330 |
GtkTreeSelection *selection = NULL;
|
renatofilho@20
|
331 |
GtkTreeModel *list_store = NULL;
|
renatofilho@20
|
332 |
GtkTreeIter iter;
|
renatofilho@20
|
333 |
gchar *path = NULL;
|
renatofilho@20
|
334 |
|
renatofilho@20
|
335 |
/* returning nuv filename, basename_column */
|
renatofilho@20
|
336 |
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(recordui->rec_treeview));
|
renatofilho@20
|
337 |
if (gtk_tree_selection_get_selected (selection, &list_store, &iter)) {
|
renatofilho@20
|
338 |
gtk_tree_model_get(list_store, &iter, BASENAME_COLUMN, &path, -1);
|
renatofilho@20
|
339 |
}
|
renatofilho@20
|
340 |
|
renatofilho@20
|
341 |
// FIXME: MOVE THIS TO OTHER PLACE
|
renatofilho@20
|
342 |
return path;
|
renatofilho@20
|
343 |
}
|