示例#1
0
/* fill_widgets handler for the alarm page */
static void
alarm_to_dialog (Dialog *dialog)
{
	GtkTreeModel *model;
	GtkTreeIter iter;
	gboolean valid;
	gboolean repeat;
	ECalComponentAlarmAction action;
	gchar *email;
	gint i;

	/* Clean the page */
	clear_widgets (dialog);

	/* Alarm types */
	model = gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->action_combo));
	valid = gtk_tree_model_get_iter_first (model, &iter);
	for (i = 0; valid && action_map[i] != -1; i++) {
		gtk_list_store_set (
			GTK_LIST_STORE (model), &iter,
			1, !e_client_check_capability (E_CLIENT (dialog->cal_client), action_map_cap[i]),
			-1);

		valid = gtk_tree_model_iter_next (model, &iter);
	}

	/* Set a default address if possible */
	if (!e_client_check_capability (E_CLIENT (dialog->cal_client), CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS)
	    && !e_cal_component_alarm_has_attendees (dialog->alarm)
	    && e_client_get_backend_property_sync (E_CLIENT (dialog->cal_client), CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS, &email, NULL, NULL)) {
		ECalComponentAttendee *a;
		GSList attendee_list;

		a = g_new0 (ECalComponentAttendee, 1);
		a->value = email;
		a->cutype = ICAL_CUTYPE_INDIVIDUAL;
		a->status = ICAL_PARTSTAT_NEEDSACTION;
		a->role = ICAL_ROLE_REQPARTICIPANT;
		attendee_list.data = a;
		attendee_list.next = NULL;
		e_cal_component_alarm_set_attendee_list (dialog->alarm, &attendee_list);
		g_free (email);
		g_free (a);
	}

	/* If we can repeat */
	repeat = !e_client_check_capability (E_CLIENT (dialog->cal_client), CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT);
	gtk_widget_set_sensitive (dialog->repeat_toggle, repeat);

	/* if we are editing a exiting alarm */
	e_cal_component_alarm_get_action (dialog->alarm, &action);

	if (action)
		populate_widgets_from_alarm (dialog);
}
示例#2
0
static gboolean
addressbook_model_idle_cb (EAddressbookModel *model)
{
	model->priv->client_view_idle_id = 0;

	if (model->priv->book_client && model->priv->query_str) {
		remove_book_view (model);

		if (model->priv->first_get_view) {
			model->priv->first_get_view = FALSE;

			if (e_client_check_capability (E_CLIENT (model->priv->book_client), "do-initial-query")) {
				e_book_client_get_view (
					model->priv->book_client, model->priv->query_str,
					NULL, client_view_ready_cb, model);
			} else {
				free_data (model);

				g_signal_emit (
					model, signals[MODEL_CHANGED], 0);
				g_signal_emit (
					model, signals[STOP_STATE_CHANGED], 0);
			}
		} else
			e_book_client_get_view (
				model->priv->book_client, model->priv->query_str,
				NULL, client_view_ready_cb, model);

	}

	g_object_unref (model);

	return FALSE;
}
示例#3
0
static void
set_empty_message (EMinicardView *view)
{
	gchar *empty_message;
	gboolean editable = FALSE, perform_initial_query = FALSE, searching = FALSE;

	if (view->adapter) {
		EAddressbookModel *model = NULL;
		EBookClient *book_client = NULL;

		g_object_get (
			view->adapter,
			"editable", &editable,
			"model", &model,
			"client", &book_client,
			NULL);

		if (book_client && !e_client_check_capability (E_CLIENT (book_client), "do-initial-query"))
			perform_initial_query = TRUE;

		searching = model && e_addressbook_model_can_stop (model);

		if (book_client)
			g_object_unref (book_client);
		if (model)
			g_object_unref (model);
	}

	if (searching) {
		empty_message = _("\n\nSearching for the Contacts...");
	} else if (editable) {
		if (perform_initial_query)
			empty_message = _("\n\nSearch for the Contact\n\n"
					  "or double-click here to create a new Contact.");
		else
			empty_message = _("\n\nThere are no items to show in this view.\n\n"
					  "Double-click here to create a new Contact.");
	} else {
		if (perform_initial_query)
			empty_message = _("\n\nSearch for the Contact.");
		else
			empty_message = _("\n\nThere are no items to show in this view.");
	}

	g_object_set (
		view,
		"empty_message", empty_message,
		NULL);
}
void
e_cal_shell_view_taskpad_actions_update (ECalShellView *cal_shell_view)
{
	ECalShellContent *cal_shell_content;
	EShellWindow *shell_window;
	EShellView *shell_view;
	ETaskTable *task_table;
	GtkAction *action;
	GSList *list, *iter;
	gboolean assignable = TRUE;
	gboolean editable = TRUE;
	gboolean has_url = FALSE;
	gboolean sensitive;
	gint n_selected;
	gint n_complete = 0;
	gint n_incomplete = 0;

	shell_view = E_SHELL_VIEW (cal_shell_view);
	shell_window = e_shell_view_get_shell_window (shell_view);

	cal_shell_content = cal_shell_view->priv->cal_shell_content;
	task_table = e_cal_shell_content_get_task_table (cal_shell_content);

	n_selected = e_table_selected_count (E_TABLE (task_table));

	list = e_task_table_get_selected (task_table);
	for (iter = list; iter != NULL; iter = iter->next) {
		ECalModelComponent *comp_data = iter->data;
		icalproperty *prop;
		const gchar *cap;
		gboolean read_only;

		read_only = e_client_is_readonly (E_CLIENT (comp_data->client));
		editable &= !read_only;

		cap = CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT;
		if (e_client_check_capability (E_CLIENT (comp_data->client), cap))
			assignable = FALSE;

		cap = CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK;
		if (e_client_check_capability (E_CLIENT (comp_data->client), cap))
			assignable = FALSE;

		prop = icalcomponent_get_first_property (
			comp_data->icalcomp, ICAL_URL_PROPERTY);
		has_url |= (prop != NULL);

		prop = icalcomponent_get_first_property (
			comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
		if (prop != NULL)
			n_complete++;
		else
			n_incomplete++;
	}
	g_slist_free (list);

	action = ACTION (CALENDAR_TASKPAD_ASSIGN);
	sensitive = (n_selected == 1) && editable && assignable;
	gtk_action_set_sensitive (action, sensitive);

	action = ACTION (CALENDAR_TASKPAD_FORWARD);
	sensitive = (n_selected == 1);
	gtk_action_set_sensitive (action, sensitive);

	action = ACTION (CALENDAR_TASKPAD_MARK_COMPLETE);
	sensitive = (n_selected > 0) && editable && (n_incomplete > 0);
	gtk_action_set_sensitive (action, sensitive);

	action = ACTION (CALENDAR_TASKPAD_MARK_INCOMPLETE);
	sensitive = (n_selected > 0) && editable && (n_complete > 0);
	gtk_action_set_sensitive (action, sensitive);

	action = ACTION (CALENDAR_TASKPAD_OPEN);
	sensitive = (n_selected == 1);
	gtk_action_set_sensitive (action, sensitive);

	action = ACTION (CALENDAR_TASKPAD_OPEN_URL);
	sensitive = (n_selected == 1) && has_url;
	gtk_action_set_sensitive (action, sensitive);

	action = ACTION (CALENDAR_TASKPAD_PRINT);
	sensitive = (n_selected == 1);
	gtk_action_set_sensitive (action, sensitive);

	action = ACTION (CALENDAR_TASKPAD_SAVE_AS);
	sensitive = (n_selected == 1);
	gtk_action_set_sensitive (action, sensitive);
}
示例#5
0
static void
update_cal_entries_cb (EShellView *shell_view,
                       gpointer user_data)
{
	EShellWindow *shell_window;
	GtkActionGroup *action_group;
	gboolean visible = FALSE, is_unaccepted = FALSE, is_mtg_owner = FALSE;
	EShellContent *shell_content;
	GnomeCalendar *gcal = NULL;
	GnomeCalendarViewType view_type;
	ECalendarView *view;

	g_return_if_fail (E_IS_SHELL_VIEW (shell_view));

	shell_window = e_shell_view_get_shell_window (shell_view);
	shell_content = e_shell_view_get_shell_content (shell_view);

	g_object_get (shell_content, "calendar", &gcal, NULL);

	view_type = gnome_calendar_get_view (gcal);
	view = gnome_calendar_get_calendar_view (gcal, view_type);

	if (view) {
		GList *selected;

		selected = e_calendar_view_get_selected_events (view);
		if (selected && selected->data) {
			ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
			const gchar *uri;

			uri = is_comp_data_valid (event) ? e_client_get_uri (E_CLIENT (event->comp_data->client)) : NULL;

			if (uri && g_ascii_strncasecmp (uri, "groupwise://", 12) == 0) {
				visible = e_cal_util_component_has_attendee (event->comp_data->icalcomp);
				if (visible) {
					ECalComponent *comp;

					comp = e_cal_component_new ();
					e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));

					if (e_client_check_capability (E_CLIENT (event->comp_data->client), CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING)) {
						gchar *user_email;

						user_email = itip_get_comp_attendee (comp, event->comp_data->client);

						is_unaccepted = needs_to_accept (event->comp_data->icalcomp, user_email);

						g_free (user_email);
					}

					is_mtg_owner = is_meeting_owner (comp, event->comp_data->client);

					g_object_unref (comp);
				}
			}
		}

		g_list_free (selected);
	}

	action_group = e_shell_window_get_action_group (shell_window, "calendar");
	visible_actions (action_group, visible, cal_entries, G_N_ELEMENTS (cal_entries));

	if (visible && !is_unaccepted) {
		GtkAction *action;

		action = gtk_action_group_get_action (action_group, "gw-meeting-accept");
		g_return_if_fail (action != NULL);
		gtk_action_set_visible (action, FALSE);

		action = gtk_action_group_get_action (action_group, "gw-meeting-accept-tentative");
		g_return_if_fail (action != NULL);
		gtk_action_set_visible (action, FALSE);
	}

	if (visible && !is_mtg_owner) {
		GtkAction *action;

		action = gtk_action_group_get_action (action_group, "gw-resend-meeting");
		g_return_if_fail (action != NULL);
		gtk_action_set_visible (action, FALSE);
	}

	g_object_unref (gcal);
}
示例#6
0
static guint32
task_shell_content_check_state (EShellContent *shell_content)
{
	ETaskShellContent *task_shell_content;
	ETaskTable *task_table;
	GSList *list, *iter;
	gboolean assignable = TRUE;
	gboolean editable = TRUE;
	gboolean has_url = FALSE;
	gint n_selected;
	gint n_complete = 0;
	gint n_incomplete = 0;
	guint32 state = 0;

	task_shell_content = E_TASK_SHELL_CONTENT (shell_content);
	task_table = e_task_shell_content_get_task_table (task_shell_content);

	n_selected = e_table_selected_count (E_TABLE (task_table));

	list = e_task_table_get_selected (task_table);
	for (iter = list; iter != NULL; iter = iter->next) {
		ECalModelComponent *comp_data = iter->data;
		icalproperty *prop;
		const gchar *cap;
		gboolean read_only;

		if (!comp_data)
			continue;

		read_only = e_client_is_readonly (E_CLIENT (comp_data->client));
		editable &= !read_only;

		cap = CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT;
		if (e_client_check_capability (E_CLIENT (comp_data->client), cap))
			assignable = FALSE;

		cap = CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK;
		if (e_client_check_capability (E_CLIENT (comp_data->client), cap))
			assignable = FALSE;

		prop = icalcomponent_get_first_property (
			comp_data->icalcomp, ICAL_URL_PROPERTY);
		has_url |= (prop != NULL);

		prop = icalcomponent_get_first_property (
			comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
		if (prop != NULL)
			n_complete++;
		else
			n_incomplete++;
	}
	g_slist_free (list);

	if (n_selected == 1)
		state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_SINGLE;
	if (n_selected > 1)
		state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_MULTIPLE;
	if (assignable)
		state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_CAN_ASSIGN;
	if (editable)
		state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_IS_EDITABLE;
	if (n_complete > 0)
		state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_HAS_COMPLETE;
	if (n_incomplete > 0)
		state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_HAS_INCOMPLETE;
	if (has_url)
		state |= E_CAL_BASE_SHELL_CONTENT_SELECTION_HAS_URL;

	return state;
}