** avoid fetching hddtemp daemon when no hdd in the sensors list
** psensor: closing the window hides psensor instead of quitting when
application indicator support is enabled.
+** psensor: dialog window for editing all sensors preferences.
* v0.6.2.7
top_srcdir = ..
-prefix = /home/jporsini/tmp
+prefix = /usr/local
exec_prefix = ${prefix}
datarootdir = ${prefix}/share
datadir = ${datarootdir}
# We use $(mkdir_p).
# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
-# ${SHELL} /home/jporsini/work/wpitchoune.net/svnpub/psensor/trunk/install-sh does not start with $(SHELL), so we add it.
+# ${SHELL} /mnt/nfs4/users/jporsini/work/wpitchoune.net/svnpub/psensor/trunk/install-sh does not start with $(SHELL), so we add it.
# In automake >= 1.10, /bin/mkdir -p is derived from ${MKDIR_P}, which is defined
# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
# versions, $(mkinstalldirs) and $(install_sh) are unused.
-mkinstalldirs = $(SHELL) ${SHELL} /home/jporsini/work/wpitchoune.net/svnpub/psensor/trunk/install-sh -d
-install_sh = $(SHELL) ${SHELL} /home/jporsini/work/wpitchoune.net/svnpub/psensor/trunk/install-sh
+mkinstalldirs = $(SHELL) ${SHELL} /mnt/nfs4/users/jporsini/work/wpitchoune.net/svnpub/psensor/trunk/install-sh -d
+install_sh = $(SHELL) ${SHELL} /mnt/nfs4/users/jporsini/work/wpitchoune.net/svnpub/psensor/trunk/install-sh
MKDIR_P = /bin/mkdir -p
mkdir_p = /bin/mkdir -p
msgstr ""
"Project-Id-Version: psensor 0.6.0.9\n"
"Report-Msgid-Bugs-To: jeanfi@gmail.com\n"
-"POT-Creation-Date: 2011-05-03 09:31+0200\n"
+"POT-Creation-Date: 2011-05-06 22:58+0200\n"
"PO-Revision-Date: 2011-02-07 21:18+0100\n"
"Last-Translator: Jean-Philippe Orsini <jeanfi@gmail.com>\n"
"Language-Team: Oriya\n"
"ERREUR: Psensor n'a pas ete compilé avec le support de surveillance à "
"distance.\n"
-#: src/ui_sensorlist.c:285
+#: src/ui_sensorlist.c:200
msgid "Preferences"
msgstr "Configuration"
-#: src/ui_sensorlist.c:318
+#: src/ui_sensorlist.c:231
msgid "Select foreground color"
msgstr "Selectionner la couleur d'avant-plan"
-#: src/ui_sensorlist.c:401 src/glade/psensor-pref.glade:185
+#: src/ui_sensorlist.c:308 src/glade/psensor-pref.glade:185
msgid "Sensor"
msgstr "Sonde"
-#: src/ui_sensorlist.c:407
+#: src/ui_sensorlist.c:314
msgid "Current"
msgstr "Actuelle"
-#: src/ui_sensorlist.c:413
+#: src/ui_sensorlist.c:320
msgid "Min"
msgstr "Min"
-#: src/ui_sensorlist.c:419
+#: src/ui_sensorlist.c:326
msgid "Max"
msgstr "Max"
-#: src/ui_sensorlist.c:426
+#: src/ui_sensorlist.c:333
msgid "Color"
msgstr "Couleur"
-#: src/ui_sensorlist.c:439
+#: src/ui_sensorlist.c:345
msgid "Enabled"
msgstr "Activée"
-#: src/ui_sensorlist.c:468 src/ui_sensorlist.c:469 src/ui_sensorlist.c:470
-#: src/glade/sensor-edit.glade:25 src/glade/sensor-edit.glade:83
+#: src/ui_sensorlist.c:374 src/ui_sensorlist.c:375 src/ui_sensorlist.c:376
+#: src/glade/sensor-edit.glade:87 src/glade/sensor-edit.glade:153
msgid "N/A"
msgstr "N/A"
msgid "Background opacity:"
msgstr "Opacité du fond:"
-#: src/glade/psensor-pref.glade:114 src/glade/sensor-edit.glade:112
+#: src/glade/psensor-pref.glade:114 src/glade/sensor-edit.glade:184
msgid "Graph"
msgstr "Graphe"
msgid "Enable Unity Launcher counter"
msgstr "Activer le compteur du lanceur de Unity"
-#: src/glade/sensor-edit.glade:7
+#: src/glade/sensor-edit.glade:8
msgid "Edit Sensor Preferences"
msgstr "Editer La Configuration Des Sondes"
-#: src/glade/sensor-edit.glade:41
+#: src/glade/sensor-edit.glade:104
msgid "Name:"
msgstr "Nom:"
-#: src/glade/sensor-edit.glade:70
+#: src/glade/sensor-edit.glade:139
msgid "Type:"
msgstr "Type:"
-#: src/glade/sensor-edit.glade:98
+#: src/glade/sensor-edit.glade:169
msgid "Id:"
msgstr "Id:"
-#: src/glade/sensor-edit.glade:129
+#: src/glade/sensor-edit.glade:202
#, fuzzy
msgid "Color:"
msgstr "Couleur:"
-#: src/glade/sensor-edit.glade:142
+#: src/glade/sensor-edit.glade:216
msgid "Alarm"
msgstr "Alarme"
-#: src/glade/sensor-edit.glade:157
+#: src/glade/sensor-edit.glade:231
msgid "Activate desktop notifications"
msgstr "Activer les notifications du bureau"
-#: src/glade/sensor-edit.glade:175
+#: src/glade/sensor-edit.glade:251
msgid "Temperature limit:"
msgstr "Limite de température:"
-#: src/glade/sensor-edit.glade:189
+#: src/glade/sensor-edit.glade:266
msgid "Sensor Information"
msgstr "Information sonde"
-#: src/glade/sensor-edit.glade:202
+#: src/glade/sensor-edit.glade:279
msgid "Draw sensor curve"
msgstr "Dessiner la courbe de la sonde"
-#: src/glade/sensor-edit.glade:241
+#: src/glade/sensor-edit.glade:327
msgid "°C"
msgstr "°C"
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: jeanfi@gmail.com\n"
-"POT-Creation-Date: 2011-05-03 09:31+0200\n"
+"POT-Creation-Date: 2011-05-06 22:58+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "ERROR: Not compiled with remote sensor support.\n"
msgstr ""
-#: src/ui_sensorlist.c:285
+#: src/ui_sensorlist.c:200
msgid "Preferences"
msgstr ""
-#: src/ui_sensorlist.c:318
+#: src/ui_sensorlist.c:231
msgid "Select foreground color"
msgstr ""
-#: src/ui_sensorlist.c:401 src/glade/psensor-pref.glade:185
+#: src/ui_sensorlist.c:308 src/glade/psensor-pref.glade:185
msgid "Sensor"
msgstr ""
-#: src/ui_sensorlist.c:407
+#: src/ui_sensorlist.c:314
msgid "Current"
msgstr ""
-#: src/ui_sensorlist.c:413
+#: src/ui_sensorlist.c:320
msgid "Min"
msgstr ""
-#: src/ui_sensorlist.c:419
+#: src/ui_sensorlist.c:326
msgid "Max"
msgstr ""
-#: src/ui_sensorlist.c:426
+#: src/ui_sensorlist.c:333
msgid "Color"
msgstr ""
-#: src/ui_sensorlist.c:439
+#: src/ui_sensorlist.c:345
msgid "Enabled"
msgstr ""
-#: src/ui_sensorlist.c:468 src/ui_sensorlist.c:469 src/ui_sensorlist.c:470
-#: src/glade/sensor-edit.glade:25 src/glade/sensor-edit.glade:83
+#: src/ui_sensorlist.c:374 src/ui_sensorlist.c:375 src/ui_sensorlist.c:376
+#: src/glade/sensor-edit.glade:87 src/glade/sensor-edit.glade:153
msgid "N/A"
msgstr ""
msgid "Background opacity:"
msgstr ""
-#: src/glade/psensor-pref.glade:114 src/glade/sensor-edit.glade:112
+#: src/glade/psensor-pref.glade:114 src/glade/sensor-edit.glade:184
msgid "Graph"
msgstr ""
msgid "Enable Unity Launcher counter"
msgstr ""
-#: src/glade/sensor-edit.glade:7
+#: src/glade/sensor-edit.glade:8
msgid "Edit Sensor Preferences"
msgstr ""
-#: src/glade/sensor-edit.glade:41
+#: src/glade/sensor-edit.glade:104
msgid "Name:"
msgstr ""
-#: src/glade/sensor-edit.glade:70
+#: src/glade/sensor-edit.glade:139
msgid "Type:"
msgstr ""
-#: src/glade/sensor-edit.glade:98
+#: src/glade/sensor-edit.glade:169
msgid "Id:"
msgstr ""
-#: src/glade/sensor-edit.glade:129
+#: src/glade/sensor-edit.glade:202
msgid "Color:"
msgstr ""
-#: src/glade/sensor-edit.glade:142
+#: src/glade/sensor-edit.glade:216
msgid "Alarm"
msgstr ""
-#: src/glade/sensor-edit.glade:157
+#: src/glade/sensor-edit.glade:231
msgid "Activate desktop notifications"
msgstr ""
-#: src/glade/sensor-edit.glade:175
+#: src/glade/sensor-edit.glade:251
msgid "Temperature limit:"
msgstr ""
-#: src/glade/sensor-edit.glade:189
+#: src/glade/sensor-edit.glade:266
msgid "Sensor Information"
msgstr ""
-#: src/glade/sensor-edit.glade:202
+#: src/glade/sensor-edit.glade:279
msgid "Draw sensor curve"
msgstr ""
-#: src/glade/sensor-edit.glade:241
+#: src/glade/sensor-edit.glade:327
msgid "°C"
msgstr ""
msgstr ""
"Project-Id-Version: psensor\n"
"Report-Msgid-Bugs-To: jeanfi@gmail.com\n"
-"POT-Creation-Date: 2011-05-03 09:31+0200\n"
+"POT-Creation-Date: 2011-05-06 22:58+0200\n"
"PO-Revision-Date: 2011-04-10 13:11+0000\n"
"Last-Translator: zeugma <Unknown>\n"
"Language-Team: Turkish <tr@li.org>\n"
msgid "ERROR: Not compiled with remote sensor support.\n"
msgstr ""
-#: src/ui_sensorlist.c:285
+#: src/ui_sensorlist.c:200
msgid "Preferences"
msgstr "Tercihler"
-#: src/ui_sensorlist.c:318
+#: src/ui_sensorlist.c:231
msgid "Select foreground color"
msgstr ""
-#: src/ui_sensorlist.c:401 src/glade/psensor-pref.glade:185
+#: src/ui_sensorlist.c:308 src/glade/psensor-pref.glade:185
msgid "Sensor"
msgstr "Algılayıcı"
-#: src/ui_sensorlist.c:407
+#: src/ui_sensorlist.c:314
msgid "Current"
msgstr ""
-#: src/ui_sensorlist.c:413
+#: src/ui_sensorlist.c:320
msgid "Min"
msgstr ""
-#: src/ui_sensorlist.c:419
+#: src/ui_sensorlist.c:326
msgid "Max"
msgstr ""
-#: src/ui_sensorlist.c:426
+#: src/ui_sensorlist.c:333
msgid "Color"
msgstr "Renk"
-#: src/ui_sensorlist.c:439
+#: src/ui_sensorlist.c:345
msgid "Enabled"
msgstr ""
-#: src/ui_sensorlist.c:468 src/ui_sensorlist.c:469 src/ui_sensorlist.c:470
-#: src/glade/sensor-edit.glade:25 src/glade/sensor-edit.glade:83
+#: src/ui_sensorlist.c:374 src/ui_sensorlist.c:375 src/ui_sensorlist.c:376
+#: src/glade/sensor-edit.glade:87 src/glade/sensor-edit.glade:153
msgid "N/A"
msgstr ""
msgid "Background opacity:"
msgstr "Arkaplan belirginliği:"
-#: src/glade/psensor-pref.glade:114 src/glade/sensor-edit.glade:112
+#: src/glade/psensor-pref.glade:114 src/glade/sensor-edit.glade:184
msgid "Graph"
msgstr "Grafik"
msgid "Enable Unity Launcher counter"
msgstr ""
-#: src/glade/sensor-edit.glade:7
+#: src/glade/sensor-edit.glade:8
#, fuzzy
msgid "Edit Sensor Preferences"
msgstr "Tercihleri düzenle"
-#: src/glade/sensor-edit.glade:41
+#: src/glade/sensor-edit.glade:104
msgid "Name:"
msgstr "İsim:"
-#: src/glade/sensor-edit.glade:70
+#: src/glade/sensor-edit.glade:139
msgid "Type:"
msgstr "Tür:"
-#: src/glade/sensor-edit.glade:98
+#: src/glade/sensor-edit.glade:169
msgid "Id:"
msgstr ""
-#: src/glade/sensor-edit.glade:129
+#: src/glade/sensor-edit.glade:202
msgid "Color:"
msgstr "Renk :"
-#: src/glade/sensor-edit.glade:142
+#: src/glade/sensor-edit.glade:216
msgid "Alarm"
msgstr "Alarm"
-#: src/glade/sensor-edit.glade:157
+#: src/glade/sensor-edit.glade:231
msgid "Activate desktop notifications"
msgstr ""
-#: src/glade/sensor-edit.glade:175
+#: src/glade/sensor-edit.glade:251
msgid "Temperature limit:"
msgstr ""
-#: src/glade/sensor-edit.glade:189
+#: src/glade/sensor-edit.glade:266
msgid "Sensor Information"
msgstr ""
-#: src/glade/sensor-edit.glade:202
+#: src/glade/sensor-edit.glade:279
msgid "Draw sensor curve"
msgstr ""
-#: src/glade/sensor-edit.glade:241
+#: src/glade/sensor-edit.glade:327
msgid "°C"
msgstr ""
msgstr ""
"Project-Id-Version: psensor 0.6.0.10\n"
"Report-Msgid-Bugs-To: jeanfi@gmail.com\n"
-"POT-Creation-Date: 2011-05-03 09:31+0200\n"
+"POT-Creation-Date: 2011-05-06 22:58+0200\n"
"PO-Revision-Date: 2011-02-07 22:21+0100\n"
"Last-Translator: 大宝 <linux.dabao@gmail.com>\n"
"Language-Team: Chinese (simplified)\n"
msgid "ERROR: Not compiled with remote sensor support.\n"
msgstr ""
-#: src/ui_sensorlist.c:285
+#: src/ui_sensorlist.c:200
msgid "Preferences"
msgstr "选项"
-#: src/ui_sensorlist.c:318
+#: src/ui_sensorlist.c:231
msgid "Select foreground color"
msgstr ""
-#: src/ui_sensorlist.c:401 src/glade/psensor-pref.glade:185
+#: src/ui_sensorlist.c:308 src/glade/psensor-pref.glade:185
msgid "Sensor"
msgstr "监视设备"
-#: src/ui_sensorlist.c:407
+#: src/ui_sensorlist.c:314
msgid "Current"
msgstr "当前"
-#: src/ui_sensorlist.c:413
+#: src/ui_sensorlist.c:320
msgid "Min"
msgstr "最小值"
-#: src/ui_sensorlist.c:419
+#: src/ui_sensorlist.c:326
msgid "Max"
msgstr "最大值"
-#: src/ui_sensorlist.c:426
+#: src/ui_sensorlist.c:333
msgid "Color"
msgstr "颜色"
-#: src/ui_sensorlist.c:439
+#: src/ui_sensorlist.c:345
msgid "Enabled"
msgstr "激活"
-#: src/ui_sensorlist.c:468 src/ui_sensorlist.c:469 src/ui_sensorlist.c:470
-#: src/glade/sensor-edit.glade:25 src/glade/sensor-edit.glade:83
+#: src/ui_sensorlist.c:374 src/ui_sensorlist.c:375 src/ui_sensorlist.c:376
+#: src/glade/sensor-edit.glade:87 src/glade/sensor-edit.glade:153
msgid "N/A"
msgstr ""
msgid "Background opacity:"
msgstr "背景亮度:"
-#: src/glade/psensor-pref.glade:114 src/glade/sensor-edit.glade:112
+#: src/glade/psensor-pref.glade:114 src/glade/sensor-edit.glade:184
msgid "Graph"
msgstr "图表"
msgid "Enable Unity Launcher counter"
msgstr ""
-#: src/glade/sensor-edit.glade:7
+#: src/glade/sensor-edit.glade:8
msgid "Edit Sensor Preferences"
msgstr "监视设备选项"
-#: src/glade/sensor-edit.glade:41
+#: src/glade/sensor-edit.glade:104
msgid "Name:"
msgstr "名称:"
-#: src/glade/sensor-edit.glade:70
+#: src/glade/sensor-edit.glade:139
msgid "Type:"
msgstr "类型:"
-#: src/glade/sensor-edit.glade:98
+#: src/glade/sensor-edit.glade:169
msgid "Id:"
msgstr "标识:"
-#: src/glade/sensor-edit.glade:129
+#: src/glade/sensor-edit.glade:202
#, fuzzy
msgid "Color:"
msgstr "颜色:"
-#: src/glade/sensor-edit.glade:142
+#: src/glade/sensor-edit.glade:216
msgid "Alarm"
msgstr "警告信息"
-#: src/glade/sensor-edit.glade:157
+#: src/glade/sensor-edit.glade:231
msgid "Activate desktop notifications"
msgstr "激活桌面气泡提示"
-#: src/glade/sensor-edit.glade:175
+#: src/glade/sensor-edit.glade:251
msgid "Temperature limit:"
msgstr "温度警戒线:"
-#: src/glade/sensor-edit.glade:189
+#: src/glade/sensor-edit.glade:266
msgid "Sensor Information"
msgstr "设备信息"
-#: src/glade/sensor-edit.glade:202
+#: src/glade/sensor-edit.glade:279
msgid "Draw sensor curve"
msgstr "绘制监视曲线"
-#: src/glade/sensor-edit.glade:241
+#: src/glade/sensor-edit.glade:327
msgid "°C"
msgstr ""
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkDialog" id="dialog1">
+ <property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Edit Sensor Preferences</property>
<property name="modal">True</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">2</property>
- <child>
- <object class="GtkTable" id="table1">
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
- <property name="n_rows">10</property>
- <property name="n_columns">2</property>
- <child>
- <object class="GtkLabel" id="sensor_id">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">N/A</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_padding">4</property>
- <property name="y_padding">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="xpad">10</property>
- <property name="label" translatable="yes">Name:</property>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="x_padding">4</property>
- <property name="y_padding">4</property>
- </packing>
- </child>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
<child>
- <object class="GtkEntry" id="sensor_name">
+ <object class="GtkButton" id="btn_ok">
+ <property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="invisible_char">•</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_padding">4</property>
- <property name="y_padding">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Type:</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_padding">14</property>
- <property name="y_padding">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="sensor_type">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">N/A</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_padding">4</property>
- <property name="y_padding">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Id:</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="x_padding">14</property>
- <property name="y_padding">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label5">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Graph</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_padding">4</property>
- <property name="y_padding">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label7">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Color:</property>
- </object>
- <packing>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_padding">14</property>
- <property name="y_padding">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Alarm</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
</object>
<packing>
- <property name="right_attach">2</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- <property name="x_padding">4</property>
- <property name="y_padding">4</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="sensor_alarm">
- <property name="label" translatable="yes">Activate desktop notifications</property>
+ <object class="GtkButton" id="btn_cancel">
+ <property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="right_attach">2</property>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
- <property name="x_padding">14</property>
- <property name="y_padding">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Temperature limit:</property>
- </object>
- <packing>
- <property name="top_attach">9</property>
- <property name="bottom_attach">10</property>
- <property name="x_options">GTK_FILL</property>
- <property name="x_padding">14</property>
- <property name="y_padding">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Sensor Information</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
</object>
<packing>
- <property name="right_attach">2</property>
- <property name="x_padding">4</property>
- <property name="y_padding">4</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHPaned" id="hpaned1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<child>
- <object class="GtkCheckButton" id="sensor_draw">
- <property name="label" translatable="yes">Draw sensor curve</property>
+ <object class="GtkTreeView" id="sensors_list">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="yalign">0.41999998688697815</property>
- <property name="draw_indicator">True</property>
+ <property name="model">sensors_liststore</property>
</object>
<packing>
- <property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_padding">14</property>
- <property name="y_padding">4</property>
+ <property name="resize">False</property>
+ <property name="shrink">True</property>
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkTable" id="table1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">10</property>
+ <property name="n_columns">2</property>
+ <child>
+ <object class="GtkLabel" id="sensor_id">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">N/A</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_padding">4</property>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="xpad">10</property>
+ <property name="label" translatable="yes">Name:</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="x_padding">4</property>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
<child>
- <object class="GtkSpinButton" id="sensor_temp_limit">
+ <object class="GtkEntry" id="sensor_name">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="max_length">3</property>
<property name="invisible_char">•</property>
- <property name="adjustment">temp_limit</property>
- <property name="climb_rate">1</property>
- <property name="snap_to_ticks">True</property>
- <property name="numeric">True</property>
- <property name="update_policy">if-valid</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="position">0</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_padding">4</property>
+ <property name="y_padding">4</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label9">
+ <object class="GtkLabel" id="label4">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">°C</property>
+ <property name="label" translatable="yes">Type:</property>
</object>
<packing>
- <property name="position">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_padding">14</property>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="sensor_type">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">N/A</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_padding">4</property>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Id:</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="x_padding">14</property>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Graph</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_padding">4</property>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Color:</property>
+ </object>
+ <packing>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_padding">14</property>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Alarm</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ <property name="x_padding">4</property>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="sensor_alarm">
+ <property name="label" translatable="yes">Activate desktop notifications</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
+ <property name="x_padding">14</property>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Temperature limit:</property>
+ </object>
+ <packing>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="x_padding">14</property>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Sensor Information</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="x_padding">4</property>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="sensor_draw">
+ <property name="label" translatable="yes">Draw sensor curve</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="yalign">0.41999998688697815</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ <property name="x_padding">14</property>
+ <property name="y_padding">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkSpinButton" id="sensor_temp_limit">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="max_length">3</property>
+ <property name="invisible_char">•</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">temp_limit</property>
+ <property name="climb_rate">1</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">if-valid</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">°C</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">9</property>
+ <property name="bottom_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="sensor_color">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="color">#000000000000</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options"></property>
+ <property name="x_padding">4</property>
+ <property name="y_padding">4</property>
</packing>
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">9</property>
- <property name="bottom_attach">10</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="sensor_color">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="xalign">0</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_options"></property>
- <property name="x_padding">4</property>
- <property name="y_padding">4</property>
+ <property name="resize">True</property>
+ <property name="shrink">False</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="btn_ok">
- <property name="label">gtk-ok</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="btn_cancel">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
</object>
</child>
<action-widgets>
<action-widget response="0">btn_cancel</action-widget>
</action-widgets>
</object>
+ <object class="GtkListStore" id="sensors_liststore">
+ <columns>
+ <!-- column-name sensor_name -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkAdjustment" id="temp_limit">
<property name="upper">256</property>
<property name="step_increment">1</property>
#include "ui_sensorpref.h"
#include "ui_color.h"
-void ui_sensorpref_dialog_run(struct psensor *sensor, struct ui_psensor *ui)
-{
- GtkDialog *diag;
- gint result;
+struct sensor_pref {
+ struct psensor *sensor;
+ char *name;
+ int enabled;
+ struct color *color;
+ int alarm_enabled;
+ double alarm_limit;
+};
+
+struct cb_data {
+ struct ui_psensor *ui;
GtkBuilder *builder;
- GError *error = NULL;
+ struct sensor_pref **prefs;
+};
+
+static struct sensor_pref *sensor_pref_new(struct psensor *s)
+{
+ struct sensor_pref *p = malloc(sizeof(struct sensor_pref));
+
+ p->sensor = s;
+
+ p->name = strdup(s->name);
+ p->enabled = s->enabled;
+ p->alarm_enabled = s->alarm_enabled;
+ p->alarm_limit = s->alarm_limit;
+ p->color = color_dup(s->color);
+
+ return p;
+}
+
+static void sensor_pref_free(struct sensor_pref *p)
+{
+ if (!p)
+ return ;
+
+ free(p->name);
+ free(p->color);
+
+ free(p);
+}
+
+static struct sensor_pref **sensor_pref_list_new(struct psensor **sensors)
+{
+ int n, i;
+ struct sensor_pref **pref_list;
+
+ n = psensor_list_size(sensors);
+ pref_list = malloc(sizeof(struct sensor_pref *) * (n+1));
+
+ for (i = 0; i < n; i++)
+ pref_list[i] = sensor_pref_new(sensors[i]);
+
+ pref_list[n] = NULL;
+
+ return pref_list;
+}
+
+static void sensor_pref_list_free(struct sensor_pref **list)
+{
+ struct sensor_pref **cur = list;
+
+ while (*cur) {
+ sensor_pref_free(*cur);
+
+ cur++;
+ }
+
+ free(list);
+}
+
+static struct sensor_pref *
+sensor_pref_get(struct sensor_pref **ps, struct psensor *s)
+{
+ struct sensor_pref **p_cur = ps;
+
+ while (*p_cur) {
+ struct sensor_pref *p = *p_cur;
+
+ if (p->sensor == s)
+ return p;
+
+ p_cur++;
+ }
+
+ return NULL;
+}
+
+static struct sensor_pref *
+get_seleted_sensor_pref(GtkBuilder *builder, struct sensor_pref **ps)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ struct sensor_pref *pref = NULL;
+ GtkTreeSelection *selection;
+ GtkTreeView *tree;
+
+ tree = GTK_TREE_VIEW(gtk_builder_get_object(builder,
+ "sensors_list"));
+
+ selection = gtk_tree_view_get_selection(tree);
+
+ if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
+ GtkTreePath *p = gtk_tree_model_get_path(model, &iter);
+ gint *indices = gtk_tree_path_get_indices(p);
+
+ pref = ps[*indices];
+
+ gtk_tree_path_free(p);
+ }
+
+ return pref;
+}
+
+static void on_name_changed(GtkEntry *entry, gpointer data)
+{
+ struct cb_data *cbdata = data;
+ struct sensor_pref *p;
+ const char *str;
+
+ str = gtk_entry_get_text(entry);
+
+ p = get_seleted_sensor_pref(cbdata->builder, cbdata->prefs);
+
+ if (p && strcmp(p->name, str)) {
+ free(p->name);
+ p->name = strdup(str);
+ }
+}
+
+static void
+on_drawed_toggled(GtkToggleButton *btn, gpointer data)
+{
+ struct cb_data *cbdata = data;
+ struct sensor_pref *p;
+
+ p = get_seleted_sensor_pref(cbdata->builder, cbdata->prefs);
+
+ if (p)
+ p->enabled = gtk_toggle_button_get_active(btn);
+}
+
+static void
+on_alarm_toggled(GtkToggleButton *btn, gpointer data)
+{
+ struct cb_data *cbdata = data;
+ struct sensor_pref *p;
+
+ p = get_seleted_sensor_pref(cbdata->builder, cbdata->prefs);
+
+ if (p)
+ p->alarm_enabled = gtk_toggle_button_get_active(btn);
+}
+
+static void on_color_set(GtkColorButton *widget, gpointer data)
+{
+ struct cb_data *cbdata = data;
+ struct sensor_pref *p;
+ GdkColor color;
+
+ p = get_seleted_sensor_pref(cbdata->builder, cbdata->prefs);
+
+ if (p) {
+ gtk_color_button_get_color(widget, &color);
+ color_set(p->color, color.red, color.green, color.blue);
+ }
+}
+
+static void on_temp_limit_changed(GtkSpinButton *btn, gpointer data)
+{
+ struct cb_data *cbdata = data;
+ struct sensor_pref *p;
+
+ p = get_seleted_sensor_pref(cbdata->builder, cbdata->prefs);
+
+ if (p)
+ p->alarm_limit = gtk_spin_button_get_value(btn);
+}
+
+static void connect_signals(GtkBuilder *builder, struct cb_data *cbdata)
+{
+ g_signal_connect(gtk_builder_get_object(builder, "sensor_name"),
+ "changed", G_CALLBACK(on_name_changed), cbdata);
+
+ g_signal_connect(gtk_builder_get_object(builder, "sensor_draw"),
+ "toggled", G_CALLBACK(on_drawed_toggled), cbdata);
+
+ g_signal_connect(gtk_builder_get_object(builder, "sensor_color"),
+ "color-set", G_CALLBACK(on_color_set), cbdata);
+
+ g_signal_connect(gtk_builder_get_object(builder, "sensor_alarm"),
+ "toggled", G_CALLBACK(on_alarm_toggled), cbdata);
+
+ g_signal_connect(gtk_builder_get_object(builder, "sensor_temp_limit"),
+ "value-changed", G_CALLBACK(on_temp_limit_changed),
+ cbdata);
+}
+
+static void
+update_pref(struct psensor *s, struct sensor_pref **prefs, GtkBuilder *builder)
+{
GtkLabel *w_id, *w_type;
GtkEntry *w_name;
GtkToggleButton *w_draw, *w_alarm;
GtkColorButton *w_color;
GtkSpinButton *w_temp_limit;
GdkColor *color;
- guint ok;
-
- builder = gtk_builder_new();
-
- ok = gtk_builder_add_from_file
- (builder,
- PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "sensor-edit.glade",
- &error);
-
- if (!ok) {
- g_warning("%s", error->message);
- g_free(error);
- return ;
- }
+ struct sensor_pref *p = sensor_pref_get(prefs, s);
w_id = GTK_LABEL(gtk_builder_get_object(builder, "sensor_id"));
- gtk_label_set_text(w_id, sensor->id);
+ gtk_label_set_text(w_id, s->id);
w_type = GTK_LABEL(gtk_builder_get_object(builder, "sensor_type"));
- gtk_label_set_text(w_type, psensor_type_to_str(sensor->type));
+ gtk_label_set_text(w_type, psensor_type_to_str(s->type));
w_name = GTK_ENTRY(gtk_builder_get_object(builder, "sensor_name"));
- gtk_entry_set_text(w_name, sensor->name);
+ gtk_entry_set_text(w_name, p->name);
w_draw = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder,
"sensor_draw"));
- gtk_toggle_button_set_active(w_draw, sensor->enabled);
+ gtk_toggle_button_set_active(w_draw, p->enabled);
- color = color_to_gdkcolor(sensor->color);
+ color = color_to_gdkcolor(p->color);
w_color = GTK_COLOR_BUTTON(gtk_builder_get_object(builder,
"sensor_color"));
gtk_color_button_set_color(w_color, color);
= GTK_SPIN_BUTTON(gtk_builder_get_object(builder,
"sensor_temp_limit"));
- if (is_temp_type(sensor->type)) {
- gtk_toggle_button_set_active(w_alarm, sensor->alarm_enabled);
- gtk_spin_button_set_value(w_temp_limit, sensor->alarm_limit);
+ if (is_temp_type(s->type)) {
+ gtk_toggle_button_set_active(w_alarm, p->alarm_enabled);
+ gtk_spin_button_set_value(w_temp_limit, p->alarm_limit);
+ gtk_widget_set_sensitive(GTK_WIDGET(w_alarm), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(w_temp_limit), TRUE);
} else {
+ gtk_toggle_button_set_active(w_alarm, 0);
+ gtk_spin_button_set_value(w_temp_limit, 0);
gtk_widget_set_sensitive(GTK_WIDGET(w_alarm), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(w_temp_limit), FALSE);
}
+}
- diag = GTK_DIALOG(gtk_builder_get_object(builder, "dialog1"));
- result = gtk_dialog_run(diag);
+static void on_changed(GtkTreeSelection *selection, gpointer data)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ struct cb_data *cbdata = data;
+ struct ui_psensor *ui = cbdata->ui;
- if (result == GTK_RESPONSE_ACCEPT) {
+ if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
+ GtkTreePath *p = gtk_tree_model_get_path(model, &iter);
+ gint *indices = gtk_tree_path_get_indices(p);
+ struct psensor *s = *(ui->sensors + *indices);
+
+ update_pref(s, cbdata->prefs, cbdata->builder);
+
+ gtk_tree_path_free(p);
+ }
+}
+
+static void
+select_sensor(struct psensor *s, struct psensor **sensors, GtkTreeView *tree)
+{
+ struct psensor **s_cur = sensors;
+ int i = 0;
+ GtkTreePath *p = NULL;
+
+ while (*s_cur) {
+ if (s == *s_cur) {
+ p = gtk_tree_path_new_from_indices(i, -1);
+ break;
+ }
+
+ i++;
+ s_cur++;
+ }
+
+ if (p) {
+ GtkTreeSelection *s = gtk_tree_view_get_selection(tree);
+
+ gtk_tree_selection_select_path(s, p);
+ gtk_tree_path_free(p);
+ }
+}
+
+static void
+apply_prefs(struct sensor_pref **prefs, struct psensor **sensors)
+{
+ int n = psensor_list_size(sensors);
+ int i;
+
+ for (i = 0; i < n; i++) {
+ struct psensor *s = sensors[i];
+ struct sensor_pref *p = prefs[i];
+
+ if (strcmp(p->name, s->name)) {
+ free(s->name);
+ s->name = strdup(p->name);
+ config_set_sensor_name(s->id, s->name);
+ }
+
+ if (s->enabled != p->enabled) {
+ s->enabled = p->enabled;
+ config_set_sensor_enabled(s->id, s->enabled);
+ }
+
+ if (s->alarm_limit != p->alarm_limit) {
+ s->alarm_limit = p->alarm_limit;
+ config_set_sensor_alarm_limit(s->id,
+ s->alarm_limit);
+ }
+
+ if (s->alarm_enabled != p->alarm_enabled) {
+ s->alarm_enabled = p->alarm_enabled;
+ config_set_sensor_alarm_enabled(s->id,
+ s->alarm_enabled);
+ }
+
+ color_set(s->color,
+ p->color->red, p->color->green, p->color->blue);
+ config_set_sensor_color(s->id, s->color);
+ }
+}
+
+void ui_sensorpref_dialog_run(struct psensor *sensor, struct ui_psensor *ui)
+{
+ GtkDialog *diag;
+ gint result;
+ GtkBuilder *builder;
+ GError *error = NULL;
+ GtkTreeView *w_sensors_list;
+ guint ok;
+ GtkCellRenderer *renderer;
+ GtkListStore *store;
+ struct psensor **s_cur;
+ GtkTreeSelection *selection;
+ struct cb_data cbdata;
+
+ cbdata.ui = ui;
+ cbdata.prefs = sensor_pref_list_new(ui->sensors);
+
+ builder = gtk_builder_new();
+ cbdata.builder = builder;
- free(sensor->name);
- sensor->name = strdup(gtk_entry_get_text(w_name));
- config_set_sensor_name(sensor->id, sensor->name);
+ ok = gtk_builder_add_from_file
+ (builder,
+ PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "sensor-edit.glade",
+ &error);
+
+ if (!ok) {
+ g_warning("%s", error->message);
+ g_free(error);
+ return ;
+ }
- sensor->enabled = gtk_toggle_button_get_active(w_draw);
- config_set_sensor_enabled(sensor->id, sensor->enabled);
+ update_pref(sensor, cbdata.prefs, builder);
+ connect_signals(builder, &cbdata);
- sensor->alarm_limit = gtk_spin_button_get_value(w_temp_limit);
- config_set_sensor_alarm_limit(sensor->id, sensor->alarm_limit);
+ w_sensors_list
+ = GTK_TREE_VIEW(gtk_builder_get_object(builder,
+ "sensors_list"));
- sensor->alarm_enabled = gtk_toggle_button_get_active(w_alarm);
- config_set_sensor_alarm_enabled(sensor->id,
- sensor->alarm_enabled);
+ renderer = gtk_cell_renderer_text_new();
+ gtk_tree_view_insert_column_with_attributes(w_sensors_list,
+ -1,
+ _("Sensor Name"),
+ renderer,
+ "text", 0, NULL);
- gtk_color_button_get_color(w_color, color);
- color_set(sensor->color, color->red, color->green, color->blue);
- config_set_sensor_color(sensor->id, sensor->color);
+ 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;
+
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, s->name, -1);
+
+ s_cur++;
+ }
+
+ selection = gtk_tree_view_get_selection(w_sensors_list);
+ g_signal_connect(selection, "changed", G_CALLBACK(on_changed), &cbdata);
+ select_sensor(sensor, ui->sensors, w_sensors_list);
+
+ diag = GTK_DIALOG(gtk_builder_get_object(builder, "dialog1"));
+ result = gtk_dialog_run(diag);
+
+ if (result == GTK_RESPONSE_ACCEPT) {
+ apply_prefs(cbdata.prefs, ui->sensors);
ui_sensorlist_update_sensors_preferences(ui);
}
g_object_unref(G_OBJECT(builder));
gtk_widget_destroy(GTK_WIDGET(diag));
+
+ sensor_pref_list_free(cbdata.prefs);
}