]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/gnome2-console/console.c
03Dec05
[bacula/bacula] / bacula / src / gnome2-console / console.c
index e2223c49a25f1f2b3159f8a3c9300a7e1d41fcdf..38fc765ac94be74363b44cdf143044cdb991fd9b 100644 (file)
@@ -48,8 +48,8 @@ GtkWidget *restore_file_selection;
 GtkWidget *dir_select;
 GtkWidget *about1;           /* about box */
 GtkWidget *label_dialog;
-GdkFont   *text_font = NULL;
 PangoFontDescription *font_desc;
+PangoFontDescription *console_font_desc = NULL;
 pthread_mutex_t cmd_mutex = PTHREAD_MUTEX_INITIALIZER;
 pthread_cond_t  cmd_wait;
 char cmd[1000];
@@ -86,14 +86,14 @@ static void usage()
 {
    fprintf(stderr, _(
 "Copyright (C) 2002-2005 Kern Sibbald\n"
-"\nVersion: " VERSION " (" BDATE ") %s %s %s\n\n"
+"\nVersion: %s (%s) %s %s %s\n\n"
 "Usage: gnome-console [-s] [-c config_file] [-d debug_level] [config_file]\n"
 "       -c <file>   set configuration file to file\n"
 "       -dnn        set debug level to nn\n"
 "       -s          no signals\n"
 "       -t          test - read configuration and exit\n"
 "       -?          print this message.\n"
-"\n"), HOST_OS, DISTNAME, DISTVER);
+"\n"), VERSION, BDATE, HOST_OS, DISTNAME, DISTVER);
 
    exit(1);
 }
@@ -200,6 +200,10 @@ int main(int argc, char *argv[])
    const char *gargv[2] = {"gnome-console", NULL};
    CONFONTRES *con_font;
 
+   setlocale(LC_ALL, "");
+   bindtextdomain("bacula", LOCALEDIR);
+   textdomain("bacula");
+
    init_stack_dump();
    my_name_is(argc, argv, "gnome-console");
    init_msg(NULL, NULL);
@@ -288,12 +292,7 @@ int main(int argc, char *argv[])
    gtk_widget_show(console);
 
 /*
- * Thanks to Phil Stracchino for providing the font configuration code.
- * original default:
-   text_font = gdk_font_load("-misc-fixed-medium-r-normal-*-*-130-*-*-c-*-koi8-r");
- * this works for me:
-   text_font = gdk_font_load("-Bigelow & Holmes-lucida console-medium-r-semi condensed-*-12-0-100-100-m-0-iso8859-1");
- * and, new automagic:font specification!
+ * Gtk2/pango have different font names. Gnome2 comes with "Monospace 10"
  */
 
    LockRes();
@@ -302,8 +301,9 @@ int main(int argc, char *argv[])
           Dmsg1(400, "No fontface for %s\n", con_font->hdr.name);
           continue;
        }
-       text_font = gdk_font_load(con_font->fontface);
-       if (text_font == NULL) {
+       Dmsg1(100, "Now loading: %s\n",con_font->fontface);
+        console_font_desc = pango_font_description_from_string(con_font->fontface);
+       if (console_font_desc == NULL) {
            Dmsg2(400, "Load of requested ConsoleFont \"%s\" (%s) failed!\n",
                   con_font->hdr.name, con_font->fontface);
        } else {
@@ -314,16 +314,16 @@ int main(int argc, char *argv[])
    }
    UnlockRes();
 
-   if (text_font == NULL) {
-       Dmsg1(400, "Attempting to load fallback font %s\n",
-              "-misc-fixed-medium-r-normal-*-*-130-*-*-c-*-iso8859-1");
-       text_font = gdk_font_load("-misc-fixed-medium-r-normal-*-*-130-*-*-c-*-iso8859-1");
-   }
    font_desc = pango_font_description_from_string("LucidaTypewriter 9");
    gtk_widget_modify_font(console, font_desc);
-   gtk_widget_modify_font(text1, font_desc);
    gtk_widget_modify_font(entry1, font_desc);
    gtk_widget_modify_font(status1, font_desc);
+   if (console_font_desc) {
+      gtk_widget_modify_font(text1, console_font_desc);
+      pango_font_description_free(console_font_desc);
+   } else {
+      gtk_widget_modify_font(text1, font_desc);
+   }
    pango_font_description_free(font_desc);
 
    if (test_config) {
@@ -395,13 +395,13 @@ static GList *get_list(char *cmd)
 
 }
 
-static GList *get_and_fill_combo(GtkWidget *dialog, const char *combo_name, const char *cm)
+static GList *get_and_fill_combo(GtkWidget *dialog, const char *combo_name, const char *dircmd)
 {
    GtkWidget *combo;
    GList *options;
 
    combo = lookup_widget(dialog, combo_name);
-   options = get_list(cmd);
+   options = get_list((char *)dircmd);
    if (combo && options) {
       gtk_combo_set_popdown_strings(GTK_COMBO(combo), options);
    }
@@ -491,7 +491,7 @@ int connect_to_director(gpointer data)
    /* Initialize Console TLS context */
    if (cons && (cons->tls_enable || cons->tls_require)) {
       /* Generate passphrase prompt */
-      bsnprintf(buf, sizeof(buf), "Passphrase for Console \"%s\" TLS private key: ", cons->hdr.name);
+      bsnprintf(buf, sizeof(buf), _("Passphrase for Console \"%s\" TLS private key: "), cons->hdr.name);
 
       /* Initialize TLS context:
        * Args: CA certfile, CA certdir, Certfile, Keyfile,
@@ -513,7 +513,7 @@ int connect_to_director(gpointer data)
    /* Initialize Director TLS context */
    if (dir->tls_enable || dir->tls_require) {
       /* Generate passphrase prompt */
-      bsnprintf(buf, sizeof(buf), "Passphrase for Director \"%s\" TLS private key: ", dir->hdr.name);
+      bsnprintf(buf, sizeof(buf), _("Passphrase for Director \"%s\" TLS private key: "), dir->hdr.name);
 
       /* Initialize TLS context:
        * Args: CA certfile, CA certdir, Certfile, Keyfile,
@@ -532,7 +532,7 @@ int connect_to_director(gpointer data)
    }
 
 
-   UA_sock = bnet_connect(NULL, 5, 15, "Director daemon", dir->address,
+   UA_sock = bnet_connect(NULL, 5, 15, _("Director daemon"), dir->address,
                           NULL, dir->DIRport, 0);
    if (UA_sock == NULL) {
       return 0;
@@ -544,7 +544,7 @@ int connect_to_director(gpointer data)
       return 0;
    }
 
-   set_status(" Initializing ...");
+   set_status(_(" Initializing ..."));
 
    bnet_fsend(UA_sock, "autodisplay on");
 
@@ -580,7 +580,7 @@ int connect_to_director(gpointer data)
    fill_combo(restore_dialog, "combo_restore_pool", pool_list);
    fill_combo(restore_dialog, "combo_restore_storage", storage_list);
 
-   set_status(" Connected");
+   set_status(_(" Connected"));
    return 1;
 }
 
@@ -743,7 +743,7 @@ void set_statusf(const char *fmt, ...)
 
 void set_status_ready()
 {
-   gtk_label_set_text(GTK_LABEL(status1), " Ready");
+   gtk_label_set_text(GTK_LABEL(status1), _(" Ready"));
    ready = true;
 // set_scroll_bar_to_end();
 }