aboutsummaryrefslogtreecommitdiffstats
path: root/www
Commit message (Expand)AuthorAgeFilesLines
* - Update to 0.61sunpoet2015-05-052-3/+3
* Upgrade to version 1.0.1.olgeni2015-05-053-62/+10
* - Add missing PHP moduleswen2015-05-051-1/+2
* - Update to 1.4207sunpoet2015-05-052-3/+3
* Update to 3.0.4.1; simplify with @sample and @dirbf2015-05-054-87/+25
* - Add USE_OCAML_CAMLP4 and USE_OCAML_TK to bsd.ocaml.mk which addmadpilot2015-05-041-0/+1
* Mark BROKENantoine2015-05-041-0/+2
* Allow packaging as a userbapt2015-05-041-1/+3
* Allow packaging as a userbapt2015-05-041-1/+3
* - Update to 1.5.7wen2015-05-042-3/+3
* By request, reset maintainership of multiple portseadler2015-05-041-1/+1
* - Add CPE infoamdmi32015-05-041-0/+1
* - Add NEED_ROOT, doesn't build from plain user (Couldn't load RT config file ...amdmi32015-05-041-0/+1
* - Update to 2.45.0sunpoet2015-05-042-3/+3
* - Update to 2.2.5sunpoet2015-05-042-5/+8
* - Update to 2.2.5sunpoet2015-05-042-5/+8
* - Update to 1.4.1sunpoet2015-05-042-3/+3
* Do not try to load rt configuration files before installingbapt2015-05-043-4/+7
* Do not try to load rt configuration files before installingbapt2015-05-041-1/+3
* Fix staging done wrongbapt2015-05-032-90/+16
* Remove the uneeded NEED_ROOTbapt2015-05-031-1/+0
* Do not chown in post-install, the plist does the job alreadybapt2015-05-031-3/+0
* Update to XS-httpd 3.7 beta 33johans2015-05-032-3/+3
* Fix some _DEPENDSantoine2015-05-031-1/+1
* - Fix gemspec patchsunpoet2015-05-031-1/+1
* - Fix gemspec patchsunpoet2015-05-031-2/+4
* - Fix gemspec patchsunpoet2015-05-032-6/+14
* - Update RUN_DEPENDSsunpoet2015-05-031-1/+1
* - Update WWWsunpoet2015-05-031-1/+1
* - Update to 2.9.4sunpoet2015-05-032-3/+3
* Really fix the build with GCC (for FreeBSD < 10)rene2015-05-031-0/+38
* - Update to 1.8.1lwhsu2015-05-032-5/+4
* - Copy www/py-django to www/py-django17 and update to 1.7.8,lwhsu2015-05-034-0/+81
* - Fix gemspecsunpoet2015-05-032-0/+18
* - Add rubygem-gollum-grit_adapter 1.0.0sunpoet2015-05-034-0/+26
* - Fix gemspec patchsunpoet2015-05-032-21/+14
* - Update to 1.0.2sunpoet2015-05-032-4/+6
* Update to 0.60.adamw2015-05-022-3/+3
* Update to 0.59.adamw2015-05-022-3/+3
* Chase py-certifi rename, bump PORTREVISION.rm2015-05-021-1/+2
* www/squid finally gets a maintainermarino2015-05-021-1/+1
* Add www/p5-Toadfarm, a tool for managing one or more Mojoliciousadamw2015-05-015-0/+69
* www/piwik: update 2.12.1 -> 2.13.0robak2015-05-013-36/+146
* - Update to 7.2.0sunpoet2015-05-012-5/+3
* Horde package update:mm2015-05-016-9/+9
* Fix typo.osa2015-05-011-1/+1
* www/chromium: fix build with GCC (FreeBSD < 10)rene2015-05-011-0/+11
* Update to 0.303, and sort plist.adamw2015-05-013-21/+21
* Update to 5.90090. Add a couple more TEST_DEPENDS for more comprehensiveadamw2015-05-013-4/+12
* Fix warnings when using rc scriptfeld2015-05-012-3/+3
* www/squid: Add MAP_NOSYNC flay to mmap callmarino2015-05-013-0/+23
* Remove expired ports:rene2015-04-305-39/+0
* - Fix debug option that was always ongarga2015-04-303-3/+51
* Move each pkg-{plist,descr} into its own port, cleanup @dirrm*mat2015-04-307-11/+5
* www/chromium: update to 42.0.2311.135rene2015-04-302-5/+5
* Remove useless code.osa2015-04-302-4/+0
* Update to 0.5.7bapt2015-04-302-3/+3
* Flask-Cors is a simple extension to Flask allowing you to support cross-originwen2015-04-294-0/+28
* Update from 5.0.6 to 5.0.7:osa2015-04-298-13/+13
* Enable check for passenger third-party module compiled in nginx.osa2015-04-291-0/+7
* Add support for stream and stream_ssl modules.osa2015-04-291-0/+13
* Remove needless code.osa2015-04-291-6/+0
* Upgrade from 1.8.0 to 1.9.0.osa2015-04-292-7/+6
* Update my email address and give a few ports to ruby@mmoll2015-04-291-1/+1
* www/chromium: fix patching on FreeBSD < 10 (linking still fails because of arene2015-04-292-22/+0
* - Update to 4.2.1sunpoet2015-04-292-3/+3
* USES=xfce: Stop overriding MASTER_SITE_SUBDIR.bdrewery2015-04-291-2/+1
* Include high availability patch to give us feature parity with Linuxfeld2015-04-282-1/+31
* - Update to 3.1.21 [1]culot2015-04-282-3/+5
* New port: www/itopvg2015-04-285-0/+92
* Update to 0.002.adamw2015-04-272-3/+3
* - Update to 5.13sunpoet2015-04-272-3/+3
* - Add LICENSEsunpoet2015-04-271-1/+4
* - Update to 1.8.1sunpoet2015-04-273-3/+90
* - Fix build on 9.x (OpenSSL 0.9.8)sunpoet2015-04-271-0/+23
* Update to 0.55, and remove unnecessary DOCS option.adamw2015-04-272-8/+4
* Update to 0.160000, and fix whitespace alignment.adamw2015-04-272-32/+32
* www/chromium: update to 42.0.2311.90rene2015-04-2758-736/+1057
* - Chase GNU Emacs updatesashish2015-04-271-0/+1
* Update to 6.10.adamw2015-04-272-4/+4
* Add www/p5-Mojolicious-Plugin-SetUserGroup, a plugin to set theadamw2015-04-275-0/+47
* Remove needless patch, I've just forgotten to remove it in previous commit.osa2015-04-272-3338/+0
* Remove support for next unsupported third-party modules:osa2015-04-276-202/+6
* www/mod_rivet: update 2.2.1 -> 2.2.2robak2015-04-272-3/+3
* Upgrade to 4.9.26.thierry2015-04-274-9/+22
* Update to 7.0.5 release.ale2015-04-262-3/+3
* - Update to 6.09sunpoet2015-04-262-3/+3
* - Update to 0.54sunpoet2015-04-263-17/+11
* - Update to 2.8.4sunpoet2015-04-263-4/+8
* Deprecate ports broken for more than 6 monthsantoine2015-04-261-0/+2
* - Update to 4.2sunpoet2015-04-262-3/+3
* Add CPE information and update to 2.9bf2015-04-262-5/+6
* Update to 2.01.adamw2015-04-262-3/+3
* Switch TEST_DEPEND from p5-CGI.pm to p5-CGI.adamw2015-04-261-1/+1
* Convert remaining p5-CGI.pm consumers to p5-CGI, and bump PORTREVISION.adamw2015-04-269-43/+43
* - Update to 0.8.4sunpoet2015-04-252-3/+3
* Update to 2.9.0.adamw2015-04-255-24/+135
* www/node: update to 0.12.2xmj2015-04-249-29/+36
* Update icu to 55.1bapt2015-04-249-5/+9
* - Update to 6.2.12wen2015-04-232-3/+3
* Update to 0.5.6 which brings some fixes on capsicumbapt2015-04-232-3/+3
* - Update to 3.3wen2015-04-232-4/+7
* Horde package update:mm2015-04-232-3/+3
* - Add an optional patch, off by default, that enable 2 new options:garga2015-04-234-4/+240
* - Update to 1.4205sunpoet2015-04-232-8/+5
* - Update to 4.15sunpoet2015-04-233-3/+6
* - Update to 5.6sem2015-04-223-13/+17
* www/wordpress: update 4.1 -> 4.1.2robak2015-04-222-3/+3
* Remove third-party syslog support, it's available out of box now,osa2015-04-222-12/+0
* 1: Upgrade to 2.0.0.vanilla2015-04-222-6/+9
* - Add CPE infoamdmi32015-04-222-2/+3
* - Add CPE infoamdmi32015-04-221-1/+2
* Upgrade to latest stable version 1.8.0.osa2015-04-2213-1589/+222
* - Update to 15.1.0sunpoet2015-04-222-3/+3
* - Update to 2.8.3sunpoet2015-04-223-128/+312
* - Update to 0.7.12sunpoet2015-04-223-8/+9
* Upgrade third-party set_misc module from 0.24 to 0.28.osa2015-04-226-12/+12
* - Update to Firefox 37.0.2jbeich2015-04-216-183/+183
* Upgrade third-party modules:osa2015-04-214-24/+24
* Upgrade third-party redis2 module from 0.10 to 0.11.osa2015-04-214-8/+8
* Upgrade third-pary redis2 module from 0.9.4 to 0.9.15.osa2015-04-214-8/+8
* Upgrade to 4.9.25.thierry2015-04-214-6/+19
* Update to 0.08ehaupt2015-04-212-4/+3
* - Add LICENSEamdmi32015-04-212-2/+6
* - Update to 0.5.10olivierd2015-04-214-43/+30
* - Update to 3.25culot2015-04-202-3/+3
* - Update to 5.5culot2015-04-203-4/+3
* Remove ${WRKSRC}/INSTALL because it's a symlink to a non-existent filetijl2015-04-201-0/+3
* Put acinclude.m4 where aclocal can find ittijl2015-04-191-0/+3
* AC_CONFIG_MACRO_DIR is missing in configure.ac but USES=autoreconf isn'ttijl2015-04-191-7/+3
* Add new port lesc, a Javascript CSS preprocessor.rodrigo2015-04-195-0/+538
* Convert to USES=autoreconftijl2015-04-184-19/+7
* - Remove libtool hacks and patches that are now handled by USES=libtooltijl2015-04-182-4/+2
* Update Firebug to 2.0.9bar2015-04-182-3/+3
* Upgrade third-party headers-more module from 0.25 to 0.26.osa2015-04-184-8/+8
* Remove expired ports:rene2015-04-187-172/+0
* - Update to 1.4204sunpoet2015-04-182-4/+8
* [NEW] www/py-hyper: HTTP/2 Client for Pythonkoobs2015-04-174-0/+39
* www/linux-{c6,f10}-flashplugin11: Update to 11.2r202.457xmj2015-04-172-6/+5
* www/geeknote: Update to 0.2a (7ea2255)koobs2015-04-172-5/+6
* Back to the pool.gblach2015-04-175-5/+5
* www/py-werkzeug: update 0.10.1 -> 0.10.4robak2015-04-162-3/+3
* Add CVE information to all Horde applicationsmm2015-04-155-5/+5
* converters/libiconv:tijl2015-04-157-19/+56
* Update to 0.5.5bapt2015-04-152-3/+3
* Reset WWW-link to PECL, because the original page(s) no longer exist.mi2015-04-151-1/+1
* Add hunks to allow compiling with php-5.4 and (hopefully) newer. Fixmi2015-04-152-25/+192
* www/squid: 3.4.12 -> 3.5.3pi2015-04-1512-206/+298
* Varnish 3.0 is officially end of lifefeld2015-04-141-0/+1
* Fix some glib schema issues.kwm2015-04-142-1/+3
* Use python 2 meta port.kevlo2015-04-141-1/+1
* Update lynx to 2.8.9-dev5johans2015-04-142-3/+3
* - Add CPE informationsunpoet2015-04-141-0/+2
* Update to 1.56.adamw2015-04-142-3/+3
* Add CPE informationfeld2015-04-141-1/+2
* Add CPE informationfeld2015-04-141-1/+2
* Update to 0.5.4bapt2015-04-132-3/+3
* These need Module::Build.mat2015-04-131-1/+1
* Remove unnecessary bsd.port.options.mk inclusion, and unmute installationadamw2015-04-131-13/+9
* Update to 0.5.3bapt2015-04-122-3/+3
* These need Module::Build.mat2015-04-121-1/+1
* This needs Module::Build.mat2015-04-121-1/+1
* - Add missing dependency on USES=pythonkevlo2015-04-111-4/+4
* These needs Module::Build.mat2015-04-111-1/+1
* Don't let webalizer change name when GEOIP is enabled.mat2015-04-112-1/+2
* Remove expired ports:rene2015-04-115-42/+0
* - Fix a typo in PCRE_CONFIGURE_ENABLE knobdanfe2015-04-103-17/+12
* www/httpclient: add CPE informationrobak2015-04-101-0/+3
* - Update to 0.8.3sunpoet2015-04-102-3/+3
* Convert to USES=gnustepbapt2015-04-101-6/+3
* Convert to USES=gnustepbapt2015-04-101-5/+3
* Initial import of cppcms 1.0.5.kevlo2015-04-105-0/+307
* Update to 6.08.adamw2015-04-102-3/+3
* Remove THREADS option support.osa2015-04-091-26/+0
* - Add CPE infoamdmi32015-04-091-0/+2
* - Update to 0.8.2sunpoet2015-04-092-3/+3
* www/libmicrohttpd: add CPE informationrobak2015-04-081-1/+3
* Upgrade to 2.2.1.vanilla2015-04-083-20/+6
* Upgrade from 1.7.11 to 1.7.12.osa2015-04-082-3/+29
* Upgrade from 1.6.2 to 1.6.3.osa2015-04-082-4/+3
* Fix a couple portlint warnings.osa2015-04-084-8/+4
* www/py-flask-cache: upadate to 0.13.1rm2015-04-082-5/+5
* www/py-pyramid: pass maintainership to submitterrm2015-04-081-1/+6
* Remove expired ports:rene2015-04-088-8452/+0
* Update to 6.07.adamw2015-04-082-3/+3
* Remove USE_BZIP2=yes (this code is anyway unsused by any ports)bapt2015-04-071-1/+0
* Update to 6.06.adamw2015-04-072-3/+3
* - Update to 0.16sunpoet2015-04-062-3/+3
* Update to 0.5.2bapt2015-04-063-3/+6
* - Update to 0.3.5sunpoet2015-04-062-3/+3
* - Update to 3.5.5sunpoet2015-04-062-3/+3
* - Update to 3.5.5sunpoet2015-04-062-3/+3
* - Add LICENSEsunpoet2015-04-061-0/+2
* - Update to 0.6.0sunpoet2015-04-062-6/+8
* - Add LICENSEsunpoet2015-04-061-2/+4
* - Update to 2.3.8sunpoet2015-04-062-3/+3
* Upgrade from 1.7.10 to 1.7.11.osa2015-04-062-3/+4
* Upgrade third-party rtmp module from 1.1.6 to 1.1.7.osa2015-04-064-6/+6
* www/ruby-aws: mark broken with ruby 2.2swills2015-04-051-1/+7
* www/rubygem-amazon: mark broken with ruby 2.2swills2015-04-051-1/+7
* Upgrade from 5.0.4 to 5.0.6:osa2015-04-058-22/+15
* - Update to 1.4203sunpoet2015-04-052-3/+4
* www/py-webkitgtk: drop maintainershiprm2015-04-052-6/+4
* - Update to 1.6.3sunpoet2015-04-042-3/+3
* - Update to 0.21sunpoet2015-04-043-5/+4
* - Update to Firefox 37.0.1jbeich2015-04-046-183/+183
* Update Adblock Plus to 2.6.9bar2015-04-042-4/+4
* - Add LICENSEsunpoet2015-04-042-1/+4
* - Update to 0.8.1sunpoet2015-04-042-3/+3
* Update to 0.14.adamw2015-04-042-4/+7
* www/MT,russian/MT: Upgrade version 5.2.11 => 5.2.12marino2015-04-045-119/+99
* www/ruby-google: mark broken with ruby 2.2swills2015-04-031-1/+7
* www/rubygem-rails4: use newer sprocketsswills2015-04-031-4/+4
* www/rubygem-turbolinks: update to 2.5.3swills2015-04-032-3/+3
* - Remove STAGEDIR references from plistamdmi32015-04-031-6/+6
* www/py-flask-admin: update 1.0.8 -> 1.1.0robak2015-04-032-6/+8
* www/rubygem-railties: add rdoc3 dependencyswills2015-04-031-1/+3
* www/rubygem-actionpack: use sprockets 2.2swills2015-04-031-1/+2
* www/rubygem-rails: update rubygem-rails and friends to 3.2.21swills2015-04-038-14/+16
* Avoid patch issue that ends up with i18n listed twice in Gemfile by rearrangingswills2015-04-032-8/+10
* - Update to 4.14sunpoet2015-04-033-3/+4
* - Update to 0.8.0sunpoet2015-04-032-4/+5
* - Update to 5.90035sunpoet2015-04-032-6/+6
* www/py-flask-restful: update to 0.3.2rm2015-04-032-3/+3
* www/py-flask-oauthlib: update to 0.9.1rm2015-04-032-3/+3
* - Update to 1.19.24wen2015-04-022-6/+5
* - Update to 1.23.9wen2015-04-022-4/+3
* - Update to 1.24.2wen2015-04-022-4/+3
* Update to 0.10feld2015-04-023-13/+13
* Invert order of CATEGORIES to fix PKGORIGINerwin2015-04-011-1/+1
* Bump required system NSPR versionjbeich2015-04-011-1/+1
* - add CPE informationohauer2015-04-013-3/+6
* - use dedicated apache module file for subversion modulesohauer2015-04-012-9/+6
* - Update gmp-api to 38.0jbeich2015-04-0124-973/+1203
* www/p5-Test-LWP-UserAgent: 0.026 -> 0.027pi2015-04-013-5/+3
* - Update to 2.7.4sunpoet2015-04-011-22/+136
* Mark BROKEN: unfetchableantoine2015-04-011-0/+2
* Mark as broken: too creative (sorry I could not find a better term)bapt2015-03-311-0/+2
* - Update to 2.00sunpoet2015-03-312-3/+3
* - Update to 1.0.1sunpoet2015-03-312-3/+3
* - Update to 2.7.4sunpoet2015-03-312-3/+3
* Remove useless post-install targetbapt2015-03-311-6/+0
* www/e2guardian: NEW PORT - Dansguardian fork with many improvements and bug f...garga2015-03-316-0/+385
* - Update to 1.6.2sunpoet2015-03-313-4/+4
* www/py-flask-bootstrap: NEW PORT - Flask extension that adds Bootstrap to you...robak2015-03-314-0/+27
* - Update to 2.12.1culot2015-03-313-21/+74
* Update to 3.20141016.2.mat2015-03-312-4/+3
* Update enigmail to 1.8.1.jbeich2015-03-312-3/+4
* Fix madsonic rc script. I should have made an end-to-end test when I convertedjlh2015-03-311-17/+19
* Remove dead RINGSERVERbapt2015-03-313-6/+3
href='#n121'>121 122 123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543


                                                                           
                                                     

                                                                
                                                                   
                                                        










                                                                    
                                            


                            
                    
                   

      
                          

                               
                                 
                                
                                

                                         
                                         
                                      
                                            

                                                    
                                                       
                                                
                                               
                                  
                                  
                                  
                           
                                     
                            
                              
                    
                             
                  
                          
                                            
                          

                          
                       
 
                                                   

 


                                                                                    


                                                                               


                                                                               








                                                                               


                                                                               


                                                                               
                                                                             

                                                                               





                                                                               


                                                                              
 


                                                                              
 




                                                                                   
          
               
                        






                               



                                             
                                           



                                                                                  
                                                                                              




                       




                                                                           



                                    
                     
                                                        
            


                                                          


























                                                                                          

                                                                                                                   




                                                                                                             


                                                                           

                                                                                        

                               
                                  
                   
                         



                                           
                                  



                                                        


                                                                        
                                              

                                                       









                                                                                                          
 
                                                      

                  
                                                            
                

                                                                     

 







                                                                   
                                                                      
 

                                
                                                                      
                                                                    


                                                               
                                                                 
                                                                         
                                                               

                                                                              

                                                                   
                                                                   


                          
    
                                                              


                                      


                                  
                       



                                                        

                                                                            

                                                       

                                              



                                                                        
                                           
                                                                      

                                                 
 



                                                                                         
                                                                                                  
 
                                                                          



                                                        
                                                                      
 
                                                    
 



                                                                                                 
                                                                             


                                                                              
                                              
      


 
    
                                                                

                                                                           
 

                               
                                                                          

                                               

                                           
                                                            
                                                                                                     
 
                                                
                                                        

 








                                                                              





                                                                      
                      
 
                               
                                 

 
           








                                                                      
                                                   











                                                                      
                                                    















                                                                      








                                                                      
 










                                                                      
               
                             
 
                                              
                   
        
                                                  
                            

                                                              
                                         
                                    





                                                                                                                                                                                      

                                                                               
                                                                                          
        

                                                                                                      
                                                          
                                    
        
                                                         


           


                                                      



                               
                                  



                                             
           
                                             

                                  
                       


                                                                           
 
                                                                    

 






                                                


                               
                                   










                                                        
                                  

 


































                                                                                                               














                                                                                                                                       
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* tasks-control.c
 *
 * Copyright (C) 2000, 2001, 2002, 2003  Ximian, Inc.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Authors: Damon Chaplin <damon@ximian.com>
 *      Ettore Perazzoli
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <gtk/gtksignal.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkcheckbutton.h>
#include <gtk/gtkmessagedialog.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomeui/gnome-stock-icons.h>
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-print-paper.h>
#include <libgnomeprint/gnome-print-job.h>
#include <libgnomeprintui/gnome-print-job-preview.h>
#include <libgnomeprintui/gnome-print-paper-selector.h>
#include <libgnomeprintui/gnome-print-preview.h>
#include <libgnomeprintui/gnome-print-dialog.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-ui-util.h>
#include <e-util/e-dialog-utils.h>
#include <e-util/e-print.h>
#include "dialogs/cal-prefs-dialog.h"
#include "calendar-config.h"
#include "calendar-commands.h"
#include "e-tasks.h"
#include "e-calendar-table.h"
#include "print.h"
#include "tasks-control.h"
#include "evolution-shell-component-utils.h"
#include "e-util/e-menu.h"
#include "e-cal-menu.h"
#include "e-util/e-menu.h"
#include "itip-utils.h"

#define FIXED_MARGIN                            .05


static void tasks_control_activate_cb       (BonoboControl      *control,
                         gboolean        activate,
                         gpointer        user_data);
static void tasks_control_open_task_cmd     (BonoboUIComponent  *uic,
                         gpointer        data,
                         const char     *path);
static void tasks_control_new_task_cmd      (BonoboUIComponent  *uic,
                         gpointer        data,
                         const char     *path);
static void tasks_control_cut_cmd               (BonoboUIComponent      *uic,
                         gpointer                data,
                         const gchar            *path);
static void tasks_control_copy_cmd              (BonoboUIComponent      *uic,
                         gpointer                data,
                         const gchar            *path);
static void tasks_control_paste_cmd             (BonoboUIComponent      *uic,
                         gpointer                data,
                         const gchar            *path);
static void tasks_control_delete_cmd        (BonoboUIComponent  *uic,
                         gpointer        data,
                         const char     *path);
static void tasks_control_complete_cmd      (BonoboUIComponent  *uic,
                         gpointer        data,
                         const char     *path);
static void tasks_control_purge_cmd     (BonoboUIComponent  *uic,
                         gpointer        data,
                         const char     *path);
static void tasks_control_print_cmd     (BonoboUIComponent  *uic,
                         gpointer        data,
                         const char     *path);
static void tasks_control_print_preview_cmd (BonoboUIComponent  *uic,
                         gpointer        data,
                         const char     *path);
static void tasks_control_assign_cmd           (BonoboUIComponent      *uic,
                                                gpointer               data,
                                                const char             *path);

static void tasks_control_forward_cmd          (BonoboUIComponent      *uic,
                                                gpointer               data,
                                                const char             *path);

static void tasks_control_view_preview         (BonoboUIComponent *uic, 
                        const char *path, 
                        Bonobo_UIComponent_EventType type, 
                        const char *state, 
                        void *data);
      
BonoboControl *
tasks_control_new (void)
{
    BonoboControl *control;
    GtkWidget *tasks;

    tasks = e_tasks_new ();
    if (!tasks)
        return NULL;
    gtk_widget_show (tasks);

    control = bonobo_control_new (tasks);
    if (!control) {
        gtk_widget_destroy (tasks);
        g_message ("control_factory_fn(): could not create the control!");
        return NULL;
    }

    g_signal_connect (control, "activate", G_CALLBACK (tasks_control_activate_cb), tasks);

    return control;
}


static void
tasks_control_activate_cb       (BonoboControl      *control,
                     gboolean        activate,
                     gpointer        user_data)
{
    ETasks *tasks;

    tasks = E_TASKS (user_data);

    if (activate)
        tasks_control_activate (control, tasks);
    else
        tasks_control_deactivate (control, tasks);
}

struct _tasks_sensitize_item {
    char *command;
    guint32 enable;
};

static void
sensitize_items(BonoboUIComponent *uic, struct _tasks_sensitize_item *items, guint32 mask)
{
    while (items->command) {
        char command[32];

        g_assert(strlen(items->command)<21);
        sprintf(command, "/commands/%s", items->command);

        bonobo_ui_component_set_prop (uic, command, "sensitive",
                          (items->enable & mask) == 0 ? "1" : "0",
                          NULL);
        items++;
    }
}

static struct _tasks_sensitize_item tasks_sensitize_table[] = {
    { "TasksOpenTask", E_CAL_MENU_SELECT_ONE },
    { "TasksCut", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE },
    { "TasksCopy", E_CAL_MENU_SELECT_ANY },
    { "TasksPaste", E_CAL_MENU_SELECT_EDITABLE },
    { "TasksDelete", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE },
    { "TasksMarkComplete", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE | E_CAL_MENU_SELECT_NOTCOMPLETE},
    { "TasksPurge",  E_CAL_MENU_SELECT_EDITABLE },
    { "TasksAssign", E_CAL_MENU_SELECT_ONE | E_CAL_MENU_SELECT_EDITABLE | E_CAL_MENU_SELECT_ASSIGNABLE },
    { "TasksForward", E_CAL_MENU_SELECT_ONE },
    { 0 }
};

/* Sensitizes the UI Component menu/toolbar commands based on the number of
 * selected tasks.
 */
void
tasks_control_sensitize_commands (BonoboControl *control, ETasks *tasks, int n_selected)
{
    BonoboUIComponent *uic;
    gboolean read_only = TRUE;
    ECal *ecal;
    ECalModel *model;
    ECalMenu *menu;
    ECalMenuTargetSelect *t;
    GPtrArray *events;
    GSList *selected = NULL, *l = NULL;
    ECalendarTable *cal_table;

    uic = bonobo_control_get_ui_component (control);
    g_assert (uic != NULL);

    if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL)
        return;

    menu = e_tasks_get_tasks_menu (tasks);
    cal_table = e_tasks_get_calendar_table (tasks);
    model = e_calendar_table_get_model (cal_table);
    events = g_ptr_array_new ();
    selected = e_calendar_table_get_selected (cal_table);

    for (l = selected;l;l = g_slist_next (l)) {
        g_ptr_array_add (events, e_cal_model_copy_component_data ((ECalModelComponent *)l->data));
    }

    g_slist_free (selected);

    t = e_cal_menu_target_new_select (menu, model, events);

    ecal = e_cal_model_get_default_client (model);

    if (ecal) 
        e_cal_is_read_only (ecal, &read_only, NULL);
        
    sensitize_items (uic, tasks_sensitize_table, t->target.mask);
    e_menu_update_target ((EMenu *)menu, (EMenuTarget *)t);
}

/* Callback used when the selection in the table changes */
static void
selection_changed_cb (ETasks *tasks, int n_selected, gpointer data)
{
    BonoboControl *control;

    control = BONOBO_CONTROL (data);

    tasks_control_sensitize_commands (control, tasks, n_selected);
}

static BonoboUIVerb verbs [] = {
    BONOBO_UI_VERB ("TasksOpenTask", tasks_control_open_task_cmd),
    BONOBO_UI_VERB ("TasksNewTask", tasks_control_new_task_cmd),
    BONOBO_UI_VERB ("TasksCut", tasks_control_cut_cmd),
    BONOBO_UI_VERB ("TasksCopy", tasks_control_copy_cmd),
    BONOBO_UI_VERB ("TasksPaste", tasks_control_paste_cmd),
    BONOBO_UI_VERB ("TasksDelete", tasks_control_delete_cmd),
    BONOBO_UI_VERB ("TasksMarkComplete", tasks_control_complete_cmd),
    BONOBO_UI_VERB ("TasksPurge", tasks_control_purge_cmd),
    BONOBO_UI_VERB ("TasksPrint", tasks_control_print_cmd),
    BONOBO_UI_VERB ("TasksPrintPreview", tasks_control_print_preview_cmd),
    BONOBO_UI_VERB ("TasksAssign", tasks_control_assign_cmd),
        BONOBO_UI_VERB ("TasksForward", tasks_control_forward_cmd),
        BONOBO_UI_VERB ("ViewPreview", tasks_control_view_preview),
    BONOBO_UI_VERB_END
};

void
tasks_control_activate (BonoboControl *control, ETasks *tasks)
{
    Bonobo_UIContainer remote_uih;
    BonoboUIComponent *uic;
    int n_selected;
    ECalendarTable *cal_table;
    ETable *etable;
    gboolean state;

    uic = bonobo_control_get_ui_component (control);
    g_assert (uic != NULL);

    remote_uih = bonobo_control_get_remote_ui_container (control, NULL);
    bonobo_ui_component_set_container (uic, remote_uih, NULL);
    bonobo_object_release_unref (remote_uih, NULL);

    e_tasks_set_ui_component (tasks, uic);

    bonobo_ui_component_add_verb_list_with_data (uic, verbs, tasks);

    bonobo_ui_component_freeze (uic, NULL);

    bonobo_ui_util_set_ui (uic, PREFIX,
                   EVOLUTION_UIDIR "/evolution-tasks.xml",
                   "evolution-tasks",
                   NULL);

    e_tasks_setup_view_menus (tasks, uic);

    /* Signals from the tasks widget; also sensitize the menu items as appropriate */

    g_signal_connect (tasks, "selection_changed", G_CALLBACK (selection_changed_cb), control);

    e_menu_activate ((EMenu *)e_tasks_get_tasks_menu (tasks), uic, 1);
    cal_table = e_tasks_get_calendar_table (tasks);
    etable = e_calendar_table_get_table (cal_table);
    n_selected = e_table_selected_count (etable);

    tasks_control_sensitize_commands (control, tasks, n_selected);

    state = calendar_config_get_preview_state();

    bonobo_ui_component_thaw (uic, NULL);
    
    bonobo_ui_component_add_listener(uic, "ViewPreview", tasks_control_view_preview, tasks);
    bonobo_ui_component_set_prop(uic, "/commands/ViewPreview", "state", state?"1":"0", NULL);
    /* Show the dialog for setting the timezone if the user hasn't chosen
       a default timezone already. This is done in the startup wizard now,
       so we don't do it here. */
#if 0
    calendar_config_check_timezone_set ();
#endif
}


void
tasks_control_deactivate (BonoboControl *control, ETasks *tasks)
{
    BonoboUIComponent *uic = bonobo_control_get_ui_component (control);

    g_assert (uic != NULL);

    e_menu_activate ((EMenu *)e_tasks_get_tasks_menu (tasks), uic, 0);
    e_tasks_set_ui_component (tasks, NULL);

    e_tasks_discard_view_menus (tasks);

    /* Stop monitoring the "selection_changed" signal */
    g_signal_handlers_disconnect_matched (tasks, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, control);

    bonobo_ui_component_rm (uic, "/", NULL);
    bonobo_ui_component_unset_container (uic, NULL);
}

static void tasks_control_open_task_cmd     (BonoboUIComponent  *uic,
                         gpointer        data,
                         const char     *path)
{
    ETasks *tasks;

    tasks = E_TASKS (data);
    e_tasks_open_task (tasks);
}

static void
tasks_control_new_task_cmd      (BonoboUIComponent  *uic,
                     gpointer        data,
                     const char     *path)
{
    ETasks *tasks;

    tasks = E_TASKS (data);
    e_tasks_new_task (tasks);
}

static void
tasks_control_cut_cmd                   (BonoboUIComponent      *uic,
                     gpointer                data,
                     const char             *path)
{
    ETasks *tasks;
    ECalendarTable *cal_table;

    tasks = E_TASKS (data);
    cal_table = e_tasks_get_calendar_table (tasks);
    e_calendar_table_cut_clipboard (cal_table);
}

static void
tasks_control_copy_cmd                  (BonoboUIComponent      *uic,
                     gpointer                data,
                     const char             *path)
{
    ETasks *tasks;
    ECalendarTable *cal_table;

    tasks = E_TASKS (data);
    cal_table = e_tasks_get_calendar_table (tasks);
    e_calendar_table_copy_clipboard (cal_table);
}

static void
tasks_control_paste_cmd                 (BonoboUIComponent      *uic,
                     gpointer                data,
                     const char             *path)
{
    ETasks *tasks;
    ECalendarTable *cal_table;

    tasks = E_TASKS (data);
    cal_table = e_tasks_get_calendar_table (tasks);
    e_calendar_table_paste_clipboard (cal_table);
}

static void
tasks_control_delete_cmd        (BonoboUIComponent  *uic,
                     gpointer        data,
                     const char     *path)
{
    ETasks *tasks;

    tasks = E_TASKS (data);
    e_tasks_delete_selected (tasks);
}

static void
tasks_control_complete_cmd      (BonoboUIComponent  *uic,
                     gpointer        data,
                     const char     *path)
{
    ETasks *tasks;

    tasks = E_TASKS (data);
    e_tasks_complete_selected (tasks);
}

static gboolean
confirm_purge (ETasks *tasks)
{
    GtkWidget *dialog, *checkbox, *parent;
    int button;
    
    if (!calendar_config_get_confirm_purge ())
        return TRUE;

    parent = gtk_widget_get_toplevel (GTK_WIDGET (tasks));
    dialog = gtk_message_dialog_new (
        (GtkWindow *)parent,
        GTK_DIALOG_DESTROY_WITH_PARENT,
        GTK_MESSAGE_WARNING,
        GTK_BUTTONS_YES_NO,
        _("This operation will permanently erase all tasks marked as completed. If you continue, you will not be able to recover these tasks.\n\nReally erase these tasks?"));
    gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_NO);

    checkbox = gtk_check_button_new_with_label (_("Do not ask me again."));
    gtk_widget_show (checkbox);
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 6);
    
    button = gtk_dialog_run (GTK_DIALOG (dialog));  
    if (button == GTK_RESPONSE_YES && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)))
        calendar_config_set_confirm_purge (FALSE);
    gtk_widget_destroy (dialog);
    
    return button == GTK_RESPONSE_YES ? TRUE : FALSE;
}

static void
tasks_control_purge_cmd (BonoboUIComponent  *uic,
             gpointer        data,
             const char     *path)
{
    ETasks *tasks;

    tasks = E_TASKS (data);
    if (confirm_purge (tasks))
        e_tasks_delete_completed (tasks);
}


static void
print_tasks (ETasks *tasks, gboolean preview)
{
    ECalendarTable *cal_table;
    ETable *etable;

    cal_table = e_tasks_get_calendar_table (tasks);
    etable = e_calendar_table_get_table (E_CALENDAR_TABLE (cal_table));

    print_table (etable, _("Print Tasks"), _("Tasks"), preview);
}

/* File/Print callback */
static void
tasks_control_print_cmd (BonoboUIComponent *uic,
             gpointer data,
             const char *path)
{
    ETasks *tasks;

    tasks = E_TASKS (data);

    print_tasks (tasks, FALSE);
}

static void
tasks_control_print_preview_cmd (BonoboUIComponent *uic,
                 gpointer data,
                 const char *path)
{
    ETasks *tasks;

    tasks = E_TASKS (data);

    print_tasks (tasks, TRUE);
}

static void
tasks_control_assign_cmd (BonoboUIComponent *uic,
                         gpointer data,
                         const char *path)
{
              ETasks *tasks;
              ECalendarTable *cal_table;
              ECalModelComponent *comp_data;

              tasks = E_TASKS (data);
              cal_table = e_tasks_get_calendar_table (tasks);
              comp_data = e_calendar_table_get_selected_comp (cal_table);
           if (comp_data)
              e_calendar_table_open_task (cal_table, comp_data, TRUE);
}

static void
tasks_control_forward_cmd (BonoboUIComponent *uic,
                         gpointer data,
                          const char *path)
{
            ETasks *tasks;
               ECalendarTable *cal_table;
               ECalModelComponent *comp_data;
    
               tasks = E_TASKS (data);
               cal_table = e_tasks_get_calendar_table (tasks);
               comp_data = e_calendar_table_get_selected_comp (cal_table);
               if (comp_data) {
                       ECalComponent *comp;
                       comp = e_cal_component_new ();
                       e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
                       itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL);
                       g_object_unref (comp);
           }
}

static void
tasks_control_view_preview (BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type, const char *state, void *data)
{
        ETasks *tasks;

    if (type != Bonobo_UIComponent_STATE_CHANGED)
        return;
    
    tasks = E_TASKS (data);

    calendar_config_set_preview_state (state[0] != '0');
    e_tasks_show_preview (tasks, state[0] != '0');
}