static void delete_property (GsmXSMPClient *client, const char *name) { int index; SmProp *prop; prop = find_property (client, name, &index); if (!prop) { return; } #if 0 /* This is wrong anyway; we can't unconditionally run the current * discard command; if this client corresponds to a GsmAppResumed, * and the current discard command is identical to the app's * discard_command, then we don't run the discard command now, * because that would delete a saved state we may want to resume * again later. */ if (!strcmp (name, SmDiscardCommand)) { gsm_client_run_discard (GSM_CLIENT (client)); } #endif g_ptr_array_remove_index_fast (client->priv->props, index); SmFreeProperty (prop); }
void KSMDeletePropertiesProc ( SmsConn /* smsConn */, SmPointer managerData, int numProps, char ** propNames ) { KSMClient* client = ( KSMClient* ) managerData; for ( int i = 0; i < numProps; i++ ) { SmProp *p = client->property( propNames[i] ); if ( p ) { client->properties.removeAll( p ); SmFreeProperty( p ); } } }
static void sm_set_properties (SmsConn sms_conn, SmPointer client_data, int num_props, SmProp **props) { XfsmClient *client = (XfsmClient *) client_data; int n; int i; if (G_UNLIKELY (verbose)) { xfsm_verbose ("Client Id = %s, received SET PROPERTIES [Num props = %d]\n", xfsm_client_get_id (client), num_props); for (n = 0; n < num_props; ++n) { xfsm_verbose (" Name: %s\n", props[n]->name); xfsm_verbose (" Type: %s\n", props[n]->type); if (strcmp (props[n]->type, "ARRAY8") == 0) { xfsm_verbose (" Value: %s\n", (const gchar *) props[n]->vals->value); } else if (strcmp (props[n]->type, "CARD8") == 0) { const guint8 *cardptr = (const guint8 *) props[n]->vals->value; xfsm_verbose (" Value: %u\n", (unsigned) *cardptr); } else if (strcmp (props[n]->type, "LISTofARRAY8") == 0) { xfsm_verbose (" Value:\n"); for (i = 0; i < props[n]->num_vals; ++i) { xfsm_verbose (" %s%s\n", (const gchar *) props[n]->vals[i].value, (i == props[n]->num_vals - 1) ? "" : ","); } } xfsm_verbose ("\n"); } xfsm_verbose ("\n"); } xfsm_client_merge_properties (client, props, num_props); while (num_props-- > 0) SmFreeProperty (props[num_props]); free (props); }
static void sm_get_properties (SmsConn sms_conn, SmPointer client_data) { XfsmClient *client = (XfsmClient *) client_data; XfsmProperties *properties = client->properties; SmProp **props = NULL; gint num_props = 0; xfsm_verbose ("Client Id = %s, received GET PROPERTIES\n\n", properties->client_id); xfsm_properties_extract (client->properties, &num_props, &props); SmsReturnProperties (sms_conn, num_props, props); if (num_props > 0) { while (num_props-- > 0) SmFreeProperty (props[num_props]); free (props); } }
void KSMSetPropertiesProc ( SmsConn /* smsConn */, SmPointer managerData, int numProps, SmProp ** props ) { KSMClient* client = ( KSMClient* ) managerData; for ( int i = 0; i < numProps; i++ ) { SmProp *p = client->property( props[i]->name ); if ( p ) { client->properties.removeAll( p ); SmFreeProperty( p ); } client->properties.append( props[i] ); if ( !qstrcmp( props[i]->name, SmProgram ) ) the_server->clientSetProgram( client ); } if ( numProps ) free( props ); }
KSMClient::~KSMClient() { for ( SmProp* prop = properties.first(); prop; prop = properties.next() ) SmFreeProperty( prop ); if (id) free((void*)id); }
KSMClient::~KSMClient() { foreach( SmProp *prop, properties ) SmFreeProperty( prop ); if (id) free((void*)id); }