On Fri, 2016-02-12 at 09:35 -0200, Eduardo Lima (Etrunko) wrote: > The reason for using properties to access those members was to ensure > that they would only be set during the creation of the object. Now > that > we removed that restriction, we set private members directly. > > Signed-off-by: Eduardo Lima (Etrunko) <etrunko@xxxxxxxxxx> > --- > src/remote-viewer.c | 101 +++--------------------------------------- > ---------- > 1 file changed, 4 insertions(+), 97 deletions(-) > > diff --git a/src/remote-viewer.c b/src/remote-viewer.c > index 0e15d2f..1c3cd84 100644 > --- a/src/remote-viewer.c > +++ b/src/remote-viewer.c > @@ -67,15 +67,6 @@ G_DEFINE_TYPE (RemoteViewer, remote_viewer, > VIRT_VIEWER_TYPE_APP) > #define > GET_PRIVATE(o) > \ > (G_TYPE_INSTANCE_GET_PRIVATE ((o), REMOTE_VIEWER_TYPE, > RemoteViewerPrivate)) > > -enum { > - PROP_0, > -#ifdef HAVE_SPICE_GTK > - PROP_CONTROLLER, > - PROP_CTRL_FOREIGN_MENU, > -#endif > - PROP_OPEN_RECENT_DIALOG > -}; > - > #ifdef HAVE_OVIRT > static OvirtVm * choose_vm(GtkWindow *main_window, > char **vm_name, > @@ -122,56 +113,6 @@ remote_viewer_dispose (GObject *object) > } > > static void > -remote_viewer_get_property (GObject *object, guint property_id, > - GValue *value, GParamSpec *pspec) > -{ > - RemoteViewer *self = REMOTE_VIEWER(object); > - RemoteViewerPrivate *priv = self->priv; > - > - switch (property_id) { > -#ifdef HAVE_SPICE_GTK > - case PROP_CONTROLLER: > - g_value_set_object(value, priv->controller); > - break; > - case PROP_CTRL_FOREIGN_MENU: > - g_value_set_object(value, priv->ctrl_foreign_menu); > - break; > -#endif > - case PROP_OPEN_RECENT_DIALOG: > - g_value_set_boolean(value, priv->open_recent_dialog); > - break; > - default: > - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, > pspec); > - } > -} > - > -static void > -remote_viewer_set_property (GObject *object, guint property_id, > - const GValue *value, GParamSpec *pspec) > -{ > - RemoteViewer *self = REMOTE_VIEWER(object); > - RemoteViewerPrivate *priv = self->priv; > - > - switch (property_id) { > -#ifdef HAVE_SPICE_GTK > - case PROP_CONTROLLER: > - g_return_if_fail(priv->controller == NULL); > - priv->controller = g_value_dup_object(value); > - break; > - case PROP_CTRL_FOREIGN_MENU: > - g_return_if_fail(priv->ctrl_foreign_menu == NULL); > - priv->ctrl_foreign_menu = g_value_dup_object(value); > - break; > -#endif > - case PROP_OPEN_RECENT_DIALOG: > - priv->open_recent_dialog = g_value_get_boolean(value); > - break; > - default: > - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, > pspec); > - } > -} > - > -static void > remote_viewer_deactivated(VirtViewerApp *app, gboolean > connect_error) > { > RemoteViewer *self = REMOTE_VIEWER(app); > @@ -271,20 +212,14 @@ remote_viewer_local_command_line > (GApplication *gapp, > GOTO_END; > } > > - SpiceCtrlController *ctrl = spice_ctrl_controller_new(); > - SpiceCtrlForeignMenu *menu = spice_ctrl_foreign_menu_new(); > + self->priv->controller = spice_ctrl_controller_new(); > + self->priv->ctrl_foreign_menu = > spice_ctrl_foreign_menu_new(); > > - g_object_set(self, "guest-name", "defined by Spice > controller", > - "controller", ctrl, > - "foreign-menu", menu, > - NULL); > + g_object_set(self, "guest-name", "defined by Spice > controller", NULL); > > - g_signal_connect(menu, "notify::title", > + g_signal_connect(self->priv->ctrl_foreign_menu, > "notify::title", > G_CALLBACK(foreign_menu_title_changed), > self); > - > - g_object_unref(ctrl); > - g_object_unref(menu); > } > #endif > > @@ -311,8 +246,6 @@ remote_viewer_class_init (RemoteViewerClass > *klass) > > g_type_class_add_private (klass, sizeof (RemoteViewerPrivate)); > > - object_class->get_property = remote_viewer_get_property; > - object_class->set_property = remote_viewer_set_property; > object_class->dispose = remote_viewer_dispose; > > g_app_class->local_command_line = > remote_viewer_local_command_line; > @@ -322,36 +255,10 @@ remote_viewer_class_init (RemoteViewerClass > *klass) > app_class->add_option_entries = > remote_viewer_add_option_entries; > #ifdef HAVE_SPICE_GTK > app_class->activate = remote_viewer_activate; > - > gtk_app_class->window_added = remote_viewer_window_added; > - > - g_object_class_install_property(object_class, > - PROP_CONTROLLER, > - g_param_spec_object("controller" > , > - "Controller" > , > - "Spice > controller", > - SPICE_CTRL_T > YPE_CONTROLLER, > - G_PARAM_READ > WRITE | > - G_PARAM_STAT > IC_STRINGS)); > - g_object_class_install_property(object_class, > - PROP_CTRL_FOREIGN_MENU, > - g_param_spec_object("foreign- > menu", > - "Foreign > Menu", > - "Spice > foreign menu", > - SPICE_CTRL_T > YPE_FOREIGN_MENU, > - G_PARAM_READ > WRITE | > - G_PARAM_STAT > IC_STRINGS)); > #else > (void) gtk_app_class; > #endif > - g_object_class_install_property(object_class, > - PROP_OPEN_RECENT_DIALOG, > - g_param_spec_boolean("open- > recent-dialog", > - "Open > recent dialog", > - "Open > recent dialog", > - FALSE, > - G_PARAM_REA > DWRITE | > - G_PARAM_STA > TIC_STRINGS)); > } > > static void Acked-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list