diff options
author | Damon Chaplin <damon@helixcode.com> | 2000-09-06 08:13:05 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2000-09-06 08:13:05 +0800 |
commit | e8648e48175c1b6d26bff5316c2c7d738245a63c (patch) | |
tree | b6dcd1e5670462fe810b90a601013556d5db2604 | |
parent | 6403bd5b4def7c610285d2aaad10e793b321091d (diff) | |
download | gsoc2013-evolution-e8648e48175c1b6d26bff5316c2c7d738245a63c.tar gsoc2013-evolution-e8648e48175c1b6d26bff5316c2c7d738245a63c.tar.gz gsoc2013-evolution-e8648e48175c1b6d26bff5316c2c7d738245a63c.tar.bz2 gsoc2013-evolution-e8648e48175c1b6d26bff5316c2c7d738245a63c.tar.lz gsoc2013-evolution-e8648e48175c1b6d26bff5316c2c7d738245a63c.tar.xz gsoc2013-evolution-e8648e48175c1b6d26bff5316c2c7d738245a63c.tar.zst gsoc2013-evolution-e8648e48175c1b6d26bff5316c2c7d738245a63c.zip |
uses the new TaskEditor dialog.
2000-09-06 Damon Chaplin <damon@helixcode.com>
* gui/e-calendar-table.c (e_calendar_table_open_task): uses the new
TaskEditor dialog.
* gui/dialogs/task-editor.[hc]:
* gui/dialogs/task-editor-dialog.glade: updated. Still need to fix the
'Status' property (CalComponent doesn't support it yet), and use a
replacement for GnomeDateEdit, since we need to support setting 'None'
as the date.
2000-09-04 Damon Chaplin <damon@helixcode.com>
* gui/event-editor.c (obj_updated_cb):
(obj_removed_cb): compare the updated object's uid with the one we
are editing, and just return if it doesn't match.
2000-09-01 Damon Chaplin <damon@helixcode.com>
* gui/gnome-cal.c (gnome_calendar_tag_calendar): added check to see
if the client has loaded successfully. Gets rid of a few warnings.
svn path=/trunk/; revision=5217
-rw-r--r-- | calendar/ChangeLog | 32 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor-dialog.glade | 386 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor-dialog.glade.h | 16 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 929 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.h | 5 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.glade | 386 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.c | 12 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 2 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 28 | ||||
-rw-r--r-- | calendar/gui/event-editor-dialog.glade | 54 | ||||
-rw-r--r-- | calendar/gui/event-editor.c | 18 | ||||
-rw-r--r-- | calendar/gui/gncal-todo.c | 6 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 20 |
13 files changed, 1300 insertions, 594 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 9a6b9e155e..af7e292b09 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,25 @@ +2000-09-06 Damon Chaplin <damon@helixcode.com> + + * gui/e-calendar-table.c (e_calendar_table_open_task): uses the new + TaskEditor dialog. + + * gui/dialogs/task-editor.[hc]: + * gui/dialogs/task-editor-dialog.glade: updated. Still need to fix the + 'Status' property (CalComponent doesn't support it yet), and use a + replacement for GnomeDateEdit, since we need to support setting 'None' + as the date. + +2000-09-04 Damon Chaplin <damon@helixcode.com> + + * gui/event-editor.c (obj_updated_cb): + (obj_removed_cb): compare the updated object's uid with the one we + are editing, and just return if it doesn't match. + +2000-09-01 Damon Chaplin <damon@helixcode.com> + + * gui/gnome-cal.c (gnome_calendar_tag_calendar): added check to see + if the client has loaded successfully. Gets rid of a few warnings. + 2000-09-05 JP Rosevear <jpr@helixcode.com> * cal-util/cal-recur.c (generate_instances_for_year): The exdate @@ -144,6 +166,16 @@ * gui/print.c: Countless small changes for gnome-print 0.21+ +2000-08-30 Damon Chaplin <damon@helixcode.com> + + * gui/e-day-view.[hc]: + * gui/e-day-view-main-item.c: + * gui/e-week-view.[hc]: + * gui/e-week-view-main-item.c: + * gui/calendar-commands.c: + * gui/gnome-cal.[hc]: switched to using new ECalendar widget, + and a few other fixes. + 2000-08-30 Federico Mena Quintero <federico@helixcode.com> * gui/gnome-cal.h (GnomeCal): Removed unused field event_editor. diff --git a/calendar/gui/dialogs/task-editor-dialog.glade b/calendar/gui/dialogs/task-editor-dialog.glade index 56f7f83422..8a8ca800d6 100644 --- a/calendar/gui/dialogs/task-editor-dialog.glade +++ b/calendar/gui/dialogs/task-editor-dialog.glade @@ -18,9 +18,11 @@ <class>GnomeApp</class> <name>task-editor-dialog</name> <visible>False</visible> + <title>task-editor-dialog</title> <type>GTK_WINDOW_TOPLEVEL</type> <position>GTK_WIN_POS_NONE</position> <modal>False</modal> + <default_height>350</default_height> <allow_shrink>False</allow_shrink> <allow_grow>True</allow_grow> <auto_shrink>False</auto_shrink> @@ -61,7 +63,7 @@ <widget> <class>GtkTable</class> <name>table3</name> - <rows>2</rows> + <rows>1</rows> <columns>2</columns> <homogeneous>False</homogeneous> <row_spacing>4</row_spacing> @@ -75,19 +77,19 @@ <widget> <class>GtkLabel</class> <name>label3</name> - <label>S_ubject:</label> + <label>S_ummary</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> <xalign>0.5</xalign> <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <default_focus_target>entry1</default_focus_target> + <default_focus_target>summary</default_focus_target> <child> <left_attach>0</left_attach> <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> <xexpand>False</xexpand> @@ -101,7 +103,7 @@ <widget> <class>GtkEntry</class> - <name>entry1</name> + <name>summary</name> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> @@ -110,63 +112,11 @@ <child> <left_attach>1</left_attach> <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label10</name> - <label>Owner:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> <top_attach>0</top_attach> <bottom_attach>1</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label11</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> + <xexpand>True</xexpand> <yexpand>False</yexpand> <xshrink>False</xshrink> <yshrink>False</yshrink> @@ -201,7 +151,7 @@ <class>GtkTable</class> <name>table1</name> <rows>2</rows> - <columns>2</columns> + <columns>4</columns> <homogeneous>False</homogeneous> <row_spacing>2</row_spacing> <column_spacing>4</column_spacing> @@ -213,9 +163,9 @@ <widget> <class>GnomeDateEdit</class> - <name>dateedit1</name> + <name>due-date</name> <show_time>True</show_time> - <use_24_format>False</use_24_format> + <use_24_format>True</use_24_format> <week_start_monday>False</week_start_monday> <lower_hour>7</lower_hour> <upper_hour>19</upper_hour> @@ -237,7 +187,7 @@ <widget> <class>GnomeDateEdit</class> - <name>dateedit2</name> + <name>start-date</name> <show_time>True</show_time> <use_24_format>True</use_24_format> <week_start_monday>False</week_start_monday> @@ -310,6 +260,66 @@ <yfill>False</yfill> </child> </widget> + + <widget> + <class>GtkLabel</class> + <name>label9</name> + <label>% Comp_lete:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <default_focus_target>percent-complete</default_focus_target> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkSpinButton</class> + <name>percent-complete</name> + <width>60</width> + <can_focus>True</can_focus> + <climb_rate>1</climb_rate> + <digits>0</digits> + <numeric>False</numeric> + <update_policy>GTK_UPDATE_ALWAYS</update_policy> + <snap>False</snap> + <wrap>False</wrap> + <value>0</value> + <lower>0</lower> + <upper>100</upper> + <step>10</step> + <page>10</page> + <page_size>10</page_size> + <child> + <left_attach>3</left_attach> + <right_attach>4</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> </widget> </widget> @@ -344,7 +354,7 @@ <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <default_focus_target>combo-entry1</default_focus_target> + <default_focus_target>status</default_focus_target> <child> <padding>0</padding> <expand>False</expand> @@ -353,35 +363,20 @@ </widget> <widget> - <class>GtkCombo</class> - <name>combo1</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> + <class>GtkOptionMenu</class> + <name>status</name> + <can_focus>True</can_focus> <items>Not Started In Progress Completed Cancelled </items> + <initial_choice>0</initial_choice> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>combo-entry1</name> - <width>60</width> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text>Not Started</text> - </widget> </widget> <widget> @@ -394,7 +389,7 @@ Cancelled <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <default_focus_target>combo-entry2</default_focus_target> + <default_focus_target>priority</default_focus_target> <child> <padding>0</padding> <expand>False</expand> @@ -403,47 +398,32 @@ Cancelled </widget> <widget> - <class>GtkCombo</class> - <name>combo2</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> + <class>GtkOptionMenu</class> + <name>priority</name> + <can_focus>True</can_focus> <items>High Normal Low </items> + <initial_choice>0</initial_choice> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>combo-entry2</name> - <width>60</width> - <can_focus>True</can_focus> - <editable>False</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text>High</text> - </widget> </widget> <widget> <class>GtkLabel</class> - <name>label9</name> - <label>% Comp_lete:</label> + <name>label18</name> + <label>C_lassification:</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> <xalign>0.5</xalign> <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <default_focus_target>spinbutton1</default_focus_target> + <default_focus_target>classification</default_focus_target> <child> <padding>0</padding> <expand>False</expand> @@ -452,25 +432,18 @@ Low </widget> <widget> - <class>GtkSpinButton</class> - <name>spinbutton1</name> + <class>GtkOptionMenu</class> + <name>classification</name> <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>False</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>0</value> - <lower>0</lower> - <upper>100</upper> - <step>10</step> - <page>10</page> - <page_size>10</page_size> + <items>Public +Private +Confidential +</items> + <initial_choice>0</initial_choice> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> </widget> </widget> @@ -490,8 +463,7 @@ Low <widget> <class>GtkText</class> - <name>text1</name> - <height>150</height> + <name>description</name> <can_focus>True</can_focus> <editable>True</editable> <text></text> @@ -513,17 +485,30 @@ Low <class>GtkButton</class> <name>button3</name> <can_focus>True</can_focus> - <label>_Contacts...</label> <child> <padding>0</padding> <expand>False</expand> <fill>False</fill> </child> + + <widget> + <class>GtkLabel</class> + <name>label16</name> + <sensitive>False</sensitive> + <label>_Contacts...</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>4</xpad> + <ypad>0</ypad> + </widget> </widget> <widget> <class>GtkEntry</class> - <name>entry2</name> + <name>contacts</name> + <sensitive>False</sensitive> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> @@ -540,17 +525,30 @@ Low <class>GtkButton</class> <name>button4</name> <can_focus>True</can_focus> - <label>Ca_tegories...</label> <child> <padding>0</padding> <expand>False</expand> <fill>False</fill> </child> + + <widget> + <class>GtkLabel</class> + <name>label17</name> + <sensitive>False</sensitive> + <label>Ca_tegories...</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>4</xpad> + <ypad>0</ypad> + </widget> </widget> <widget> <class>GtkEntry</class> - <name>entry3</name> + <name>categories</name> + <sensitive>False</sensitive> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> @@ -562,20 +560,6 @@ Low <fill>True</fill> </child> </widget> - - <widget> - <class>GtkCheckButton</class> - <name>checkbutton1</name> - <can_focus>True</can_focus> - <label>Private</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> </widget> </widget> @@ -596,7 +580,7 @@ Low <class>GtkTable</class> <name>table4</name> <border_width>4</border_width> - <rows>4</rows> + <rows>2</rows> <columns>2</columns> <homogeneous>False</homogeneous> <row_spacing>2</row_spacing> @@ -604,7 +588,7 @@ Low <widget> <class>GnomeDateEdit</class> - <name>dateedit3</name> + <name>completed-date</name> <show_time>True</show_time> <use_24_format>True</use_24_format> <week_start_monday>False</week_start_monday> @@ -654,32 +638,6 @@ Low <widget> <class>GtkLabel</class> - <name>label13</name> - <label>Location:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> <name>label14</name> <label>URL:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -691,84 +649,10 @@ Low <child> <left_attach>0</left_attach> <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry4</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> <top_attach>1</top_attach> <bottom_attach>2</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry5</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label15</name> - <label>Resources:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> <xexpand>False</xexpand> <yexpand>False</yexpand> <xshrink>False</xshrink> @@ -780,7 +664,7 @@ Low <widget> <class>GtkEntry</class> - <name>entry6</name> + <name>url</name> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> @@ -789,8 +673,8 @@ Low <child> <left_attach>1</left_attach> <right_attach>2</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> <xexpand>True</xexpand> diff --git a/calendar/gui/dialogs/task-editor-dialog.glade.h b/calendar/gui/dialogs/task-editor-dialog.glade.h index 9ee959817f..9c20880b51 100644 --- a/calendar/gui/dialogs/task-editor-dialog.glade.h +++ b/calendar/gui/dialogs/task-editor-dialog.glade.h @@ -4,30 +4,30 @@ * DO NOT compile it as part of your application. */ -gchar *s = N_("S_ubject:"); -gchar *s = N_("Owner:"); +gchar *s = N_("task-editor-dialog"); +gchar *s = N_("S_ummary"); gchar *s = N_("Sta_rt Date:"); gchar *s = N_("_Due Date:"); +gchar *s = N_("% Comp_lete:"); gchar *s = N_("_Status:"); gchar *s = N_("Not Started\n" "In Progress\n" "Completed\n" "Cancelled\n" ""); -gchar *s = N_("Not Started"); gchar *s = N_("_Priority:"); gchar *s = N_("High\n" "Normal\n" "Low\n" ""); -gchar *s = N_("High"); -gchar *s = N_("% Comp_lete:"); +gchar *s = N_("C_lassification:"); +gchar *s = N_("Public\n" + "Private\n" + "Confidential\n" + ""); gchar *s = N_("_Contacts..."); gchar *s = N_("Ca_tegories..."); -gchar *s = N_("Private"); gchar *s = N_("Task"); gchar *s = N_("Date Completed:"); -gchar *s = N_("Location:"); gchar *s = N_("URL:"); -gchar *s = N_("Resources:"); gchar *s = N_("Details"); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index dd40c1b9df..a91278b84a 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -31,6 +31,8 @@ #include <gnome.h> #include <glade/glade.h> #include <e-util/e-util.h> +#include <e-util/e-dialog-widgets.h> +#include <cal-util/timeutil.h> #include <cal-client/cal-client.h> #include "task-editor.h" @@ -42,25 +44,118 @@ typedef struct { /* UI handler */ BonoboUIHandler *uih; + /* Client to use */ + CalClient *client; + /* Calendar component we are editing; this is an internal copy and is * not one of the read-only objects from the parent calendar. */ CalComponent *comp; + + /* This is TRUE while we are setting the widget values. We just return + from any signal handlers. */ + gboolean ignore_callbacks; + /* Widgets from the Glade file */ GtkWidget *app; + + GtkWidget *summary; + + GtkWidget *due_date; + GtkWidget *start_date; + + GtkWidget *percent_complete; + + GtkWidget *status; + GtkWidget *priority; + GtkWidget *classification; + + GtkWidget *description; + + GtkWidget *contacts; + GtkWidget *categories; + + GtkWidget *completed_date; + GtkWidget *url; } TaskEditorPrivate; +/* CalComponent doesn't support status yet, so we use this temporarily. */ +typedef enum { + STATUS_NOT_STARTED, + STATUS_IN_PROGRESS, + STATUS_COMPLETED, + STATUS_CANCELLED +} TaskEditorStatus; + +static const int status_map[] = { + STATUS_NOT_STARTED, + STATUS_IN_PROGRESS, + STATUS_COMPLETED, + STATUS_CANCELLED, + -1 +}; + +typedef enum { + PRIORITY_HIGH, + PRIORITY_NORMAL, + PRIORITY_LOW, + PRIORITY_UNDEFINED, +} TaskEditorPriority; + +static const int priority_map[] = { + PRIORITY_HIGH, + PRIORITY_NORMAL, + PRIORITY_LOW, + PRIORITY_UNDEFINED, + -1 +}; + +static const int classification_map[] = { + CAL_COMPONENT_CLASS_PUBLIC, + CAL_COMPONENT_CLASS_PRIVATE, + CAL_COMPONENT_CLASS_CONFIDENTIAL, + -1 +}; + static void task_editor_class_init (TaskEditorClass *class); static void task_editor_init (TaskEditor *tedit); -TaskEditor * task_editor_construct (TaskEditor *tedit); +static gint app_delete_event_cb (GtkWidget *widget, + GdkEvent *event, + gpointer data); +static void close_dialog (TaskEditor *tedit); static gboolean get_widgets (TaskEditor *tedit); static void init_widgets (TaskEditor *tedit); static void create_menu (TaskEditor *tedit); static void create_toolbar (TaskEditor *tedit); static void task_editor_destroy (GtkObject *object); +static char * make_title_from_comp (CalComponent *comp); +static void clear_widgets (TaskEditor *tedit); +static void fill_widgets (TaskEditor *tedit); + +static void file_save_cb (GtkWidget *widget, gpointer data); +static void file_save_and_close_cb (GtkWidget *widget, gpointer data); +static void file_delete_cb (GtkWidget *widget, gpointer data); +static void file_close_cb (GtkWidget *widget, gpointer data); + +static void save_todo_object (TaskEditor *tedit); +static void dialog_to_comp_object (TaskEditor *tedit); + +static void obj_updated_cb (CalClient *client, const char *uid, gpointer data); +static void obj_removed_cb (CalClient *client, const char *uid, gpointer data); +static void raise_and_focus (GtkWidget *widget); + +static TaskEditorPriority priority_value_to_index (int priority_value); +static int priority_index_to_value (TaskEditorPriority priority); + +static void completed_date_changed (GnomeDateEdit *dedit, + TaskEditor *tedit); +static void status_changed (GtkMenu *menu, + TaskEditor *tedit); +static void percent_complete_changed (GtkAdjustment *adj, + TaskEditor *tedit); static GtkObjectClass *parent_class; @@ -77,7 +172,6 @@ task_editor_class_init (TaskEditorClass *class) parent_class = gtk_type_class (GTK_TYPE_OBJECT); - object_class->destroy = task_editor_destroy; } @@ -89,6 +183,8 @@ task_editor_init (TaskEditor *tedit) priv = g_new0 (TaskEditorPrivate, 1); tedit->priv = priv; + + priv->ignore_callbacks = FALSE; } @@ -104,7 +200,6 @@ task_editor_new (void) TaskEditor *tedit; tedit = TASK_EDITOR (gtk_type_new (task_editor_get_type ())); - return task_editor_construct (tedit); } @@ -159,10 +254,8 @@ task_editor_construct (TaskEditor *tedit) /* Hook to destruction of the dialog */ -#if 0 gtk_signal_connect (GTK_OBJECT (priv->app), "delete_event", GTK_SIGNAL_FUNC (app_delete_event_cb), tedit); -#endif /* Show the dialog */ @@ -177,6 +270,35 @@ task_editor_construct (TaskEditor *tedit) } +/* Callback used when the dialog box is destroyed */ +static gint +app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) +{ + TaskEditor *tedit; + + /* FIXME: need to check for a dirty object */ + + tedit = TASK_EDITOR (data); + close_dialog (tedit); + + return TRUE; +} + + +/* Closes the dialog box and emits the appropriate signals */ +static void +close_dialog (TaskEditor *tedit) +{ + TaskEditorPrivate *priv; + + priv = tedit->priv; + + g_assert (priv->app != NULL); + + gtk_object_destroy (GTK_OBJECT (tedit)); +} + + /* Gets the widgets from the XML file and returns if they are all available. * For the widgets whose values can be simply set with e-dialog-utils, it does * that as well. @@ -192,7 +314,40 @@ get_widgets (TaskEditor *tedit) priv->app = GW ("task-editor-dialog"); - return TRUE; + priv->summary = GW ("summary"); + + priv->due_date = GW ("due-date"); + priv->start_date = GW ("start-date"); + + priv->percent_complete = GW ("percent-complete"); + + priv->status = GW ("status"); + priv->priority = GW ("priority"); + priv->classification = GW ("classification"); + + priv->description = GW ("description"); + + priv->contacts = GW ("contacts"); + priv->categories = GW ("categories"); + + priv->completed_date = GW ("completed-date"); + priv->url = GW ("url"); + +#undef GW + + return (priv->app + && priv->summary + && priv->due_date + && priv->start_date + && priv->percent_complete + && priv->status + && priv->priority + && priv->classification + && priv->description + && priv->contacts + && priv->categories + && priv->completed_date + && priv->url); } @@ -201,9 +356,59 @@ static void init_widgets (TaskEditor *tedit) { TaskEditorPrivate *priv; + GnomeDateEdit *gde; + GtkWidget *widget; priv = tedit->priv; + + /* Connect signals. The Status, Percent Complete & Date Completed + properties are closely related so whenever one changes we may need + to update the other 2. */ + gtk_signal_connect (GTK_OBJECT (priv->completed_date), "date_changed", + GTK_SIGNAL_FUNC (completed_date_changed), tedit); + gtk_signal_connect (GTK_OBJECT (priv->completed_date), "time_changed", + GTK_SIGNAL_FUNC (completed_date_changed), tedit); + + gtk_signal_connect (GTK_OBJECT (GTK_OPTION_MENU (priv->status)->menu), + "deactivate", + GTK_SIGNAL_FUNC (status_changed), tedit); + + gtk_signal_connect (GTK_OBJECT (GTK_SPIN_BUTTON (priv->percent_complete)->adjustment), + "value_changed", + GTK_SIGNAL_FUNC (percent_complete_changed), tedit); + + + /* Hide the stupid 'Calendar' labels. */ + gde = GNOME_DATE_EDIT (priv->due_date); + gtk_widget_hide (gde->cal_label); + widget = gde->date_entry; + gtk_box_set_child_packing (GTK_BOX (widget->parent), widget, + FALSE, FALSE, 0, GTK_PACK_START); + widget = gde->time_entry; + gtk_box_set_child_packing (GTK_BOX (widget->parent), widget, + FALSE, FALSE, 0, GTK_PACK_START); + gtk_box_set_spacing (GTK_BOX (widget->parent), 2); + + gde = GNOME_DATE_EDIT (priv->start_date); + gtk_widget_hide (gde->cal_label); + widget = gde->date_entry; + gtk_box_set_child_packing (GTK_BOX (widget->parent), widget, + FALSE, FALSE, 0, GTK_PACK_START); + widget = gde->time_entry; + gtk_box_set_child_packing (GTK_BOX (widget->parent), widget, + FALSE, FALSE, 0, GTK_PACK_START); + gtk_box_set_spacing (GTK_BOX (widget->parent), 2); + + gde = GNOME_DATE_EDIT (priv->completed_date); + gtk_widget_hide (gde->cal_label); + widget = gde->date_entry; + gtk_box_set_child_packing (GTK_BOX (widget->parent), widget, + FALSE, FALSE, 0, GTK_PACK_START); + widget = gde->time_entry; + gtk_box_set_child_packing (GTK_BOX (widget->parent), widget, + FALSE, FALSE, 0, GTK_PACK_START); + gtk_box_set_spacing (GTK_BOX (widget->parent), 2); } @@ -238,11 +443,12 @@ static GnomeUIInfo file_menu[] = { GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_ITEM_NONE (N_("FIXME: S_end"), NULL, NULL), GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_SAVE_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_SAVE_ITEM (file_save_cb, NULL), GNOMEUIINFO_MENU_SAVE_AS_ITEM (NULL, NULL), GNOMEUIINFO_ITEM_NONE (N_("FIXME: Save Attac_hments..."), NULL, NULL), GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Delete"), NULL, NULL), + GNOMEUIINFO_ITEM_STOCK (N_("_Delete"), NULL, + file_delete_cb, GNOME_STOCK_PIXMAP_TRASH), GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Move to Folder..."), NULL, NULL), GNOMEUIINFO_ITEM_NONE (N_("FIXME: Cop_y to Folder..."), NULL, NULL), GNOMEUIINFO_SEPARATOR, @@ -252,7 +458,7 @@ static GnomeUIInfo file_menu[] = { GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_MENU_PROPERTIES_ITEM (NULL, NULL), GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_CLOSE_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_CLOSE_ITEM (file_close_cb, NULL), GNOMEUIINFO_END }; @@ -406,31 +612,43 @@ create_menu (TaskEditor *tedit) /* Toolbar */ static GnomeUIInfo toolbar[] = { - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Save and Close"), + GNOMEUIINFO_ITEM_STOCK (N_("Save and Close"), N_("Save the task and close the dialog box"), - NULL, + file_save_and_close_cb, GNOME_STOCK_PIXMAP_SAVE), GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Print..."), - N_("Print this item"), NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Insert File..."), - N_("Insert a file as an attachment"), NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Recurrence..."), - N_("Configure recurrence rules"), NULL), + GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Print..."), + N_("Print this item"), + NULL, + GNOME_STOCK_PIXMAP_PRINT), + GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Insert File..."), + N_("Insert a file as an attachment"), + NULL, + GNOME_STOCK_PIXMAP_ATTACH), GNOMEUIINFO_SEPARATOR, +#if 0 GNOMEUIINFO_ITEM_NONE (N_("FIXME: Assign Task..."), - N_("Assign the task to someone"), NULL), + N_("Assign the task to someone"), + NULL), GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Delete"), - N_("Delete this item"), NULL), +#endif + GNOMEUIINFO_ITEM_STOCK (N_("Delete"), + N_("Delete this task"), + file_delete_cb, + GNOME_STOCK_PIXMAP_TRASH), GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Previous"), - N_("Go to the previous item"), NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Next"), - N_("Go to the next item"), NULL), + GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Previous"), + N_("Go to the previous item"), + NULL, + GNOME_STOCK_PIXMAP_BACK), + GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Next"), + N_("Go to the next item"), + NULL, + GNOME_STOCK_PIXMAP_FORWARD), GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Help"), - N_("See online help"), NULL, GNOME_STOCK_PIXMAP_HELP), + N_("See online help"), + NULL, + GNOME_STOCK_PIXMAP_HELP), GNOMEUIINFO_END }; @@ -469,13 +687,672 @@ static void task_editor_destroy (GtkObject *object) { TaskEditor *tedit; + TaskEditorPrivate *priv; g_return_if_fail (object != NULL); g_return_if_fail (IS_TASK_EDITOR (object)); tedit = TASK_EDITOR (object); + priv = tedit->priv; + if (priv->uih) { + bonobo_object_unref (BONOBO_OBJECT (priv->uih)); + priv->uih = NULL; + } + + if (priv->app) { + gtk_widget_destroy (priv->app); + priv->app = NULL; + } + + if (priv->comp) { + gtk_object_unref (GTK_OBJECT (priv->comp)); + priv->comp = NULL; + } + + if (priv->client) { + gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), + tedit); + gtk_object_unref (GTK_OBJECT (priv->client)); + priv->client = NULL; + } + + if (priv->xml) { + gtk_object_unref (GTK_OBJECT (priv->xml)); + priv->xml = NULL; + } + g_free (priv); + tedit->priv = NULL; + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } +void +task_editor_set_cal_client (TaskEditor *tedit, + CalClient *client) +{ + TaskEditorPrivate *priv; + + g_return_if_fail (tedit != NULL); + g_return_if_fail (IS_TASK_EDITOR (tedit)); + + priv = tedit->priv; + + if (client == priv->client) + return; + + if (client) + g_return_if_fail (IS_CAL_CLIENT (client)); + + if (client) + g_return_if_fail (cal_client_is_loaded (client)); + + if (client) + gtk_object_ref (GTK_OBJECT (client)); + + if (priv->client) { + gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), + tedit); + gtk_object_unref (GTK_OBJECT (priv->client)); + } + + priv->client = client; + + if (priv->client) { + gtk_signal_connect (GTK_OBJECT (priv->client), "obj_updated", + GTK_SIGNAL_FUNC (obj_updated_cb), tedit); + gtk_signal_connect (GTK_OBJECT (priv->client), "obj_removed", + GTK_SIGNAL_FUNC (obj_removed_cb), tedit); + } +} + + +/* Callback used when the calendar client tells us that an object changed */ +static void +obj_updated_cb (CalClient *client, const char *uid, gpointer data) +{ + TaskEditor *tedit; + TaskEditorPrivate *priv; + CalComponent *comp; + CalClientGetStatus status; + const gchar *editing_uid; + + tedit = TASK_EDITOR (data); + + g_return_if_fail (IS_TASK_EDITOR (tedit)); + + priv = tedit->priv; + + /* If we aren't showing the object which has been updated, return. */ + if (!priv->comp) + return; + cal_component_get_uid (priv->comp, &editing_uid); + if (strcmp (uid, editing_uid)) + return; + + + /* Get the task from the server. */ + status = cal_client_get_object (priv->client, uid, &comp); + + switch (status) { + case CAL_CLIENT_GET_SUCCESS: + /* Everything is fine */ + break; + + case CAL_CLIENT_GET_SYNTAX_ERROR: + g_message ("obj_updated_cb(): Syntax error when getting object `%s'", uid); + return; + + case CAL_CLIENT_GET_NOT_FOUND: + /* The object is no longer in the server, so do nothing */ + return; + + default: + g_assert_not_reached (); + return; + } + + raise_and_focus (priv->app); +} + +/* Callback used when the calendar client tells us that an object was removed */ +static void +obj_removed_cb (CalClient *client, const char *uid, gpointer data) +{ + TaskEditor *tedit; + TaskEditorPrivate *priv; + const gchar *editing_uid; + + tedit = TASK_EDITOR (data); + + g_return_if_fail (tedit != NULL); + g_return_if_fail (IS_TASK_EDITOR (tedit)); + + priv = tedit->priv; + + /* If we aren't showing the object which has been updated, return. */ + if (!priv->comp) + return; + cal_component_get_uid (priv->comp, &editing_uid); + if (strcmp (uid, editing_uid)) + return; + + + raise_and_focus (priv->app); +} + + +/* Brings attention to a window by raising it and giving it focus */ +static void +raise_and_focus (GtkWidget *widget) +{ + g_assert (GTK_WIDGET_REALIZED (widget)); + gdk_window_show (widget->window); + gtk_widget_grab_focus (widget); +} + + +/** + * task_editor_set_todo_object: + * @tedit: A #TaskEditor. + * @comp: A todo object. + * + * Sets the todo object that a task editor dialog will manipulate. + **/ +void +task_editor_set_todo_object (TaskEditor *tedit, + CalComponent *comp) +{ + TaskEditorPrivate *priv; + char *title; + + g_return_if_fail (tedit != NULL); + g_return_if_fail (IS_TASK_EDITOR (tedit)); + + priv = tedit->priv; + + if (priv->comp) { + gtk_object_unref (GTK_OBJECT (priv->comp)); + priv->comp = NULL; + } + + if (comp) + priv->comp = cal_component_clone (comp); + + title = make_title_from_comp (priv->comp); + gtk_window_set_title (GTK_WINDOW (priv->app), title); + g_free (title); + + fill_widgets (tedit); +} + + +/* Creates an appropriate title for the task editor dialog */ +static char * +make_title_from_comp (CalComponent *comp) +{ + const char *summary; + CalComponentVType type; + CalComponentText text; + + if (!comp) + return g_strdup (_("Edit Task")); + + cal_component_get_summary (comp, &text); + if (text.value) + summary = text.value; + else + summary = _("No summary"); + + + type = cal_component_get_vtype (comp); + switch (type) { + case CAL_COMPONENT_EVENT: + return g_strdup_printf (_("Appointment - %s"), summary); + + case CAL_COMPONENT_TODO: + return g_strdup_printf (_("Task - %s"), summary); + + case CAL_COMPONENT_JOURNAL: + return g_strdup_printf (_("Journal entry - %s"), summary); + + default: + g_message ("make_title_from_comp(): Cannot handle object of type %d", type); + return NULL; + } +} + + +/* Fills the widgets with default values */ +static void +clear_widgets (TaskEditor *tedit) +{ + TaskEditorPrivate *priv; + + priv = tedit->priv; + + +} + +/* Fills in the widgets with the proper values */ +static void +fill_widgets (TaskEditor *tedit) +{ + TaskEditorPrivate *priv; + CalComponentText text; + CalComponentDateTime d; + struct icaltimetype *completed; + CalComponentClassification classification; + GSList *l; + time_t t; + int *priority_value, *percent; + TaskEditorPriority priority; + const char *url; + + priv = tedit->priv; + + clear_widgets (tedit); + + if (!priv->comp) + return; + + /* We want to ignore any signals emitted while changing fields. */ + priv->ignore_callbacks = TRUE; + + + cal_component_get_summary (priv->comp, &text); + e_dialog_editable_set (priv->summary, text.value); + + cal_component_get_description_list (priv->comp, &l); + if (l) { + text = *(CalComponentText *)l->data; + e_dialog_editable_set (priv->description, text.value); + } else { + e_dialog_editable_set (priv->description, NULL); + } + cal_component_free_text_list (l); + + /* Due Date. */ + cal_component_get_due (priv->comp, &d); + if (d.value) { + t = icaltime_as_timet (*d.value); + } else { + /* FIXME: Can't set GnomeDateEdit to a date of 'None'. */ + t = time (NULL); + } + e_dialog_dateedit_set (priv->due_date, t); + + /* Start Date. */ + cal_component_get_dtstart (priv->comp, &d); + if (d.value) { + t = icaltime_as_timet (*d.value); + } else { + /* FIXME: Can't set GnomeDateEdit to a date of 'None'. */ + t = time (NULL); + } + e_dialog_dateedit_set (priv->start_date, t); + + /* Completed Date. */ + cal_component_get_completed (priv->comp, &completed); + if (completed) { + t = icaltime_as_timet (*completed); + cal_component_free_icaltimetype (completed); + } else { + /* FIXME: Can't set GnomeDateEdit to a date of 'None'. */ + t = time (NULL); + } + e_dialog_dateedit_set (priv->completed_date, t); + + /* Percent Complete. */ + cal_component_get_percent (priv->comp, &percent); + if (percent) { + e_dialog_spin_set (priv->percent_complete, *percent); + cal_component_free_percent (percent); + } else { + /* FIXME: Could check if task is completed and set 100%. */ + e_dialog_spin_set (priv->percent_complete, 0); + } + + /* Status. FIXME: CalComponent doesn't support this yet. */ + e_dialog_option_menu_set (priv->status, STATUS_IN_PROGRESS, + status_map); + + /* Priority. */ + cal_component_get_priority (priv->comp, &priority_value); + if (priority_value) { + priority = priority_value_to_index (*priority_value); + cal_component_free_priority (priority_value); + } else { + priority = PRIORITY_UNDEFINED; + } + e_dialog_option_menu_set (priv->priority, priority, priority_map); + + + /* Classification. */ + cal_component_get_classification (priv->comp, &classification); + e_dialog_option_menu_set (priv->classification, classification, + classification_map); + + + /* URL. */ + cal_component_get_url (priv->comp, &url); + e_dialog_editable_set (priv->url, url); + + priv->ignore_callbacks = FALSE; +} + + +static void +save_todo_object (TaskEditor *tedit) +{ + TaskEditorPrivate *priv; + char *title; + + priv = tedit->priv; + + g_return_if_fail (priv->client != NULL); + + if (!priv->comp) + return; + + dialog_to_comp_object (tedit); + + title = make_title_from_comp (priv->comp); + gtk_window_set_title (GTK_WINDOW (priv->app), title); + g_free (title); + + if (!cal_client_update_object (priv->client, priv->comp)) + g_message ("save_todo_object(): Could not update the object!"); +} + + +/* Get the values of the widgets in the event editor and put them in the iCalObject */ +static void +dialog_to_comp_object (TaskEditor *tedit) +{ + TaskEditorPrivate *priv; + CalComponent *comp; + CalComponentText *text; + CalComponentDateTime date; + time_t t; + GSList *list; + TaskEditorStatus status; + TaskEditorPriority priority; + int priority_value, percent; + CalComponentClassification classification; + char *url; + + priv = tedit->priv; + comp = priv->comp; + + /* Summary. */ + text = g_new0 (CalComponentText, 1); + text->value = e_dialog_editable_get (priv->summary); + cal_component_set_summary (comp, text); + + /* Description. Note that we use the text variable again, and it is + freed in cal_component_free_text_list(). */ + list = NULL; + text->value = e_dialog_editable_get (priv->description); + list = g_slist_prepend (list, text); + cal_component_set_description_list (comp, list); + cal_component_free_text_list (list); + + + date.value = g_new (struct icaltimetype, 1); + date.tzid = NULL; + + /* Due Date. */ + t = e_dialog_dateedit_get (priv->due_date); + *date.value = icaltime_from_timet (t, FALSE, FALSE); + cal_component_set_due (comp, &date); + + /* Start Date. */ + t = e_dialog_dateedit_get (priv->start_date); + *date.value = icaltime_from_timet (t, FALSE, FALSE); + cal_component_set_dtstart (comp, &date); + + /* Completed Date. */ + t = e_dialog_dateedit_get (priv->completed_date); + *date.value = icaltime_from_timet (t, FALSE, FALSE); + cal_component_set_completed (comp, date.value); + + g_free (date.value); + + /* Percent Complete. */ + percent = e_dialog_spin_get_int (priv->percent_complete); + cal_component_set_percent (comp, &percent); + + /* Status. FIXME: CalComponent doesn't support it. */ + status = e_dialog_option_menu_get (priv->status, status_map); +#if 0 + cal_component_set_status (comp, status); +#endif + + /* Priority. */ + priority = e_dialog_option_menu_get (priv->priority, priority_map); + priority_value = priority_index_to_value (priority); + cal_component_set_priority (comp, &priority_value); + + /* Classification. */ + classification = e_dialog_option_menu_get (priv->classification, + classification_map); + cal_component_set_classification (comp, classification); + + + /* URL. */ + url = e_dialog_editable_get (priv->url); + cal_component_set_url (comp, url); + + + + + cal_component_commit_sequence (comp); +} + + + +/* File/Save callback */ +static void +file_save_cb (GtkWidget *widget, gpointer data) +{ + TaskEditor *tedit; + + tedit = TASK_EDITOR (data); + save_todo_object (tedit); +} + +/* File/Save and Close callback */ +static void +file_save_and_close_cb (GtkWidget *widget, gpointer data) +{ + TaskEditor *tedit; + + tedit = TASK_EDITOR (data); + save_todo_object (tedit); + close_dialog (tedit); +} + +/* File/Delete callback */ +static void +file_delete_cb (GtkWidget *widget, gpointer data) +{ + TaskEditor *tedit; + TaskEditorPrivate *priv; + const char *uid; + + tedit = TASK_EDITOR (data); + + g_return_if_fail (IS_TASK_EDITOR (tedit)); + + priv = tedit->priv; + + g_return_if_fail (priv->comp); + + cal_component_get_uid (priv->comp, &uid); + + /* We don't check the return value; FALSE can mean the object was not in + * the server anyways. + */ + cal_client_remove_object (priv->client, uid); + + close_dialog (tedit); +} + +/* File/Close callback */ +static void +file_close_cb (GtkWidget *widget, gpointer data) +{ + TaskEditor *tedit; + + tedit = TASK_EDITOR (data); + + g_return_if_fail (IS_TASK_EDITOR (tedit)); + + close_dialog (tedit); +} + + +static TaskEditorPriority +priority_value_to_index (int priority_value) +{ + TaskEditorPriority retval; + + if (priority_value == 0) + retval = PRIORITY_UNDEFINED; + else if (priority_value <= 4) + retval = PRIORITY_HIGH; + else if (priority_value == 5) + retval = PRIORITY_NORMAL; + else + retval = PRIORITY_LOW; + + return retval; +} + + +static int +priority_index_to_value (TaskEditorPriority priority) +{ + int retval; + + switch (priority) { + case PRIORITY_UNDEFINED: + retval = 0; + break; + case PRIORITY_HIGH: + retval = 3; + break; + case PRIORITY_NORMAL: + retval = 5; + break; + case PRIORITY_LOW: + retval = 7; + break; + } + + return retval; +} + + +static void +completed_date_changed (GnomeDateEdit *dedit, + TaskEditor *tedit) +{ + TaskEditorPrivate *priv; + time_t t; + + g_return_if_fail (IS_TASK_EDITOR (tedit)); + + priv = tedit->priv; + + if (priv->ignore_callbacks) + return; + + t = e_dialog_dateedit_get (priv->completed_date); + /* FIXME: We want to check for 'None' here. */ + priv->ignore_callbacks = TRUE; + if (0) { + /* What do we do if the 'Date Completed' property is set to + 'None' ? The status should not be 'Completed' and the + percent-complete should not be 100%, but what do we set + them to? */ + + } else { + e_dialog_option_menu_set (priv->status, STATUS_COMPLETED, + status_map); + e_dialog_spin_set (priv->percent_complete, 100); + } + priv->ignore_callbacks = FALSE; +} + + +static void +status_changed (GtkMenu *menu, + TaskEditor *tedit) +{ + TaskEditorPrivate *priv; + TaskEditorStatus status; + + g_return_if_fail (IS_TASK_EDITOR (tedit)); + + priv = tedit->priv; + + if (priv->ignore_callbacks) + return; + + status = e_dialog_option_menu_get (priv->status, status_map); + priv->ignore_callbacks = TRUE; + if (status == STATUS_NOT_STARTED) { + e_dialog_spin_set (priv->percent_complete, 0); + /* FIXME: Set to 'None'. */ + e_dialog_dateedit_set (priv->completed_date, time (NULL)); + } else if (status == STATUS_COMPLETED) { + e_dialog_spin_set (priv->percent_complete, 100); + e_dialog_dateedit_set (priv->completed_date, time (NULL)); + } + priv->ignore_callbacks = FALSE; +} + + +static void +percent_complete_changed (GtkAdjustment *adj, + TaskEditor *tedit) +{ + TaskEditorPrivate *priv; + gint percent; + TaskEditorStatus status; + time_t date_completed; + + g_return_if_fail (IS_TASK_EDITOR (tedit)); + + priv = tedit->priv; + + if (priv->ignore_callbacks) + return; + + percent = e_dialog_spin_get_int (priv->percent_complete); + priv->ignore_callbacks = TRUE; + + if (percent == 100) { + date_completed = time (NULL); + status = STATUS_COMPLETED; + } else { + /* FIXME: Set to 'None'. */ + date_completed = time (NULL); + + if (percent == 0) + status = STATUS_NOT_STARTED; + else + status = STATUS_IN_PROGRESS; + } + + e_dialog_dateedit_set (priv->completed_date, date_completed); + e_dialog_option_menu_set (priv->status, status, status_map); + + priv->ignore_callbacks = FALSE; +} + diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h index 159b969ab9..a53d29c2a2 100644 --- a/calendar/gui/dialogs/task-editor.h +++ b/calendar/gui/dialogs/task-editor.h @@ -54,8 +54,13 @@ struct _TaskEditorClass GtkType task_editor_get_type (void); +TaskEditor* task_editor_construct (TaskEditor *tedit); TaskEditor* task_editor_new (void); +void task_editor_set_cal_client (TaskEditor *tedit, + CalClient *client); +void task_editor_set_todo_object (TaskEditor *tedit, + CalComponent *comp); END_GNOME_DECLS diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade index 56f7f83422..8a8ca800d6 100644 --- a/calendar/gui/dialogs/task-page.glade +++ b/calendar/gui/dialogs/task-page.glade @@ -18,9 +18,11 @@ <class>GnomeApp</class> <name>task-editor-dialog</name> <visible>False</visible> + <title>task-editor-dialog</title> <type>GTK_WINDOW_TOPLEVEL</type> <position>GTK_WIN_POS_NONE</position> <modal>False</modal> + <default_height>350</default_height> <allow_shrink>False</allow_shrink> <allow_grow>True</allow_grow> <auto_shrink>False</auto_shrink> @@ -61,7 +63,7 @@ <widget> <class>GtkTable</class> <name>table3</name> - <rows>2</rows> + <rows>1</rows> <columns>2</columns> <homogeneous>False</homogeneous> <row_spacing>4</row_spacing> @@ -75,19 +77,19 @@ <widget> <class>GtkLabel</class> <name>label3</name> - <label>S_ubject:</label> + <label>S_ummary</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> <xalign>0.5</xalign> <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <default_focus_target>entry1</default_focus_target> + <default_focus_target>summary</default_focus_target> <child> <left_attach>0</left_attach> <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> <xexpand>False</xexpand> @@ -101,7 +103,7 @@ <widget> <class>GtkEntry</class> - <name>entry1</name> + <name>summary</name> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> @@ -110,63 +112,11 @@ <child> <left_attach>1</left_attach> <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label10</name> - <label>Owner:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> <top_attach>0</top_attach> <bottom_attach>1</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label11</name> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> + <xexpand>True</xexpand> <yexpand>False</yexpand> <xshrink>False</xshrink> <yshrink>False</yshrink> @@ -201,7 +151,7 @@ <class>GtkTable</class> <name>table1</name> <rows>2</rows> - <columns>2</columns> + <columns>4</columns> <homogeneous>False</homogeneous> <row_spacing>2</row_spacing> <column_spacing>4</column_spacing> @@ -213,9 +163,9 @@ <widget> <class>GnomeDateEdit</class> - <name>dateedit1</name> + <name>due-date</name> <show_time>True</show_time> - <use_24_format>False</use_24_format> + <use_24_format>True</use_24_format> <week_start_monday>False</week_start_monday> <lower_hour>7</lower_hour> <upper_hour>19</upper_hour> @@ -237,7 +187,7 @@ <widget> <class>GnomeDateEdit</class> - <name>dateedit2</name> + <name>start-date</name> <show_time>True</show_time> <use_24_format>True</use_24_format> <week_start_monday>False</week_start_monday> @@ -310,6 +260,66 @@ <yfill>False</yfill> </child> </widget> + + <widget> + <class>GtkLabel</class> + <name>label9</name> + <label>% Comp_lete:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <default_focus_target>percent-complete</default_focus_target> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> + <class>GtkSpinButton</class> + <name>percent-complete</name> + <width>60</width> + <can_focus>True</can_focus> + <climb_rate>1</climb_rate> + <digits>0</digits> + <numeric>False</numeric> + <update_policy>GTK_UPDATE_ALWAYS</update_policy> + <snap>False</snap> + <wrap>False</wrap> + <value>0</value> + <lower>0</lower> + <upper>100</upper> + <step>10</step> + <page>10</page> + <page_size>10</page_size> + <child> + <left_attach>3</left_attach> + <right_attach>4</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>True</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>True</xfill> + <yfill>False</yfill> + </child> + </widget> </widget> </widget> @@ -344,7 +354,7 @@ <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <default_focus_target>combo-entry1</default_focus_target> + <default_focus_target>status</default_focus_target> <child> <padding>0</padding> <expand>False</expand> @@ -353,35 +363,20 @@ </widget> <widget> - <class>GtkCombo</class> - <name>combo1</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> + <class>GtkOptionMenu</class> + <name>status</name> + <can_focus>True</can_focus> <items>Not Started In Progress Completed Cancelled </items> + <initial_choice>0</initial_choice> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>combo-entry1</name> - <width>60</width> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text>Not Started</text> - </widget> </widget> <widget> @@ -394,7 +389,7 @@ Cancelled <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <default_focus_target>combo-entry2</default_focus_target> + <default_focus_target>priority</default_focus_target> <child> <padding>0</padding> <expand>False</expand> @@ -403,47 +398,32 @@ Cancelled </widget> <widget> - <class>GtkCombo</class> - <name>combo2</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> + <class>GtkOptionMenu</class> + <name>priority</name> + <can_focus>True</can_focus> <items>High Normal Low </items> + <initial_choice>0</initial_choice> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>combo-entry2</name> - <width>60</width> - <can_focus>True</can_focus> - <editable>False</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text>High</text> - </widget> </widget> <widget> <class>GtkLabel</class> - <name>label9</name> - <label>% Comp_lete:</label> + <name>label18</name> + <label>C_lassification:</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> <xalign>0.5</xalign> <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad> - <default_focus_target>spinbutton1</default_focus_target> + <default_focus_target>classification</default_focus_target> <child> <padding>0</padding> <expand>False</expand> @@ -452,25 +432,18 @@ Low </widget> <widget> - <class>GtkSpinButton</class> - <name>spinbutton1</name> + <class>GtkOptionMenu</class> + <name>classification</name> <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>False</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>0</value> - <lower>0</lower> - <upper>100</upper> - <step>10</step> - <page>10</page> - <page_size>10</page_size> + <items>Public +Private +Confidential +</items> + <initial_choice>0</initial_choice> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> </widget> </widget> @@ -490,8 +463,7 @@ Low <widget> <class>GtkText</class> - <name>text1</name> - <height>150</height> + <name>description</name> <can_focus>True</can_focus> <editable>True</editable> <text></text> @@ -513,17 +485,30 @@ Low <class>GtkButton</class> <name>button3</name> <can_focus>True</can_focus> - <label>_Contacts...</label> <child> <padding>0</padding> <expand>False</expand> <fill>False</fill> </child> + + <widget> + <class>GtkLabel</class> + <name>label16</name> + <sensitive>False</sensitive> + <label>_Contacts...</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>4</xpad> + <ypad>0</ypad> + </widget> </widget> <widget> <class>GtkEntry</class> - <name>entry2</name> + <name>contacts</name> + <sensitive>False</sensitive> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> @@ -540,17 +525,30 @@ Low <class>GtkButton</class> <name>button4</name> <can_focus>True</can_focus> - <label>Ca_tegories...</label> <child> <padding>0</padding> <expand>False</expand> <fill>False</fill> </child> + + <widget> + <class>GtkLabel</class> + <name>label17</name> + <sensitive>False</sensitive> + <label>Ca_tegories...</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>4</xpad> + <ypad>0</ypad> + </widget> </widget> <widget> <class>GtkEntry</class> - <name>entry3</name> + <name>categories</name> + <sensitive>False</sensitive> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> @@ -562,20 +560,6 @@ Low <fill>True</fill> </child> </widget> - - <widget> - <class>GtkCheckButton</class> - <name>checkbutton1</name> - <can_focus>True</can_focus> - <label>Private</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> </widget> </widget> @@ -596,7 +580,7 @@ Low <class>GtkTable</class> <name>table4</name> <border_width>4</border_width> - <rows>4</rows> + <rows>2</rows> <columns>2</columns> <homogeneous>False</homogeneous> <row_spacing>2</row_spacing> @@ -604,7 +588,7 @@ Low <widget> <class>GnomeDateEdit</class> - <name>dateedit3</name> + <name>completed-date</name> <show_time>True</show_time> <use_24_format>True</use_24_format> <week_start_monday>False</week_start_monday> @@ -654,32 +638,6 @@ Low <widget> <class>GtkLabel</class> - <name>label13</name> - <label>Location:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> <name>label14</name> <label>URL:</label> <justify>GTK_JUSTIFY_CENTER</justify> @@ -691,84 +649,10 @@ Low <child> <left_attach>0</left_attach> <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry4</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> <top_attach>1</top_attach> <bottom_attach>2</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry5</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label15</name> - <label>Resources:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> <xexpand>False</xexpand> <yexpand>False</yexpand> <xshrink>False</xshrink> @@ -780,7 +664,7 @@ Low <widget> <class>GtkEntry</class> - <name>entry6</name> + <name>url</name> <can_focus>True</can_focus> <editable>True</editable> <text_visible>True</text_visible> @@ -789,8 +673,8 @@ Low <child> <left_attach>1</left_attach> <right_attach>2</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> + <top_attach>1</top_attach> + <bottom_attach>2</bottom_attach> <xpad>0</xpad> <ypad>0</ypad> <xexpand>True</xexpand> diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 17f957623f..ab1578508e 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -35,7 +35,7 @@ #include <e-table/e-cell-text.h> #include "e-calendar-table.h" #include "calendar-model.h" -#include "gncal-todo.h" +#include "dialogs/task-editor.h" /* Pixmaps. */ #include "task.xpm" @@ -415,16 +415,14 @@ static void e_calendar_table_open_task (ECalendarTable *cal_table, gint row) { + TaskEditor *tedit; CalComponent *comp; -#if 0 - task_editor_new (); - /* FIXME: Set iCalObject to edit. */ -#endif + tedit = task_editor_new (); + task_editor_set_cal_client (tedit, calendar_model_get_cal_client (cal_table->model)); comp = calendar_model_get_cal_object (cal_table->model, row); - - gncal_todo_edit (calendar_model_get_cal_client (cal_table->model), comp); + task_editor_set_todo_object (tedit, comp); } diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 1f3808d695..9e6db8151f 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -1345,7 +1345,7 @@ e_day_view_set_cal_client (EDayView *day_view, GTK_SIGNAL_FUNC (obj_removed_cb), day_view); } - e_day_view_reload_events (day_view); + e_day_view_queue_reload_events (day_view); } diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 5c4bbcc312..c9caeff732 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -820,7 +820,7 @@ cal_loaded_cb (CalClient *client, CalClientLoadStatus status, gpointer data) if (status != CAL_CLIENT_LOAD_SUCCESS) return; - e_week_view_reload_events (week_view); + e_week_view_queue_reload_events (week_view); } /* Callback used when the calendar client tells us that an object changed */ @@ -972,7 +972,7 @@ e_week_view_set_cal_client (EWeekView *week_view, GTK_SIGNAL_FUNC (obj_removed_cb), week_view); } - e_week_view_reload_events (week_view); + e_week_view_queue_reload_events (week_view); } @@ -1588,7 +1588,7 @@ e_week_view_on_button_press (GtkWidget *widget, { gint x, y, day; -#if 0 +#if 1 g_print ("In e_week_view_on_button_press\n"); #endif @@ -1610,6 +1610,8 @@ e_week_view_on_button_press (GtkWidget *widget, if (week_view->pressed_event_num != -1) return FALSE; + g_print ("In e_week_view_on_button_press 2\n"); + /* Convert the mouse position to a week & day. */ x = event->x; y = event->y; @@ -1844,6 +1846,7 @@ e_week_view_reload_events (EWeekView *week_view) week_view); } + week_view->events_need_reshape = TRUE; e_week_view_check_layout (week_view); gtk_widget_queue_draw (week_view->main_canvas); @@ -1855,9 +1858,15 @@ e_week_view_free_events (EWeekView *week_view) { EWeekViewEvent *event; EWeekViewEventSpan *span; - gint event_num, span_num; + gint event_num, span_num, num_days, day; - /* FIXME: set any indices into the arrays to -1? */ + /* Reset all our indices. */ + week_view->pressed_event_num = -1; + week_view->pressed_span_num = -1; + week_view->editing_event_num = -1; + week_view->editing_span_num = -1; + week_view->popup_event_num = -1; + week_view->editing_new_event = FALSE; for (event_num = 0; event_num < week_view->events->len; event_num++) { event = &g_array_index (week_view->events, EWeekViewEvent, @@ -1881,6 +1890,12 @@ e_week_view_free_events (EWeekView *week_view) g_array_free (week_view->spans, TRUE); week_view->spans = NULL; } + + /* Clear the number of rows used per day. */ + num_days = week_view->multi_week_view ? week_view->weeks_shown * 7 : 7; + for (day = 0; day <= num_days; day++) { + week_view->rows_per_day[day] = 0; + } } @@ -2553,8 +2568,7 @@ e_week_view_start_editing_event (EWeekView *week_view, } -/* This stops the current edit. If accept is TRUE the event summary is update, - else the edit is cancelled. */ +/* This stops any current edit. */ void e_week_view_stop_editing_event (EWeekView *week_view) { diff --git a/calendar/gui/event-editor-dialog.glade b/calendar/gui/event-editor-dialog.glade index 5267bda069..3a81c0d1de 100644 --- a/calendar/gui/event-editor-dialog.glade +++ b/calendar/gui/event-editor-dialog.glade @@ -203,6 +203,29 @@ </widget> <widget> + <class>GtkCheckButton</class> + <name>all-day-event</name> + <can_focus>True</can_focus> + <label>A_ll day event</label> + <active>False</active> + <draw_indicator>True</draw_indicator> + <child> + <left_attach>2</left_attach> + <right_attach>3</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</bottom_attach> + <xpad>0</xpad> + <ypad>0</ypad> + <xexpand>False</xexpand> + <yexpand>False</yexpand> + <xshrink>False</xshrink> + <yshrink>False</yshrink> + <xfill>False</xfill> + <yfill>False</yfill> + </child> + </widget> + + <widget> <class>Custom</class> <name>start-time</name> <creation_function>make_date_edit_with_time</creation_function> @@ -223,7 +246,7 @@ <xshrink>False</xshrink> <yshrink>False</yshrink> <xfill>True</xfill> - <yfill>True</yfill> + <yfill>False</yfill> </child> </widget> @@ -246,29 +269,6 @@ <xshrink>False</xshrink> <yshrink>False</yshrink> <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>all-day-event</name> - <can_focus>True</can_focus> - <label>A_ll day event</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> <yfill>False</yfill> </child> </widget> @@ -1703,7 +1703,7 @@ Sunday <child> <padding>0</padding> <expand>False</expand> - <fill>True</fill> + <fill>False</fill> </child> <widget> @@ -1744,8 +1744,8 @@ Sunday <spacing>0</spacing> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> <widget> diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c index 34c659b163..9a398d13cb 100644 --- a/calendar/gui/event-editor.c +++ b/calendar/gui/event-editor.c @@ -1549,6 +1549,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data) EventEditorPrivate *priv; CalComponent *comp; CalClientGetStatus status; + const gchar *editing_uid; ee = EVENT_EDITOR (data); @@ -1556,6 +1557,14 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data) priv = ee->priv; + /* If we aren't showing the object which has been updated, return. */ + if (!priv->comp) + return; + cal_component_get_uid (priv->comp, &editing_uid); + if (strcmp (uid, editing_uid)) + return; + + /* Get the event from the server. */ status = cal_client_get_object (priv->client, uid, &comp); @@ -1586,6 +1595,7 @@ obj_removed_cb (CalClient *client, const char *uid, gpointer data) { EventEditor *ee; EventEditorPrivate *priv; + const gchar *editing_uid; ee = EVENT_EDITOR (data); @@ -1594,6 +1604,14 @@ obj_removed_cb (CalClient *client, const char *uid, gpointer data) priv = ee->priv; + /* If we aren't showing the object which has been updated, return. */ + if (!priv->comp) + return; + cal_component_get_uid (priv->comp, &editing_uid); + if (strcmp (uid, editing_uid)) + return; + + raise_and_focus (priv->app); } diff --git a/calendar/gui/gncal-todo.c b/calendar/gui/gncal-todo.c index 47d63e35e9..239517ff3b 100644 --- a/calendar/gui/gncal-todo.c +++ b/calendar/gui/gncal-todo.c @@ -189,7 +189,11 @@ gncal_todo_edit (CalClient *client, CalComponent *comp) due_entry = gtk_entry_new (); cal_component_get_dtend (comp, &date); - d = icaltime_as_timet (*date.value); + /* FIXME: Does GnomeDateEdit support no time set? */ + if (date.value) + d = icaltime_as_timet (*date.value); + else + d = time (NULL); due_entry = date_edit_new (d, TRUE); gtk_box_pack_start (GTK_BOX (due_box), due_entry, TRUE, TRUE, 0); gtk_widget_show (due_entry); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 6a8dae19ce..8373eea7b5 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -444,8 +444,6 @@ gnome_calendar_set_view_internal (GnomeCalendar *gcal, int view; gboolean round_selection = FALSE; - g_print ("In gnome_calendar_set_view_internal: %s\n", page_name); - if (!strcmp (page_name, "dayview")) { view = GNOME_CALENDAR_VIEW_DAY; if (!range_selected) @@ -521,9 +519,6 @@ gnome_calendar_set_pane_positions (GnomeCalendar *gcal) top_pane_height = top_pane_height * (row_height + top_border + bottom_border) + 0.5; - g_print ("right width:%g top height:%g\n", right_pane_width, - top_pane_height); - e_paned_set_position (E_PANED (gcal->hpane), -1); e_paned_set_position (E_PANED (gcal->vpane), -1); /* We add one to each dimension since we can't use 0. */ @@ -1309,6 +1304,11 @@ gnome_calendar_tag_calendar (GnomeCalendar *gcal, ECalendar *ecal) if (!GTK_WIDGET_VISIBLE (ecal)) return; + e_calendar_item_clear_marks (ecal->calitem); + + if (!cal_client_is_loaded (gcal->client)) + return; + e_calendar_item_get_date_range (ecal->calitem, &start_year, &start_month, &start_day, &end_year, &end_month, &end_day); @@ -1329,8 +1329,6 @@ gnome_calendar_tag_calendar (GnomeCalendar *gcal, ECalendar *ecal) end_tm.tm_sec = 0; end_tm.tm_isdst = -1; - e_calendar_item_clear_marks (ecal->calitem); - c.calitem = ecal->calitem; c.start_time = mktime (&start_tm); c.end_time = mktime (&end_tm); @@ -1607,8 +1605,6 @@ gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, gboolean starts_on_week_start_day = FALSE; struct tm tm; - g_print ("In gnome_calendar_on_date_navigator_selection_changed\n"); - if (!gnome_calendar_get_days_shown (gcal, &start_date, &days_shown)) return; @@ -1744,9 +1740,6 @@ gnome_calendar_on_date_navigator_size_allocate (GtkWidget *widget, gint top_border, bottom_border, left_border, right_border; gfloat hpane_pos, vpane_pos; - g_print ("In gnome_calendar_on_date_navigator_size_allocate %ix%i\n", - allocation->width, allocation->height); - if (gcal->current_view_type != GNOME_CALENDAR_VIEW_NOT_SET) { e_calendar_get_border_size (gcal->date_navigator, &top_border, &bottom_border, @@ -1777,9 +1770,6 @@ gnome_calendar_on_date_navigator_size_allocate (GtkWidget *widget, gcal->hpane_pos = hpane_pos; gcal->vpane_pos = vpane_pos; } - - g_print (" hpane_pos:%g vpane_pos:%g\n", hpane_pos, vpane_pos); - } } |