]> git.sur5r.net Git - bacula/bacula/commitdiff
Apply implementation of tray-monitor font derived from gnome-console
authorKern Sibbald <kern@sibbald.com>
Mon, 14 May 2007 08:31:56 +0000 (08:31 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 14 May 2007 08:31:56 +0000 (08:31 +0000)
     submitted by Andreas Piesk <a.piesk@gmx.net>

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4778 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/gnome2-console/console_conf.c
bacula/src/gnome2-console/console_conf.h
bacula/src/tray-monitor/tray-monitor.c
bacula/src/tray-monitor/tray_conf.c
bacula/src/tray-monitor/tray_conf.h
bacula/src/version.h
bacula/technotes-2.1

index e8c442a0517797c6adf9b1bc8e2e8a31195cb384..0903d30f64be6ffd24b2dd6552e6652aba9da8ca 100644 (file)
@@ -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}
 };
 
index 7a3100443666c610c0867b7fe2498f3222eb4268..580c499c346b31ca8a39be686edd3ebde09150ec 100644 (file)
@@ -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 {
index a20e9ca9a2af64914c8e252a291a44bf58b8fed7..838ae3fbcfb6cc733301b31a5775aad9ac0d8b3c 100644 (file)
@@ -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);
 
index 0623f29bf7f396fb8bca9213aa26048e8cfac0d1..12789c89297c9b2909c707010f1d215877c967c7 100644 (file)
@@ -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;
index 3a8f118d10b3375830ed79e4dd34b3de3a6565d9..9679fbafaecce19ba500a0fa737ba036d43ab714 100644 (file)
@@ -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;
 };
index 051f837d12cefa4071cdbb7d1b91b0d759ddce7d..c71cb4f86da4db0d7b180823f07c500cc719b163 100644 (file)
@@ -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 */
index 70eeb1eabc77b4f7524b95fcab8d87fdba6d45e4..22f6fd5cb58d6e28a01b28b462c7a9f6c4c25837 100644 (file)
@@ -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 <a.piesk@gmx.net>
 13May07
 kes  Eliminate important memory loss in SQLite
 kes  Fixed the batch insert MySQL thread specific data that was not