~ubuntu-branches/ubuntu/quantal/colord/quantal-proposed

« back to all changes in this revision

Viewing changes to src/cd-profile.c

  • Committer: Package Import Robot
  • Author(s): Sjoerd Simons
  • Date: 2011-10-25 16:21:20 UTC
  • mto: (2.1.1 sid) (1.1.2)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: package-import@ubuntu.com-20111025162120-0aypjqn1zx9n6vgf
Tags: upstream-0.1.13
ImportĀ upstreamĀ versionĀ 0.1.13

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
        gboolean                         has_vcgt;
59
59
        gboolean                         is_system_wide;
60
60
        gint64                           created;
 
61
        guint                            owner;
61
62
};
62
63
 
63
64
enum {
99
100
}
100
101
 
101
102
/**
 
103
 * cd_profile_set_owner:
 
104
 **/
 
105
void
 
106
cd_profile_set_owner (CdProfile *profile, guint owner)
 
107
{
 
108
        g_return_if_fail (CD_IS_PROFILE (profile));
 
109
        profile->priv->owner = owner;
 
110
}
 
111
 
 
112
/**
102
113
 * cd_profile_set_is_system_wide:
103
114
 **/
104
115
void
427
438
 
428
439
                /* require auth */
429
440
                ret = cd_main_sender_authenticated (invocation,
430
 
                                                    sender,
431
441
                                                    "org.freedesktop.color-manager.modify-profile");
432
442
                if (!ret)
433
443
                        goto out;
461
471
                g_debug ("CdProfile %s:InstallSystemWide() on %s",
462
472
                         sender, profile->priv->object_path);
463
473
                ret = cd_main_sender_authenticated (invocation,
464
 
                                                    sender,
465
474
                                                    "org.freedesktop.color-manager.install-system-wide");
466
475
                if (!ret)
467
476
                        goto out;
548
557
                retval = g_variant_new_string (cd_object_scope_to_string (profile->priv->object_scope));
549
558
                goto out;
550
559
        }
 
560
        if (g_strcmp0 (property_name, CD_PROFILE_PROPERTY_OWNER) == 0) {
 
561
                retval = g_variant_new_uint32 (profile->priv->owner);
 
562
                goto out;
 
563
        }
551
564
 
552
565
        g_critical ("failed to set property %s", property_name);
553
566
out:
670
683
        /* does profile have metadata? */
671
684
        dict = cmsReadTag (lcms_profile, cmsSigMetaTag);
672
685
        if (dict == NULL) {
673
 
                g_debug ("%s (%s) has no DICT tag", priv->id, priv->filename);
 
686
                g_debug ("%s (%s) has no DICT tag",
 
687
                         priv->id ? priv->id : "new profile",
 
688
                         priv->filename);
674
689
                return;
675
690
        }
676
691
 
913
928
                }
914
929
        }
915
930
 
 
931
        /* check we're not already set using the fd */
 
932
        if (priv->kind != CD_PROFILE_KIND_UNKNOWN) {
 
933
                ret = TRUE;
 
934
                g_debug ("profile '%s' already set",
 
935
                         priv->object_path);
 
936
                goto out;
 
937
        } else if (!priv->is_system_wide) {
 
938
#ifndef HAVE_FD_FALLBACK
 
939
                /* we're not allowing the dameon to open the file */
 
940
                ret = FALSE;
 
941
                g_set_error (error,
 
942
                             CD_MAIN_ERROR,
 
943
                             CD_MAIN_ERROR_FAILED,
 
944
                             "Failed to open %s as client did not send FD and "
 
945
                             "daemon is not compiled with --enable-fd-fallback",
 
946
                             filename);
 
947
                goto out;
 
948
#endif
 
949
        }
 
950
 
 
951
        /* parse the ICC file */
 
952
        lcms_profile = cmsOpenProfileFromFile (filename, "r");
 
953
        if (lcms_profile == NULL) {
 
954
                g_set_error (error,
 
955
                             CD_MAIN_ERROR,
 
956
                             CD_MAIN_ERROR_FAILED,
 
957
                             "failed to parse %s",
 
958
                             filename);
 
959
                goto out;
 
960
        }
 
961
 
 
962
        /* set the virtual profile from the lcms profile */
 
963
        ret = cd_profile_set_from_profile (profile, lcms_profile, error);
 
964
        if (!ret)
 
965
                goto out;
 
966
 
916
967
        /* try the metadata if available */
917
968
        if (priv->checksum == NULL) {
918
969
                tmp = g_hash_table_lookup (profile->priv->metadata,
938
989
                                                              len);
939
990
        }
940
991
 
941
 
        /* check we're not already set using the fd */
942
 
        if (priv->kind != CD_PROFILE_KIND_UNKNOWN) {
943
 
                ret = TRUE;
944
 
                g_debug ("profile '%s' already set",
945
 
                         priv->object_path);
946
 
                goto out;
947
 
        }
948
 
 
949
 
        /* parse the ICC file */
950
 
        lcms_profile = cmsOpenProfileFromFile (filename, "r");
951
 
        if (lcms_profile == NULL) {
952
 
                g_set_error (error,
953
 
                             CD_MAIN_ERROR,
954
 
                             CD_MAIN_ERROR_FAILED,
955
 
                             "failed to parse %s",
956
 
                             filename);
957
 
                goto out;
958
 
        }
959
 
 
960
 
        /* set the virtual profile from the lcms profile */
961
 
        ret = cd_profile_set_from_profile (profile, lcms_profile, error);
962
 
        if (!ret)
963
 
                goto out;
964
 
 
965
992
        /* emit all the things that could have changed */
966
993
        cd_profile_emit_parsed_property_changed (profile);
967
994
out: