Re: [libvirt-glib] Remove vir- prefix from signals

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

 



On Mon, Oct 17, 2011 at 01:32:58PM +0200, Christophe Fergeau wrote:
> gobject signals are generally not namespaced this way, removing
> this prefix makes things look a bit nicer.
> ---
>  libvirt-gobject/libvirt-gobject-connection.c |   50 +++++++++++++-------------
>  libvirt-gobject/libvirt-gobject-domain.c     |   10 +++---
>  libvirt-gobject/libvirt-gobject-manager.c    |    8 ++--
>  3 files changed, 34 insertions(+), 34 deletions(-)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
> index 4832908..8813e96 100644
> --- a/libvirt-gobject/libvirt-gobject-connection.c
> +++ b/libvirt-gobject/libvirt-gobject-connection.c
> @@ -170,7 +170,7 @@ static void gvir_connection_class_init(GVirConnectionClass *klass)
>                                                          G_PARAM_STATIC_NICK |
>                                                          G_PARAM_STATIC_BLURB));
>  
> -    signals[VIR_CONNECTION_OPENED] = g_signal_new("vir-connection-opened",
> +    signals[VIR_CONNECTION_OPENED] = g_signal_new("connection-opened",
>                   G_OBJECT_CLASS_TYPE(object_class),
>                   G_SIGNAL_RUN_FIRST,
>                   G_STRUCT_OFFSET(GVirConnectionClass, vir_connection_opened),
> @@ -179,7 +179,7 @@ static void gvir_connection_class_init(GVirConnectionClass *klass)
>                   G_TYPE_NONE,
>                   0);
>  
> -    signals[VIR_CONNECTION_CLOSED] = g_signal_new("vir-connection-closed",
> +    signals[VIR_CONNECTION_CLOSED] = g_signal_new("connection-closed",
>                   G_OBJECT_CLASS_TYPE(object_class),
>                   G_SIGNAL_RUN_FIRST,
>                   G_STRUCT_OFFSET(GVirConnectionClass, vir_connection_closed),
> @@ -188,7 +188,7 @@ static void gvir_connection_class_init(GVirConnectionClass *klass)
>                   G_TYPE_NONE,
>                   0);
>  
> -    signals[VIR_DOMAIN_ADDED] = g_signal_new("vir-domain-added",
> +    signals[VIR_DOMAIN_ADDED] = g_signal_new("domain-added",
>                   G_OBJECT_CLASS_TYPE(object_class),
>                   G_SIGNAL_RUN_FIRST,
>                   G_STRUCT_OFFSET(GVirConnectionClass, vir_domain_added),
> @@ -198,7 +198,7 @@ static void gvir_connection_class_init(GVirConnectionClass *klass)
>                   1,
>                   G_TYPE_OBJECT);
>  
> -    signals[VIR_DOMAIN_REMOVED] = g_signal_new("vir-domain-removed",
> +    signals[VIR_DOMAIN_REMOVED] = g_signal_new("domain-removed",
>                   G_OBJECT_CLASS_TYPE(object_class),
>                   G_SIGNAL_RUN_FIRST,
>                   G_STRUCT_OFFSET(GVirConnectionClass, vir_domain_removed),
> @@ -282,7 +282,7 @@ static int domain_event_cb(virConnectPtr conn G_GNUC_UNUSED,
>              if (detail == VIR_DOMAIN_EVENT_DEFINED_ADDED)
>                  g_signal_emit(gconn, signals[VIR_DOMAIN_ADDED], 0, gdom);
>              else if (detail == VIR_DOMAIN_EVENT_DEFINED_UPDATED)
> -                g_signal_emit_by_name(gdom, "vir-updated");
> +                g_signal_emit_by_name(gdom, "updated");
>              else
>                  g_warn_if_reached();
>              break;
> @@ -301,60 +301,60 @@ static int domain_event_cb(virConnectPtr conn G_GNUC_UNUSED,
>  
>          case VIR_DOMAIN_EVENT_STARTED:
>              if (detail == VIR_DOMAIN_EVENT_STARTED_BOOTED)
> -                g_signal_emit_by_name(gdom, "vir-started::booted");
> +                g_signal_emit_by_name(gdom, "started::booted");
>              else if (detail == VIR_DOMAIN_EVENT_STARTED_MIGRATED)
> -                g_signal_emit_by_name(gdom, "vir-started::migrated");
> +                g_signal_emit_by_name(gdom, "started::migrated");
>              else if (detail == VIR_DOMAIN_EVENT_STARTED_RESTORED)
> -                g_signal_emit_by_name(gdom, "vir-started::restored");
> +                g_signal_emit_by_name(gdom, "started::restored");
>              else if (detail == VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT)
> -                g_signal_emit_by_name(gdom, "vir-started::from-snapshot");
> +                g_signal_emit_by_name(gdom, "started::from-snapshot");
>              else
>                  g_warn_if_reached();
>              break;
>  
>          case VIR_DOMAIN_EVENT_SUSPENDED:
>              if (detail == VIR_DOMAIN_EVENT_SUSPENDED_PAUSED)
> -                g_signal_emit_by_name(gdom, "vir-suspended::paused");
> +                g_signal_emit_by_name(gdom, "suspended::paused");
>              else if (detail == VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED)
> -                g_signal_emit_by_name(gdom, "vir-suspended::migrated");
> +                g_signal_emit_by_name(gdom, "suspended::migrated");
>              else if (detail == VIR_DOMAIN_EVENT_SUSPENDED_IOERROR)
> -                g_signal_emit_by_name(gdom, "vir-suspended::ioerror");
> +                g_signal_emit_by_name(gdom, "suspended::ioerror");
>              else if (detail == VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG)
> -                g_signal_emit_by_name(gdom, "vir-suspended::watchdog");
> +                g_signal_emit_by_name(gdom, "suspended::watchdog");
>              else if (detail == VIR_DOMAIN_EVENT_SUSPENDED_RESTORED)
> -                g_signal_emit_by_name(gdom, "vir-suspended::restored");
> +                g_signal_emit_by_name(gdom, "suspended::restored");
>              else if (detail == VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT)
> -                g_signal_emit_by_name(gdom, "vir-suspended::from-snapshot");
> +                g_signal_emit_by_name(gdom, "suspended::from-snapshot");
>              else
>                  g_warn_if_reached();
>              break;
>  
>          case VIR_DOMAIN_EVENT_RESUMED:
>              if (detail == VIR_DOMAIN_EVENT_RESUMED_UNPAUSED)
> -                g_signal_emit_by_name(gdom, "vir-resumed::unpaused");
> +                g_signal_emit_by_name(gdom, "resumed::unpaused");
>              else if (detail == VIR_DOMAIN_EVENT_RESUMED_MIGRATED)
> -                g_signal_emit_by_name(gdom, "vir-resumed::migrated");
> +                g_signal_emit_by_name(gdom, "resumed::migrated");
>              else if (detail == VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT)
> -                g_signal_emit_by_name(gdom, "vir-resumed::from-snapshot");
> +                g_signal_emit_by_name(gdom, "resumed::from-snapshot");
>              else
>                  g_warn_if_reached();
>              break;
>  
>          case VIR_DOMAIN_EVENT_STOPPED:
>              if (detail == VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN)
> -                g_signal_emit_by_name(gdom, "vir-stopped::shutdown");
> +                g_signal_emit_by_name(gdom, "stopped::shutdown");
>              else if (detail == VIR_DOMAIN_EVENT_STOPPED_DESTROYED)
> -                g_signal_emit_by_name(gdom, "vir-stopped::destroyed");
> +                g_signal_emit_by_name(gdom, "stopped::destroyed");
>              else if (detail == VIR_DOMAIN_EVENT_STOPPED_CRASHED)
> -                g_signal_emit_by_name(gdom, "vir-stopped::crashed");
> +                g_signal_emit_by_name(gdom, "stopped::crashed");
>              else if (detail == VIR_DOMAIN_EVENT_STOPPED_MIGRATED)
> -                g_signal_emit_by_name(gdom, "vir-stopped::migrated");
> +                g_signal_emit_by_name(gdom, "stopped::migrated");
>              else if (detail == VIR_DOMAIN_EVENT_STOPPED_SAVED)
> -                g_signal_emit_by_name(gdom, "vir-stopped::saved");
> +                g_signal_emit_by_name(gdom, "stopped::saved");
>              else if (detail == VIR_DOMAIN_EVENT_STOPPED_FAILED)
> -                g_signal_emit_by_name(gdom, "vir-stopped::failed");
> +                g_signal_emit_by_name(gdom, "stopped::failed");
>              else if (detail == VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT)
> -                g_signal_emit_by_name(gdom, "vir-stopped::from-snapshot");
> +                g_signal_emit_by_name(gdom, "stopped::from-snapshot");
>              else
>                  g_warn_if_reached();
>              break;
> diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
> index 2a5c9fd..70d8d6d 100644
> --- a/libvirt-gobject/libvirt-gobject-domain.c
> +++ b/libvirt-gobject/libvirt-gobject-domain.c
> @@ -159,7 +159,7 @@ static void gvir_domain_class_init(GVirDomainClass *klass)
>                                                         G_PARAM_STATIC_NICK |
>                                                         G_PARAM_STATIC_BLURB));
>  
> -    signals[VIR_STARTED] = g_signal_new("vir-started",
> +    signals[VIR_STARTED] = g_signal_new("started",
>                                          G_OBJECT_CLASS_TYPE(object_class),
>                                          G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
>                                          G_SIGNAL_NO_HOOKS | G_SIGNAL_DETAILED,
> @@ -169,7 +169,7 @@ static void gvir_domain_class_init(GVirDomainClass *klass)
>                                          G_TYPE_NONE,
>                                          1, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
>  
> -    signals[VIR_SUSPENDED] = g_signal_new("vir-suspended",
> +    signals[VIR_SUSPENDED] = g_signal_new("suspended",
>                                          G_OBJECT_CLASS_TYPE(object_class),
>                                          G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
>                                          G_SIGNAL_NO_HOOKS | G_SIGNAL_DETAILED,
> @@ -179,7 +179,7 @@ static void gvir_domain_class_init(GVirDomainClass *klass)
>                                          G_TYPE_NONE,
>                                          1, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
>  
> -    signals[VIR_RESUMED] = g_signal_new("vir-resumed",
> +    signals[VIR_RESUMED] = g_signal_new("resumed",
>                                          G_OBJECT_CLASS_TYPE(object_class),
>                                          G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
>                                          G_SIGNAL_NO_HOOKS | G_SIGNAL_DETAILED,
> @@ -189,7 +189,7 @@ static void gvir_domain_class_init(GVirDomainClass *klass)
>                                          G_TYPE_NONE,
>                                          1, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
>  
> -    signals[VIR_STOPPED] = g_signal_new("vir-stopped",
> +    signals[VIR_STOPPED] = g_signal_new("stopped",
>                                          G_OBJECT_CLASS_TYPE(object_class),
>                                          G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE |
>                                          G_SIGNAL_NO_HOOKS | G_SIGNAL_DETAILED,
> @@ -199,7 +199,7 @@ static void gvir_domain_class_init(GVirDomainClass *klass)
>                                          G_TYPE_NONE,
>                                          1, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
>  
> -    signals[VIR_UPDATED] = g_signal_new("vir-updated",
> +    signals[VIR_UPDATED] = g_signal_new("updated",
>                                          G_OBJECT_CLASS_TYPE(object_class),
>                                          G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
>                                          G_STRUCT_OFFSET(GVirDomainClass, vir_domain_updated),
> diff --git a/libvirt-gobject/libvirt-gobject-manager.c b/libvirt-gobject/libvirt-gobject-manager.c
> index 36167be..ae3e4a1 100644
> --- a/libvirt-gobject/libvirt-gobject-manager.c
> +++ b/libvirt-gobject/libvirt-gobject-manager.c
> @@ -88,7 +88,7 @@ static void gvir_manager_class_init(GVirManagerClass *klass)
>  
>      object_class->finalize = gvir_manager_finalize;
>  
> -    g_signal_new("vir-connection-added",
> +    g_signal_new("connection-added",
>                   G_OBJECT_CLASS_TYPE(object_class),
>                   G_SIGNAL_RUN_FIRST,
>                   G_STRUCT_OFFSET(GVirManagerClass, vir_connection_added),
> @@ -97,7 +97,7 @@ static void gvir_manager_class_init(GVirManagerClass *klass)
>                   G_TYPE_NONE,
>                   1,
>                   GVIR_TYPE_CONNECTION);
> -    g_signal_new("vir-connection-removed",
> +    g_signal_new("connection-removed",
>                   G_OBJECT_CLASS_TYPE(object_class),
>                   G_SIGNAL_RUN_FIRST,
>                   G_STRUCT_OFFSET(GVirManagerClass, vir_connection_removed),
> @@ -145,7 +145,7 @@ void gvir_manager_add_connection(GVirManager *man,
>      /* Hold extra reference while emitting signal */
>      g_object_ref(conn);
>      g_mutex_unlock(priv->lock);
> -    g_signal_emit_by_name(man, "vir-connection-added", conn);
> +    g_signal_emit_by_name(man, "connection-added", conn);
>      g_object_unref(conn);
>  }
>  
> @@ -158,7 +158,7 @@ void gvir_manager_remove_connection(GVirManager *man,
>      priv->connections = g_list_remove(priv->connections, conn);
>      g_mutex_unlock(priv->lock);
>  
> -    g_signal_emit_by_name(man, "vir-connection-removed", conn);
> +    g_signal_emit_by_name(man, "connection-removed", conn);
>      g_object_unref(conn);
>  }

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]