Hello,

I'm not sure this is the best place to send this in, but since I would
like to have input from more people on this I thought I'd send it to
this list first. I am using the bacula-tray-monitor application to
monitor a client and the SD in our setup here (I could not get the
director to work on b-t-m, but I was OK with only SD, so I didn't try
harder ;)).

The problem is the UI layout doesn't let me add as many clients as I
want to monitor, nor lets me view the full information when there are
many jobs running on the SD. That is because the window gets too big and
goes outside of my desktop viewport.

The attached patch tries to address this last issue. I have not yet
addressed the 'many clients' problem, for if you add too many clients to
the config right now you'll still have the window grow bigger than your
screen, but it is still better than before. I'd like some feed back on
this improvement suggestion.

The patch is against Bacula 2.0.3. I downloaded the source package from
the Debian repository.

Thanks,

-- 
Gustavo Noronha <[EMAIL PROTECTED]>
 Coordenação de Sustentação e Segurança/CGI
--- tray-monitor.c~	2006-12-01 06:45:40.000000000 -0200
+++ tray-monitor.c	2007-08-29 16:03:13.000000000 -0300
@@ -348,21 +348,24 @@
 
    gtk_container_set_border_width(GTK_CONTAINER(window), 10);
 
+   GtkWidget* mainhbox = gtk_hbox_new(FALSE, 10);
    GtkWidget* vbox = gtk_vbox_new(FALSE, 10);
 
-   GtkWidget* daemon_table = gtk_table_new((nitems*2)+2, 3, FALSE);
+   GtkWidget* daemon_table = gtk_vbox_new(FALSE, 10);
 
-   gtk_table_set_col_spacings(GTK_TABLE(daemon_table), 8);
-
-   GtkWidget* separator = gtk_hseparator_new();
-   gtk_table_attach_defaults(GTK_TABLE(daemon_table), separator, 0, 3, 0, 1);
+   gtk_box_pack_start(GTK_BOX(mainhbox), daemon_table, FALSE, FALSE, 0);
+   gtk_box_pack_start(GTK_BOX(mainhbox), vbox, TRUE, TRUE, 0);
 
    GString *str;
    GSList *group = NULL;
    GtkWidget* radio;
    GtkWidget* align;
+   GtkWidget* scrolled_window;
 
    for (int i = 0; i < nitems; i++) {
+      GtkWidget *mytable = gtk_table_new(2, 2, FALSE);
+      GtkWidget *expander = gtk_expander_new_with_mnemonic(_("Details"));
+
       switch (items[i].type) {
       case R_DIRECTOR:
          str = g_string_new(((DIRRES*)(items[i].resource))->hdr.name);
@@ -391,22 +394,26 @@
       align = gtk_alignment_new(0.0, 0.5, 0.0, 1.0);
       gtk_container_add(GTK_CONTAINER(align), items[i].label);
 
-      gtk_table_attach(GTK_TABLE(daemon_table), radio, 0, 1, (i*2)+1, (i*2)+2,
-         GTK_FILL, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
-      gtk_table_attach(GTK_TABLE(daemon_table), items[i].image, 1, 2, (i*2)+1, (i*2)+2,
-         GTK_FILL, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
-      gtk_table_attach(GTK_TABLE(daemon_table), align, 2, 3, (i*2)+1, (i*2)+2,
-         (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
-
-      separator = gtk_hseparator_new();
-      gtk_table_attach_defaults(GTK_TABLE(daemon_table), separator, 0, 3, (i*2)+2, (i*2)+3);
+      gtk_table_attach(GTK_TABLE(mytable), radio, 0, 1, 0, 1,
+         GTK_FILL, (GtkAttachOptions)(GTK_FILL), 0, 0);
+      gtk_table_attach(GTK_TABLE(mytable), items[i].image, 1, 2, 0, 1,
+         GTK_FILL, (GtkAttachOptions)(GTK_FILL), 0, 0);
+
+      gtk_container_add(GTK_CONTAINER(expander), align);
+      gtk_table_attach(GTK_TABLE(mytable), expander, 0, 2, 1, 2,
+         (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_FILL), 0, 0);
 
+      gtk_box_pack_start(GTK_BOX(daemon_table), mytable, FALSE, FALSE, 0);
       group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio));
    }
 
-   gtk_box_pack_start(GTK_BOX(vbox), daemon_table, FALSE, FALSE, 0);
+   scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
+				  GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+   gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
 
    textview = gtk_text_view_new();
+   gtk_widget_set_size_request(textview, 570, 400);
 
    buffer = gtk_text_buffer_new(NULL);
 
@@ -420,10 +427,11 @@
    gtk_text_view_set_right_margin(GTK_TEXT_VIEW(textview), 20);
 
    gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);
+   gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD);
 
    gtk_text_view_set_buffer(GTK_TEXT_VIEW(textview), buffer);
 
-   gtk_box_pack_start(GTK_BOX(vbox), textview, TRUE, TRUE, 0);
+   gtk_container_add(GTK_CONTAINER(scrolled_window), textview);
 
    GtkWidget* hbox = gtk_hbox_new(FALSE, 10);
 
@@ -450,9 +458,9 @@
 
    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
-   gtk_container_add(GTK_CONTAINER (window), vbox);
+   gtk_container_add(GTK_CONTAINER (window), mainhbox);
 
-   gtk_widget_show_all(vbox);
+   gtk_widget_show_all(mainhbox);
 
    gtk_main();
    

Attachment: signature.asc
Description: Esta é uma parte de mensagem assinada digitalmente

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to