aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/memos-component.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/memos-component.c')
-rw-r--r--calendar/gui/memos-component.c208
1 files changed, 104 insertions, 104 deletions
diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c
index 40b71cf5f5..8766649959 100644
--- a/calendar/gui/memos-component.c
+++ b/calendar/gui/memos-component.c
@@ -84,16 +84,16 @@ extern ECompEditorRegistry *comp_editor_registry;
typedef struct _MemosComponentView
{
ESourceList *source_list;
-
+
GSList *source_selection;
-
+
EMemos *memos;
ETable *table;
ETableModel *model;
EInfoLabel *info_label;
GtkWidget *source_selector;
-
+
BonoboControl *view_control;
BonoboControl *sidebar_control;
BonoboControl *statusbar_control;
@@ -113,9 +113,9 @@ struct _MemosComponentPrivate {
GSList *source_selection;
GList *views;
-
+
ECal *create_ecal;
-
+
GList *notifications;
};
@@ -157,7 +157,7 @@ ensure_sources (MemosComponent *component)
group = E_SOURCE_GROUP (g->data);
- /* compare only file:// part. If user home dir name changes we do not want to create
+ /* compare only file:// part. If user home dir name changes we do not want to create
one more group */
if (!on_this_computer && !strncmp (base_uri_proto, e_source_group_peek_base_uri (group), 7))
@@ -249,10 +249,10 @@ static gboolean
is_in_selection (GSList *selection, ESource *source)
{
GSList *l;
-
+
for (l = selection; l; l = l->next) {
ESource *selected_source = l->data;
-
+
if (!strcmp (e_source_peek_uid (selected_source), e_source_peek_uid (source)))
return TRUE;
}
@@ -264,10 +264,10 @@ static gboolean
is_in_uids (GSList *uids, ESource *source)
{
GSList *l;
-
+
for (l = uids; l; l = l->next) {
const char *uid = l->data;
-
+
if (!strcmp (uid, e_source_peek_uid (source)))
return TRUE;
}
@@ -279,19 +279,19 @@ static void
update_uris_for_selection (MemosComponentView *component_view)
{
GSList *selection, *l, *uids_selected = NULL;
-
+
selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (component_view->source_selector));
-
+
for (l = component_view->source_selection; l; l = l->next) {
ESource *old_selected_source = l->data;
if (!is_in_selection (selection, old_selected_source))
e_memos_remove_memo_source (component_view->memos, old_selected_source);
- }
-
+ }
+
for (l = selection; l; l = l->next) {
ESource *selected_source = l->data;
-
+
e_memos_add_memo_source (component_view->memos, selected_source);
uids_selected = g_slist_append (uids_selected, (char *)e_source_peek_uid (selected_source));
}
@@ -322,7 +322,7 @@ update_uri_for_primary_selection (MemosComponentView *component_view)
etable = e_memo_table_get_table (cal_table);
memos_control_sensitize_commands (component_view->view_control, component_view->memos, e_table_selected_count (etable));
-
+
/* Save the selection for next time we start up */
calendar_config_set_primary_memos (e_source_peek_uid (source));
}
@@ -331,7 +331,7 @@ static void
update_selection (MemosComponentView *component_view)
{
GSList *selection, *uids_selected, *l;
-
+
d(g_message("memos-component.c: update_selection called");)
/* Get the selection in gconf */
@@ -343,10 +343,10 @@ update_selection (MemosComponentView *component_view)
for (l = selection; l; l = l->next) {
ESource *source = l->data;
- if (!is_in_uids (uids_selected, source))
+ if (!is_in_uids (uids_selected, source))
e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
}
-
+
e_source_selector_free_selection (selection);
/* Make sure the whole selection is there */
@@ -355,9 +355,9 @@ update_selection (MemosComponentView *component_view)
ESource *source;
source = e_source_list_peek_source_by_uid (component_view->source_list, uid);
- if (source)
+ if (source)
e_source_selector_select_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
-
+
g_free (uid);
}
g_slist_free (uids_selected);
@@ -374,7 +374,7 @@ update_primary_selection (MemosComponentView *component_view)
source = e_source_list_peek_source_by_uid (component_view->source_list, uid);
g_free (uid);
}
-
+
if (source) {
e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector), source);
} else {
@@ -394,7 +394,7 @@ copy_memo_list_cb (EPopup *ep, EPopupItem *pitem, void *data)
{
MemosComponentView *component_view = data;
ESource *selected_source;
-
+
selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
if (!selected_source)
return;
@@ -434,7 +434,7 @@ delete_memo_list_cb (EPopup *ep, EPopupItem *pitem, void *data)
e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector),
selected_source);
}
-
+
e_source_group_remove_source (e_source_peek_group (selected_source), selected_source);
e_source_list_sync (component_view->source_list, NULL);
}
@@ -533,7 +533,7 @@ set_info (MemosComponentView *component_view)
{
GString *message = g_string_new (NULL);
int rows, selected_rows;
-
+
rows = e_table_model_row_count (component_view->model);
selected_rows = e_table_selected_count (component_view->table);
@@ -596,11 +596,11 @@ impl_upgradeFromVersion (PortableServer_Servant servant,
}
static gboolean
-selector_tree_drag_drop (GtkWidget *widget,
- GdkDragContext *context,
- int x,
- int y,
- guint time,
+selector_tree_drag_drop (GtkWidget *widget,
+ GdkDragContext *context,
+ int x,
+ int y,
+ guint time,
CalendarComponent *component)
{
GtkTreeViewColumn *column;
@@ -610,12 +610,12 @@ selector_tree_drag_drop (GtkWidget *widget,
GtkTreeModel *model;
GtkTreeIter iter;
gpointer data;
-
- if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), x, y, &path,
+
+ if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), x, y, &path,
&column, &cell_x, &cell_y))
return FALSE;
-
-
+
+
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
if (!gtk_tree_model_get_iter (model, &iter, path)) {
@@ -624,17 +624,17 @@ selector_tree_drag_drop (GtkWidget *widget,
}
gtk_tree_model_get (model, &iter, 0, &data, -1);
-
+
if (E_IS_SOURCE_GROUP (data)) {
g_object_unref (data);
gtk_tree_path_free (path);
return FALSE;
}
-
+
gtk_tree_path_free (path);
return TRUE;
}
-
+
static gboolean
selector_tree_drag_motion (GtkWidget *widget,
GdkDragContext *context,
@@ -649,21 +649,21 @@ selector_tree_drag_motion (GtkWidget *widget,
GtkTreeModel *model;
GtkTreeIter iter;
GdkDragAction action = GDK_ACTION_DEFAULT;
-
+
if (!gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget),
x, y, &path, &pos))
goto finish;
-
+
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
-
+
if (!gtk_tree_model_get_iter (model, &iter, path))
goto finish;
-
+
gtk_tree_model_get (model, &iter, 0, &data, -1);
if (E_IS_SOURCE_GROUP (data) || e_source_get_readonly (data))
goto finish;
-
+
gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW (widget), path, GTK_TREE_VIEW_DROP_INTO_OR_BEFORE);
action = context->suggested_action;
if (action == GDK_ACTION_COPY && (context->actions & GDK_ACTION_MOVE))
@@ -688,7 +688,7 @@ update_single_object (ECal *client, icalcomponent *icalcomp, gboolean fail_on_mo
d(g_message("memos-component.c: update_single_object called");)
uid = (char *) icalcomponent_get_uid (icalcomp);
-
+
if (e_cal_get_object (client, uid, NULL, &tmp_icalcomp, NULL)) {
if (fail_on_modify)
return FALSE;
@@ -696,7 +696,7 @@ update_single_object (ECal *client, icalcomponent *icalcomp, gboolean fail_on_mo
return e_cal_modify_object (client, icalcomp, CALOBJ_MOD_ALL, NULL);
}
- return e_cal_create_object (client, icalcomp, &uid, NULL);
+ return e_cal_create_object (client, icalcomp, &uid, NULL);
}
static gboolean
@@ -704,7 +704,7 @@ update_objects (ECal *client, icalcomponent *icalcomp)
{
icalcomponent *subcomp;
icalcomponent_kind kind;
-
+
d(g_message("memos-component.c: update_objects called");)
kind = icalcomponent_isa (icalcomp);
@@ -716,7 +716,7 @@ update_objects (ECal *client, icalcomponent *icalcomp)
subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
while (subcomp) {
gboolean success;
-
+
kind = icalcomponent_isa (subcomp);
if (kind == ICAL_VTIMEZONE_COMPONENT) {
icaltimezone *zone;
@@ -741,10 +741,10 @@ update_objects (ECal *client, icalcomponent *icalcomp)
}
static void
-selector_tree_drag_data_received (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
+selector_tree_drag_data_received (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
GtkSelectionData *data,
guint info,
guint time,
@@ -764,13 +764,13 @@ selector_tree_drag_data_received (GtkWidget *widget,
if (!gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget),
x, y, &path, &pos))
goto finish;
-
+
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
-
+
if (!gtk_tree_model_get_iter (model, &iter, path))
goto finish;
-
-
+
+
gtk_tree_model_get (model, &iter, 0, &source, -1);
if (E_IS_SOURCE_GROUP (source) || e_source_get_readonly (source) || !data->data)
@@ -865,12 +865,12 @@ selector_tree_drag_data_received (GtkWidget *widget,
gtk_tree_path_free (path);
gtk_drag_finish (context, success, success && context->action == GDK_ACTION_MOVE, time);
-}
+}
static void
selector_tree_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, gpointer data)
{
- gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW (widget),
+ gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW (widget),
NULL, GTK_TREE_VIEW_DROP_BEFORE);
}
@@ -883,33 +883,33 @@ control_activate_cb (BonoboControl *control, gboolean activate, gpointer data)
if (activate) {
BonoboUIComponent *uic;
uic = bonobo_control_get_ui_component (component_view->view_control);
-
+
e_user_creatable_items_handler_activate (component_view->creatable_items_handler, uic);
- }
+ }
}
static void
config_create_ecal_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
+{
MemosComponent *component = data;
MemosComponentPrivate *priv;
-
+
priv = component->priv;
g_object_unref (priv->create_ecal);
priv->create_ecal = NULL;
-
+
priv->notifications = g_list_remove (priv->notifications, GUINT_TO_POINTER (id));
}
static ECal *
-setup_create_ecal (MemosComponent *component, MemosComponentView *component_view)
+setup_create_ecal (MemosComponent *component, MemosComponentView *component_view)
{
MemosComponentPrivate *priv;
ESource *source = NULL;
char *uid;
guint not;
-
+
priv = component->priv;
if (component_view) {
@@ -919,10 +919,10 @@ setup_create_ecal (MemosComponent *component, MemosComponentView *component_view
if (default_ecal)
return default_ecal;
}
-
+
if (priv->create_ecal)
- return priv->create_ecal;
-
+ return priv->create_ecal;
+
/* Get the current primary calendar, or try to set one if it doesn't already exist */
uid = calendar_config_get_primary_memos ();
if (uid) {
@@ -938,15 +938,15 @@ setup_create_ecal (MemosComponent *component, MemosComponentView *component_view
if (source)
priv->create_ecal = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL);
}
-
+
if (priv->create_ecal) {
if (!e_cal_open (priv->create_ecal, FALSE, NULL)) {
GtkWidget *dialog;
-
+
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
- _("Unable to open the memo list '%s' for creating events and meetings"),
+ _("Unable to open the memo list '%s' for creating events and meetings"),
e_source_peek_name (source));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -956,7 +956,7 @@ setup_create_ecal (MemosComponent *component, MemosComponentView *component_view
} else {
GtkWidget *dialog;
-
+
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
_("There is no calendar available for creating memos"));
@@ -964,10 +964,10 @@ setup_create_ecal (MemosComponent *component, MemosComponentView *component_view
gtk_widget_destroy (dialog);
return NULL;
- }
+ }
/* Handle the fact it may change on us */
- not = calendar_config_add_notification_primary_memos (config_create_ecal_changed_cb,
+ not = calendar_config_add_notification_primary_memos (config_create_ecal_changed_cb,
component);
priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
@@ -995,7 +995,7 @@ create_new_memo (MemosComponent *memo_component, gboolean is_assigned, MemosComp
ECalComponent *comp;
MemoEditor *editor;
CompEditorFlags flags = 0;
-
+
ecal = setup_create_ecal (memo_component, component_view);
if (!ecal)
return FALSE;
@@ -1026,18 +1026,18 @@ create_local_item_cb (EUserCreatableItemsHandler *handler, const char *item_type
MemosComponentPrivate *priv;
MemosComponentView *component_view = NULL;
GList *l;
-
+
priv = memos_component->priv;
-
+
for (l = priv->views; l; l = l->next) {
component_view = l->data;
if (component_view->creatable_items_handler == handler)
break;
-
+
component_view = NULL;
}
-
+
if (strcmp (item_type_name, CREATE_MEMO_ID) == 0) {
create_new_memo (memos_component, FALSE, component_view);
} else if (strcmp (item_type_name, CREATE_SHARED_MEMO_ID) == 0) {
@@ -1055,28 +1055,28 @@ create_component_view (MemosComponent *memos_component)
GtkWidget *selector_scrolled_window, *vbox;
GtkWidget *statusbar_widget;
AtkObject *a11y;
-
+
priv = memos_component->priv;
/* Create the calendar component view */
component_view = g_new0 (MemosComponentView, 1);
-
+
/* Add the source lists */
component_view->source_list = g_object_ref (priv->source_list);
-
+
/* Create sidebar selector */
component_view->source_selector = e_source_selector_new (memos_component->priv->source_list);
e_source_selector_set_select_new ((ESourceSelector *)component_view->source_selector, TRUE);
a11y = gtk_widget_get_accessible (GTK_WIDGET (component_view->source_selector));
atk_object_set_name (a11y, _("Memo Source Selector"));
- g_signal_connect (component_view->source_selector, "drag-motion", G_CALLBACK (selector_tree_drag_motion),
+ g_signal_connect (component_view->source_selector, "drag-motion", G_CALLBACK (selector_tree_drag_motion),
memos_component);
- g_signal_connect (component_view->source_selector, "drag-leave", G_CALLBACK (selector_tree_drag_leave),
+ g_signal_connect (component_view->source_selector, "drag-leave", G_CALLBACK (selector_tree_drag_leave),
memos_component);
- g_signal_connect (component_view->source_selector, "drag-drop", G_CALLBACK (selector_tree_drag_drop),
+ g_signal_connect (component_view->source_selector, "drag-drop", G_CALLBACK (selector_tree_drag_drop),
memos_component);
- g_signal_connect (component_view->source_selector, "drag-data-received",
+ g_signal_connect (component_view->source_selector, "drag-data-received",
G_CALLBACK (selector_tree_drag_data_received), memos_component);
gtk_drag_dest_set(component_view->source_selector, GTK_DEST_DEFAULT_ALL, drag_types,
@@ -1116,9 +1116,9 @@ create_component_view (MemosComponent *memos_component)
component_view->model = E_TABLE_MODEL (e_memo_table_get_model (e_memos_get_calendar_table (component_view->memos)));
/* This signal is thrown if backends die - we update the selector */
- g_signal_connect (component_view->memos, "source_added",
+ g_signal_connect (component_view->memos, "source_added",
G_CALLBACK (source_added_cb), component_view);
- g_signal_connect (component_view->memos, "source_removed",
+ g_signal_connect (component_view->memos, "source_removed",
G_CALLBACK (source_removed_cb), component_view);
/* Create status bar */
@@ -1128,9 +1128,9 @@ create_component_view (MemosComponent *memos_component)
gtk_widget_show (statusbar_widget);
component_view->statusbar_control = bonobo_control_new (statusbar_widget);
-
+
e_memo_table_set_activity_handler (e_memos_get_calendar_table (component_view->memos), component_view->activity_handler);
-
+
/* connect after setting the initial selections, or we'll get unwanted calls
to calendar_control_sensitize_calendar_commands */
g_signal_connect (component_view->source_selector, "selection_changed",
@@ -1148,7 +1148,7 @@ create_component_view (MemosComponent *memos_component)
set_info (component_view);
g_signal_connect (component_view->table, "selection_change",
G_CALLBACK (table_selection_change_cb), component_view);
- g_signal_connect (component_view->model, "model_changed",
+ g_signal_connect (component_view->model, "model_changed",
G_CALLBACK (model_changed_cb), component_view);
g_signal_connect (component_view->model, "model_rows_inserted",
G_CALLBACK (model_rows_inserted_cb), component_view);
@@ -1156,7 +1156,7 @@ create_component_view (MemosComponent *memos_component)
G_CALLBACK (model_rows_deleted_cb), component_view);
/* Load the selection from the last run */
- update_selection (component_view);
+ update_selection (component_view);
update_primary_selection (component_view);
return component_view;
@@ -1164,15 +1164,15 @@ create_component_view (MemosComponent *memos_component)
static void
destroy_component_view (MemosComponentView *component_view)
-{
+{
GList *l;
-
+
if (component_view->source_list)
g_object_unref (component_view->source_list);
if (component_view->source_selection)
e_source_selector_free_selection (component_view->source_selection);
-
+
for (l = component_view->notifications; l; l = l->next)
calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
g_list_free (component_view->notifications);
@@ -1192,12 +1192,12 @@ view_destroyed_cb (gpointer data, GObject *where_the_object_was)
MemosComponent *memos_component = data;
MemosComponentPrivate *priv;
GList *l;
-
+
priv = memos_component->priv;
for (l = priv->views; l; l = l->next) {
MemosComponentView *component_view = l->data;
-
+
if (G_OBJECT (component_view->view_control) == where_the_object_was) {
priv->views = g_list_remove (priv->views, component_view);
destroy_component_view (component_view);
@@ -1216,7 +1216,7 @@ impl_createView (PortableServer_Servant servant,
MemosComponentPrivate *priv;
MemosComponentView *component_view;
EComponentView *ecv;
-
+
priv = component->priv;
/* Create the calendar component view */
@@ -1230,7 +1230,7 @@ impl_createView (PortableServer_Servant servant,
g_object_weak_ref (G_OBJECT (component_view->view_control), view_destroyed_cb, component);
priv->views = g_list_append (priv->views, component_view);
-
+
/* TODO: Make CalendarComponentView just subclass EComponentView */
ecv = e_component_view_new_controls (parent, "memos", component_view->sidebar_control,
component_view->view_control, component_view->statusbar_control);
@@ -1283,7 +1283,7 @@ impl_requestCreateItem (PortableServer_Servant servant,
CORBA_Environment *ev)
{
MemosComponent *memos_component = MEMOS_COMPONENT (bonobo_object_from_servant (servant));
-
+
if (strcmp (item_type_name, CREATE_MEMO_ID) == 0) {
if (!create_new_memo (memos_component, FALSE, NULL))
bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
@@ -1308,7 +1308,7 @@ impl_dispose (GObject *object)
MemosComponent *memos_component = MEMOS_COMPONENT (object);
MemosComponentPrivate *priv = memos_component->priv;
GList *l;
-
+
if (priv->source_list != NULL) {
g_object_unref (priv->source_list);
priv->source_list = NULL;
@@ -1325,7 +1325,7 @@ impl_dispose (GObject *object)
for (l = priv->views; l; l = l->next) {
MemosComponentView *component_view = l->data;
-
+
g_object_weak_unref (G_OBJECT (component_view->view_control), view_destroyed_cb, memos_component);
}
g_list_free (priv->views);
@@ -1344,10 +1344,10 @@ impl_finalize (GObject *object)
{
MemosComponentPrivate *priv = MEMOS_COMPONENT (object)->priv;
GList *l;
-
+
for (l = priv->views; l; l = l->next) {
MemosComponentView *component_view = l->data;
-
+
destroy_component_view (component_view);
}
g_list_free (priv->views);
@@ -1382,7 +1382,7 @@ memos_component_init (MemosComponent *component, MemosComponentClass *klass)
MemosComponentPrivate *priv;
priv = g_new0 (MemosComponentPrivate, 1);
-
+
priv->base_directory = g_build_filename (g_get_home_dir (), ".evolution", NULL);
priv->config_directory = g_build_filename (g_get_home_dir (),
".evolution", "memos", "config",
@@ -1428,7 +1428,7 @@ memos_component_peek_config_directory (MemosComponent *component)
ESourceList *
memos_component_peek_source_list (MemosComponent *component)
{
- return component->priv->source_list;
+ return component->priv->source_list;
}
BONOBO_TYPE_FUNC_FULL (MemosComponent, GNOME_Evolution_Component, PARENT_TYPE, memos_component)