comparison src/collect.c @ 1367:fe4da037be21

When g_new0() is used, drop redundant initializations to NULL, FALSE or 0, second pass.
author zas_
date Sun, 01 Mar 2009 23:14:19 +0000
parents 79937bc55f3a
children 3a9fb1b52559
comparison
equal deleted inserted replaced
1366:ff3cd67235af 1367:fe4da037be21
321 CollectionData *cd; 321 CollectionData *cd;
322 static gint untitled_counter = 0; 322 static gint untitled_counter = 0;
323 323
324 cd = g_new0(CollectionData, 1); 324 cd = g_new0(CollectionData, 1);
325 325
326 collection_list = g_list_append(collection_list, cd);
327
328 cd->ref = 1; /* starts with a ref of 1 */ 326 cd->ref = 1; /* starts with a ref of 1 */
329
330 cd->list = NULL;
331 cd->sort_method = SORT_NONE; 327 cd->sort_method = SORT_NONE;
332 cd->thumb_loader = NULL;
333 cd->info_updated_func = NULL;
334
335 cd->window_read = FALSE;
336 cd->window_x = 0;
337 cd->window_y = 0;
338 cd->window_w = COLLECT_DEF_WIDTH; 328 cd->window_w = COLLECT_DEF_WIDTH;
339 cd->window_h = COLLECT_DEF_HEIGHT; 329 cd->window_h = COLLECT_DEF_HEIGHT;
340
341 cd->changed = FALSE;
342
343 cd->existence = g_hash_table_new(NULL, NULL); 330 cd->existence = g_hash_table_new(NULL, NULL);
344 331
345 if (path) 332 if (path)
346 { 333 {
347 cd->path = g_strdup(path); 334 cd->path = g_strdup(path);
348 cd->name = g_strdup(filename_from_path(cd->path)); 335 cd->name = g_strdup(filename_from_path(cd->path));
349 /* load it */ 336 /* load it */
350 } 337 }
351 else 338 else
352 { 339 {
353 cd->path = NULL;
354
355 if (untitled_counter == 0) 340 if (untitled_counter == 0)
356 { 341 {
357 cd->name = g_strdup(_("Untitled")); 342 cd->name = g_strdup(_("Untitled"));
358 } 343 }
359 else 344 else
364 untitled_counter++; 349 untitled_counter++;
365 } 350 }
366 351
367 file_data_register_notify_func(collection_notify_cb, cd, NOTIFY_PRIORITY_MEDIUM); 352 file_data_register_notify_func(collection_notify_cb, cd, NOTIFY_PRIORITY_MEDIUM);
368 353
354
355 collection_list = g_list_append(collection_list, cd);
356
369 return cd; 357 return cd;
370 } 358 }
371 359
372 void collection_free(CollectionData *cd) 360 void collection_free(CollectionData *cd)
373 { 361 {
1181 GtkWidget *extra_label; 1169 GtkWidget *extra_label;
1182 GdkGeometry geometry; 1170 GdkGeometry geometry;
1183 1171
1184 cw = g_new0(CollectWindow, 1); 1172 cw = g_new0(CollectWindow, 1);
1185 1173
1186 cw->close_dialog = NULL;
1187
1188 collection_window_list = g_list_append(collection_window_list, cw); 1174 collection_window_list = g_list_append(collection_window_list, cw);
1189 1175
1190 cw->cd = collection_new(path); 1176 cw->cd = collection_new(path);
1191 1177
1192 cw->window = window_new(GTK_WINDOW_TOPLEVEL, "collection", PIXBUF_INLINE_ICON_BOOK, NULL, NULL); 1178 cw->window = window_new(GTK_WINDOW_TOPLEVEL, "collection", PIXBUF_INLINE_ICON_BOOK, NULL, NULL);