Browse Source

add a "duplicate alarm" button, and bugfixes

* close all windows when unloading the module
* "execute command" has a normal size now
* title changes for configuration windows
* save configuration at every change


SVN revision: 28179
master
kiwi 16 years ago committed by kiwi
parent
commit
0aec97bd92
  1. 6
      TODO
  2. 41
      e_mod_config.c
  3. 5
      e_mod_config_alarm.c
  4. 54
      e_mod_main.c
  5. 1
      e_mod_main.h

6
TODO

@ -11,6 +11,8 @@ TODO
- snooze program ?
- [Config_Dialog] sort alarms list by 'next time ring' order
- add predefined alarms action like command is not user friendly
- full size popup like exebuf when ringing
- alarm logo like an e, instead of alarm clock image, a bit like on e_module
@ -23,3 +25,7 @@ TODO
- dont share state for icons and detail between instance
and save it
- "Time table" button
to add alarms for a whole week for example
does it create multiple alarms, or time tables are objects ?

41
e_mod_config.c

@ -32,6 +32,7 @@ static void _cb_alarms_list(void *data);
static void _cb_alarm_add(void *data, void *data2);
static void _cb_alarm_del(void *data, void *data2);
static void _cb_alarm_config(void *data, void *data2);
static void _cb_alarm_duplicate(void *data, void *data2);
void
alarm_config_module(void)
@ -160,14 +161,16 @@ _common_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *c
e_widget_ilist_selector_set(ob, 1);
cfdata->alarms_ilist = ob;
alarm_config_refresh_alarms_ilist(cfdata);
e_widget_frametable_object_append(of, ob, 0, 1, 3, 1, 1, 1, 1, 1);
e_widget_frametable_object_append(of, ob, 0, 1, 6, 1, 1, 1, 1, 1);
ob = e_widget_button_add(evas, _("Add"), NULL, _cb_alarm_add, cfdata, NULL);
e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 1, 1, 1);
e_widget_frametable_object_append(of, ob, 0, 2, 2, 1, 1, 1, 1, 1);
ob = e_widget_button_add(evas, _("Delete"), NULL, _cb_alarm_del, cfdata, NULL);
e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 1, 1, 1);
e_widget_frametable_object_append(of, ob, 2, 2, 2, 1, 1, 1, 1, 1);
ob = e_widget_button_add(evas, _("Configure"), NULL, _cb_alarm_config, cfdata, NULL);
e_widget_frametable_object_append(of, ob, 2, 2, 1, 1, 1, 1, 1, 1);
e_widget_frametable_object_append(of, ob, 4, 2, 1, 1, 1, 1, 1, 1);
ob = e_widget_button_add(evas, _("Duplicate"), NULL, _cb_alarm_duplicate, cfdata, NULL);
e_widget_frametable_object_append(of, ob, 5, 2, 1, 1, 1, 1, 1, 1);
e_widget_table_object_append(o, of, 0, 0, 1, 2, 1, 1, 1, 1);
}
@ -215,12 +218,12 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
{
Evas_Object *o, *of, *ob;
o = e_widget_table_add(evas, 1);
o = e_widget_table_add(evas, 0);
_common_create_widgets(cfd, evas, cfdata, o);
of = e_widget_frametable_add(evas, D_("Alarm Options"), 1);
of = e_widget_frametable_add(evas, D_("Alarm Options"), 0);
/*
ob = e_widget_label_add(evas, D_("Time format"));
@ -238,7 +241,7 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
e_widget_table_object_append(o, of, 1, 0, 1, 1, 1, 0, 1, 0);
of = e_widget_frametable_add(evas, D_("Alarms Defaults"), 1);
of = e_widget_frametable_add(evas, D_("Alarms Defaults"), 0);
ob = e_widget_check_add(evas, D_("Open popup"), &(cfdata->alarms_open_popup_default));
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 1);
@ -331,3 +334,27 @@ _cb_alarm_config(void *data, void *data2)
alarm_config_alarm(al);
}
static void
_cb_alarm_duplicate(void *data, void *data2)
{
E_Config_Dialog_Data *cfdata;
Alarm *al, *al_new;
cfdata = data;
al = evas_list_nth(alarm_config->alarms,
e_widget_ilist_selected_get(cfdata->alarms_ilist));
if (!al) return;
al_new = alarm_alarm_duplicate(al);
alarm_config->alarms = evas_list_append(alarm_config->alarms, al_new);
/* refresh things */
if (alarm_config->config_dialog)
{
E_Config_Dialog_Data *mcda;
mcda = alarm_config->config_dialog->cfdata;
alarm_config_refresh_alarms_ilist(mcda);
}
}

5
e_mod_config_alarm.c

@ -68,7 +68,7 @@ alarm_config_alarm(Alarm *al)
snprintf(buf, sizeof(buf), "%s/module.edj", e_module_dir_get(alarm_config->module));
cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
D_("Alarm Alarm Configuration"), "Alarm", "_e_modules_alarm_alarm_config_dialog", buf, 0, v, al);
D_("Alarm Configuration : Setup an alarm"), "Alarm", "_e_modules_alarm_alarm_config_dialog", buf, 0, v, al);
}
static void *
@ -325,6 +325,9 @@ _common_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
cfdata->new = 0;
cfdata->al = al;
al->config_dialog = cfd;
alarm_config->config_dialog_alarm_new = NULL;
/* refresh things */
if (alarm_config->config_dialog)
{

54
e_mod_main.c

@ -118,6 +118,8 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
break;
}
e_config_save_queue();
return gcc;
}
@ -130,6 +132,8 @@ _gc_shutdown(E_Gadcon_Client *gcc)
evas_object_del(inst->obj);
alarm_config->instances = evas_list_remove(alarm_config->instances, inst);
free(inst);
e_config_save_queue();
}
static void
@ -326,6 +330,41 @@ alarm_alarm_del(Alarm *al)
}
}
Alarm *
alarm_alarm_duplicate(Alarm *al)
{
Alarm *al_new;
al_new = E_NEW(Alarm, 1);
if (al->name)
al_new->name = evas_stringshare_add(al->name);
al_new->state = al->state;
if (al->description)
al_new->description = evas_stringshare_add(al->description);
al_new->autoremove = al->autoremove;
al_new->open_popup = al->open_popup;
al_new->run_program = al->run_program;
if (al->program)
al_new->program = evas_stringshare_add(al->program);
al_new->sched.type = al->sched.type;
al_new->sched.date_epoch = al->sched.date_epoch;
al_new->sched.hour = al->sched.hour;
al_new->sched.minute = al->sched.minute;
al_new->sched.day_monday = al->sched.day_monday;
al_new->sched.day_tuesday = al->sched.day_tuesday;
al_new->sched.day_wenesday = al->sched.day_wenesday;
al_new->sched.day_thursday = al->sched.day_thursday;
al_new->sched.day_friday = al->sched.day_friday;
al_new->sched.day_saturday = al->sched.day_saturday;
al_new->sched.day_sunday = al->sched.day_sunday;
al_new->snooze.hour = al->snooze.hour;
al_new->snooze.minute = al->snooze.minute;
al_new->snooze.remember = al->snooze.remember;
return al_new;
}
int
alarm_alarm_ring(Alarm *al, int test)
{
@ -380,6 +419,8 @@ alarm_alarm_ring(Alarm *al, int test)
if (alarm_config->alarms_details)
alarm_edje_refresh_details();
e_config_save_queue();
return ret;
}
@ -416,6 +457,8 @@ alarm_alarm_ring_stop(Alarm *al, int check)
alarm_edje_signal_emit(EDJE_SIG_SEND_ALARM_STATE_ON);
alarm_config->alarms_state = ALARM_STATE_ON;
}
e_config_save_queue();
}
void
@ -634,6 +677,8 @@ _alarm_cb_dialog_snooze_ok(void *data, E_Dialog *dia)
al->snooze.remember = 1;
al->snooze.etimer = ecore_timer_add(time, _cb_alarm_snooze_time, al);
_alarm_dialog_snooze_delete(dia, al);
e_config_save_queue();
}
static void
@ -643,6 +688,8 @@ _alarm_cb_dialog_snooze_cancel(void *data, E_Dialog *dia)
al = data;
_alarm_dialog_snooze_delete(dia, al);
e_config_save_queue();
}
static void
@ -870,12 +917,17 @@ _cb_edje_alarm_state_on(void *data, Evas_Object *obj, const char *emission, cons
alarm_config->alarms_ring_etimer = ecore_timer_add(ALARMS_CHECK_TIMER,
_cb_alarms_ring_etimer,
NULL);
e_config_save_queue();
}
static void
_cb_edje_alarm_state_off(void *data, Evas_Object *obj, const char *emission, const char *source)
{
if (alarm_config->alarms_state == ALARM_STATE_OFF) return;
alarm_config->alarms_state = ALARM_STATE_OFF;
ecore_timer_del(alarm_config->alarms_ring_etimer);
e_config_save_queue();
}
static void
@ -1090,6 +1142,8 @@ e_modapi_shutdown(E_Module *m)
free(alarm_config->theme);
if (alarm_config->config_dialog)
e_object_del(E_OBJECT(alarm_config->config_dialog));
if (alarm_config->config_dialog_alarm_new)
e_object_del(E_OBJECT(alarm_config->config_dialog_alarm_new));
if (alarm_config->menu)
{
e_menu_post_deactivate_callback_set(alarm_config->menu , NULL, NULL);

1
e_mod_main.h

@ -148,6 +148,7 @@ EAPI int e_modapi_config (E_Module *m);
Alarm *alarm_alarm_add(int state, char *name, int type, char *date, int day_monday, int day_tuesday, int day_wenesday, int day_thursday, int day_friday, int day_saturday, int day_sunday, int hour, int minute, int autoremove, char *description, int open_popup, int run_program, char *program, int *error);
void alarm_alarm_del(Alarm *al);
Alarm *alarm_alarm_duplicate(Alarm *al);
int alarm_alarm_ring(Alarm *al, int test);
void alarm_alarm_ring_stop(Alarm *al, int check);
void alarm_edje_signal_emit(const char *source, const char *message);

Loading…
Cancel
Save