~ubuntu-branches/debian/squeeze/glib2.0/squeeze

« back to all changes in this revision

Viewing changes to glib/gwin32.c

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-02-15 13:00:43 UTC
  • mfrom: (1.3.1 upstream) (69.1.10 intrepid)
  • Revision ID: james.westby@ubuntu.com-20090215130043-q47fbt3owmt42m2f
Tags: 2.18.4-2
* Release to unstable
* debian/rules:
- bump SHVER, since we are already forcing a 2.18.0 dependecy on the
  symbols introduced in the development versions
* debian/control.in:
- added Homepage and Vcs-* control fields

Show diffs side-by-side

added added

removed removed

Lines of Context:
299
299
      g_free (wc_module_name);
300
300
 
301
301
      if (!hmodule)
302
 
        return NULL;
 
302
        {
 
303
          G_UNLOCK (module_dirs);
 
304
          return NULL;
 
305
        }
303
306
    }
304
307
 
305
308
  fn = g_win32_get_package_installation_directory_of_module (hmodule);
306
309
 
307
310
  if (fn == NULL)
308
 
    return NULL;
 
311
    {
 
312
      G_UNLOCK (module_dirs);
 
313
      return NULL;
 
314
    }
309
315
  
310
316
  g_hash_table_insert (module_dirs, module_name ? g_strdup (module_name) : "", fn);
311
317
 
321
327
 *
322
328
 * Try to determine the installation directory for a software package.
323
329
 *
324
 
 * This function will be deprecated in the future. Use
 
330
 * This function is deprecated. Use
325
331
 * g_win32_get_package_installation_directory_of_module() instead.
326
332
 *
327
 
 * The use of @package is deprecated. You should always pass %NULL.
 
333
 * The use of @package is deprecated. You should always pass %NULL. A
 
334
 * warning is printed if non-NULL is passed as @package.
328
335
 *
329
336
 * The original intended use of @package was for a short identifier of
330
337
 * the package, typically the same identifier as used for
343
350
 *
344
351
 * For this reason it is recommeded to always pass %NULL as
345
352
 * @package to this function, to avoid the temptation to use the
346
 
 * Registry. In version 2.18 of GLib the @package parameter
 
353
 * Registry. In version 2.20 of GLib the @package parameter
347
354
 * will be ignored and this function won't look in the Registry at all.
348
355
 *
349
356
 * If @package is %NULL, or the above value isn't found in the
364
371
 * @package. The string is in the GLib file name encoding,
365
372
 * i.e. UTF-8. The return value should be freed with g_free() when not
366
373
 * needed any longer. If the function fails %NULL is returned.
 
374
 *
 
375
 * @Deprecated:2.18: Pass the HMODULE of a DLL or EXE to
 
376
 * g_win32_get_package_installation_directory_of_module() instead.
367
377
 **/
368
378
 
369
 
gchar *
370
 
g_win32_get_package_installation_directory (const gchar *package,
371
 
                                            const gchar *dll_name)
 
379
 gchar *
 
380
g_win32_get_package_installation_directory_utf8 (const gchar *package,
 
381
                                                 const gchar *dll_name)
372
382
{
373
383
  static GHashTable *package_dirs = NULL;
374
384
  G_LOCK_DEFINE_STATIC (package_dirs);
379
389
  DWORD type;
380
390
  DWORD nbytes;
381
391
 
 
392
#if GLIB_CHECK_VERSION (2, 19, 0)
 
393
  if (package != NULL)
 
394
      g_warning ("Passing a non-NULL package to g_win32_get_package_installation_directory() is deprecated and it is ignored.");
 
395
#else
382
396
  if (package != NULL)
383
397
    {
 
398
      g_warning ("Passing a non-NULL package to g_win32_get_package_installation_directory() is deprecated and will not work in GLib after 2.18.");
 
399
 
384
400
      G_LOCK (package_dirs);
385
401
      
386
402
      if (package_dirs == NULL)
432
448
        }
433
449
      G_UNLOCK (package_dirs);
434
450
    }
435
 
 
 
451
#endif
436
452
  if (dll_name != NULL)
437
453
    result = get_package_directory_from_module (dll_name);
438
454
 
442
458
  return result;
443
459
}
444
460
 
445
 
#undef g_win32_get_package_installation_directory
 
461
#if !defined (_WIN64)
446
462
 
447
463
/* DLL ABI binary compatibility version that uses system codepage file names */
448
464
 
472
488
  return retval;
473
489
}
474
490
 
 
491
#endif
 
492
 
475
493
/**
476
494
 * g_win32_get_package_installation_subdirectory:
477
495
 * @package: You should pass %NULL for this.
478
496
 * @dll_name: The name of a DLL that a package provides, in UTF-8, or %NULL.
479
497
 * @subdir: A subdirectory of the package installation directory, also in UTF-8
480
498
 *
481
 
 * This function will be deprecated in the future. Use
482
 
 * g_win32_get_package_installation_directory_of_module() instead.
 
499
 * This function is deprecated. Use
 
500
 * g_win32_get_package_installation_directory_of_module() and
 
501
 * g_build_filename() instead.
483
502
 *
484
503
 * Returns a newly-allocated string containing the path of the
485
504
 * subdirectory @subdir in the return value from calling
494
513
 * the GLib file name encoding, i.e. UTF-8. The return value should be
495
514
 * freed with g_free() when no longer needed. If something goes wrong,
496
515
 * %NULL is returned.
 
516
 *
 
517
 * @Deprecated:2.18: Pass the HMODULE of a DLL or EXE to
 
518
 * g_win32_get_package_installation_directory_of_module() instead, and
 
519
 * then construct a subdirectory pathname with g_build_filename().
497
520
 **/
498
521
 
499
522
gchar *
500
 
g_win32_get_package_installation_subdirectory (const gchar *package,
501
 
                                               const gchar *dll_name,
502
 
                                               const gchar *subdir)
 
523
g_win32_get_package_installation_subdirectory_utf8 (const gchar *package,
 
524
                                                    const gchar *dll_name,
 
525
                                                    const gchar *subdir)
503
526
{
504
527
  gchar *prefix;
505
528
  gchar *dirname;
512
535
  return dirname;
513
536
}
514
537
 
515
 
#undef g_win32_get_package_installation_subdirectory
 
538
#if !defined (_WIN64)
516
539
 
517
540
/* DLL ABI binary compatibility version that uses system codepage file names */
518
541
 
532
555
  return dirname;
533
556
}
534
557
 
 
558
#endif
 
559
 
535
560
static guint windows_version;
536
561
 
537
562
static void