Scrollbars in balsa-message.?




Okay,

Last one for today :) my girfriend is waiting (we are going 
to the movies or a party I think; but it's a supprise..I don't
know it yet *heh*)

So.. These two patches are `all the things that I've changed
to balsa-message.c and balsa-message.h`. They make scrolled
windows of the widgets used for viewing MimeText, HTML 
(gtkhtml) and the gnome_icon_list where the attachments get 
listed -if we are dealing with a multipart email-.

Pros: 
  * Now scroll/selecting text in the preview panel works.
  * You can more easy select which part you want to view
    when previewing a Multipart E-Mail. (The gnome_icon_list
    is always visible -when needed-, as scrolledwindow).
  * I can finally use my MouseWheel correct with balsa :)
   -> when "a lot" attachments are attached to the mail,
      you can now scroll them and easily select them without
      loosing the gnome_icon_list widget.
  * blablabla

Contra:
  * Changes some default behaviour of balsa
  * Needs checking on bugz :)
  * Same should be done when viewing images
    and other/future filetypes which balsa
    (will) support.
  * Adds bloat .. maybe ? -> I find it more
    easy to view E-Mails this way. But that is
    of course my opinion on this. (and I made
    this change so I guess I can't be objective
    anoymore)
  * You need a bigger screen, well .. the
    gnome_icon_list as scolledwindow fixes
    that problem a bit..

Extra
  * If the headers entry is also a scrolledwindow
    then displaying "a lot" headers is not ignorant
    anymore. The scrollbar wil dissapear when not
    much headers are selected anyway...
    ps. These patches don't make the headers entry a
    scrolledwindow.
  * blabla spam blabla


Please check this patch before committing it to cvs,
it was not tested yet..well not tested a lot -> gtg
to a party now.

I hope you guys don't mind that I post a lot to this 
list ;) .. it will stop until at least tomorrow (unless
I escaped from the party/movie and dragged myself behind 
the computer again)

heh :)


-- 
Philip van Hoof aka freax (http://www.freax.eu.org)
irc: irc.openprojects.net mailto:freax @ linux.be
--- balsa/src/balsa-message.h	Sun Feb  4 12:48:34 2001
+++ balsa-oddfreax/src/balsa-message.h	Sat Nov  3 17:46:34 2001
@@ -55,6 +55,7 @@
 	gboolean content_has_focus;
 
 	/* Widget to hold icons */
+	GtkWidget *scroll;
 	GtkWidget *part_list;
 	gint part_count;
 
--- balsa/src/balsa-message.c	Thu Oct 18 11:47:29 2001
+++ balsa-oddfreax/src/balsa-message.c	Sat Nov  3 18:13:25 2001
@@ -260,6 +260,9 @@
     gtk_table_attach(GTK_TABLE(bm->table), bm->header_text, 0, 1, 0, 1,
 		     GTK_EXPAND | GTK_FILL, 0, 0, 1);
 
+    bm->scroll = gtk_scrolled_window_new (NULL, NULL);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (bm->scroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+    
     bm->part_list = gnome_icon_list_new(100, NULL, FALSE);
 
     gnome_icon_list_set_selection_mode(GNOME_ICON_LIST(bm->part_list),
@@ -270,9 +273,13 @@
 		       GTK_SIGNAL_FUNC(balsa_icon_list_size_request),
 		       (gpointer) bm);
 
-    gtk_table_attach(GTK_TABLE(bm->table), bm->part_list, 0, 1, 2, 3,
+    gtk_container_add (GTK_CONTAINER (bm->scroll), bm->part_list);
+
+/*    gtk_table_attach(GTK_TABLE(bm->table), bm->part_list, 0, 1, 2, 3,*/
+    gtk_table_attach(GTK_TABLE(bm->table), bm->scroll, 0, 1, 2, 3,
 		     GTK_EXPAND | GTK_FILL, 0, 0, 1);
 
+
     bm->current_part = NULL;
     bm->message = NULL;
 
@@ -287,7 +294,7 @@
     BalsaMessage* bm = BALSA_MESSAGE(object);
     balsa_message_set(bm, NULL);
     gtk_widget_destroy(bm->part_list);
-
+    gtk_widget_destroy(bm->scroll);
     if (GTK_OBJECT_CLASS(parent_class)->destroy)
 	(*GTK_OBJECT_CLASS(parent_class)->destroy) (GTK_OBJECT(object));
 }
@@ -543,17 +550,21 @@
      * or we don't know how to display the one part.
      */
     if (bm->part_count > 1) {
-	gtk_widget_show(bm->part_list);
+     gtk_widget_show(bm->scroll);
+	 gtk_widget_show(bm->part_list);
     } else {
 	BalsaPartInfo *info = (BalsaPartInfo *)
 	    gnome_icon_list_get_icon_data(GNOME_ICON_LIST(bm->part_list),
 					  0);
 	g_assert( info != NULL );
 
-	if (info->can_display)
-	    gtk_widget_hide(bm->part_list);
-	else
+ 	if (info->can_display) {
+	     gtk_widget_hide(bm->part_list);
+         gtk_widget_hide(bm->scroll);
+ 	} else {
+        gtk_widget_show(bm->scroll);
 	    gtk_widget_show(bm->part_list);
+	 }
     }
 
     return TRUE;
@@ -1819,11 +1830,12 @@
 	part_info_init_unknown(bm, info);
 #endif
     } else {
-	regex_t rex;
+    regex_t rex;
+    GtkWidget *scrolledwindow = NULL;
 	GtkWidget *item = NULL;
 	GdkFont *fnt = NULL;
 	GList *url_list = NULL;
-	
+
 	fnt = find_body_font(info->body);
 
     if (bm->wrap_text) {
@@ -1839,7 +1851,9 @@
 	if (!fnt)
 	    fnt = gdk_fontset_load(balsa_app.message_font);
 	
+
 	item = gtk_text_new(NULL, NULL);
+    scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
 	
 	/* get the widget's default font for those people who did not set up a 
 	   custom one */
@@ -1857,7 +1871,7 @@
 			   (gpointer) bm);
 	gtk_signal_connect(GTK_OBJECT(item), "size_request",
 			   (GtkSignalFunc)balsa_gtk_text_size_request,
-			   (gpointer) bm);
+			   (gpointer) bm);	   
 	
 	allocate_quote_colors(GTK_WIDGET(bm), balsa_app.quoted_color,
 			      0, MAX_QUOTED_COLOR - 1);
@@ -1894,7 +1908,7 @@
 	    g_strfreev(l);
 	    regfree(&rex);
 	}
-	
+
 	gtk_signal_connect_after(GTK_OBJECT(item), "realize",
 				 (GtkSignalFunc)fix_text_widget, url_list);
 	if (url_list) {
@@ -1911,17 +1925,32 @@
 	}
 
 	gtk_text_set_editable(GTK_TEXT(item), FALSE);
-	
+
+    gtk_widget_show(scrolledwindow);
 	gtk_widget_show(item);
+
+/* Ehm, Looks like this ain't nessesairy if you use that info->.. stuff
+    gtk_container_add (GTK_CONTAINER(bm->content), scrolledwindow); */
+	gtk_container_add (GTK_CONTAINER (scrolledwindow), item);
+/*	
 	info->focus_widget = item;
 	info->widget = item;
 	info->can_display = TRUE;
+	
+	Well.. item is now under scrolledwindow, so ..
+*/
+	info->focus_widget = scrolledwindow;
+	info->widget = scrolledwindow;
+	info->can_display = TRUE;
+
     }
     g_free(ptr);
     
     fclose(fp);
 }
 
+
+
 #ifdef HAVE_GTKHTML
 static void
 part_info_init_html(BalsaMessage * bm, BalsaPartInfo * info, gchar * ptr,
@@ -1932,7 +1961,8 @@
 
     scroll = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
-				   GTK_POLICY_NEVER, GTK_POLICY_NEVER);
+				   GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+//				   GTK_POLICY_NEVER, GTK_POLICY_NEVER);
 
     html = gtk_html_new();
 
@@ -1956,7 +1986,8 @@
     gtk_widget_show(html);
     gtk_widget_show(scroll);
 
-    info->focus_widget = html;
+//    info->focus_widget = html;
+    info->focus_widget = scroll;
     info->widget = scroll;
     info->can_display = TRUE;
 }
@@ -2022,6 +2053,7 @@
     /* The widget is unref'd in part_info_free */
     if (info->widget)
 	gtk_object_ref(GTK_OBJECT(info->widget));
+
 
     return;
 }


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