Scrollbars .. part two




*waking up*

Hi there,

I've added the same scrollbars (see my last post) to 
widgets for Images, fixed some bugs on previous patch 
and used  GTK_POLICY_AUTOMATIC for most scrollbars .. 
which makes the result a bit nicer :) ..

I also cleaned up balsa-message.c a bit (some tabs are
wrong there, and in my editor the code looks a bot messy)

I also made a few screenshots if you want to see the result :

http://freax.eu.org/oddfreaxpatch/

http://freax.eu.org/oddfreaxpatch/balsa-with-oddfreax-patch.imageloaded.png
http://freax.eu.org/oddfreaxpatch/balsa-with-oddfreax-patch.mimetextloaded.png
http://freax.eu.org/oddfreaxpatch/balsa-with-oddfreax-patch.mimetextloaded%5b2%5d.png
http://freax.eu.org/oddfreaxpatch/balsa-with-oddfreax-patch.unknownloaded.png

If you have comments on this patch, let know know what you think;
send me suggestions. Of course it would be easy for me if thisone 
goes into the official release of balsa; then I don't have to 
change balsa-message everytime it gets updated at cvs :) but I do
understand that it changes some behaviour of balsa.. so I know that
I am probably programming this stuff for personal use only :).


-- 
Philip van Hoof aka freax (http://www.freax.eu.org)
irc: irc.openprojects.net mailto:freax @ linux.be
--- 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]