~ubuntu-branches/ubuntu/oneiric/evince/oneiric-updates

« back to all changes in this revision

Viewing changes to cut-n-paste/smclient/eggdesktopfile.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2011-04-14 16:20:57 UTC
  • mfrom: (1.6.4 upstream)
  • mto: (1.3.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 138.
  • Revision ID: james.westby@ubuntu.com-20110414162057-0ofhbd139zs6ev6y
ImportĀ upstreamĀ versionĀ 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *
18
18
 * You should have received a copy of the GNU Lesser General Public
19
19
 * License along with this library; see the file COPYING.LIB. If not,
20
 
 * write to the Free Software Foundation, Inc., 59 Temple Place -
21
 
 * Suite 330, Boston, MA 02111-1307, USA.
 
20
 * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
 
21
 * Boston, MA 02110-1301, USA.
22
22
 */
23
23
 
24
24
#ifdef HAVE_CONFIG_H
431
431
                                error);
432
432
}
433
433
 
 
434
int
 
435
egg_desktop_file_get_integer (EggDesktopFile *desktop_file,
 
436
                              const char     *key,
 
437
                              GError        **error)
 
438
{
 
439
  return g_key_file_get_integer (desktop_file->key_file,
 
440
                                 EGG_DESKTOP_FILE_GROUP, key,
 
441
                                 error);
 
442
}
 
443
 
434
444
char **
435
445
egg_desktop_file_get_string_list (EggDesktopFile  *desktop_file,
436
446
                                  const char      *key,
1274
1284
 out:
1275
1285
  if (env)
1276
1286
    {
1277
 
      g_strfreev ((char **)env->pdata);
1278
 
      g_ptr_array_free (env, FALSE);
 
1287
      g_ptr_array_foreach (env, (GFunc)g_free, NULL);
 
1288
      g_ptr_array_free (env, TRUE);
1279
1289
    }
1280
1290
  free_document_list (translated_documents);
1281
1291
 
1386
1396
      free_document_list (documents);
1387
1397
      break;
1388
1398
 
 
1399
    case EGG_DESKTOP_FILE_TYPE_UNRECOGNIZED:
 
1400
    case EGG_DESKTOP_FILE_TYPE_DIRECTORY:
1389
1401
    default:
1390
1402
      g_set_error (error, EGG_DESKTOP_FILE_ERROR,
1391
1403
                   EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
1408
1420
G_LOCK_DEFINE_STATIC (egg_desktop_file);
1409
1421
static EggDesktopFile *egg_desktop_file;
1410
1422
 
1411
 
/**
1412
 
 * egg_set_desktop_file:
1413
 
 * @desktop_file_path: path to the application's desktop file
1414
 
 *
1415
 
 * Creates an #EggDesktopFile for the application from the data at
1416
 
 * @desktop_file_path. This will also call g_set_application_name()
1417
 
 * with the localized application name from the desktop file, and
1418
 
 * gtk_window_set_default_icon_name() or
1419
 
 * gtk_window_set_default_icon_from_file() with the application's
1420
 
 * icon. Other code may use additional information from the desktop
1421
 
 * file.
1422
 
 *
1423
 
 * Note that for thread safety reasons, this function can only
1424
 
 * be called once.
1425
 
 **/
1426
 
void
1427
 
egg_set_desktop_file (const char *desktop_file_path)
 
1423
static void
 
1424
egg_set_desktop_file_internal (const char *desktop_file_path,
 
1425
                               gboolean set_defaults)
1428
1426
{
1429
1427
  GError *error = NULL;
1430
1428
 
1440
1438
      g_error_free (error);
1441
1439
    }
1442
1440
 
1443
 
  if (egg_desktop_file) {
 
1441
  if (set_defaults && egg_desktop_file != NULL) {
1444
1442
    /* Set localized application name and default window icon */
1445
1443
    if (egg_desktop_file->name)
1446
1444
      g_set_application_name (egg_desktop_file->name);
1457
1455
}
1458
1456
 
1459
1457
/**
 
1458
 * egg_set_desktop_file:
 
1459
 * @desktop_file_path: path to the application's desktop file
 
1460
 *
 
1461
 * Creates an #EggDesktopFile for the application from the data at
 
1462
 * @desktop_file_path. This will also call g_set_application_name()
 
1463
 * with the localized application name from the desktop file, and
 
1464
 * gtk_window_set_default_icon_name() or
 
1465
 * gtk_window_set_default_icon_from_file() with the application's
 
1466
 * icon. Other code may use additional information from the desktop
 
1467
 * file.
 
1468
 * See egg_set_desktop_file_without_defaults() for a variant of this
 
1469
 * function that does not set the application name and default window
 
1470
 * icon.
 
1471
 *
 
1472
 * Note that for thread safety reasons, this function can only
 
1473
 * be called once, and is mutually exclusive with calling
 
1474
 * egg_set_desktop_file_without_defaults().
 
1475
 **/
 
1476
void
 
1477
egg_set_desktop_file (const char *desktop_file_path)
 
1478
{
 
1479
  egg_set_desktop_file_internal (desktop_file_path, TRUE);
 
1480
}
 
1481
 
 
1482
/**
 
1483
 * egg_set_desktop_file_without_defaults:
 
1484
 * @desktop_file_path: path to the application's desktop file
 
1485
 *
 
1486
 * Creates an #EggDesktopFile for the application from the data at
 
1487
 * @desktop_file_path.
 
1488
 * See egg_set_desktop_file() for a variant of this function that
 
1489
 * sets the application name and default window icon from the information
 
1490
 * in the desktop file.
 
1491
 *
 
1492
 * Note that for thread safety reasons, this function can only
 
1493
 * be called once, and is mutually exclusive with calling
 
1494
 * egg_set_desktop_file().
 
1495
 **/
 
1496
void
 
1497
egg_set_desktop_file_without_defaults (const char *desktop_file_path)
 
1498
{
 
1499
  egg_set_desktop_file_internal (desktop_file_path, FALSE);
 
1500
}
 
1501
 
 
1502
/**
1460
1503
 * egg_get_desktop_file:
1461
1504
 * 
1462
1505
 * Gets the application's #EggDesktopFile, as set by