From 15519961f3e6f3b5295f4e253268a8dff8ce9eee Mon Sep 17 00:00:00 2001 From: mbkma Date: Tue, 21 Dec 2021 23:47:49 +0100 Subject: port interface to ui files see https://gitlab.gnome.org/GNOME/gnome-system-monitor/-/commit/3df5cd02abaafe9789be53b5b78425126d7c1a07 and following commits --- src/Makefile.am | 1 + src/disks.cpp | 22 +- src/disks.h | 4 +- src/interface.cpp | 314 +++++++--------------------- src/interface.ui | 552 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/msm.gresource.xml | 1 + src/proctable.cpp | 10 +- 7 files changed, 630 insertions(+), 274 deletions(-) create mode 100644 src/interface.ui diff --git a/src/Makefile.am b/src/Makefile.am index 9f882fb..1490f77 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -86,6 +86,7 @@ CLEANFILES = \ EXTRA_DIST = \ msm.gresource.xml \ + interface.ui \ preferences.ui \ $(gsettingsschema_in_files) diff --git a/src/disks.cpp b/src/disks.cpp index 7dd398a..a645492 100644 --- a/src/disks.cpp +++ b/src/disks.cpp @@ -390,10 +390,9 @@ cb_disks_column_resized(GtkWidget *widget, GParamSpec *pspec, gpointer data) timeout_id = g_timeout_add (250, save_column_width, data); } -GtkWidget * -create_disk_view(ProcData *procdata) +void +create_disk_view(ProcData *procdata, GtkBuilder *builder) { - GtkWidget *disk_box; GtkWidget *scrolled; GtkWidget *disk_tree; GtkListStore *model; @@ -412,18 +411,7 @@ create_disk_view(ProcData *procdata) N_("Used") }; - disk_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); - - gtk_container_set_border_width(GTK_CONTAINER(disk_box), 12); - - scrolled = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), - GTK_SHADOW_IN); - - gtk_box_pack_start(GTK_BOX(disk_box), scrolled, TRUE, TRUE, 0); + scrolled = GTK_WIDGET (gtk_builder_get_object (builder, "disks_scrolled")); model = gtk_list_store_new(DISK_N_COLUMNS, /* n columns */ G_TYPE_STRING, /* DISK_DEVICE */ @@ -524,13 +512,9 @@ create_disk_view(ProcData *procdata) /* numeric sort */ - gtk_widget_show_all(disk_box); - procman_get_tree_state(procdata->settings, disk_tree, "disktreenew"); g_signal_connect (G_OBJECT(disk_tree), "columns-changed", G_CALLBACK(cb_disk_columns_changed), procdata); - - return disk_box; } diff --git a/src/disks.h b/src/disks.h index c62c47a..5681c15 100644 --- a/src/disks.h +++ b/src/disks.h @@ -3,8 +3,8 @@ #include "procman.h" -GtkWidget * -create_disk_view(ProcData *procdata); +void +create_disk_view(ProcData *procdata, GtkBuilder *builder); int cb_update_disks(gpointer procdata); diff --git a/src/interface.cpp b/src/interface.cpp index 6a46d1c..3597967 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -42,11 +42,6 @@ #include "sysinfo.h" #include "gsm_color_button.h" -#define INITIAL_MINIMUM_LENGTH 3 -#define INITIAL_MAXIMUM_LENGTH 12 -#define INITIAL_CSPACING 2 -#define INITIAL_RSPACING 2 - static void cb_toggle_tree (GtkAction *action, gpointer data); static void cb_proc_goto_tab (gint tab); @@ -201,49 +196,30 @@ static const char ui_info[] = " "; -static GtkWidget * -create_proc_view (ProcData *procdata) +static void +create_proc_view(ProcData *procdata, GtkBuilder * builder) { - GtkWidget *vbox1; - GtkWidget *hbox1; + GtkWidget *proctree; GtkWidget *scrolled; - GtkWidget *hbox2; char* string; - vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), 12); - - hbox1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); - gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0); - + /* create the processes tab */ string = make_loadavg_string (); - procdata->loadavg = gtk_label_new (string); + procdata->loadavg = GTK_WIDGET (gtk_builder_get_object (builder, "load_avg_label")); + gtk_label_set_text (GTK_LABEL (procdata->loadavg), string); g_free (string); - gtk_box_pack_start (GTK_BOX (hbox1), procdata->loadavg, FALSE, FALSE, 0); + proctree = proctable_new (procdata); + scrolled = GTK_WIDGET (gtk_builder_get_object (builder, "processes_scrolled")); - scrolled = proctable_new (procdata); - if (!scrolled) - return NULL; - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), - GTK_SHADOW_IN); + gtk_container_add (GTK_CONTAINER (scrolled), proctree); - gtk_box_pack_start (GTK_BOX (vbox1), scrolled, TRUE, TRUE, 0); - - - hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0); - - procdata->endprocessbutton = gtk_button_new_with_mnemonic (_("End _Process")); - gtk_box_pack_end (GTK_BOX (hbox2), procdata->endprocessbutton, FALSE, FALSE, 0); + procdata->endprocessbutton = GTK_WIDGET (gtk_builder_get_object (builder, "endprocessbutton")); g_signal_connect (G_OBJECT (procdata->endprocessbutton), "clicked", G_CALLBACK (cb_end_process_button_pressed), procdata); - - /* create popup_menu */ - procdata->popup_menu = gtk_ui_manager_get_widget (procdata->uimanager, "/PopupMenu"); - - return vbox1; + /* create popup_menu for the processes tab */ + procdata->popup_menu = gtk_ui_manager_get_widget (procdata->uimanager, "/PopupMenu"); } @@ -264,16 +240,14 @@ make_title_label (const char *text) } -static GtkWidget * -create_sys_view (ProcData *procdata) +static void +create_sys_view (ProcData *procdata, GtkBuilder * builder) { - GtkWidget *vbox, *hbox; - GtkWidget *cpu_box, *mem_box, *net_box; GtkWidget *cpu_graph_box, *mem_graph_box, *net_graph_box; - GtkWidget *label,*cpu_label, *spacer; - GtkWidget *grid; + GtkWidget *label,*cpu_label; + GtkWidget *table; GtkWidget *color_picker; - GtkWidget *mem_legend_box, *net_legend_box; + GtkWidget *picker_alignment; LoadGraph *cpu_graph, *mem_graph, *net_graph; gint i; @@ -284,20 +258,9 @@ create_sys_view (ProcData *procdata) // Translators: color picker title, %s is CPU, Memory, Swap, Receiving, Sending title_template = g_strdup(_("Pick a Color for '%s'")); - vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); - - gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); - /* The CPU BOX */ - cpu_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); - gtk_box_pack_start (GTK_BOX (vbox), cpu_box, TRUE, TRUE, 0); - - label = make_title_label (_("CPU History")); - gtk_box_pack_start (GTK_BOX (cpu_box), label, FALSE, FALSE, 0); - - cpu_graph_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); - gtk_box_pack_start (GTK_BOX (cpu_box), cpu_graph_box, TRUE, TRUE, 0); + cpu_graph_box = GTK_WIDGET (gtk_builder_get_object (builder, "cpu_graph_box")); cpu_graph = new LoadGraph(LOAD_GRAPH_CPU); gtk_box_pack_start (GTK_BOX (cpu_graph_box), @@ -306,29 +269,13 @@ create_sys_view (ProcData *procdata) TRUE, 0); - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - spacer = gtk_label_new (""); - gtk_widget_set_size_request(GTK_WIDGET(spacer), 57, -1); - gtk_box_pack_start (GTK_BOX (hbox), spacer, - FALSE, FALSE, 0); - - - gtk_box_pack_start (GTK_BOX (cpu_graph_box), hbox, - FALSE, FALSE, 0); - - GtkWidget* flowbox = gtk_flow_box_new (); - gtk_widget_set_halign (flowbox, GTK_ALIGN_FILL); - gtk_widget_set_valign (flowbox, GTK_ALIGN_START); - gtk_flow_box_set_column_spacing (GTK_FLOW_BOX (flowbox), INITIAL_CSPACING); - gtk_flow_box_set_row_spacing (GTK_FLOW_BOX (flowbox), INITIAL_RSPACING); - gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (flowbox), INITIAL_MINIMUM_LENGTH); - gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (flowbox), INITIAL_MAXIMUM_LENGTH); - gtk_box_pack_start(GTK_BOX(hbox), flowbox, TRUE, TRUE, 0); - + GtkWidget* flowbox = GTK_WIDGET (gtk_builder_get_object (builder, "cpu_flow_box")); + gtk_box_reorder_child (GTK_BOX (cpu_graph_box), flowbox, 1); for (i=0;iconfig.num_cpus; i++) { GtkWidget *temp_hbox; temp_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_container_add (GTK_CONTAINER (flowbox), temp_hbox); color_picker = gsm_color_button_new (&cpu_graph->colors.at(i), GSMCP_TYPE_CPU); @@ -359,15 +306,8 @@ create_sys_view (ProcData *procdata) procdata->cpu_graph = cpu_graph; - mem_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); - gtk_box_pack_start (GTK_BOX (vbox), mem_box, TRUE, TRUE, 0); - - label = make_title_label (_("Memory and Swap History")); - gtk_box_pack_start (GTK_BOX (mem_box), label, FALSE, FALSE, 0); - - mem_graph_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); - gtk_box_pack_start (GTK_BOX (mem_box), mem_graph_box, TRUE, TRUE, 0); - + /** The memory box */ + mem_graph_box = GTK_WIDGET (gtk_builder_get_object (builder, "mem_graph_box")); mem_graph = new LoadGraph(LOAD_GRAPH_MEM); gtk_box_pack_start (GTK_BOX (mem_graph_box), @@ -376,79 +316,38 @@ create_sys_view (ProcData *procdata) TRUE, 0); - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - spacer = gtk_label_new (""); - gtk_widget_set_size_request(GTK_WIDGET(spacer), 54, -1); - gtk_box_pack_start (GTK_BOX (hbox), spacer, - FALSE, FALSE, 0); + table = GTK_WIDGET (gtk_builder_get_object (builder, "mem_table")); - - gtk_box_pack_start (GTK_BOX (mem_graph_box), hbox, - FALSE, FALSE, 0); - - mem_legend_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10); - gtk_box_pack_start (GTK_BOX (hbox), mem_legend_box, - TRUE, TRUE, 0); - - grid = gtk_grid_new (); - gtk_grid_set_row_spacing (GTK_GRID (grid), 6); - gtk_grid_set_column_spacing (GTK_GRID (grid), 6); - gtk_box_pack_start (GTK_BOX (mem_legend_box), grid, - TRUE, TRUE, 0); - - label_text = g_strdup(_("Memory")); color_picker = load_graph_get_mem_color_picker(mem_graph); g_signal_connect (G_OBJECT (color_picker), "color_set", G_CALLBACK (cb_mem_color_changed), procdata); - title_text = g_strdup_printf(title_template, label_text); + title_text = g_strdup_printf(title_template, _("Memory")); gsm_color_button_set_title(GSM_COLOR_BUTTON(color_picker), title_text); g_free(title_text); - gtk_grid_attach (GTK_GRID (grid), color_picker, 0, 0, 1, 2); - label = gtk_label_new (label_text); - g_free(label_text); - gtk_label_set_xalign (GTK_LABEL (label), 0.0); - gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 7, 1); - - gtk_grid_attach (GTK_GRID (grid), - load_graph_get_labels(mem_graph)->memory, - 1, 1, 1, 1); + gtk_grid_attach (GTK_GRID (table), color_picker, 0, 0, 1, 2); - grid = gtk_grid_new (); - gtk_grid_set_row_spacing (GTK_GRID (grid), 6); - gtk_grid_set_column_spacing (GTK_GRID (grid), 6); - gtk_box_pack_start (GTK_BOX (mem_legend_box), grid, - TRUE, TRUE, 0); + label = load_graph_get_labels(mem_graph)->memory; + gtk_label_set_xalign(GTK_LABEL(label), 0); + gtk_grid_attach (GTK_GRID (table), label, 1, 1, 1, 1); - label_text = g_strdup(_("Swap")); color_picker = load_graph_get_swap_color_picker(mem_graph); g_signal_connect (G_OBJECT (color_picker), "color_set", G_CALLBACK (cb_swap_color_changed), procdata); - title_text = g_strdup_printf(title_template, label_text); + title_text = g_strdup_printf(title_template, _("Swap")); gsm_color_button_set_title(GSM_COLOR_BUTTON(color_picker), title_text); g_free(title_text); - gtk_grid_attach (GTK_GRID (grid), color_picker, 0, 0, 1, 2); - label = gtk_label_new (label_text); - g_free(label_text); - gtk_label_set_xalign (GTK_LABEL (label), 0.0); - gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 7, 1); + gtk_grid_attach (GTK_GRID (table), color_picker, 2, 0, 1, 2); - gtk_grid_attach (GTK_GRID (grid), - load_graph_get_labels(mem_graph)->swap, - 1, 1, 1, 1); + label = load_graph_get_labels(mem_graph)->swap; + gtk_label_set_xalign(GTK_LABEL(label), 0); + gtk_grid_attach (GTK_GRID (table), label, 3, 1, 1, 1); procdata->mem_graph = mem_graph; /* The net box */ - net_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); - gtk_box_pack_start (GTK_BOX (vbox), net_box, TRUE, TRUE, 0); - - label = make_title_label (_("Network History")); - gtk_box_pack_start (GTK_BOX (net_box), label, FALSE, FALSE, 0); - - net_graph_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); - gtk_box_pack_start (GTK_BOX (net_box), net_graph_box, TRUE, TRUE, 0); + net_graph_box = GTK_WIDGET (gtk_builder_get_object (builder, "net_graph_box")); net_graph = new LoadGraph(LOAD_GRAPH_NET); gtk_box_pack_start (GTK_BOX (net_graph_box), @@ -457,106 +356,48 @@ create_sys_view (ProcData *procdata) TRUE, 0); - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - spacer = gtk_label_new (""); - gtk_widget_set_size_request(GTK_WIDGET(spacer), 54, -1); - gtk_box_pack_start (GTK_BOX (hbox), spacer, - FALSE, FALSE, 0); - - - gtk_box_pack_start (GTK_BOX (net_graph_box), hbox, - FALSE, FALSE, 0); - - net_legend_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10); - gtk_box_pack_start (GTK_BOX (hbox), net_legend_box, - TRUE, TRUE, 0); - - grid = gtk_grid_new (); - gtk_grid_set_row_spacing (GTK_GRID (grid), 6); - gtk_grid_set_column_spacing (GTK_GRID (grid), 6); - gtk_box_pack_start (GTK_BOX (net_legend_box), grid, - TRUE, TRUE, 0); - - label_text = g_strdup(_("Receiving")); + table = GTK_WIDGET (gtk_builder_get_object (builder, "net_table")); color_picker = gsm_color_button_new ( &net_graph->colors.at(0), GSMCP_TYPE_NETWORK_IN); g_signal_connect (G_OBJECT (color_picker), "color_set", G_CALLBACK (cb_net_in_color_changed), procdata); - title_text = g_strdup_printf(title_template, label_text); + title_text = g_strdup_printf(title_template, _("Receiving")); gsm_color_button_set_title(GSM_COLOR_BUTTON(color_picker), title_text); g_free(title_text); - gtk_grid_attach (GTK_GRID (grid), color_picker, 0, 0, 1, 2); - label = gtk_label_new (label_text); - g_free(label_text); - gtk_label_set_xalign (GTK_LABEL (label), 0.0); - gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1); + picker_alignment = GTK_WIDGET (gtk_builder_get_object (builder, "receiving_picker_alignment")); + gtk_container_add (GTK_CONTAINER (picker_alignment), color_picker); - gtk_label_set_xalign (GTK_LABEL (load_graph_get_labels(net_graph)->net_in), 1.0); + label = load_graph_get_labels(net_graph)->net_in; + gtk_label_set_xalign(GTK_LABEL(label), 1); + gtk_grid_attach (GTK_GRID (table), label, 2, 0, 1, 1); - gtk_widget_set_size_request(GTK_WIDGET(load_graph_get_labels(net_graph)->net_in), 100, -1); - gtk_widget_set_hexpand (load_graph_get_labels(net_graph)->net_in, TRUE); - gtk_grid_attach (GTK_GRID (grid), load_graph_get_labels(net_graph)->net_in, 2, 0, 1, 1); - - label = gtk_label_new (_("Total Received")); - gtk_label_set_xalign (GTK_LABEL (label), 0.0); - gtk_grid_attach (GTK_GRID (grid), label, 1, 1, 1, 1); - - gtk_label_set_xalign (GTK_LABEL (load_graph_get_labels(net_graph)->net_in_total), 1.0); - gtk_grid_attach (GTK_GRID (grid), - load_graph_get_labels(net_graph)->net_in_total, - 2, 1, 1, 1); - - spacer = gtk_label_new (""); - gtk_widget_set_size_request(GTK_WIDGET(spacer), 38, -1); - gtk_grid_attach (GTK_GRID (grid), spacer, 3, 0, 1, 1); - - grid = gtk_grid_new (); - gtk_grid_set_row_spacing (GTK_GRID (grid), 6); - gtk_grid_set_column_spacing (GTK_GRID (grid), 6); - gtk_box_pack_start (GTK_BOX (net_legend_box), grid, - TRUE, TRUE, 0); - - label_text = g_strdup(_("Sending")); + label = load_graph_get_labels(net_graph)->net_in_total; + gtk_label_set_xalign(GTK_LABEL(label), 1); + gtk_grid_attach (GTK_GRID (table), label, 2, 1, 1, 1); color_picker = gsm_color_button_new ( &net_graph->colors.at(1), GSMCP_TYPE_NETWORK_OUT); g_signal_connect (G_OBJECT (color_picker), "color_set", G_CALLBACK (cb_net_out_color_changed), procdata); - title_text = g_strdup_printf(title_template, label_text); + title_text = g_strdup_printf(title_template, _("Sending")); gsm_color_button_set_title(GSM_COLOR_BUTTON(color_picker), title_text); g_free(title_text); - gtk_grid_attach (GTK_GRID (grid), color_picker, 0, 0, 1, 2); - label = gtk_label_new (label_text); - g_free(label_text); - gtk_label_set_xalign (GTK_LABEL (label), 0.0); - gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1); + picker_alignment = GTK_WIDGET (gtk_builder_get_object (builder, "sending_picker_alignment")); + gtk_container_add (GTK_CONTAINER (picker_alignment), color_picker); - gtk_label_set_xalign (GTK_LABEL (load_graph_get_labels(net_graph)->net_out), 1.0); + label = load_graph_get_labels(net_graph)->net_out; + gtk_label_set_xalign(GTK_LABEL(label), 0); + gtk_grid_attach (GTK_GRID (table), label, 6, 0, 1, 1); - gtk_widget_set_size_request(GTK_WIDGET(load_graph_get_labels(net_graph)->net_out), 100, -1); - gtk_widget_set_hexpand (load_graph_get_labels(net_graph)->net_out, TRUE); - gtk_grid_attach (GTK_GRID (grid), load_graph_get_labels(net_graph)->net_out, 2, 0, 1, 1); - - label = gtk_label_new (_("Total Sent")); - gtk_label_set_xalign (GTK_LABEL (label), 0.0); - gtk_grid_attach (GTK_GRID (grid), label, 1, 1, 1, 1); - - gtk_label_set_xalign (GTK_LABEL (load_graph_get_labels(net_graph)->net_out_total), 1.0); - gtk_grid_attach (GTK_GRID (grid), - load_graph_get_labels(net_graph)->net_out_total, - 2, 1, 1, 1); - - spacer = gtk_label_new (""); - gtk_widget_set_size_request(GTK_WIDGET(spacer), 38, -1); - gtk_grid_attach (GTK_GRID (grid), spacer, 3, 0, 1, 1); + label = load_graph_get_labels(net_graph)->net_out_total; + gtk_label_set_xalign(GTK_LABEL(label), 1); + gtk_grid_attach (GTK_GRID (table), label, 6, 1, 1, 1); procdata->net_graph = net_graph; g_free(title_template); - - return vbox; } static void @@ -624,13 +465,12 @@ create_main_window (ProcData *procdata) GtkWidget *menubar; GtkWidget *main_box; GtkWidget *notebook; - GtkWidget *tab_label1, *tab_label2, *tab_label3; - GtkWidget *vbox1; - GtkWidget *sys_box, *devices_box; - GtkWidget *sysinfo_box, *sysinfo_label; + GtkBuilder *builder; + + builder = gtk_builder_new_from_resource("/org/mate/mate-system-monitor/interface.ui"); - app = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(app), _("System Monitor")); + app = GTK_WIDGET (gtk_builder_get_object (builder, "main_window")); + main_box = GTK_WIDGET (gtk_builder_get_object (builder, "main_box")); GdkScreen* screen = gtk_widget_get_screen(app); /* use visual, if available */ @@ -638,16 +478,13 @@ create_main_window (ProcData *procdata) if (visual) gtk_widget_set_visual(app, visual); - main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add(GTK_CONTAINER(app), main_box); - width = procdata->config.width; height = procdata->config.height; xpos = procdata->config.xpos; ypos = procdata->config.ypos; gtk_window_set_default_size (GTK_WINDOW (app), width, height); gtk_window_move(GTK_WINDOW (app), xpos, ypos); - gtk_window_set_resizable (GTK_WINDOW (app), TRUE); + if (procdata->config.maximized) { gtk_window_maximize(GTK_WINDOW(app)); } @@ -702,28 +539,14 @@ create_main_window (ProcData *procdata) menubar = gtk_ui_manager_get_widget (procdata->uimanager, "/MenuBar"); gtk_box_pack_start (GTK_BOX (main_box), menubar, FALSE, FALSE, 0); - + gtk_box_reorder_child (GTK_BOX (main_box), menubar, 0); /* create the main notebook */ - procdata->notebook = notebook = gtk_notebook_new (); - gtk_box_pack_start (GTK_BOX (main_box), notebook, TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (notebook), 12); - - sysinfo_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); // procman_create_sysinfo_view(); - sysinfo_label = gtk_label_new(_("System")); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sysinfo_box, sysinfo_label); - - vbox1 = create_proc_view (procdata); - tab_label1 = gtk_label_new (_("Processes")); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox1, tab_label1); + procdata->notebook = notebook = GTK_WIDGET (gtk_builder_get_object (builder, "notebook")); - sys_box = create_sys_view (procdata); - tab_label2 = gtk_label_new (_("Resources")); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sys_box, tab_label2); - - devices_box = create_disk_view (procdata); - tab_label3 = gtk_label_new (_("File Systems")); - gtk_notebook_append_page (GTK_NOTEBOOK (notebook), devices_box, tab_label3); + create_proc_view(procdata, builder); + create_sys_view (procdata, builder); + create_disk_view (procdata, builder); g_signal_connect (G_OBJECT (notebook), "switch-page", G_CALLBACK (cb_switch_page), procdata); @@ -750,8 +573,7 @@ create_main_window (ProcData *procdata) } /* create the statusbar */ - procdata->statusbar = gtk_statusbar_new(); - gtk_box_pack_start(GTK_BOX(main_box), procdata->statusbar, FALSE, FALSE, 0); + procdata->statusbar = GTK_WIDGET (gtk_builder_get_object (builder, "statusbar")); procdata->tip_message_cid = gtk_statusbar_get_context_id (GTK_STATUSBAR (procdata->statusbar), "tip_message"); @@ -759,8 +581,12 @@ create_main_window (ProcData *procdata) gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), procdata->config.show_tree); + gtk_builder_connect_signals (builder, NULL); + gtk_widget_show_all(app); procdata->app = app; + + g_object_unref (G_OBJECT (builder)); } void diff --git a/src/interface.ui b/src/interface.ui new file mode 100644 index 0000000..59d83d6 --- /dev/null +++ b/src/interface.ui @@ -0,0 +1,552 @@ + + + + + + False + System Monitor + 440 + 495 + + + True + False + vertical + + + + + + True + True + 12 + 12 + 12 + + + True + False + True + True + 12 + 12 + + + + + + + + + + + True + False + System + + + False + + + + + True + False + True + True + 12 + vertical + 18 + + + True + False + start + + + False + True + 0 + + + + + True + True + True + True + in + + + + + + False + True + 1 + + + + + End _Process + False + True + True + True + end + True + + + False + True + 2 + + + + + 1 + + + + + True + False + Processes + + + 1 + False + + + + + True + False + True + True + 12 + vertical + 12 + + + True + False + vertical + 10 + + + True + False + CPU History + 0 + + + + + + False + True + 0 + + + + + True + False + True + True + vertical + 6 + + + + + + True + False + start + 57 + 2 + 2 + 3 + 12 + none + + + False + True + end + 1 + + + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + vertical + 10 + + + True + False + Memory and Swap History + 0 + + + + + + False + True + 0 + + + + + True + False + True + True + vertical + 6 + + + + + + + True + False + 57 + True + 6 + 6 + True + + + True + False + True + Swap + 0 + + + 3 + 0 + + + + + True + False + True + Memory + 0 + + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + False + True + end + 1 + + + + + False + True + 1 + + + + + False + True + 1 + + + + + True + False + vertical + 10 + + + True + False + Network History + 0 + + + + + + False + True + 0 + + + + + True + False + True + True + vertical + 6 + + + + True + False + 54 + 38 + True + 6 + 6 + True + + + True + False + True + Receiving + 0 + + + 1 + 0 + + + + + True + False + True + Total Received + 0 + + + 1 + 1 + + + + + True + False + True + Sent + 0 + + + 5 + 0 + + + + + True + False + True + Total Sent + 0 + + + 5 + 1 + + + + + 38 + True + False + + + + + 3 + 0 + 2 + + + + + True + False + 6 + + + + + + 0 + 0 + 2 + + + + + True + False + 6 + + + + + + 4 + 0 + 2 + + + + + + + + + + + False + True + end + 0 + + + + + + + + True + True + 1 + + + + + False + True + 2 + + + + + 2 + + + + + True + False + Resources + + + 2 + False + + + + + True + False + 12 + vertical + 6 + + + True + True + True + True + in + + + + + + False + True + 0 + + + + + 3 + + + + + True + False + File Systems + + + 3 + False + + + + + False + True + 1 + + + + + True + False + vertical + 2 + + + False + False + 2 + + + + + + diff --git a/src/msm.gresource.xml b/src/msm.gresource.xml index c77245e..6178236 100644 --- a/src/msm.gresource.xml +++ b/src/msm.gresource.xml @@ -1,6 +1,7 @@ + interface.ui preferences.ui diff --git a/src/proctable.cpp b/src/proctable.cpp index c11336d..2316109 100644 --- a/src/proctable.cpp +++ b/src/proctable.cpp @@ -244,7 +244,6 @@ GtkWidget * proctable_new (ProcData * const procdata) { GtkWidget *proctree; - GtkWidget *scrolled; GtkTreeStore *model; GtkTreeSelection *selection; GtkTreeViewColumn *column; @@ -287,11 +286,6 @@ proctable_new (ProcData * const procdata) gint i; - scrolled = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING, /* Process Name */ G_TYPE_STRING, /* User */ @@ -518,8 +512,6 @@ proctable_new (ProcData * const procdata) } } - gtk_container_add (GTK_CONTAINER (scrolled), proctree); - procdata->tree = proctree; procman_get_tree_state (procdata->settings, proctree, "proctree"); @@ -559,7 +551,7 @@ proctable_new (ProcData * const procdata) g_signal_connect (G_OBJECT (model), "sort-column-changed", G_CALLBACK (cb_sort_changed), procdata); - return scrolled; + return proctree; } -- cgit v1.2.1