21 this->updating_view =
false;
33 GtkWidget* combo = gtk_combo_box_new_text();
35 this->combos.push_back(combo);
36 this->num_sources.push_back(0);
37 this->updateComboBox(combos.size()-1);
39 g_signal_connect(G_OBJECT(combo),
41 G_CALLBACK(CB_changeSource),
49 this->updating_view =
true;
50 for(
unsigned int i=0;i<combos.size();i++)
52 this->updateComboBox(i);
54 this->updating_view =
false;
59 void DataSourceCombo::updateComboBox(
int index)
61 GtkWidget * combo = combos[index];
62 int num_sources = this->num_sources[index];
65 for(
int i=num_sources-1;i>=0;i--)
67 gtk_combo_box_remove_text(GTK_COMBO_BOX(combo),i);
73 std::vector<string> sources = view->getModel()->dataGetSources();
74 num_sources = sources.size();
75 int selected = view->getModel()->dataGetSource();
76 for(
int i=0;i<num_sources;i++)
78 gtk_combo_box_append_text(GTK_COMBO_BOX(combo),sources[i].c_str());
80 this->selected_source = sources[i];
83 gtk_combo_box_set_active(GTK_COMBO_BOX(combo),selected);
85 this->num_sources[index] = num_sources;
92 return this->selected_source;
100 void DataSourceCombo::CB_changeSource(GtkWidget * w, gpointer data)
104 if(!d->updating_view)
107 int source = gtk_combo_box_get_active(GTK_COMBO_BOX(w));
108 d->selected_source = gtk_combo_box_get_active_text(GTK_COMBO_BOX(w));