[virt-tools-list] [virt-viewer v2 5/5] cleanup: Don't use gtk_widget_modify_{fg, bg}()
Fabiano Fidêncio
fabiano at fidencio.org
Wed Feb 24 08:02:25 UTC 2016
On Wed, Feb 24, 2016 at 8:45 AM, Pavel Grunt <pgrunt at redhat.com> wrote:
> s/depracated/deprecated/g
>
> Thanks for the FIXME, maybe we should fill a bug/RFE to fix it asap.
> I don't have strong feelings about this (replacing one deprecated
> function for another).
Would you like to have something like this? Or there is no need to
mention the bug/RFE?
ffidenci at cat ~/src/upstream/virt-viewer $ git diff
diff --git a/src/virt-viewer-notebook.c b/src/virt-viewer-notebook.c
index bce77e3..420c914 100644
--- a/src/virt-viewer-notebook.c
+++ b/src/virt-viewer-notebook.c
@@ -83,9 +83,11 @@ virt_viewer_notebook_init (VirtViewerNotebook *self)
gtk_notebook_append_page(GTK_NOTEBOOK(self), priv->status, NULL);
gdk_rgba_parse(&color, "white");
/* FIXME:
- * This method has been depracated in 3.16.
+ * This method has been deprecated in 3.16.
* For more details on how to deal with this in the future, please, see:
* https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-override-color
+ * For the bug report about this deprecated function, please, see:
+ * https://bugs.freedesktop.org/show_bug.cgi?id=94276
*/
gtk_widget_override_color(priv->status, GTK_STATE_FLAG_NORMAL, &color);
}
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 237bffd..8ce34ca 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -336,9 +336,11 @@ virt_viewer_window_init (VirtViewerWindow *self)
gtk_box_pack_end(GTK_BOX(vbox), priv->layout, TRUE, TRUE, 0);
gdk_rgba_parse(&color, "black");
/* FIXME:
- * This method has been depracated in 3.16.
+ * This method has been deprecated in 3.16.
* For more details on how to deal with this in the future, please, see:
* https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-override-background-color
+ * For the bug report about this deprecated function, please, see:
+ * https://bugs.freedesktop.org/show_bug.cgi?id=94276
*/
gtk_widget_override_background_color(priv->layout,
GTK_STATE_FLAG_NORMAL, &color);
>
> Pavel
>
> On Wed, 2016-02-24 at 08:04 +0100, Fabiano Fidêncio wrote:
>> These function have been deprecated since Gtk 3.0 and is recommended
>> to
>> use _override_color() and _override_background_color() instead.
>> As these new functions take a GdkRGBA as parameter, let's use
>> gdk_rgba_parse() instead of gdk_color_parse().
>>
>> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
>> ---
>> src/virt-viewer-notebook.c | 11 ++++++++---
>> src/virt-viewer-window.c | 11 ++++++++---
>> 2 files changed, 16 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/virt-viewer-notebook.c b/src/virt-viewer-notebook.c
>> index 98b663f..bce77e3 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,13 @@ 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");
>> + /* FIXME:
>> + * This method has been depracated in 3.16.
>> + * For more details on how to deal with this in the future,
>> please, see:
>> + * https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-wi
>> dget-override-color
>> + */
>> + 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..237bffd 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,13 @@ 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");
>> + /* FIXME:
>> + * This method has been depracated in 3.16.
>> + * For more details on how to deal with this in the future,
>> please, see:
>> + * https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-wi
>> dget-override-background-color
>> + */
>> + gtk_widget_override_background_color(priv->layout,
>> GTK_STATE_FLAG_NORMAL, &color);
>>
>> priv->window = GTK_WIDGET(gtk_builder_get_object(priv->builder,
>> "viewer"));
>> gtk_window_add_accel_group(GTK_WINDOW(priv->window), priv-
>> >accel_group);
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
--
Fabiano Fidêncio
More information about the virt-tools-list
mailing list