]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/gnome2-console/console.c
Add missing ;
[bacula/bacula] / bacula / src / gnome2-console / console.c
index e157edfaea9afb773f87fc523f7a9e308d050f1f..1fb76c08d4eded258c87f46eaadb72d6675e585b 100644 (file)
@@ -74,7 +74,6 @@ static int director_reader_running = FALSE;
 static bool at_prompt = false;
 static bool ready = false;
 static bool quit = false;
-static bool adjusted = false;
 static guint initial;
 
 #define CONFIG_FILE "./gnome-console.conf"   /* default configuration file */
@@ -387,12 +386,12 @@ int connect_to_director(gpointer data)
 
    memset(&jcr, 0, sizeof(jcr));
    
-   set_statusf(_(" Connecting to Director %s:%d\n"), dir->address,dir->DIRport);
-   set_textf(_("Connecting to Director %s:%d\n"), dir->address,dir->DIRport);
+   set_statusf(_(" Connecting to Director %s:%d"), dir->address,dir->DIRport);
+   set_textf(_("Connecting to Director %s:%d\n\n"), dir->address,dir->DIRport);
 
-// while (gtk_events_pending()) {     /* fully paint screen */
-//    gtk_main_iteration();
-// }
+   while (gtk_events_pending()) {     /* fully paint screen */
+      gtk_main_iteration();
+   }
    UA_sock = bnet_connect(NULL, 5, 15, "Director daemon", dir->address, 
                          NULL, dir->DIRport, 0);
    if (UA_sock == NULL) {
@@ -548,6 +547,7 @@ void set_textf(char *fmt, ...)
    int len;
    va_start(arg_ptr, fmt);
    len = bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
+   va_end(arg_ptr);
    set_text(buf, len);
 }
 
@@ -565,10 +565,7 @@ void set_text(char *buf, int len)
    if (text_chars > MAX_TEXT_CHARS) {
       truncate_text_chars();
    }
-   buf_len = gtk_text_buffer_get_char_count(textbuf);
-   gtk_text_buffer_get_iter_at_offset(textbuf, &iter, buf_len - 1);
-   gtk_text_iter_set_offset(&iter, buf_len);
-   adjusted = false;
+   set_scroll_bar_to_end();
 }
 
 void set_statusf(char *fmt, ...)
@@ -578,8 +575,9 @@ void set_statusf(char *fmt, ...)
    int len;
    va_start(arg_ptr, fmt);
    len = bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
+   va_end(arg_ptr);
    gtk_label_set_text(GTK_LABEL(status1), buf);
-   set_scroll_bar_to_end();
+// set_scroll_bar_to_end();
    ready = false;
 }
 
@@ -587,27 +585,28 @@ void set_status_ready()
 {
    gtk_label_set_text(GTK_LABEL(status1), " Ready");
    ready = true;
-   set_scroll_bar_to_end();
+// set_scroll_bar_to_end();
 }
 
 void set_status(char *buf)
 {
    gtk_label_set_text(GTK_LABEL(status1), buf);
-   set_scroll_bar_to_end();
+// set_scroll_bar_to_end();
    ready = false;
 }
 
 static void set_scroll_bar_to_end(void)
 {
-   GtkAdjustment *vadj;
-   /*
-    * Force the scroll bars to the bottom so that most
-    * recent text is on screen.
-    */
-   if ((ready || at_prompt) && !adjusted) {
-      adjusted = true;
-      vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scroll1));
-      gtk_adjustment_set_value(vadj, vadj->upper);
-   }
-   gtk_widget_show(text1);
+   GtkTextBuffer* textbuf = NULL;
+   GtkTextIter iter;
+   guint buf_len;
+
+   textbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text1));
+   buf_len = gtk_text_buffer_get_char_count(textbuf);
+   gtk_text_buffer_get_iter_at_offset(textbuf, &iter, buf_len - 1);
+   gtk_text_iter_set_offset(&iter, buf_len);
+   gtk_text_buffer_place_cursor(textbuf, &iter);
+   gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(text1),
+              gtk_text_buffer_get_mark(textbuf, "insert"), 
+             0, TRUE, 0.0, 1.0);
 }