コード例 #1
0
static void
e_mapi_config_ui_extension_shell_view_toggled_cb (EShellView *shell_view,
						  EMapiConfigUIExtension *ui_ext)
{
	EShellViewClass *shell_view_class;
	EShellWindow *shell_window;
	GtkUIManager *ui_manager;
	gpointer key = NULL, value = NULL;
	const gchar *ui_def;
	gboolean is_active, need_update;

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

	shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
	g_return_if_fail (shell_view_class != NULL);

	shell_window = e_shell_view_get_shell_window (shell_view);
	ui_manager = e_shell_window_get_ui_manager (shell_window);

	need_update = ui_ext->current_ui_id != 0;
	if (ui_ext->current_ui_id) {
		gtk_ui_manager_remove_ui (ui_manager, ui_ext->current_ui_id);
		ui_ext->current_ui_id = 0;
	}

	is_active = e_shell_view_is_active (shell_view);
	if (!is_active) {
		if (need_update)
			gtk_ui_manager_ensure_update (ui_manager);

		return;
	}

	if (!g_hash_table_lookup_extended (ui_ext->ui_definitions, shell_view_class->ui_manager_id, &key, &value)) {
		gchar *ui_definition = NULL;

		e_mapi_config_utils_init_ui (shell_view, shell_view_class->ui_manager_id, &ui_definition);
		g_hash_table_insert (ui_ext->ui_definitions, g_strdup (shell_view_class->ui_manager_id), ui_definition);
	}

	ui_def = g_hash_table_lookup (ui_ext->ui_definitions, shell_view_class->ui_manager_id);
	if (ui_def) {
		GError *error = NULL;

		ui_ext->current_ui_id = gtk_ui_manager_add_ui_from_string (ui_manager, ui_def, -1, &error);
		need_update = TRUE;

		if (error) {
			g_warning ("%s: Failed to add ui definition: %s", G_STRFUNC, error->message);
			g_error_free (error);
		}
	}

	if (need_update)
		gtk_ui_manager_ensure_update (ui_manager);
}
コード例 #2
0
ファイル: e-shell-searchbar.c プロジェクト: jdapena/evolution
static void
shell_searchbar_execute_search_cb (EShellView *shell_view,
                                   EShellSearchbar *searchbar)
{
	EShellContent *shell_content;

	shell_searchbar_update_search_widgets (searchbar);

	e_shell_searchbar_save_state (searchbar);

	if (!e_shell_view_is_active (shell_view))
		return;

	/* Direct the focus away from the search entry, so that a
	 * focus-in event is required before the text can be changed.
	 * This will reset the entry to the appropriate visual state. */
	if (gtk_widget_is_focus (searchbar->priv->search_entry)) {
		shell_content = e_shell_view_get_shell_content (shell_view);
		e_shell_content_focus_search_results (shell_content);
	}
}
コード例 #3
0
static void
action_gal_save_custom_view_cb (GtkAction *action,
                                EBookShellView *book_shell_view)
{
	EBookShellContent *book_shell_content;
	EShellView *shell_view;
	EAddressbookView *address_view;
	GalViewInstance *view_instance;

	/* All shell views respond to the activation of this action,
	 * which is defined by EShellWindow.  But only the currently
	 * active shell view proceeds with saving the custom view. */
	shell_view = E_SHELL_VIEW (book_shell_view);
	if (!e_shell_view_is_active (shell_view))
		return;

	book_shell_content = book_shell_view->priv->book_shell_content;
	address_view = e_book_shell_content_get_current_view (book_shell_content);
	view_instance = e_addressbook_view_get_view_instance (address_view);
	gal_view_instance_save_as (view_instance);
}
コード例 #4
0
ファイル: e-mail-shell-view.c プロジェクト: UIKit0/evolution
static void
mail_shell_view_toggled (EShellView *shell_view)
{
	EMailShellViewPrivate *priv;
	EShellWindow *shell_window;
	GtkUIManager *ui_manager;
	const gchar *basename;
	gboolean view_is_active;

	priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (shell_view);

	shell_window = e_shell_view_get_shell_window (shell_view);
	ui_manager = e_shell_window_get_ui_manager (shell_window);
	view_is_active = e_shell_view_is_active (shell_view);
	basename = E_MAIL_READER_UI_DEFINITION;

	if (view_is_active && priv->merge_id == 0) {
		EMailView *mail_view;

		priv->merge_id = e_load_ui_manager_definition (
			ui_manager, basename);
		mail_view = e_mail_shell_content_get_mail_view (
			priv->mail_shell_content);
		e_mail_reader_create_charset_menu (
			E_MAIL_READER (mail_view),
			ui_manager, priv->merge_id);
	} else if (!view_is_active && priv->merge_id != 0) {
		gtk_ui_manager_remove_ui (ui_manager, priv->merge_id);
		gtk_ui_manager_ensure_update (ui_manager);
		priv->merge_id = 0;
	}

	/* Chain up to parent's toggled() method. */
	E_SHELL_VIEW_CLASS (e_mail_shell_view_parent_class)->
		toggled (shell_view);
}
コード例 #5
0
void
e_mail_shell_view_update_send_receive_menus (EMailShellView *mail_shell_view)
{
	EMailShellViewPrivate *priv;
	EShellWindow *shell_window;
	EShellView *shell_view;
	GtkWidget *widget;
	const gchar *widget_path;

	g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view));

	priv = E_MAIL_SHELL_VIEW_GET_PRIVATE (mail_shell_view);

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

	if (!e_shell_view_is_active (shell_view)) {
		if (priv->send_receive_tool_item) {
			GtkWidget *toolbar;

			toolbar = e_shell_window_get_managed_widget (
				shell_window, "/main-toolbar");
			g_return_if_fail (toolbar != NULL);

			gtk_container_remove (
				GTK_CONTAINER (toolbar),
				GTK_WIDGET (priv->send_receive_tool_item));
			gtk_container_remove (
				GTK_CONTAINER (toolbar),
				GTK_WIDGET (priv->send_receive_tool_separator));

			priv->send_receive_tool_item = NULL;
			priv->send_receive_tool_separator = NULL;
		}

		return;
	}

	widget_path =
		"/main-menu/file-menu"
		"/mail-send-receiver/mail-send-receive-submenu";
	widget = e_shell_window_get_managed_widget (shell_window, widget_path);
	if (widget != NULL)
		gtk_menu_item_set_submenu (
			GTK_MENU_ITEM (widget),
			create_send_receive_submenu (mail_shell_view));

	if (!priv->send_receive_tool_item) {
		GtkWidget *toolbar;
		GtkToolItem *tool_item;
		gint index;

		toolbar = e_shell_window_get_managed_widget (
			shell_window, "/main-toolbar");
		g_return_if_fail (toolbar != NULL);

		widget_path =
			"/main-toolbar/toolbar-actions/mail-send-receiver";
		widget = e_shell_window_get_managed_widget (
			shell_window, widget_path);
		g_return_if_fail (widget != NULL);

		index = gtk_toolbar_get_item_index (
			GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (widget));

		tool_item = gtk_separator_tool_item_new ();
		gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, index);
		gtk_widget_show (GTK_WIDGET (tool_item));
		priv->send_receive_tool_separator = tool_item;

		tool_item = GTK_TOOL_ITEM (
			e_menu_tool_button_new (_("Send / Receive")));
		gtk_tool_item_set_is_important (tool_item, TRUE);
		gtk_toolbar_insert (GTK_TOOLBAR (toolbar), tool_item, index);
		gtk_widget_show (GTK_WIDGET (tool_item));
		priv->send_receive_tool_item = tool_item;

		e_binding_bind_property (
			ACTION (MAIL_SEND_RECEIVE), "sensitive",
			tool_item, "sensitive",
			G_BINDING_SYNC_CREATE);
	}

	if (priv->send_receive_tool_item)
		gtk_menu_tool_button_set_menu (
			GTK_MENU_TOOL_BUTTON (priv->send_receive_tool_item),
			create_send_receive_submenu (mail_shell_view));
}