PATCH: heavy balsa declutter



hi,

seriously. nowadays gnome without gdk-pixbuf ? cant imagine
that. theres a lot of stuff implemented in balsa that really
require gdk-pixbuff not to mention the other libs that we use
now... i removed all imlib stuff out of balsa. it lightens the
code up.

-- 
Name....: Ali Akcaagac
Status..: Student Of Computer & Economic Science
E-Mail..: mailto:ali.akcaagac@stud.fh-wilhelmshaven.de
WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa
diff -ruN balsa-cvs/acconfig.h balsa/acconfig.h
--- balsa-cvs/acconfig.h	Sat Oct 13 23:22:48 2001
+++ balsa/acconfig.h	Sat Oct 13 23:22:20 2001
@@ -33,7 +33,6 @@
 
 /* Shall we multithread? */
 #undef BALSA_USE_THREADS
-#undef USE_PIXBUF
 
 /* LDAP support? */
 #undef ENABLE_LDAP
diff -ruN balsa-cvs/configure.in balsa/configure.in
--- balsa-cvs/configure.in	Sat Oct 13 23:22:48 2001
+++ balsa/configure.in	Sat Oct 13 23:22:20 2001
@@ -289,20 +289,6 @@
 fi
 
 dnl ##########################################################################
-dnl Check for GdkPixbuf if available
-dnl I guess we could safely assome everybody has got this one, couldn't we?
-dnl ##########################################################################
-AC_MSG_CHECKING(whether to use GdkPixbuf)
-if gnome-config --libs gdk_pixbuf > /dev/null 2>&1; then
-	gnome_libs="$gnome_libs gdk_pixbuf"
-	AC_DEFINE(USE_PIXBUF)
-       	AC_MSG_RESULT(yes)
-else
-        AC_MSG_RESULT(not found)
-fi
-
-
-dnl ##########################################################################
 dnl Install into gnome locations? (may require priveliges that we don't have)
 dnl ##########################################################################
 
diff -ruN balsa-cvs/src/balsa-message.c balsa/src/balsa-message.c
--- balsa-cvs/src/balsa-message.c	Sat Oct 13 23:22:47 2001
+++ balsa/src/balsa-message.c	Sat Oct 13 23:22:19 2001
@@ -37,9 +37,7 @@
 #include <libmutt/mutt.h>
 #include <libmutt/mime.h>
 
-#ifdef USE_PIXBUF
 #include <gdk-pixbuf/gdk-pixbuf.h>
-#endif
 
 #ifdef HAVE_GTKHTML
 #include <gtkhtml/gtkhtml.h>
@@ -770,12 +768,7 @@
 static void
 part_info_init_image(BalsaMessage * bm, BalsaPartInfo * info)
 {
-#ifndef USE_PIXBUF
-    GdkImlibImage *im;
-#else
     GdkPixbuf *pb;
-#endif
-
     GdkPixmap *pixmap = NULL;
     GdkBitmap *mask = NULL;
 
@@ -783,19 +776,6 @@
 
     libbalsa_message_body_save_temporary(info->body, NULL);
 
-#ifndef USE_PIXBUF
-    if (!(im = gdk_imlib_load_image(info->body->temp_filename))) {
-	g_print(_("Could not load image. It is most likely corrupted."));
-	return;
-    }
-
-    if (!gdk_imlib_render(im, im->rgb_width, im->rgb_height))
-	g_print(_("Couldn't render image\n"));
-
-    pixmap = gdk_imlib_copy_image(im);
-    mask = gdk_imlib_copy_mask(im);
-    gdk_imlib_destroy_image(im);
-#else
     if( (pb = gdk_pixbuf_new_from_file(info->body->temp_filename)) ) {
 	gdk_pixbuf_render_pixmap_and_mask(pb, &pixmap, &mask, 0);
 	gdk_pixbuf_unref(pb);
@@ -804,7 +784,6 @@
 	    (_("balsa/pixbuf: Could not load image. It is likely corrupted."));
 	return;
     }
-#endif
 
     if (pixmap) {
 	image = gtk_pixmap_new(pixmap, mask);
diff -ruN balsa-cvs/src/filter-edit-callbacks.c balsa/src/filter-edit-callbacks.c
--- balsa-cvs/src/filter-edit-callbacks.c	Sat Oct 13 23:22:47 2001
+++ balsa/src/filter-edit-callbacks.c	Sat Oct 13 23:22:19 2001
@@ -34,7 +34,6 @@
 #include "filter-edit.h"
 #include "pixmaps/enabled.xpm"
 
-#ifdef USE_PIXBUF
 #include <gdk-pixbuf/gdk-pixbuf.h>
 static void
 get_pixmap_and_mask_from_xpm(char* xpm[],
@@ -44,18 +43,6 @@
     gdk_pixbuf_render_pixmap_and_mask(pb, pixmap, mask, 0);
     gdk_pixbuf_unref(pb);
 }
-#else
-static void
-get_pixmap_and_mask_from_xpm(char* xpm[],
-			     GdkPixmap **pixmap, GdkBitmap **mask)
-{
-    GdkImlibImage *im = gdk_imlib_create_image_from_xpm_data(xpm);
-    gdk_imlib_render(im, im->rgb_width, im->rgb_height);
-    *pixmap = gdk_imlib_copy_image(im);
-    *mask = gdk_imlib_copy_mask(im);
-    gdk_imlib_destroy_image(im);
-}
-#endif
 
 /*
  * unique_filter_name()
diff -ruN balsa-cvs/src/filter-edit-dialog.c balsa/src/filter-edit-dialog.c
--- balsa-cvs/src/filter-edit-dialog.c	Sat Oct 13 23:22:47 2001
+++ balsa/src/filter-edit-dialog.c	Sat Oct 13 23:22:19 2001
@@ -21,9 +21,9 @@
 
 #include "config.h"
 #include <gnome.h>
-#ifdef USE_PIXBUF
+
 #include <gdk-pixbuf/gdk-pixbuf.h>
-#endif
+
 #include "balsa-app.h"
 #include "filter.h"
 #include "filter-edit.h"
@@ -148,13 +148,8 @@
     vbox = gtk_vbox_new(FALSE, 2);
 
     /* the clist */
-#ifdef USE_PIXBUF
     gtk_widget_push_visual(gdk_rgb_get_visual());
     gtk_widget_push_colormap(gdk_rgb_get_cmap());
-#else
-    gtk_widget_push_visual(gdk_imlib_get_visual());
-    gtk_widget_push_colormap(gdk_imlib_get_colormap());
-#endif
 
     sw = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
diff -ruN balsa-cvs/src/main-window.c balsa/src/main-window.c
--- balsa-cvs/src/main-window.c	Sat Oct 13 23:22:47 2001
+++ balsa/src/main-window.c	Sat Oct 13 23:22:19 2001
@@ -26,9 +26,7 @@
 #include <gnome.h>
 #include <gdk/gdkx.h>
 
-#ifdef USE_PIXBUF
 #include <gdk-pixbuf/gdk-pixbuf.h>
-#endif
 
 #ifdef BALSA_USE_THREADS
 #include <pthread.h>
@@ -2604,12 +2602,7 @@
 static void
 set_icon(GnomeApp * app)
 {
-#ifdef USE_PIXBUF
     GdkPixbuf *pb = NULL;
-#else
-    GdkImlibImage *im = NULL;
-    GdkPixmap *pmap, *mask;
-#endif
     GdkWindow *ic_win, *w;
     GdkWindowAttr att;
     XIconSize *is;
@@ -2653,32 +2646,15 @@
     att.window_type = GDK_WINDOW_TOPLEVEL;
     att.x = 0;
     att.y = 0;
-#ifdef USE_PIXBUF
     att.visual = gdk_rgb_get_visual();
     att.colormap = gdk_rgb_get_cmap();
-#else
-    att.visual = gdk_imlib_get_visual();
-    att.colormap = gdk_imlib_get_colormap();
-#endif
     ic_win = gdk_window_new(NULL, &att, GDK_WA_VISUAL | GDK_WA_COLORMAP);
     gdk_window_set_icon(w, ic_win, NULL, NULL);
 
     if( (filename = balsa_pixmap_finder("balsa/balsa_icon.png")) ) {
-#ifdef USE_PIXBUF
         pb = gdk_pixbuf_new_from_file(filename);
         gdk_window_clear(ic_win);
         gdk_pixbuf_unref(pb);
-#else
-        im = gdk_imlib_load_image(filename);
-        gdk_imlib_render(im, att.width, att.height);
-        pmap = gdk_imlib_move_image(im);
-        mask = gdk_imlib_move_mask(im);
-        gdk_window_set_back_pixmap(ic_win, pmap, FALSE);
-        gdk_window_clear(ic_win);
-        gdk_window_shape_combine_mask(ic_win, mask, 0, 0);
-        gdk_imlib_free_pixmap(pmap);
-        gdk_imlib_destroy_image(im);
-#endif
         g_free(filename);
     }
 }
diff -ruN balsa-cvs/src/main.c balsa/src/main.c
--- balsa-cvs/src/main.c	Sat Oct 13 23:22:47 2001
+++ balsa/src/main.c	Sat Oct 13 23:22:19 2001
@@ -287,13 +287,8 @@
     /* Initialize libbalsa */
     libbalsa_init((LibBalsaInformationFunc) balsa_information);
 
-#ifdef USE_PIXBUF
     gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
     gtk_widget_set_default_visual(gdk_rgb_get_visual());
-#else
-    gtk_widget_set_default_colormap(gdk_imlib_get_colormap());
-    gtk_widget_set_default_visual(gdk_imlib_get_visual());
-#endif
 
     /* Allocate the best colormap we can get */
     balsa_app.visual = gdk_visual_get_best();
diff -ruN balsa-cvs/src/print.c balsa/src/print.c
--- balsa-cvs/src/print.c	Sat Oct 13 23:22:47 2001
+++ balsa/src/print.c	Sat Oct 13 23:22:19 2001
@@ -657,9 +657,7 @@
     guint id_tag;
     float label_width, image_width, image_height, text_height, part_height;
     gchar **labels;
-#ifdef USE_PIXBUF
     GdkPixbuf *pixbuf;
-#endif
 } DefaultInfo;
 
 static void
@@ -679,17 +677,12 @@
 	conttype = 
 	    g_strdup(libbalsa_lookup_mime_type(body->filename));
 
-#ifdef USE_PIXBUF
     /* get a pixbuf according to the mime type */
     icon_name = libbalsa_icon_finder(conttype, NULL);
     pdata->pixbuf = gdk_pixbuf_new_from_file(icon_name);
     pdata->image_width = gdk_pixbuf_get_width (pdata->pixbuf);
     pdata->image_height = gdk_pixbuf_get_height (pdata->pixbuf);
     g_free(icon_name);
-#else
-    pdata->image_width = -10;  /* pts */
-    pdata->image_height = 0;
-#endif
 
     /* gather some info about this part */
     pdata->labels = g_new0(gchar *, 5); /* four fields, one terminator */
@@ -734,9 +727,8 @@
 static void
 print_default(PrintInfo * pi, gpointer data)
 {
-#ifdef USE_PIXBUF
     double matrix[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
-#endif
+
     DefaultInfo *pdata = (DefaultInfo *)data;
     GnomeFont *font;
     gint i, offset;
@@ -746,7 +738,6 @@
     if (pi->ypos - pdata->part_height < pi->margin_bottom)
 	start_new_page(pi);
 
-#ifdef USE_PIXBUF
     /* print the icon */
     gnome_print_gsave(pi->pc);
     matrix[0] = pdata->image_width;
@@ -757,8 +748,7 @@
     gnome_print_pixbuf (pi->pc, pdata->pixbuf);
     gnome_print_grestore (pi->pc);
     gdk_pixbuf_unref(pdata->pixbuf);
-#endif
-    
+
     /* print the description */
     font = gnome_font_new(BALSA_PRINT_HEAD_FONT, BALSA_PRINT_HEAD_SIZE);
     gnome_print_setfont(pi->pc, font);
@@ -778,7 +768,6 @@
     g_strfreev(pdata->labels);
 }
 
-#ifdef USE_PIXBUF
 /*
  * ~~~ stuff to print an image ~~~
  */
@@ -850,7 +839,6 @@
     pi->ypos -= pdata->print_height;
     gdk_pixbuf_unref(pdata->pixbuf);
 }
-#endif
 
 /*
  * scan the body list and prepare print data according to the content type
@@ -862,9 +850,7 @@
 	{"multipart", NULL},              /* ignore `multipart' entries */
 	{"text/html", prepare_default},   /* don't print html source */
 	{"text", prepare_plaintext},
-#ifdef USE_PIXBUF
 	{"image", prepare_image},
-#endif
 	{NULL, prepare_default}           /* anything else... */
     };
     mime_action_t *action;
@@ -1150,7 +1136,3 @@
 
     print_info_destroy(pi);
 }
-#endif
-
-
-
diff -ruN balsa-cvs/src/toolbar-factory.c balsa/src/toolbar-factory.c
--- balsa-cvs/src/toolbar-factory.c	Sat Oct 13 23:22:47 2001
+++ balsa/src/toolbar-factory.c	Sat Oct 13 23:22:19 2001
@@ -25,9 +25,7 @@
 #include <gnome.h>
 #include <gdk/gdkx.h>
 
-#ifdef USE_PIXBUF
 #include <gdk-pixbuf/gdk-pixbuf.h>
-#endif
 
 #ifdef BALSA_USE_THREADS
 #include <pthread.h>
diff -ruN balsa-cvs/src/toolbar-prefs.c balsa/src/toolbar-prefs.c
--- balsa-cvs/src/toolbar-prefs.c	Sat Oct 13 23:22:47 2001
+++ balsa/src/toolbar-prefs.c	Sat Oct 13 23:22:19 2001
@@ -25,9 +25,7 @@
 #include <gnome.h>
 #include <gdk/gdkx.h>
 
-#ifdef USE_PIXBUF
 #include <gdk-pixbuf/gdk-pixbuf.h>
-#endif
 
 #ifdef BALSA_USE_THREADS
 #include <pthread.h>


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