Re: [PATCH] libnm-glib: added "connections-fetched" signal o NMRemoteSettings



On Wed, 2009-09-02 at 02:32 +0200, Witold Sowa wrote:
> A "connections-fetched" signal is emited when the last connection's
> settings are obtained or if there was no connections to fetch. The 
> signal will inform the user, that the connections list is filled up.

b20cef2e1beae61cb2335edb8cb0aa3932facd54

Committed, thanks; though I changed it a bit and made the signal a
member of the NMSettingsInterface interface since this is useful in both
local and remote objects that implement NMSettingsInterface.

Dan

> ---                                                                 
>  libnm-glib/nm-remote-settings.c |   26 ++++++++++++++++++++++----  
>  libnm-glib/nm-remote-settings.h |    6 ++++++                      
>  2 files changed, 28 insertions(+), 4 deletions(-)                  
> 
> diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c
> index 3d335fe..0e928fb 100644                                                 
> --- a/libnm-glib/nm-remote-settings.c                                         
> +++ b/libnm-glib/nm-remote-settings.c                                         
> @@ -122,6 +122,10 @@ connection_init_result_cb (NMRemoteConnection *remote,   
>         }                                                                     
>                                                                               
>         g_hash_table_remove (priv->pending, path);                            
> +                                                                             
> +       if (g_hash_table_size (priv->pending) == 0) {                         
> +               g_signal_emit_by_name (self, NM_REMOTE_SETTINGS_CONNECTIONS_FETCHED);
> +       }                                                                            
>  }                                                                                   
>                                                                                      
>  static void                                                                         
> @@ -169,11 +173,16 @@ fetch_connections_done (DBusGProxy *proxy,                     
>                 return;                                                              
>         }                                                                            
>                                                                                      
> -       for (i = 0; connections && (i < connections->len); i++) {                    
> -               char *path = g_ptr_array_index (connections, i);                     
> +       if (connections->len == 0) {                                                 
> +               g_signal_emit_by_name (self, NM_REMOTE_SETTINGS_CONNECTIONS_FETCHED);
> +       }                                                                            
> +       else {                                                                       
> +               for (i = 0; connections && (i < connections->len); i++) {            
> +                       char *path = g_ptr_array_index (connections, i);             
>                                                                                      
> -               new_connection_cb (proxy, path, user_data);                          
> -               g_free (path);                                                       
> +                       new_connection_cb (proxy, path, user_data);                  
> +                       g_free (path);                                               
> +               }                                                                    
>         }                                                                            
>         g_ptr_array_free (connections, TRUE);                                        
>  }                                                                                   
> @@ -484,5 +493,14 @@ nm_remote_settings_class_init (NMRemoteSettingsClass *class)    
>                                     NM_CONNECTION_SCOPE_USER,                        
>                                     NM_CONNECTION_SCOPE_USER,                        
>                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));    
> +                                                                                    
> +       /* Signals */                                                                
> +       g_signal_new (NM_REMOTE_SETTINGS_CONNECTIONS_FETCHED,                        
> +                                       G_OBJECT_CLASS_TYPE (object_class),          
> +                                       G_SIGNAL_RUN_FIRST,
> +                                       G_STRUCT_OFFSET (NMRemoteSettingsClass, connections_fetched),
> +                                       NULL, NULL,
> +                                       g_cclosure_marshal_VOID__VOID,
> +                                       G_TYPE_NONE, 0);
>  }
> 
> diff --git a/libnm-glib/nm-remote-settings.h b/libnm-glib/nm-remote-settings.h
> index f94aee4..05be199 100644
> --- a/libnm-glib/nm-remote-settings.h
> +++ b/libnm-glib/nm-remote-settings.h
> @@ -41,12 +41,18 @@ G_BEGIN_DECLS
>  #define NM_REMOTE_SETTINGS_BUS "bus"
>  #define NM_REMOTE_SETTINGS_SCOPE "scope"
> 
> +#define NM_REMOTE_SETTINGS_CONNECTIONS_FETCHED "connections-fetched"
> +
> +
>  typedef struct {
>         GObject parent;
>  } NMRemoteSettings;
> 
>  typedef struct {
>         GObjectClass parent;
> +
> +       /* Signals */
> +       void (*connections_fetched) (NMRemoteSettings *remote_settings);
>  } NMRemoteSettingsClass;
> 
>  GType nm_remote_settings_get_type (void);
> --
> 1.6.0.2
> _______________________________________________
> NetworkManager-list mailing list
> NetworkManager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list



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