mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Conditionally enable the device combo box.
The device combo box is only necessary for the Uemis Zurich, and dive computers using serial communication. For dive computers using IrDA or USB communication, this combo box causes only confusion for the users. Starting with libdivecomputer version 0.4, there is an api to query the transport type, which can be used to enable/disable the device combo box based on the selected model. Signed-off-by: Jef Driesen <jefdriesen@telenet.be> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
41373e467a
commit
e3b8d8ee70
2 changed files with 15 additions and 1 deletions
|
@ -109,6 +109,18 @@ static void dive_computer_selector_changed(GtkWidget *combo, gpointer data)
|
|||
{
|
||||
GtkWidget *import, *button;
|
||||
|
||||
#if DC_VERSION_CHECK(0, 4, 0)
|
||||
GtkTreeIter iter;
|
||||
if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo), &iter)) {
|
||||
GtkTreeModel *model;
|
||||
dc_descriptor_t *descriptor;
|
||||
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX(combo));
|
||||
gtk_tree_model_get(model, &iter, 0, &descriptor, -1);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(data), dc_descriptor_get_transport (descriptor) == DC_TRANSPORT_SERIAL);
|
||||
}
|
||||
#endif
|
||||
|
||||
import = gtk_widget_get_ancestor(combo, GTK_TYPE_DIALOG);
|
||||
button = gtk_dialog_get_widget_for_response(GTK_DIALOG(import), GTK_RESPONSE_ACCEPT);
|
||||
gtk_widget_set_sensitive(button, TRUE);
|
||||
|
@ -295,7 +307,6 @@ static GtkComboBox *dive_computer_selector(GtkWidget *vbox)
|
|||
product_combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL(product_model[vendor_default_index + 1]));
|
||||
|
||||
g_signal_connect(G_OBJECT(vendor_combo_box), "changed", G_CALLBACK(dive_computer_vendor_changed), product_combo_box);
|
||||
g_signal_connect(G_OBJECT(product_combo_box), "changed", G_CALLBACK(dive_computer_selector_changed), NULL);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), vendor_combo_box, FALSE, FALSE, 3);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), product_combo_box, FALSE, FALSE, 3);
|
||||
|
||||
|
@ -375,6 +386,8 @@ void download_dialog(GtkWidget *w, gpointer data)
|
|||
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 3);
|
||||
computer = dive_computer_selector(vbox);
|
||||
device = dc_device_selector(vbox);
|
||||
g_signal_connect(G_OBJECT(computer), "changed", G_CALLBACK(dive_computer_selector_changed), device);
|
||||
|
||||
hbox = gtk_hbox_new(FALSE, 6);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 3);
|
||||
devicedata.progress.bar = gtk_progress_bar_new();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define LIBDIVECOMPUTER_H
|
||||
|
||||
/* libdivecomputer */
|
||||
#include <libdivecomputer/version.h>
|
||||
#include <libdivecomputer/device.h>
|
||||
#include <libdivecomputer/parser.h>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue