~ubuntu-branches/ubuntu/precise/gnome-control-center/precise-updates

« back to all changes in this revision

Viewing changes to panels/color/cc-color-panel.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher, Jeremy Bicha, Ken VanDine
  • Date: 2012-02-15 23:16:31 UTC
  • mfrom: (1.1.56)
  • Revision ID: package-import@ubuntu.com-20120215231631-vk7me0mhofpsq0hp
Tags: 1:3.3.5-0ubuntu1
* Upload the new serie, that will bring in quite some fixes, we revert
  some problematic or risky changes as well
* The new version includes those fixes:
  - "Change Password in User Accounts panel focuses "New password" field, 
     skipping "Current password"" (lp: #821759)
  - The dialog to add online accounts should have a title 
    (lp: #822380)
  - "Remove Profile" button clickable in Color panel when 
     no profile selected (lp: #869603)
  - Move Removable Media into System Info (lp: #835880)
  - Sound preferences: mouse scrolling balance only works for right.
    (lp: #918017)
  - gnome-control-center SIGSEGV in actualize_printers_list() 
    (lp: #903009)
  - selecting preffered applications is not an info (lp: #890143)
  - Add a keyboard shortcut by default for take screenshot of a selection"
    (lp: #625518)
* debian/patches/revert_git_datetime_port.patch:
  - revert use of datetimed, we don't use systemd and ubuntu-system-service 
    doesn't support it yet
* debian/patches/revert_git_drop_library.patch:
  - consolidate "01_allow_external_panels.patch", don't drop the library
    we use it from other components on ubuntu, the patch will be improved
    later to not use a copy of files like it does in that version
* debian/patches/revert_git_stop_using_gconf.patch,
  debian/patches/revert_ua_gsettings.patch,
  debian/patches/revert_git_keyboard_gsettings.patch:
  - revert keyboard porting to gsettings, compiz still use gconf and we
    didn't update gnome-shell to the new serie (yet)

[ Jeremy Bicha ]
* New upstream release (Thanks Rico Tzchichholz!)
* debian/control.in:
  - Bump minimum dependency versions and add libwacom dependency
* debian/rules: Build without -Wl,-z,defs
* debian/watch: Watch for unstable releases
* Refreshed patches:
  - 01_allow_external_panels.patch
  - 04_add_theme_selection.patch
  - 50_ubuntu_systemwide_prefs.patch
  - 58_ubuntu_icon_views_redesign.patch
  - 59_install_gcm_components_on_demand.patch
  - 91_configure_cheese.patch
* Dropped upstream patches:
  - 00git_handle_media_dialog_close.patch
  - 03_show_wacom_under_unity.patch
  - 90_git_sound_tab_order.patch
  - 91_git_build_use_fontconfig.patch
  - 92_git_minimal_output_height.patch
  - 93_change_window_role_on_panel_change.patch
  - 94_git_adding_shortcuts.patch
  - 95_git_ctrlw_shortcut.patch
  - git_extra_keywords.patch

[ Ken VanDine ]
* debian/patches/96_sound_nua_panel.patch
  - refreshed with latest changes from ronoc

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
                                GcmPrefsEntryType entry_type,
92
92
                                GtkTreeIter *iter)
93
93
{
 
94
  const gchar *id;
94
95
  GtkTreeModel *model;
95
96
  GtkTreeIter iter_tmp;
96
 
  const gchar *description;
 
97
  GString *string;
97
98
 
98
99
  /* iter is optional */
99
100
  if (iter == NULL)
103
104
  if (entry_type == GCM_PREFS_ENTRY_TYPE_IMPORT)
104
105
    {
105
106
      /* TRANSLATORS: this is where the user can click and import a profile */
106
 
      description = _("Other profile…");
 
107
      string = g_string_new (_("Other profile…"));
107
108
    }
108
109
  else
109
110
    {
110
 
      description = cd_profile_get_title (profile);
 
111
      string = g_string_new (cd_profile_get_title (profile));
 
112
 
 
113
      /* any source prefix? */
 
114
      id = cd_profile_get_metadata_item (profile,
 
115
                                         CD_PROFILE_METADATA_DATA_SOURCE);
 
116
      if (g_strcmp0 (id, CD_PROFILE_METADATA_DATA_SOURCE_EDID) == 0)
 
117
        {
 
118
          /* TRANSLATORS: this is a profile prefix to signify the
 
119
           * profile has been auto-generated for this hardware */
 
120
          g_string_prepend (string, _("Default: "));
 
121
        }
 
122
#if CD_CHECK_VERSION(0,1,14)
 
123
      if (g_strcmp0 (id, CD_PROFILE_METADATA_DATA_SOURCE_STANDARD) == 0)
 
124
        {
 
125
          /* TRANSLATORS: this is a profile prefix to signify the
 
126
           * profile his a standard space like AdobeRGB */
 
127
          g_string_prepend (string, _("Colorspace: "));
 
128
        }
 
129
      if (g_strcmp0 (id, CD_PROFILE_METADATA_DATA_SOURCE_TEST) == 0)
 
130
        {
 
131
          /* TRANSLATORS: this is a profile prefix to signify the
 
132
           * profile is a test profile */
 
133
          g_string_prepend (string, _("Test profile: "));
 
134
        }
 
135
#endif
111
136
    }
112
137
 
113
138
  /* also add profile */
114
139
  model = gtk_combo_box_get_model (GTK_COMBO_BOX(widget));
115
140
  gtk_list_store_append (GTK_LIST_STORE(model), iter);
116
141
  gtk_list_store_set (GTK_LIST_STORE(model), iter,
117
 
                      GCM_PREFS_COMBO_COLUMN_TEXT, description,
 
142
                      GCM_PREFS_COMBO_COLUMN_TEXT, string->str,
118
143
                      GCM_PREFS_COMBO_COLUMN_PROFILE, profile,
119
144
                      GCM_PREFS_COMBO_COLUMN_TYPE, entry_type,
120
145
                      -1);
 
146
  g_string_free (string, TRUE);
121
147
}
122
148
 
123
149
static void
408
434
gcm_prefs_is_profile_suitable_for_device (CdProfile *profile,
409
435
                                          CdDevice *device)
410
436
{
 
437
#if CD_CHECK_VERSION(0,1,14)
 
438
  const gchar *data_source;
 
439
#endif
411
440
  CdProfileKind profile_kind_tmp;
412
441
  CdProfileKind profile_kind;
413
442
  CdColorspace profile_colorspace;
428
457
  if (profile_kind_tmp != profile_kind)
429
458
    goto out;
430
459
 
 
460
#if CD_CHECK_VERSION(0,1,14)
 
461
  /* ignore the colorspace profiles */
 
462
  data_source = cd_profile_get_metadata_item (profile,
 
463
                                              CD_PROFILE_METADATA_DATA_SOURCE);
 
464
  if (g_strcmp0 (data_source, CD_PROFILE_METADATA_DATA_SOURCE_STANDARD) == 0)
 
465
    goto out;
 
466
#endif
 
467
 
431
468
  /* success */
432
469
  ret = TRUE;
433
470
out:
565
602
static void
566
603
gcm_prefs_profile_add_cb (GtkWidget *widget, CcColorPanel *prefs)
567
604
{
 
605
  const gchar *title;
568
606
  CdProfile *profile = NULL;
569
607
  CcColorPanelPrivate *priv = prefs->priv;
570
608
 
574
612
  profile = cd_device_get_default_profile (priv->current_device);
575
613
  gcm_prefs_add_profiles_suitable_for_devices (prefs, widget, profile);
576
614
 
 
615
  /* set the title */
 
616
  widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
 
617
                                               "label_assign_title"));
 
618
  switch (cd_device_get_kind (priv->current_device)) {
 
619
    case CD_DEVICE_KIND_DISPLAY:
 
620
      /* TRANSLATORS: this is the dialog title in the 'Add profile' UI */
 
621
      title = _("Available Profiles for Displays");
 
622
      break;
 
623
    case CD_DEVICE_KIND_SCANNER:
 
624
      /* TRANSLATORS: this is the dialog title in the 'Add profile' UI */
 
625
      title = _("Available Profiles for Scanners");
 
626
      break;
 
627
    case CD_DEVICE_KIND_PRINTER:
 
628
      /* TRANSLATORS: this is the dialog title in the 'Add profile' UI */
 
629
      title = _("Available Profiles for Printers");
 
630
      break;
 
631
    case CD_DEVICE_KIND_CAMERA:
 
632
      /* TRANSLATORS: this is the dialog title in the 'Add profile' UI */
 
633
      title = _("Available Profiles for Cameras");
 
634
      break;
 
635
    case CD_DEVICE_KIND_WEBCAM:
 
636
      /* TRANSLATORS: this is the dialog title in the 'Add profile' UI */
 
637
      title = _("Available Profiles for Webcams");
 
638
      break;
 
639
    default:
 
640
      /* TRANSLATORS: this is the dialog title in the 'Add profile' UI
 
641
       * where the device type is not recognised */
 
642
      title = _("Available Profiles");
 
643
      break;
 
644
  }
 
645
  gtk_label_set_label (GTK_LABEL (widget), title);
 
646
 
577
647
  /* show the dialog */
578
648
  widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
579
649
                                               "dialog_assign"));
700
770
 
701
771
  gcm_prefs_run_maybe_install (xid, viewer_filename, argv);
702
772
 
703
 
  if (argv != NULL)
704
 
    g_ptr_array_unref (argv);
 
773
  g_ptr_array_unref (argv);
705
774
  g_free (options);
706
775
  if (profile != NULL)
707
776
    g_object_unref (profile);
1194
1263
  g_object_set (renderer,
1195
1264
                "ellipsize", PANGO_ELLIPSIZE_END,
1196
1265
                "wrap-mode", PANGO_WRAP_WORD_CHAR,
1197
 
                "width-chars", 60,
1198
1266
                NULL);
1199
1267
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
1200
1268
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
1335
1403
static const gchar *
1336
1404
gcm_prefs_device_kind_to_icon_name (CdDeviceKind kind)
1337
1405
{
1338
 
  if (kind == CD_DEVICE_KIND_DISPLAY)
 
1406
  switch (kind) {
 
1407
  case CD_DEVICE_KIND_DISPLAY:
1339
1408
    return "video-display";
1340
 
  if (kind == CD_DEVICE_KIND_SCANNER)
 
1409
  case CD_DEVICE_KIND_SCANNER:
1341
1410
    return "scanner";
1342
 
  if (kind == CD_DEVICE_KIND_PRINTER)
 
1411
  case CD_DEVICE_KIND_PRINTER:
1343
1412
    return "printer";
1344
 
  if (kind == CD_DEVICE_KIND_CAMERA)
1345
 
    return "camera-photo";
1346
 
  if (kind == CD_DEVICE_KIND_CAMERA)
1347
 
    return "camera-photo";
1348
 
  if (kind == CD_DEVICE_KIND_WEBCAM)
 
1413
  case CD_DEVICE_KIND_CAMERA:
 
1414
    return "camera-photo";
 
1415
  case CD_DEVICE_KIND_WEBCAM:
1349
1416
    return "camera-web";
1350
 
  return "image-missing";
1351
 
}
1352
 
 
1353
 
static gboolean
1354
 
gcm_prefs_profile_is_based_from_edid (CdProfile *profile)
1355
 
{
1356
 
  if (cd_profile_get_kind (profile) != CD_PROFILE_KIND_DISPLAY_DEVICE)
1357
 
    return FALSE;
1358
 
  if (cd_profile_get_metadata_item (profile, "EDID_md5") == NULL)
1359
 
    return FALSE;
1360
 
  return TRUE;
 
1417
  default:
 
1418
    return "image-missing";
 
1419
  }
1361
1420
}
1362
1421
 
1363
1422
static GString *
1364
1423
gcm_prefs_get_profile_age_as_string (CdProfile *profile)
1365
1424
{
 
1425
  const gchar *id;
1366
1426
  gint64 age;
1367
 
  GString *string;
 
1427
  GString *string = NULL;
1368
1428
 
1369
1429
  if (profile == NULL)
1370
1430
    {
1373
1433
      goto out;
1374
1434
    }
1375
1435
 
 
1436
  /* don't show details for EDID, colorspace or test profiles */
 
1437
  id = cd_profile_get_metadata_item (profile,
 
1438
                                     CD_PROFILE_METADATA_DATA_SOURCE);
 
1439
  if (g_strcmp0 (id, CD_PROFILE_METADATA_DATA_SOURCE_EDID) == 0)
 
1440
    goto out;
 
1441
#if CD_CHECK_VERSION(0,1,14)
 
1442
  if (g_strcmp0 (id, CD_PROFILE_METADATA_DATA_SOURCE_STANDARD) == 0)
 
1443
    goto out;
 
1444
  if (g_strcmp0 (id, CD_PROFILE_METADATA_DATA_SOURCE_TEST) == 0)
 
1445
    goto out;
 
1446
#endif
 
1447
 
1376
1448
  /* days */
1377
1449
  age = cd_profile_get_age (profile);
1378
1450
  if (age == 0)
1659
1731
 
1660
1732
  /* yay! */
1661
1733
  status = gcm_prefs_get_profile_age_as_string (profile);
 
1734
  if (status == NULL)
 
1735
    {
 
1736
      status = g_string_new (_("Uncalibrated"));
 
1737
      g_string_prepend (status, "<span foreground='gray'><i>");
 
1738
      g_string_append (status, "</i></span>");
 
1739
    }
1662
1740
 
1663
1741
  /* greater than the calibration threshold for the device type */
1664
1742
  age = cd_profile_get_age (profile);
1702
1780
      profile_tmp = g_ptr_array_index (profiles, i);
1703
1781
      title_tmp = gcm_prefs_get_profile_title (prefs, profile_tmp);
1704
1782
 
1705
 
      /* don't show details for EDID profiles */
1706
 
      if (gcm_prefs_profile_is_based_from_edid (profile_tmp))
 
1783
      /* get profile age */
 
1784
      date_tmp = gcm_prefs_get_profile_age_as_string (profile_tmp);
 
1785
      if (date_tmp == NULL)
1707
1786
        {
1708
1787
          /* TRANSLATORS: this is when the calibration profile age is not
1709
1788
           * specified as it has been autogenerated from the hardware */
1711
1790
          g_string_prepend (date_tmp, "<span foreground='gray'><i>");
1712
1791
          g_string_append (date_tmp, "</i></span>");
1713
1792
        }
1714
 
      else
1715
 
        {
1716
 
          date_tmp = gcm_prefs_get_profile_age_as_string (profile_tmp);
1717
 
        }
1718
1793
      sort_tmp = gcm_prefs_get_profile_created_for_sort (profile_tmp);
1719
1794
 
1720
1795
      /* get an existing profile, or create a new one */