Added source change notification.
Added support in GcalEditDialog to notify when the source of an event has changed.
This commit is contained in:
committed by
Rene A. Viant Moran
parent
b4f7cee991
commit
21ab796fb3
+52
-8
@@ -99,6 +99,8 @@ static gboolean gcal_edit_dialog_date_changed (GcalEditDialog *di
|
|||||||
static void gcal_edit_dialog_date_entry_modified (GtkWidget *entry,
|
static void gcal_edit_dialog_date_entry_modified (GtkWidget *entry,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
static gboolean gcal_edit_dialog_source_changed (GcalEditDialog *dialog);
|
||||||
|
|
||||||
G_DEFINE_TYPE(GcalEditDialog, gcal_edit_dialog, GTK_TYPE_DIALOG)
|
G_DEFINE_TYPE(GcalEditDialog, gcal_edit_dialog, GTK_TYPE_DIALOG)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -409,6 +411,7 @@ gcal_edit_dialog_calendar_selected (GtkWidget *menu_item,
|
|||||||
3, &color,
|
3, &color,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
|
|
||||||
if (priv->active_iter != NULL)
|
if (priv->active_iter != NULL)
|
||||||
gtk_tree_iter_free (priv->active_iter);
|
gtk_tree_iter_free (priv->active_iter);
|
||||||
priv->active_iter = gtk_tree_iter_copy (iter);
|
priv->active_iter = gtk_tree_iter_copy (iter);
|
||||||
@@ -562,8 +565,6 @@ gcal_edit_dialog_clear_data (GcalEditDialog *dialog)
|
|||||||
|
|
||||||
priv = dialog->priv;
|
priv = dialog->priv;
|
||||||
|
|
||||||
/* FIXME: add clear for the rest of the fields when I define loading code for
|
|
||||||
* those below */
|
|
||||||
/* summary */
|
/* summary */
|
||||||
gtk_entry_set_text (GTK_ENTRY (priv->summary_entry), "");
|
gtk_entry_set_text (GTK_ENTRY (priv->summary_entry), "");
|
||||||
|
|
||||||
@@ -829,6 +830,30 @@ gcal_edit_dialog_date_entry_modified (GtkWidget *entry,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gcal_edit_dialog_source_changed (GcalEditDialog *dialog)
|
||||||
|
{
|
||||||
|
GcalEditDialogPrivate *priv;
|
||||||
|
|
||||||
|
GtkListStore *sources_model;
|
||||||
|
gchar* uid;
|
||||||
|
|
||||||
|
priv = dialog->priv;
|
||||||
|
sources_model = gcal_manager_get_sources_model (priv->manager);
|
||||||
|
gtk_tree_model_get (GTK_TREE_MODEL (sources_model), priv->active_iter,
|
||||||
|
0, &uid,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
if (g_strcmp0 (priv->source_uid, uid) != 0)
|
||||||
|
{
|
||||||
|
g_free (uid);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (uid);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Public API */
|
/* Public API */
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
gcal_edit_dialog_new (void)
|
gcal_edit_dialog_new (void)
|
||||||
@@ -1100,7 +1125,6 @@ GList*
|
|||||||
gcal_edit_dialog_get_modified_properties (GcalEditDialog *dialog)
|
gcal_edit_dialog_get_modified_properties (GcalEditDialog *dialog)
|
||||||
{
|
{
|
||||||
GcalEditDialogPrivate *priv;
|
GcalEditDialogPrivate *priv;
|
||||||
gboolean date_changed;
|
|
||||||
gchar *desc;
|
gchar *desc;
|
||||||
GList *res;
|
GList *res;
|
||||||
|
|
||||||
@@ -1117,15 +1141,12 @@ gcal_edit_dialog_get_modified_properties (GcalEditDialog *dialog)
|
|||||||
res = g_list_append (res, GINT_TO_POINTER (EVENT_SUMMARY));
|
res = g_list_append (res, GINT_TO_POINTER (EVENT_SUMMARY));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: add calendar and dates and times and all_day */
|
if (gcal_edit_dialog_date_changed (dialog, TRUE))
|
||||||
date_changed = gcal_edit_dialog_date_changed (dialog, TRUE);
|
|
||||||
if (date_changed)
|
|
||||||
{
|
{
|
||||||
res = g_list_append (res, GINT_TO_POINTER (EVENT_START_DATE));
|
res = g_list_append (res, GINT_TO_POINTER (EVENT_START_DATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
date_changed = gcal_edit_dialog_date_changed (dialog, FALSE);
|
if (gcal_edit_dialog_date_changed (dialog, FALSE))
|
||||||
if (date_changed)
|
|
||||||
{
|
{
|
||||||
res = g_list_append (res, GINT_TO_POINTER (EVENT_END_DATE));
|
res = g_list_append (res, GINT_TO_POINTER (EVENT_END_DATE));
|
||||||
}
|
}
|
||||||
@@ -1144,6 +1165,12 @@ gcal_edit_dialog_get_modified_properties (GcalEditDialog *dialog)
|
|||||||
}
|
}
|
||||||
g_free (desc);
|
g_free (desc);
|
||||||
|
|
||||||
|
/* and the bigger one is the calendar, the source switched */
|
||||||
|
if (gcal_edit_dialog_source_changed (dialog))
|
||||||
|
{
|
||||||
|
res = g_list_append (res, GINT_TO_POINTER (EVENT_SOURCE));
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1265,3 +1292,20 @@ gcal_edit_dialog_get_end_date (GcalEditDialog *dialog)
|
|||||||
|
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gchar*
|
||||||
|
gcal_edit_dialog_get_new_source_uid (GcalEditDialog *dialog)
|
||||||
|
{
|
||||||
|
GcalEditDialogPrivate *priv;
|
||||||
|
|
||||||
|
GtkListStore *sources_model;
|
||||||
|
gchar* uid;
|
||||||
|
|
||||||
|
priv = dialog->priv;
|
||||||
|
sources_model = gcal_manager_get_sources_model (priv->manager);
|
||||||
|
gtk_tree_model_get (GTK_TREE_MODEL (sources_model), priv->active_iter,
|
||||||
|
0, &uid,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ icaltimetype* gcal_edit_dialog_get_start_date (GcalEditDialog *d
|
|||||||
|
|
||||||
icaltimetype* gcal_edit_dialog_get_end_date (GcalEditDialog *dialog);
|
icaltimetype* gcal_edit_dialog_get_end_date (GcalEditDialog *dialog);
|
||||||
|
|
||||||
|
gchar* gcal_edit_dialog_get_new_source_uid (GcalEditDialog *dialog);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GCAL_EDIT_DIALOG_H__ */
|
#endif /* __GCAL_EDIT_DIALOG_H__ */
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ typedef enum
|
|||||||
EVENT_END_DATE,
|
EVENT_END_DATE,
|
||||||
EVENT_LOCATION,
|
EVENT_LOCATION,
|
||||||
EVENT_DESCRIPTION,
|
EVENT_DESCRIPTION,
|
||||||
|
EVENT_SOURCE,
|
||||||
} EventEditableProperty;
|
} EventEditableProperty;
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
|
|||||||
Reference in New Issue
Block a user