[virt-tools-list] [PATCH virt-viewer 10/11] remote-viewer: Make ovirt-foreign-menu a property

Christophe Fergeau cfergeau at redhat.com
Wed Jul 20 14:58:30 UTC 2016


On Tue, Jul 19, 2016 at 03:04:58PM -0300, Eduardo Lima (Etrunko) wrote:
> On 07/19/2016 02:54 PM, Eduardo Lima (Etrunko) wrote:
> > On 07/19/2016 12:57 PM, Christophe Fergeau wrote:
> >>> +
> >>> +    self = REMOTE_VIEWER_ISO_LIST_DIALOG(dialog);
> >>> +    self->priv->foreign_menu = foreign_menu;
> >>
> >> I'd g_object_ref it if you need to have it around (together with g_clear_object
> >> in dispose/finalize).
> > 
> > Okay, fixed.
> > 
> >>> +
> >>> +#ifdef HAVE_OVIRT
> >>> +    g_object_class_install_property(object_class,
> >>> +                                    PROP_OVIRT_FOREIGN_MENU,
> >>> +                                    g_param_spec_pointer("ovirt-foreign-menu",
> >>
> >> This can be a g_param_spec_object, OvirtForeignMenu is a GObject.
> > 
> > Also fixed.
> > 
> >>
> >>> +                                                         "oVirt Foreign Menu",
> >>> +                                                         "Object which is used as interface to oVirt",
> >>> +                                                         G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
> >>> +#endif
> >>>  }
> >>>  
> >>>  static void
> >>> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> >>> index 867fb86..76fe80f 100644
> >>> --- a/src/virt-viewer-window.c
> >>> +++ b/src/virt-viewer-window.c
> >>> @@ -1072,11 +1072,25 @@ virt_viewer_window_menu_change_cd_activate(GtkWidget *menu G_GNUC_UNUSED,
> >>>  {
> >>>      VirtViewerWindowPrivate *priv = self->priv;
> >>>      static GtkWidget *dialog = NULL;
> >>> +    GValue foreign_menu = G_VALUE_INIT;
> >>>  
> >>>      if (dialog)
> >>>          return;
> >>>  
> >>> -    dialog = remote_viewer_iso_list_dialog_new(GTK_WINDOW(priv->window));
> >>> +    g_value_init(&foreign_menu, G_TYPE_POINTER);
> >>> +    g_object_get_property(G_OBJECT(priv->app), "ovirt-foreign-menu", &foreign_menu);
> >>
> >> You can use g_object_get(G_OBJECT(priv->app), "ovirt-foreign_menu", &foreign_menu, NULL);
> >> rather than a GValue.
> >>
> > 
> > Thanks, fixed too.
> > 
> 
> Actually I did make it a pointer on purpose, because I did not want to
> have OvirtForeignMenu type in this file. Maybe I should change it to
> GObject then?

GObject should be fine yes. Or if it really is opaque data that you'd
prefer VirtViewerWindow not to know about, use g_object_set_data() and
pass the VirtViewerWindow to remote_viewer_iso_list_dialog_new() and let
it extract the foreign menu from the VirtViewerWindow instance with
g_object_get_data().

Christophe

> 
> -- 
> Eduardo de Barros Lima (Etrunko)
> Software Engineer - RedHat
> etrunko at redhat.com
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20160720/a128fcfa/attachment.sig>


More information about the virt-tools-list mailing list