View | Details | Raw Unified | Return to bug 145416
Collapse All | Expand All

(-)a/hald/device.c (+46 lines)
Lines 1146-1151 hal_device_property_set_double (HalDevic Link Here
1146
}
1146
}
1147
1147
1148
gboolean
1148
gboolean
1149
hal_device_property_set_strlist (HalDevice *device, const char *key,
1150
			 	 GSList *value)
1151
{
1152
	HalProperty *prop;
1153
	GSList *l;
1154
1155
	/* check if property already exists */
1156
	prop = hal_device_property_find (device, key);
1157
1158
	if (prop != NULL) {
1159
		if (hal_property_get_type (prop) != HAL_PROPERTY_TYPE_STRLIST)
1160
			return FALSE;
1161
1162
		/* don't bother setting the same value TODO: CHECK IF THIS WORK */
1163
		if (hal_property_get_strlist (prop) == value)
1164
			return TRUE;
1165
1166
		hal_property_strlist_clear (prop);
1167
		for (l = value ; l != NULL; l = l->next) {
1168
			hal_property_strlist_append (prop, l->data);
1169
		}
1170
1171
		g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1172
			       key, FALSE, FALSE);
1173
1174
	} else {
1175
		prop = hal_property_new (HAL_PROPERTY_TYPE_STRLIST);
1176
		for (l = value ; l != NULL; l = l->next) {
1177
			hal_property_strlist_append (prop, l->data);
1178
		}
1179
		g_hash_table_insert (device->private->props, g_strdup (key), prop);
1180
1181
		g_signal_emit (device, signals[PROPERTY_CHANGED], 0,
1182
			       key, FALSE, TRUE);
1183
	}
1184
1185
	return TRUE;
1186
}
1187
1188
1189
gboolean
1149
hal_device_copy_property (HalDevice *from_device, const char *from, HalDevice *to_device, const char *to)
1190
hal_device_copy_property (HalDevice *from_device, const char *from, HalDevice *to_device, const char *to)
1150
{
1191
{
1151
	gboolean rc;
1192
	gboolean rc;
Lines 1174-1179 hal_device_copy_property (HalDevice *fro Link Here
1174
			rc = hal_device_property_set_double (
1215
			rc = hal_device_property_set_double (
1175
				to_device, to, hal_device_property_get_double (from_device, from));
1216
				to_device, to, hal_device_property_get_double (from_device, from));
1176
			break;
1217
			break;
1218
		case HAL_PROPERTY_TYPE_STRLIST:
1219
			rc = hal_device_property_set_strlist(
1220
				to_device, to, hal_device_property_get_strlist (from_device, from));
1221
			break;
1222
		break;
1177
		}
1223
		}
1178
	}
1224
	}
1179
1225
(-)a/hald/device.h (+3 lines)
Lines 163-168 gboolean hal_device_property_set_bo Link Here
163
gboolean      hal_device_property_set_double (HalDevice    *device,
163
gboolean      hal_device_property_set_double (HalDevice    *device,
164
					      const char   *key,
164
					      const char   *key,
165
					      double        value);
165
					      double        value);
166
gboolean      hal_device_property_set_strlist (HalDevice *device, 
167
					       const char *key,
168
                                 	       GSList *value);
166
gboolean      hal_device_property_strlist_append (HalDevice    *device,
169
gboolean      hal_device_property_strlist_append (HalDevice    *device,
167
						  const char   *key,
170
						  const char   *key,
168
						  const char *value);
171
						  const char *value);
(-)a/doc/spec/hal-spec-fdi-files.xml (-1 / +3 lines)
Lines 166-172 Link Here
166
          <literal>strlist</literal> - For <literal>&#60;merge&#62;</literal> the value is
166
          <literal>strlist</literal> - For <literal>&#60;merge&#62;</literal> the value is
167
          copied to the property and the current property will be overwritten. For
167
          copied to the property and the current property will be overwritten. For
168
          <literal>&#60;append&#62;</literal> and <literal>&#60;prepend&#62;</literal> the
168
          <literal>&#60;append&#62;</literal> and <literal>&#60;prepend&#62;</literal> the
169
          value is append or prepend to the list as new item.
169
          value is append or prepend to the list as new item. Usage of 
170
	  <literal>&#60;copy_property&#62;</literal> overwrite the complete list with the 
171
	  value of the given property to copy from.
170
        </para>
172
        </para>
171
      </listitem>
173
      </listitem>
172
      <listitem>
174
      <listitem>

Return to bug 145416