Re: Icon theming for Balsa



On 12/23/2004 11:59:01 PM, Andrew Conkling wrote:
[ snip ]
Here's the rundown:
Toolbars: all work except for "Close" under Main Window

That's strange--that icon is handled no differently from the others, afaict.

Message list: None of the status/attachment/encrypted icons work (For the record, I haven't tested the mailbox icons.)

OK--those are created differently from the toolbar items, using gtk_widget_render_icon(). The attached patch switches to gtk_icon_theme_load_icon(), which is suggested in the Gtk docs (http://developer.gnome.org/doc/API/2.0/gtk/GtkIconTheme.html). It seems to bypass the stock items in the GtkIconFactory, and go straight to the files--at least, I had to install Balsa's xpm files in /usr/share/icons/hicolor/16x16/apps/ to get them seen.

Message window: Only the "recheck GPG" icon works; the attachment and message parts icons do not.

The "recheck GPG" icon is the one embedded to the right of the headers? That's created using gtk_image_new_from_stock(), which therefore seems to be safe. The attachment icon is created the same way, but with a gnome stock name: "gnome-stock-attach"--you could try replacing that with "balsa_attachment" or BALSA_PIXMAP_ATTACHMENT. I find gnome-stock-attach.png only under Bluecurve.

Are the "message parts icons" the ones in the tree-view on the Message parts notebook page?

Menus: All of the "standard" GTK icons--copy, paste, close, help, etc.--work, but the others do not.

That may also be a naming issue: Balsa passes e.g. the string "balsa_menu_new" to GnomeApp for the "Toggle New" item, but the xpm file is src/pixmaps/menu_new.xpm.

Compose window: nothing unique to mention

Great!  That's progress, right?

Peter
Index: src/balsa-icons.c
===================================================================
RCS file: /cvs/gnome/balsa/src/balsa-icons.c,v
retrieving revision 1.37
diff -u -r1.37 balsa-icons.c
--- src/balsa-icons.c	11 Oct 2004 18:55:50 -0000	1.37
+++ src/balsa-icons.c	24 Dec 2004 15:20:44 -0000
@@ -255,10 +255,18 @@
 #endif
     };
     guint i;
+    GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
 
-    for (i = 0; i < ELEMENTS(icons); i++)
-	icons[i].set_icon(gtk_widget_render_icon(widget,
-						 icons[i].icon,
-						 GTK_ICON_SIZE_MENU,
-						 NULL));
+    for (i = 0; i < ELEMENTS(icons); i++) {
+        GError *error = NULL;
+        GdkPixbuf *pixbuf =
+            gtk_icon_theme_load_icon(icon_theme, icons[i].icon, 16, 0,
+                                     &error);
+        if (!pixbuf) {
+            g_message("Couldn't load icon: %s", error->message);
+            g_error_free(error);
+        } else
+            /* Use the pixbuf */
+            icons[i].set_icon(pixbuf);
+    }
 }



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