aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-04-01 05:42:14 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-04-06 08:59:44 +0800
commitda7aacb87cd1d5d635f367928994c19af8c764f6 (patch)
tree388f68d35a953b38fea583c4030249d6f33a30f9
parent8580bd4a42a98f0171e9524d69385c9868c7c07a (diff)
downloadgsoc2013-evolution-da7aacb87cd1d5d635f367928994c19af8c764f6.tar
gsoc2013-evolution-da7aacb87cd1d5d635f367928994c19af8c764f6.tar.gz
gsoc2013-evolution-da7aacb87cd1d5d635f367928994c19af8c764f6.tar.bz2
gsoc2013-evolution-da7aacb87cd1d5d635f367928994c19af8c764f6.tar.lz
gsoc2013-evolution-da7aacb87cd1d5d635f367928994c19af8c764f6.tar.xz
gsoc2013-evolution-da7aacb87cd1d5d635f367928994c19af8c764f6.tar.zst
gsoc2013-evolution-da7aacb87cd1d5d635f367928994c19af8c764f6.zip
Capplet cleanups.
-rw-r--r--capplet/anjal-settings-main.c95
-rw-r--r--capplet/settings/anjal-mail-view.c37
-rw-r--r--capplet/settings/anjal-mail-view.h20
-rw-r--r--capplet/settings/mail-account-view.c176
-rw-r--r--capplet/settings/mail-account-view.h13
-rw-r--r--capplet/settings/mail-capplet-shell.c169
-rw-r--r--capplet/settings/mail-capplet-shell.h14
-rw-r--r--capplet/settings/mail-decoration.c99
-rw-r--r--capplet/settings/mail-decoration.h9
-rw-r--r--capplet/settings/mail-guess-servers.c70
-rw-r--r--capplet/settings/mail-guess-servers.h32
-rw-r--r--capplet/settings/mail-settings-view.c34
-rw-r--r--capplet/settings/mail-settings-view.h10
-rw-r--r--capplet/settings/mail-view.c384
-rw-r--r--capplet/settings/mail-view.h15
15 files changed, 355 insertions, 822 deletions
diff --git a/capplet/anjal-settings-main.c b/capplet/anjal-settings-main.c
index c9e08d18c0..6352f020bd 100644
--- a/capplet/anjal-settings-main.c
+++ b/capplet/anjal-settings-main.c
@@ -12,7 +12,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -50,7 +50,6 @@
#include <windows.h>
#endif
-
#include <unique/unique.h>
gboolean windowed = FALSE;
@@ -59,7 +58,7 @@ gboolean default_app = FALSE;
guint32 socket_id = 0;
MailCappletShell *main_window;
static gchar **remaining_args;
-extern char *shell_moduledir;
+extern gchar *shell_moduledir;
#define GCONF_KEY_MAILTO_ENABLED "/desktop/gnome/url-handlers/mailto/enabled"
#define GCONF_KEY_MAILTO_COMMAND "/desktop/gnome/url-handlers/mailto/command"
@@ -74,8 +73,8 @@ mail_message_received_cb (UniqueApp *app G_GNUC_UNUSED,
{
gchar *url;
GtkWindow *window = (GtkWindow *) user_data;
- char *args[2];
-
+ gchar *args[2];
+
switch (command) {
case UNIQUE_ACTIVATE :
gtk_window_deiconify (window);
@@ -143,7 +142,7 @@ check_and_set_default_mail (void)
g_object_unref (client);
return; /* Anjal is the default mailer */
}
-
+
gconf_client_set_bool(client, GCONF_KEY_MAILTO_ENABLED, TRUE, NULL);
gconf_client_set_string(client, GCONF_KEY_MAILTO_COMMAND, ANJAL_MAILTO_COMMAND, NULL);
g_object_unref (client);
@@ -152,13 +151,11 @@ check_and_set_default_mail (void)
static gboolean
idle_cb (MailCappletShell *mshell G_GNUC_UNUSED)
{
-
+
if (default_app) {
check_and_set_default_mail ();
}
-
-
return FALSE;
}
@@ -171,12 +168,12 @@ create_default_shell (void)
g_idle_add ((GSourceFunc) idle_cb, remaining_args);
}
-int
-main (int argc, char *argv[])
+gint
+main (gint argc, gchar *argv[])
{
GError *error = NULL;
GConfClient *client;
-
+
UniqueApp *app;
#ifdef G_OS_WIN32
@@ -208,7 +205,7 @@ main (int argc, char *argv[])
&socket_id,
/* TRANSLATORS: don't translate the terms in brackets */
N_("ID of the socket to embed in"),
- N_("socket") },
+ N_("socket") },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining_args, NULL, NULL },
{ NULL, 0, 0, 0, NULL, NULL, NULL }
};
@@ -219,7 +216,6 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE);
#endif
-
gtk_set_locale ();
if (!gtk_init_with_args (&argc, &argv, _("Anjal email client"), entries, NULL, &error)) {
@@ -239,11 +235,11 @@ main (int argc, char *argv[])
gconf_client_set_bool (client, "/apps/evolution/mail/display/enable_vfolders", FALSE, NULL);
g_object_unref (client);
-
+
app = unique_app_new ("org.gnome.AnjalSettings", NULL);
if (unique_app_is_running (app) && !socket_id) {
gboolean cmd_line = (remaining_args && remaining_args[0] != NULL);
-
+
if (!cmd_line)
unique_app_send_message (app, UNIQUE_ACTIVATE, NULL);
else {
@@ -263,73 +259,8 @@ main (int argc, char *argv[])
if (windowed)
anjal_icon_decoration = TRUE;
-
+
gtk_main ();
return 0;
}
-
-#ifndef HACK
-gpointer em_format_html_print_new(gpointer p1 G_GNUC_UNUSED,
- int i G_GNUC_UNUSED)
-{
- return NULL;
-}
-
-void em_format_html_print_raw_message (gpointer p1 G_GNUC_UNUSED,
- gpointer p2 G_GNUC_UNUSED)
-{
- return ;
-}
-
-void
-eab_merging_book_commit_contact ()
-{
-}
-
-void
-e_searching_tokenizer_set_primary_case_sensitivity ()
-{
-}
-
-void
-eab_prompt_save_dialog ()
-{
-}
-
-void
-eab_merging_book_add_contact ()
-{
-}
-
-void
-e_searching_tokenizer_match_count ()
-{
-}
-
-void
-addressbook_load_cancel()
-{
-}
-
-void
-e_searching_tokenizer_new ()
-{
-}
-
-void
-e_searching_tokenizer_set_primary_search_string()
-{
-}
-
-void
-addressbook_load()
-{
-}
-
-void
-eab_load_error_dialog()
-{
-}
-
-#endif
diff --git a/capplet/settings/anjal-mail-view.c b/capplet/settings/anjal-mail-view.c
index 5178b56422..99ff93a065 100644
--- a/capplet/settings/anjal-mail-view.c
+++ b/capplet/settings/anjal-mail-view.c
@@ -10,7 +10,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -31,13 +31,11 @@
#include "mail/mail-ops.h"
#include "mail/em-folder-tree.h"
-
struct _AnjalMailViewPrivate {
gboolean started;
};
-
G_DEFINE_TYPE (AnjalMailView, anjal_mail_view, GTK_TYPE_NOTEBOOK)
static void
@@ -52,31 +50,31 @@ anjal_mail_view_finalize (GObject *object)
{
AnjalMailView *shell = (AnjalMailView *)object;
AnjalMailViewPrivate *priv = shell->priv;
-
+
g_free (priv);
-
+
G_OBJECT_CLASS (anjal_mail_view_parent_class)->finalize (object);
}
-static void
+static void
view_set_folder_uri (AnjalMailView *mail_view, const gchar *uri)
{
}
-static void
+static void
view_set_folder_tree_widget (AnjalMailView *mail_view, GtkWidget *tree)
{
}
-static void
+static void
view_set_folder_tree (AnjalMailView *mail_view, EMFolderTree *tree)
{
}
-static void
-view_set_search (AnjalMailView *mail_view, const char *search)
+static void
+view_set_search (AnjalMailView *mail_view, const gchar *search)
{
}
-static void
+static void
view_init_search (AnjalMailView *mail_view, GtkWidget *search)
{
}
@@ -95,17 +93,16 @@ anjal_mail_view_class_init (AnjalMailViewClass *klass)
klass->init_search = view_init_search;
};
-
AnjalMailView *
anjal_mail_view_new ()
{
AnjalMailView *shell = g_object_new (ANJAL_MAIL_VIEW_TYPE, NULL);
-
+
return shell;
}
-void
-anjal_mail_view_set_folder_uri (AnjalMailView *mv, const char *uri)
+void
+anjal_mail_view_set_folder_uri (AnjalMailView *mv, const gchar *uri)
{
if (!mv || !uri)
return;
@@ -113,25 +110,25 @@ anjal_mail_view_set_folder_uri (AnjalMailView *mv, const char *uri)
ANJAL_MAIL_VIEW_GET_CLASS(mv)->set_folder_uri (mv, uri);
}
-void
+void
anjal_mail_view_set_folder_tree_widget (AnjalMailView *mv, GtkWidget *tree)
{
ANJAL_MAIL_VIEW_GET_CLASS(mv)->set_folder_tree_widget (mv, tree);
}
-void
+void
anjal_mail_view_set_folder_tree (AnjalMailView *mv, GtkWidget *tree)
{
ANJAL_MAIL_VIEW_GET_CLASS(mv)->set_folder_tree (mv, (EMFolderTree *)tree);
}
-void
-anjal_mail_view_set_search (AnjalMailView *view, const char *search)
+void
+anjal_mail_view_set_search (AnjalMailView *view, const gchar *search)
{
ANJAL_MAIL_VIEW_GET_CLASS(view)->set_search (view, search);
}
-void
+void
anjal_mail_view_init_search (AnjalMailView *mv, GtkWidget *search)
{
ANJAL_MAIL_VIEW_GET_CLASS(mv)->init_search (mv, search);
diff --git a/capplet/settings/anjal-mail-view.h b/capplet/settings/anjal-mail-view.h
index 647d07b29a..953aa4b935 100644
--- a/capplet/settings/anjal-mail-view.h
+++ b/capplet/settings/anjal-mail-view.h
@@ -10,7 +10,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -50,27 +50,15 @@ typedef struct _AnjalMailViewClass {
void (*set_folder_tree) (AnjalMailView *mail_view,
EMFolderTree *tree);
void (*set_search) (AnjalMailView *mail_view,
- const char *search);
+ const gchar *search);
void (* init_search) (AnjalMailView *mail_view, GtkWidget *search);
} AnjalMailViewClass;
GType anjal_mail_view_get_type (void);
AnjalMailView * anjal_mail_view_new (void);
-void anjal_mail_view_set_folder_uri (AnjalMailView *mv, const char *uri);
-#if 0
-void anjal_mail_view_show_sort_popup (AnjalMailView *mv, GtkWidget *);
-void anjal_anjal_mail_view_show_list (AnjalMailView *mv);
-void anjal_mail_view_close_view (AnjalMailView *mv);
-void anjal_mail_view_set_check_email (AnjalMailView *mv, GtkWidget *button);
-void anjal_mail_view_set_sort_by (AnjalMailView *mv, GtkWidget *button);
-void anjal_mail_view_check_mail(AnjalMailView *mv, gboolean deep);
-void anjal_mail_view_save (AnjalMailView *mv);
-void anjal_mail_view_set_slider (AnjalMailView *mv, GtkWidget *slider);
-void anjal_mail_view_switch_to_people (AnjalMailView* mv, MailViewChild *mpv);
-void anjal_mail_view_switch_to_settings (AnjalMailView* mv, MailViewChild *mpv);
-#endif
+void anjal_mail_view_set_folder_uri (AnjalMailView *mv, const gchar *uri);
void anjal_mail_view_set_folder_tree_widget (AnjalMailView *mv, GtkWidget *tree);
void anjal_mail_view_set_folder_tree (AnjalMailView *mv, GtkWidget *tree);
-void anjal_mail_view_set_search (AnjalMailView *view, const char *search);
+void anjal_mail_view_set_search (AnjalMailView *view, const gchar *search);
void anjal_mail_view_init_search (AnjalMailView *mv, GtkWidget *search);
#endif
diff --git a/capplet/settings/mail-account-view.c b/capplet/settings/mail-account-view.c
index cb5b1aeda7..e97abdc6dc 100644
--- a/capplet/settings/mail-account-view.c
+++ b/capplet/settings/mail-account-view.c
@@ -10,7 +10,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -50,8 +50,8 @@ enum {
};
struct _dialog_errors {
- int error;
- char *detail;
+ gint error;
+ const gchar *detail;
} dialog_errors[] = {
{ ERROR_NO_FULLNAME, N_("Please enter your full name.") },
{ ERROR_NO_EMAIL, N_("Please enter your email address.") },
@@ -90,7 +90,7 @@ mail_account_view_class_init (MailAccountViewClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
+
}
#ifdef NOT_USED
@@ -101,21 +101,21 @@ enum {
AOL
};
struct _server_prefill {
- char *key;
- char *recv;
- char *send;
- char *proto;
- char *ssl;
+ gchar *key;
+ gchar *recv;
+ gchar *send;
+ gchar *proto;
+ gchar *ssl;
} std_server [] = {
{"gmail", "imap.gmail.com", "smtp.gmail.com", "imap", "always"},
{"yahoo", "pop3.yahoo.com", "smtp.yahoo.com", "pop", "never"},
{"aol", "imap.aol.com", "smtp.aol.com", "pop", "never"},
{"msn", "pop3.email.msn.com", "smtp.email.msn.com", "pop", "never"}
};
-static int
-check_servers (char *server)
+static gint
+check_servers (gchar *server)
{
- int len = G_N_ELEMENTS(std_server), i;
+ gint len = G_N_ELEMENTS(std_server), i;
for (i=0; i<len; i++) {
if (strstr(server, std_server[i].key) != NULL)
@@ -124,67 +124,24 @@ check_servers (char *server)
return -1;
}
-#endif
+#endif
static void
save_identity (MailAccountView *view)
{
-#if 0
- if (!view->original) {
- char *tmp = e_account_get_string(view->edit->account, E_ACCOUNT_ID_ADDRESS);
- char **token;
- int index;
-
- if (tmp && *tmp) {
- token = g_strsplit (tmp, "@", 2);
- index = check_servers(token[1]);
-
- if (index != -1) {
- char *uri = e_account_get_string(view->edit->account, E_ACCOUNT_SOURCE_URL);
- CamelURL *url;
- if (uri == NULL || (url = camel_url_new(uri, NULL)) == NULL)
- return;
-
- if (strcmp(url->protocol, std_server[index].proto)) {
- camel_url_set_protocol (url, std_server[index].proto);
- g_datalist_clear (&url->params);
- }
- camel_url_set_param(url, "use_ssl", std_server[index].ssl);
- camel_url_set_host (url, std_server[index].recv);
- camel_url_set_user (url, token[0]);
- uri = camel_url_to_string(url, 0);
- e_account_set_string(view->edit->account, E_ACCOUNT_SOURCE_URL, uri);
- g_free(uri);
-
- uri = e_account_get_string(view->edit->account, E_ACCOUNT_TRANSPORT_URL);
- if (uri == NULL || (url = camel_url_new(uri, NULL)) == NULL)
- return;
-
- camel_url_set_protocol (url, "smtp");
- camel_url_set_param(url, "use_ssl", std_server[index].ssl);
- camel_url_set_host (url, std_server[index].recv);
- camel_url_set_user (url, token[0]);
- uri = camel_url_to_string(url, 0);
- e_account_set_string(view->edit->account, E_ACCOUNT_TRANSPORT_URL, uri);
- g_free(uri);
- }
- g_strfreev(token);
- }
- }
-#endif
}
-static int
+static gint
validate_identity (MailAccountView *view)
{
- char *user = (char *)e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_ID_NAME);
- char *email = (char *)e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_ID_ADDRESS);
- char *tmp;
+ gchar *user = (gchar *)e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_ID_NAME);
+ gchar *email = (gchar *)e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_ID_ADDRESS);
+ gchar *tmp;
if (!user || !*user)
return ERROR_NO_FULLNAME;
- if (!email || !*email)
+ if (!email || !*email)
return ERROR_NO_EMAIL;
- tmp = strchr(email, '@');
+ tmp = strchr(email, '@');
if (!tmp || tmp[1] == 0)
return ERROR_INVALID_EMAIL;
@@ -209,11 +166,11 @@ static GtkWidget *
create_review (MailAccountView *view)
{
GtkWidget *table, *box, *label, *entry;
- char *uri;
- char *enc;
+ gchar *uri;
+ gchar *enc;
CamelURL *url;
- uri = (char *)e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_SOURCE_URL);
+ 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;
@@ -268,7 +225,6 @@ create_review (MailAccountView *view)
PACK_BOX(entry);
gtk_table_attach ((GtkTable *)table, box, 1, 2, 5, 6, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
-
label = gtk_label_new (_("Username:"));
gtk_widget_show (label);
PACK_BOX(label);
@@ -282,15 +238,14 @@ 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, 10, 3);
- enc = (char *)camel_url_get_param(url, "use_ssl");
+ enc = (gchar *)camel_url_get_param(url, "use_ssl");
entry = gtk_label_new (enc ? enc : _("never"));
gtk_widget_show(entry);
PACK_BOX(entry);
gtk_table_attach ((GtkTable *)table, box, 1, 2, 7, 8, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
-
camel_url_free(url);
- uri =(char *) e_account_get_string(em_account_editor_get_modified_account(view->edit), E_ACCOUNT_TRANSPORT_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;
@@ -318,7 +273,6 @@ create_review (MailAccountView *view)
PACK_BOX(entry);
gtk_table_attach ((GtkTable *)table, box, 1, 2, 10, 11, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
-
label = gtk_label_new (_("Username:"));
gtk_widget_show (label);
PACK_BOX(label);
@@ -332,12 +286,12 @@ create_review (MailAccountView *view)
gtk_widget_show (label);
PACK_BOX(label);
gtk_table_attach ((GtkTable *)table, box, 0, 1, 12, 13, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
- enc = (char *)camel_url_get_param(url, "use_ssl");
+ enc = (gchar *)camel_url_get_param(url, "use_ssl");
entry = gtk_label_new (enc ? enc : _("never"));
gtk_widget_show(entry);
PACK_BOX(entry);
gtk_table_attach ((GtkTable *)table, box, 1, 2, 12, 13, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
-
+
/*
label = gtk_label_new (_("Organization:"));
gtk_widget_show (label);
@@ -347,7 +301,7 @@ create_review (MailAccountView *view)
gtk_table_attach (table, entry, 1, 2, 3, 4, GTK_EXPAND|GTK_FILL, GTK_SHRINK, 10, 3);
*/
- gtk_widget_show(table);
+ gtk_widget_show(table);
return table;
}
@@ -362,18 +316,18 @@ create_review (MailAccountView *view)
#define DEFAULTS_DETAIL N_("You can specify your default settings for your account.")
#define REVIEW_DETAIL N_("Time to check things over before we try and connect to the server and fetch your mail.")
struct _page_text {
- int id;
- char *head;
- char *next;
- char *prev;
- char *next_edit;
- char *prev_edit;
- char *detail;
- char *path;
+ gint id;
+ const gchar *head;
+ const gchar *next;
+ const gchar *prev;
+ const gchar *next_edit;
+ const gchar *prev_edit;
+ const gchar *detail;
+ const gchar *path;
GtkWidget * (*create_page) (MailAccountView *view);
void (*fill_page) (MailAccountView *view);
void (*save_page) (MailAccountView *view);
- int (*validate_page) (MailAccountView *view);
+ gint (*validate_page) (MailAccountView *view);
} mail_account_pages[] = {
{ MAV_IDENTITY_PAGE, N_("Identity"), N_("Next - Receiving mail"), NULL, N_("Next - Receiving mail"), NULL, IDENTITY_DETAIL, "00.identity",NULL, NULL, save_identity, validate_identity},
{ MAV_RECV_PAGE, N_("Receiving mail"), N_("Next - Sending mail"), N_("Back - Identity"), N_("Next - Receiving options"), N_("Back - Identity"), RECEIVE_DETAIL, "10.receive", NULL, NULL, NULL, NULL },
@@ -389,7 +343,7 @@ static void
mav_next_pressed (GtkButton *button, MailAccountView *mav)
{
if (mail_account_pages[mav->current_page].validate_page) {
- int ret = (*mail_account_pages[mav->current_page].validate_page) (mav);
+ gint ret = (*mail_account_pages[mav->current_page].validate_page) (mav);
MAVPage *page = mav->pages[mav->current_page];
if (ret) {
gtk_label_set_text ((GtkLabel *)page->error_label, _(dialog_errors[ret-1].detail));
@@ -404,7 +358,7 @@ mav_next_pressed (GtkButton *button, MailAccountView *mav)
}
if (mav->current_page == MAV_LAST - 1) {
- char *uri = (char *)e_account_get_string(em_account_editor_get_modified_account(mav->edit), E_ACCOUNT_SOURCE_URL);
+ gchar *uri = (gchar *)e_account_get_string(em_account_editor_get_modified_account(mav->edit), E_ACCOUNT_SOURCE_URL);
CamelURL *url;
e_account_set_string (em_account_editor_get_modified_account(mav->edit), E_ACCOUNT_NAME, e_account_get_string(em_account_editor_get_modified_account(mav->edit), E_ACCOUNT_ID_ADDRESS));
@@ -425,7 +379,7 @@ mav_next_pressed (GtkButton *button, MailAccountView *mav)
camel_url_free(url);
}
em_account_editor_commit (mav->edit);
- g_signal_emit (mav, signals[VIEW_CLOSE], 0);
+ g_signal_emit (mav, signals[VIEW_CLOSE], 0);
return;
}
@@ -478,19 +432,18 @@ mav_prev_pressed (GtkButton *button, MailAccountView *mav)
}
-
static GtkWidget *
mav_construct_page(MailAccountView *view, MAVPageType type)
{
MAVPage *page = g_new0(MAVPage, 1);
GtkWidget *box, *tmp, *error_box;
- char *str;
+ gchar *str;
page->type = type;
page->box = gtk_vbox_new (FALSE, 2);
- error_box = gtk_hbox_new (FALSE, 2);
+ error_box = gtk_hbox_new (FALSE, 2);
page->error_label = gtk_label_new ("");
tmp = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU);
gtk_box_pack_start ((GtkBox *)error_box, tmp, FALSE, FALSE, 2);
@@ -552,7 +505,7 @@ mav_construct_page(MailAccountView *view, MAVPageType type)
tmp = gtk_label_new (_(view->original ? mail_account_pages[type].next_edit : mail_account_pages[type].next));
gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 3);
if (FALSE) {
- tmp = gtk_image_new_from_icon_name ("go-next", GTK_ICON_SIZE_BUTTON);
+ tmp = gtk_image_new_from_icon_name ("go-next", GTK_ICON_SIZE_BUTTON);
gtk_box_pack_start((GtkBox *)box, tmp, FALSE, FALSE, 0);
}
page->next = gtk_button_new ();
@@ -560,7 +513,7 @@ mav_construct_page(MailAccountView *view, MAVPageType type)
gtk_widget_show_all(page->next);
g_signal_connect(page->next, "clicked", G_CALLBACK(mav_next_pressed), view);
}
-
+
box = gtk_hbox_new (FALSE, 0);
if (page->prev)
gtk_box_pack_start ((GtkBox *)box, page->prev, FALSE, FALSE, 12);
@@ -578,17 +531,17 @@ emae_check_servers (const gchar *email)
{
ServerData *sdata = g_new0(ServerData, 1);
EmailProvider *provider = g_new0(EmailProvider, 1);
- char *dupe = g_strdup(email);
- char *tmp;
+ gchar *dupe = g_strdup(email);
+ gchar *tmp;
/* FIXME: Find a way to free the provider once given to account settings. */
- provider->email = (char *)email;
+ provider->email = (gchar *)email;
tmp = strchr(email, '@');
tmp++;
provider->domain = tmp;
tmp = strchr(dupe, '@');
*tmp = 0;
- provider->username = (char *)g_quark_to_string(g_quark_from_string(dupe));
+ provider->username = (gchar *)g_quark_to_string(g_quark_from_string(dupe));
g_free(dupe);
if (!mail_guess_servers (provider)) {
@@ -596,11 +549,11 @@ emae_check_servers (const gchar *email)
g_free (sdata);
return NULL;
}
- /*printf("Recv: %s\n%s(%s), %s by %s \n Send: %s\n%s(%s), %s by %s\n via %s to %s\n",
+ /*printf("Recv: %s\n%s(%s), %s by %s \n Send: %s\n%s(%s), %s by %s\n via %s to %s\n",
provider->recv_type, provider->recv_hostname, provider->recv_port, provider->recv_username, provider->recv_auth,
provider->send_type, provider->send_hostname, provider->send_port, provider->send_username, provider->send_auth,
provider->recv_socket_type, provider->send_socket_type); */
-
+
sdata->recv = provider->recv_hostname;
sdata->recv_port = provider->recv_port;
sdata->send = provider->send_hostname;
@@ -612,32 +565,31 @@ emae_check_servers (const gchar *email)
else
sdata->proto = provider->recv_type;
if (provider->recv_socket_type) {
- if(g_ascii_strcasecmp(provider->recv_socket_type, "SSL") == 0)
+ if (g_ascii_strcasecmp(provider->recv_socket_type, "SSL") == 0)
sdata->ssl = g_strdup("always");
- else if(g_ascii_strcasecmp(provider->recv_socket_type, "secure") == 0)
+ else if (g_ascii_strcasecmp(provider->recv_socket_type, "secure") == 0)
sdata->ssl = g_strdup("always");
- else if(g_ascii_strcasecmp(provider->recv_socket_type, "STARTTLS") == 0)
- sdata->ssl = g_strdup("when-possible");
- else if(g_ascii_strcasecmp(provider->recv_socket_type, "TLS") == 0)
+ else if (g_ascii_strcasecmp(provider->recv_socket_type, "STARTTLS") == 0)
sdata->ssl = g_strdup("when-possible");
- else
+ else if (g_ascii_strcasecmp(provider->recv_socket_type, "TLS") == 0)
+ sdata->ssl = g_strdup("when-possible");
+ else
sdata->ssl = g_strdup("never");
}
sdata->send_user = provider->send_username;
sdata->recv_user = provider->recv_username;
-
g_free (provider);
return sdata;
}
-void
+static void
mail_account_view_construct (MailAccountView *view)
{
- int i;
-
+ gint i;
+
view->scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy ((GtkScrolledWindow *)view->scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type ((GtkScrolledWindow *)view->scroll, GTK_SHADOW_NONE);
@@ -676,7 +628,7 @@ mail_account_view_new (EAccount *account)
view->uri = "account://";
view->original = account;
mail_account_view_construct (view);
-
+
return view;
}
@@ -697,7 +649,7 @@ mav_btn_expose (GtkWidget *w, GdkEventExpose *event, MailAccountView *mfv)
static void
mav_close (GtkButton *w, MailAccountView *mfv)
{
- g_signal_emit (mfv, signals[VIEW_CLOSE], 0);
+ g_signal_emit (mfv, signals[VIEW_CLOSE], 0);
}
GtkWidget *
@@ -706,19 +658,19 @@ mail_account_view_get_tab_widget (MailAccountView *mcv)
GdkPixbuf *pbuf = gtk_widget_render_icon ((GtkWidget *)mcv, "gtk-close", GTK_ICON_SIZE_MENU, NULL);
GtkWidget *tool, *box, *img;
- int w=-1, h=-1;
+ gint w=-1, h=-1;
GtkWidget *tab_label;
img = (GtkWidget *)gtk_image_new_from_pixbuf (pbuf);
g_object_set_data ((GObject *)img, "pbuf", pbuf);
g_signal_connect (img, "expose-event", G_CALLBACK(mav_btn_expose), mcv);
-
+
tool = gtk_button_new ();
gtk_button_set_relief((GtkButton *)tool, GTK_RELIEF_NONE);
gtk_button_set_focus_on_click ((GtkButton *)tool, FALSE);
gtk_widget_set_tooltip_text (tool, _("Close Tab"));
g_signal_connect (tool, "clicked", G_CALLBACK(mav_close), mcv);
-
+
box = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start ((GtkBox *)box, img, FALSE, FALSE, 0);
gtk_container_add ((GtkContainer *)tool, box);
@@ -733,7 +685,7 @@ mail_account_view_get_tab_widget (MailAccountView *mcv)
gtk_widget_show_all (tab_label);
return tab_label;
-
+
}
void
diff --git a/capplet/settings/mail-account-view.h b/capplet/settings/mail-account-view.h
index 5066d83dce..618dce5361 100644
--- a/capplet/settings/mail-account-view.h
+++ b/capplet/settings/mail-account-view.h
@@ -10,7 +10,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -60,12 +60,10 @@ typedef struct _MAVPage {
gboolean done;
}MAVPage;
-
-
typedef struct _MailAccountView {
GtkVBox parent;
- int type;
- char *uri;
+ gint type;
+ const gchar *uri;
MailViewFlags flags;
/* Base class of MailChildView ends */
@@ -75,7 +73,7 @@ typedef struct _MailAccountView {
MAVPage *pages[6];
struct _EAccount *original;
GtkWidget *wpages[6];
- int current_page;
+ gint current_page;
struct _EMAccountEditor *edit;
MailAccountViewPrivate *priv;
@@ -84,10 +82,11 @@ typedef struct _MailAccountView {
typedef struct _MailAccountViewClass {
GtkVBoxClass parent_class;
- void (* view_close) (MailAccountView *);
+ void (* view_close) (MailAccountView *);
} MailAccountViewClass;
+GType mail_account_view_get_type (void);
MailAccountView *mail_account_view_new (EAccount *account);
GtkWidget * mail_account_view_get_tab_widget(MailAccountView *mcv);
void mail_account_view_activate (MailAccountView *mcv, GtkWidget *tree, GtkWidget *folder_tree, GtkWidget *check_mail, GtkWidget *sort_by, gboolean act);
diff --git a/capplet/settings/mail-capplet-shell.c b/capplet/settings/mail-capplet-shell.c
index 52f4519d42..da22b9d0d5 100644
--- a/capplet/settings/mail-capplet-shell.c
+++ b/capplet/settings/mail-capplet-shell.c
@@ -12,7 +12,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -29,7 +29,7 @@
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <gconf/gconf-client.h>
-#include "mail-capplet-shell.h"
+#include "mail-capplet-shell.h"
#include "mail-view.h"
#include <gdk/gdkkeysyms.h>
@@ -51,30 +51,30 @@ enum {
/* Re usable colors */
GdkColor *pcolor_sel;
-char *scolor_sel;
+gchar *scolor_sel;
GdkColor *pcolor_fg_sel;
-char *scolor_fg_sel;
+gchar *scolor_fg_sel;
GdkColor *pcolor_bg_norm;
-char *scolor_bg_norm;
+gchar *scolor_bg_norm;
GdkColor *pcolor_norm;
-char *scolor_norm;
+gchar *scolor_norm;
GdkColor *pcolor_fg_norm;
-char *scolor_fg_norm;
+gchar *scolor_fg_norm;
static guint mail_capplet_shell_signals[LAST_SIGNAL];
struct _MailCappletShellPrivate {
GtkWidget *box;
-
+
GtkWidget * top_bar;
GtkWidget *message_pane;
GtkWidget *bottom_bar;
/* Top Bar */
GtkWidget *action_bar;
- GtkWidget *quit;
-
+ GtkWidget *quit;
+
gboolean main_loop;
MailViewChild *settings_view;
@@ -102,8 +102,6 @@ mail_capplet_shell_finalize (GObject *object)
static void
ms_ctrl_w_pressed (MailCappletShell *shell)
{
- MailCappletShellPrivate *priv = shell->priv;
-
mail_view_close_view ((MailView *)shell->view);
}
@@ -111,7 +109,7 @@ static void
ms_ctrl_q_pressed (MailCappletShell *shell)
{
mail_capplet_shell_quit (shell);
-}
+}
static void
mail_capplet_shell_class_init (MailCappletShellClass *klass)
@@ -132,7 +130,7 @@ mail_capplet_shell_class_init (MailCappletShellClass *klass)
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),
@@ -150,36 +148,6 @@ mail_capplet_shell_class_init (MailCappletShellClass *klass)
};
-static int
-color_expose (GtkWidget *w,
- GdkEventExpose *event G_GNUC_UNUSED,
- gpointer data)
-{
- GtkWindow *win = (GtkWindow *)data;
- cairo_t *cr = gdk_cairo_create (w->window);
- int wid = w->allocation.width;
- int heig = w->allocation.height;
- int wwid, wheig;
- GdkColor paint;
-
- gtk_window_get_size (win, &wwid, &wheig);
- gdk_color_parse ("#000000", &paint);
- gdk_cairo_set_source_color (cr, &(paint));
- cairo_rectangle (cr, 0, 0, wwid, wheig);
- cairo_stroke (cr);
-
- gdk_color_parse ("#000000", &paint);
- gdk_cairo_set_source_color (cr, &(paint));
- cairo_rectangle (cr, 1, 1, wid, heig);
- cairo_fill (cr);
-
- cairo_destroy (cr);
-
- return FALSE;
-}
-
-
-
static void
ms_init_style (GtkStyle *style)
{
@@ -208,13 +176,6 @@ mail_capplet_shell_quit (MailCappletShell *shell)
gtk_main_quit();
else
gtk_widget_hide ((GtkWidget *)shell);
-}
-
-static void
-mail_capplet_shell_quit_cb (GtkWidget *w G_GNUC_UNUSED,
- MailCappletShell *shell)
-{
- mail_capplet_shell_quit (shell);
}
static void
@@ -225,60 +186,23 @@ ms_delete_event (MailCappletShell *shell,
mail_capplet_shell_quit (shell);
}
-static gboolean
-ms_check_new ()
-{
- GConfClient *client;
- GSList *accounts;
-
- client = gconf_client_get_default ();
- accounts = gconf_client_get_list (client, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL);
- g_object_unref (client);
-
- if (accounts != NULL) {
- g_slist_foreach (accounts, (GFunc) g_free, NULL);
- g_slist_free (accounts);
-
- return FALSE;
- }
-
- return TRUE;
-}
-
-
static void
ms_show_post_druid (MailViewChild *mfv G_GNUC_UNUSED,
MailCappletShell *shell)
{
gtk_widget_destroy (GTK_WIDGET (shell));
- /*
- if (shell->priv->settings_view)
- mail_view_switch_to_settings ((MailView *)shell->view, (MailViewChild *)shell->priv->settings_view);
- else {
- shell->priv->settings_view = mail_view_add_page ((MailView *)shell->view, MAIL_VIEW_SETTINGS, NULL);
- } */
-
}
#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); }
-#if 0
static void
-handle_cmdline (MailView *mv, MailCappletShell *shell)
-{
- g_signal_handlers_block_by_func (mv, handle_cmdline, shell);
- mail_capplet_shell_handle_cmdline (shell);
-}
-#endif
-
-void
-mail_capplet_shell_construct (MailCappletShell *shell, int socket_id, gboolean just_druid, gboolean main_loop)
+mail_capplet_shell_construct (MailCappletShell *shell, gint socket_id, gboolean just_druid, gboolean main_loop)
{
MailCappletShellPrivate *priv = shell->priv;
- GtkWidget *tmp, *img, *box, *ar1, *ar2, *lbl;
+ GtkWidget *tmp;
GtkStyle *style = gtk_widget_get_default_style ();
- int window_width = 1024;
- char *custom_dir;
+ gint window_width = 1024;
+ gchar *custom_dir;
gtk_window_set_icon_name ((GtkWindow *)shell, "evolution");
gtk_window_set_title ((GtkWindow *)shell, _("Evolution account assistant"));
@@ -291,7 +215,6 @@ mail_capplet_shell_construct (MailCappletShell *shell, int socket_id, gboolean j
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 {
- //mail_decoration_new ((GtkWindow *)shell);
gtk_window_set_default_size ((GtkWindow *)shell, 1024, 500);
}
@@ -300,47 +223,10 @@ mail_capplet_shell_construct (MailCappletShell *shell, int socket_id, gboolean j
gtk_widget_show ((GtkWidget *)priv->box);
if (!socket_id) {
-#if 0
- /* Toolbar */
- priv->top_bar = gtk_toolbar_new ();
- gtk_box_pack_start ((GtkBox *)priv->box, priv->top_bar, FALSE, FALSE, 0);
- gtk_widget_show (priv->top_bar);
- if (g_getenv("ANJAL_NO_MAX") || FALSE) {
- gtk_container_set_border_width (GTK_CONTAINER (shell), 1);
- g_signal_connect (priv->top_bar, "expose-event",
- G_CALLBACK (color_expose),
- shell);
- /* Leave it to the theme to decide the height */
- /* gtk_widget_set_size_request (priv->top_bar, -1, 42); */
- }
-
- /* Label */
- tmp = (GtkWidget *)gtk_tool_item_new ();
- gtk_tool_item_set_expand((GtkToolItem *)tmp, FALSE);
- lbl = gtk_label_new (_("Email Settings"));
- gtk_container_add ((GtkContainer *)tmp, lbl);
- gtk_toolbar_insert ((GtkToolbar *)priv->top_bar, (GtkToolItem *)tmp, 0);
- gtk_widget_show_all (tmp);
-
- tmp = (GtkWidget *)gtk_tool_item_new ();
- gtk_tool_item_set_expand((GtkToolItem *)tmp, TRUE);
- lbl = gtk_label_new (NULL);
- gtk_container_add ((GtkContainer *)tmp, lbl);
- gtk_toolbar_insert ((GtkToolbar *)priv->top_bar, (GtkToolItem *)tmp, 1);
- gtk_widget_show_all (tmp);
-
- /* Close button */
- PACK_IN_TOOL(priv->quit, "gtk-close");
- gtk_widget_set_tooltip_text(priv->quit, _("Quit"));
- gtk_tool_item_set_expand ((GtkToolItem *)priv->quit, FALSE);
- gtk_toolbar_insert ((GtkToolbar *)priv->top_bar, (GtkToolItem *)priv->quit, -1);
- gtk_widget_show_all (priv->quit);
- g_signal_connect (priv->quit, "clicked", G_CALLBACK(mail_capplet_shell_quit_cb), shell);
-#endif
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);
@@ -360,11 +246,11 @@ mail_capplet_shell_construct (MailCappletShell *shell, int socket_id, gboolean j
custom_dir = g_build_filename (e_get_user_data_dir (), "mail", NULL);
e_mail_store_init (custom_dir);
g_free (custom_dir);
-
+
if (just_druid) {
MailViewChild *mc;
- char *pdir = g_build_filename (g_get_home_dir(), ".gnome2_private", NULL);
-
+ gchar *pdir = g_build_filename (g_get_home_dir(), ".gnome2_private", NULL);
+
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);
@@ -373,20 +259,19 @@ mail_capplet_shell_construct (MailCappletShell *shell, int socket_id, gboolean j
g_mkdir (pdir, 0700);
}
g_free (pdir);
- } else
+ } else
shell->priv->settings_view = mail_view_add_page ((MailView *)shell->view, MAIL_VIEW_SETTINGS, NULL);
-
}
-int
+gint
mail_capplet_shell_toolbar_height (MailCappletShell *shell)
{
return shell->priv->top_bar->allocation.height;
}
MailCappletShell *
-mail_capplet_shell_new (int socket_id, gboolean just_druid, gboolean main_loop)
+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);
@@ -399,7 +284,7 @@ mail_capplet_shell_new (int socket_id, gboolean just_druid, gboolean main_loop)
static void
setup_abooks()
{
- char *base_dir, *uri;
+ gchar *base_dir, *uri;
GSList *groups;
ESourceGroup *group;
ESourceList *list = NULL;
@@ -408,7 +293,7 @@ setup_abooks()
base_dir = g_build_filename (e_get_user_data_dir (), "addressbook", "local", NULL);
uri = g_filename_to_uri (base_dir, NULL, NULL);
-
+
if (!e_book_get_addressbooks(&list, NULL)) {
g_warning ("Unable to get books\n");
return;
@@ -429,7 +314,7 @@ setup_abooks()
}
}
}
-
+
if (on_this_computer) {
/* make sure "Personal" shows up as a source under
this group */
@@ -470,7 +355,7 @@ setup_abooks()
g_object_unref (on_this_computer);
if (personal_source)
g_object_unref (personal_source);
-
+
e_source_list_sync (list, NULL);
g_object_unref (list);
g_free (uri);
diff --git a/capplet/settings/mail-capplet-shell.h b/capplet/settings/mail-capplet-shell.h
index 9cc4255760..5845973065 100644
--- a/capplet/settings/mail-capplet-shell.h
+++ b/capplet/settings/mail-capplet-shell.h
@@ -10,7 +10,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -47,12 +47,16 @@ typedef struct _MailCappletShellClass {
GtkWindowClass parent_class;
void (* ctrl_w_pressed) (MailCappletShell *class);
- void (* ctrl_q_pressed) (MailCappletShell *class);
+ void (* ctrl_q_pressed) (MailCappletShell *class);
} MailCappletShellClass;
-MailCappletShell * mail_capplet_shell_new (int socket_id, gboolean just_druid, gboolean main_loop);
-int mail_capplet_shell_toolbar_height (MailCappletShell *shell);
+GType mail_capplet_shell_get_type (void);
+MailCappletShell *
+ mail_capplet_shell_new (gint socket_id,
+ gboolean just_druid,
+ gboolean main_loop);
+gint mail_capplet_shell_toolbar_height
+ (MailCappletShell *shell);
#endif
-
diff --git a/capplet/settings/mail-decoration.c b/capplet/settings/mail-decoration.c
index 9b8bc37886..056283dabe 100644
--- a/capplet/settings/mail-decoration.c
+++ b/capplet/settings/mail-decoration.c
@@ -10,7 +10,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -37,14 +37,14 @@ struct _MailDecorationPrivate
gboolean default_cursor;
gboolean resizing;
GdkWindowEdge last_edge;
- int resize_width;
- int top_height;
+ gint resize_width;
+ gint top_height;
gboolean check_window;
gboolean can_resize;
gboolean full_screen;
- int window_width;
- int window_height;
+ gint window_width;
+ gint window_height;
};
static GObjectClass *parent_class = NULL;
@@ -80,14 +80,14 @@ mail_decoration_get_type(void)
return type;
}
-static void
-md_translate_position (GdkWindow *w, double ex, double ey, int *x, int *y, GtkWidget *window)
+static void
+md_translate_position (GdkWindow *w, double ex, double ey, gint *x, gint *y, GtkWidget *window)
{
- *x = (int)ex;
- *y = (int)ey;
+ *x = (gint)ex;
+ *y = (gint)ey;
while (w && w != window->window) {
- int cx, cy, cw, ch, cd;
+ gint cx, cy, cw, ch, cd;
gdk_window_get_geometry (w, &cx, &cy, &cw, &ch, &cd);
*x += cx;
*y += cy;
@@ -96,30 +96,29 @@ md_translate_position (GdkWindow *w, double ex, double ey, int *x, int *y, GtkWi
}
static gboolean
-in_top (MailDecoration *md, double y)
-{
- return y <= md->priv->resize_width;
+in_top (MailDecoration *md, double y)
+{
+ return y <= md->priv->resize_width;
}
static gboolean
-in_left (MailDecoration *md, double x)
-{
- return x <= md->priv->resize_width;
+in_left (MailDecoration *md, double x)
+{
+ return x <= md->priv->resize_width;
}
-static gboolean
-in_bottom (MailDecoration *md, double y)
-{
- return y >= ((GtkWidget *)md->window)->allocation.height - md->priv->resize_width;
+static gboolean
+in_bottom (MailDecoration *md, double y)
+{
+ return y >= ((GtkWidget *)md->window)->allocation.height - md->priv->resize_width;
}
-static gboolean
-in_right (MailDecoration *md, double x)
-{
- return x >= ((GtkWidget *)md->window)->allocation.width - md->priv->resize_width;
+static gboolean
+in_right (MailDecoration *md, double x)
+{
+ return x >= ((GtkWidget *)md->window)->allocation.width - md->priv->resize_width;
}
-
static void
set_cursor (MailDecoration *md, GdkWindowEdge edge)
{
@@ -145,7 +144,7 @@ update_cursor (MailDecoration *md, double x, double y, gboolean update)
if (in_top(md, y) && in_left (md, x)) {
md->priv->last_edge = GDK_WINDOW_EDGE_NORTH_WEST;
- set_cursor (md, GDK_WINDOW_EDGE_NORTH_WEST);
+ set_cursor (md, GDK_WINDOW_EDGE_NORTH_WEST);
} else if (in_top (md, y) && in_right (md, x)) {
md->priv->last_edge = GDK_WINDOW_EDGE_NORTH_EAST;
set_cursor (md, GDK_WINDOW_EDGE_NORTH_EAST);
@@ -174,11 +173,10 @@ update_cursor (MailDecoration *md, double x, double y, gboolean update)
}
}
-
-static gboolean
-md_motion_event (GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
+static gboolean
+md_motion_event (GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
{
- int x, y;
+ gint x, y;
MailDecoration *md = (MailDecoration *)user_data;
md_translate_position (event->window, event->x, event->y, &x, &y, (GtkWidget *)md->window);
@@ -190,11 +188,11 @@ md_motion_event (GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
return FALSE;
}
-static gboolean
-md_enter_event (GtkWidget *widget , GdkEventCrossing *event, gpointer user_data)
+static gboolean
+md_enter_event (GtkWidget *widget , GdkEventCrossing *event, gpointer user_data)
{
MailDecoration *md = (MailDecoration *)user_data;
- int x, y;
+ gint x, y;
md_translate_position (event->window, event->x, event->y, &x, &y, (GtkWidget *)md->window);
@@ -205,7 +203,7 @@ md_enter_event (GtkWidget *widget , GdkEventCrossing *event, gpointer user_data)
return FALSE;
}
-static gboolean
+static gboolean
md_leave_event (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
{
MailDecoration *md = (MailDecoration *)user_data;
@@ -216,17 +214,17 @@ md_leave_event (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
return FALSE;
}
-static void
+static void
md_size_allocate_event (GtkWidget *widget, GtkAllocation *allocation, gpointer user_data)
{
- int width=1024, height=500;
+ gint width=1024, height=500;
MailDecoration *md = (MailDecoration *)user_data;
gtk_widget_queue_draw (widget);
gtk_window_get_size ((GtkWindow *)widget, &width, &height);
if (width != md->priv->window_width || height != md->priv->window_height) {
GConfClient *client = gconf_client_get_default ();
-
+
md->priv->window_height = height;
md->priv->window_width = width;
gconf_client_set_int (client, "/apps/anjal/window_width", width, NULL);
@@ -236,18 +234,18 @@ md_size_allocate_event (GtkWidget *widget, GtkAllocation *allocation, gpointer u
}
-static gboolean
+static gboolean
md_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
{
MailDecoration *md = (MailDecoration *)user_data;
- int x_root = (int) event->x_root;
- int y_root = (int) event->y_root;
- int x, y;
+ gint x_root = (gint) event->x_root;
+ gint y_root = (gint) event->y_root;
+ gint x, y;
if (!md->priv->can_resize) {
return FALSE;
}
-
+
md_translate_position (event->window, event->x, event->y, &x, &y, (GtkWidget *)md->window);
update_cursor (md, x, y, TRUE);
if (md->priv->resizing && event->button == 1 && event->type != GDK_2BUTTON_PRESS) {
@@ -257,7 +255,7 @@ md_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_d
(event->button == 1 && y <= md->priv->top_height && event->type != GDK_2BUTTON_PRESS)) {
gtk_window_begin_move_drag ((GtkWindow *)widget, event->button, x_root, y_root, event->time);
} else if (y <= md->priv->top_height && event->type == GDK_2BUTTON_PRESS) {
- if (md->priv->full_screen)
+ if (md->priv->full_screen)
gtk_window_unfullscreen (md->window);
else
gtk_window_fullscreen (md->window);
@@ -269,15 +267,15 @@ md_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_d
return TRUE;
}
-static gboolean
+static gboolean
md_button_release_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
{
- int x, y;
+ gint x, y;
MailDecoration *md = (MailDecoration *)user_data;
md_translate_position (event->window, event->x, event->y, &x, &y, (GtkWidget *)md->window);
if (md->priv->resizing) {
- update_cursor (md, x, y, TRUE);
+ update_cursor (md, x, y, TRUE);
}
return FALSE;
@@ -287,7 +285,7 @@ MailDecoration* mail_decoration_new(GtkWindow *window)
{
MailDecoration *md = g_object_new(mail_decoration_get_type(), NULL);
GConfClient *client = gconf_client_get_default ();
- int width, height;
+ gint width, height;
md->priv->window_width = width = gconf_client_get_int (client, "/apps/anjal/window_width", NULL);
if (!width)
@@ -299,7 +297,7 @@ MailDecoration* mail_decoration_new(GtkWindow *window)
md->window = window;
gtk_window_set_decorated (window, FALSE);
- gtk_widget_add_events ((GtkWidget *)window, GDK_BUTTON_PRESS_MASK |
+ gtk_widget_add_events ((GtkWidget *)window, GDK_BUTTON_PRESS_MASK |
GDK_POINTER_MOTION_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK |
@@ -312,11 +310,10 @@ MailDecoration* mail_decoration_new(GtkWindow *window)
g_signal_connect (window, "button-release-event", G_CALLBACK(md_button_release_event), md);
g_signal_connect (window, "size-allocate", G_CALLBACK(md_size_allocate_event), md);
gtk_window_set_default_size ((GtkWindow *)window , width, height);/* We officiall should support 800x600 */
-
+
return md;
}
-
static void
mail_decoration_class_init(MailDecorationClass *klass)
{
@@ -343,7 +340,7 @@ mail_decoration_init(MailDecoration *md)
priv->cursors[5]= gdk_cursor_new (GDK_BOTTOM_LEFT_CORNER);
priv->cursors[6]= gdk_cursor_new (GDK_BOTTOM_SIDE);
priv->cursors[7]= gdk_cursor_new (GDK_BOTTOM_RIGHT_CORNER);
-
+
priv->default_cursor = TRUE;
priv->resizing = FALSE;
priv->resize_width = 4;
diff --git a/capplet/settings/mail-decoration.h b/capplet/settings/mail-decoration.h
index 9010e8990c..1339cae305 100644
--- a/capplet/settings/mail-decoration.h
+++ b/capplet/settings/mail-decoration.h
@@ -10,7 +10,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -29,7 +29,6 @@
#include <gtk/gtk.h>
-
#define MAIL_DECORATION_TYPE \
(mail_decoration_get_type ())
#define MAIL_DECORATION(obj) \
@@ -53,7 +52,7 @@ typedef struct _MailDecorationClass MailDecorationClass;
typedef struct _MailDecorationPrivate MailDecorationPrivate;
struct _MailDecoration {
- GObject parent;
+ GObject parent;
GtkWindow *window;
MailDecorationPrivate *priv;
@@ -63,7 +62,7 @@ struct _MailDecorationClass {
GObjectClass parent_class;
};
-MailDecoration *mail_decoration_new(GtkWindow *);
-
+GType mail_decoration_get_type (void);
+MailDecoration *mail_decoration_new (GtkWindow *);
#endif
diff --git a/capplet/settings/mail-guess-servers.c b/capplet/settings/mail-guess-servers.c
index ef656bf8a3..388f894e72 100644
--- a/capplet/settings/mail-guess-servers.c
+++ b/capplet/settings/mail-guess-servers.c
@@ -11,7 +11,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -44,22 +44,23 @@
#include "mail-guess-servers.h"
-static char *
+static gchar *
xml_to_gchar (xmlChar *xml, EmailProvider *provider)
{
- char *gxml = NULL;
- char *tmp;
- char *repl = NULL, *sec_part;
+ gchar *gxml = NULL;
+ gchar *tmp;
+ gchar *repl = NULL;
+ const gchar *sec_part;
- tmp = xml ? strstr(xml, "\%EMAIL") : NULL;
+ tmp = xml ? strstr((gchar *) xml, "\%EMAIL") : NULL;
if (!tmp) {
- gxml = xml ? g_strdup(xml) : NULL ;
+ gxml = xml ? g_strdup((gchar *) xml) : NULL;
} else {
decodepart:
*tmp = 0;
tmp+=6;
- if(*tmp == 'A')
+ if (*tmp == 'A')
repl = provider->email;
else if (*tmp == 'L')
repl = provider->username;
@@ -69,25 +70,25 @@ xml_to_gchar (xmlChar *xml, EmailProvider *provider)
sec_part++;
if (!*sec_part)
sec_part = "";
-
- gxml = g_strdup_printf("%s%s%s", gxml ? gxml : (char *)xml, repl, sec_part);
+
+ gxml = g_strdup_printf("%s%s%s", gxml ? gxml : (gchar *)xml, repl, sec_part);
tmp = strstr (gxml, "\%EMAIL");
- if(tmp) {
+ if (tmp) {
goto decodepart;
}
}
xmlFree(xml);
-
+
return gxml;
}
static SoupMessage *
-get_url (SoupSession *session, const char *url)
+get_url (SoupSession *session, const gchar *url)
{
- const char *name;
+ const gchar *name;
SoupMessage *msg;
- const char *header;
+ const gchar *header;
msg = soup_message_new (SOUP_METHOD_GET, url);
soup_message_set_flags (msg, SOUP_MESSAGE_NO_REDIRECT);
@@ -96,7 +97,6 @@ get_url (SoupSession *session, const char *url)
name = soup_message_get_uri (msg)->path;
-
if (SOUP_STATUS_IS_REDIRECTION (msg->status_code)) {
header = soup_message_headers_get_one (msg->response_headers,
"Location");
@@ -110,13 +110,12 @@ get_url (SoupSession *session, const char *url)
return NULL;
}
-
-static void
+static void
handle_incoming (xmlNodePtr head, EmailProvider *provider)
{
xmlNodePtr node = head->children;
- provider->recv_type = xml_to_gchar(xmlGetProp(head, "type"), provider);
+ provider->recv_type = xml_to_gchar(xmlGetProp(head, (xmlChar *) "type"), provider);
while (node) {
if (strcmp ((gchar *)node->name, "hostname") == 0) {
@@ -126,21 +125,21 @@ handle_incoming (xmlNodePtr head, EmailProvider *provider)
} else if (strcmp ((gchar *)node->name, "socketType") == 0) {
provider->recv_socket_type = xml_to_gchar(xmlNodeGetContent(node), provider);
} else if (strcmp ((gchar *)node->name, "username") == 0) {
- provider->recv_username = xml_to_gchar(xmlNodeGetContent(node), provider);
+ provider->recv_username = xml_to_gchar(xmlNodeGetContent(node), provider);
} else if (strcmp ((gchar *)node->name, "authentication") == 0) {
- provider->recv_auth = xml_to_gchar(xmlNodeGetContent(node), provider);
+ provider->recv_auth = xml_to_gchar(xmlNodeGetContent(node), provider);
}
node = node->next;
}
}
-static void
+static void
handle_outgoing (xmlNodePtr head, EmailProvider *provider)
{
xmlNodePtr node = head->children;
- provider->send_type = xml_to_gchar(xmlGetProp(head, "type"), provider);
+ provider->send_type = xml_to_gchar(xmlGetProp(head, (xmlChar *) "type"), provider);
while (node) {
if (strcmp ((gchar *)node->name, "hostname") == 0) {
@@ -150,9 +149,9 @@ handle_outgoing (xmlNodePtr head, EmailProvider *provider)
} else if (strcmp ((gchar *)node->name, "socketType") == 0) {
provider->send_socket_type = xml_to_gchar(xmlNodeGetContent(node), provider);
} else if (strcmp ((gchar *)node->name, "username") == 0) {
- provider->send_username = xml_to_gchar(xmlNodeGetContent(node), provider);
+ provider->send_username = xml_to_gchar(xmlNodeGetContent(node), provider);
} else if (strcmp ((gchar *)node->name, "authentication") == 0) {
- provider->send_auth = xml_to_gchar(xmlNodeGetContent(node), provider);
+ provider->send_auth = xml_to_gchar(xmlNodeGetContent(node), provider);
}
node = node->next;
@@ -165,7 +164,7 @@ parse_msg (SoupMessage *msg, EmailProvider *provider)
xmlDocPtr doc;
xmlNodePtr node, top;
- doc = xmlReadMemory ((xmlChar *) msg->response_body->data, msg->response_body->length, "file.xml", NULL, 0);
+ doc = xmlReadMemory (msg->response_body->data, msg->response_body->length, "file.xml", NULL, 0);
node = doc->children;
while (node) {
@@ -202,7 +201,7 @@ parse_msg (SoupMessage *msg, EmailProvider *provider)
} else if (strcmp ((gchar *)node->name, "outgoingServer") == 0) {
/* Handle Outgoing */
handle_outgoing (node, provider);
- }
+ }
node = node->next;
}
@@ -213,14 +212,13 @@ parse_msg (SoupMessage *msg, EmailProvider *provider)
gboolean
mail_guess_servers(EmailProvider *provider)
{
- const char *cafile = NULL;
- char *url;
+ const gchar *cafile = NULL;
+ gchar *url;
SoupURI *proxy = NULL, *parsed;
- int opt;
SoupMessage *msg;
SoupSession *session;
- url = g_strdup_printf("%s/%s", "https://live.mozillamessaging.com/autoconfig", provider->domain);
+ url = g_strdup_printf("%s/%s", "https://live.mozillamessaging.com/autoconfig", provider->domain);
parsed = soup_uri_new (url);
soup_uri_free (parsed);
@@ -231,7 +229,7 @@ mail_guess_servers(EmailProvider *provider)
NULL);
if (proxy) {
- g_object_set (G_OBJECT (session),
+ g_object_set (G_OBJECT (session),
SOUP_SESSION_PROXY_URI, proxy,
NULL);
}
@@ -251,8 +249,8 @@ mail_guess_servers(EmailProvider *provider)
}
#ifdef TEST
-int
-main (int argc, char **argv)
+gint
+main (gint argc, gchar **argv)
{
EmailProvider *provider;
g_thread_init (NULL);
@@ -266,10 +264,10 @@ main (int argc, char **argv)
mail_guess_servers (provider);
- printf("Recv: %s\n%s(%s), %s by %s \n Send: %s\n%s(%s), %s by %s\n via %s to %s\n",
+ printf("Recv: %s\n%s(%s), %s by %s \n Send: %s\n%s(%s), %s by %s\n via %s to %s\n",
provider->recv_type, provider->recv_hostname, provider->recv_port, provider->recv_username, provider->recv_auth,
provider->send_type, provider->send_hostname, provider->send_port, provider->send_username, provider->send_auth,
- provider->recv_socket_type, provider->send_socket_type);
+ provider->recv_socket_type, provider->send_socket_type);
return 0;
}
#endif
diff --git a/capplet/settings/mail-guess-servers.h b/capplet/settings/mail-guess-servers.h
index b1d6746a4d..84f6090ebe 100644
--- a/capplet/settings/mail-guess-servers.h
+++ b/capplet/settings/mail-guess-servers.h
@@ -10,7 +10,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -25,25 +25,25 @@
typedef struct _EmailProvider {
/* Input */
- char *domain;
- char *email;
- char *username;
+ gchar *domain;
+ gchar *email;
+ gchar *username;
/* Receiving server*/
- char *recv_type;
- char *recv_hostname;
- char *recv_port;
- char *recv_socket_type;
- char *recv_username;
- char *recv_auth;
+ gchar *recv_type;
+ gchar *recv_hostname;
+ gchar *recv_port;
+ gchar *recv_socket_type;
+ gchar *recv_username;
+ gchar *recv_auth;
/* Sending server */
- char *send_type;
- char *send_hostname;
- char *send_port;
- char *send_socket_type;
- char *send_username;
- char *send_auth;
+ gchar *send_type;
+ gchar *send_hostname;
+ gchar *send_port;
+ gchar *send_socket_type;
+ gchar *send_username;
+ gchar *send_auth;
} EmailProvider;
gboolean mail_guess_servers (EmailProvider *provider);
diff --git a/capplet/settings/mail-settings-view.c b/capplet/settings/mail-settings-view.c
index 154fd0b319..3a9864ae23 100644
--- a/capplet/settings/mail-settings-view.c
+++ b/capplet/settings/mail-settings-view.c
@@ -10,7 +10,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -50,7 +50,6 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
-
static void msv_regen_view (MailSettingsView *acview);
static void
@@ -92,7 +91,7 @@ mail_settings_view_class_init (MailSettingsViewClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
-
+
}
static void
@@ -125,19 +124,18 @@ msv_account_added (EAccountList *al, EAccount *account, MailSettingsView *msv)
#define PACK_BOX(w,s) box = gtk_hbox_new(FALSE, 0); gtk_box_pack_start((GtkBox *)box, w, FALSE, FALSE, s); gtk_widget_show(box); gtk_widget_show(w); gtk_box_pack_start((GtkBox *)acview->priv->box, box, FALSE, FALSE, 3);
-
static void
build_account_button (MailSettingsView *acview, EAccount *account)
{
GtkWidget *box, *box1, *label, *tbox, *tlabel;
- char *tmp;
-
+ gchar *tmp;
+
box1 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (box1);
label = gtk_button_new ();
tbox = gtk_hbox_new (FALSE, 0);
-
+
if (FALSE) {
tlabel = (GtkWidget *)gtk_image_new_from_stock (account ? "gtk-edit" : "gtk-new", GTK_ICON_SIZE_BUTTON);
gtk_widget_show(tlabel);
@@ -171,7 +169,7 @@ build_account_button (MailSettingsView *acview, EAccount *account)
PACK_BOX(box1,24);
}
-static void
+static void
msv_regen_view (MailSettingsView *acview)
{
struct _EAccount *account;
@@ -195,7 +193,7 @@ msv_regen_view (MailSettingsView *acview)
build_account_button (acview, NULL);
}
-void
+static void
mail_settings_view_construct (MailSettingsView *acview)
{
acview->priv->scroll = gtk_scrolled_window_new (NULL, NULL);
@@ -221,7 +219,7 @@ mail_settings_view_new ()
view->uri = "settings://";
mail_settings_view_construct (view);
-
+
return view;
}
@@ -242,30 +240,28 @@ msv_btn_expose (GtkWidget *w, GdkEventExpose *event, MailSettingsView *mfv)
static void
msv_close (GtkButton *w, MailSettingsView *mfv)
{
- g_signal_emit (mfv, signals[VIEW_CLOSE], 0);
+ g_signal_emit (mfv, signals[VIEW_CLOSE], 0);
}
-
-
GtkWidget *
mail_settings_view_get_tab_widget(MailSettingsView *mcv)
{
GdkPixbuf *pbuf = gtk_widget_render_icon ((GtkWidget *)mcv, "gtk-close", GTK_ICON_SIZE_MENU, NULL);
GtkWidget *tool, *box, *img;
- int w=-1, h=-1;
+ gint w=-1, h=-1;
GtkWidget *tab_label;
img = gtk_image_new_from_pixbuf (pbuf);
g_object_set_data ((GObject *)img, "pbuf", pbuf);
g_signal_connect (img, "expose-event", G_CALLBACK(msv_btn_expose), mcv);
-
+
tool = gtk_button_new ();
gtk_button_set_relief((GtkButton *)tool, GTK_RELIEF_NONE);
gtk_button_set_focus_on_click ((GtkButton *)tool, FALSE);
gtk_widget_set_tooltip_text (tool, _("Close Tab"));
g_signal_connect (tool, "clicked", G_CALLBACK(msv_close), mcv);
-
+
box = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start ((GtkBox *)box, img, FALSE, FALSE, 0);
gtk_container_add ((GtkContainer *)tool, box);
@@ -276,13 +272,13 @@ mail_settings_view_get_tab_widget(MailSettingsView *mcv)
box = gtk_label_new (_("Settings"));
tab_label = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start ((GtkBox *)tab_label, box, FALSE, FALSE, 0);
-#ifndef ANJAL_SETTINGS
+#ifndef ANJAL_SETTINGS
gtk_box_pack_start ((GtkBox *)tab_label, tool, FALSE, FALSE, 0);
-#endif
+#endif
gtk_widget_show_all (tab_label);
return tab_label;
-
+
}
void
diff --git a/capplet/settings/mail-settings-view.h b/capplet/settings/mail-settings-view.h
index 6a649d31ad..136e4414a2 100644
--- a/capplet/settings/mail-settings-view.h
+++ b/capplet/settings/mail-settings-view.h
@@ -10,7 +10,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -33,13 +33,12 @@
#define IS_MAIL_SETTINGS_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MAIL_SETTINGS_VIEW_TYPE))
#define MAIL_SETTINGS_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), MAIL_SETTINGS_VIEW_TYPE, MailFolderViewClass))
-
typedef struct _MailSettingsViewPrivate MailSettingsViewPrivate;
typedef struct _MailSettingsView {
GtkVBox parent;
- int type;
- char *uri;
+ gint type;
+ const gchar *uri;
MailViewFlags flags;
/* Base class of MailChildView ends */
@@ -49,10 +48,11 @@ typedef struct _MailSettingsView {
typedef struct _MailSettingsViewClass {
GtkVBoxClass parent_class;
- void (* view_close) (MailSettingsView *);
+ void (* view_close) (MailSettingsView *);
void (* show_account) (MailSettingsView *, gpointer);
} MailSettingsViewClass;
+GType mail_settings_view_get_type (void);
MailSettingsView *mail_settings_view_new (void);
GtkWidget * mail_settings_view_get_tab_widget(MailSettingsView *mcv);
void mail_settings_view_activate (MailSettingsView *mcv, GtkWidget *tree, GtkWidget *folder_tree, GtkWidget *check_mail, GtkWidget *sort_by, GtkWidget *slider, gboolean act);
diff --git a/capplet/settings/mail-view.c b/capplet/settings/mail-view.c
index cb6afb659d..84214888a9 100644
--- a/capplet/settings/mail-view.c
+++ b/capplet/settings/mail-view.c
@@ -10,7 +10,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -36,9 +36,6 @@
#include "mail-settings-view.h"
-#if HAVE_ANERLEY
-# include "mail-people-view.h"
-#endif
#include "anjal-mail-view.h"
#include "mail-account-view.h"
#include "mail/em-folder-tree.h"
@@ -61,19 +58,17 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
-#undef MV_NEW_TAB
-
G_DEFINE_TYPE (MailView, mail_view, ANJAL_MAIL_VIEW_TYPE)
#ifndef ANJAL_SETTINGS
-static MailConvView * mv_switch_message_view (MailView *mv, const char *uri);
+static MailConvView * mv_switch_message_view (MailView *mv, const gchar *uri);
#endif
#define REALIGN_NODES(list,pdata) if (list->data != pdata) { \
list = g_list_remove (list, pdata); \
list = g_list_prepend (list, pdata); \
}
-
-void anjal_shell_view_restore_state (EShellView *view, const char *uri);
+
+void anjal_shell_view_restore_state (EShellView *view, const gchar *uri);
static void
mail_view_init (MailView *shell)
@@ -91,17 +86,17 @@ mail_view_finalize (GObject *object)
{
MailView *shell = (MailView *)object;
MailViewPrivate *priv = shell->priv;
-
+
g_list_free (priv->children);
g_free (priv);
-
+
G_OBJECT_CLASS (mail_view_parent_class)->finalize (object);
}
static void
-mv_set_folder_uri (AnjalMailView *mv, const char *uri)
+mv_set_folder_uri (AnjalMailView *mv, const gchar *uri)
{
-#ifndef ANJAL_SETTINGS
+#ifndef ANJAL_SETTINGS
mail_view_set_folder_uri ((MailView *)mv, uri);
#endif
}
@@ -112,11 +107,11 @@ static void set_folder_tree (AnjalMailView *mv, EMFolderTree *tree)
}
static void
-set_search (AnjalMailView *mv, const char *search)
+set_search (AnjalMailView *mv, const gchar *search)
{
-#ifndef ANJAL_SETTINGS
+#ifndef ANJAL_SETTINGS
mail_view_set_search ((MailView *)mv, search);
-#endif
+#endif
}
static void
@@ -142,125 +137,48 @@ mail_view_class_init (MailViewClass *klass)
};
-#ifdef MV_NEW_TAB
-static void
-mv_new_page (GtkButton *w, MailView *mv)
-{
- mail_view_add_page (mv, MAIL_VIEW_FOLDER, NULL);
- gtk_notebook_set_current_page (mv, g_list_length (mv->priv->children)-1);
-}
-#endif
-
static void
mv_switch (GtkNotebook *notebook,GtkNotebookPage *page, guint page_num, gpointer user_data)
{
MailView *shell = (MailView *)notebook;
MailViewPrivate *priv = shell->priv;
MailViewChild *curr = priv->current_view;
+ MailViewChild *child;
+ gint current_child = gtk_notebook_get_current_page (notebook);
curr->flags &= ~MAIL_VIEW_HOLD_FOCUS;
-
-#ifdef MV_NEW_TAB
- if (page_num == g_list_length(priv->children) && shell->priv->new) {
- mail_view_add_page (shell, MAIL_VIEW_FOLDER, NULL);
- gtk_notebook_set_current_page (shell, g_list_length (shell->priv->children)-1);
- } else {
-#endif
- MailViewChild *child;
- int current_child = gtk_notebook_get_current_page (notebook);
-
- child = (MailViewChild *)gtk_notebook_get_nth_page (notebook, current_child);
-
- priv->current_view = child;
- REALIGN_NODES(shell->priv->children,child);
-
-#ifndef ANJAL_SETTINGS
- if (child->type == MAIL_VIEW_COMPOSER)
- mail_composer_view_activate ((MailComposerView *)child, shell->folder_tree, shell->check_mail, shell->sort_by, TRUE);
- else if (child->type == MAIL_VIEW_MESSAGE)
- mail_conv_view_activate ((MailConvView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, FALSE);
- else if (child->type == MAIL_VIEW_FOLDER) {
- mail_folder_view_activate ((MailFolderView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, shell->slider, TRUE);
- anjal_shell_view_restore_state (shell->shell_view, child->uri);
- } else if (child->type == MAIL_VIEW_ACCOUNT)
- mail_account_view_activate ((MailAccountView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, FALSE);
- else if (child->type == MAIL_VIEW_SETTINGS)
- mail_settings_view_activate ((MailSettingsView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, shell->slider, FALSE);
-#else
- if (child->type == MAIL_VIEW_ACCOUNT)
- mail_account_view_activate ((MailAccountView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, FALSE);
- else if (child->type == MAIL_VIEW_SETTINGS)
- mail_settings_view_activate ((MailSettingsView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, shell->slider, FALSE);
-#endif
-#if HAVE_ANERLEY
- else if (child->type == MAIL_VIEW_PEOPLE)
- mail_people_view_activate ((MailPeopleView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, shell->slider, FALSE);
-#endif
-
-
-
-#ifdef MV_NEW_TAB
- }
-#endif
-}
+ child = (MailViewChild *)gtk_notebook_get_nth_page (notebook, current_child);
-#ifdef MV_NEW_TAB
-static gboolean
-mv_btn_expose (GtkWidget *w, GdkEventExpose *event, MailView *mv)
-{
- GdkPixbuf *img = g_object_get_data (w, "pbuf");
- cairo_t *cr = gdk_cairo_create (w->window);
- int wid = w->allocation.width;
- int heig = w->allocation.height;
- cairo_save (cr);
- gdk_cairo_set_source_pixbuf (cr, img, event->area.x-4, event->area.y-5);
- cairo_paint(cr);
- cairo_restore(cr);
- cairo_destroy (cr);
+ priv->current_view = child;
+ REALIGN_NODES(shell->priv->children,child);
- return TRUE;
+#ifndef ANJAL_SETTINGS
+ if (child->type == MAIL_VIEW_COMPOSER)
+ mail_composer_view_activate ((MailComposerView *)child, shell->folder_tree, shell->check_mail, shell->sort_by, TRUE);
+ else if (child->type == MAIL_VIEW_MESSAGE)
+ mail_conv_view_activate ((MailConvView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, FALSE);
+ else if (child->type == MAIL_VIEW_FOLDER) {
+ mail_folder_view_activate ((MailFolderView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, shell->slider, TRUE);
+ anjal_shell_view_restore_state (shell->shell_view, child->uri);
+ } else if (child->type == MAIL_VIEW_ACCOUNT)
+ mail_account_view_activate ((MailAccountView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, FALSE);
+ else if (child->type == MAIL_VIEW_SETTINGS)
+ mail_settings_view_activate ((MailSettingsView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, shell->slider, FALSE);
+#else
+ if (child->type == MAIL_VIEW_ACCOUNT)
+ mail_account_view_activate ((MailAccountView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, FALSE);
+ else if (child->type == MAIL_VIEW_SETTINGS)
+ mail_settings_view_activate ((MailSettingsView *)child, shell->tree, shell->folder_tree, shell->check_mail, shell->sort_by, shell->slider, FALSE);
+#endif
}
static void
-mv_new_tab_button (MailView *shell)
-{
- int position;
- GtkWidget *label = gtk_button_new (), *img;
- GdkPixbuf *pbuf = e_icon_factory_get_icon ("gtk-add", E_ICON_SIZE_MENU);
- GtkWidget *box = gtk_hbox_new (FALSE, 0);
- int w,h;
-
- img = gtk_image_new_from_pixbuf (pbuf);
- g_object_set_data (img, "pbuf", pbuf);
- g_signal_connect (img, "expose-event", mv_btn_expose, shell);
- g_signal_connect (label, "clicked", G_CALLBACK(mv_new_page), shell);
- gtk_button_set_image (label, img);
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings(label) , GTK_ICON_SIZE_MENU, &w, &h);
- gtk_widget_set_size_request (label, w+2, h+2);
-
- gtk_button_set_relief(label, GTK_RELIEF_NONE);
- gtk_button_set_focus_on_click (label, FALSE);
- gtk_widget_set_tooltip_text (label, _("New Tab"));
- gtk_widget_show_all (label);
- gtk_widget_show (box);
- shell->priv->new = box;
- position = gtk_notebook_append_page (shell, box, label);
- gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (shell), box, FALSE);
- gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (shell), box, FALSE);
-
-}
-#endif
-
-void
mail_view_construct (MailView *shell)
{
gtk_notebook_set_show_tabs ((GtkNotebook *)shell, TRUE);
gtk_notebook_set_scrollable ((GtkNotebook *)shell, TRUE);
gtk_notebook_popup_disable ((GtkNotebook *)shell);
-#ifdef MV_NEW_TAB
- mv_new_tab_button (shell);
-#endif
g_signal_connect_after (shell, "switch-page", G_CALLBACK(mv_switch), shell);
}
@@ -269,42 +187,14 @@ mail_view_new ()
{
MailView *shell = g_object_new (MAIL_VIEW_TYPE, NULL);
mail_view_construct (shell);
-
- return shell;
-}
-
-static void
-mv_message_shown (MailViewChild *mfv, MailView *mv)
-{
- GtkWidget *arr;
-
- if (!mv->slider)
- return;
-
- arr = g_object_get_data ((GObject *)mv->slider, "right-arrow");
- //gtk_widget_hide (mv->folder_tree);
- gtk_widget_show (arr);
- gtk_widget_show (mv->slider);
-}
-
-static int
-list_data_pos (GList *list, gpointer data)
-{
- int i=-1;
- while (list) {
- i++;
- if (list->data == data)
- return i;
- list = list->next;
- }
- return i;
+ return shell;
}
-static int
+static gint
mv_get_page_number (GtkNotebook *note, GtkWidget *widget)
{
- int i, total;
+ gint i, total;
total = gtk_notebook_get_n_pages (note);
for (i=0; i<total; i++) {
@@ -318,15 +208,15 @@ mv_get_page_number (GtkNotebook *note, GtkWidget *widget)
static void
mv_close_mcv (MailViewChild *mfv, MailView *mv)
{
- int n = mv_get_page_number ((GtkNotebook *)mv, (GtkWidget *)mfv);
- int pos = gtk_notebook_get_current_page ((GtkNotebook *)mv);
+ gint n = mv_get_page_number ((GtkNotebook *)mv, (GtkWidget *)mfv);
+ gint pos = gtk_notebook_get_current_page ((GtkNotebook *)mv);
MailViewChild *child;
gboolean removing_viewed = FALSE;
if (g_list_length(mv->priv->children) == 1)
return;
-#ifndef ANJAL_SETTINGS
+#ifndef ANJAL_SETTINGS
/* Make sure atleast one folder view is open. */
if (mfv->type == MAIL_VIEW_FOLDER) {
GList *tmp = mv->priv->children;
@@ -348,12 +238,12 @@ mv_close_mcv (MailViewChild *mfv, MailView *mv)
if (!mail_composer_view_can_quit((MailComposerView *)mfv))
return;
}
-#endif
+#endif
g_signal_handlers_block_by_func(mv, mv_switch, mv);
gtk_notebook_remove_page ((GtkNotebook *)mv, n);
g_signal_handlers_unblock_by_func(mv, mv_switch, mv);
-
+
if (mfv == mv->priv->children->data)
removing_viewed = TRUE;
mv->priv->children = g_list_remove (mv->priv->children, mfv);
@@ -366,7 +256,7 @@ mv_close_mcv (MailViewChild *mfv, MailView *mv)
pos = mv_get_page_number ((GtkNotebook *)mv, (GtkWidget *)child);
gtk_notebook_set_current_page ((GtkNotebook *)mv, pos);
-#ifndef ANJAL_SETTINGS
+#ifndef ANJAL_SETTINGS
if (child->type == MAIL_VIEW_COMPOSER)
mail_composer_view_activate ((MailComposerView *)child, mv->folder_tree, mv->check_mail, mv->sort_by, TRUE);
else if (child->type == MAIL_VIEW_MESSAGE)
@@ -374,7 +264,6 @@ mv_close_mcv (MailViewChild *mfv, MailView *mv)
else if (child->type == MAIL_VIEW_FOLDER) {
mail_folder_view_activate ((MailFolderView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, TRUE);
anjal_shell_view_restore_state ((EShellView *)mv->shell_view, child->uri);
- //mail_search_set_state (mv->priv->search, ((MailFolderView *)child)->search_str, ((MailFolderView *)child)->search_state);
} else if (child->type == MAIL_VIEW_ACCOUNT)
mail_account_view_activate ((MailAccountView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
else if (child->type == MAIL_VIEW_SETTINGS)
@@ -384,22 +273,17 @@ mv_close_mcv (MailViewChild *mfv, MailView *mv)
mail_account_view_activate ((MailAccountView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
else if (child->type == MAIL_VIEW_SETTINGS)
mail_settings_view_activate ((MailSettingsView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
-
-#endif
-#if HAVE_ANERLEY
- else if (child->type == MAIL_VIEW_PEOPLE)
- mail_people_view_activate ((MailPeopleView *)child, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
-#endif
+#endif
}
#ifndef ANJAL_SETTINGS
static void
-mv_message_new (MailFolderView *mfv, gpointer data, char *umid, MailView *mv)
+mv_message_new (MailFolderView *mfv, gpointer data, gchar *umid, MailView *mv)
{
MailConvView *conv = (MailConvView *)mv_switch_message_view(mv, umid);
*(MailConvView **)data = conv;
-
+
if (conv)
conv->uri = g_strdup(umid);
@@ -410,7 +294,6 @@ static void
mv_search_set (MailFolderView *mfv, MailView *mv)
{
anjal_shell_view_restore_state (mv->shell_view, ((MailViewChild *)mfv)->uri);
- //mail_search_set_state (mv->priv->search, mfv->search_str, mfv->search_state);
}
static void
@@ -426,7 +309,7 @@ mail_view_add_folder (MailView *mv, gpointer data, gboolean block)
MailFolderView *mfv = mail_folder_view_new ();
gint position = 0;
mail_folder_view_set_folder_pane (mfv, mv->folder_tree);
- if(!block)
+ if (!block)
mv->priv->current_view = (MailViewChild *)mfv;
mv->priv->children = block ? g_list_append(mv->priv->children, mfv) : g_list_prepend (mv->priv->children, mfv);
position = gtk_notebook_append_page ((GtkNotebook *)mv, (GtkWidget *)mfv, mfv->tab_label);
@@ -464,17 +347,17 @@ mail_view_add_composer (MailView *mv, gpointer data, gboolean block)
if (!block)
mv->priv->current_view = (MailViewChild *)mcv;
mv->priv->children = block ? g_list_append(mv->priv->children, mcv) : g_list_prepend (mv->priv->children, mcv);
-
- if (!special)
- position = gtk_notebook_append_page ((GtkNotebook *)mv, (GtkWidget *)mcv, mcv->tab_label);
+
+ if (!special)
+ position = gtk_notebook_append_page ((GtkNotebook *)mv, (GtkWidget *)mcv, mcv->tab_label);
else {
- int position = gtk_notebook_get_current_page ((GtkNotebook *)mv);
+ gint position = gtk_notebook_get_current_page ((GtkNotebook *)mv);
gtk_notebook_insert_page ((GtkNotebook *)mv, (GtkWidget *)mcv, mcv->tab_label, position+1);
}
gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (mv), (GtkWidget *)mcv, TRUE);
gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *)mcv, FALSE);
- if (!block)
+ if (!block)
gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)mcv, FALSE, FALSE, 0);
if (!block)
@@ -483,7 +366,6 @@ mail_view_add_composer (MailView *mv, gpointer data, gboolean block)
g_signal_connect (mcv, "view-close", G_CALLBACK(mv_close_mcv), mv);
g_signal_connect (mcv, "message-shown", G_CALLBACK(mv_message_shown), mv);
- //mv_message_shown ((MailViewChild *)mcv, mv);
return (MailViewChild *)mcv;
}
@@ -495,10 +377,10 @@ mail_view_add_message (MailView *mv, gpointer data, gboolean block)
gtk_widget_show ((GtkWidget *)mcv);
mcv->type = MAIL_VIEW_MESSAGE;
- if(!block)
+ if (!block)
mv->priv->current_view = (MailViewChild *)mcv;
mv->priv->children = block ? g_list_append(mv->priv->children, mcv) : g_list_prepend (mv->priv->children, mcv);
-
+
position = gtk_notebook_get_current_page ((GtkNotebook *)mv);
gtk_notebook_insert_page ((GtkNotebook *)mv, (GtkWidget *)mcv, mail_conv_view_get_tab_widget(mcv), position+1);
gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (mv), (GtkWidget *)mcv, TRUE);
@@ -511,7 +393,7 @@ mail_view_add_message (MailView *mv, gpointer data, gboolean block)
g_signal_connect (mcv, "view-close", G_CALLBACK(mv_close_mcv), mv);
g_signal_connect (mcv, "message-shown", G_CALLBACK(mv_message_shown), mv);
-
+
return (MailViewChild *)mcv;
}
@@ -528,9 +410,9 @@ mail_view_add_settings (MailView *mv, gpointer data, gboolean block)
{
MailSettingsView *msv = mail_settings_view_new ();
gint position = 0;
-
+
gtk_widget_show ((GtkWidget *)msv);
- if(!block)
+ if (!block)
mv->priv->current_view = (MailViewChild *)msv;
mv->priv->children = block ? g_list_append(mv->priv->children, msv) : g_list_prepend (mv->priv->children, msv);
@@ -541,69 +423,29 @@ mail_view_add_settings (MailView *mv, gpointer data, gboolean block)
gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *)msv, FALSE);
if (!block)
gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
- gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)msv, FALSE, FALSE, 0);
- if(!block)
+ if (!block)
mail_settings_view_activate (msv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
return (MailViewChild *)msv;
}
-#if HAVE_ANERLEY
-void
-mail_view_switch_to_people (MailView* mv, MailViewChild *mpv)
-{
- GList *tmp = mv->priv->children;
- int position = 0;
-
- position = mv_get_page_number(mv, mpv);
- REALIGN_NODES(mv->priv->children,mpv);
- gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
- mail_people_view_activate ((MailPeopleView *)mpv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
-}
-#endif
-
void
mail_view_switch_to_settings (MailView* mv, MailViewChild *mpv)
{
- int position = 0;
+ gint position = 0;
position = mv_get_page_number((GtkNotebook *)mv, (GtkWidget *)mpv);
- REALIGN_NODES(mv->priv->children,mpv);
+ REALIGN_NODES(mv->priv->children,mpv);
gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
mail_settings_view_activate ((MailSettingsView *)mpv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
}
-
-#if HAVE_ANERLEY
-static MailViewChild *
-mail_view_add_people (MailView *mv, gpointer data, gboolean block)
-{
- MailPeopleView *msv = mail_people_view_new ();
- gint position = 0;
-
- gtk_widget_show ((GtkWidget *)msv);
- if (!block)
- mv->priv->current_view = (MailViewChild *)msv;
- mv->priv->children = block ? g_list_append(mv->priv->children, msv) : g_list_prepend (mv->priv->children, msv);
- position = gtk_notebook_append_page ((GtkNotebook *)mv, (GtkWidget *)msv, mail_people_view_get_tab_widget(msv));
- g_signal_connect (msv, "view-close", G_CALLBACK(mv_close_mcv), mv);
- gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (mv), (GtkWidget *)msv, TRUE);
- gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *)msv, FALSE);
- if (!block)
- gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
- gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)msv, FALSE, FALSE, 0);
- if(!block)
- mail_people_view_activate (msv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, mv->slider, FALSE);
-
- return (MailViewChild *)msv;
-}
-#endif
static MailViewChild *
mail_view_add_account (MailView *mv, gpointer data, gboolean block)
{
MailAccountView *msv = mail_account_view_new (data);
gint position = 0;
-
+
gtk_widget_show ((GtkWidget *)msv);
if (!block)
mv->priv->current_view = (MailViewChild *)msv;
@@ -612,10 +454,9 @@ mail_view_add_account (MailView *mv, gpointer data, gboolean block)
g_signal_connect_after (msv, "view-close", G_CALLBACK(mv_close_mcv), mv);
gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (mv), (GtkWidget *)msv, TRUE);
gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *)msv, FALSE);
- if(!block)
+ if (!block)
gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
- gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)msv, FALSE, FALSE, 0);
- if(!block)
+ if (!block)
mail_account_view_activate (msv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
return (MailViewChild *)msv;
@@ -626,14 +467,14 @@ mail_view_add_page (MailView *mv, guint16 type, gpointer data)
{
MailViewChild *child = NULL, *current_child;
gboolean block = FALSE;
-
+
current_child = mv->priv->current_view;
if (current_child && (current_child->flags & MAIL_VIEW_HOLD_FOCUS))
block = TRUE;
-
+
g_signal_handlers_block_by_func(mv, mv_switch, mv);
- switch (type){
-#ifndef ANJAL_SETTINGS
+ switch (type) {
+#ifndef ANJAL_SETTINGS
case MAIL_VIEW_FOLDER:
child = mail_view_add_folder (mv, data, block);
break;
@@ -644,47 +485,37 @@ mail_view_add_page (MailView *mv, guint16 type, gpointer data)
case MAIL_VIEW_MESSAGE:
child = mail_view_add_message (mv, data, block);
break;
-#endif
+#endif
case MAIL_VIEW_SETTINGS:
child = mail_view_add_settings (mv, data, block);
break;
-#if HAVE_ANERLEY
- case MAIL_VIEW_PEOPLE:
- child = mail_view_add_people (mv, data, block);
- break;
-#endif
case MAIL_VIEW_ACCOUNT:
child = mail_view_add_account (mv, data, block);
- break;
+ break;
}
gtk_widget_grab_focus((GtkWidget *)child);
child->type = type;
-#ifdef MV_NEW_TAB
- gtk_notebook_reorder_child (mv, mv->priv->new, -1);
- gtk_notebook_set_current_page (mv, g_list_length (mv->priv->children)-1);
-#endif
g_signal_handlers_unblock_by_func(mv, mv_switch, mv);
child->flags = 0;
-
+
return child;
}
#ifndef ANJAL_SETTINGS
static void
-mv_switch_folder_view (MailView *mv, const char *uri)
+mv_switch_folder_view (MailView *mv, const gchar *uri)
{
- int i=0, len = g_list_length(mv->priv->children);
+ gint i=0, len = g_list_length(mv->priv->children);
GList *tmp = mv->priv->children;
while (i<len) {
MailViewChild *child = (MailViewChild *)gtk_notebook_get_nth_page ((GtkNotebook *)mv, i);
if (child->type == MAIL_VIEW_FOLDER && !strcmp (uri, child->uri)) {
- if(child != mv->priv->current_view) {
+ if (child != mv->priv->current_view) {
gtk_notebook_set_current_page ((GtkNotebook *)mv, i);
- //REALIGN_NODES(mv->priv->children, child);
- }
- return;
+ }
+ return;
}
i++;
tmp = tmp->next;
@@ -695,9 +526,9 @@ mv_switch_folder_view (MailView *mv, const char *uri)
}
static MailConvView *
-mv_switch_message_view (MailView *mv, const char *uri)
+mv_switch_message_view (MailView *mv, const gchar *uri)
{
- int i=0;
+ gint i=0;
GList *tmp = mv->priv->children;
while (tmp) {
MailViewChild *child = tmp->data;
@@ -715,11 +546,10 @@ mv_switch_message_view (MailView *mv, const char *uri)
}
void
-mail_view_set_folder_uri (MailView *mv, const char *uri)
+mail_view_set_folder_uri (MailView *mv, const gchar *uri)
{
-
+
mv_switch_folder_view (mv, uri);
- //mail_folder_view_set_folder_uri (mv->priv->current_view, uri);
}
void
@@ -738,7 +568,6 @@ mail_view_show_list (MailView *mv)
else if (child->type == MAIL_VIEW_FOLDER)
mail_folder_view_show_list ((MailFolderView *)mv->priv->current_view);
-
}
#endif
void
@@ -777,36 +606,10 @@ mail_view_set_folder_tree_widget (MailView *mv, GtkWidget *tree)
mv->folder_tree = tree;
}
-#if 0
-static gboolean
-mv_tree_click_cb (GtkWidget *w, GdkEventButton *event, MailView *mv)
-{
- if ((event->button == 1 && event->type == GDK_2BUTTON_PRESS) || event->button == 2) {
- GtkTreeSelection *selection;
- GtkTreePath *tree_path;
-
- if (!gtk_tree_view_get_path_at_pos ((GtkTreeView *)w, (int) event->x, (int) event->y, &tree_path, NULL, NULL, NULL))
- return FALSE;
- mail_view_add_page (mv, MAIL_VIEW_FOLDER, NULL);
- gtk_notebook_set_current_page ((GtkNotebook *)mv, g_list_length (mv->priv->children)-1);
- selection = gtk_tree_view_get_selection ((GtkTreeView *)w);
- gtk_tree_selection_unselect_path (selection, tree_path);
- gtk_tree_selection_select_path(selection, tree_path);
- gtk_tree_view_set_cursor ((GtkTreeView *)w, tree_path, NULL, FALSE);
-
-
- return TRUE;
- }
- return FALSE;
-}
-#endif
-
void
mail_view_set_folder_tree (MailView *mv, GtkWidget *tree)
{
mv->tree = tree;
- //em_folder_tree_set_skip_double_click ((EMFolderTree *)tree, FALSE);
- //g_signal_connect ((GObject *)em_folder_tree_get_tree_view((EMFolderTree *)tree), "button-press-event", G_CALLBACK(mv_tree_click_cb), mv);
}
void
@@ -821,46 +624,29 @@ mail_view_set_sort_by (MailView *mv, GtkWidget *button)
mv->sort_by = button;;
}
-static void
-mv_spinner_show (MailView *mv, gboolean show)
-{
- GtkWidget *spinner = g_object_get_data ((GObject *)mv->check_mail, "spinner");
- GtkWidget *icon = g_object_get_data ((GObject *)mv->check_mail, "icon");
-
- if(show) {
- gtk_widget_show (spinner);
- gtk_widget_hide(icon);
- gtk_button_set_relief ((GtkButton *)mv->check_mail, GTK_RELIEF_NORMAL);
-
- } else {
- gtk_widget_show (icon);
- gtk_widget_hide(spinner);
- gtk_button_set_relief ((GtkButton *)mv->check_mail, GTK_RELIEF_NONE);
- }
-}
-
+#ifndef ANJAL_SETTINGS
static void
mv_spinner_done (CamelFolder *f, gpointer data)
{
MailView *mv = (MailView *)data;
mv_spinner_show (mv, FALSE);
}
-#ifndef ANJAL_SETTINGS
+
void
mail_view_check_mail(MailView *mv, gboolean deep)
{
MailViewChild *child = (MailViewChild *)mv->priv->current_view;
-
+
if (child && child->type == MAIL_VIEW_FOLDER) {
mail_folder_view_check_mail ((MailFolderView *)child);
CamelFolder *folder;
-
+
if ((folder = em_folder_tree_get_selected_folder ((EMFolderTree *)mv->tree)) != NULL) {
mv_spinner_show (mv, TRUE);
mail_refresh_folder(folder, mv_spinner_done, mv);
}
}
-
+
if (deep) {
em_utils_clear_get_password_canceled_accounts_flag ();
mail_send_receive (NULL);
@@ -883,7 +669,7 @@ mail_view_save (MailView *mv)
}
void
-mail_view_set_search (MailView *mv, const char *search)
+mail_view_set_search (MailView *mv, const gchar *search)
{
MailViewChild *child = (MailViewChild *)mv->priv->current_view;
diff --git a/capplet/settings/mail-view.h b/capplet/settings/mail-view.h
index 339d690c43..b76a425bbe 100644
--- a/capplet/settings/mail-view.h
+++ b/capplet/settings/mail-view.h
@@ -10,7 +10,7 @@
* 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/>
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*
* Authors:
@@ -52,7 +52,7 @@ typedef struct _MailView {
GtkWidget *folder_tree;
GtkWidget *slider;
GtkWidget *check_mail;
- GtkWidget *sort_by;
+ GtkWidget *sort_by;
MailViewPrivate *priv;
EShellView *shell_view;
} MailView;
@@ -60,7 +60,7 @@ typedef struct _MailView {
typedef struct _MailViewClass {
AnjalMailViewClass parent_class;
void (* view_new) (MailView*);
-
+
} MailViewClass;
typedef enum {
@@ -69,13 +69,14 @@ typedef enum {
typedef struct _MailViewChild {
GtkVBox parent;
- int type;
- char *uri;
+ gint type;
+ gchar *uri;
MailViewFlags flags;
}MailViewChild;
+GType mail_view_get_type (void);
MailView * mail_view_new (void);
-void mail_view_set_folder_uri (MailView *mv, const char *uri);
+void mail_view_set_folder_uri (MailView *mv, const gchar *uri);
void mail_view_show_sort_popup (MailView *mv, GtkWidget *);
void mail_view_show_list (MailView *mv);
void mail_view_close_view (MailView *mv);
@@ -86,7 +87,7 @@ void mail_view_set_folder_tree_widget (MailView *mv, GtkWidget *tree);
void mail_view_set_folder_tree (MailView *mv, GtkWidget *tree);
void mail_view_save (MailView *mv);
MailViewChild * mail_view_add_page (MailView *mv, guint16 type, gpointer data);
-void mail_view_set_search (MailView *view, const char *search);
+void mail_view_set_search (MailView *view, const gchar *search);
void mail_view_set_slider (MailView *mv, GtkWidget *slider);
void mail_view_init_search (MailView *mv, GtkWidget *search);
void mail_view_switch_to_people (MailView* mv, MailViewChild *mpv);