From fd017fc993a6a71eb96ca67a63621cc1e21c138d Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Mon, 28 Aug 2000 14:58:25 +0000 Subject: Display the number of messages downloaded starting from one instead of zero. Improve the behavior of the mail view in a separate window by reusing the same size as the last resize (we could have a better policy, but this should be enough for now). Also, create the toolbar the right way so that we respect the global GNOME settings without doing it manually. svn path=/trunk/; revision=5075 --- mail/ChangeLog | 18 ++++++++++++++++++ mail/mail-tools.c | 2 +- mail/mail-view.c | 45 ++++++++++++++++++++++++++++++--------------- 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index fd9ab2082b..319ac75258 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,21 @@ +2000-08-28 Ettore Perazzoli + + * mail-view.c (mail_view_create): Use `gnome_app_set_toolbar()' + the easy way instead of doing things manually with `GnomeDock' and + `gnome_app_add_toolbar()'. + (MINIMUM_WIDTH): New #define. + (MINIMUM_HEIGHT): New #define. + (view_size_allocate_cb): New, callback for the "size_allocate" + signal of the mail view. It saves the last allocation in a static + `last_allocation' variable. + (mail_view_create): Connect it. + (set_default_size): New function. Set the default width/height to + the last allocation width/height; if the width/height is less than + the `MINIUM_WIDTH' or `MINIMUM_HEIGHT', use that value instead. + + * mail-tools.c (mail_tool_move_folder_contents): Show `i + 1', not + `i', so that we correctlly start counting from one instead of zero. + 2000-08-28 Peter Williams * *.c: s,mail_dialog_run,gnome_dialog_run,g. diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 62da0dade8..b540c595e2 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -310,7 +310,7 @@ mail_tool_move_folder_contents (CamelFolder *source, CamelFolder *dest, gboolean /* Info */ - mail_op_set_message ("Retrieving message %d of %d", i, uids->len); + mail_op_set_message ("Retrieving message %d of %d", i + 1, uids->len); /* Get the message */ diff --git a/mail/mail-view.c b/mail/mail-view.c index 065386f4ff..989d1a2a3a 100644 --- a/mail/mail-view.c +++ b/mail/mail-view.c @@ -32,6 +32,12 @@ typedef struct mail_view_data_s { MailDisplay *md; } mail_view_data; +#define MINIMUM_WIDTH 600 +#define MINIMUM_HEIGHT 400 + +/* Size of the window last time it was changed. */ +static GtkAllocation last_allocation = { 0, 0 }; + static void mail_view_data_free (gpointer mvd) { @@ -127,6 +133,13 @@ view_delete_msg (GtkWidget *button, gpointer user_data) CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED); } +static void +view_size_allocate_cb (GtkWidget *widget, + GtkAllocation *allocation) +{ + last_allocation = *allocation; +} + static GnomeUIInfo mail_view_toolbar [] = { /*GNOMEUIINFO_ITEM_STOCK (N_("Save"), N_("Save this message"), @@ -175,13 +188,23 @@ static GnomeUIInfo mail_view_menubar[] = GNOMEUIINFO_END }; +static void +set_default_size (GtkWidget *widget) +{ + int width, height; + + width = MAX (MINIMUM_WIDTH, last_allocation.width); + height = MAX (MINIMUM_HEIGHT, last_allocation.height); + + gtk_window_set_default_size (GTK_WINDOW (widget), width, height); +} + GtkWidget * mail_view_create (CamelFolder *source, const char *uid, CamelMimeMessage *msg) { GtkWidget *window; GtkWidget *toolbar; GtkWidget *mail_display; - GnomeDockItemBehavior behavior; char *subject; mail_view_data *data; @@ -199,16 +222,7 @@ mail_view_create (CamelFolder *source, const char *uid, CamelMimeMessage *msg) mail_view_toolbar, NULL, data); - behavior = GNOME_DOCK_ITEM_BEH_NORMAL; - if (!gnome_preferences_get_toolbar_detachable ()) - behavior |= GNOME_DOCK_ITEM_BEH_LOCKED; - - gnome_app_add_toolbar (GNOME_APP (window), - GTK_TOOLBAR (toolbar), - GNOME_APP_TOOLBAR_NAME, - behavior, - GNOME_DOCK_TOP, 1, 0, 0); - + gnome_app_set_toolbar (GNOME_APP (window), GTK_TOOLBAR (toolbar)); gnome_app_create_menus (GNOME_APP (window), mail_view_menubar); gtk_object_set_data_full (GTK_OBJECT (window), "mvd", data, @@ -234,11 +248,12 @@ mail_view_create (CamelFolder *source, const char *uid, CamelMimeMessage *msg) mail_display_set_message (MAIL_DISPLAY (mail_display), CAMEL_MEDIUM (msg)); data->md = MAIL_DISPLAY (mail_display); gnome_app_set_contents (GNOME_APP (window), mail_display); - - gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); + gtk_signal_connect (GTK_OBJECT (window), "size_allocate", + GTK_SIGNAL_FUNC (view_size_allocate_cb), NULL); + + set_default_size (window); + return window; } - - -- cgit v1.2.3