renatofilho@20: #include <gtk/gtk.h>
renatofilho@20: #include <glib.h>
renatofilho@20: #include <glib/gprintf.h>
renatofilho@20: #include <sys/types.h>
renatofilho@20: #include <sys/stat.h>
renatofilho@20: #include <unistd.h>
renatofilho@20: #include <string.h>
renatofilho@20: #include <stdio.h>
renatofilho@20: 
renatofilho@20: #include "mmyth_ui.h"
renatofilho@20: #include "mmyth_uicommon.h"
renatofilho@20: #include "mmyth_recordui.h"
renatofilho@20: #include "mmyth_schedulerui.h"
renatofilho@20: 
renatofilho@754: /*
renatofilho@754:  * GMyth library includes 
renatofilho@754:  */
rosfran@244: #include <gmyth/gmyth_scheduler.h>
rosfran@244: #include <gmyth/gmyth_common.h>
rosfran@244: #include <gmyth/gmyth_epg.h>
renatofilho@20: 
renatofilho@754: static void     run_calendar_dialog(GtkButton * button, gpointer data);
renatofilho@20: 
renatofilho@754: static void     add_channel_field(MMythSchedulerUI * scheduler_ui,
renatofilho@754:                                   GtkWidget * vbox);
renatofilho@754: static void     add_time_field(MMythSchedulerUI * scheduler_ui,
renatofilho@754:                                GtkWidget * vbox);
renatofilho@754: static void     add_date_field(MMythSchedulerUI * scheduler_ui,
renatofilho@754:                                GtkWidget * vbox);
renatofilho@754: static void     add_duration_field(MMythSchedulerUI * scheduler_ui,
renatofilho@754:                                    GtkWidget * vbox);
renatofilho@754: static void     add_frequency_field(MMythSchedulerUI * scheduler_ui,
renatofilho@754:                                     GtkWidget * vbox);
renatofilho@754: static void     add_title_field(MMythSchedulerUI * scheduler_ui,
renatofilho@754:                                 GtkWidget * vbox);
renatofilho@20: 
renatofilho@754: MMythSchedulerUI *
renatofilho@754: mmyth_schedulerui_new(GMythBackendInfo * backend_info)
renatofilho@20: {
renatofilho@754:     GtkWidget      *scrolledwindow;
renatofilho@754:     GtkWidget      *viewport;
renatofilho@754:     GtkWidget      *head_hbox;
renatofilho@754:     GtkWidget      *fields_vbox;
renatofilho@754:     GtkWidget      *hseparator;
renatofilho@754:     GtkWidget      *label;
renatofilho@20: 
renatofilho@754:     MMythSchedulerUI *scheduler_ui = g_new0(MMythSchedulerUI, 1);
rosfran@244: 
renatofilho@754:     scheduler_ui->backend_info = backend_info;
renatofilho@20: 
renatofilho@754:     scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
renatofilho@754:     scheduler_ui->main_widget = scrolledwindow;
renatofilho@754:     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow),
renatofilho@754:                                    GTK_POLICY_AUTOMATIC,
renatofilho@754:                                    GTK_POLICY_AUTOMATIC);
renatofilho@20: 
renatofilho@754:     // Is this needed? 
renatofilho@754:     viewport = gtk_viewport_new(NULL, NULL);
renatofilho@754:     gtk_container_add(GTK_CONTAINER(scrolledwindow), viewport);
renatofilho@20: 
renatofilho@754:     // Is this needed?
renatofilho@754:     head_hbox = gtk_hbox_new(FALSE, 0);
renatofilho@754:     gtk_container_add(GTK_CONTAINER(viewport), head_hbox);
renatofilho@20: 
renatofilho@754:     fields_vbox = gtk_vbox_new(FALSE, 0);
renatofilho@754:     gtk_box_pack_start(GTK_BOX(head_hbox), fields_vbox, TRUE, TRUE, 0);
renatofilho@754:     gtk_container_set_border_width(GTK_CONTAINER(fields_vbox), 10);
renatofilho@20: 
renatofilho@754:     label = gtk_label_new_with_mnemonic(("Manual Schedule Recording"));
renatofilho@754:     gtk_box_pack_start(GTK_BOX(fields_vbox), label, FALSE, FALSE, 0);
renatofilho@754:     gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
renatofilho@20: 
renatofilho@754:     hseparator = gtk_hseparator_new();
renatofilho@754:     gtk_box_pack_start(GTK_BOX(fields_vbox), hseparator, FALSE, TRUE, 0);
renatofilho@754: 
renatofilho@754:     add_channel_field(scheduler_ui, fields_vbox);
renatofilho@754:     add_time_field(scheduler_ui, fields_vbox);
renatofilho@754:     add_date_field(scheduler_ui, fields_vbox);
renatofilho@754:     add_duration_field(scheduler_ui, fields_vbox);
renatofilho@754:     add_frequency_field(scheduler_ui, fields_vbox);
renatofilho@754:     add_title_field(scheduler_ui, fields_vbox);
renatofilho@754: 
renatofilho@754:     return scheduler_ui;
renatofilho@20: }
renatofilho@20: 
renatofilho@20: static void
renatofilho@754: set_date_from_calendar(GtkCalendar * calendar, gpointer data)
renatofilho@20: {
renatofilho@754:     char            sched_date[24];
renatofilho@20: 
renatofilho@754:     MMythSchedulerUI *scheduler_ui = (MMythSchedulerUI *) data;
renatofilho@20: 
renatofilho@754:     // FIXME: Change this, save another value instead of month_temp,
renatofilho@754:     // day_temp, ... 
renatofilho@754:     gtk_calendar_get_date(GTK_CALENDAR(calendar),
renatofilho@754:                           &(scheduler_ui->year_temp),
renatofilho@754:                           &(scheduler_ui->month_temp),
renatofilho@754:                           &(scheduler_ui->day_temp));
renatofilho@20: 
renatofilho@754:     sched_date[23] = '\0';
renatofilho@754:     g_sprintf(sched_date, "%04d %02d %02d (yyyy mm dd)",
renatofilho@754:               scheduler_ui->year_temp, scheduler_ui->month_temp + 1,
renatofilho@754:               scheduler_ui->day_temp);
renatofilho@20: 
renatofilho@754:     gtk_button_set_label(GTK_BUTTON(scheduler_ui->date_button),
renatofilho@754:                          sched_date);
renatofilho@20: 
renatofilho@754:     gtk_widget_destroy(scheduler_ui->calendar_dialog);
renatofilho@754:     scheduler_ui->calendar_dialog = NULL;
renatofilho@754:     scheduler_ui->calendar = NULL;
renatofilho@20: }
renatofilho@20: 
renatofilho@754: // calendar
renatofilho@20: static void
renatofilho@754: run_calendar_dialog(GtkButton * button, gpointer data)
renatofilho@20: {
renatofilho@20: 
renatofilho@754:     GtkWidget      *dialog_vbox;
renatofilho@754:     MMythSchedulerUI *scheduler_ui = (MMythSchedulerUI *) data;
renatofilho@20: 
renatofilho@754:     // calendar_dialog and calendar are been released at
renatofilho@754:     // set_date_from_calendar ()
renatofilho@754:     scheduler_ui->calendar_dialog = gtk_dialog_new();
renatofilho@754:     gtk_container_set_border_width(GTK_CONTAINER
renatofilho@754:                                    (scheduler_ui->calendar_dialog), 1);
renatofilho@754:     gtk_window_set_title(GTK_WINDOW(scheduler_ui->calendar_dialog),
renatofilho@754:                          "Select starting date");
renatofilho@754:     gtk_window_set_position(GTK_WINDOW(scheduler_ui->calendar_dialog),
renatofilho@754:                             GTK_WIN_POS_CENTER);
renatofilho@754:     gtk_window_set_decorated(GTK_WINDOW(scheduler_ui->calendar_dialog),
renatofilho@754:                              FALSE);
renatofilho@20: 
renatofilho@754:     dialog_vbox = GTK_DIALOG(scheduler_ui->calendar_dialog)->vbox;
renatofilho@20: 
renatofilho@754:     scheduler_ui->calendar = gtk_calendar_new();
renatofilho@20: 
renatofilho@754:     gtk_box_pack_start(GTK_BOX(dialog_vbox), scheduler_ui->calendar, TRUE,
renatofilho@754:                        TRUE, 0);
renatofilho@754:     gtk_calendar_display_options(GTK_CALENDAR(scheduler_ui->calendar),
renatofilho@754:                                  GTK_CALENDAR_SHOW_HEADING |
renatofilho@754:                                  GTK_CALENDAR_SHOW_DAY_NAMES);
renatofilho@20: 
renatofilho@754:     gtk_widget_show_all(scheduler_ui->calendar_dialog);
renatofilho@20: 
renatofilho@754:     g_signal_connect(G_OBJECT(scheduler_ui->calendar),
renatofilho@754:                      "day-selected-double-click",
renatofilho@754:                      G_CALLBACK(set_date_from_calendar), data);
renatofilho@20: }
renatofilho@20: 
renatofilho@20: 
renatofilho@20: gboolean
renatofilho@754: mmyth_schedulerui_save(MMythSchedulerUI * scheduler_ui)
renatofilho@20: {
renatofilho@754:     GMythScheduler *scheduler;
renatofilho@754:     ScheduleInfo   *schedule_info;
renatofilho@754:     GMythChannelInfo *channel_info;
renatofilho@20: 
renatofilho@754:     GList          *clist;
renatofilho@754:     gint            index,
renatofilho@754:                     duration;
renatofilho@754:     gint            frequency;
renatofilho@754:     struct tm       start_tm;
rosfran@244: 
renatofilho@754:     schedule_info = g_new0(ScheduleInfo, 1);
renatofilho@754:     if (schedule_info == NULL) {
renatofilho@754:         g_warning("Error allocating memory");
renatofilho@754:         return FALSE;
renatofilho@754:     }
renatofilho@20: 
renatofilho@754:     clist = scheduler_ui->channel_list;
rosfran@244: 
renatofilho@754:     index =
renatofilho@754:         gtk_combo_box_get_active(GTK_COMBO_BOX
renatofilho@754:                                  (scheduler_ui->channel_combobox));
rosfran@244: 
renatofilho@754:     if (clist != NULL)
renatofilho@754:         clist = g_list_nth(clist, index);
rosfran@244: 
renatofilho@754:     if (clist) {
renatofilho@754:         g_debug("[%s] New schedule: %d", __FUNCTION__, index);
renatofilho@754:     } else {
renatofilho@754:         g_warning("[%s] Error when adding new schedule", __FUNCTION__);
renatofilho@754:         return FALSE;
renatofilho@754:     }
rosfran@244: 
renatofilho@754:     channel_info = clist->data;
rosfran@244: 
renatofilho@754:     /*
renatofilho@754:      * initialize schedule_info 
renatofilho@754:      */
renatofilho@754:     schedule_info->channel_id = channel_info->channel_ID;
rosfran@244: 
renatofilho@754:     start_tm.tm_hour =
renatofilho@754:         (int)
renatofilho@754:         gtk_spin_button_get_value(GTK_SPIN_BUTTON
renatofilho@754:                                   (scheduler_ui->hour_spinbutton));
renatofilho@754:     start_tm.tm_min =
renatofilho@754:         (int)
renatofilho@754:         gtk_spin_button_get_value(GTK_SPIN_BUTTON
renatofilho@754:                                   (scheduler_ui->min_spinbutton));
renatofilho@754:     start_tm.tm_sec = 0;
renatofilho@20: 
renatofilho@754:     start_tm.tm_mday = (gint) scheduler_ui->day_temp;
renatofilho@754:     start_tm.tm_mon = (gint) scheduler_ui->month_temp;
renatofilho@754:     start_tm.tm_year = (gint) scheduler_ui->year_temp - 1900;   // years
renatofilho@754:                                                                 // since
renatofilho@754:                                                                 // 1900
renatofilho@754:     GTimeVal       *time_val_local = g_new0(GTimeVal, 1);
renatofilho@754:     time_val_local->tv_sec = timelocal(&start_tm);
renatofilho@20: 
renatofilho@754:     schedule_info->start_time = time_val_local;
renatofilho@754:     if (NULL == schedule_info->start_time) {
renatofilho@754:         g_warning("timelocal error!\n");
renatofilho@754:         return FALSE;
renatofilho@754:     }
renatofilho@20: 
renatofilho@754:     duration =
renatofilho@754:         (gint)
renatofilho@754:         gtk_spin_button_get_value(GTK_SPIN_BUTTON
renatofilho@754:                                   (scheduler_ui->duration_spinbutton));
renatofilho@754:     schedule_info->end_time = schedule_info->start_time + (duration * 60);
renatofilho@20: 
renatofilho@754:     /*
renatofilho@754:      * TODO: frequency is not implemented yet 
renatofilho@754:      */
renatofilho@754:     frequency =
renatofilho@754:         gtk_combo_box_get_active(GTK_COMBO_BOX
renatofilho@754:                                  (scheduler_ui->freq_combobox));
renatofilho@20: 
renatofilho@754:     schedule_info->title = g_string_new("");
renatofilho@754:     g_string_printf(schedule_info->title, "%s",
renatofilho@754:                     gtk_entry_get_text(GTK_ENTRY
renatofilho@754:                                        (scheduler_ui->title_entry)));
renatofilho@20: 
renatofilho@754:     /*
renatofilho@754:      * FIXME: Architecture change to reuse the scheduler created in the
renatofilho@754:      * recordui! 
renatofilho@754:      */
renatofilho@754:     scheduler = gmyth_scheduler_new();
renatofilho@20: 
renatofilho@754:     gmyth_scheduler_connect(scheduler, scheduler->backend_info);
renatofilho@20: 
renatofilho@754:     /*
renatofilho@754:      * FIXME: set record_id = -1 to add a new schedule 
renatofilho@754:      */
renatofilho@754:     schedule_info->record_id = -1;
renatofilho@754:     gmyth_scheduler_add_schedule(scheduler, schedule_info);
rosfran@244: 
renatofilho@754:     gmyth_scheduler_disconnect(scheduler);
rosfran@244: 
renatofilho@754:     /*
renatofilho@754:      * free allocated memory 
renatofilho@754:      */
renatofilho@754:     g_object_unref(scheduler);
renatofilho@754:     g_free(schedule_info);
rosfran@244: 
renatofilho@754:     return TRUE;
renatofilho@754: }
renatofilho@20: 
renatofilho@754: static GtkWidget *
renatofilho@754: add_line(GtkWidget * vbox, const gchar * str)
renatofilho@20: {
renatofilho@754:     GtkWidget      *label;
renatofilho@754:     GtkWidget      *hbox = gtk_hbox_new(FALSE, 0);
renatofilho@20: 
renatofilho@754:     gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
renatofilho@754:     gtk_container_set_border_width(GTK_CONTAINER(hbox), 3);
renatofilho@20: 
renatofilho@754:     label = gtk_label_new(str);
renatofilho@754:     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
renatofilho@754:     gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
renatofilho@754: 
renatofilho@754:     return hbox;
renatofilho@20: }
renatofilho@20: 
renatofilho@20: static void
renatofilho@754: add_channel_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox)
renatofilho@20: {
renatofilho@754:     GtkWidget      *combobox;
renatofilho@20: 
renatofilho@754:     GtkWidget      *hbox = add_line(vbox, "Channel:    ");
renatofilho@20: 
renatofilho@754:     combobox = gtk_combo_box_new_text();
renatofilho@20: 
renatofilho@754:     scheduler_ui->channel_combobox = combobox;
renatofilho@754:     gtk_box_pack_start(GTK_BOX(hbox), combobox, FALSE, FALSE, 0);
renatofilho@754: 
renatofilho@754:     GMythEPG       *mmyth_epg = gmyth_epg_new();
renatofilho@754:     if (!gmyth_epg_connect(mmyth_epg, scheduler_ui->backend_info)) {
renatofilho@754:         // FIXME: Without this list the scheduler UI should not be shown!
renatofilho@754:         g_warning("[%s] Error when getting list of channels",
renatofilho@754:                   __FUNCTION__);
renatofilho@754:     }
renatofilho@754: 
renatofilho@754:     if (gmyth_epg_get_channel_list
renatofilho@754:         (mmyth_epg, &(scheduler_ui->channel_list)) < 0) {
renatofilho@754:         g_debug("[%s] Error while trying to retrieve channel list",
renatofilho@754:                 __FUNCTION__);
renatofilho@754:     } else {
renatofilho@754:         GList          *clist = scheduler_ui->channel_list;
renatofilho@754:         GMythChannelInfo *channel_info;
renatofilho@754: 
renatofilho@754:         while (clist != NULL) {
renatofilho@754:             channel_info = clist->data;
renatofilho@754:             clist = clist->next;
renatofilho@754:             gtk_combo_box_append_text(GTK_COMBO_BOX
renatofilho@754:                                       (scheduler_ui->channel_combobox),
renatofilho@754:                                       (channel_info->channel_name->str));
renatofilho@754:         }
renatofilho@754: 
renatofilho@754:         gtk_combo_box_set_active(GTK_COMBO_BOX
renatofilho@754:                                  (scheduler_ui->channel_combobox), 0);
renatofilho@754:     }
renatofilho@20: }
renatofilho@20: 
renatofilho@20: static void
renatofilho@754: add_time_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox)
renatofilho@20: {
renatofilho@754:     GtkWidget      *label;
renatofilho@754:     GtkObject      *spinbutton_adj;
renatofilho@754:     GtkWidget      *hbox = add_line(vbox, "Time:         ");
renatofilho@20: 
renatofilho@754:     time_t          real_time;
renatofilho@754:     struct tm       sched_time;
renatofilho@20: 
renatofilho@754:     time(&real_time);
renatofilho@20: 
renatofilho@754:     if (localtime_r((time_t *) & real_time, &sched_time) == NULL) {
renatofilho@754:         g_warning("localtime_r error in mmyth_epg_grid_view!\n");
rosfran@244:         return;
renatofilho@20:     }
renatofilho@20: 
renatofilho@754:     if (sched_time.tm_min > 30) {
renatofilho@754:         sched_time.tm_hour = sched_time.tm_hour + 1;
renatofilho@754:         sched_time.tm_min = 0;
renatofilho@754:     } else if (sched_time.tm_min > 0) {
renatofilho@754:         sched_time.tm_min = 30;
renatofilho@754:     }
renatofilho@20: 
renatofilho@754:     scheduler_ui->year_temp = (guint) sched_time.tm_year + 1900;
renatofilho@754:     scheduler_ui->month_temp = (guint) sched_time.tm_mon;
renatofilho@754:     scheduler_ui->day_temp = (guint) sched_time.tm_mday;
renatofilho@20: 
renatofilho@754:     // hour entry
renatofilho@754:     spinbutton_adj =
renatofilho@754:         gtk_adjustment_new(sched_time.tm_hour, 00, 23, 1, 10, 10);
renatofilho@754:     scheduler_ui->hour_spinbutton =
renatofilho@754:         gtk_spin_button_new(GTK_ADJUSTMENT(spinbutton_adj), 1, 0);
renatofilho@754:     gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->hour_spinbutton, FALSE,
renatofilho@754:                        FALSE, 0);
renatofilho@20: 
renatofilho@754:     label = gtk_label_new((" : "));
renatofilho@754:     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
renatofilho@754:     gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT);
renatofilho@754:     gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
renatofilho@20: 
renatofilho@754:     // minute entry
renatofilho@754:     spinbutton_adj =
renatofilho@754:         gtk_adjustment_new(sched_time.tm_min, 0, 59, 1, 10, 10);
renatofilho@754:     scheduler_ui->min_spinbutton =
renatofilho@754:         gtk_spin_button_new(GTK_ADJUSTMENT(spinbutton_adj), 1, 0);
renatofilho@754:     gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->min_spinbutton, FALSE,
renatofilho@754:                        FALSE, 0);
renatofilho@20: 
renatofilho@754:     label = gtk_label_new((" (hh:mm)"));
renatofilho@20: 
renatofilho@754:     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
renatofilho@20: 
renatofilho@20: }
renatofilho@20: 
renatofilho@20: static void
renatofilho@754: add_date_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox)
renatofilho@20: {
renatofilho@754:     char            sched_date[24];
renatofilho@754:     GtkWidget      *hbox = add_line(vbox, "Date:        ");
renatofilho@20: 
renatofilho@754:     // sched_date = ctime(&real_time);
renatofilho@754:     g_sprintf(sched_date, "%04d %02d %02d (yyyy mm dd)",
renatofilho@754:               scheduler_ui->year_temp, scheduler_ui->month_temp + 1,
renatofilho@754:               scheduler_ui->day_temp);
renatofilho@754:     sched_date[23] = '\0';
renatofilho@20: 
renatofilho@754:     scheduler_ui->date_button = gtk_button_new_with_label(sched_date);
renatofilho@754:     gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->date_button, FALSE,
renatofilho@754:                        FALSE, 0);
renatofilho@754:     gtk_button_set_relief(GTK_BUTTON(scheduler_ui->date_button),
renatofilho@754:                           GTK_RELIEF_NONE);
renatofilho@754: 
renatofilho@754:     g_signal_connect(G_OBJECT(scheduler_ui->date_button), "clicked",
renatofilho@754:                      G_CALLBACK(run_calendar_dialog), scheduler_ui);
renatofilho@20: 
renatofilho@20: }
renatofilho@20: 
renatofilho@20: static void
renatofilho@754: add_duration_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox)
renatofilho@20: {
renatofilho@754:     GtkWidget      *hbox = add_line(vbox, "Duration:   ");
renatofilho@754:     GtkWidget      *label;
renatofilho@754:     GtkObject      *spinbutton_adj;
renatofilho@754: 
renatofilho@754:     spinbutton_adj = gtk_adjustment_new(60, 5, 360, 5, 60, 60);
renatofilho@754:     scheduler_ui->duration_spinbutton =
renatofilho@754:         gtk_spin_button_new(GTK_ADJUSTMENT(spinbutton_adj), 1, 0);
renatofilho@754:     gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->duration_spinbutton,
renatofilho@754:                        FALSE, TRUE, 0);
renatofilho@754:     gtk_spin_button_set_numeric(GTK_SPIN_BUTTON
renatofilho@754:                                 (scheduler_ui->duration_spinbutton), TRUE);
renatofilho@754: 
renatofilho@754:     label = gtk_label_new((" (minutes)     "));
renatofilho@754:     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
renatofilho@20: }
renatofilho@754: 
renatofilho@754: static void
renatofilho@754: add_frequency_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox)
renatofilho@754: {
renatofilho@754: 
renatofilho@754:     GtkWidget      *hbox = add_line(vbox, "Frequency: ");
renatofilho@754: 
renatofilho@754:     scheduler_ui->freq_combobox = gtk_combo_box_new_text();
renatofilho@754:     gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->freq_combobox, FALSE,
renatofilho@754:                        FALSE, 0);
renatofilho@754:     gtk_combo_box_append_text(GTK_COMBO_BOX(scheduler_ui->freq_combobox),
renatofilho@754:                               ("Only this day               "));
renatofilho@754:     gtk_combo_box_append_text(GTK_COMBO_BOX(scheduler_ui->freq_combobox),
renatofilho@754:                               ("Daily                            "));
renatofilho@754:     gtk_combo_box_append_text(GTK_COMBO_BOX(scheduler_ui->freq_combobox),
renatofilho@754:                               ("Weekly                         "));
renatofilho@754:     gtk_combo_box_set_active(GTK_COMBO_BOX(scheduler_ui->freq_combobox),
renatofilho@754:                              0);
renatofilho@754: 
renatofilho@754: }
renatofilho@754: 
renatofilho@754: static void
renatofilho@754: add_title_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox)
renatofilho@754: {
renatofilho@754:     GtkWidget      *hbox = add_line(vbox, "Title:           ");
renatofilho@754: 
renatofilho@754:     scheduler_ui->title_entry = gtk_entry_new();
renatofilho@754:     gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->title_entry, FALSE,
renatofilho@754:                        FALSE, 0);
renatofilho@754:     gtk_entry_set_text(GTK_ENTRY(scheduler_ui->title_entry), "(Optional)");
renatofilho@754: 
renatofilho@754: }