balsa r7829 - in trunk: . libbalsa src



Author: PeterB
Date: Wed Jan  9 15:39:55 2008
New Revision: 7829
URL: http://svn.gnome.org/viewvc/balsa?rev=7829&view=rev

Log:
remember source viewer size and add horizontal scrolling

Modified:
   trunk/ChangeLog
   trunk/libbalsa/libbalsa.h
   trunk/libbalsa/source-viewer.c
   trunk/src/balsa-app.h
   trunk/src/balsa-index.c
   trunk/src/main-window.c
   trunk/src/message-window.c
   trunk/src/save-restore.c

Modified: trunk/libbalsa/libbalsa.h
==============================================================================
--- trunk/libbalsa/libbalsa.h	(original)
+++ trunk/libbalsa/libbalsa.h	Wed Jan  9 15:39:55 2008
@@ -103,7 +103,8 @@
 
 void libbalsa_show_message_source(LibBalsaMessage * msg,
                                   const gchar * font,
-                                  gboolean *escape_specials);
+                                  gboolean *escape_specials,
+                                  gint * width, gint * height);
 gchar *libbalsa_rot(const gchar * pass);
 
 gchar *libbalsa_guess_email_address(void);

Modified: trunk/libbalsa/source-viewer.c
==============================================================================
--- trunk/libbalsa/source-viewer.c	(original)
+++ trunk/libbalsa/source-viewer.c	Wed Jan  9 15:39:55 2008
@@ -109,6 +109,8 @@
     GtkWidget *text;
     GtkWidget *window;
     gboolean *escape_specials;
+    gint *width;
+    gint *height;
 };
 
 typedef struct _LibBalsaSourceViewerInfo LibBalsaSourceViewerInfo;
@@ -226,9 +228,22 @@
     return menubar;
 }
 
+static void
+lsv_size_allocate_cb(GtkWindow * window, GtkAllocation * alloc,
+                     LibBalsaSourceViewerInfo * lsvi)
+{
+    if (GTK_WIDGET_REALIZED(lsvi->window)
+        && !(gdk_window_get_state(lsvi->window->window)
+             & GDK_WINDOW_STATE_MAXIMIZED)) {
+        *lsvi->width  = alloc->width;
+        *lsvi->height = alloc->height;
+    }
+}
+
 void
 libbalsa_show_message_source(LibBalsaMessage* msg, const gchar * font,
-			     gboolean* escape_specials)
+			     gboolean* escape_specials,
+                             gint * width, gint * height)
 {
     GtkWidget *text;
     PangoFontDescription *desc;
@@ -252,14 +267,15 @@
     interior = gtk_scrolled_window_new(GTK_TEXT_VIEW(text)->hadjustment,
                                        GTK_TEXT_VIEW(text)->vadjustment);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(interior),
-                                   GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+                                   GTK_POLICY_AUTOMATIC,
+                                   GTK_POLICY_ALWAYS);
     gtk_container_add(GTK_CONTAINER(interior), GTK_WIDGET(text));
 
     window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     gtk_window_set_title(GTK_WINDOW(window), _("Message Source"));
     g_object_set_data(G_OBJECT(window), "text", text);
     gtk_window_set_wmclass(GTK_WINDOW(window), "message-source", "Balsa");
-    gtk_window_set_default_size(GTK_WINDOW(window), 500, 400);
+    gtk_window_set_default_size(GTK_WINDOW(window), *width, *height);
     vbox = gtk_vbox_new(FALSE, 1);
     gtk_box_pack_start(GTK_BOX(vbox), 
                        lbsv_app_set_menus(GTK_WINDOW(window),
@@ -268,14 +284,18 @@
     gtk_container_add(GTK_CONTAINER(window), vbox);
 
     lsvi = g_new(LibBalsaSourceViewerInfo, 1);
-    lsvi->msg = msg;
-    g_object_ref(msg);
+    lsvi->msg = g_object_ref(msg);
     lsvi->text = text;
     lsvi->window = window;
     lsvi->escape_specials = escape_specials;
+    lsvi->width = width;
+    lsvi->height = height;
     g_object_set_data_full(G_OBJECT(window), "lsvi", lsvi,
                            (GDestroyNotify) lsv_window_destroy_notify);
 
+    g_signal_connect(window, "size-allocate",
+                     G_CALLBACK(lsv_size_allocate_cb), lsvi);
+
     gtk_widget_show_all(window);
     if (*escape_specials)
         gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(escape_action),

Modified: trunk/src/balsa-app.h
==============================================================================
--- trunk/src/balsa-app.h	(original)
+++ trunk/src/balsa-app.h	Wed Jan  9 15:39:55 2008
@@ -298,9 +298,13 @@
 
     gboolean empty_trash_on_exit;
     gboolean previewpane;
-    gboolean source_escape_specials;
     gboolean debug;
 
+    /* Source viewer */
+    gboolean source_escape_specials;
+    gint source_width;
+    gint source_height;
+
     /* what to do with message window after moving the message */
     MwActionAfterMove mw_action_after_move;
 

Modified: trunk/src/balsa-index.c
==============================================================================
--- trunk/src/balsa-index.c	(original)
+++ trunk/src/balsa-index.c	Wed Jan  9 15:39:55 2008
@@ -1444,7 +1444,9 @@
         if (!message)
             continue;
 	libbalsa_show_message_source(message, balsa_app.message_font,
-				     &balsa_app.source_escape_specials);
+				     &balsa_app.source_escape_specials,
+                                     &balsa_app.source_width,
+                                     &balsa_app.source_height);
         g_object_unref(message);
     }
     balsa_index_selected_msgnos_free(index, selected);

Modified: trunk/src/main-window.c
==============================================================================
--- trunk/src/main-window.c	(original)
+++ trunk/src/main-window.c	Wed Jan  9 15:39:55 2008
@@ -3566,7 +3566,9 @@
 	LibBalsaMessage *message = list->data;
 
 	libbalsa_show_message_source(message, balsa_app.message_font,
-				     &balsa_app.source_escape_specials);
+				     &balsa_app.source_escape_specials,
+                                     &balsa_app.source_width,
+                                     &balsa_app.source_height);
     }
 
     g_list_foreach(messages, (GFunc)g_object_unref, NULL);

Modified: trunk/src/message-window.c
==============================================================================
--- trunk/src/message-window.c	(original)
+++ trunk/src/message-window.c	Wed Jan  9 15:39:55 2008
@@ -785,7 +785,9 @@
 {
     MessageWindow *mw = (MessageWindow *) data;
     libbalsa_show_message_source(mw->message, balsa_app.message_font,
-                                 &balsa_app.source_escape_specials);
+                                 &balsa_app.source_escape_specials,
+                                 &balsa_app.source_width,
+                                 &balsa_app.source_height);
 }
 
 static void

Modified: trunk/src/save-restore.c
==============================================================================
--- trunk/src/save-restore.c	(original)
+++ trunk/src/save-restore.c	Wed Jan  9 15:39:55 2008
@@ -805,6 +805,8 @@
     libbalsa_conf_push_group("SourcePreview");
     balsa_app.source_escape_specials = 
         libbalsa_conf_get_bool("EscapeSpecials=true");
+    balsa_app.source_width  = libbalsa_conf_get_int("Width=500");
+    balsa_app.source_height = libbalsa_conf_get_int("Height=400");
     libbalsa_conf_pop_group();
 
     /* Printing options ... */
@@ -1308,6 +1310,8 @@
     libbalsa_conf_push_group("SourcePreview");
     libbalsa_conf_set_bool("EscapeSpecials",
                           balsa_app.source_escape_specials);
+    libbalsa_conf_set_int("Width",  balsa_app.source_width);
+    libbalsa_conf_set_int("Height", balsa_app.source_height);
     libbalsa_conf_pop_group();
 
     /* Printing options ... */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]