Make Capplet work again with new CamelSettings and other stuffs. Also add

EPlugin support to capplet so that exchange and other accoutns can be
configured via this. now.
This commit is contained in:
Srinivasa Ragavan
2012-02-16 10:57:40 +00:00
parent b8cfd5f9a4
commit 02cbfd837a
12 changed files with 2034 additions and 46 deletions

View File

@ -24,6 +24,7 @@ evolution_settings_CPPFLAGS = \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DEVOLUTION_ICONSDIR=\""$(imagesdir)"\" \
-DEVOLUTION_IMAGES=\""$(imagesdir)"\" \
-DEVOLUTION_MODULEDIR=\""$(moduledir)"\" \
-DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
-DEVOLUTION_BUTTONSDIR=\""$(buttonsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \

View File

@ -39,6 +39,11 @@
#include <libemail-utils/mail-mt.h>
#include "settings/mail-capplet-shell.h"
#include <libedataserver/e-categories.h>
#include "e-util/e-plugin.h"
#include "e-util/e-plugin-ui.h"
#include "shell/es-event.h"
#include "shell/e-shell-meego.h"
#include "e-util/e-import.h"
#ifdef G_OS_WIN32
#define WIN32_LEAN_AND_MEAN
@ -91,12 +96,47 @@ categories_icon_theme_hack (void)
g_free (dirname);
}
static void
static EShell *
create_default_shell (void)
{
EShell *shell;
const gchar *key;
gboolean is_meego = FALSE, small_screen = FALSE;
gboolean express_mode = TRUE;
GSettings *settings;
GError *error = NULL;
GApplicationFlags flags;
settings = g_settings_new ("org.gnome.evolution.shell");
main_window = mail_capplet_shell_new (socket_id, FALSE, TRUE);
if (!socket_id)
gtk_widget_show (main_window);
if (!express_mode)
express_mode = g_settings_get_boolean (settings, "express-mode");
if (express_mode)
e_shell_detect_meego (&is_meego, &small_screen);
flags = G_APPLICATION_HANDLES_OPEN |
G_APPLICATION_HANDLES_COMMAND_LINE;
shell = g_initable_new (
E_TYPE_SHELL, NULL, &error,
"application-id", "org.gnome.EvolutionSettings",
"flags", flags,
"geometry", "",
"module-directory", EVOLUTION_MODULEDIR,
"meego-mode", is_meego,
"express-mode", express_mode,
"small-screen-mode", small_screen,
"online", TRUE,
NULL);
g_object_unref (settings);
return shell;
}
gint
@ -104,6 +144,7 @@ main (gint argc,
gchar *argv[])
{
GError *error = NULL;
EShell *shell;
#ifdef G_OS_WIN32
/* Reduce risks */
@ -170,7 +211,17 @@ main (gint argc,
e_passwords_init ();
categories_icon_theme_hack ();
create_default_shell ();
shell = create_default_shell ();
e_shell_load_modules (shell);
/* Register built-in plugin hook types. */
es_event_hook_get_type ();
e_import_hook_get_type ();
e_plugin_ui_hook_get_type ();
/* All EPlugin and EPluginHook subclasses should be
* registered in GType now, so load plugins now. */
e_plugin_load_plugins ();
gtk_main ();

View File

@ -0,0 +1,229 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
* Srinivasa Ragavan <sragavan@novell.com>
*
* Copyright (C) 2009 Intel Corporation (www.intel.com)
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <locale.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <libedataserverui/e-passwords.h>
#include <libemail-utils/mail-mt.h>
#include "settings/mail-capplet-shell.h"
#include <libedataserver/e-categories.h>
#include "e-util/e-plugin.h"
#include "e-util/e-plugin-ui.h"
#include "shell/es-event.h"
#include "shell/e-shell-meego.h"
#include "e-util/e-import.h"
#ifdef G_OS_WIN32
#define WIN32_LEAN_AND_MEAN
#ifdef DATADIR
#undef DATADIR
#endif
#define _WIN32_WINNT 0x0601
#include <windows.h>
#include <conio.h>
#include <io.h>
#ifndef PROCESS_DEP_ENABLE
#define PROCESS_DEP_ENABLE 0x00000001
#endif
#ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
#endif
#endif
guint32 socket_id = 0;
GtkWidget *main_window;
static gchar **remaining_args;
static void
categories_icon_theme_hack (void)
{
GtkIconTheme *icon_theme;
const gchar *category_name;
const gchar *filename;
gchar *dirname;
/* XXX Allow the category icons to be referenced as named
* icons, since GtkAction does not support GdkPixbufs. */
/* Get the icon file for some default category. Doesn't matter
* which, so long as it has an icon. We're just interested in
* the directory components. */
category_name = _("Birthday");
filename = e_categories_get_icon_file_for (category_name);
g_return_if_fail (filename != NULL && *filename != '\0');
/* Extract the directory components. */
dirname = g_path_get_dirname (filename);
/* Add it to the icon theme's search path. This relies on
* GtkIconTheme's legacy feature of using image files found
* directly in the search path. */
icon_theme = gtk_icon_theme_get_default ();
gtk_icon_theme_append_search_path (icon_theme, dirname);
g_free (dirname);
}
static EShell *
create_default_shell (void)
{
EShell *shell;
GConfClient *client;
const gchar *key;
gboolean is_meego = FALSE, small_screen = FALSE;
gboolean express_mode = TRUE;
client = gconf_client_get_default ();
main_window = mail_capplet_shell_new (socket_id, FALSE, TRUE);
if (!socket_id)
gtk_widget_show (main_window);
/* Determine whether to run Evolution in "express" mode. */
key = "/apps/evolution/shell/express_mode";
if (!express_mode)
express_mode = gconf_client_get_bool (client, key, NULL);
if (express_mode)
e_shell_detect_meego (&is_meego, &small_screen);
flags = G_APPLICATION_HANDLES_OPEN |
G_APPLICATION_HANDLES_COMMAND_LINE;
shell = g_initable_new (
E_TYPE_SHELL, NULL, &error,
"application-id", "org.gnome.EvolutionSettings",
"flags", flags,
"geometry", "",
"module-directory", EVOLUTION_MODULEDIR,
"meego-mode", is_meego,
"express-mode", express_mode,
"small-screen-mode", small_screen,
"online", TRUE,
NULL);
g_object_unref (client);
return shell;
}
gint
main (gint argc,
gchar *argv[])
{
GError *error = NULL;
EShell *shell;
#ifdef G_OS_WIN32
/* Reduce risks */
{
typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName);
t_SetDllDirectoryA p_SetDllDirectoryA;
p_SetDllDirectoryA = GetProcAddress (GetModuleHandle ("kernel32.dll"), "SetDllDirectoryA");
if (p_SetDllDirectoryA)
(*p_SetDllDirectoryA) ("");
}
#ifndef _WIN64
{
typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags);
t_SetProcessDEPPolicy p_SetProcessDEPPolicy;
p_SetProcessDEPPolicy = GetProcAddress (GetModuleHandle ("kernel32.dll"), "SetProcessDEPPolicy");
if (p_SetProcessDEPPolicy)
(*p_SetProcessDEPPolicy) (PROCESS_DEP_ENABLE | PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION);
}
#endif
if (fileno (stdout) != -1 && _get_osfhandle (fileno (stdout)) != -1) {
/* stdout is fine, presumably redirected to a file or pipe */
} else {
typedef BOOL (* WINAPI AttachConsole_t) (DWORD);
AttachConsole_t p_AttachConsole =
(AttachConsole_t) GetProcAddress (GetModuleHandle ("kernel32.dll"), "AttachConsole");
if (p_AttachConsole && p_AttachConsole (ATTACH_PARENT_PROCESS)) {
freopen ("CONOUT$", "w", stdout);
dup2 (fileno (stdout), 1);
freopen ("CONOUT$", "w", stderr);
dup2 (fileno (stderr), 2);
}
}
#endif
static GOptionEntry entries[] = {
{ "socket",
's',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_INT,
&socket_id,
/* TRANSLATORS: don't translate the terms in brackets */
N_("ID of the socket to embed in"),
N_("socket") },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining_args, NULL, NULL },
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif
setlocale (LC_ALL, NULL);
if (!gtk_init_with_args (&argc, &argv, NULL, entries, NULL, &error))
g_error ("%s", error->message);
e_passwords_init ();
categories_icon_theme_hack ();
shell = create_default_shell ();
e_shell_load_modules (shell);
/* Register built-in plugin hook types. */
es_event_hook_get_type ();
e_import_hook_get_type ();
e_plugin_ui_hook_get_type ();
/* All EPlugin and EPluginHook subclasses should be
* registered in GType now, so load plugins now. */
e_plugin_load_plugins ();
gtk_main ();
return 0;
}

View File

@ -0,0 +1,11 @@
--- capplet/anjal-settings-main.c
+++ capplet/anjal-settings-main.c
@@ -104,8 +104,6 @@
gboolean is_meego = FALSE, small_screen = FALSE;
gboolean express_mode = TRUE;
GSettings *settings;
- GError *error = NULL;
- GApplicationFlags flags;
settings = g_settings_new ("org.gnome.evolution.shell");

Binary file not shown.

View File

@ -0,0 +1,65 @@
privsolib_LTLIBRARIES = libevolution-mail-settings.la
libevolution_mail_settings_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
-I$(top_srcdir)/widgets \
-I$(top_srcdir)/widgets/misc \
-I$(top_srcdir) \
-I$(top_srcdir)/e-util \
-I$(top_srcdir)/em-format \
-I$(top_srcdir)/mail \
-I$(top_srcdir)/composer \
-I$(top_builddir)/composer \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
-I$(top_srcdir)/smime/lib \
-I$(top_srcdir)/smime/gui \
$(EVOLUTION_DATA_SERVER_CFLAGS) \
$(GNOME_PLATFORM_CFLAGS) \
$(CERT_UI_CFLAGS) \
$(CANBERRA_CFLAGS) \
$(GTKHTML_CFLAGS) \
-DANJAL_SETTINGS \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DEVOLUTION_ICONSDIR=\""$(imagesdir)"\" \
-DEVOLUTION_MODULEDIR=\""$(moduledir)"\" \
-DEVOLUTION_IMAGES=\""$(imagesdir)"\" \
-DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
-DEVOLUTION_BUTTONSDIR=\""$(buttonsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
-DEVOLUTION_UIDIR=\""$(uidir)"\" \
-DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\" \
-DPREFIX=\""$(prefix)"\" \
-DG_LOG_DOMAIN=\"evolution-mail\" \
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-DPACKAGE_DATA_DIR=\""$(datadir)"\"
libevolution_mail_settings_la_SOURCES = \
mail-settings-view.c \
mail-settings-view.h \
mail-account-view.c \
mail-account-view.h \
mail-view.c \
mail-view.h \
mail-capplet-shell.c \
mail-capplet-shell.h \
anjal-mail-view.h \
anjal-mail-view.c
libevolution_mail_settings_la_LIBADD = \
$(EVOLUTION_DATA_SERVER_LIBS) \
$(GNOME_PLATFORM_LIBS) \
$(CERT_UI_LIBS) \
$(CANBERRA_LIBS) \
$(GTKHTML_LIBS) \
$(SMIME_LIBS) \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
$(top_builddir)/filter/libfilter.la \
$(top_builddir)/mail/libevolution-mail.la \
$(top_builddir)/shell/libeshell.la \
$(top_builddir)/e-util/libeutil.la
libevolution_mail_settings_la_LDFLAGS = $(NO_UNDEFINED)

View File

@ -51,6 +51,7 @@ struct _MailAccountViewPrivate {
gboolean do_calendar;
gchar *username;
GList *providers;
GtkWidget *yahoo_cal_entry;
};
@ -96,6 +97,7 @@ mail_account_view_finalize (GObject *object)
MailAccountView *shell = (MailAccountView *) object;
g_free (shell->priv->username);
g_list_free (shell->priv->providers);
G_OBJECT_CLASS (mail_account_view_parent_class)->finalize (object);
}
@ -470,14 +472,38 @@ static GtkWidget *
create_review (MailAccountView *view)
{
GtkWidget *table, *box, *label, *entry;
gchar *uri;
gchar *enc;
CamelURL *url;
gchar *buff;
CamelNetworkSettings *source_settings = NULL;
CamelNetworkSettings *transport_settings = NULL;
const gchar *encryption;
const gchar *protocol;
gchar *host = NULL;
gchar *user = NULL;
CamelNetworkSecurityMethod method;
EMConfigTargetSettings *target;
uri = (gchar *) e_account_get_string (em_account_editor_get_modified_account (view->edit), E_ACCOUNT_SOURCE_URL);
if (!uri || (url = camel_url_new (uri, NULL)) == NULL)
return NULL;
target = ((EConfig *)view->edit->config)->target;
g_object_get (view->edit, "store-settings", &source_settings, NULL);
g_object_get (view->edit, "transport-settings", &transport_settings, NULL);
protocol = target->storage_protocol;
g_object_get (
source_settings,
"host", &host, "user", &user,
"security-method", &method, NULL);
switch (method) {
case CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT:
encryption = _("Always (SSL)");
break;
case CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT:
encryption = _("When possible (TLS)");
break;
default:
encryption = _("Never");
break;
}
table = gtk_table_new (4,2, FALSE);
gtk_table_set_row_spacings ((GtkTable *) table, 4);
@ -528,7 +554,7 @@ create_review (MailAccountView *view)
gtk_widget_show (label);
PACK_BOX (label);
gtk_table_attach ((GtkTable *) table, box, 0, 1, 4, 5, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
entry = gtk_label_new (url->protocol);
entry = gtk_label_new (protocol);
gtk_widget_show (entry);
PACK_BOX (entry)
gtk_table_attach ((GtkTable *) table, box, 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
@ -537,7 +563,7 @@ create_review (MailAccountView *view)
gtk_widget_show (label);
PACK_BOX (label);
gtk_table_attach ((GtkTable *) table, box, 0, 1, 5, 6, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
entry = gtk_label_new (url->host);
entry = gtk_label_new (host);
gtk_widget_show (entry);
PACK_BOX (entry);
gtk_table_attach ((GtkTable *) table, box, 1, 2, 5, 6, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
@ -546,7 +572,7 @@ create_review (MailAccountView *view)
gtk_widget_show (label);
PACK_BOX (label);
gtk_table_attach ((GtkTable *) table, box, 0, 1, 6, 7, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
entry = gtk_label_new (url->user);
entry = gtk_label_new (user);
gtk_widget_show (entry);
PACK_BOX (entry);
gtk_table_attach ((GtkTable *) table, box, 1, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
@ -555,18 +581,34 @@ create_review (MailAccountView *view)
gtk_widget_show (label);
PACK_BOX (label);
gtk_table_attach ((GtkTable *) table, box, 0, 1, 7, 8, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
enc = (gchar *)camel_url_get_param(url, "security-method");
entry = gtk_label_new (enc ? enc : _("never"));
entry = gtk_label_new (encryption);
gtk_widget_show (entry);
PACK_BOX (entry);
gtk_table_attach ((GtkTable *) table, box, 1, 2, 7, 8, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
view->priv->username = g_strdup (url->user);
camel_url_free (url);
uri =(gchar *) e_account_get_string (em_account_editor_get_modified_account (view->edit), E_ACCOUNT_TRANSPORT_URL);
if (!uri || (url = camel_url_new (uri, NULL)) == NULL)
return NULL;
view->priv->username = g_strdup (user);
g_free (host);
g_free (user);
g_object_get (
transport_settings,
"host", &host, "user", &user,
"security-method", &method, NULL);
protocol = target->transport_protocol;
switch (method) {
case CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT:
encryption = _("Always (SSL)");
break;
case CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT:
encryption = _("When possible (TLS)");
break;
default:
encryption = _("Never");
break;
}
label = gtk_label_new (NULL);
buff = g_markup_printf_escaped ("<span size=\"large\" weight=\"bold\">%s</span>", _("Sending"));
gtk_label_set_markup ((GtkLabel *) label, buff);
@ -575,23 +617,22 @@ create_review (MailAccountView *view)
PACK_BOXF (label);
gtk_table_attach ((GtkTable *) table, box, 2, 3, 3, 4, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
entry = gtk_label_new (url->protocol);
entry = gtk_label_new (protocol);
gtk_widget_show (entry);
PACK_BOX (entry)
gtk_table_attach ((GtkTable *) table, box, 2, 3, 4, 5, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
entry = gtk_label_new (url->host);
entry = gtk_label_new (host);
gtk_widget_show (entry);
PACK_BOX (entry);
gtk_table_attach ((GtkTable *) table, box, 2, 3, 5, 6, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
entry = gtk_label_new (url->user);
entry = gtk_label_new (user);
gtk_widget_show (entry);
PACK_BOX (entry);
gtk_table_attach ((GtkTable *) table, box, 2, 3, 6, 7, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
enc = (gchar *)camel_url_get_param(url, "security-method");
entry = gtk_label_new (enc ? enc : _("never"));
entry = gtk_label_new (encryption);
gtk_widget_show (entry);
PACK_BOX (entry);
gtk_table_attach ((GtkTable *) table, box, 2, 3, 7, 8, GTK_EXPAND | GTK_FILL, GTK_SHRINK, INDENTATION, 0);
@ -606,6 +647,8 @@ create_review (MailAccountView *view)
*/
gtk_widget_show (table);
g_free (host);
g_free (user);
return table;
}
@ -643,6 +686,44 @@ struct _page_text {
{ MAV_REVIEW_PAGE, N_("Review account"), N_("Finish"), N_("Back - Sending"), N_("Finish"), N_("Back - Sending"), REVIEW_DETAIL, NULL, create_review, NULL, NULL},
};
static gboolean
mav_check_same_source_transport (MailAccountView *mav)
{
EAccount *account = em_account_editor_get_modified_account(mav->edit);
const gchar *uri;
gchar *current = NULL;
gboolean ret = FALSE;
uri = e_account_get_string (account, E_ACCOUNT_SOURCE_URL);
if (uri) {
const gchar *colon = strchr (uri, ':');
gint len;
if (colon) {
len = colon-uri;
current = g_alloca (len+1);
memcpy (current, uri, len);
current[len] = 0;
}
}
if (current) {
GList *l;
for (l=mav->priv->providers; l; l=l->next) {
CamelProvider *provider = l->data;
if (strcmp (provider->protocol, current) == 0 &&
CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider)) {
ret = TRUE;
break;
}
}
}
return ret;
}
static void
mav_next_pressed (GtkButton *button,
MailAccountView *mav)
@ -709,8 +790,12 @@ mav_next_pressed (GtkButton *button,
gtk_widget_hide (mav->pages[mav->current_page]->box);
mav->current_page++;
if (mav->current_page == MAV_RECV_OPT_PAGE && mav->original == NULL)
mav->current_page++; /* Skip recv options in new account creation. */
if (mav->current_page == MAV_SEND_PAGE && mav_check_same_source_transport (mav)) {
mav->current_page++; /* Skip send page if the provider does both source and transport*/
}
if (mav->current_page == MAV_DEFAULTS_PAGE && mav->original == NULL)
mav->current_page++; /* Skip defaults in new account creation. */
@ -718,7 +803,12 @@ mav_next_pressed (GtkButton *button,
MAVPage *page = mav->pages[mav->current_page];
GtkWidget *tmp;
EAccount *account = em_account_editor_get_modified_account (mav->edit);
CamelNetworkSettings *settings = NULL;
const gchar *host = NULL;
g_object_get (mav->edit, "store-settings", &settings, NULL);
host = camel_network_settings_get_host (settings);
if (page->main)
gtk_widget_destroy (page->main);
@ -757,8 +847,8 @@ mav_next_pressed (GtkButton *button,
}
}
if (mav->original == NULL && (g_strrstr(account->source->url, "gmail") ||
g_strrstr(account->source->url, "googlemail"))) {
if (mav->original == NULL && (g_strrstr(host, "gmail") ||
g_strrstr(host, "googlemail"))) {
/* Google accounts*/
gchar *buff;
mav->priv->is_gmail = TRUE;
@ -794,9 +884,9 @@ mav_next_pressed (GtkButton *button,
PACK_IN_BOX (page->box,mav->priv->gmail_info_label,mav->priv->gmail_link, 24, 0);
#undef PACK_IN_BOX
} else if (mav->original == NULL &&
(g_strrstr(account->source->url, "yahoo.") ||
g_strrstr(account->source->url, "ymail.") ||
g_strrstr(account->source->url, "rocketmail."))) {
(g_strrstr(host, "yahoo.") ||
g_strrstr(host, "ymail.") ||
g_strrstr(host, "rocketmail."))) {
/* Yahoo accounts*/
gchar *cal_name;
gchar *buff;
@ -864,10 +954,14 @@ mav_prev_pressed (GtkButton *button,
gtk_widget_hide (mav->pages[mav->current_page]->box);
mav->current_page--;
if (mav->current_page == MAV_RECV_OPT_PAGE && mav->original == NULL)
mav->current_page--; /* Skip recv options in new account creation. */
if (mav->current_page == MAV_DEFAULTS_PAGE && mav->original == NULL)
mav->current_page--; /* Skip defaults in new account creation. */
if (mav->current_page == MAV_SEND_PAGE && mav_check_same_source_transport (mav)) {
mav->current_page--; /* Skip send page if the provider does both source and transport*/
}
if (mav->current_page == MAV_RECV_OPT_PAGE && mav->original == NULL)
mav->current_page--; /* Skip recv options in new account creation. */
gtk_widget_show (mav->pages[mav->current_page]->box);
}
@ -1010,6 +1104,8 @@ mail_account_view_construct (MailAccountView *view,
em_account_editor_check (view->edit, mail_account_pages[0].path);
view->pages[0]->done = TRUE;
view->priv->providers = camel_provider_list (TRUE);
shell = e_shell_get_default ();
if (!shell || e_shell_get_express_mode (shell)) {
GtkWidget *table = em_account_editor_get_widget (view->edit, "identity-required-table");

File diff suppressed because it is too large Load Diff

View File

@ -174,10 +174,8 @@ mail_capplet_shell_quit (MailCappletShell *shell)
{
MailCappletShellPrivate *priv = shell->priv;
if (priv->main_loop)
gtk_main_quit ();
else
gtk_widget_destroy ((GtkWidget *) shell);
if (!priv->main_loop)
gtk_widget_hide ((GtkWidget *)shell);
}
static void
@ -186,13 +184,15 @@ ms_delete_event (MailCappletShell *shell,
gpointer data G_GNUC_UNUSED)
{
mail_capplet_shell_quit (shell);
gtk_main_quit();
}
static void
ms_show_post_druid (MailViewChild *mfv G_GNUC_UNUSED,
MailCappletShell *shell)
{
gtk_widget_destroy (GTK_WIDGET (shell));
gtk_main_quit ();
g_timeout_add_seconds (5, (GSourceFunc) gtk_widget_destroy, shell);
}
#define PACK_IN_TOOL(wid,icon) { GtkWidget *tbox; tbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start ((GtkBox *)tbox, gtk_image_new_from_icon_name(icon, GTK_ICON_SIZE_BUTTON), FALSE, FALSE, 0); wid = (GtkWidget *)gtk_tool_button_new (tbox, NULL); }
@ -250,7 +250,7 @@ mail_capplet_shell_construct (MailCappletShell *shell,
eshell = g_initable_new (
E_TYPE_SHELL, NULL, &error,
"application-id", "org.gnome.Evolution",
"flags", 0,
"flags", G_APPLICATION_HANDLES_OPEN | G_APPLICATION_HANDLES_COMMAND_LINE,
"geometry", NULL,
"module-directory", EVOLUTION_MODULEDIR,
"meego-mode", FALSE,

View File

@ -0,0 +1,395 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
* Srinivasa Ragavan <sragavan@gnome.org>
* Srinivasa Ragavan <srini@linux.intel.com>
*
* Copyright (C) 2010 Intel Corporation. (www.intel.com)
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtkx.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include "mail-capplet-shell.h"
#include "mail-view.h"
#include <gdk/gdkkeysyms.h>
#include <e-util/e-util.h>
#include <mail/em-utils.h>
#include <mail/em-composer-utils.h>
#include <libemail-engine/mail-config.h>
#include <libemail-utils/mail-mt.h>
#include <shell/e-shell.h>
enum {
CTRL_W_PRESSED,
CTRL_Q_PRESSED,
LAST_SIGNAL
};
/* Re usable colors */
GdkColor *pcolor_sel;
gchar *scolor_sel;
GdkColor *pcolor_fg_sel;
gchar *scolor_fg_sel;
GdkColor *pcolor_bg_norm;
gchar *scolor_bg_norm;
GdkColor *pcolor_norm;
gchar *scolor_norm;
GdkColor *pcolor_fg_norm;
gchar *scolor_fg_norm;
static guint mail_capplet_shell_signals[LAST_SIGNAL];
struct _MailCappletShellPrivate {
EMailBackend *backend;
GtkWidget *box;
GtkWidget * top_bar;
GtkWidget *message_pane;
GtkWidget *bottom_bar;
/* Top Bar */
GtkWidget *action_bar;
GtkWidget *quit;
gboolean main_loop;
MailViewChild *settings_view;
};
static void mail_capplet_shell_quit (MailCappletShell *shell);
G_DEFINE_TYPE (MailCappletShell, mail_capplet_shell, GTK_TYPE_WINDOW)
static void setup_abooks (void);
static void
mail_capplet_shell_init (MailCappletShell *shell)
{
shell->priv = g_new0 (MailCappletShellPrivate, 1);
shell->priv->settings_view = NULL;
}
static void
mail_capplet_shell_finalize (GObject *object)
{
G_OBJECT_CLASS (mail_capplet_shell_parent_class)->finalize (object);
}
static void
ms_ctrl_w_pressed (MailCappletShell *shell)
{
mail_view_close_view ((MailView *) shell->view);
}
static void
ms_ctrl_q_pressed (MailCappletShell *shell)
{
mail_capplet_shell_quit (shell);
}
static void
mail_capplet_shell_class_init (MailCappletShellClass *klass)
{
GObjectClass * object_class = G_OBJECT_CLASS (klass);
GtkBindingSet *binding_set;
mail_capplet_shell_parent_class = g_type_class_peek_parent (klass);
object_class->finalize = mail_capplet_shell_finalize;
klass->ctrl_w_pressed = ms_ctrl_w_pressed;
klass->ctrl_q_pressed = ms_ctrl_q_pressed;
mail_capplet_shell_signals[CTRL_W_PRESSED] =
g_signal_new ("ctrl_w_pressed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (MailCappletShellClass, ctrl_w_pressed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
mail_capplet_shell_signals[CTRL_Q_PRESSED] =
g_signal_new ("ctrl_q_pressed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (MailCappletShellClass, ctrl_q_pressed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
binding_set = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_W, GDK_CONTROL_MASK, "ctrl_w_pressed", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_w, GDK_CONTROL_MASK, "ctrl_w_pressed", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Q, GDK_CONTROL_MASK, "ctrl_q_pressed", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Q, GDK_CONTROL_MASK, "ctrl_q_pressed", 0);
};
static void
ms_init_style (GtkStyle *style)
{
pcolor_sel = &style->base[GTK_STATE_SELECTED];
scolor_sel = gdk_color_to_string (pcolor_sel);
pcolor_norm = &style->bg[GTK_STATE_NORMAL];
scolor_norm = gdk_color_to_string (pcolor_norm);
pcolor_bg_norm = &style->base[GTK_STATE_NORMAL];
scolor_bg_norm = gdk_color_to_string (pcolor_bg_norm);
pcolor_fg_sel =&style->fg[GTK_STATE_SELECTED];
scolor_fg_sel = gdk_color_to_string (pcolor_fg_sel);
pcolor_fg_norm =&style->fg[GTK_STATE_NORMAL];
scolor_fg_norm = gdk_color_to_string (pcolor_fg_norm);
}
static void
mail_capplet_shell_quit (MailCappletShell *shell)
{
MailCappletShellPrivate *priv = shell->priv;
if (priv->main_loop)
gtk_main_quit ();
else
gtk_widget_destroy ((GtkWidget *) shell);
}
static void
ms_delete_event (MailCappletShell *shell,
GdkEvent *event G_GNUC_UNUSED,
gpointer data G_GNUC_UNUSED)
{
mail_capplet_shell_quit (shell);
}
static void
ms_show_post_druid (MailViewChild *mfv G_GNUC_UNUSED,
MailCappletShell *shell)
{
gtk_widget_destroy (GTK_WIDGET (shell));
}
#define PACK_IN_TOOL(wid,icon) { GtkWidget *tbox; tbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start ((GtkBox *)tbox, gtk_image_new_from_icon_name(icon, GTK_ICON_SIZE_BUTTON), FALSE, FALSE, 0); wid = (GtkWidget *)gtk_tool_button_new (tbox, NULL); }
static void
mail_capplet_shell_construct (MailCappletShell *shell,
gint socket_id,
gboolean just_druid,
gboolean main_loop)
{
MailCappletShellPrivate *priv = shell->priv;
GtkStyle *style = gtk_widget_get_default_style ();
EShell *eshell;
EMailSession *session;
gtk_window_set_icon_name ((GtkWindow *)shell, "evolution");
gtk_window_set_title ((GtkWindow *)shell, _("Evolution account assistant"));
ms_init_style (style);
g_signal_connect ((GObject *)shell, "delete-event", G_CALLBACK (ms_delete_event), NULL);
gtk_window_set_type_hint ((GtkWindow *) shell, GDK_WINDOW_TYPE_HINT_NORMAL);
if (g_getenv("ANJAL_NO_MAX") == NULL && FALSE) {
GdkScreen *scr = gtk_widget_get_screen ((GtkWidget *) shell);
gtk_window_set_default_size ((GtkWindow *) shell, gdk_screen_get_width (scr), gdk_screen_get_height (scr));
gtk_window_set_decorated ((GtkWindow *) shell, FALSE);
} else {
gtk_window_set_default_size ((GtkWindow *) shell, 1024, 500);
}
priv->main_loop = main_loop;
priv->box = (GtkWidget *) gtk_vbox_new (FALSE, 0);
gtk_widget_show ((GtkWidget *) priv->box);
if (!socket_id) {
gtk_container_add ((GtkContainer *) shell, priv->box);
} else {
GtkWidget *plug = gtk_plug_new (socket_id);
gtk_container_add ((GtkContainer *) plug, priv->box);
g_signal_connect (plug, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show (plug);
gtk_widget_hide ((GtkWidget *) shell);
}
if (camel_init (e_get_user_data_dir (), TRUE) != 0)
exit (0);
camel_provider_init ();
eshell = e_shell_get_default ();
if (eshell == NULL) {
GError *error = NULL;
eshell = g_initable_new (
E_TYPE_SHELL, NULL, &error,
"application-id", "org.gnome.Evolution",
"flags", 0,
"geometry", NULL,
"module-directory", EVOLUTION_MODULEDIR,
"meego-mode", FALSE,
"express-mode", FALSE,
"small-screen-mode", FALSE,
"online", FALSE,
NULL);
if (error != NULL)
g_error ("%s", error->message);
e_shell_load_modules (eshell);
}
shell->priv->backend = E_MAIL_BACKEND (e_shell_get_backend_by_name (eshell, "mail"));
session = e_mail_backend_get_session (shell->priv->backend);
shell->view = mail_view_new ();
shell->view->backend = shell->priv->backend;
gtk_widget_show ((GtkWidget *) shell->view);
gtk_box_pack_end ((GtkBox *) priv->box, (GtkWidget *) shell->view, TRUE, TRUE, 2);
mail_config_init (session);
mail_msg_init ();
if (just_druid) {
MailViewChild *mc;
gtk_notebook_set_show_tabs ((GtkNotebook *) shell->view, FALSE);
mc = mail_view_add_page ((MailView *) shell->view, MAIL_VIEW_ACCOUNT, NULL);
g_signal_connect (mc, "view-close", G_CALLBACK(ms_show_post_druid), shell);
setup_abooks ();
} else
shell->priv->settings_view = mail_view_add_page ((MailView *) shell->view, MAIL_VIEW_SETTINGS, NULL);
}
GtkWidget *
mail_capplet_shell_new (gint socket_id,
gboolean just_druid,
gboolean main_loop)
{
MailCappletShell *shell = g_object_new (MAIL_CAPPLET_SHELL_TYPE, NULL);
mail_capplet_shell_construct (shell, socket_id, just_druid, main_loop);
return GTK_WIDGET (shell);
}
#define LOCAL_BASE_URI "local:"
#define PERSONAL_RELATIVE_URI "system"
static void
setup_abooks (void)
{
GSList *groups;
ESourceGroup *group;
ESourceList *list = NULL;
ESourceGroup *on_this_computer = NULL;
ESource *personal_source = NULL;
GError *error = NULL;
e_book_client_get_sources (&list, &error);
if (error != NULL) {
g_warning (
"%s: Unable to get books: %s",
G_STRFUNC, error->message);
g_error_free (error);
return;
}
groups = e_source_list_peek_groups (list);
if (groups) {
/* groups are already there, we need to search for things... */
GSList *g;
gchar *base_dir, *base_uri;
base_dir = g_build_filename (
e_get_user_data_dir (), "addressbook", "local", NULL);
base_uri = g_filename_to_uri (base_dir, NULL, NULL);
for (g = groups; g; g = g->next) {
group = E_SOURCE_GROUP (g->data);
if (strcmp (base_uri, e_source_group_peek_base_uri (group)) == 0)
e_source_group_set_base_uri (group, LOCAL_BASE_URI);
if (!on_this_computer && !strcmp (LOCAL_BASE_URI, e_source_group_peek_base_uri (group))) {
on_this_computer = g_object_ref (group);
break;
}
}
g_free (base_dir);
g_free (base_uri);
}
if (on_this_computer) {
/* make sure "Personal" shows up as a source under
* this group */
GSList *sources = e_source_group_peek_sources (on_this_computer);
GSList *s;
for (s = sources; s; s = s->next) {
ESource *source = E_SOURCE (s->data);
const gchar *relative_uri;
relative_uri = e_source_peek_relative_uri (source);
if (relative_uri == NULL)
continue;
if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
personal_source = g_object_ref (source);
break;
}
}
}
else {
/* create the local source group */
group = e_source_group_new (_("On This Computer"), LOCAL_BASE_URI);
e_source_list_add_group (list, group, -1);
on_this_computer = group;
}
if (!personal_source) {
/* Create the default Person addressbook */
ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
e_source_group_add_source (on_this_computer, source, -1);
e_source_set_property (source, "completion", "true");
personal_source = source;
}
if (on_this_computer)
g_object_unref (on_this_computer);
if (personal_source)
g_object_unref (personal_source);
e_source_list_sync (list, NULL);
g_object_unref (list);
}

View File

@ -3043,7 +3043,10 @@ emae_identity_page (EConfig *ec,
w = e_builder_get_widget (builder, item->label);
if (emae->type == EMAE_PAGES) {
GtkWidget *page = emae_create_basic_assistant_page (emae, GTK_ASSISTANT (parent), "identity_page", position);
gtk_box_pack_start ((GtkBox *) emae->pages[0], w, TRUE, TRUE, 0);
w = page;
} else if (((EConfig *) priv->config)->type == E_CONFIG_ASSISTANT) {
GtkWidget *page;
@ -3102,7 +3105,21 @@ emae_receive_page (EConfig *ec,
w = e_builder_get_widget (builder, item->label);
if (emae->type == EMAE_PAGES) {
gtk_box_pack_start ((GtkBox *) emae->pages[1], w, TRUE, TRUE, 0);
GtkWidget *page = emae_create_basic_assistant_page (emae, GTK_ASSISTANT (parent), "source_page", position);
GtkWidget *vbox, *child;
child = (GtkWidget *)g_object_get_data ((GObject *)emae->pages[1], "old-child");
if (child)
gtk_container_remove ((GtkContainer *)emae->pages[1], child);
vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_widget_show (vbox);
gtk_box_pack_start ((GtkBox *)vbox, w, TRUE, TRUE, 0);
g_object_set_data ((GObject *)emae->pages[1], "old-child", vbox);
gtk_box_pack_start ((GtkBox *)emae->pages[1], vbox, TRUE, TRUE, 0);
w = page;
} else if (((EConfig *) priv->config)->type == E_CONFIG_ASSISTANT) {
GtkWidget *page;
@ -3706,7 +3723,22 @@ emae_send_page (EConfig *ec,
w = e_builder_get_widget (builder, item->label);
if (emae->type == EMAE_PAGES) {
gtk_box_pack_start ((GtkBox *) emae->pages[3], w, TRUE, TRUE, 0);
GtkWidget *page = emae_create_basic_assistant_page (emae, GTK_ASSISTANT (parent), "transport_page", position);
GtkWidget *vbox, *child;
child = (GtkWidget *)g_object_get_data ((GObject *)emae->pages[3], "old-child");
if (child)
gtk_container_remove ((GtkContainer *)emae->pages[3], child);
vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
gtk_widget_show (vbox);
gtk_box_pack_start ((GtkBox *)vbox, w, TRUE, TRUE, 0);
g_object_set_data ((GObject *)emae->pages[3], "old-child", vbox);
gtk_box_pack_start ((GtkBox *)emae->pages[3], vbox, TRUE, TRUE, 0);
w = page;
} else if (((EConfig *) priv->config)->type == E_CONFIG_ASSISTANT) {
GtkWidget *page;

View File

@ -521,9 +521,9 @@ startup_wizard_new_capplet (EStartupWizard *extension)
capplet = mail_capplet_shell_new (0, TRUE, TRUE);
g_signal_connect (
/* g_signal_connect (
capplet, "destroy",
G_CALLBACK (gtk_main_quit), NULL);
G_CALLBACK (gtk_main_quit), NULL); */
return capplet;
}
@ -553,16 +553,20 @@ startup_wizard_run (EStartupWizard *extension)
if (express_mode)
window = startup_wizard_new_capplet (extension);
else
else {
window = startup_wizard_new_assistant (extension);
g_signal_connect (
window, "delete-event",
G_CALLBACK (startup_wizard_terminate), NULL);
g_signal_connect (
window, "delete-event",
G_CALLBACK (startup_wizard_terminate), NULL);
}
gtk_widget_show (window);
gtk_main ();
if (e_list_length (E_LIST (account_list)) <= 0)
exit(0);
}
static void