updated copyright end date to 2013
[psensor.git] / src / ui_appindicator.c
index 6deedcb..b6bea65 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2013 jeanfi@gmail.com
+ * Copyright (C) 2010-2014 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
@@ -125,7 +125,10 @@ static GtkActionEntry entries[] = {
          G_CALLBACK(cb_about) },
 
        { "QuitAction",
-         GTK_STOCK_QUIT, "_Quit", NULL, "Quit", G_CALLBACK(cb_menu_quit) }
+         GTK_STOCK_QUIT,
+         N_("_Quit"),
+         NULL, N_("Quit"),
+         G_CALLBACK(cb_menu_quit) }
 };
 static guint n_entries = G_N_ELEMENTS(entries);
 
@@ -163,17 +166,19 @@ build_sensor_menu_items(const struct ui_psensor *ui,
 {
        int i, j, n, celcius;
        const char *name;
+       struct psensor **sorted_sensors;
 
        free(menu_items);
 
        celcius  = ui->config->temperature_unit == CELCIUS;
 
-       n = psensor_list_size(ui->sensors);
+       sorted_sensors = ui_get_sensors_ordered_by_position(ui);
+       n = psensor_list_size(sorted_sensors);
        menu_items = malloc(n * sizeof(GtkWidget *));
        sensors = malloc((n + 1) * sizeof(struct psensor *));
        for (i = 0, j = 0; i < n; i++) {
-               if (config_is_appindicator_enabled(ui->sensors[i]->id)) {
-                       sensors[j] = ui->sensors[i];
+               if (config_is_appindicator_enabled(sorted_sensors[i]->id)) {
+                       sensors[j] = sorted_sensors[i];
                        name = sensors[j]->name;
 
                        menu_items[j] = GTK_MENU_ITEM
@@ -190,6 +195,8 @@ build_sensor_menu_items(const struct ui_psensor *ui,
        }
 
        sensors[j] = NULL;
+
+       free(sorted_sensors);
 }
 
 static GtkWidget *get_menu(struct ui_psensor *ui)