Merge lp:~karl-qdh/indicator-datetime/calendarmenuitemsignals into lp:indicator-datetime/0.3
- calendarmenuitemsignals
- Merge into trunk
Proposed by
Karl Lattimer
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Ted Gould | ||||||||||||||||
Approved revision: | 73 | ||||||||||||||||
Merged at revision: | 66 | ||||||||||||||||
Proposed branch: | lp:~karl-qdh/indicator-datetime/calendarmenuitemsignals | ||||||||||||||||
Merge into: | lp:indicator-datetime/0.3 | ||||||||||||||||
Diff against target: |
364 lines (+121/-69) 2 files modified
src/datetime-service.c (+113/-53) src/indicator-datetime.c (+8/-16) |
||||||||||||||||
To merge this branch: | bzr merge lp:~karl-qdh/indicator-datetime/calendarmenuitemsignals | ||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ted Gould (community) | Approve | ||
Review via email: mp+53467@code.launchpad.net |
Commit message
Description of the change
Updated code in this branch to fulfil ted's comments
Partially fixes bug #726531
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/datetime-service.c' | |||
2 | --- src/datetime-service.c 2011-03-15 02:43:27 +0000 | |||
3 | +++ src/datetime-service.c 2011-03-15 15:51:45 +0000 | |||
4 | @@ -280,9 +280,6 @@ | |||
5 | 280 | static gboolean | 280 | static gboolean |
6 | 281 | month_changed_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp) | 281 | month_changed_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp) |
7 | 282 | { | 282 | { |
8 | 283 | // BLOCKED: get type, then get type as string from the variant causes segfault in glib | ||
9 | 284 | // TODO: * Set some globals so when we-re-run update appointment menu items it gets the right start date | ||
10 | 285 | // * update appointment menu items | ||
11 | 286 | start_time_appointments = (time_t)g_variant_get_uint32(variant); | 283 | start_time_appointments = (time_t)g_variant_get_uint32(variant); |
12 | 287 | 284 | ||
13 | 288 | g_debug("Received month changed with timestamp: %d -> %s",(int)start_time_appointments, ctime(&start_time_appointments)); | 285 | g_debug("Received month changed with timestamp: %d -> %s",(int)start_time_appointments, ctime(&start_time_appointments)); |
14 | @@ -290,6 +287,37 @@ | |||
15 | 290 | return TRUE; | 287 | return TRUE; |
16 | 291 | } | 288 | } |
17 | 292 | 289 | ||
18 | 290 | static gboolean | ||
19 | 291 | day_selected_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp) | ||
20 | 292 | { | ||
21 | 293 | start_time_appointments = (time_t)g_variant_get_uint32(variant); | ||
22 | 294 | |||
23 | 295 | g_debug("Received day-selected with timestamp: %d -> %s",(int)start_time_appointments, ctime(&start_time_appointments)); | ||
24 | 296 | update_appointment_menu_items(NULL); | ||
25 | 297 | return TRUE; | ||
26 | 298 | } | ||
27 | 299 | |||
28 | 300 | static gboolean | ||
29 | 301 | day_selected_double_click_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp) | ||
30 | 302 | { | ||
31 | 303 | time_t evotime = (time_t)g_variant_get_uint32(variant); | ||
32 | 304 | |||
33 | 305 | g_debug("Received day-selected-double-click with timestamp: %d -> %s",(int)evotime, ctime(&evotime)); | ||
34 | 306 | |||
35 | 307 | gchar *ad = isodate_from_time_t(evotime); | ||
36 | 308 | gchar *cmd = g_strconcat("evolution calendar:///?startdate=", ad, NULL); | ||
37 | 309 | |||
38 | 310 | GError * error = NULL; | ||
39 | 311 | |||
40 | 312 | g_debug("Issuing command '%s'", cmd); | ||
41 | 313 | if (!g_spawn_command_line_async(cmd, &error)) { | ||
42 | 314 | g_warning("Unable to start %s: %s", (char *)cmd, error->message); | ||
43 | 315 | g_error_free(error); | ||
44 | 316 | } | ||
45 | 317 | |||
46 | 318 | return TRUE; | ||
47 | 319 | } | ||
48 | 320 | |||
49 | 293 | static guint ecaltimer = 0; | 321 | static guint ecaltimer = 0; |
50 | 294 | 322 | ||
51 | 295 | static void | 323 | static void |
52 | @@ -365,8 +393,10 @@ | |||
53 | 365 | stop_ecal_timer(); | 393 | stop_ecal_timer(); |
54 | 366 | } | 394 | } |
55 | 367 | 395 | ||
57 | 368 | // Connect to event::month-changed | 396 | // Connect to calendar events |
58 | 369 | g_signal_connect(calendar, "event::month-changed", G_CALLBACK(month_changed_cb), NULL); | 397 | g_signal_connect(calendar, "event::month-changed", G_CALLBACK(month_changed_cb), NULL); |
59 | 398 | g_signal_connect(calendar, "event::day-selected", G_CALLBACK(day_selected_cb), NULL); | ||
60 | 399 | g_signal_connect(calendar, "event::day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), NULL); | ||
61 | 370 | g_free(evo); | 400 | g_free(evo); |
62 | 371 | } else { | 401 | } else { |
63 | 372 | g_debug("Unable to find calendar app."); | 402 | g_debug("Unable to find calendar app."); |
64 | @@ -543,27 +573,51 @@ | |||
65 | 543 | if (updating_appointments) return TRUE; | 573 | if (updating_appointments) return TRUE; |
66 | 544 | updating_appointments = TRUE; | 574 | updating_appointments = TRUE; |
67 | 545 | 575 | ||
69 | 546 | time_t t1, t2; | 576 | time_t curtime = 0, t1 = 0, t2 = 0; |
70 | 547 | gchar *ad; | 577 | gchar *ad; |
71 | 548 | GList *l; | 578 | GList *l; |
72 | 549 | GSList *g; | 579 | GSList *g; |
73 | 550 | GError *gerror = NULL; | 580 | GError *gerror = NULL; |
74 | 551 | gint i; | 581 | gint i; |
76 | 552 | gint width, height; | 582 | gint width = 0, height = 0; |
77 | 553 | ESourceList * sources = NULL; | 583 | ESourceList * sources = NULL; |
91 | 554 | 584 | ||
92 | 555 | if (start_time_appointments > 0) | 585 | // Get today & work out query times |
93 | 556 | t1 = start_time_appointments; | 586 | time(&curtime); |
94 | 557 | else | 587 | struct tm *today = localtime(&curtime); |
95 | 558 | time(&t1); | 588 | const int mday = today->tm_mday; |
96 | 559 | 589 | const int mon = today->tm_mon; | |
97 | 560 | /* TODO: 7 days ahead of now, we actually need number_of_days_in_this_month | 590 | const int year = today->tm_year; |
98 | 561 | * so we call "mark-day" for all remaining days in this month | 591 | |
99 | 562 | * N.B. Ideally we want any/all dates which are later than today to be marked. | 592 | struct tm *start_tm = NULL; |
100 | 563 | */ | 593 | int this_year = today->tm_year + 1900; |
101 | 564 | t2 = t1 + (time_t) (7 * 24 * 60 * 60); | 594 | int days[12]={31,28,31,30,31,30,31,31,30,31,30,31}; |
102 | 565 | 595 | if ((this_year % 400 == 0) || (this_year % 100 > 0 && this_year % 4 == 0)) days[1] = 29; | |
103 | 566 | // TODO Remove all highlights from the calendar widget | 596 | |
104 | 597 | int highlightdays = days[mon] - mday + 1; | ||
105 | 598 | t1 = curtime; // By default the current time is the appointment start time. | ||
106 | 599 | |||
107 | 600 | if (start_time_appointments > 0) { | ||
108 | 601 | start_tm = localtime(&start_time_appointments); | ||
109 | 602 | int start_month = start_tm->tm_mon; | ||
110 | 603 | int start_year = start_tm->tm_year + 1900; | ||
111 | 604 | if ((start_month != mon) || (start_year != this_year)) { | ||
112 | 605 | // Set t1 to the start of that month. | ||
113 | 606 | struct tm month_start = {0}; | ||
114 | 607 | month_start.tm_year = start_tm->tm_year; | ||
115 | 608 | month_start.tm_mon = start_tm->tm_mon; | ||
116 | 609 | month_start.tm_mday = 1; | ||
117 | 610 | t1 = mktime(&month_start); | ||
118 | 611 | highlightdays = days[mon]; | ||
119 | 612 | } | ||
120 | 613 | } | ||
121 | 614 | |||
122 | 615 | g_debug("Will highlight %d days from %s", highlightdays, ctime(&t1)); | ||
123 | 616 | |||
124 | 617 | t2 = t1 + (time_t) (highlightdays * 24 * 60 * 60); | ||
125 | 618 | |||
126 | 619 | // Remove all highlights from the calendar widget | ||
127 | 620 | dbusmenu_menuitem_property_set (calendar, CALENDAR_MENUITEM_PROP_CLEAR_MARKS, NULL); | ||
128 | 567 | 621 | ||
129 | 568 | if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_EVENT, &gerror)) { | 622 | if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_EVENT, &gerror)) { |
130 | 569 | g_debug("Failed to get ecal sources\n"); | 623 | g_debug("Failed to get ecal sources\n"); |
131 | @@ -588,7 +642,7 @@ | |||
132 | 588 | 642 | ||
133 | 589 | for (s = e_source_group_peek_sources (group); s; s = s->next) { | 643 | for (s = e_source_group_peek_sources (group); s; s = s->next) { |
134 | 590 | ESource *source = E_SOURCE (s->data); | 644 | ESource *source = E_SOURCE (s->data); |
136 | 591 | //g_signal_connect (G_OBJECT(source), "changed", G_CALLBACK (update_appointment_menu_items), NULL); | 645 | g_signal_connect (G_OBJECT(source), "changed", G_CALLBACK (update_appointment_menu_items), NULL); |
137 | 592 | ECal *ecal = e_cal_new(source, E_CAL_SOURCE_TYPE_EVENT); | 646 | ECal *ecal = e_cal_new(source, E_CAL_SOURCE_TYPE_EVENT); |
138 | 593 | e_cal_set_auth_func (ecal, (ECalAuthFunc) auth_func, NULL); | 647 | e_cal_set_auth_func (ecal, (ECalAuthFunc) auth_func, NULL); |
139 | 594 | 648 | ||
140 | @@ -605,7 +659,8 @@ | |||
141 | 605 | g_debug("Number of ECalComponents returned: %d", g_list_length(comp_instances)); | 659 | g_debug("Number of ECalComponents returned: %d", g_list_length(comp_instances)); |
142 | 606 | GList *sorted_comp_instances = g_list_sort(comp_instances, compare_comp_instances); | 660 | GList *sorted_comp_instances = g_list_sort(comp_instances, compare_comp_instances); |
143 | 607 | comp_instances = NULL; | 661 | comp_instances = NULL; |
145 | 608 | 662 | g_debug("Components sorted"); | |
146 | 663 | |||
147 | 609 | /* Remove all of the previous appointments */ | 664 | /* Remove all of the previous appointments */ |
148 | 610 | if (appointments != NULL) { | 665 | if (appointments != NULL) { |
149 | 611 | g_debug("Freeing old appointments"); | 666 | g_debug("Freeing old appointments"); |
150 | @@ -619,9 +674,7 @@ | |||
151 | 619 | } | 674 | } |
152 | 620 | } | 675 | } |
153 | 621 | 676 | ||
157 | 622 | gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); | 677 | gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height); |
155 | 623 | // Sometimes these give negative numbers, sometimes large numbers which look like timestamps | ||
156 | 624 | // is there a buffer overwrite causing it? | ||
158 | 625 | if (width <= 0) width = 12; | 678 | if (width <= 0) width = 12; |
159 | 626 | if (height <= 0) height = 12; | 679 | if (height <= 0) height = 12; |
160 | 627 | if (width > 30) width = 12; | 680 | if (width > 30) width = 12; |
161 | @@ -646,13 +699,34 @@ | |||
162 | 646 | char right[20]; | 699 | char right[20]; |
163 | 647 | //const gchar *uri; | 700 | //const gchar *uri; |
164 | 648 | DbusmenuMenuitem * item; | 701 | DbusmenuMenuitem * item; |
169 | 649 | 702 | ||
170 | 650 | g_debug("Start Object %p", ecalcomp); | 703 | ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp); |
171 | 651 | 704 | struct tm *due = NULL; | |
172 | 652 | // TODO Mark days | 705 | if (vtype == E_CAL_COMPONENT_EVENT) due = localtime(&ci->start); |
173 | 706 | else if (vtype == E_CAL_COMPONENT_TODO) due = localtime(&ci->end); | ||
174 | 707 | else continue; | ||
175 | 708 | |||
176 | 709 | const int dmday = due->tm_mday; | ||
177 | 710 | const int dmon = due->tm_mon; | ||
178 | 711 | const int dyear = due->tm_year; | ||
179 | 712 | |||
180 | 713 | // Mark day | ||
181 | 714 | g_debug("Marking date %s", ctime(&ci->start)); | ||
182 | 715 | dbusmenu_menuitem_property_set_int (calendar, CALENDAR_MENUITEM_PROP_MARK, due->tm_mday); | ||
183 | 716 | |||
184 | 717 | |||
185 | 718 | // If the appointment time is less than the selected date, | ||
186 | 719 | // don't create an appointment item for it. | ||
187 | 720 | if (vtype == E_CAL_COMPONENT_EVENT) { | ||
188 | 721 | if (ci->start < start_time_appointments) continue; | ||
189 | 722 | } else if (vtype == E_CAL_COMPONENT_TODO) { | ||
190 | 723 | if (ci->end < start_time_appointments) continue; | ||
191 | 724 | } | ||
192 | 653 | 725 | ||
193 | 654 | if (i >= 5) continue; | 726 | if (i >= 5) continue; |
194 | 655 | i++; | 727 | i++; |
195 | 728 | |||
196 | 729 | g_debug("Create menu item"); | ||
197 | 656 | 730 | ||
198 | 657 | item = dbusmenu_menuitem_new(); | 731 | item = dbusmenu_menuitem_new(); |
199 | 658 | dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_TYPE, APPOINTMENT_MENUITEM_TYPE); | 732 | dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_TYPE, APPOINTMENT_MENUITEM_TYPE); |
200 | @@ -668,25 +742,6 @@ | |||
201 | 668 | g_free (summary); | 742 | g_free (summary); |
202 | 669 | 743 | ||
203 | 670 | // Due text | 744 | // Due text |
204 | 671 | ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp); | ||
205 | 672 | |||
206 | 673 | // Get today | ||
207 | 674 | time_t curtime = time(NULL); | ||
208 | 675 | struct tm *today = localtime(&curtime); | ||
209 | 676 | |||
210 | 677 | int mday = today->tm_mday; | ||
211 | 678 | int mon = today->tm_mon; | ||
212 | 679 | int year = today->tm_year; | ||
213 | 680 | |||
214 | 681 | struct tm *due; | ||
215 | 682 | if (vtype == E_CAL_COMPONENT_EVENT) due = localtime(&ci->start); | ||
216 | 683 | else if (vtype == E_CAL_COMPONENT_TODO) due = localtime(&ci->end); | ||
217 | 684 | else continue; | ||
218 | 685 | |||
219 | 686 | int dmday = due->tm_mday; | ||
220 | 687 | int dmon = due->tm_mon; | ||
221 | 688 | int dyear = due->tm_year; | ||
222 | 689 | |||
223 | 690 | if (apt_output == SETTINGS_TIME_12_HOUR) { | 745 | if (apt_output == SETTINGS_TIME_12_HOUR) { |
224 | 691 | if ((mday == dmday) && (mon == dmon) && (year == dyear)) | 746 | if ((mday == dmday) && (mon == dmon) && (year == dyear)) |
225 | 692 | strftime(right, 20, _(DEFAULT_TIME_12_FORMAT), due); | 747 | strftime(right, 20, _(DEFAULT_TIME_12_FORMAT), due); |
226 | @@ -703,7 +758,6 @@ | |||
227 | 703 | else | 758 | else |
228 | 704 | strftime(right, 20, _(DEFAULT_TIME_FORMAT_WITH_DAY), due); | 759 | strftime(right, 20, _(DEFAULT_TIME_FORMAT_WITH_DAY), due); |
229 | 705 | } | 760 | } |
230 | 706 | |||
231 | 707 | g_debug("Appointment time: %s, for date %s", right, asctime(due)); | 761 | g_debug("Appointment time: %s, for date %s", right, asctime(due)); |
232 | 708 | dbusmenu_menuitem_property_set (item, APPOINTMENT_MENUITEM_PROP_RIGHT, right); | 762 | dbusmenu_menuitem_property_set (item, APPOINTMENT_MENUITEM_PROP_RIGHT, right); |
233 | 709 | 763 | ||
234 | @@ -723,10 +777,9 @@ | |||
235 | 723 | // Draw the correct icon for the appointment type and then tint it using mask fill. | 777 | // Draw the correct icon for the appointment type and then tint it using mask fill. |
236 | 724 | // For now we'll create a circle | 778 | // For now we'll create a circle |
237 | 725 | if (color_spec != NULL) { | 779 | if (color_spec != NULL) { |
238 | 726 | // Fixme causes segfault, but we have colours now yay! | ||
239 | 727 | GdkColor color; | 780 | GdkColor color; |
240 | 728 | gdk_color_parse (color_spec, &color); | 781 | gdk_color_parse (color_spec, &color); |
242 | 729 | g_debug("Creating a cairo surface\n size, %d by %d", width, height); | 782 | g_debug("Creating a cairo surface: size, %d by %d", width, height); |
243 | 730 | cairo_surface_t *surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, width, height ); | 783 | cairo_surface_t *surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, width, height ); |
244 | 731 | 784 | ||
245 | 732 | cairo_t *cr = cairo_create(surface); | 785 | cairo_t *cr = cairo_create(surface); |
246 | @@ -771,13 +824,13 @@ | |||
247 | 771 | 824 | ||
248 | 772 | dbusmenu_menuitem_property_set_image (item, APPOINTMENT_MENUITEM_PROP_ICON, pixbuf); | 825 | dbusmenu_menuitem_property_set_image (item, APPOINTMENT_MENUITEM_PROP_ICON, pixbuf); |
249 | 773 | } else { | 826 | } else { |
251 | 774 | g_debug("Creating pixbuf from surface failed\n Couldn't create new pixbuf for size, %d by %d", width, height); | 827 | g_debug("Creating pixbuf from surface failed"); |
252 | 775 | } | 828 | } |
253 | 776 | cairo_surface_destroy (surface); | 829 | cairo_surface_destroy (surface); |
254 | 777 | cairo_destroy(cr); | 830 | cairo_destroy(cr); |
255 | 778 | } | 831 | } |
256 | 779 | dbusmenu_menuitem_child_add_position (root, item, 2+i); | 832 | dbusmenu_menuitem_child_add_position (root, item, 2+i); |
258 | 780 | appointments = g_list_append (appointments, item); // Keep track of the items here to make them east to remove | 833 | appointments = g_list_append (appointments, item); // Keep track of the items here to make them easy to remove |
259 | 781 | g_debug("Adding appointment: %p", item); | 834 | g_debug("Adding appointment: %p", item); |
260 | 782 | } | 835 | } |
261 | 783 | 836 | ||
262 | @@ -785,8 +838,8 @@ | |||
263 | 785 | for (l = sorted_comp_instances; l; l = l->next) { | 838 | for (l = sorted_comp_instances; l; l = l->next) { |
264 | 786 | const struct comp_instance *ci = l->data; | 839 | const struct comp_instance *ci = l->data; |
265 | 787 | g_object_unref(ci->comp); | 840 | g_object_unref(ci->comp); |
266 | 788 | g_list_free(sorted_comp_instances); | ||
267 | 789 | } | 841 | } |
268 | 842 | g_list_free(sorted_comp_instances); | ||
269 | 790 | 843 | ||
270 | 791 | updating_appointments = FALSE; | 844 | updating_appointments = FALSE; |
271 | 792 | g_debug("End of objects"); | 845 | g_debug("End of objects"); |
272 | @@ -820,6 +873,12 @@ | |||
273 | 820 | check_timezone_sync(); | 873 | check_timezone_sync(); |
274 | 821 | } | 874 | } |
275 | 822 | 875 | ||
276 | 876 | static void | ||
277 | 877 | time_format_changed (void) | ||
278 | 878 | { | ||
279 | 879 | update_appointment_menu_items(NULL); | ||
280 | 880 | } | ||
281 | 881 | |||
282 | 823 | /* Does the work to build the default menu, really calls out | 882 | /* Does the work to build the default menu, really calls out |
283 | 824 | to other functions but this is the core to clean up the | 883 | to other functions but this is the core to clean up the |
284 | 825 | main function. */ | 884 | main function. */ |
285 | @@ -872,6 +931,7 @@ | |||
286 | 872 | g_signal_connect (conf, "changed::" SETTINGS_SHOW_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL); | 931 | g_signal_connect (conf, "changed::" SETTINGS_SHOW_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL); |
287 | 873 | g_signal_connect (conf, "changed::" SETTINGS_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL); | 932 | g_signal_connect (conf, "changed::" SETTINGS_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL); |
288 | 874 | g_signal_connect (conf, "changed::" SETTINGS_SHOW_EVENTS_S, G_CALLBACK (show_events_changed), NULL); | 933 | g_signal_connect (conf, "changed::" SETTINGS_SHOW_EVENTS_S, G_CALLBACK (show_events_changed), NULL); |
289 | 934 | g_signal_connect (conf, "changed::" SETTINGS_TIME_FORMAT_S, G_CALLBACK (time_format_changed), NULL); | ||
290 | 875 | 935 | ||
291 | 876 | DbusmenuMenuitem * separator = dbusmenu_menuitem_new(); | 936 | DbusmenuMenuitem * separator = dbusmenu_menuitem_new(); |
292 | 877 | dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); | 937 | dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR); |
293 | 878 | 938 | ||
294 | === modified file 'src/indicator-datetime.c' | |||
295 | --- src/indicator-datetime.c 2011-03-15 02:40:24 +0000 | |||
296 | +++ src/indicator-datetime.c 2011-03-15 15:51:45 +0000 | |||
297 | @@ -813,7 +813,7 @@ | |||
298 | 813 | 813 | ||
299 | 814 | if (self->priv->show_seconds || | 814 | if (self->priv->show_seconds || |
300 | 815 | (self->priv->time_mode == SETTINGS_TIME_CUSTOM && self->priv->custom_show_seconds)) { | 815 | (self->priv->time_mode == SETTINGS_TIME_CUSTOM && self->priv->custom_show_seconds)) { |
302 | 816 | self->priv->timer = g_timeout_add_seconds(1, timer_func, self); | 816 | self->priv->timer = g_timeout_add_full(G_PRIORITY_HIGH, 865, timer_func, self, NULL); |
303 | 817 | } else { | 817 | } else { |
304 | 818 | if (datetime == NULL) { | 818 | if (datetime == NULL) { |
305 | 819 | datetime = g_date_time_new_now_local(); | 819 | datetime = g_date_time_new_now_local(); |
306 | @@ -1154,9 +1154,9 @@ | |||
307 | 1154 | } else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_CLEAR_MARKS)) { | 1154 | } else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_CLEAR_MARKS)) { |
308 | 1155 | ido_calendar_menu_item_clear_marks (IDO_CALENDAR_MENU_ITEM (mi_data)); | 1155 | ido_calendar_menu_item_clear_marks (IDO_CALENDAR_MENU_ITEM (mi_data)); |
309 | 1156 | } else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_SET_DATE)) { | 1156 | } else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_SET_DATE)) { |
313 | 1157 | // const gint * array = g_variant_get_fixed_array(value, NULL, sizeof(gint)); | 1157 | gsize size = 3; |
314 | 1158 | // TODO: Needs ido branch merged - lp:~karl-qdh/ido/select-activate-set-date | 1158 | const gint * array = g_variant_get_fixed_array(value, &size, sizeof(gint)); |
315 | 1159 | // ido_calendar_menu_item_set_date (IDO_CALENDAR_MENU_ITEM (mi_data), array[0], array[1], array[2]); | 1159 | ido_calendar_menu_item_set_date (IDO_CALENDAR_MENU_ITEM (mi_data), array[0], array[1], array[2]); |
316 | 1160 | } else { | 1160 | } else { |
317 | 1161 | g_warning("Indicator Item property '%s' unknown", prop); | 1161 | g_warning("Indicator Item property '%s' unknown", prop); |
318 | 1162 | } | 1162 | } |
319 | @@ -1257,13 +1257,10 @@ | |||
320 | 1257 | guint timestamp = (guint)time(NULL); | 1257 | guint timestamp = (guint)time(NULL); |
321 | 1258 | dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "month-changed", variant, timestamp); | 1258 | dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "month-changed", variant, timestamp); |
322 | 1259 | } | 1259 | } |
326 | 1260 | 1260 | ||
324 | 1261 | // TODO: Needs ido branch merged - lp:~karl-qdh/ido/select-activate-set-date | ||
325 | 1262 | /* | ||
327 | 1263 | static void | 1261 | static void |
328 | 1264 | day_selected_cb (IdoCalendarMenuItem *ido, | 1262 | day_selected_cb (IdoCalendarMenuItem *ido, |
331 | 1265 | guint day, | 1263 | gpointer user_data) |
330 | 1266 | gpointer user_data) | ||
332 | 1267 | { | 1264 | { |
333 | 1268 | guint d,m,y; | 1265 | guint d,m,y; |
334 | 1269 | DbusmenuMenuitem * item = DBUSMENU_MENUITEM (user_data); | 1266 | DbusmenuMenuitem * item = DBUSMENU_MENUITEM (user_data); |
335 | @@ -1281,7 +1278,6 @@ | |||
336 | 1281 | 1278 | ||
337 | 1282 | static void | 1279 | static void |
338 | 1283 | day_selected_double_click_cb (IdoCalendarMenuItem *ido, | 1280 | day_selected_double_click_cb (IdoCalendarMenuItem *ido, |
339 | 1284 | guint day, | ||
340 | 1285 | gpointer user_data) | 1281 | gpointer user_data) |
341 | 1286 | { | 1282 | { |
342 | 1287 | guint d,m,y; | 1283 | guint d,m,y; |
343 | @@ -1297,8 +1293,6 @@ | |||
344 | 1297 | guint timestamp = (guint)time(NULL); | 1293 | guint timestamp = (guint)time(NULL); |
345 | 1298 | dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "day-selected-double-click", variant, timestamp); | 1294 | dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "day-selected-double-click", variant, timestamp); |
346 | 1299 | } | 1295 | } |
347 | 1300 | */ | ||
348 | 1301 | |||
349 | 1302 | 1296 | ||
350 | 1303 | static gboolean | 1297 | static gboolean |
351 | 1304 | new_calendar_item (DbusmenuMenuitem * newitem, | 1298 | new_calendar_item (DbusmenuMenuitem * newitem, |
352 | @@ -1333,10 +1327,8 @@ | |||
353 | 1333 | 1327 | ||
354 | 1334 | dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(ido), parent); | 1328 | dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(ido), parent); |
355 | 1335 | g_signal_connect_after(ido, "month-changed", G_CALLBACK(month_changed_cb), (gpointer)newitem); | 1329 | g_signal_connect_after(ido, "month-changed", G_CALLBACK(month_changed_cb), (gpointer)newitem); |
360 | 1336 | 1330 | g_signal_connect_after(ido, "day-selected", G_CALLBACK(day_selected_cb), (gpointer)newitem); | |
361 | 1337 | // TODO: Needs ido branch merged - lp:~karl-qdh/ido/select-activate-set-date | 1331 | g_signal_connect_after(ido, "day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), (gpointer)newitem); |
358 | 1338 | /*g_signal_connect_after(ido, "day-selected", G_CALLBACK(day_selected_cb), (gpointer)newitem); | ||
359 | 1339 | g_signal_connect_after(ido, "day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), (gpointer)newitem);*/ | ||
362 | 1340 | 1332 | ||
363 | 1341 | return TRUE; | 1333 | return TRUE; |
364 | 1342 | } | 1334 | } |
review approve
merge approve