edit-dialog: added stub code
The code added make the dialog show up. Probably anything else works, but it's start to keep the project building while GcalManager migration is finished and new GcalEditDialog is built.
This commit is contained in:
+43
-38
@@ -70,6 +70,10 @@ struct _GcalEditDialogPrivate
|
|||||||
|
|
||||||
SimpleEventStore *ev_store;
|
SimpleEventStore *ev_store;
|
||||||
|
|
||||||
|
/* new data holders */
|
||||||
|
ESource *source; /* weak reference */
|
||||||
|
ECalComponent *component;
|
||||||
|
|
||||||
gboolean setting_event;
|
gboolean setting_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -393,6 +397,9 @@ gcal_edit_dialog_finalize (GObject *object)
|
|||||||
if (priv->calendars_menu != NULL)
|
if (priv->calendars_menu != NULL)
|
||||||
g_object_unref (priv->calendars_menu);
|
g_object_unref (priv->calendars_menu);
|
||||||
|
|
||||||
|
if (priv->component != NULL)
|
||||||
|
g_object_unref (priv->component);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gcal_edit_dialog_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gcal_edit_dialog_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -841,27 +848,36 @@ gcal_edit_dialog_new (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gcal_edit_dialog_set_event (GcalEditDialog *dialog,
|
gcal_edit_dialog_set_event_data (GcalEditDialog *dialog,
|
||||||
const gchar *source_uid,
|
GcalEventData *data)
|
||||||
const gchar *event_uid)
|
|
||||||
{
|
{
|
||||||
GcalEditDialogPrivate *priv;
|
GcalEditDialogPrivate *priv;
|
||||||
|
|
||||||
const gchar *const_text;
|
const gchar *const_text = NULL;
|
||||||
gboolean all_day;
|
gboolean all_day;
|
||||||
|
|
||||||
|
const gchar *uid = NULL;
|
||||||
|
ECalComponentText e_summary;
|
||||||
|
ECalComponentDateTime dt;
|
||||||
|
|
||||||
priv = dialog->priv;
|
priv = dialog->priv;
|
||||||
all_day = FALSE;
|
all_day = FALSE;
|
||||||
|
|
||||||
priv->setting_event = TRUE;
|
priv->setting_event = TRUE;
|
||||||
|
|
||||||
|
priv->source = data->source;
|
||||||
|
if (priv->component != NULL)
|
||||||
|
g_object_unref (priv->component);
|
||||||
|
priv->component = e_cal_component_clone (data->event_component);
|
||||||
|
|
||||||
if (priv->source_uid != NULL)
|
if (priv->source_uid != NULL)
|
||||||
g_free (priv->source_uid);
|
g_free (priv->source_uid);
|
||||||
priv->source_uid = g_strdup (source_uid);
|
priv->source_uid = g_strdup (e_source_get_uid (priv->source));
|
||||||
|
|
||||||
if (priv->event_uid != NULL)
|
if (priv->event_uid != NULL)
|
||||||
g_free (priv->event_uid);
|
g_free (priv->event_uid);
|
||||||
priv->event_uid = g_strdup (event_uid);
|
e_cal_component_get_uid (priv->component, &uid);
|
||||||
|
priv->event_uid = g_strdup (uid);
|
||||||
|
|
||||||
/* Clear event data */
|
/* Clear event data */
|
||||||
gcal_edit_dialog_clear_data (dialog);
|
gcal_edit_dialog_clear_data (dialog);
|
||||||
@@ -879,9 +895,8 @@ gcal_edit_dialog_set_event (GcalEditDialog *dialog,
|
|||||||
|
|
||||||
/* Load new event data */
|
/* Load new event data */
|
||||||
/* summary */
|
/* summary */
|
||||||
priv->ev_store->summary = gcal_manager_get_event_summary (priv->manager,
|
e_cal_component_get_summary (priv->component, &e_summary);
|
||||||
priv->source_uid,
|
priv->ev_store->summary = g_strdup (e_summary.value);
|
||||||
priv->event_uid);
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (priv->summary_entry),
|
gtk_entry_set_text (GTK_ENTRY (priv->summary_entry),
|
||||||
priv->ev_store->summary != NULL ?
|
priv->ev_store->summary != NULL ?
|
||||||
priv->ev_store->summary : "");
|
priv->ev_store->summary : "");
|
||||||
@@ -891,20 +906,28 @@ gcal_edit_dialog_set_event (GcalEditDialog *dialog,
|
|||||||
gcal_edit_dialog_set_calendar_selected (dialog);
|
gcal_edit_dialog_set_calendar_selected (dialog);
|
||||||
|
|
||||||
/* start date */
|
/* start date */
|
||||||
priv->ev_store->start_date =
|
e_cal_component_get_dtstart (priv->component, &dt);
|
||||||
gcal_manager_get_event_start_date (priv->manager,
|
priv->ev_store->start_date = gcal_dup_icaltime (dt.value);
|
||||||
priv->source_uid,
|
e_cal_component_free_datetime (&dt);
|
||||||
priv->event_uid);
|
|
||||||
|
|
||||||
gcal_date_entry_set_date (GCAL_DATE_ENTRY (priv->start_date_entry),
|
gcal_date_entry_set_date (GCAL_DATE_ENTRY (priv->start_date_entry),
|
||||||
priv->ev_store->start_date->day,
|
priv->ev_store->start_date->day,
|
||||||
priv->ev_store->start_date->month,
|
priv->ev_store->start_date->month,
|
||||||
priv->ev_store->start_date->year);
|
priv->ev_store->start_date->year);
|
||||||
|
|
||||||
|
/* end date */
|
||||||
|
e_cal_component_get_dtend (priv->component, &dt);
|
||||||
|
priv->ev_store->end_date = gcal_dup_icaltime (dt.value);
|
||||||
|
e_cal_component_free_datetime (&dt);
|
||||||
|
|
||||||
|
gcal_date_entry_set_date (GCAL_DATE_ENTRY (priv->end_date_entry),
|
||||||
|
priv->ev_store->end_date->day,
|
||||||
|
priv->ev_store->end_date->month,
|
||||||
|
priv->ev_store->end_date->year);
|
||||||
|
|
||||||
/* all_day */
|
/* all_day */
|
||||||
priv->ev_store->all_day = gcal_manager_get_event_all_day (priv->manager,
|
priv->ev_store->all_day = (priv->ev_store->start_date->is_date == 1 &&
|
||||||
priv->source_uid,
|
priv->ev_store->end_date->is_date == 1);
|
||||||
priv->event_uid);
|
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->all_day_check),
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->all_day_check),
|
||||||
priv->ev_store->all_day);
|
priv->ev_store->all_day);
|
||||||
|
|
||||||
@@ -917,16 +940,6 @@ gcal_edit_dialog_set_event (GcalEditDialog *dialog,
|
|||||||
gcal_time_entry_set_time (GCAL_TIME_ENTRY (priv->start_time_entry),
|
gcal_time_entry_set_time (GCAL_TIME_ENTRY (priv->start_time_entry),
|
||||||
priv->ev_store->start_date->hour,
|
priv->ev_store->start_date->hour,
|
||||||
priv->ev_store->start_date->minute);
|
priv->ev_store->start_date->minute);
|
||||||
|
|
||||||
/* end date */
|
|
||||||
priv->ev_store->end_date = gcal_manager_get_event_end_date (priv->manager,
|
|
||||||
priv->source_uid,
|
|
||||||
priv->event_uid);
|
|
||||||
gcal_date_entry_set_date (GCAL_DATE_ENTRY (priv->end_date_entry),
|
|
||||||
priv->ev_store->end_date->day,
|
|
||||||
priv->ev_store->end_date->month,
|
|
||||||
priv->ev_store->end_date->year);
|
|
||||||
|
|
||||||
/* end time */
|
/* end time */
|
||||||
if (all_day)
|
if (all_day)
|
||||||
{
|
{
|
||||||
@@ -943,19 +956,12 @@ gcal_edit_dialog_set_event (GcalEditDialog *dialog,
|
|||||||
0);
|
0);
|
||||||
|
|
||||||
/* location */
|
/* location */
|
||||||
const_text = gcal_manager_get_event_location (priv->manager,
|
e_cal_component_get_location (priv->component, &const_text);
|
||||||
priv->source_uid,
|
|
||||||
priv->event_uid);
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (priv->location_entry),
|
gtk_entry_set_text (GTK_ENTRY (priv->location_entry),
|
||||||
const_text != NULL ? const_text : "");
|
const_text != NULL ? const_text : "");
|
||||||
priv->ev_store->location = const_text != NULL ? g_strdup (const_text) : "";
|
priv->ev_store->location = const_text != NULL ? g_strdup (const_text) : "";
|
||||||
|
|
||||||
/* notes */
|
/* notes */
|
||||||
priv->ev_store->description =
|
|
||||||
gcal_manager_get_event_description (priv->manager,
|
|
||||||
priv->source_uid,
|
|
||||||
priv->event_uid);
|
|
||||||
if (priv->ev_store->description == NULL)
|
|
||||||
priv->ev_store->description = "";
|
priv->ev_store->description = "";
|
||||||
|
|
||||||
gtk_text_buffer_set_text (
|
gtk_text_buffer_set_text (
|
||||||
@@ -965,8 +971,8 @@ gcal_edit_dialog_set_event (GcalEditDialog *dialog,
|
|||||||
|
|
||||||
gcal_edit_dialog_set_writable (
|
gcal_edit_dialog_set_writable (
|
||||||
dialog,
|
dialog,
|
||||||
! gcal_manager_get_source_readonly (priv->manager,
|
! gcal_manager_is_client_writable (priv->manager,
|
||||||
priv->source_uid));
|
priv->source));
|
||||||
|
|
||||||
priv->setting_event = FALSE;
|
priv->setting_event = FALSE;
|
||||||
}
|
}
|
||||||
@@ -1016,8 +1022,7 @@ gcal_edit_dialog_set_manager (GcalEditDialog *dialog,
|
|||||||
3, &color,
|
3, &color,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
if (! active ||
|
if (! active)
|
||||||
gcal_manager_get_source_readonly (priv->manager, uid))
|
|
||||||
{
|
{
|
||||||
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (sources_model),
|
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (sources_model),
|
||||||
&iter);
|
&iter);
|
||||||
|
|||||||
@@ -57,9 +57,8 @@ GType gcal_edit_dialog_get_type (void);
|
|||||||
|
|
||||||
GtkWidget* gcal_edit_dialog_new (void);
|
GtkWidget* gcal_edit_dialog_new (void);
|
||||||
|
|
||||||
void gcal_edit_dialog_set_event (GcalEditDialog *dialog,
|
void gcal_edit_dialog_set_event_data (GcalEditDialog *dialog,
|
||||||
const gchar *source_uid,
|
GcalEventData *data);
|
||||||
const gchar *event_uid);
|
|
||||||
|
|
||||||
void gcal_edit_dialog_set_manager (GcalEditDialog *dialog,
|
void gcal_edit_dialog_set_manager (GcalEditDialog *dialog,
|
||||||
GcalManager *manager);
|
GcalManager *manager);
|
||||||
|
|||||||
+3
-3
@@ -863,15 +863,15 @@ gcal_manager_get_default_source (GcalManager *manager)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gcal_manager_get_source_readonly (GcalManager *manager,
|
gcal_manager_is_client_writable (GcalManager *manager,
|
||||||
const gchar *source_uid)
|
ESource *source)
|
||||||
{
|
{
|
||||||
GcalManagerPrivate *priv;
|
GcalManagerPrivate *priv;
|
||||||
GcalManagerUnit *unit;
|
GcalManagerUnit *unit;
|
||||||
|
|
||||||
priv = gcal_manager_get_instance_private (manager);
|
priv = gcal_manager_get_instance_private (manager);
|
||||||
|
|
||||||
unit = g_hash_table_lookup (priv->clients, source_uid);
|
unit = g_hash_table_lookup (priv->clients, source);
|
||||||
return e_client_is_readonly (E_CLIENT (unit->client));
|
return e_client_is_readonly (E_CLIENT (unit->client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -78,8 +78,8 @@ gchar* gcal_manager_add_source (GcalManager *manager
|
|||||||
|
|
||||||
gchar* gcal_manager_get_default_source (GcalManager *manager);
|
gchar* gcal_manager_get_default_source (GcalManager *manager);
|
||||||
|
|
||||||
gboolean gcal_manager_get_source_readonly (GcalManager *manager,
|
gboolean gcal_manager_is_client_writable (GcalManager *manager,
|
||||||
const gchar *source_uid);
|
ESource *source);
|
||||||
|
|
||||||
void gcal_manager_set_new_range (GcalManager *manager,
|
void gcal_manager_set_new_range (GcalManager *manager,
|
||||||
const icaltimetype *initial_date,
|
const icaltimetype *initial_date,
|
||||||
|
|||||||
Reference in New Issue
Block a user