Leandro A. F. Pereira <leandro@linuxmag.com.br>
Luke Plant <L.Plant.98@cantab.net>
Martin Schaaf <mascha@ma-scha.de>
+ Jesper Schultz <jesper@schultz-net.dk>
Carsten Schurig <Carsten.Schurig@web.de>
Sergey Vlasov <vsu@users.sourceforge.net>
Hiroyuki Yamamoto <hiro-y@kcn.ne.jp>
pixmaps/privacy_signed.xpm \
pixmaps/privacy_unknown.xpm \
pixmaps/privacy_warn.xpm \
+ pixmaps/privacy_emblem_encrypted.xpm \
+ pixmaps/privacy_emblem_failed.xpm \
+ pixmaps/privacy_emblem_passed.xpm \
+ pixmaps/privacy_emblem_signed.xpm \
+ pixmaps/privacy_emblem_warn.xpm \
pixmaps/properties.xpm \
pixmaps/quicksearch.xpm \
pixmaps/regular.xpm \
}
}
-static GdkColor nocheck_sig_color = {
- (gulong)0,
- (gushort)0,
- (gushort)0,
- (gushort)0xcfff
-};
-
-static GdkColor good_sig_color = {
- (gulong)0,
- (gushort)0,
- (gushort)0xbfff,
- (gushort)0
-};
-
-static GdkColor bad_sig_color = {
- (gulong)0,
- (gushort)0xffff,
- (gushort)0,
- (gushort)0
-};
-
-#define COLOR_BORDER 3
-
-static gboolean icon_drawing_area_expose_event_cb (GtkWidget *widget, GdkEventExpose *expose,
- gpointer data)
-{
- GdkColor *color = (GdkColor *)data;
- GdkDrawable *drawable = widget->window;
- GdkGC *gc_pix;
- GdkPixmap *stock_pixmap;
- GdkBitmap *stock_mask;
-
- stock_pixmap = (GdkPixmap *)gtk_object_get_data(GTK_OBJECT(widget), "pixmap");
- stock_mask = (GdkBitmap *)gtk_object_get_data(GTK_OBJECT(widget), "mask");
-
- g_return_val_if_fail(stock_pixmap != NULL, FALSE);
- g_return_val_if_fail(stock_mask != NULL, FALSE);
-
- gc_pix = gdk_gc_new((GdkWindow *)drawable);
-
- gdk_window_clear_area (drawable, expose->area.x, expose->area.y,
- expose->area.width, expose->area.height);
-
- if (color != NULL) {
- gdk_gc_set_foreground(gc_pix, color);
- if (color == &good_sig_color) {
- gdk_draw_rectangle(drawable, gc_pix, TRUE, 0 , 0,
- widget->allocation.width,
- widget->allocation.height);
- } else {
- gdk_gc_set_line_attributes(gc_pix, COLOR_BORDER - 1, GDK_LINE_ON_OFF_DASH,
- GDK_CAP_BUTT, GDK_JOIN_MITER);
- gdk_draw_rectangle(drawable, gc_pix, FALSE, 1 , 1,
- widget->allocation.width - 2,
- widget->allocation.height - 2);
- }
- }
-
-#define LEFT COLOR_BORDER + widget->allocation.width - widget->requisition.width
-#define TOP COLOR_BORDER + widget->allocation.height - widget->requisition.height
-
- gdk_gc_set_tile(gc_pix, stock_pixmap);
- gdk_gc_set_ts_origin(gc_pix, LEFT, TOP);
- gdk_gc_set_clip_mask(gc_pix, stock_mask);
- gdk_gc_set_clip_origin(gc_pix, LEFT, TOP);
- gdk_gc_set_fill(gc_pix, GDK_TILED);
- gdk_draw_rectangle(drawable, gc_pix, TRUE, LEFT, TOP,
- widget->requisition.width - COLOR_BORDER * 2,
- widget->requisition.height - COLOR_BORDER * 2);
-
- gdk_gc_destroy(gc_pix);
-
- return TRUE;
-
-}
-
-static GtkWidget* icon_stock_pixmap_with_privacy (GtkWidget *window, StockPixmap icon,
- MimeInfo *mimeinfo)
-{
- GdkPixmap *stock_pixmap;
- GdkBitmap *stock_mask;
- GtkWidget *widget;
- GtkWidget *stock_wid;
- GdkColor *color = NULL;
- MimeInfo *siginfo;
- gboolean is_signed = FALSE;
- gint height;
- gint width;
-
- siginfo = mimeinfo;
- while (siginfo != NULL) {
- if (privacy_mimeinfo_is_signed(siginfo)) {
- is_signed = TRUE;
- break;
- }
- siginfo = procmime_mimeinfo_parent(siginfo);
- }
-
- stock_wid = stock_pixmap_widget(window, icon);
- gtk_pixmap_get(GTK_PIXMAP(stock_wid), &stock_pixmap, &stock_mask);
- height = stock_wid->requisition.height;
- width = stock_wid->requisition.width;
- gdk_pixmap_ref(stock_pixmap);
- gdk_pixmap_ref(stock_mask);
- gtk_widget_destroy(stock_wid);
-
- widget = gtk_drawing_area_new();
- gtk_drawing_area_size(GTK_DRAWING_AREA(widget),
- width + COLOR_BORDER * 2,
- height + COLOR_BORDER * 2);
- gtk_object_set_data_full(GTK_OBJECT(widget), "pixmap", stock_pixmap,
- (GtkDestroyNotify)gdk_pixmap_unref);
- gtk_object_set_data_full(GTK_OBJECT(widget), "mask", stock_mask,
- (GtkDestroyNotify)gdk_pixmap_unref);
-
- if (is_signed) {
- switch (privacy_mimeinfo_get_sig_status(siginfo)) {
- case SIGNATURE_UNCHECKED:
- color = &nocheck_sig_color;
- break;
- case SIGNATURE_OK:
- color = &good_sig_color;
- break;
- default:
- color = &bad_sig_color;
- break;
- }
- if (!color->pixel)
- gdk_colormap_alloc_color(gtk_widget_get_colormap(widget),
- color, FALSE, TRUE);
- } else {
- color = NULL;
- }
- gtk_signal_connect(GTK_OBJECT(widget), "expose_event",
- GTK_SIGNAL_FUNC
- (icon_drawing_area_expose_event_cb),
- color);
- return widget;
-}
-
-#undef COLOR_BORDER
-
static void icon_list_append_icon (MimeView *mimeview, MimeInfo *mimeinfo)
{
GtkWidget *pixmap;
GtkWidget *vbox;
GtkWidget *button;
gchar *tip;
+ gchar *tiptmp;
const gchar *desc = NULL;
+ gchar *sigshort = NULL;
gchar *content_type;
StockPixmap stockp;
+ MimeInfo *partinfo;
+ MimeInfo *siginfo = NULL;
+ MimeInfo *encrypted = NULL;
vbox = mimeview->icon_vbox;
mimeview->icon_count++;
break;
}
- pixmap = icon_stock_pixmap_with_privacy(mimeview->mainwin->window, stockp,
- mimeinfo);
+ partinfo = mimeinfo;
+ while (partinfo != NULL) {
+ if (privacy_mimeinfo_is_signed(partinfo)) {
+ siginfo = partinfo;
+ break;
+ }
+ if (privacy_mimeinfo_is_encrypted(partinfo)) {
+ encrypted = partinfo;
+ break;
+ }
+ partinfo = procmime_mimeinfo_parent(partinfo);
+ }
+
+ if (siginfo != NULL) {
+ switch (privacy_mimeinfo_get_sig_status(siginfo)) {
+ case SIGNATURE_UNCHECKED:
+ case SIGNATURE_CHECK_FAILED:
+ pixmap = stock_pixmap_widget_with_overlay(mimeview->mainwin->window, stockp,
+ STOCK_PIXMAP_PRIVACY_EMBLEM_SIGNED, OVERLAY_BOTTOM_RIGHT, 6, 3);
+ break;
+ case SIGNATURE_OK:
+ pixmap = stock_pixmap_widget_with_overlay(mimeview->mainwin->window, stockp,
+ STOCK_PIXMAP_PRIVACY_EMBLEM_PASSED, OVERLAY_BOTTOM_RIGHT, 6, 3);
+ break;
+ case SIGNATURE_WARN:
+ pixmap = stock_pixmap_widget_with_overlay(mimeview->mainwin->window, stockp,
+ STOCK_PIXMAP_PRIVACY_EMBLEM_WARN, OVERLAY_BOTTOM_RIGHT, 6, 3);
+ break;
+ case SIGNATURE_INVALID:
+ pixmap = stock_pixmap_widget_with_overlay(mimeview->mainwin->window, stockp,
+ STOCK_PIXMAP_PRIVACY_EMBLEM_FAILED, OVERLAY_BOTTOM_RIGHT, 6, 3);
+ break;
+ }
+ sigshort = privacy_mimeinfo_sig_info_short(siginfo);
+ } else if (encrypted != NULL) {
+ pixmap = stock_pixmap_widget_with_overlay(mimeview->mainwin->window, stockp,
+ STOCK_PIXMAP_PRIVACY_EMBLEM_ENCRYPTED, OVERLAY_BOTTOM_RIGHT, 6, 3);
+ } else {
+ pixmap = stock_pixmap_widget_with_overlay(mimeview->mainwin->window, stockp, 0,
+ OVERLAY_NONE, 6, 3);
+ }
gtk_container_add(GTK_CONTAINER(button), pixmap);
if (!desc) {
content_type = procmime_get_content_type_str(mimeinfo->type,
mimeinfo->subtype);
- if (desc && *desc)
- tip = g_strdup_printf("%s\n%s\n%s", desc, content_type,
- to_human_readable(mimeinfo->length));
- else
- tip = g_strdup_printf("%s\n%s", content_type,
- to_human_readable(mimeinfo->length));
-
+ tip = g_strjoin("\n", content_type,
+ to_human_readable(mimeinfo->length), NULL);
g_free(content_type);
+ if (desc && *desc) {
+ tiptmp = g_strjoin("\n", desc, tip, NULL);
+ g_free(tip);
+ tip = tiptmp;
+ }
+ if (sigshort && *sigshort) {
+ tiptmp = g_strjoin("\n", tip, sigshort, NULL);
+ g_free(tip);
+ tip = tiptmp;
+ }
+ g_free(sigshort);
gtk_tooltips_set_tip(mimeview->tooltips, button, tip, NULL);
g_free(tip);
--- /dev/null
+/* XPM */
+static char * privacy_emblem_encrypted_xpm[] = {
+"13 16 13 1",
+" c None",
+". c #000000",
+"+ c #FFFFFF",
+"@ c #EDEDED",
+"# c #D9D9D9",
+"$ c #BDBDBD",
+"% c #BABABA",
+"& c #ECE6C8",
+"* c #C8B971",
+"= c #826D02",
+"- c #B8A751",
+"; c #857005",
+"> c #D3C78A",
+" ...... ",
+" .+@@###. ",
+" .@#..##.$ ",
+" .#.$$.#.$ ",
+" .%.$+.%.$ ",
+" ..........$ ",
+".&********=. ",
+".-.*;;;;**=.$",
+".&**;...>*=.$",
+".-.*;...>*=.$",
+".&***;.>**=.$",
+".-.**;.>**=.$",
+".&********=.$",
+".==========.$",
+" ..........$ ",
+" $$$$$$$$$ "};
--- /dev/null
+/* XPM */
+static char * privacy_emblem_failed_xpm[] = {
+"15 16 114 2",
+" c None",
+". c #151515",
+"+ c #2C2C2C",
+"@ c #0D0D0D",
+"# c #030303",
+"$ c #040404",
+"% c #060606",
+"& c #0E0E0E",
+"* c #242424",
+"= c #FFFFFF",
+"- c #D5D5D5",
+"; c #171717",
+"> c #000000",
+", c #252525",
+"' c #2D2D2D",
+") c #373737",
+"! c #262626",
+"~ c #F2F2F2",
+"{ c #0F0F0F",
+"] c #F8F8F8",
+"^ c #4C4C4C",
+"/ c #B9B9B9",
+"( c #3E3E3E",
+"_ c #101010",
+": c #090909",
+"< c #454545",
+"[ c #FCFCFC",
+"} c #565656",
+"| c #B8B8B8",
+"1 c #4E4E4E",
+"2 c #131313",
+"3 c #6E6E6E",
+"4 c #FBFBFB",
+"5 c #272727",
+"6 c #646464",
+"7 c #A6A6A6",
+"8 c #CBCBCB",
+"9 c #3B3B3B",
+"0 c #C2C2C2",
+"a c #282828",
+"b c #A3A3A3",
+"c c #848484",
+"d c #4D4D4D",
+"e c #DBDBDB",
+"f c #292929",
+"g c #474747",
+"h c #F0F0F0",
+"i c #C1C1C1",
+"j c #767676",
+"k c #C5C5C5",
+"l c #606060",
+"m c #2A2A2A",
+"n c #595959",
+"o c #E2E2E2",
+"p c #1B1B1B",
+"q c #FAFAFA",
+"r c #424242",
+"s c #DAB6B6",
+"t c #F4AFAF",
+"u c #F4B1B1",
+"v c #F6BCBC",
+"w c #2B2B2B",
+"x c #7A7A7A",
+"y c #B1B1B1",
+"z c #333333",
+"A c #949494",
+"B c #D2D2D2",
+"C c #3C3C3C",
+"D c #9B9B9B",
+"E c #E74E4E",
+"F c #E33030",
+"G c #F6BDBD",
+"H c #DE0D0D",
+"I c #F3A7A7",
+"J c #2E2E2E",
+"K c #353535",
+"L c #5B5B5B",
+"M c #858585",
+"N c #444444",
+"O c #DCDCDC",
+"P c #F8CCCC",
+"Q c #DC0101",
+"R c #DF1919",
+"S c #F7C3C3",
+"T c #313131",
+"U c #D3D3D3",
+"V c #383838",
+"W c #2F2F2F",
+"X c #3D3D3D",
+"Y c #8F8F8F",
+"Z c #FDFDFD",
+"` c #FFFDFD",
+" . c #EA6666",
+".. c #DC0000",
+"+. c #DE0B0B",
+"@. c #FBE0E0",
+"#. c #797979",
+"$. c #D9D9D9",
+"%. c #EE8484",
+"&. c #DE1212",
+"*. c #F5B7B7",
+"=. c #E12323",
+"-. c #E75252",
+";. c #FEFEFE",
+">. c #FADADA",
+",. c #F9D3D3",
+"'. c #FADEDE",
+"). c #FDEEEE",
+"!. c #0C0C0C",
+"~. c #202020",
+"{. c #212121",
+"]. c #222222",
+"^. c #232323",
+"/. c #111111",
+". + + + + + + + @ # # # $ % & ",
+"* = = = = = = - ; > > > > , ' ",
+", = = = = = = ) > > > > > ! ' ",
+", = = = = = ~ ' { > > > > ! ' ",
+", = = = = ] ^ / ( _ > > : < ' ",
+"! = = = [ } | = ] 1 2 2 3 4 ' ",
+"5 = = = 6 7 = = = 8 9 0 = = ' ",
+"a = = b c = = = = d e = = = ' ",
+"f = = g h i j = k l = = = = ' ",
+"m = e n o p i q r s t = u v ' ",
+"w = x y z A B C D E F G H I ' ",
+"J [ K L l M N O = P Q R S = ' ",
+"T U V W X Y Z = ` ...+.@.= ' ",
+"K = #.C $.= = = %.&.*.=.-.= ' ",
+") = ;.Z = = = = >.,.= '.).= ' ",
+"!.~.{.{.].].^.^.* , , ! ! 5 /."};
--- /dev/null
+/* XPM */
+static char * privacy_emblem_passed_xpm[] = {
+"15 16 101 2",
+" c None",
+". c #393939",
+"+ c #404040",
+"@ c #171717",
+"# c #050505",
+"$ c #060606",
+"% c #080808",
+"& c #1F1F1F",
+"* c #3F3F3F",
+"= c #FFFFFF",
+"- c #DADADA",
+"; c #181818",
+"> c #000000",
+", c #212121",
+"' c #4F4F4F",
+") c #383838",
+"! c #222222",
+"~ c #F6F6F6",
+"{ c #303030",
+"] c #101010",
+"^ c #3E3E3E",
+"/ c #FAFAFA",
+"( c #515151",
+"_ c #B3B3B3",
+": c #464646",
+"< c #121212",
+"[ c #070707",
+"} c #FDFDFD",
+"| c #5B5B5B",
+"1 c #B0B0B0",
+"2 c #FBFBFB",
+"3 c #595959",
+"4 c #151515",
+"5 c #131313",
+"6 c #666666",
+"7 c #F9F9F9",
+"8 c #676767",
+"9 c #A1A1A1",
+"0 c #D9D9D9",
+"a c #353535",
+"b c #C0C0C0",
+"c c #A4A4A4",
+"d c #838383",
+"e c #5A5A5A",
+"f c #CECECE",
+"g c #FEFFFE",
+"h c #E2F2E2",
+"i c #4A4A4A",
+"j c #EFEFEF",
+"k c #C2C2C2",
+"l c #767676",
+"m c #D3D3D3",
+"n c #525252",
+"o c #B9E1B9",
+"p c #069305",
+"q c #A3D7A3",
+"r c #E1E1E1",
+"s c #545454",
+"t c #E5E5E5",
+"u c #1C1C1C",
+"v c #BFBFBF",
+"w c #4D4D4D",
+"x c #50B34F",
+"y c #0A9509",
+"z c #E5F4E5",
+"A c #848484",
+"B c #A9A9A9",
+"C c #8D8D8D",
+"D c #414141",
+"E c #8F8F8F",
+"F c #049203",
+"G c #76C375",
+"H c #363636",
+"I c #575757",
+"J c #909090",
+"K c #D5D5D5",
+"L c #A1D6A1",
+"M c #83CA83",
+"N c #7AC579",
+"O c #0F970E",
+"P c #EDF7ED",
+"Q c #2B2B2B",
+"R c #424242",
+"S c #FCFEFC",
+"T c #019100",
+"U c #82C982",
+"V c #898989",
+"W c #343434",
+"X c #D1D1D1",
+"Y c #60BA5F",
+"Z c #169A15",
+"` c #F3FAF3",
+" . c #CDE9CD",
+".. c #1D1D1D",
+"+. c #313131",
+"@. c #323232",
+"#. c #333333",
+"$. c #3A3A3A",
+"%. c #3B3B3B",
+"&. c #3C3C3C",
+"*. c #2A2A2A",
+". + + + + + + + @ # # # $ % & ",
+"* = = = = = = - ; > > > > , ' ",
+"* = = = = = = ) > > > > > ! ' ",
+"* = = = = = ~ { ] > > > > ! ' ",
+"^ = = = = / ( _ : < > > [ . ' ",
+"* = = = } | 1 = 2 3 4 5 6 7 ' ",
+"^ = = = 8 9 = = = 0 a b = = ' ",
+"* = = c d = = = = e f g h = ' ",
+"+ = = i j k l = m n = o p q ' ",
+"+ = r s t u v } w f = x y z ' ",
+"+ = A B . C 0 D E = h F G = ' ",
+"+ = H 6 I J ^ K L M N O P = ' ",
+"+ r { Q R A 2 S x T T U = = ' ",
+"+ = V W X = = = S Y Z ` = = ' ",
+"+ = = 2 = = = = = g .= = = ' ",
+"..+.@.@.#.W H H ) $.$.%.&.^ *."};
--- /dev/null
+/* XPM */
+static char * privacy_emblem_signed_xpm[] = {
+"15 16 75 1",
+" c None",
+". c #393939",
+"+ c #404040",
+"@ c #151515",
+"# c #050505",
+"$ c #060606",
+"% c #090909",
+"& c #222222",
+"* c #3F3F3F",
+"= c #FFFFFF",
+"- c #D5D5D5",
+"; c #171717",
+"> c #000000",
+", c #232323",
+"' c #373737",
+") c #242424",
+"! c #F6F6F6",
+"~ c #303030",
+"{ c #101010",
+"] c #252525",
+"^ c #3E3E3E",
+"/ c #FAFAFA",
+"( c #515151",
+"_ c #B3B3B3",
+": c #434343",
+"< c #111111",
+"[ c #454545",
+"} c #FDFDFD",
+"| c #5B5B5B",
+"1 c #B0B0B0",
+"2 c #131313",
+"3 c #6E6E6E",
+"4 c #FBFBFB",
+"5 c #676767",
+"6 c #A1A1A1",
+"7 c #CCCCCC",
+"8 c #3B3B3B",
+"9 c #C2C2C2",
+"0 c #A3A3A3",
+"a c #838383",
+"b c #525252",
+"c c #D7D7D7",
+"d c #474747",
+"e c #F0F0F0",
+"f c #C1C1C1",
+"g c #767676",
+"h c #CECECE",
+"i c #575757",
+"j c #DBDBDB",
+"k c #595959",
+"l c #E2E2E2",
+"m c #1B1B1B",
+"n c #FCFCFC",
+"o c #4C4C4C",
+"p c #D1D1D1",
+"q c #7A7A7A",
+"r c #B1B1B1",
+"s c #333333",
+"t c #949494",
+"u c #8F8F8F",
+"v c #353535",
+"w c #606060",
+"x c #8A8A8A",
+"y c #D3D3D3",
+"z c #383838",
+"A c #797979",
+"B c #FEFEFE",
+"C c #1D1D1D",
+"D c #313131",
+"E c #323232",
+"F c #343434",
+"G c #363636",
+"H c #3A3A3A",
+"I c #3C3C3C",
+"J c #2C2C2C",
+".+++++++@##$$%&",
+"*======-;>>>>,+",
+"*======'>>>>>)+",
+"*=====!~{>>>>]+",
+"^====/(_:<>>%[+",
+"*===}|1=/(2234+",
+"^===56===789==+",
+"*==0a====bc===+",
+"+==defg=hi====+",
+"+=jklmfnop====+",
+"+=qrstc+u=====+",
+"+nv|wx+c======+",
+"+yz~^xn=======+",
+"+=A8c=========+",
+"+=Bn==========+",
+"CDEEsFGGzHH8I^J"};
--- /dev/null
+/* XPM */
+static char * privacy_emblem_warn_xpm[] = {
+"15 16 82 1",
+" c None",
+". c #111111",
+"+ c #2C2C2C",
+"@ c #0D0D0D",
+"# c #030303",
+"$ c #040404",
+"% c #080808",
+"& c #0E0E0E",
+"* c #272727",
+"= c #FFFFFF",
+"- c #D5D5D5",
+"; c #171717",
+"> c #000000",
+", c #252525",
+"' c #2D2D2D",
+") c #373737",
+"! c #262626",
+"~ c #282828",
+"{ c #F1F1F1",
+"] c #F6F6F6",
+"^ c #4A4A4A",
+"/ c #BABABA",
+"( c #3D3D3D",
+"_ c #101010",
+": c #454545",
+"< c #292929",
+"[ c #FAFAFA",
+"} c #515151",
+"| c #BDBDBD",
+"1 c #F8F8F8",
+"2 c #4D4D4D",
+"3 c #121212",
+"4 c #131313",
+"5 c #666666",
+"6 c #FDFDFD",
+"7 c #5B5B5B",
+"8 c #AFAFAF",
+"9 c #CBCBCB",
+"0 c #363636",
+"a c #B6B6B6",
+"b c #2A2A2A",
+"c c #949494",
+"d c #939393",
+"e c #DADADA",
+"f c #EFEFEF",
+"g c #F2F2F2",
+"h c #414141",
+"i c #F7F7F7",
+"j c #C1C1C1",
+"k c #767676",
+"l c #C5C5C5",
+"m c #606060",
+"n c #303030",
+"o c #2E2E2E",
+"p c #D3D3D3",
+"q c #626262",
+"r c #E2E2E2",
+"s c #1B1B1B",
+"t c #424242",
+"u c #DBDBDB",
+"v c #747474",
+"w c #B7B7B7",
+"x c #333333",
+"y c #9A9A9A",
+"z c #323232",
+"A c #FCFCFC",
+"B c #343434",
+"C c #5C5C5C",
+"D c #616161",
+"E c #8D8D8D",
+"F c #D2D2D2",
+"G c #3A3A3A",
+"H c #444444",
+"I c #868686",
+"J c #8F8F8F",
+"K c #A2A2A2",
+"L c #717171",
+"M c #D0D0D0",
+"N c #383838",
+"O c #F9F9F9",
+"P c #0C0C0C",
+"Q c #2B2B2B",
+".+++++++@###$%&",
+"*======-;>>>>,'",
+"*======)>>>>>!'",
+"~====={+&>>>>!'",
+"~====]^/(_>>%:'",
+"<===[}|=12345['",
+"<==678===90a=='",
+"b==cd====2efg='",
+"+==hijk=lmf>n='",
+"o=pqrsj[tuf>n='",
+"n=vwxc-(y=f>n='",
+"zABCDEhe==f>n='",
+"BFGzHIA===iJK='",
+"0=L)M=====f>n='",
+"N=AO=========='",
+"P''+++Qb<<~~**."};
#include "pixmaps/privacy_unknown.xpm"
#include "pixmaps/privacy_expired.xpm"
#include "pixmaps/privacy_warn.xpm"
+#include "pixmaps/privacy_emblem_encrypted.xpm"
+#include "pixmaps/privacy_emblem_signed.xpm"
+#include "pixmaps/privacy_emblem_passed.xpm"
+#include "pixmaps/privacy_emblem_failed.xpm"
+#include "pixmaps/privacy_emblem_warn.xpm"
#include "pixmaps/mime_message.xpm"
#include "pixmaps/address_search.xpm"
#include "pixmaps/check_spelling.xpm"
gchar *icon_path;
};
+typedef struct _OverlayData OverlayData;
+
+struct _OverlayData
+{
+ GdkPixmap *base_pixmap;
+ GdkBitmap *base_mask;
+ GdkPixmap *overlay_pixmap;
+ GdkBitmap *overlay_mask;
+ guint base_height;
+ guint base_width;
+ guint overlay_height;
+ guint overlay_width;
+ OverlayPosition position;
+ gint border_x;
+ gint border_y;
+};
+
static void stock_pixmap_find_themes_in_dir(GList **list, const gchar *dirname);
static StockPixmapData pixmaps[] =
{privacy_unknown_xpm , NULL, NULL, "privacy_unknown", NULL},
{privacy_expired_xpm , NULL, NULL, "privacy_expired", NULL},
{privacy_warn_xpm , NULL, NULL, "privacy_warn", NULL},
+ {privacy_emblem_encrypted_xpm , NULL, NULL, "privacy_emblem_encrypted", NULL},
+ {privacy_emblem_signed_xpm , NULL, NULL, "privacy_emblem_signed", NULL},
+ {privacy_emblem_passed_xpm , NULL, NULL, "privacy_emblem_passed", NULL},
+ {privacy_emblem_failed_xpm , NULL, NULL, "privacy_emblem_failed", NULL},
+ {privacy_emblem_warn_xpm , NULL, NULL, "privacy_emblem_warn", NULL},
{mime_message_xpm , NULL, NULL, "mime_message", NULL},
{sylpheed_logo_xpm , NULL, NULL, "sylpheed_logo", NULL},
};
}
return -1;
}
+
+static gboolean pixmap_with_overlay_expose_event_cb(GtkWidget *widget, GdkEventExpose *expose,
+ OverlayData *data)
+{
+ GdkDrawable *drawable = widget->window;
+ GdkGC *gc_pix;
+ gint left;
+ gint top;
+
+ g_return_val_if_fail(data->base_pixmap != NULL, FALSE);
+ g_return_val_if_fail(data->base_mask != NULL, FALSE);
+
+ gc_pix = gdk_gc_new((GdkWindow *)drawable);
+
+ gdk_window_clear_area (drawable, expose->area.x, expose->area.y,
+ expose->area.width, expose->area.height);
+
+ gdk_gc_set_tile(gc_pix, data->base_pixmap);
+ gdk_gc_set_ts_origin(gc_pix, data->border_x, data->border_y);
+ gdk_gc_set_clip_mask(gc_pix, data->base_mask);
+ gdk_gc_set_clip_origin(gc_pix, data->border_x, data->border_y);
+ gdk_gc_set_fill(gc_pix, GDK_TILED);
+
+ gdk_draw_rectangle(drawable, gc_pix, TRUE, data->border_x, data->border_y,
+ data->base_width, data->base_height);
+
+ if (data->position != OVERLAY_NONE) {
+ g_return_val_if_fail(data->overlay_pixmap != NULL, FALSE);
+ g_return_val_if_fail(data->overlay_mask != NULL, FALSE);
+
+ gdk_gc_set_tile(gc_pix, data->overlay_pixmap);
+ gdk_gc_set_clip_mask(gc_pix, data->overlay_mask);
+
+ switch (data->position) {
+ case OVERLAY_TOP_LEFT:
+ case OVERLAY_MID_LEFT:
+ case OVERLAY_BOTTOM_LEFT:
+ left = 0;
+ break;
+
+ case OVERLAY_TOP_CENTER:
+ case OVERLAY_MID_CENTER:
+ case OVERLAY_BOTTOM_CENTER:
+ left = (data->base_width + data->border_x * 2 - data->overlay_width)/2;
+ break;
+
+ case OVERLAY_TOP_RIGHT:
+ case OVERLAY_MID_RIGHT:
+ case OVERLAY_BOTTOM_RIGHT:
+ left = data->base_width + data->border_x * 2 - data->overlay_width;
+ break;
+ }
+ switch (data->position) {
+ case OVERLAY_TOP_LEFT:
+ case OVERLAY_TOP_CENTER:
+ case OVERLAY_TOP_RIGHT:
+ top = 0;
+ break;
+
+ case OVERLAY_MID_LEFT:
+ case OVERLAY_MID_CENTER:
+ case OVERLAY_MID_RIGHT:
+ top = (data->base_height + data->border_y * 2 - data->overlay_height)/2;
+ break;
+
+ case OVERLAY_BOTTOM_LEFT:
+ case OVERLAY_BOTTOM_CENTER:
+ case OVERLAY_BOTTOM_RIGHT:
+ top = data->base_height + data->border_y * 2 - data->overlay_height;
+ break;
+ }
+
+ gdk_gc_set_ts_origin(gc_pix, left, top);
+ gdk_gc_set_clip_origin(gc_pix, left, top);
+ gdk_gc_set_fill(gc_pix, GDK_TILED);
+ gdk_draw_rectangle(drawable, gc_pix, TRUE, left, top,
+ data->overlay_width, data->overlay_height);
+ }
+ gdk_gc_destroy(gc_pix);
+
+ return TRUE;
+}
+
+static void pixmap_with_overlay_destroy_cb(GtkObject *object, OverlayData *data)
+{
+ gdk_pixmap_unref(data->base_pixmap);
+ gdk_pixmap_unref(data->base_mask);
+ if (data->position != OVERLAY_NONE) {
+ gdk_pixmap_unref(data->overlay_pixmap);
+ gdk_pixmap_unref(data->overlay_mask);
+ }
+ g_free(data);
+}
+
+/**
+ * \brief Get a widget showing one icon with another overlaid on top of it.
+ *
+ * The base icon is always centralised, the other icon can be positioned.
+ * The overlay icon is ignored if pos=OVERLAY_NONE is used
+ *
+ * \param window top-level window widget
+ * \param icon the base icon
+ * \param overlay the icon to overlay
+ * \param pos how to align the overlay widget, or OVERLAY_NONE for no overlay
+ * \param border_x size of the border around the base icon (left and right)
+ * \param border_y size of the border around the base icon (top and bottom)
+ */
+GtkWidget *stock_pixmap_widget_with_overlay(GtkWidget *window, StockPixmap icon,
+ StockPixmap overlay, OverlayPosition pos,
+ gint border_x, gint border_y)
+{
+ GdkPixmap *stock_pixmap;
+ GdkBitmap *stock_mask;
+ GtkWidget *widget;
+ GtkWidget *stock_wid;
+ OverlayData *data;
+
+ data = g_new0(OverlayData, 1);
+
+ stock_wid = stock_pixmap_widget(window, icon);
+ gtk_pixmap_get(GTK_PIXMAP(stock_wid), &stock_pixmap, &stock_mask);
+ gdk_pixmap_ref(stock_pixmap);
+ gdk_pixmap_ref(stock_mask);
+ data->base_pixmap = stock_pixmap;
+ data->base_mask = stock_mask;
+ data->base_height = stock_wid->requisition.height;
+ data->base_width = stock_wid->requisition.width;
+ gtk_widget_destroy(stock_wid);
+
+ if (pos == OVERLAY_NONE) {
+ data->overlay_pixmap = NULL;
+ data->overlay_mask = NULL;
+ } else {
+ stock_wid = stock_pixmap_widget(window, overlay);
+ gtk_pixmap_get(GTK_PIXMAP(stock_wid), &stock_pixmap, &stock_mask);
+ gdk_pixmap_ref(stock_pixmap);
+ gdk_pixmap_ref(stock_mask);
+ data->overlay_pixmap = stock_pixmap;
+ data->overlay_mask = stock_mask;
+ data->overlay_height = stock_wid->requisition.height;
+ data->overlay_width = stock_wid->requisition.width;
+
+ gtk_widget_destroy(stock_wid);
+ }
+
+ data->position = pos;
+ data->border_x = border_x;
+ data->border_y = border_y;
+
+ widget = gtk_drawing_area_new();
+ gtk_drawing_area_size(GTK_DRAWING_AREA(widget), data->base_width + border_x * 2,
+ data->base_height + border_y * 2);
+ gtk_signal_connect(GTK_OBJECT(widget), "expose_event",
+ GTK_SIGNAL_FUNC(pixmap_with_overlay_expose_event_cb), data);
+ gtk_signal_connect(GTK_OBJECT(widget), "destroy",
+ GTK_SIGNAL_FUNC(pixmap_with_overlay_destroy_cb), data);
+ return widget;
+
+}
STOCK_PIXMAP_PRIVACY_UNKNOWN,
STOCK_PIXMAP_PRIVACY_EXPIRED,
STOCK_PIXMAP_PRIVACY_WARN,
+ STOCK_PIXMAP_PRIVACY_EMBLEM_ENCRYPTED,
+ STOCK_PIXMAP_PRIVACY_EMBLEM_SIGNED,
+ STOCK_PIXMAP_PRIVACY_EMBLEM_PASSED,
+ STOCK_PIXMAP_PRIVACY_EMBLEM_FAILED,
+ STOCK_PIXMAP_PRIVACY_EMBLEM_WARN,
STOCK_PIXMAP_MIME_MESSAGE,
STOCK_PIXMAP_SYLPHEED_LOGO, /* last entry */
N_STOCK_PIXMAPS
} StockPixmap;
+typedef enum {
+ OVERLAY_NONE,
+ OVERLAY_TOP_LEFT,
+ OVERLAY_TOP_CENTER,
+ OVERLAY_TOP_RIGHT,
+ OVERLAY_MID_LEFT,
+ OVERLAY_MID_CENTER,
+ OVERLAY_MID_RIGHT,
+ OVERLAY_BOTTOM_LEFT,
+ OVERLAY_BOTTOM_CENTER,
+ OVERLAY_BOTTOM_RIGHT
+} OverlayPosition;
+
GtkWidget *stock_pixmap_widget (GtkWidget *window,
StockPixmap icon);
gint stock_pixmap_gdk (GtkWidget *window,
void stock_pixmap_themes_list_free (GList *list);
gchar *stock_pixmap_get_name (StockPixmap icon);
StockPixmap stock_pixmap_get_icon (gchar *file);
+GtkWidget *stock_pixmap_widget_with_overlay (GtkWidget *window,
+ StockPixmap icon,
+ StockPixmap overlay,
+ OverlayPosition pos,
+ gint border_x,
+ gint border_y);
#endif /* __STOCK_PIXMAP_H__ */
};
#endif
-static GdkColor good_sig_color = {
- (gulong)0,
- (gushort)0,
- (gushort)0xbfff,
- (gushort)0
-};
-
-static GdkColor nocheck_sig_color = {
- (gulong)0,
- (gushort)0,
- (gushort)0,
- (gushort)0xcfff
-};
-
-static GdkColor bad_sig_color = {
- (gulong)0,
- (gushort)0xefff,
- (gushort)0,
- (gushort)0
-};
-
static GdkFont *text_sb_font;
static GdkFont *text_mb_font;
static gint text_sb_font_orig_ascent;