static void
setup_source_actions (EShellView *shell_view,
                      GtkActionEntry *entries)
{
	EShellWindow *shell_window;
	const gchar *group;

	g_return_if_fail (shell_view != NULL);
	g_return_if_fail (entries != NULL);

	if (strstr (entries->name, "calendar"))
		group = "calendar";
	else if (strstr (entries->name, "tasks"))
		group = "tasks";
	else
		group = "contacts";

	shell_window = e_shell_view_get_shell_window (shell_view);

	e_action_group_add_actions_localized (
		e_shell_window_get_action_group (shell_window, group), GETTEXT_PACKAGE,
		entries, NUM_ENTRIES, shell_view);

	g_signal_connect (shell_view, "update-actions", G_CALLBACK (update_source_entries_cb), entries);
}
static GtkActionGroup *
mail_shell_content_get_action_group (EMailReader *reader,
                                     EMailReaderActionGroup group)
{
	EShellView *shell_view;
	EShellWindow *shell_window;
	EShellContent *shell_content;
	const gchar *group_name;

	shell_content = E_SHELL_CONTENT (reader);
	shell_view = e_shell_content_get_shell_view (shell_content);
	shell_window = e_shell_view_get_shell_window (shell_view);

	switch (group) {
		case E_MAIL_READER_ACTION_GROUP_STANDARD:
			group_name = "mail";
			break;
		case E_MAIL_READER_ACTION_GROUP_SEARCH_FOLDERS:
			group_name = "search-folders";
			break;
		default:
			g_return_val_if_reached (NULL);
	}

	return e_shell_window_get_action_group (shell_window, group_name);
}
Exemple #3
0
static void
update_mmp_entries_cb (EShellView *shell_view,
                       gpointer user_data)
{
	EShellWindow *shell_window;
	GtkActionGroup *action_group;
	gboolean visible;
	gchar *full_name = NULL, *uri = NULL;
	guint n_selected = 0;

	g_return_if_fail (E_IS_SHELL_VIEW (shell_view));

	shell_window = e_shell_view_get_shell_window (shell_view);
	action_group = e_shell_window_get_action_group (shell_window, "mail");

	visible = is_in_gw_account (shell_view, NULL, &full_name);
	if (visible) {
		EShellContent *shell_content;
		EMailReader *reader;
		GPtrArray *uids;

		shell_content = e_shell_view_get_shell_content (shell_view);

		reader = E_MAIL_READER (shell_content);
		uids = e_mail_reader_get_selected_uids (reader);

		if (uids)
			n_selected = uids->len;

		em_utils_uids_free (uids);

		visible = n_selected > 0;
	}

	visible_actions (action_group, visible, mmp_entries, G_N_ELEMENTS (mmp_entries));

	if (visible) {
		GtkAction *action;
		gboolean is_sent_items_folder = full_name && g_ascii_strncasecmp (full_name, "Sent Items", 10) == 0;

		action = gtk_action_group_get_action (action_group, "gw-track-message-status");
		g_return_if_fail (action != NULL);
		gtk_action_set_visible (action, is_sent_items_folder && n_selected == 1);

		action = gtk_action_group_get_action (action_group, "gw-retract-mail");
		g_return_if_fail (action != NULL);
		gtk_action_set_visible (action, is_sent_items_folder && n_selected == 1);
	}

	g_free (full_name);
	g_free (uri);
}
gboolean e_plugin_ui_init(GtkUIManager *ui_manager, EShellView *shell_view)
{
    EShellWindow *shell_window;
    GtkActionGroup *action_group;

    shell_window = e_shell_view_get_shell_window (shell_view);
    action_group = e_shell_window_get_action_group (shell_window, "calendar");

    gtk_action_group_add_actions (
        action_group, menuItems,
        G_N_ELEMENTS (menuItems), shell_view);

    return TRUE;
}
gboolean
eex_ui_mail_init (GtkUIManager *ui_manager,
                  EShellView *shell_view)
{
	EShellWindow *shell_window;

	shell_window = e_shell_view_get_shell_window (shell_view);

	e_action_group_add_actions_localized (
		e_shell_window_get_action_group (shell_window, "mail"), GETTEXT_PACKAGE,
		mail_entries, G_N_ELEMENTS (mail_entries), shell_view);

	g_signal_connect (shell_view, "update-actions", G_CALLBACK (update_mail_entries_cb), NULL);

	return TRUE;
}
static void
update_source_entries_cb (EShellView *shell_view,
                          GtkActionEntry *entries)
{
	GtkActionGroup *action_group;
	EShellWindow *shell_window;
	GtkAction *action;
	const gchar *group;
	gchar *uri = NULL;
	gboolean is_eex_source, is_eex_avail;
	gint i;

	g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
	g_return_if_fail (entries != NULL);

	if (strstr (entries->name, "calendar"))
		group = "calendar";
	else if (strstr (entries->name, "tasks"))
		group = "tasks";
	else
		group = "contacts";

	is_eex_source = is_eex_source_selected (shell_view, &uri);
	is_eex_avail = is_eex_source || is_eex_source_available (shell_view);
	shell_window = e_shell_view_get_shell_window (shell_view);
	action_group = e_shell_window_get_action_group (shell_window, group);

	/* index 0 ... Permissions
	 * index 1 ... Subscribe to
	 * index 2 ... Unsubscribe */
	for (i = 0; i < NUM_ENTRIES; i++) {
		gboolean visible = is_eex_avail;

		action = gtk_action_group_get_action (action_group, entries[i].name);
		g_return_if_fail (action != NULL);

		if (visible && i == 2) {
			/* it's an unsubscribe, check if this is public and show/hide based on that */
			visible = uri && is_subscribed_folder (uri);
		}

		gtk_action_set_visible (action, visible);
		gtk_action_set_sensitive (action, i == 1 || (visible && is_eex_source));
	}

	g_free (uri);
}
Exemple #7
0
gboolean
gw_ui_calendar_event_popup (GtkUIManager *ui_manager,
                            EShellView *shell_view)
{
	EShellWindow *shell_window;
	GtkActionGroup *action_group;

	shell_window = e_shell_view_get_shell_window (shell_view);
	action_group = e_shell_window_get_action_group (shell_window, "calendar");

	e_action_group_add_actions_localized (
		action_group, GETTEXT_PACKAGE,
		cal_entries, G_N_ELEMENTS (cal_entries), shell_view);

	g_signal_connect (shell_view, "update-actions", G_CALLBACK (update_cal_entries_cb), NULL);

	return TRUE;
}
gboolean
calendar_actions_init (GtkUIManager *ui_manager, EShellView *shell_view)
{
  EShellWindow *shell_window;
  GtkActionGroup *action_group;
  GtkAction *action;

  shell_window = e_shell_view_get_shell_window (shell_view);

  action_group = e_shell_window_get_action_group (shell_window, "calendar");

/*  action = gtk_action_new ("calendar-permissions", _("Setup permissions"), _("Setup 3e calendar permissions"), "stock_shared-by-me");
  gtk_action_group_add_action (action_group, action);

  g_signal_connect (
    action, "activate",
    G_CALLBACK (on_permissions_cb), shell_view);

  g_object_unref (action);*/

  action = gtk_action_new ("calendar-unsubscribe", _("Unsubscribe"), _("Unsubscribe a previously subscribed 3e calendar"), "remove");
  gtk_action_group_add_action (action_group, action);

  g_signal_connect (
    action, "activate",
    G_CALLBACK (on_unsubscribe_cb), shell_view);

  g_object_unref (action);

  action = gtk_action_new ("calendar-delete-3e", _("Delete from server"), _("Delete calendar from 3e server"), GTK_STOCK_DELETE);
  gtk_action_group_add_action (action_group, action);

  g_signal_connect (
    action, "activate",
    G_CALLBACK (on_delete_cb), shell_view);

  g_object_unref (action);

  return TRUE;
}
static void
update_mail_entries_cb (EShellView *shell_view,
                        gpointer user_data)
{
	GtkActionGroup *action_group;
	EShellWindow *shell_window;
	GtkAction *action;
	gboolean is_eex, is_eex_avail;
	gchar *uri = NULL;
	gint i;

	g_return_if_fail (E_IS_SHELL_VIEW (shell_view));

	is_eex = is_eex_folder_selected (shell_view, &uri);
	is_eex_avail = is_eex || is_eex_store_available (shell_view);
	shell_window = e_shell_view_get_shell_window (shell_view);
	action_group = e_shell_window_get_action_group (shell_window, "mail");

	/* index 0 ... Permissions
	 * index 1 ... Subscribe to
	 * index 2 ... Unsubscribe */
	for (i = 0; i < G_N_ELEMENTS (mail_entries); i++) {
		gboolean visible = is_eex_avail;

		action = gtk_action_group_get_action (action_group, mail_entries[i].name);
		g_return_if_fail (action != NULL);

		if (visible && i == 2) {
			/* it's an unsubscribe, check if this is public and show/hide based on that */
			visible = uri && is_subscribed_folder (uri);
		}

		gtk_action_set_visible (action, visible);
		gtk_action_set_sensitive (action, i == 1 || (visible && is_eex));
	}

	g_free (uri);
}
Exemple #10
0
static void
update_mfp_entries_cb (EShellView *shell_view,
                       gpointer user_data)
{
	GtkActionGroup *action_group;
	EShellWindow *shell_window;
	gboolean is_on_store = FALSE, visible;

	g_return_if_fail (E_IS_SHELL_VIEW (shell_view));

	shell_window = e_shell_view_get_shell_window (shell_view);
	action_group = e_shell_window_get_action_group (shell_window, "mail");

	visible = is_in_gw_account (shell_view, &is_on_store, NULL);
	visible_actions (action_group, visible, mfp_entries, G_N_ELEMENTS (mfp_entries));

	if (visible && !is_on_store) {
		GtkAction *action = gtk_action_group_get_action (action_group, "gw-proxy-login");

		g_return_if_fail (action != NULL);

		gtk_action_set_visible (action, FALSE);
	}
}
Exemple #11
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);
}