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

Eduardo Lima (Etrunko) etrunko at redhat.com
Tue Jul 19 18:04:58 UTC 2016


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?

-- 
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
etrunko at redhat.com




More information about the virt-tools-list mailing list