Re: [virt-viewer 5/5] cleanup: Don't use gtk_widget_modify_fg()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2016-02-23 at 18:18 +0100, Fabiano Fidêncio wrote:
> On Tue, Feb 23, 2016 at 6:08 PM, Jonathon Jongsma <jjongsma@xxxxxxxxx
> m> wrote:
> > On Tue, 2016-02-23 at 15:24 +0100, Fabiano Fidêncio wrote:
> > > This function has been deprecated since Gtk 3.0 and is
> > > recommended to
> > > use gtk_widget_override_color() instead.
> > > As the new function takes a GdkRGBA as parameter, let's use
> > > gdk_rgba_parse() instead of gdk_color_parse().
> > > ---
> > >  src/virt-viewer-notebook.c | 6 +++---
> > >  src/virt-viewer-window.c   | 6 +++---
> > >  2 files changed, 6 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/src/virt-viewer-notebook.c b/src/virt-viewer-
> > > notebook.c
> > > index 98b663f..0c3ab72 100644
> > > --- a/src/virt-viewer-notebook.c
> > > +++ b/src/virt-viewer-notebook.c
> > > @@ -71,7 +71,7 @@ static void
> > >  virt_viewer_notebook_init (VirtViewerNotebook *self)
> > >  {
> > >      VirtViewerNotebookPrivate *priv;
> > > -    GdkColor color;
> > > +    GdkRGBA color;
> > > 
> > >      self->priv = GET_PRIVATE(self);
> > >      priv = self->priv;
> > > @@ -81,8 +81,8 @@ virt_viewer_notebook_init (VirtViewerNotebook
> > > *self)
> > >      gtk_notebook_set_show_border(GTK_NOTEBOOK(self), FALSE);
> > >      gtk_widget_show_all(priv->status);
> > >      gtk_notebook_append_page(GTK_NOTEBOOK(self), priv->status,
> > > NULL);
> > > -    gdk_color_parse("white", &color);
> > > -    gtk_widget_modify_fg(priv->status, GTK_STATE_NORMAL,
> > > &color);
> > > +    gdk_rgba_parse(&color, "white");
> > > +    gtk_widget_override_color(priv->status,
> > > GTK_STATE_FLAG_NORMAL, &color);
> > >  }
> > > 
> > >  void
> > > diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> > > index 3da50fb..e7ec109 100644
> > > --- a/src/virt-viewer-window.c
> > > +++ b/src/virt-viewer-window.c
> > > @@ -293,7 +293,7 @@ virt_viewer_window_init (VirtViewerWindow
> > > *self)
> > >  {
> > >      VirtViewerWindowPrivate *priv;
> > >      GtkWidget *vbox;
> > > -    GdkColor color;
> > > +    GdkRGBA color;
> > >      GSList *accels;
> > > 
> > >      self->priv = GET_PRIVATE(self);
> > > @@ -334,8 +334,8 @@ virt_viewer_window_init (VirtViewerWindow
> > > *self)
> > >      virt_viewer_window_toolbar_setup(self);
> > > 
> > >      gtk_box_pack_end(GTK_BOX(vbox), priv->layout, TRUE, TRUE,
> > > 0);
> > > -    gdk_color_parse("black", &color);
> > > -    gtk_widget_modify_bg(priv->layout, GTK_STATE_NORMAL,
> > > &color);
> > > +    gdk_rgba_parse(&color, "black");
> > > +    gtk_widget_override_color(priv->layout,
> > > GTK_STATE_FLAG_NORMAL, &color);
> > 
> > This should probably be gtk_widget_override_background_color().
> > *However*, i
> > just noticed that these functions are also deprecated since 3.16:
> > 
> >     "gtk_widget_override_color has been deprecated since version
> > 3.16 and should
> >     not be used in newly-written code.Use a custom style provider
> > and style
> >     classes instead"
> > 
> 
> Nice catch! I really missed the _bg(). I'll change it to
> gtk_widget_override_background_color().
> About it being deprecated on 3.16 ... I'd care about it when we
> depend
> on 3.16. I don't see a reason for changing it right now ...
> 

I understand that writing a "custom style provider" and css is bigger
task (not related to the series). But please add a FIXME mentioning
deprecation.

Thanks,
Pavel


> > 
> > 
> > > 
> > >      priv->window = GTK_WIDGET(gtk_builder_get_object(priv-
> > > >builder,
> > > "viewer"));
> > >      gtk_window_add_accel_group(GTK_WINDOW(priv->window), priv-
> > > >accel_group);
> > 
> > 
> > Reviewed-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/virt-tools-list

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux