From: Kern Sibbald Date: Mon, 14 May 2007 08:31:56 +0000 (+0000) Subject: Apply implementation of tray-monitor font derived from gnome-console X-Git-Tag: Release-2.2.0~502 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0edd5652d471719a10e2dd92da162072dfd77122;p=bacula%2Fbacula Apply implementation of tray-monitor font derived from gnome-console submitted by Andreas Piesk git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4778 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/gnome2-console/console_conf.c b/bacula/src/gnome2-console/console_conf.c index e8c442a051..0903d30f64 100644 --- a/bacula/src/gnome2-console/console_conf.c +++ b/bacula/src/gnome2-console/console_conf.c @@ -108,7 +108,6 @@ static RES_ITEM con_font_items[] = { {"name", store_name, ITEM(con_font.hdr.name), 0, ITEM_REQUIRED, 0}, {"description", store_str, ITEM(con_font.hdr.desc), 0, 0, 0}, {"font", store_str, ITEM(con_font.fontface), 0, 0, 0}, - {"requiressl", store_bit, ITEM(con_font.require_ssl), 1, ITEM_DEFAULT, 0}, {NULL, NULL, {0}, 0, 0, 0} }; diff --git a/bacula/src/gnome2-console/console_conf.h b/bacula/src/gnome2-console/console_conf.h index 7a31004436..580c499c34 100644 --- a/bacula/src/gnome2-console/console_conf.h +++ b/bacula/src/gnome2-console/console_conf.h @@ -79,7 +79,6 @@ struct DIRRES { struct CONFONTRES { RES hdr; char *fontface; /* Console Font specification */ - int require_ssl; /* Require SSL on all connections */ }; struct CONRES { diff --git a/bacula/src/tray-monitor/tray-monitor.c b/bacula/src/tray-monitor/tray-monitor.c index a20e9ca9a2..838ae3fbcf 100644 --- a/bacula/src/tray-monitor/tray-monitor.c +++ b/bacula/src/tray-monitor/tray-monitor.c @@ -101,6 +101,8 @@ static GtkWidget *timeoutspinner; char** xpm_generic_var; static gboolean blinkstate = TRUE; +PangoFontDescription *font_desc = NULL; + #define CONFIG_FILE "./tray-monitor.conf" /* default configuration file */ static void usage() @@ -188,6 +190,7 @@ int main(int argc, char *argv[]) DIRRES* dird; CLIENT* filed; STORE* stored; + CONFONTRES *con_font; setlocale(LC_ALL, ""); bindtextdomain("bacula", LOCALEDIR); @@ -412,7 +415,36 @@ int main(int argc, char *argv[]) gtk_text_buffer_set_text(buffer, "", -1); - PangoFontDescription *font_desc = pango_font_description_from_string ("Fixed 10"); + /* + * Gtk2/pango have different font names. Gnome2 comes with "Monospace 10" + */ + + LockRes(); + foreach_res(con_font, R_CONSOLE_FONT) { + if (!con_font->fontface) { + Dmsg1(400, "No fontface for %s\n", con_font->hdr.name); + continue; + } + Dmsg1(100, "Now loading: %s\n",con_font->fontface); + font_desc = pango_font_description_from_string(con_font->fontface); + if (font_desc == NULL) { + Dmsg2(400, "Load of requested ConsoleFont \"%s\" (%s) failed!\n", + con_font->hdr.name, con_font->fontface); + } else { + Dmsg2(400, "ConsoleFont \"%s\" (%s) loaded.\n", + con_font->hdr.name, con_font->fontface); + break; + } + } + UnlockRes(); + + if (!font_desc) { + font_desc = pango_font_description_from_string("Monospace 10"); + } + if (!font_desc) { + font_desc = pango_font_description_from_string("monospace"); + } + gtk_widget_modify_font(textview, font_desc); pango_font_description_free(font_desc); diff --git a/bacula/src/tray-monitor/tray_conf.c b/bacula/src/tray-monitor/tray_conf.c index 0623f29bf7..12789c8929 100644 --- a/bacula/src/tray-monitor/tray_conf.c +++ b/bacula/src/tray-monitor/tray_conf.c @@ -132,6 +132,13 @@ static RES_ITEM store_items[] = { {NULL, NULL, {0}, 0, 0, 0} }; +static RES_ITEM con_font_items[] = { + {"name", store_name, ITEM(con_font.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(con_font.hdr.desc), 0, 0, 0}, + {"font", store_str, ITEM(con_font.fontface), 0, 0, 0}, + {NULL, NULL, {0}, 0, 0, 0} +}; + /* * This is the master resource definition. * It must have one item for each of the resources. @@ -146,6 +153,7 @@ RES_TABLE resources[] = { {"director", dir_items, R_DIRECTOR}, {"client", cli_items, R_CLIENT}, {"storage", store_items, R_STORAGE}, + {"consolefont", con_font_items, R_CONSOLE_FONT}, {NULL, NULL, 0} }; @@ -173,15 +181,19 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm break; case R_DIRECTOR: sendit(sock, _("Director: name=%s address=%s FDport=%d\n"), - res->res_dir.hdr.name, res->res_dir.address, res->res_dir.DIRport); + res->res_dir.hdr.name, res->res_dir.address, res->res_dir.DIRport); break; case R_CLIENT: sendit(sock, _("Client: name=%s address=%s FDport=%d\n"), - res->res_client.hdr.name, res->res_client.address, res->res_client.FDport); + res->res_client.hdr.name, res->res_client.address, res->res_client.FDport); break; case R_STORAGE: sendit(sock, _("Storage: name=%s address=%s SDport=%d\n"), - res->res_store.hdr.name, res->res_store.address, res->res_store.SDport); + res->res_store.hdr.name, res->res_store.address, res->res_store.SDport); + break; + case R_CONSOLE_FONT: + sendit(sock, _("ConsoleFont: name=%s font face=%s\n"), + reshdr->name, NPRT(res->con_font.fontface)); break; default: sendit(sock, _("Unknown resource type %d in dump_resource.\n"), type); @@ -236,6 +248,11 @@ void free_resource(RES *sres, int type) free(res->res_store.password); } break; + case R_CONSOLE_FONT: + if (res->con_font.fontface) { + free(res->con_font.fontface); + } + break; default: printf(_("Unknown resource type %d in free_resource.\n"), type); } @@ -290,6 +307,7 @@ void save_resource(int type, RES_ITEM *items, int pass) case R_CLIENT: case R_STORAGE: case R_DIRECTOR: + case R_CONSOLE_FONT: break; default: Emsg1(M_ERROR, 0, _("Unknown resource type %d in save_resource.\n"), type); @@ -326,6 +344,9 @@ void save_resource(int type, RES_ITEM *items, int pass) case R_STORAGE: size = sizeof(STORE); break; + case R_CONSOLE_FONT: + size = sizeof(CONFONTRES); + break; default: printf(_("Unknown resource type %d in save_resource.\n"), type); error = 1; diff --git a/bacula/src/tray-monitor/tray_conf.h b/bacula/src/tray-monitor/tray_conf.h index 3a8f118d10..9679fbafae 100644 --- a/bacula/src/tray-monitor/tray_conf.h +++ b/bacula/src/tray-monitor/tray_conf.h @@ -45,8 +45,9 @@ enum rescode { R_DIRECTOR, R_CLIENT, R_STORAGE, + R_CONSOLE_FONT, R_FIRST = R_MONITOR, - R_LAST = R_STORAGE /* keep this updated */ + R_LAST = R_CONSOLE_FONT /* keep this updated */ }; @@ -110,7 +111,10 @@ struct STORE { int enable_ssl; /* Use SSL */ }; - +struct CONFONTRES { + RES hdr; + char *fontface; /* Console Font specification */ +}; /* Define the Union of all the above * resource structure definitions. @@ -120,5 +124,6 @@ union URES { DIRRES res_dir; CLIENT res_client; STORE res_store; + CONFONTRES con_font; RES hdr; }; diff --git a/bacula/src/version.h b/bacula/src/version.h index 051f837d12..c71cb4f86d 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.1.8" -#define BDATE "12 May 2007" -#define LSMDATE "12May07" +#define BDATE "14 May 2007" +#define LSMDATE "14May07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 70eeb1eabc..22f6fd5cb5 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,6 +1,9 @@ Technical notes on version 2.1 General: +14May07 +kes Apply implementation of tray-monitor font derived from gnome-console + submitted by Andreas Piesk 13May07 kes Eliminate important memory loss in SQLite kes Fixed the batch insert MySQL thread specific data that was not