From 411d31b2e6cd38df6e6886fc3eb4f7d52e62dcb0 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Fri, 22 Apr 2011 21:49:44 +0000 Subject: [PATCH] renamed ui_main_box_create to ui_sensor_box_create renamed ui_psensor#main_box to sensor_box added ui_psensor#main_box --- src/main.c | 4 ++-- src/ui.c | 22 +++++++++++----------- src/ui.h | 18 ++++++++++++++++-- src/ui_pref.c | 2 +- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/main.c b/src/main.c index 677d761..7b8deb9 100644 --- a/src/main.c +++ b/src/main.c @@ -381,7 +381,7 @@ int main(int argc, char **argv) /* main window */ ui.main_window = ui_window_create(&ui); - ui.main_box = NULL; + ui.sensor_box = NULL; /* drawing box */ ui.w_graph = ui_graph_create(&ui); @@ -389,7 +389,7 @@ int main(int argc, char **argv) /* sensor list */ ui.ui_sensorlist = ui_sensorlist_create(ui.sensors); - ui_main_box_create(&ui); + ui_sensor_box_create(&ui); gtk_widget_show_all(ui.main_window); diff --git a/src/ui.c b/src/ui.c index 5de91f7..e8f3303 100644 --- a/src/ui.c +++ b/src/ui.c @@ -78,18 +78,18 @@ GtkWidget *ui_window_create(struct ui_psensor * ui) return window; } -void ui_main_box_create(struct ui_psensor *ui) +void ui_sensor_box_create(struct ui_psensor *ui) { struct config *cfg; GtkWidget *w_sensorlist; cfg = ui->config; - if (ui->main_box) { + if (ui->sensor_box) { ui_sensorlist_create_widget(ui->ui_sensorlist); gtk_container_remove(GTK_CONTAINER(ui->main_window), - ui->main_box); + ui->sensor_box); ui->w_graph = ui_graph_create(ui); ui->w_sensorlist = ui->ui_sensorlist->widget; @@ -97,9 +97,9 @@ void ui_main_box_create(struct ui_psensor *ui) if (cfg->sensorlist_position == SENSORLIST_POSITION_RIGHT || cfg->sensorlist_position == SENSORLIST_POSITION_LEFT) - ui->main_box = gtk_hpaned_new(); + ui->sensor_box = gtk_hpaned_new(); else - ui->main_box = gtk_vpaned_new(); + ui->sensor_box = gtk_vpaned_new(); w_sensorlist = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(w_sensorlist), @@ -107,20 +107,20 @@ void ui_main_box_create(struct ui_psensor *ui) gtk_container_add(GTK_CONTAINER(w_sensorlist), ui->ui_sensorlist->widget); - gtk_container_add(GTK_CONTAINER(ui->main_window), ui->main_box); + gtk_container_add(GTK_CONTAINER(ui->main_window), ui->sensor_box); if (cfg->sensorlist_position == SENSORLIST_POSITION_RIGHT || cfg->sensorlist_position == SENSORLIST_POSITION_BOTTOM) { - gtk_paned_pack1(GTK_PANED(ui->main_box), + gtk_paned_pack1(GTK_PANED(ui->sensor_box), GTK_WIDGET(ui->w_graph), TRUE, TRUE); - gtk_paned_pack2(GTK_PANED(ui->main_box), + gtk_paned_pack2(GTK_PANED(ui->sensor_box), w_sensorlist, FALSE, TRUE); } else { - gtk_paned_pack1(GTK_PANED(ui->main_box), + gtk_paned_pack1(GTK_PANED(ui->sensor_box), w_sensorlist, FALSE, TRUE); - gtk_paned_pack2(GTK_PANED(ui->main_box), + gtk_paned_pack2(GTK_PANED(ui->sensor_box), GTK_WIDGET(ui->w_graph), TRUE, TRUE); } - gtk_widget_show_all(ui->main_box); + gtk_widget_show_all(ui->sensor_box); } diff --git a/src/ui.h b/src/ui.h index 7ecf1c4..eb3e7d5 100644 --- a/src/ui.h +++ b/src/ui.h @@ -42,8 +42,18 @@ struct ui_psensor { GtkWidget *main_window; + /* + The main vertical box, top contains the menubar, bottom + contains the sensor_box. + */ GtkWidget *main_box; + /* + The box which contains the sensors graph and the sensors + information list. + */ + GtkWidget *sensor_box; + GtkWidget *w_sensorlist; int graph_update_interval; @@ -52,7 +62,7 @@ struct ui_psensor { #ifdef HAVE_LIBNOTIFY /* - * Time of the last notification + Time of the last notification */ struct timeval *notification_last_time; #endif @@ -62,7 +72,11 @@ struct ui_psensor { #endif }; -void ui_main_box_create(struct ui_psensor *); +/* + Creates or re-creates the sensor_box according to the position of + the list of sensors in the configuration. +*/ +void ui_sensor_box_create(struct ui_psensor *); /* Must be called to terminate Psensor UI. diff --git a/src/ui_pref.c b/src/ui_pref.c index 399195d..44b5349 100644 --- a/src/ui_pref.c +++ b/src/ui_pref.c @@ -175,7 +175,7 @@ void ui_pref_dialog_run(struct ui_psensor *ui) g_mutex_unlock(ui->sensors_mutex); - ui_main_box_create(ui); + ui_sensor_box_create(ui); } g_object_unref(G_OBJECT(builder)); gtk_widget_destroy(GTK_WIDGET(diag)); -- 2.7.4