Revision 1897 trunk/client/gui/main.c

main.c (revision 1897)
173 173

                
174 174
    cmbConnectHostname = nntpgrab_gui_base_get_widget("cmbConnectHostname");
175 175
    spinConnectPort = nntpgrab_gui_base_get_widget("spinConnectPort");
176
#if GTK_CHECK_VERSION(3,0,0)
177
    model = gtk_combo_box_get_model(GTK_COMBO_BOX(cmbConnectHostname));
178
    if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(cmbConnectHostname), &iter)) {
179
        gtk_tree_model_get(model, &iter, 0, &hostname, -1);
180
    } else {
181
        hostname = g_strdup("");
182
    }
183
#else
184
    hostname = gtk_combo_box_get_active_text(GTK_COMBO_BOX(cmbConnectHostname));
185
#endif
176
    hostname = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(cmbConnectHostname)))));
186 177
    port = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinConnectPort));
187 178

                
188 179
    glue = nntpgrab_glue_new();
... ...
282 273
    // Save the hostname into the GUI Configuration
283 274
    ConfigGUIOpts opts = config_gui_get_opts();
284 275
    GtkWidget *cmbConnectHostname = nntpgrab_gui_base_get_widget("cmbConnectHostname");
285
    char *hostname = NULL;
276
    char *hostname = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(cmbConnectHostname))));
286 277

                
287
#if GTK_CHECK_VERSION(3,0,0)
288
    GtkTreeIter iter;
289
    GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(cmbConnectHostname));
290
    g_return_if_fail(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(cmbConnectHostname), &iter));
291
    gtk_tree_model_get(model, &iter, 0, &hostname, -1);
292
#else
293
    hostname = gtk_combo_box_get_active_text(GTK_COMBO_BOX(cmbConnectHostname));
294
#endif
295

                
296 278
    // Have we seen this hostname before ?
297 279
    if (!strcmp(hostname, opts.hostname1)) {
298 280
        // No need to do anything, item is already at the top of the list

Also available in: Unified diff