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
1=== modified file 'gtk/gtkbuilder/dialog_change_version.ui'
2--- gtk/gtkbuilder/dialog_change_version.ui 2012-02-17 07:17:41 +0000
3+++ gtk/gtkbuilder/dialog_change_version.ui 2012-11-13 08:29:23 +0000
4@@ -122,14 +122,9 @@
5 </packing>
6 </child>
7 <child>
8- <object class="GtkOptionMenu" id="optionmenu_available_versions">
9+ <object class="GtkComboBoxText" id="combobox_available_versions">
10 <property name="visible">True</property>
11 <property name="can_focus">True</property>
12- <property name="history">-1</property>
13- <child>
14- <object class="GtkMenu" id="menu1">
15- </object>
16- </child>
17 </object>
18 <packing>
19 <property name="padding">0</property>
20
21=== modified file 'gtk/rgmainwindow.cc'
22--- gtk/rgmainwindow.cc 2012-11-12 22:05:33 +0000
23+++ gtk/rgmainwindow.cc 2012-11-13 08:29:23 +0000
24@@ -560,12 +560,9 @@
25 g_free(str_name);
26 g_free(str);
27
28- GtkWidget *optionMenu = GTK_WIDGET(gtk_builder_get_object
29+ GtkWidget *comboBox = GTK_WIDGET(gtk_builder_get_object
30 (dia.getGtkBuilder(),
31- "optionmenu_available_versions"));
32-
33- GtkWidget *menu = gtk_menu_new();
34- GtkWidget *item;
35+ "combobox_available_versions"));
36
37 int canidateNr = 0;
38 vector<pair<string, string> > versions = pkg->getAvailableVersions();
39@@ -573,23 +570,20 @@
40 gchar *str = g_strdup_printf("%s (%s)",
41 versions[i].first.c_str(),
42 versions[i].second.c_str() );
43- item = gtk_menu_item_new_with_label(str);
44 const char *verStr = pkg->availableVersion();
45 if(verStr && versions[i].first == string(verStr))
46- canidateNr = i;
47- gtk_widget_show(item);
48- gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
49+ canidateNr = i;
50+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(comboBox), str);
51 //cout << "got: " << str << endl;
52 g_free(str);
53 }
54- gtk_option_menu_set_menu(GTK_OPTION_MENU(optionMenu), menu);
55- gtk_option_menu_set_history(GTK_OPTION_MENU(optionMenu), canidateNr);
56+ gtk_combo_box_set_active(GTK_COMBO_BOX(comboBox), canidateNr);
57 if(!dia.run()) {
58 //cout << "cancel" << endl;
59 return; // user clicked cancel
60 }
61
62- int nr = gtk_option_menu_get_history(GTK_OPTION_MENU(optionMenu));
63+ int nr = gtk_combo_box_get_active(GTK_COMBO_BOX(comboBox));
64
65 pkg->setNotify(false);
66 // 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: