maemo-ui/src/mmyth_schedulerui.c
author rosfran
Fri Jan 05 19:27:27 2007 +0000 (2007-01-05)
branchtrunk
changeset 244 c88244670b08
parent 208 c3c073032757
child 754 cb885ee44618
permissions -rw-r--r--
[svn r245] Fixes a lot of bugs concerning GMythBackendInfo usage.
renatofilho@20
     1
#include <gtk/gtk.h>
renatofilho@20
     2
#include <glib.h>
renatofilho@20
     3
#include <glib/gprintf.h>
renatofilho@20
     4
#include <sys/types.h>
renatofilho@20
     5
#include <sys/stat.h>
renatofilho@20
     6
#include <unistd.h>
renatofilho@20
     7
#include <string.h>
renatofilho@20
     8
#include <stdio.h>
renatofilho@20
     9
renatofilho@20
    10
#include "mmyth_ui.h"
renatofilho@20
    11
#include "mmyth_uicommon.h"
renatofilho@20
    12
#include "mmyth_recordui.h"
renatofilho@20
    13
#include "mmyth_schedulerui.h"
renatofilho@20
    14
renatofilho@20
    15
/* GMyth library includes */
rosfran@244
    16
#include <gmyth/gmyth_scheduler.h>
rosfran@244
    17
#include <gmyth/gmyth_common.h>
rosfran@244
    18
#include <gmyth/gmyth_epg.h>
renatofilho@20
    19
renatofilho@20
    20
static void run_calendar_dialog (GtkButton *button, gpointer data);
renatofilho@20
    21
renatofilho@20
    22
static void add_channel_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox);
renatofilho@20
    23
static void add_time_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox);
renatofilho@20
    24
static void add_date_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox);
renatofilho@20
    25
static void add_duration_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox);
renatofilho@20
    26
static void add_frequency_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox);
renatofilho@20
    27
static void add_title_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox);
renatofilho@20
    28
renatofilho@20
    29
MMythSchedulerUI*
rosfran@244
    30
mmyth_schedulerui_new ( GMythBackendInfo *backend_info )
renatofilho@20
    31
{
renatofilho@20
    32
	GtkWidget *scrolledwindow;	
renatofilho@20
    33
	GtkWidget *viewport;	
renatofilho@20
    34
	GtkWidget *head_hbox;
renatofilho@20
    35
	GtkWidget *fields_vbox;
renatofilho@20
    36
	GtkWidget *hseparator;
renatofilho@20
    37
	GtkWidget *label;
renatofilho@20
    38
renatofilho@20
    39
	MMythSchedulerUI *scheduler_ui = g_new0 (MMythSchedulerUI, 1);
rosfran@244
    40
rosfran@244
    41
	scheduler_ui->backend_info = backend_info;
renatofilho@20
    42
	
renatofilho@20
    43
	scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
renatofilho@20
    44
	scheduler_ui->main_widget = scrolledwindow;
renatofilho@20
    45
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
renatofilho@20
    46
  			GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
renatofilho@20
    47
renatofilho@20
    48
	//Is this needed?  
renatofilho@20
    49
	viewport = gtk_viewport_new (NULL, NULL);
renatofilho@20
    50
	gtk_container_add (GTK_CONTAINER (scrolledwindow), viewport);
renatofilho@20
    51
renatofilho@20
    52
	//Is this needed?
renatofilho@20
    53
	head_hbox = gtk_hbox_new (FALSE, 0);
renatofilho@20
    54
	gtk_container_add (GTK_CONTAINER (viewport), head_hbox);
renatofilho@20
    55
renatofilho@20
    56
	fields_vbox = gtk_vbox_new (FALSE, 0);
renatofilho@20
    57
	gtk_box_pack_start (GTK_BOX (head_hbox), fields_vbox, TRUE, TRUE, 0);
renatofilho@20
    58
	gtk_container_set_border_width (GTK_CONTAINER (fields_vbox), 10);
renatofilho@20
    59
renatofilho@20
    60
	label = gtk_label_new_with_mnemonic (("Manual Schedule Recording"));
renatofilho@20
    61
	gtk_box_pack_start (GTK_BOX (fields_vbox), label, FALSE, FALSE, 0);
renatofilho@20
    62
	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
renatofilho@20
    63
renatofilho@20
    64
	hseparator = gtk_hseparator_new ();
renatofilho@20
    65
	gtk_box_pack_start (GTK_BOX (fields_vbox), hseparator, FALSE, TRUE, 0);
renatofilho@20
    66
renatofilho@20
    67
	add_channel_field (scheduler_ui, fields_vbox);
renatofilho@20
    68
	add_time_field (scheduler_ui, fields_vbox);
renatofilho@20
    69
	add_date_field (scheduler_ui, fields_vbox);
renatofilho@20
    70
	add_duration_field (scheduler_ui, fields_vbox);
renatofilho@20
    71
	add_frequency_field (scheduler_ui, fields_vbox);
renatofilho@20
    72
	add_title_field (scheduler_ui, fields_vbox);
renatofilho@20
    73
	
renatofilho@20
    74
	return scheduler_ui;
renatofilho@20
    75
}
renatofilho@20
    76
renatofilho@20
    77
static void
renatofilho@20
    78
set_date_from_calendar (GtkCalendar *calendar, gpointer data)
renatofilho@20
    79
{
renatofilho@20
    80
	char sched_date[24];
renatofilho@20
    81
renatofilho@20
    82
	MMythSchedulerUI *scheduler_ui = (MMythSchedulerUI*) data;
renatofilho@20
    83
renatofilho@20
    84
	// FIXME: Change this, save another value instead of month_temp, day_temp, ...	
renatofilho@20
    85
	gtk_calendar_get_date(GTK_CALENDAR(calendar), 
renatofilho@20
    86
		&(scheduler_ui->year_temp), &(scheduler_ui->month_temp), &(scheduler_ui->day_temp));
renatofilho@20
    87
renatofilho@20
    88
	sched_date[23]='\0';
renatofilho@20
    89
	g_sprintf(sched_date, "%04d %02d %02d (yyyy mm dd)",
renatofilho@20
    90
		scheduler_ui->year_temp, scheduler_ui->month_temp+1, scheduler_ui->day_temp);
renatofilho@20
    91
renatofilho@20
    92
	gtk_button_set_label(GTK_BUTTON(scheduler_ui->date_button), sched_date);
renatofilho@20
    93
renatofilho@20
    94
	gtk_widget_destroy(scheduler_ui->calendar_dialog);
renatofilho@20
    95
	scheduler_ui->calendar_dialog = NULL;
renatofilho@20
    96
	scheduler_ui->calendar = NULL;
renatofilho@20
    97
}
renatofilho@20
    98
renatofilho@20
    99
//calendar
renatofilho@20
   100
static void
renatofilho@20
   101
run_calendar_dialog (GtkButton *button, gpointer data)
renatofilho@20
   102
{
renatofilho@20
   103
renatofilho@20
   104
	GtkWidget *dialog_vbox;
renatofilho@20
   105
	MMythSchedulerUI *scheduler_ui = (MMythSchedulerUI*) data;
renatofilho@20
   106
renatofilho@20
   107
	// calendar_dialog and calendar are been released at set_date_from_calendar ()
renatofilho@20
   108
	scheduler_ui->calendar_dialog = gtk_dialog_new ();
renatofilho@20
   109
	gtk_container_set_border_width (GTK_CONTAINER (scheduler_ui->calendar_dialog), 1);
renatofilho@20
   110
  	gtk_window_set_title (GTK_WINDOW (scheduler_ui->calendar_dialog), "Select starting date");
renatofilho@20
   111
  	gtk_window_set_position (GTK_WINDOW (scheduler_ui->calendar_dialog), GTK_WIN_POS_CENTER);
renatofilho@20
   112
	gtk_window_set_decorated (GTK_WINDOW (scheduler_ui->calendar_dialog), FALSE);
renatofilho@20
   113
renatofilho@20
   114
	dialog_vbox = GTK_DIALOG (scheduler_ui->calendar_dialog)->vbox;
renatofilho@20
   115
renatofilho@20
   116
	scheduler_ui->calendar = gtk_calendar_new ();
renatofilho@20
   117
renatofilho@20
   118
	gtk_box_pack_start (GTK_BOX (dialog_vbox), scheduler_ui->calendar, TRUE, TRUE, 0);
renatofilho@20
   119
	gtk_calendar_display_options (GTK_CALENDAR (scheduler_ui->calendar),
renatofilho@20
   120
        GTK_CALENDAR_SHOW_HEADING | GTK_CALENDAR_SHOW_DAY_NAMES);
renatofilho@20
   121
renatofilho@20
   122
	gtk_widget_show_all (scheduler_ui->calendar_dialog);
renatofilho@20
   123
renatofilho@20
   124
	g_signal_connect (G_OBJECT (scheduler_ui->calendar), "day-selected-double-click",
renatofilho@20
   125
                      G_CALLBACK (set_date_from_calendar), data);
renatofilho@20
   126
}
renatofilho@20
   127
renatofilho@20
   128
renatofilho@20
   129
gboolean
renatofilho@20
   130
mmyth_schedulerui_save (MMythSchedulerUI *scheduler_ui)
renatofilho@20
   131
{
rosfran@244
   132
	GMythScheduler *scheduler;
renatofilho@20
   133
	ScheduleInfo *schedule_info;
renatofilho@20
   134
	GMythChannelInfo *channel_info;
renatofilho@20
   135
renatofilho@20
   136
	GList *clist;
renatofilho@20
   137
	gint index, duration;
rosfran@244
   138
	gint frequency;
rosfran@244
   139
	struct tm start_tm;
rosfran@244
   140
renatofilho@20
   141
	schedule_info = g_new0(ScheduleInfo, 1);
rosfran@244
   142
	if(schedule_info == NULL) {
rosfran@244
   143
		g_warning ("Error allocating memory");
rosfran@244
   144
		return FALSE;
rosfran@244
   145
	}
renatofilho@20
   146
rosfran@244
   147
	clist = scheduler_ui->channel_list;
rosfran@244
   148
rosfran@244
   149
	index = gtk_combo_box_get_active(GTK_COMBO_BOX(scheduler_ui->channel_combobox));
rosfran@244
   150
rosfran@244
   151
	if (clist != NULL)
renatofilho@20
   152
		clist = g_list_nth(clist, index);
rosfran@244
   153
rosfran@244
   154
	if (clist) {
rosfran@244
   155
		g_debug ("[%s] New schedule: %d", __FUNCTION__, index);
rosfran@244
   156
	} else {
rosfran@244
   157
		g_warning ("[%s] Error when adding new schedule", __FUNCTION__);
rosfran@244
   158
		return FALSE;
rosfran@244
   159
	}
rosfran@244
   160
rosfran@244
   161
	channel_info = clist->data;
rosfran@244
   162
rosfran@244
   163
	/* initialize schedule_info */
rosfran@244
   164
	schedule_info->channel_id = channel_info->channel_ID;
rosfran@244
   165
rosfran@244
   166
	start_tm.tm_hour = 
rosfran@244
   167
		(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scheduler_ui->hour_spinbutton));
renatofilho@20
   168
	start_tm.tm_min = 
rosfran@244
   169
		(int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scheduler_ui->min_spinbutton));
rosfran@244
   170
	start_tm.tm_sec = 0;
renatofilho@20
   171
renatofilho@20
   172
	start_tm.tm_mday = (gint)scheduler_ui->day_temp;
renatofilho@20
   173
	start_tm.tm_mon =  (gint)scheduler_ui->month_temp;
renatofilho@20
   174
	start_tm.tm_year = (gint)scheduler_ui->year_temp - 1900; //years since 1900
rosfran@244
   175
	GTimeVal* time_val_local = g_new0( GTimeVal, 1 );
rosfran@244
   176
	time_val_local->tv_sec = timelocal(&start_tm);
renatofilho@20
   177
rosfran@244
   178
	schedule_info->start_time = time_val_local;
rosfran@244
   179
	if ( NULL == schedule_info->start_time ) {
rosfran@244
   180
		g_warning ("timelocal error!\n");
rosfran@244
   181
		return FALSE;
rosfran@244
   182
	}
renatofilho@20
   183
renatofilho@20
   184
	duration = (gint) gtk_spin_button_get_value(
rosfran@244
   185
			GTK_SPIN_BUTTON(scheduler_ui->duration_spinbutton));
rosfran@244
   186
	schedule_info->end_time = schedule_info->start_time + (duration*60);
renatofilho@20
   187
rosfran@244
   188
	/* TODO: frequency is not implemented yet */
renatofilho@20
   189
	frequency = gtk_combo_box_get_active(GTK_COMBO_BOX(scheduler_ui->freq_combobox));
renatofilho@20
   190
renatofilho@20
   191
	schedule_info->title = g_string_new("");
renatofilho@20
   192
	g_string_printf(schedule_info->title, "%s", 
rosfran@244
   193
			gtk_entry_get_text(GTK_ENTRY(scheduler_ui->title_entry)));
renatofilho@20
   194
rosfran@244
   195
	/* FIXME: Architecture change to reuse the scheduler created in the recordui! */
rosfran@244
   196
	scheduler = gmyth_scheduler_new ();
renatofilho@20
   197
rosfran@244
   198
	gmyth_scheduler_connect(scheduler, scheduler->backend_info);
renatofilho@20
   199
rosfran@244
   200
	/* FIXME: set record_id = -1 to add a new schedule */
rosfran@244
   201
	schedule_info->record_id = -1;
rosfran@244
   202
	gmyth_scheduler_add_schedule (scheduler, schedule_info);
rosfran@244
   203
rosfran@244
   204
	gmyth_scheduler_disconnect(scheduler);
rosfran@244
   205
rosfran@244
   206
	/* free allocated memory */
rosfran@244
   207
	g_object_unref (scheduler);
rosfran@244
   208
	g_free (schedule_info);
rosfran@244
   209
rosfran@244
   210
	return TRUE;
renatofilho@20
   211
} 
renatofilho@20
   212
renatofilho@20
   213
static GtkWidget*
renatofilho@20
   214
add_line (GtkWidget *vbox, const gchar *str)
renatofilho@20
   215
{
renatofilho@20
   216
	GtkWidget *label;
renatofilho@20
   217
	GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
renatofilho@20
   218
renatofilho@20
   219
	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
renatofilho@20
   220
	gtk_container_set_border_width (GTK_CONTAINER (hbox), 3);
renatofilho@20
   221
	
renatofilho@20
   222
	label = gtk_label_new (str);
renatofilho@20
   223
	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
renatofilho@20
   224
	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);	
renatofilho@20
   225
renatofilho@20
   226
	return hbox;
renatofilho@20
   227
}
renatofilho@20
   228
renatofilho@20
   229
static void
renatofilho@20
   230
add_channel_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox)
renatofilho@20
   231
{
renatofilho@20
   232
	GtkWidget *combobox;
renatofilho@20
   233
	
renatofilho@20
   234
	GtkWidget *hbox = add_line (vbox, "Channel:    ");
renatofilho@20
   235
	
renatofilho@20
   236
	combobox = gtk_combo_box_new_text ();
renatofilho@20
   237
renatofilho@20
   238
	scheduler_ui->channel_combobox = combobox;
renatofilho@20
   239
	gtk_box_pack_start (GTK_BOX (hbox), combobox, FALSE, FALSE, 0);
renatofilho@20
   240
			
renatofilho@20
   241
	GMythEPG *mmyth_epg = gmyth_epg_new ();
rosfran@244
   242
	if (!gmyth_epg_connect (mmyth_epg, scheduler_ui->backend_info)) {
renatofilho@20
   243
		// FIXME: Without this list the scheduler UI should not be shown!
renatofilho@20
   244
		g_warning ("[%s] Error when getting list of channels", __FUNCTION__);
renatofilho@20
   245
	}
renatofilho@20
   246
  	
renatofilho@20
   247
	if (gmyth_epg_get_channel_list (mmyth_epg, &(scheduler_ui->channel_list)) < 0) {
renatofilho@20
   248
		g_debug ("[%s] Error while trying to retrieve channel list", __FUNCTION__);
renatofilho@20
   249
	} else {
renatofilho@20
   250
 		GList *clist =  scheduler_ui->channel_list;
renatofilho@20
   251
		GMythChannelInfo *channel_info;
renatofilho@20
   252
renatofilho@20
   253
		while (clist != NULL) {
renatofilho@20
   254
  	  		channel_info = clist->data;
renatofilho@20
   255
  	  		clist = clist->next;
renatofilho@20
   256
  	  		gtk_combo_box_append_text (GTK_COMBO_BOX (scheduler_ui->channel_combobox), 
renatofilho@20
   257
                                       (channel_info->channel_name->str));
renatofilho@20
   258
  		}
renatofilho@20
   259
renatofilho@20
   260
       gtk_combo_box_set_active(GTK_COMBO_BOX (scheduler_ui->channel_combobox), 0);
renatofilho@20
   261
  	}
renatofilho@20
   262
}
renatofilho@20
   263
renatofilho@20
   264
static void
renatofilho@20
   265
add_time_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox)
renatofilho@20
   266
{
renatofilho@20
   267
	GtkWidget *label;
renatofilho@20
   268
	GtkObject *spinbutton_adj;
renatofilho@20
   269
	GtkWidget *hbox = add_line (vbox, "Time:         ");
renatofilho@20
   270
renatofilho@20
   271
	time_t real_time;
renatofilho@20
   272
	struct tm sched_time;
renatofilho@20
   273
renatofilho@20
   274
	time(&real_time);
renatofilho@20
   275
renatofilho@20
   276
    if (localtime_r((time_t *)&real_time, &sched_time) == NULL) {
renatofilho@20
   277
        g_warning ("localtime_r error in mmyth_epg_grid_view!\n");
rosfran@244
   278
        return;
renatofilho@20
   279
    }
renatofilho@20
   280
 
renatofilho@20
   281
	if (sched_time.tm_min>30){
renatofilho@20
   282
  		sched_time.tm_hour = sched_time.tm_hour+1;
renatofilho@20
   283
  		sched_time.tm_min = 0;
renatofilho@20
   284
	} else if (sched_time.tm_min>0) {
renatofilho@20
   285
  		sched_time.tm_min = 30;
renatofilho@20
   286
	}
renatofilho@20
   287
renatofilho@20
   288
  	scheduler_ui->year_temp = (guint)sched_time.tm_year + 1900;
renatofilho@20
   289
  	scheduler_ui->month_temp = (guint)sched_time.tm_mon;
renatofilho@20
   290
  	scheduler_ui->day_temp = (guint)sched_time.tm_mday;
renatofilho@20
   291
   
renatofilho@20
   292
	//hour entry
renatofilho@20
   293
	spinbutton_adj = gtk_adjustment_new (sched_time.tm_hour, 00, 23, 1, 10, 10);
renatofilho@20
   294
	scheduler_ui->hour_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 0);
renatofilho@20
   295
	gtk_box_pack_start (GTK_BOX (hbox), scheduler_ui->hour_spinbutton, FALSE, FALSE, 0);
renatofilho@20
   296
renatofilho@20
   297
	label = gtk_label_new ((" : "));
renatofilho@20
   298
	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
renatofilho@20
   299
	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT);
renatofilho@20
   300
	gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
renatofilho@20
   301
renatofilho@20
   302
	//minute entry
renatofilho@20
   303
	spinbutton_adj = gtk_adjustment_new (sched_time.tm_min, 0, 59, 1, 10, 10);
renatofilho@20
   304
	scheduler_ui->min_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 0);
renatofilho@20
   305
	gtk_box_pack_start (GTK_BOX (hbox), scheduler_ui->min_spinbutton, FALSE, FALSE, 0);
renatofilho@20
   306
renatofilho@20
   307
	label = gtk_label_new ((" (hh:mm)"));
renatofilho@20
   308
renatofilho@20
   309
	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
renatofilho@20
   310
renatofilho@20
   311
}	
renatofilho@20
   312
renatofilho@20
   313
static void
renatofilho@20
   314
add_date_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox)
renatofilho@20
   315
{
renatofilho@20
   316
	char sched_date[24];
renatofilho@20
   317
	GtkWidget *hbox = add_line (vbox, "Date:        ");
renatofilho@20
   318
		
renatofilho@20
   319
	//sched_date = ctime(&real_time);
renatofilho@20
   320
  	g_sprintf (sched_date, "%04d %02d %02d (yyyy mm dd)", scheduler_ui->year_temp, scheduler_ui->month_temp+1, scheduler_ui->day_temp);
renatofilho@20
   321
  	sched_date[23]='\0';
renatofilho@20
   322
  
renatofilho@20
   323
  	scheduler_ui->date_button = gtk_button_new_with_label (sched_date);
renatofilho@20
   324
  	gtk_box_pack_start (GTK_BOX (hbox), scheduler_ui->date_button, FALSE, FALSE, 0);
renatofilho@20
   325
  	gtk_button_set_relief (GTK_BUTTON (scheduler_ui->date_button), GTK_RELIEF_NONE);
renatofilho@20
   326
renatofilho@20
   327
	g_signal_connect (G_OBJECT (scheduler_ui->date_button), "clicked",
renatofilho@20
   328
                      G_CALLBACK (run_calendar_dialog), scheduler_ui);
renatofilho@20
   329
renatofilho@20
   330
}
renatofilho@20
   331
renatofilho@20
   332
static void
renatofilho@20
   333
add_duration_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox)
renatofilho@20
   334
{
renatofilho@20
   335
	GtkWidget *hbox = add_line (vbox, "Duration:   ");
renatofilho@20
   336
	GtkWidget *label;
renatofilho@20
   337
	GtkObject *spinbutton_adj;
renatofilho@20
   338
	
renatofilho@20
   339
	spinbutton_adj = gtk_adjustment_new (60, 5, 360, 5, 60, 60);
renatofilho@20
   340
  	scheduler_ui->duration_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_adj), 1, 0);
renatofilho@20
   341
  	gtk_box_pack_start (GTK_BOX (hbox), scheduler_ui->duration_spinbutton, FALSE, TRUE, 0);
renatofilho@20
   342
  	gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (scheduler_ui->duration_spinbutton), TRUE);
renatofilho@20
   343
renatofilho@20
   344
	label = gtk_label_new ((" (minutes)     "));
renatofilho@20
   345
  	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
renatofilho@20
   346
}
renatofilho@20
   347
renatofilho@20
   348
static void
renatofilho@20
   349
add_frequency_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox)
renatofilho@20
   350
{
renatofilho@20
   351
	
renatofilho@20
   352
	GtkWidget *hbox = add_line (vbox, "Frequency: ");	
renatofilho@20
   353
	
renatofilho@20
   354
	scheduler_ui->freq_combobox = gtk_combo_box_new_text ();
renatofilho@20
   355
	gtk_box_pack_start (GTK_BOX (hbox), scheduler_ui->freq_combobox, FALSE, FALSE, 0);
renatofilho@20
   356
	gtk_combo_box_append_text (GTK_COMBO_BOX (scheduler_ui->freq_combobox), ("Only this day               "));
renatofilho@20
   357
	gtk_combo_box_append_text (GTK_COMBO_BOX (scheduler_ui->freq_combobox), ("Daily                            "));
renatofilho@20
   358
	gtk_combo_box_append_text (GTK_COMBO_BOX (scheduler_ui->freq_combobox), ("Weekly                         "));
renatofilho@20
   359
	gtk_combo_box_set_active(GTK_COMBO_BOX (scheduler_ui->freq_combobox), 0);
renatofilho@20
   360
renatofilho@20
   361
}
renatofilho@20
   362
renatofilho@20
   363
static void
renatofilho@20
   364
add_title_field (MMythSchedulerUI *scheduler_ui, GtkWidget *vbox)
renatofilho@20
   365
{
renatofilho@20
   366
	GtkWidget *hbox = add_line (vbox, "Title:           ");
renatofilho@20
   367
	
renatofilho@20
   368
  	scheduler_ui->title_entry = gtk_entry_new ();
renatofilho@20
   369
  	gtk_box_pack_start (GTK_BOX (hbox), scheduler_ui->title_entry, FALSE, FALSE, 0);
renatofilho@20
   370
  	gtk_entry_set_text (GTK_ENTRY (scheduler_ui->title_entry), "(Optional)");
renatofilho@20
   371
	
renatofilho@20
   372
}