On Tue, Nov 13, 2012 at 08:30:35AM -0000, Robert Roth wrote: > Robert Roth has proposed merging lp:~evfool/synaptic/lp1033517 into lp:synaptic. > > Requested reviews: > synaptic-developers (synaptic-developers) > Related bugs: > Bug #1033517 in synaptic (Ubuntu): "Gtk-WARNING **: Cannot add an object of type GtkMenu to a container of type GtkOptionMenu" > https://bugs.launchpad.net/ubuntu/+source/synaptic/+bug/1033517 > > For more details, see: > https://code.launchpad.net/~evfool/synaptic/lp1033517/+merge/134046 > > Changed the deprecated GtkOptionMenu used on the force version dialog to a GtkComboBoxText (available in gtk since gtk 2.24) to fix bug #1033517. Thanks a lot for your patch! This looks good - it makes me wonder if we should switch to the gtk3 branch entirely, what do you think? Have you had a chance to play with it? There is some potential for regression with that move of course, but it seems like its not worth it as this needs to be done in the future anyway. Cheers, Michael > -- > https://code.launchpad.net/~evfool/synaptic/lp1033517/+merge/134046 > You are subscribed to branch lp:synaptic. > === modified file 'gtk/gtkbuilder/dialog_change_version.ui' > --- gtk/gtkbuilder/dialog_change_version.ui 2012-02-17 07:17:41 +0000 > +++ gtk/gtkbuilder/dialog_change_version.ui 2012-11-13 08:29:23 +0000 > @@ -122,14 +122,9 @@ > > > > - > + > True > True > - -1 > - > - > - > - > > > 0 > > === modified file 'gtk/rgmainwindow.cc' > --- gtk/rgmainwindow.cc 2012-11-12 22:05:33 +0000 > +++ gtk/rgmainwindow.cc 2012-11-13 08:29:23 +0000 > @@ -560,12 +560,9 @@ > g_free(str_name); > g_free(str); > > - GtkWidget *optionMenu = GTK_WIDGET(gtk_builder_get_object > + GtkWidget *comboBox = GTK_WIDGET(gtk_builder_get_object > (dia.getGtkBuilder(), > - "optionmenu_available_versions")); > - > - GtkWidget *menu = gtk_menu_new(); > - GtkWidget *item; > + "combobox_available_versions")); > > int canidateNr = 0; > vector > versions = pkg->getAvailableVersions(); > @@ -573,23 +570,20 @@ > gchar *str = g_strdup_printf("%s (%s)", > versions[i].first.c_str(), > versions[i].second.c_str() ); > - item = gtk_menu_item_new_with_label(str); > const char *verStr = pkg->availableVersion(); > if(verStr && versions[i].first == string(verStr)) > - canidateNr = i; > - gtk_widget_show(item); > - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); > + canidateNr = i; > + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(comboBox), str); > //cout << "got: " << str << endl; > g_free(str); > } > - gtk_option_menu_set_menu(GTK_OPTION_MENU(optionMenu), menu); > - gtk_option_menu_set_history(GTK_OPTION_MENU(optionMenu), canidateNr); > + gtk_combo_box_set_active(GTK_COMBO_BOX(comboBox), canidateNr); > if(!dia.run()) { > //cout << "cancel" << endl; > return; // user clicked cancel > } > > - int nr = gtk_option_menu_get_history(GTK_OPTION_MENU(optionMenu)); > + int nr = gtk_combo_box_get_active(GTK_COMBO_BOX(comboBox)); > > pkg->setNotify(false); > // nr-1 here as we add a "do not override" to the option menu >