After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 739737 - Don't use properties of deprecated widgets
Don't use properties of deprecated widgets
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Printers
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Marek Kašík
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-11-06 14:14 UTC by Marek Kašík
Modified: 2014-11-25 11:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't use properties of deprecated widgets (9.45 KB, patch)
2014-11-06 14:14 UTC, Marek Kašík
needs-work Details | Review
Don't update alignment padding for dialogs (11.75 KB, patch)
2014-11-07 16:01 UTC, Marek Kašík
committed Details | Review
Don't use methods of deprecated GtkMisc (3.99 KB, patch)
2014-11-07 16:02 UTC, Marek Kašík
committed Details | Review
Add GtkLabel with printer model name (4.60 KB, patch)
2014-11-07 16:04 UTC, Marek Kašík
committed Details | Review
Fix padding of a progress text (2.10 KB, patch)
2014-11-07 16:05 UTC, Marek Kašík
committed Details | Review
Remove usage of deprecated GtkAlignment (49.11 KB, patch)
2014-11-07 16:06 UTC, Marek Kašík
committed Details | Review
Don't use properties of deprecated widgets (4.80 KB, patch)
2014-11-07 16:10 UTC, Marek Kašík
committed Details | Review
Fix spacing in Jobs dialog (1.01 KB, patch)
2014-11-07 16:11 UTC, Marek Kašík
committed Details | Review
Use macros for casting of GObject (51.56 KB, patch)
2014-11-24 17:51 UTC, Marek Kašík
rejected Details | Review

Description Marek Kašík 2014-11-06 14:14:33 UTC
Created attachment 290105 [details] [review]
Don't use properties of deprecated widgets

Several widgets used in the Printers panel of gnome-control-center use properties of widgets which are deprecated now. This can lead to assertion fail.

Attached patch replaces xalign, yalign and xpad properties by halign, valign and margin-start wherever needed.
It adds custom GtkLabel into GtkButton so we can adjust alignment of the text on the button which changes printer driver.
It also sets padding of "printer-model-setting" widget at runtime.
Comment 1 Bastien Nocera 2014-11-06 14:28:24 UTC
Review of attachment 290105 [details] [review]:

::: panels/printers/cc-printers-panel.c
@@ +859,1 @@
       model_button = (GtkWidget*)

You'll need to rename it.

@@ +1002,1 @@
       model_button = (GtkWidget*)

Ditto.

@@ +2837,3 @@
+        gtk_builder_get_object (priv->builder, "printer-model-setting");
+
+      gtk_misc_get_padding  (GTK_MISC (label), &pad, NULL);

GtkMisc is deprecated as well. Best get rid of it before touching that code.
Comment 2 Marek Kašík 2014-11-07 16:01:15 UTC
Created attachment 290187 [details] [review]
Don't update alignment padding for dialogs

The update of alignment padding is not needed since gtk+ 3.14. It was needed for proper alignment of widgets of action area with those from content area.
Comment 3 Marek Kašík 2014-11-07 16:02:08 UTC
Created attachment 290188 [details] [review]
Don't use methods of deprecated GtkMisc

Use GtkWidget's methods for settings of halign, valign and margin-start instead of GtkMisc's methods for settings of xalign, yalign and xpad.
Comment 4 Marek Kašík 2014-11-07 16:04:59 UTC
Created attachment 290189 [details] [review]
Add GtkLabel with printer model name

Place a custom GtkLabel with name of printer model into "printer-model-button". This is needed for us to be able to align the text and keep the button filling all available horizontal space.
Comment 5 Marek Kašík 2014-11-07 16:05:36 UTC
Created attachment 290190 [details] [review]
Fix padding of a progress text

Set padding of the text "Setting new driver" at runtime so that it is aligned with other fields properly.
Comment 6 Marek Kašík 2014-11-07 16:06:18 UTC
Created attachment 290191 [details] [review]
Remove usage of deprecated GtkAlignment

Use halign and valign of children instead of adding GtkAlignment and setting of xalign and yalign.
Comment 7 Marek Kašík 2014-11-07 16:10:12 UTC
Created attachment 290192 [details] [review]
Don't use properties of deprecated widgets

Hi,

thank you for the review. I've divided the patch into several smaller + added few fixes.

(In reply to comment #1)
> Review of attachment 290105 [details] [review]:
> 
> ::: panels/printers/cc-printers-panel.c
> @@ +859,1 @@
>        model_button = (GtkWidget*)
> 
> You'll need to rename it.

Done. (in "Add GtkLabel with printer model name")


> @@ +1002,1 @@
>        model_button = (GtkWidget*)
> 
> Ditto.

Done. (in "Add GtkLabel with printer model name")


> @@ +2837,3 @@
> +        gtk_builder_get_object (priv->builder, "printer-model-setting");
> +
> +      gtk_misc_get_padding  (GTK_MISC (label), &pad, NULL);
> 
> GtkMisc is deprecated as well. Best get rid of it before touching that code.

Done. (in "Don't use methods of deprecated GtkMisc")


This patch replaces xalign and yalign properties by halign and valign wherever needed.
Comment 8 Marek Kašík 2014-11-07 16:11:45 UTC
Created attachment 290193 [details] [review]
Fix spacing in Jobs dialog

Increase spacing in the VBox to 10 as in other dialogs. I've spot this during fixing of the bug.
Comment 9 Bastien Nocera 2014-11-24 16:45:13 UTC
Review of attachment 290187 [details] [review]:

If this requires GTK+ 3.14, please update configure.ac as well.
Comment 10 Bastien Nocera 2014-11-24 16:45:36 UTC
Review of attachment 290188 [details] [review]:

Sure.
Comment 11 Bastien Nocera 2014-11-24 16:46:33 UTC
Review of attachment 290190 [details] [review]:

::: panels/printers/cc-printers-panel.c
@@ +2834,3 @@
         gtk_widget_set_margin_start (label, offset);
+
+      label = (GtkWidget*)

please cast properly with GTK_WIDGET.
Comment 12 Bastien Nocera 2014-11-24 16:47:21 UTC
Review of attachment 290189 [details] [review]:

::: panels/printers/cc-printers-panel.c
@@ +859,1 @@
+      model_button_label = (GtkWidget*)

Ditto about the casting.
Comment 13 Bastien Nocera 2014-11-24 16:48:46 UTC
Review of attachment 290191 [details] [review]:

Looks fine.
Comment 14 Bastien Nocera 2014-11-24 16:49:07 UTC
Review of attachment 290192 [details] [review]:

Looks fine.
Comment 15 Bastien Nocera 2014-11-24 16:49:27 UTC
Review of attachment 290193 [details] [review]:

Sure.
Comment 16 Marek Kašík 2014-11-24 17:51:53 UTC
Created attachment 291407 [details] [review]
Use macros for casting of GObject

(In reply to comment #11)
> Review of attachment 290190 [details] [review]:
> 
> ::: panels/printers/cc-printers-panel.c
> @@ +2834,3 @@
>          gtk_widget_set_margin_start (label, offset);
> +
> +      label = (GtkWidget*)
> 
> please cast properly with GTK_WIDGET.

I went ahead and prepared this patch which fixes the casting for all Glib/GTK+ object types for whole Printers panel.
I'll modify all the patches accordingly before push if you'll accept it.
Comment 17 Bastien Nocera 2014-11-24 17:53:14 UTC
Review of attachment 291407 [details] [review]:

There's no need to do this now, this would just be churn. Correcting the patches is enough for me.
Comment 18 Marek Kašík 2014-11-25 11:04:16 UTC
Comment on attachment 290190 [details] [review]
Fix padding of a progress text

(In reply to comment #11)
> Review of attachment 290190 [details] [review]:
> 
> ::: panels/printers/cc-printers-panel.c
> @@ +2834,3 @@
>          gtk_widget_set_margin_start (label, offset);
> +
> +      label = (GtkWidget*)
> 
> please cast properly with GTK_WIDGET.

I've changed the patch to cast using GTK_WIDGET and pushed it master.
Comment 19 Marek Kašík 2014-11-25 11:05:00 UTC
Comment on attachment 290189 [details] [review]
Add GtkLabel with printer model name

(In reply to comment #12)
> Review of attachment 290189 [details] [review]:
> 
> ::: panels/printers/cc-printers-panel.c
> @@ +859,1 @@
> +      model_button_label = (GtkWidget*)
> 
> Ditto about the casting.

This one too.
Comment 20 Marek Kašík 2014-11-25 11:06:48 UTC
(In reply to comment #17)
> Review of attachment 291407 [details] [review]:
> 
> There's no need to do this now, this would just be churn. Correcting the
> patches is enough for me.

Ok, I've modified the casting in the 2 patches and pushed them to master together with the other patches.
I'm closing this bug as resolved.

Thank you for all the reviews.

Marek