X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fui_sensorpref.c;h=01ea4625720c8ccf7ffb7a5bdf86bc066dce5f86;hb=7b33d0128c6e26c9098782c9e52becbc1ba8e4b4;hp=2135769c15a93008e60d8b6df5971d5216ea5ff8;hpb=b01d095d6b123bcc7ed221cccf2c04295834cc84;p=psensor.git diff --git a/src/ui_sensorpref.c b/src/ui_sensorpref.c index 2135769..01ea462 100644 --- a/src/ui_sensorpref.c +++ b/src/ui_sensorpref.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2012 jeanfi@gmail.com + * Copyright (C) 2010-2013 jeanfi@gmail.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -30,6 +30,10 @@ #include "ui_appindicator.h" #endif +enum { + COL_NAME = 0 +}; + struct sensor_pref { struct psensor *sensor; char *name; @@ -486,15 +490,14 @@ void ui_sensorpref_dialog_run(struct psensor *sensor, struct ui_psensor *ui) GError *error = NULL; GtkTreeView *w_sensors_list; guint ok; - GtkCellRenderer *renderer; GtkListStore *store; - struct psensor **s_cur; + struct psensor **s_cur, *s; GtkTreeSelection *selection; struct cb_data cbdata; + GtkTreeIter iter; cbdata.ui = ui; - cbdata.prefs = sensor_pref_list_new(ui->sensors, - ui->config); + cbdata.prefs = sensor_pref_list_new(ui->sensors, ui->config); builder = gtk_builder_new(); cbdata.builder = builder; @@ -517,24 +520,13 @@ void ui_sensorpref_dialog_run(struct psensor *sensor, struct ui_psensor *ui) = GTK_TREE_VIEW(gtk_builder_get_object(builder, "sensors_list")); - renderer = gtk_cell_renderer_text_new(); - gtk_tree_view_insert_column_with_attributes(w_sensors_list, - -1, - _("Sensor Name"), - renderer, - "text", 0, NULL); - - store = GTK_LIST_STORE(gtk_tree_view_get_model(w_sensors_list)); - - s_cur = ui->sensors; - while (*s_cur) { - GtkTreeIter iter; - struct psensor *s = *s_cur; + store = GTK_LIST_STORE(gtk_builder_get_object(builder, + "sensors_liststore")); + for (s_cur = ui->sensors; *s_cur; s_cur++) { + s = *s_cur; gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, s->name, -1); - - s_cur++; + gtk_list_store_set(store, &iter, COL_NAME, s->name, -1); } selection = gtk_tree_view_get_selection(w_sensors_list); @@ -546,7 +538,7 @@ void ui_sensorpref_dialog_run(struct psensor *sensor, struct ui_psensor *ui) if (result == GTK_RESPONSE_ACCEPT) { apply_prefs(cbdata.prefs, ui->sensors, ui->config); - ui_sensorlist_update_sensors_preferences(ui); + ui_sensorlist_update(ui, 1); #if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029) ui_appindicator_update_menu(ui); #endif