aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/dialogs/comp-editor.c72
-rw-r--r--calendar/gui/dialogs/comp-editor.h8
-rw-r--r--calendar/gui/dialogs/event-editor.c79
-rw-r--r--calendar/gui/dialogs/meeting-page.c10
-rw-r--r--calendar/gui/dialogs/schedule-page.c56
-rw-r--r--calendar/gui/dialogs/task-editor.c66
-rw-r--r--calendar/gui/e-meeting-model.c18
-rw-r--r--calendar/gui/itip-utils.c19
8 files changed, 222 insertions, 106 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index de4e528334..ca2b7cfe4f 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -265,6 +265,78 @@ comp_editor_destroy (GtkObject *object)
/**
+ * comp_editor_set_changed:
+ * @editor: A component editor
+ * @changed: Value to set the changed state to
+ *
+ * Set the dialog changed state to the given value
+ **/
+void
+comp_editor_set_changed (CompEditor *editor, gboolean changed)
+{
+ CompEditorPrivate *priv;
+
+ priv = editor->priv;
+
+ priv->changed = changed;
+}
+
+/**
+ * comp_editor_get_changed:
+ * @editor: A component editor
+ *
+ * Gets the changed state of the dialog
+ *
+ * Return value: A boolean indicating if the dialog is in a changed
+ * state
+ **/
+gboolean
+comp_editor_get_changed (CompEditor *editor)
+{
+ CompEditorPrivate *priv;
+
+ priv = editor->priv;
+
+ return priv->changed;
+}
+
+/**
+ * comp_editor_set_needs_send:
+ * @editor: A component editor
+ * @needs_send: Value to set the needs send state to
+ *
+ * Set the dialog needs send state to the given value
+ **/
+void
+comp_editor_set_needs_send (CompEditor *editor, gboolean needs_send)
+{
+ CompEditorPrivate *priv;
+
+ priv = editor->priv;
+
+ priv->needs_send = needs_send;
+}
+
+/**
+ * comp_editor_get_needs_send:
+ * @editor: A component editor
+ *
+ * Gets the needs send state of the dialog
+ *
+ * Return value: A boolean indicating if the dialog is in a needs send
+ * state
+ **/
+gboolean
+comp_editor_get_needs_send (CompEditor *editor)
+{
+ CompEditorPrivate *priv;
+
+ priv = editor->priv;
+
+ return priv->needs_send;
+}
+
+/**
* comp_editor_append_page:
* @editor: A component editor
* @page: A component editor page
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index 64920879cc..f19ac706b6 100644
--- a/calendar/gui/dialogs/comp-editor.h
+++ b/calendar/gui/dialogs/comp-editor.h
@@ -58,7 +58,12 @@ typedef struct {
} CompEditorClass;
GtkType comp_editor_get_type (void);
-CompEditor *comp_editor_new (void);
+void comp_editor_set_changed (CompEditor *editor,
+ gboolean changed);
+gboolean comp_editor_get_changed (CompEditor *editor);
+void comp_editor_set_needs_send (CompEditor *editor,
+ gboolean needs_send);
+gboolean comp_editor_get_needs_send (CompEditor *editor);
void comp_editor_append_page (CompEditor *editor,
CompEditorPage *page,
const char *label);
@@ -85,6 +90,7 @@ void comp_editor_set_ui_prop (CompEditor *editor,
const char *val);
void comp_editor_focus (CompEditor *editor);
+
END_GNOME_DECLS
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index f95f201883..ea73ba2abf 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -49,6 +49,7 @@ struct _EventEditorPrivate {
EMeetingModel *model;
gboolean meeting_shown;
+ gboolean updating;
};
@@ -65,6 +66,9 @@ static void refresh_meeting_cmd (GtkWidget *widget, gpointer data);
static void cancel_meeting_cmd (GtkWidget *widget, gpointer data);
static void forward_cmd (GtkWidget *widget, gpointer data);
+static void model_row_changed_cb (ETableModel *etm, int row, gpointer data);
+static void row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data);
+
static BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ActionScheduleMeeting", schedule_meeting_cmd),
BONOBO_UI_UNSAFE_VERB ("ActionRefreshMeeting", refresh_meeting_cmd),
@@ -147,6 +151,21 @@ set_menu_sens (EventEditor *ee)
"sensitive", priv->meeting_shown ? "1" : "0");
}
+static void
+init_widgets (EventEditor *ee)
+{
+ EventEditorPrivate *priv;
+
+ priv = ee->priv;
+
+ gtk_signal_connect (GTK_OBJECT (priv->model), "model_row_changed",
+ GTK_SIGNAL_FUNC (model_row_changed_cb), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_inserted",
+ GTK_SIGNAL_FUNC (row_count_changed_cb), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_deleted",
+ GTK_SIGNAL_FUNC (row_count_changed_cb), ee);
+}
+
/* Object initialization function for the event editor */
static void
event_editor_init (EventEditor *ee)
@@ -173,22 +192,25 @@ event_editor_init (EventEditor *ee)
priv->model = E_MEETING_MODEL (e_meeting_model_new ());
- priv->meet_page = meeting_page_new (priv->model);
- comp_editor_append_page (COMP_EDITOR (ee),
- COMP_EDITOR_PAGE (priv->meet_page),
- _("Meeting"));
-
priv->sched_page = schedule_page_new (priv->model);
comp_editor_append_page (COMP_EDITOR (ee),
COMP_EDITOR_PAGE (priv->sched_page),
_("Scheduling"));
+ priv->meet_page = meeting_page_new (priv->model);
+ comp_editor_append_page (COMP_EDITOR (ee),
+ COMP_EDITOR_PAGE (priv->meet_page),
+ _("Meeting"));
+
comp_editor_merge_ui (COMP_EDITOR (ee), EVOLUTION_DATADIR
"/gnome/ui/evolution-event-editor.xml",
verbs);
-
+
priv->meeting_shown = TRUE;
- set_menu_sens (ee);
+ priv->updating = FALSE;
+
+ init_widgets (ee);
+ set_menu_sens (ee);
}
static void
@@ -216,15 +238,17 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp)
ee = EVENT_EDITOR (editor);
priv = ee->priv;
+ priv->updating = TRUE;
+
cal_component_get_attendee_list (comp, &attendees);
if (attendees == NULL) {
comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page));
comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->sched_page));
e_meeting_model_remove_all_attendees (priv->model);
priv->meeting_shown = FALSE;
- set_menu_sens (ee);
} else {
GSList *l;
+
for (l = attendees; l != NULL; l = l->next) {
CalComponentAttendee *ca = l->data;
EMeetingAttendee *ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_cal_component_attendee (ca));
@@ -232,9 +256,15 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp)
e_meeting_model_add_attendee (priv->model, ia);
gtk_object_unref (GTK_OBJECT (ia));
}
+ priv->meeting_shown = TRUE;
}
cal_component_free_attendee_list (attendees);
-
+
+ set_menu_sens (ee);
+ comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown);
+
+ priv->updating = FALSE;
+
if (parent_class->edit_comp)
parent_class->edit_comp (editor, comp);
}
@@ -311,13 +341,15 @@ schedule_meeting_cmd (GtkWidget *widget, gpointer data)
if (!priv->meeting_shown) {
comp_editor_append_page (COMP_EDITOR (ee),
- COMP_EDITOR_PAGE (priv->meet_page),
- _("Meeting"));
- comp_editor_append_page (COMP_EDITOR (ee),
COMP_EDITOR_PAGE (priv->sched_page),
_("Scheduling"));
+ comp_editor_append_page (COMP_EDITOR (ee),
+ COMP_EDITOR_PAGE (priv->meet_page),
+ _("Meeting"));
priv->meeting_shown = TRUE;
+
set_menu_sens (ee);
+ comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown);
}
comp_editor_show_page (COMP_EDITOR (ee),
@@ -355,3 +387,26 @@ forward_cmd (GtkWidget *widget, gpointer data)
comp_editor_send_comp (COMP_EDITOR (ee), CAL_COMPONENT_METHOD_PUBLISH);
}
+static void
+model_row_changed_cb (ETableModel *etm, int row, gpointer data)
+{
+ EventEditor *ee = EVENT_EDITOR (data);
+ EventEditorPrivate *priv;
+
+ priv = ee->priv;
+
+ if (!priv->updating)
+ comp_editor_set_changed (COMP_EDITOR (ee), TRUE);
+}
+
+static void
+row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data)
+{
+ EventEditor *ee = EVENT_EDITOR (data);
+ EventEditorPrivate *priv;
+
+ priv = ee->priv;
+
+ if (!priv->updating)
+ comp_editor_set_changed (COMP_EDITOR (ee), TRUE);
+}
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index 5a146e3d04..3b20831093 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -348,7 +348,6 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
MeetingPage *mpage;
MeetingPagePrivate *priv;
CalComponentOrganizer organizer;
- GSList *attendees;
GList *l;
mpage = MEETING_PAGE (page);
@@ -400,12 +399,6 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
e_dialog_editable_set (GTK_COMBO (priv->organizer)->entry, priv->default_address);
}
- /* So the comp editor knows we need to send if anything changes */
- cal_component_get_attendee_list (comp, &attendees);
- if (attendees != NULL)
- comp_editor_page_notify_needs_send (COMP_EDITOR_PAGE (mpage));
- cal_component_free_attendee_list (attendees);
-
priv->updating = FALSE;
}
@@ -561,9 +554,6 @@ invite_entry_changed (BonoboListener *listener,
else if (!strcmp (section, _("Non-Participants")))
e_meeting_attendee_set_role (ia, ICAL_ROLE_NONPARTICIPANT);
e_meeting_attendee_set_cn (ia, g_strdup (name));
-
- comp_editor_page_notify_needs_send (COMP_EDITOR_PAGE (mpage));
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (mpage));
}
}
e_destination_freev (destv);
diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c
index 42510e0b5a..37d94c76b7 100644
--- a/calendar/gui/dialogs/schedule-page.c
+++ b/calendar/gui/dialogs/schedule-page.c
@@ -87,9 +87,6 @@ static void schedule_page_focus_main_widget (CompEditorPage *page);
static void schedule_page_fill_widgets (CompEditorPage *page, CalComponent *comp);
static void schedule_page_fill_component (CompEditorPage *page, CalComponent *comp);
-static void model_row_changed_cb (ETableModel *etm, int row, gpointer data);
-static void row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data);
-
static CompEditorPageClass *parent_class = NULL;
@@ -235,7 +232,6 @@ schedule_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
{
SchedulePage *spage;
SchedulePagePrivate *priv;
- GSList *attendees;
spage = SCHEDULE_PAGE (page);
priv = spage->priv;
@@ -245,15 +241,6 @@ schedule_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* Clean the screen */
clear_widgets (spage);
- /* Attendees */
- cal_component_get_attendee_list (comp, &attendees);
-
- /* So the comp editor knows we need to send if anything changes */
- if (attendees != NULL)
- comp_editor_page_notify_needs_send (COMP_EDITOR_PAGE (spage));
-
- cal_component_free_attendee_list (attendees);
-
priv->updating = FALSE;
}
@@ -292,22 +279,6 @@ get_widgets (SchedulePage *spage)
return TRUE;
}
-/* Hooks the widget signals */
-static void
-init_widgets (SchedulePage *spage)
-{
- SchedulePagePrivate *priv;
-
- priv = spage->priv;
-
- gtk_signal_connect (GTK_OBJECT (priv->model), "model_row_changed",
- GTK_SIGNAL_FUNC (model_row_changed_cb), spage);
- gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_inserted",
- GTK_SIGNAL_FUNC (row_count_changed_cb), spage);
- gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_deleted",
- GTK_SIGNAL_FUNC (row_count_changed_cb), spage);
-}
-
/**
@@ -349,9 +320,6 @@ schedule_page_construct (SchedulePage *spage, EMeetingModel *emm)
gtk_widget_show (GTK_WIDGET (priv->sel));
gtk_box_pack_start (GTK_BOX (priv->main), GTK_WIDGET (priv->sel), TRUE, TRUE, 2);
- /* Init the widget signals */
- init_widgets (spage);
-
return spage;
}
@@ -376,27 +344,3 @@ schedule_page_new (EMeetingModel *emm)
return spage;
}
-
-static void
-model_row_changed_cb (ETableModel *etm, int row, gpointer data)
-{
- SchedulePage *spage = SCHEDULE_PAGE (data);
- SchedulePagePrivate *priv;
-
- priv = spage->priv;
-
- if (!priv->updating)
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (spage));
-}
-
-static void
-row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data)
-{
- SchedulePage *spage = SCHEDULE_PAGE (data);
- SchedulePagePrivate *priv;
-
- priv = spage->priv;
-
- if (!priv->updating)
- comp_editor_page_notify_changed (COMP_EDITOR_PAGE (spage));
-}
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index c7879a1986..3c09dece79 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -44,6 +44,7 @@ struct _TaskEditorPrivate {
EMeetingModel *model;
gboolean meeting_shown;
+ gboolean updating;
};
@@ -58,6 +59,9 @@ static void refresh_task_cmd (GtkWidget *widget, gpointer data);
static void cancel_task_cmd (GtkWidget *widget, gpointer data);
static void forward_cmd (GtkWidget *widget, gpointer data);
+static void model_row_changed_cb (ETableModel *etm, int row, gpointer data);
+static void row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data);
+
static BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ActionAssignTask", assign_task_cmd),
BONOBO_UI_UNSAFE_VERB ("ActionRefreshTask", refresh_task_cmd),
@@ -138,7 +142,22 @@ set_menu_sens (TaskEditor *te)
"sensitive", priv->meeting_shown ? "1" : "0");
}
-/* Object initialization function for the event editor */
+static void
+init_widgets (TaskEditor *te)
+{
+ TaskEditorPrivate *priv;
+
+ priv = te->priv;
+
+ gtk_signal_connect (GTK_OBJECT (priv->model), "model_row_changed",
+ GTK_SIGNAL_FUNC (model_row_changed_cb), te);
+ gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_inserted",
+ GTK_SIGNAL_FUNC (row_count_changed_cb), te);
+ gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_deleted",
+ GTK_SIGNAL_FUNC (row_count_changed_cb), te);
+}
+
+/* Object initialization function for the task editor */
static void
task_editor_init (TaskEditor *te)
{
@@ -169,6 +188,9 @@ task_editor_init (TaskEditor *te)
verbs);
priv->meeting_shown = TRUE;
+ priv->updating = FALSE;
+
+ init_widgets (te);
set_menu_sens (te);
}
@@ -182,14 +204,32 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
te = TASK_EDITOR (editor);
priv = te->priv;
+ priv->updating = TRUE;
+
cal_component_get_attendee_list (comp, &attendees);
if (attendees == NULL) {
comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page));
priv->meeting_shown = FALSE;
set_menu_sens (te);
+ } else {
+ GSList *l;
+
+ for (l = attendees; l != NULL; l = l->next) {
+ CalComponentAttendee *ca = l->data;
+ EMeetingAttendee *ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_cal_component_attendee (ca));
+
+ e_meeting_model_add_attendee (priv->model, ia);
+ gtk_object_unref (GTK_OBJECT (ia));
+ }
+ priv->meeting_shown = TRUE;
}
cal_component_free_attendee_list (attendees);
+ set_menu_sens (te);
+ comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown);
+
+ priv->updating = FALSE;
+
if (parent_class->edit_comp)
parent_class->edit_comp (editor, comp);
}
@@ -244,7 +284,9 @@ assign_task_cmd (GtkWidget *widget, gpointer data)
COMP_EDITOR_PAGE (priv->meet_page),
_("Assignment"));
priv->meeting_shown = TRUE;
+
set_menu_sens (te);
+ comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown);
}
comp_editor_show_page (COMP_EDITOR (te),
@@ -282,4 +324,26 @@ forward_cmd (GtkWidget *widget, gpointer data)
comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_PUBLISH);
}
+static void
+model_row_changed_cb (ETableModel *etm, int row, gpointer data)
+{
+ TaskEditor *te = TASK_EDITOR (data);
+ TaskEditorPrivate *priv;
+
+ priv = te->priv;
+
+ if (!priv->updating)
+ comp_editor_set_changed (COMP_EDITOR (te), TRUE);
+}
+static void
+row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data)
+{
+ TaskEditor *te = TASK_EDITOR (data);
+ TaskEditorPrivate *priv;
+
+ priv = te->priv;
+
+ if (!priv->updating)
+ comp_editor_set_changed (COMP_EDITOR (te), TRUE);
+}
diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c
index 35c50c153c..a545c0bbf9 100644
--- a/calendar/gui/e-meeting-model.c
+++ b/calendar/gui/e-meeting-model.c
@@ -378,9 +378,6 @@ append_row (ETableModel *etm, ETableModel *source, int row)
e_meeting_attendee_set_language (ia, g_strdup (e_table_model_value_at (source, ITIP_LANGUAGE_COL, row)));
e_meeting_model_add_attendee (E_MEETING_MODEL (etm), ia);
-
-// comp_editor_page_notify_needs_send (COMP_EDITOR_PAGE (im));
-// comp_editor_page_notify_changed (COMP_EDITOR_PAGE (im));
}
static void *
@@ -465,9 +462,6 @@ set_value_at (ETableModel *etm, int col, int row, const void *val)
e_meeting_attendee_set_language (ia, g_strdup (val));
break;
}
-
-// comp_editor_page_notify_needs_send (COMP_EDITOR_PAGE (im));
-// comp_editor_page_notify_changed (COMP_EDITOR_PAGE (im));
}
static gboolean
@@ -735,11 +729,13 @@ build_etable (ETableModel *model, const gchar *spec_file, const gchar *state_fil
e_scroll_frame_set_scrollbar_spacing (E_SCROLL_FRAME (etable), 0);
e_table_load_state (real_table, state_file);
-// gtk_signal_connect (GTK_OBJECT (real_table),
-// "right_click", GTK_SIGNAL_FUNC (right_click_cb), mpage);
-// gtk_signal_connect (GTK_OBJECT (real_table->sort_info),
-// "sort_info_changed", GTK_SIGNAL_FUNC (sort_info_changed_cb), mts);
-
+#if 0
+ gtk_signal_connect (GTK_OBJECT (real_table),
+ "right_click", GTK_SIGNAL_FUNC (right_click_cb), mpage);
+ gtk_signal_connect (GTK_OBJECT (real_table->sort_info),
+ "sort_info_changed", GTK_SIGNAL_FUNC (sort_info_changed_cb), mts);
+#endif
+
gtk_object_unref (GTK_OBJECT (extras));
return E_TABLE_SCROLLED (etable);
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 8811db3487..7a5411d752 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -84,8 +84,7 @@ itip_addresses_get (void)
static Bonobo_ConfigDatabase db = NULL;
CORBA_Environment ev;
GList *addresses = NULL;
- gboolean have_default = FALSE;
- gint len, i;
+ gint len, def, i;
if (db == NULL) {
CORBA_exception_init (&ev);
@@ -103,6 +102,7 @@ itip_addresses_get (void)
}
len = bonobo_config_get_long_with_default (db, "/Mail/Accounts/num", 0, NULL);
+ def = bonobo_config_get_long_with_default (db, "/Mail/Accounts/default_account", 0, NULL);
for (i = 0; i < len; i++) {
ItipAddress *a;
@@ -119,24 +119,13 @@ itip_addresses_get (void)
a->address = bonobo_config_get_string (db, path, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/account_is_default_%d", i);
- a->default_address = !have_default && bonobo_config_get_boolean (db, path, NULL);
-
- if (a->default_address)
- have_default = TRUE;
- g_free (path);
+ if (i == def)
+ a->default_address = TRUE;
a->full = g_strdup_printf ("%s <%s>", a->name, a->address);
addresses = g_list_append (addresses, a);
}
- /* If nothing was marked as default */
- if (!have_default && addresses != NULL) {
- ItipAddress *a = addresses->data;
-
- a->default_address = TRUE;
- }
-
return addresses;
}