300
/* create a new IdoAppointmentMenuItem */
296
302
ido_appointment_menu_item_new (void)
298
304
return GTK_WIDGET (g_object_new (IDO_APPOINTMENT_MENU_ITEM_TYPE, NULL));
308
* ido_appointment_menu_item_set_color:
309
* @color: parseable color string
311
* When this is set, the menuitem will include an icon with this color.
313
* These colors can be set in the end user's calendar app as a quick visual cue
314
* to show what kind of appointment this is.
302
317
ido_appointment_menu_item_set_color (IdoAppointmentMenuItem * self,
303
318
const char * color_string)
347
* @strftime_fmt: the format string used to build the appointment's time string
375
* ido_appointment_menu_item_set_format:
376
* @format: the format string used when showing the appointment's time
378
* Set the format string for rendering the appointment's time
379
* in its right-justified secondary label.
381
* See strfrtime(3) for more information on the format string.
350
384
ido_appointment_menu_item_set_format (IdoAppointmentMenuItem * self,
360
394
update_timestamp_label (self);
398
* ido_appointment_menu_item_new_from_model:
399
* @menu_item: the corresponding menuitem
400
* @actions: action group to tell when this GtkMenuItem is activated
402
* Creates a new IdoAppointmentMenuItem with properties initialized from
403
* the menuitem's attributes.
405
* If the menuitem's 'action' attribute is set, trigger that action
406
* in @actions when this IdoAppointmentMenuItem is activated.
364
409
ido_appointment_menu_item_new_from_model (GMenuItem * menu_item,
365
410
GActionGroup * actions)
369
416
IdoAppointmentMenuItem * ido_appointment;
371
ido_appointment = IDO_APPOINTMENT_MENU_ITEM (ido_appointment_menu_item_new());
417
GParameter parameters[8];
419
/* create the ido_appointment */
373
423
if (g_menu_item_get_attribute (menu_item, "label", "s", &str))
375
ido_appointment_menu_item_set_summary (ido_appointment, str);
425
GParameter p = { "summary", G_VALUE_INIT };
426
g_value_init (&p.value, G_TYPE_STRING);
427
g_value_take_string (&p.value, str);
379
431
if (g_menu_item_get_attribute (menu_item, "x-canonical-color", "s", &str))
381
ido_appointment_menu_item_set_color (ido_appointment, str);
433
GParameter p = { "color", G_VALUE_INIT };
434
g_value_init (&p.value, G_TYPE_STRING);
435
g_value_take_string (&p.value, str);
439
if (g_menu_item_get_attribute (menu_item, "x-canonical-time-format", "s", &str))
441
GParameter p = { "format", G_VALUE_INIT };
442
g_value_init (&p.value, G_TYPE_STRING);
443
g_value_take_string (&p.value, str);
385
447
if (g_menu_item_get_attribute (menu_item, "x-canonical-time", "x", &i64))
387
ido_appointment_menu_item_set_time (ido_appointment, (time_t)i64);
390
if (g_menu_item_get_attribute (menu_item, "x-canonical-time-format", "s", &str))
392
ido_appointment_menu_item_set_format (ido_appointment, str);
449
GParameter p = { "time", G_VALUE_INIT };
450
g_value_init (&p.value, G_TYPE_INT64);
451
g_value_set_int64 (&p.value, i64);
455
g_assert (n <= G_N_ELEMENTS (parameters));
456
ido_appointment = g_object_newv (IDO_APPOINTMENT_MENU_ITEM_TYPE, n, parameters);
459
g_value_unset (¶meters[i].value);
462
/* add an ActionHelper */
396
464
if (g_menu_item_get_attribute (menu_item, "action", "s", &str))