diff options
Diffstat (limited to 'capplet/settings/mail-capplet-shell.c')
-rw-r--r-- | capplet/settings/mail-capplet-shell.c | 169 |
1 files changed, 27 insertions, 142 deletions
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); |