"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "alarms.c" between
jpilot-1.8.2.tar.gz and jpilot-2_0_1.tar.gz

About: J-Pilot is a desktop organizer application for Palm Pilot (PalmOS) devices. Ported to GTK3.

alarms.c  (jpilot-1.8.2):alarms.c  (jpilot-2_0_1)
skipping to change at line 114 skipping to change at line 114
/****************************** Main Code *************************************/ /****************************** Main Code *************************************/
/* Alarm GUI */ /* Alarm GUI */
/* Start of Dialog window code */ /* Start of Dialog window code */
static void cb_dialog_button(GtkWidget *widget, gpointer data) static void cb_dialog_button(GtkWidget *widget, gpointer data)
{ {
struct alarm_dialog_data *Pdata; struct alarm_dialog_data *Pdata;
GtkWidget *w; GtkWidget *w;
w = gtk_widget_get_toplevel(widget); w = gtk_widget_get_toplevel(widget);
Pdata = gtk_object_get_data(GTK_OBJECT(w), "alarm"); Pdata = g_object_get_data(G_OBJECT(w), "alarm");
if (Pdata) { if (Pdata) {
Pdata->button_hit = GPOINTER_TO_INT(data); Pdata->button_hit = GPOINTER_TO_INT(data);
} }
gtk_widget_destroy(w); gtk_widget_destroy(w);
} }
static gboolean cb_destroy_dialog(GtkWidget *widget) static gboolean cb_destroy_dialog(GtkWidget *widget)
{ {
struct alarm_dialog_data *Pdata; struct alarm_dialog_data *Pdata;
time_t ltime; time_t ltime;
time_t advance; time_t advance;
time_t remind; time_t remind;
total_alarm_windows--; total_alarm_windows--;
#ifdef ALARMS_DEBUG #ifdef ALARMS_DEBUG
printf("total_alarm_windows=%d\n",total_alarm_windows); printf("total_alarm_windows=%d\n",total_alarm_windows);
#endif #endif
Pdata = gtk_object_get_data(GTK_OBJECT(widget), "alarm"); Pdata = g_object_get_data(G_OBJECT(widget), "alarm");
if (!Pdata) { if (!Pdata) {
return FALSE; return FALSE;
} }
if (Pdata->button_hit==DIALOG_SAID_2) { if (Pdata->button_hit==DIALOG_SAID_2) {
remind = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(Pdata->remind_en try)); remind = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(Pdata->remind_en try));
jp_logf(JP_LOG_DEBUG, "remind = [%d]\n", remind); jp_logf(JP_LOG_DEBUG, "remind = [%d]\n", remind);
set_pref(PREF_REMIND_IN, remind, NULL, TRUE); set_pref(PREF_REMIND_IN, remind, NULL, TRUE);
if (GTK_TOGGLE_BUTTON(Pdata->radio1)->active) { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Pdata->radio1))) {
set_pref(PREF_REMIND_UNITS, 0, NULL, TRUE); set_pref(PREF_REMIND_UNITS, 0, NULL, TRUE);
remind *= MIN_IN_SECS; remind *= MIN_IN_SECS;
} else { } else {
set_pref(PREF_REMIND_UNITS, 1, NULL, TRUE); set_pref(PREF_REMIND_UNITS, 1, NULL, TRUE);
remind *= HR_IN_SECS; remind *= HR_IN_SECS;
} }
time(&ltime); time(&ltime);
localtime(&ltime); localtime(&ltime);
advance = -(ltime + remind - Pdata->remind_time); advance = -(ltime + remind - Pdata->remind_time);
alarms_add_to_list(Pdata->unique_id, alarms_add_to_list(Pdata->unique_id,
skipping to change at line 193 skipping to change at line 193
} }
total_alarm_windows++; total_alarm_windows++;
#ifdef ALARMS_DEBUG #ifdef ALARMS_DEBUG
printf("total_alarm_windows=%d\n",total_alarm_windows); printf("total_alarm_windows=%d\n",total_alarm_windows);
#endif #endif
alarm_dialog = gtk_widget_new(GTK_TYPE_WINDOW, alarm_dialog = gtk_widget_new(GTK_TYPE_WINDOW,
"type", GTK_WINDOW_TOPLEVEL, "type", GTK_WINDOW_TOPLEVEL,
"title", title, "title", title,
NULL); NULL);
gtk_signal_connect(GTK_OBJECT(alarm_dialog), "destroy", g_signal_connect(G_OBJECT(alarm_dialog), "destroy",
GTK_SIGNAL_FUNC(cb_destroy_dialog), alarm_dialog); G_CALLBACK(cb_destroy_dialog), alarm_dialog);
gtk_window_set_transient_for(GTK_WINDOW(alarm_dialog), GTK_WINDOW(window)); gtk_window_set_transient_for(GTK_WINDOW(alarm_dialog), GTK_WINDOW(window));
gtk_window_stick(GTK_WINDOW(alarm_dialog)); gtk_window_stick(GTK_WINDOW(alarm_dialog));
vbox1 = gtk_vbox_new(FALSE, 5); vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
gtk_container_add(GTK_CONTAINER(alarm_dialog), vbox1); gtk_container_add(GTK_CONTAINER(alarm_dialog), vbox1);
hbox1 = gtk_hbox_new(FALSE, 5); hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 0);
image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG) ; image = gtk_image_new_from_icon_name("dialog-information", GTK_ICON_SIZE_DIAL OG);
gtk_box_pack_start(GTK_BOX(hbox1), image, FALSE, FALSE, 12); gtk_box_pack_start(GTK_BOX(hbox1), image, FALSE, FALSE, 12);
/* Label */ /* Label */
label = gtk_label_new(""); label = gtk_label_new("");
if (note_str[0] == '\0') { if (note_str[0] == '\0') {
markup = g_markup_printf_escaped("<b><big>%s</big></b>\n\n%s\n\n%s", markup = g_markup_printf_escaped("<b><big>%s</big></b>\n\n%s\n\n%s",
desc_str, reason, time_str); desc_str, reason, time_str);
} else { } else {
markup = g_markup_printf_escaped("<b><big>%s</big></b>\n\n%s\n\n%s\n\n%s", markup = g_markup_printf_escaped("<b><big>%s</big></b>\n\n%s\n\n%s\n\n%s",
desc_str, reason, time_str, note_str); desc_str, reason, time_str, note_str);
} }
gtk_label_set_markup(GTK_LABEL(label), markup); gtk_label_set_markup(GTK_LABEL(label), markup);
g_free(markup); g_free(markup);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 6); gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 6);
/* remind delay */ /* remind delay */
hbox1 = gtk_hbox_new(FALSE, 0); hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
remind_entry = gtk_spin_button_new_with_range(0, 59, 1); remind_entry = gtk_spin_button_new_with_range(0, 59, 1);
gtk_box_pack_start(GTK_BOX(hbox1), remind_entry, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(hbox1), remind_entry, FALSE, FALSE, 2);
vbox_temp = gtk_vbox_new(FALSE, 0); vbox_temp = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start(GTK_BOX(hbox1), vbox_temp, FALSE, TRUE, 4); gtk_box_pack_start(GTK_BOX(hbox1), vbox_temp, FALSE, TRUE, 4);
radio1 = gtk_radio_button_new_with_label(NULL, _("Minutes")); radio1 = gtk_radio_button_new_with_label(NULL, _("Minutes"));
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio1)); group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio1));
radio2 = gtk_radio_button_new_with_label(group, _("Hours")); radio2 = gtk_radio_button_new_with_label(group, _("Hours"));
gtk_radio_button_group(GTK_RADIO_BUTTON(radio2)); gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio2));
gtk_box_pack_start(GTK_BOX(vbox_temp), radio1, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox_temp), radio1, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox_temp), radio2, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox_temp), radio2, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 2); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 2);
get_pref(PREF_REMIND_IN, &pref_entry, NULL); get_pref(PREF_REMIND_IN, &pref_entry, NULL);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(remind_entry), pref_entry); gtk_spin_button_set_value(GTK_SPIN_BUTTON(remind_entry), pref_entry);
get_pref(PREF_REMIND_UNITS, &pref_units, NULL); get_pref(PREF_REMIND_UNITS, &pref_units, NULL);
if (pref_units) { if (pref_units) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio2), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio2), TRUE);
} else { } else {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio1), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio1), TRUE);
} }
/* Buttons */ /* Buttons */
gtk_container_set_border_width(GTK_CONTAINER(hbox1), 12); gtk_container_set_border_width(GTK_CONTAINER(hbox1), 12);
button = gtk_button_new_with_label(_("Remind me")); button = gtk_button_new_with_label(_("Remind me"));
gtk_signal_connect(GTK_OBJECT(button), "clicked", g_signal_connect(G_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(cb_dialog_button), G_CALLBACK(cb_dialog_button),
GINT_TO_POINTER(DIALOG_SAID_2)); GINT_TO_POINTER(DIALOG_SAID_2));
gtk_box_pack_start(GTK_BOX(hbox1), button, TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(hbox1), button, TRUE, TRUE, 4);
button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); button = gtk_button_new_with_label("Close");
gtk_signal_connect(GTK_OBJECT(button), "clicked", g_signal_connect(G_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(cb_dialog_button), G_CALLBACK(cb_dialog_button),
GINT_TO_POINTER(DIALOG_SAID_1)); GINT_TO_POINTER(DIALOG_SAID_1));
gtk_box_pack_start(GTK_BOX(hbox1), button, TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(hbox1), button, TRUE, TRUE, 4);
Pdata = malloc(sizeof(struct alarm_dialog_data)); Pdata = malloc(sizeof(struct alarm_dialog_data));
if (Pdata) { if (Pdata) {
Pdata->unique_id = unique_id; Pdata->unique_id = unique_id;
Pdata->remind_time = remind_time; Pdata->remind_time = remind_time;
/* Set the default button pressed to OK */ /* Set the default button pressed to OK */
Pdata->button_hit = DIALOG_SAID_1; Pdata->button_hit = DIALOG_SAID_1;
Pdata->remind_entry=remind_entry; Pdata->remind_entry=remind_entry;
Pdata->radio1=radio1; Pdata->radio1=radio1;
Pdata->radio2=radio2; Pdata->radio2=radio2;
} }
gtk_object_set_data(GTK_OBJECT(alarm_dialog), "alarm", Pdata); g_object_set_data(G_OBJECT(alarm_dialog), "alarm", Pdata);
gtk_widget_show_all(alarm_dialog); gtk_widget_show_all(alarm_dialog);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
/* End Alarm GUI */ /* End Alarm GUI */
static time_t tm_copy_with_dst_adj(struct tm *dest, struct tm *src) static time_t tm_copy_with_dst_adj(struct tm *dest, struct tm *src)
{ {
memcpy(dest, src, sizeof(struct tm)); memcpy(dest, src, sizeof(struct tm));
skipping to change at line 669 skipping to change at line 669
alarms_do_one(&(temp_al->mcale.cale), alarms_do_one(&(temp_al->mcale.cale),
temp_alarm->unique_id, temp_alarm->unique_id,
temp_alarm->event_time, temp_alarm->event_time,
ALARM_MISSED); ALARM_MISSED);
break; break;
} }
} }
/* CAUTION, this modifies the list we are parsing and /* CAUTION, this modifies the list we are parsing and
* removes the current node */ * removes the current node */
if (temp_al) if (temp_al)
alarms_remove_from_to_list(temp_al->mcale.unique_id); alarms_remove_from_to_list(temp_al->mcale.unique_id);
} }
if (next_alarm) { if (next_alarm) {
diff = next_alarm->event_time - t - next_alarm->alarm_advance; diff = next_alarm->event_time - t - next_alarm->alarm_advance;
if (diff <= ALARM_INTERVAL/2) { if (diff <= ALARM_INTERVAL/2) {
if (alm_list==NULL) { if (alm_list==NULL) {
get_days_calendar_events2(&alm_list, NULL, 0, 0, 1, CATEGORY_ALL, NU LL); get_days_calendar_events2(&alm_list, NULL, 0, 0, 1, CATEGORY_ALL, NU LL);
} }
for (temp_alarm=next_alarm; temp_alarm; temp_alarm=ta_next) { for (temp_alarm=next_alarm; temp_alarm; temp_alarm=ta_next) {
for (temp_al = alm_list; temp_al; temp_al=temp_al->next) { for (temp_al = alm_list; temp_al; temp_al=temp_al->next) {
skipping to change at line 1064 skipping to change at line 1064
tm1.tm_isdst=-1; tm1.tm_isdst=-1;
mktime(&tm1); mktime(&tm1);
alarms_find_next(&tm1, &now, FALSE); alarms_find_next(&tm1, &now, FALSE);
/* Pop up reminder windows for expired alarms immediately /* Pop up reminder windows for expired alarms immediately
* rather than waiting ALARM_INTERVAL seconds and then doing it */ * rather than waiting ALARM_INTERVAL seconds and then doing it */
cb_timer_alarms(NULL); cb_timer_alarms(NULL);
gtk_timeout_add(ALARM_INTERVAL*CLOCK_TICK, cb_timer_alarms, NULL); g_timeout_add(ALARM_INTERVAL*CLOCK_TICK, cb_timer_alarms, NULL);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
 End of changes. 16 change blocks. 
20 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)