Merge lp:~evfool/synaptic/lp1033517 into lp:synaptic

Proposed by Robert Roth
Status: Merged
Merged at revision: 2120
Proposed branch: lp:~evfool/synaptic/lp1033517
Merge into: lp:synaptic
Diff against target: 66 lines (+7/-18)
2 files modified
gtk/gtkbuilder/dialog_change_version.ui (+1/-6)
gtk/rgmainwindow.cc (+6/-12)
To merge this branch: bzr merge lp:~evfool/synaptic/lp1033517
Reviewer Review Type Date Requested Status
synaptic-developers Pending
Review via email: mp+134046@code.launchpad.net

Description of the change

Changed the deprecated GtkOptionMenu used on the force version dialog to a GtkComboBoxText (available in gtk since gtk 2.24) to fix bug #1033517.

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :
Download full text (4.0 KiB)

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 @@
> </packing>
> </child>
> <child>
> - <object class="GtkOptionMenu" id="optionmenu_available_versions">
> + <object class="GtkComboBoxText" id="combobox_available_versions">
> <property name="visible">True</property>
> <property name="can_focus">True</property>
> - <property name="history">-1</property>
> - <child>
> - <object class="GtkMenu" id="menu1">
> - </object>
> - </child>
> </object>
> <packing>
> <property name="padding">0</property>
>
> === 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<pair<string, string> > 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))
> - ...

Read more...

Revision history for this message
Robert Roth (evfool) wrote :

I have been playing with it a bit, but I guess the best would be to switch to it, and that way we could get some testing until the Raring release, and as the gtk3 branch seems to work pretty well, the issues arising should mostly be simple ones to fix.

Revision history for this message
Robert Roth (evfool) wrote :

So I'd say let's switch to gtk3, and I'll be happy to hack on the new issues reported (along with the ancient ones).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
122 </packing>122 </packing>
123 </child>123 </child>
124 <child>124 <child>
125 <object class="GtkOptionMenu" id="optionmenu_available_versions">125 <object class="GtkComboBoxText" id="combobox_available_versions">
126 <property name="visible">True</property>126 <property name="visible">True</property>
127 <property name="can_focus">True</property>127 <property name="can_focus">True</property>
128 <property name="history">-1</property>
129 <child>
130 <object class="GtkMenu" id="menu1">
131 </object>
132 </child>
133 </object>128 </object>
134 <packing>129 <packing>
135 <property name="padding">0</property>130 <property name="padding">0</property>
136131
=== 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 @@
560 g_free(str_name);560 g_free(str_name);
561 g_free(str);561 g_free(str);
562 562
563 GtkWidget *optionMenu = GTK_WIDGET(gtk_builder_get_object563 GtkWidget *comboBox = GTK_WIDGET(gtk_builder_get_object
564 (dia.getGtkBuilder(),564 (dia.getGtkBuilder(),
565 "optionmenu_available_versions"));565 "combobox_available_versions"));
566
567 GtkWidget *menu = gtk_menu_new();
568 GtkWidget *item;
569566
570 int canidateNr = 0;567 int canidateNr = 0;
571 vector<pair<string, string> > versions = pkg->getAvailableVersions();568 vector<pair<string, string> > versions = pkg->getAvailableVersions();
@@ -573,23 +570,20 @@
573 gchar *str = g_strdup_printf("%s (%s)", 570 gchar *str = g_strdup_printf("%s (%s)",
574 versions[i].first.c_str(), 571 versions[i].first.c_str(),
575 versions[i].second.c_str() );572 versions[i].second.c_str() );
576 item = gtk_menu_item_new_with_label(str);
577 const char *verStr = pkg->availableVersion();573 const char *verStr = pkg->availableVersion();
578 if(verStr && versions[i].first == string(verStr))574 if(verStr && versions[i].first == string(verStr))
579 canidateNr = i;575 canidateNr = i;
580 gtk_widget_show(item);576 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(comboBox), str);
581 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
582 //cout << "got: " << str << endl;577 //cout << "got: " << str << endl;
583 g_free(str);578 g_free(str);
584 }579 }
585 gtk_option_menu_set_menu(GTK_OPTION_MENU(optionMenu), menu);580 gtk_combo_box_set_active(GTK_COMBO_BOX(comboBox), canidateNr);
586 gtk_option_menu_set_history(GTK_OPTION_MENU(optionMenu), canidateNr);
587 if(!dia.run()) {581 if(!dia.run()) {
588 //cout << "cancel" << endl;582 //cout << "cancel" << endl;
589 return; // user clicked cancel583 return; // user clicked cancel
590 }584 }
591585
592 int nr = gtk_option_menu_get_history(GTK_OPTION_MENU(optionMenu));586 int nr = gtk_combo_box_get_active(GTK_COMBO_BOX(comboBox));
593587
594 pkg->setNotify(false);588 pkg->setNotify(false);
595 // nr-1 here as we add a "do not override" to the option menu589 // nr-1 here as we add a "do not override" to the option menu

Subscribers

People subscribed via source and target branches

to status/vote changes: