Bug#771508: unblock: gnome-control-center/1:3.14.2-1
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
Hi,
please unblock gnome-control-center for the following changes:
gnome-control-center (1:3.14.2-1) unstable; urgency=medium
* New upstream translation and bugfix release.
+ Disables SSLv3 because POODLE.
* 30_stack_overflow.patch: patch from upstream git. Prevents stack
overflow in sharing panel.
* 31_printers_border.patch: patch from upstream git. Removes unwanted
border around printer model name.
Attaching non-translation upstream changes between 3.14.1 and 3.14.2, as
well as Debian changes.
Note that the upstream diff is huge because of a file rename that is
required to fix a crash, but the actual changes are smaller.
unblock gnome-control-center/1:3.14.2-1
Thanks,
--
.''`. Josselin Mouette
: :' :
`. `'
`-
Index: debian/patches/series
===================================================================
--- debian/patches/series (révision 43900)
+++ debian/patches/series (copie de travail)
@@ -1,3 +1,5 @@
01_menu_category.patch
06_handle_passwd_with_ldap.patch
07_polkit_wheel_sudo_group.patch
+30_stack_overflow.patch
+31_printers_border.patch
Index: debian/patches/30_stack_overflow.patch
===================================================================
--- debian/patches/30_stack_overflow.patch (révision 0)
+++ debian/patches/30_stack_overflow.patch (révision 43955)
@@ -0,0 +1,30 @@
+From f5be9cccd8e78970d25fa3559128e827f9924651 Mon Sep 17 00:00:00 2001
+From: Rui Matos <tiagomatos@gmail.com>
+Date: Mon, 10 Nov 2014 15:06:52 +0100
+Subject: sharing: Prevent an endless loop and resulting stack overflow
+
+We need to block ourselves around the gtk_switch_set_active() call in
+the error path, when we can't speak to the sharing dbus service, or we
+end up in an endless loop since we're the ::state-set handler.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=739886
+
+diff --git a/panels/sharing/cc-sharing-networks.c b/panels/sharing/cc-sharing-networks.c
+index 181ed99..10920de 100644
+--- a/panels/sharing/cc-sharing-networks.c
++++ b/panels/sharing/cc-sharing-networks.c
+@@ -190,7 +190,11 @@ cc_sharing_networks_enable_network (GtkSwitch *widget,
+ g_warning ("Failed to %s service %s: %s", state ? "enable" : "disable",
+ self->priv->service_name, error->message);
+ g_error_free (error);
++ g_signal_handlers_block_by_func (widget,
++ cc_sharing_networks_enable_network, self);
+ gtk_switch_set_active (widget, !state);
++ g_signal_handlers_unblock_by_func (widget,
++ cc_sharing_networks_enable_network, self);
+ }
+
+ cc_sharing_update_networks (self);
+--
+cgit v0.10.1
+
Index: debian/patches/31_printers_border.patch
===================================================================
--- debian/patches/31_printers_border.patch (révision 0)
+++ debian/patches/31_printers_border.patch (révision 43955)
@@ -0,0 +1,25 @@
+From cc0ce5f2c6d52f799707a612832f3715572eeab9 Mon Sep 17 00:00:00 2001
+From: Marek Kasik <mkasik@redhat.com>
+Date: Thu, 27 Nov 2014 15:06:47 +0100
+Subject: printers: Remove border around model name
+
+The border was not there in 3.10 and it is not
+intended to be there in 3.14.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=740811
+
+diff --git a/panels/printers/printers.ui b/panels/printers/printers.ui
+index ecb545f..3891c35 100644
+--- a/panels/printers/printers.ui
++++ b/panels/printers/printers.ui
+@@ -332,6 +332,7 @@
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="show_tabs">False</property>
++ <property name="show_border">False</property>
+ <child>
+ <object class="GtkButton" id="printer-model-button">
+ <property name="use_action_appearance">False</property>
+--
+cgit v0.10.1
+
Index: debian/changelog
===================================================================
--- debian/changelog (révision 43900)
+++ debian/changelog (copie de travail)
@@ -1,3 +1,14 @@
+gnome-control-center (1:3.14.2-1) unstable; urgency=medium
+
+ * New upstream translation and bugfix release.
+ + Disables SSLv3 because POODLE.
+ * 30_stack_overflow.patch: patch from upstream git. Prevents stack
+ overflow in sharing panel.
+ * 31_printers_border.patch: patch from upstream git. Removes unwanted
+ border around printer model name.
+
+ -- Josselin Mouette <joss@debian.org> Sun, 30 Nov 2014 11:08:12 +0100
+
gnome-control-center (1:3.14.1-1) unstable; urgency=medium
* New upstream release.
Index: debian/control
===================================================================
--- debian/control (révision 43900)
+++ debian/control (copie de travail)
@@ -6,7 +6,7 @@
Section: gnome
Priority: optional
Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
-Uploaders: Andreas Henriksson <andreas@fatal.se>, Laurent Bigonville <bigon@debian.org>, Sjoerd Simons <sjoerd@debian.org>
+Uploaders: Andreas Henriksson <andreas@fatal.se>, Josselin Mouette <joss@debian.org>, Laurent Bigonville <bigon@debian.org>, Sjoerd Simons <sjoerd@debian.org>
Standards-Version: 3.9.6
Build-Depends: autotools-dev,
cdbs (>= 0.4.41),
diff --git a/NEWS b/NEWS
index ab2308c..8a51da2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,38 @@
==============
+Version 3.14.2
+==============
+
+- Disable SSLv3 because of POODLE
+- Translation updates
+
+Background:
+- Fix possible crash when date isn't available
+- Fix crash when adding the second color
+
+Power:
+- Disable hover on non-clickable rows
+
+Printers:
+- Automatically keep the selected row scrolled in view
+
+Region:
+- Make Add/Done buttons blue as intended
+- Don't crash for locales with no country code
+
+Search:
+- Use g_get_system_data_dirs() to discover providers
+
+Sound:
+- Fix the main volume bars to correctly display changes in volume
+
+Universal Access:
+- Make Add/Done buttons blue as intended
+
+User Accounts:
+- Fix a crash when taking a photo in the avatar chooser
+- Reset language dialog to original state when used the 2nd time
+
+==============
Version 3.14.1
==============
diff --git a/configure.ac b/configure.ac
index dba434f..97715db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-m4_define([gnome_control_center_version], 3.14.1)
+m4_define([gnome_control_center_version], 3.14.2)
AC_INIT([gnome-control-center], [gnome_control_center_version],
[http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-control-center])
diff --git a/panels/background/bg-colors-source.c b/panels/background/bg-colors-source.c
index 09e484a..afe5868 100644
--- a/panels/background/bg-colors-source.c
+++ b/panels/background/bg-colors-source.c
@@ -222,8 +222,21 @@ bg_colors_source_add (BgColorsSource *self,
}
else
{
- colors[len] = c;
+ char **new_colors;
+ guint i;
+
+ new_colors = g_new0 (char *, len + 2);
+ for (i = 0; colors[i] != NULL; i++)
+ {
+ new_colors[i] = colors[i];
+ colors[i] = NULL;
+ }
+
+ new_colors[len] = c;
len++;
+
+ g_strfreev (colors);
+ colors = new_colors;
}
g_key_file_set_string_list (keyfile, "Colors", "custom-colors", (const gchar * const*) colors, len);
diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c
index c165fa3..1dcce19 100644
--- a/panels/background/bg-pictures-source.c
+++ b/panels/background/bg-pictures-source.c
@@ -571,7 +571,12 @@ add_single_file_from_media (BgPicturesSource *bg_source,
* plugin, GRL_METADATA_KEY_MODIFICATION_DATE is not
*/
mtime = grl_media_get_creation_date (media);
- mtime_unix = g_date_time_to_unix (mtime);
+ if (!mtime)
+ mtime = grl_media_get_modification_date (media);
+ if (mtime)
+ mtime_unix = g_date_time_to_unix (mtime);
+ else
+ mtime_unix = g_get_real_time () / G_USEC_PER_SEC;
return add_single_file (bg_source, file, content_type, (guint64) mtime_unix, NULL);
}
diff --git a/panels/common/cc-language-chooser.c b/panels/common/cc-language-chooser.c
index 0f77d8a..6e52639 100644
--- a/panels/common/cc-language-chooser.c
+++ b/panels/common/cc-language-chooser.c
@@ -285,7 +285,7 @@ filter_changed (GtkDialog *chooser)
}
static void
-show_more (GtkDialog *chooser)
+show_more (GtkDialog *chooser, gboolean visible)
{
CcLanguageChooserPrivate *priv = GET_PRIVATE (chooser);
GtkWidget *widget;
@@ -298,16 +298,15 @@ show_more (GtkDialog *chooser)
widget = priv->scrolledwindow;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget),
GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
+ visible ? GTK_POLICY_AUTOMATIC : GTK_POLICY_NEVER);
- gtk_widget_show (priv->filter_entry);
- gtk_widget_grab_focus (priv->filter_entry);
+ gtk_widget_set_visible (priv->filter_entry, visible);
+ gtk_widget_grab_focus (visible ? priv->filter_entry : priv->language_list);
- priv->showing_extra = TRUE;
+ priv->showing_extra = visible;
gtk_list_box_invalidate_filter (GTK_LIST_BOX (priv->language_list));
}
-
static void
set_locale_id (GtkDialog *chooser,
const gchar *locale_id)
@@ -356,7 +355,7 @@ row_activated (GtkListBox *box,
return;
if (row == priv->more_item) {
- show_more (chooser);
+ show_more (chooser, TRUE);
return;
}
new_locale_id = g_object_get_data (G_OBJECT (row), "locale-id");
@@ -436,6 +435,7 @@ cc_language_chooser_clear_filter (GtkWidget *chooser)
CcLanguageChooserPrivate *priv = GET_PRIVATE (chooser);
gtk_entry_set_text (GTK_ENTRY (priv->filter_entry), "");
+ show_more (GTK_DIALOG (chooser), FALSE);
}
const gchar *
diff --git a/panels/common/language-chooser.ui b/panels/common/language-chooser.ui
index 9dfca24..c8228bb 100644
--- a/panels/common/language-chooser.ui
+++ b/panels/common/language-chooser.ui
@@ -7,42 +7,24 @@
<property name="destroy_with_parent">True</property>
<property name="resizable">False</property>
<property name="use_header_bar">1</property>
- <child internal-child="headerbar">
- <object class="GtkHeaderBar" id="format-chooser-header-bar">
+ <child type="action">
+ <object class="GtkButton" id="ok-button">
+ <property name="label" translatable="yes">_Done</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="show_close_button">False</property>
- <child>
- <object class="GtkButton" id="ok-button">
- <property name="label" translatable="yes">_Done</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <property name="valign">center</property>
- <style>
- <class name="text-button"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="cancel-button">
- <property name="label" translatable="yes">_Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="use_underline">True</property>
- <property name="valign">center</property>
- <style>
- <class name="text-button"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">start</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <property name="valign">center</property>
+ </object>
+ </child>
+ <child type="action">
+ <object class="GtkButton" id="cancel-button">
+ <property name="label" translatable="yes">_Cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_underline">True</property>
+ <property name="valign">center</property>
</object>
</child>
<child internal-child="vbox">
@@ -89,7 +71,7 @@
</object>
</child>
<action-widgets>
- <action-widget response="-5">ok-button</action-widget>
+ <action-widget response="-5" default="true">ok-button</action-widget>
<action-widget response="-6">cancel-button</action-widget>
</action-widgets>
</object>
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index 6ef1208..9b0449e 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -168,6 +168,15 @@ cc_power_panel_class_init (CcPowerPanelClass *klass)
panel_class->get_help_uri = cc_power_panel_get_help_uri;
}
+static GtkWidget *
+no_prelight_row_new (void)
+{
+ return (GtkWidget *) g_object_new (GTK_TYPE_LIST_BOX_ROW,
+ "selectable", FALSE,
+ "activatable", FALSE,
+ NULL);
+}
+
static gchar *
get_timestring (guint64 time_secs)
{
@@ -321,7 +330,7 @@ set_primary (CcPowerPanel *panel, UpDevice *device)
details = get_details_string (percentage, state, time);
- row = gtk_list_box_row_new ();
+ row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (row), box);
@@ -397,7 +406,7 @@ add_battery (CcPowerPanel *panel, UpDevice *device)
else
name = C_("Battery name", "Extra");
- row = gtk_list_box_row_new ();
+ row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (row), box);
@@ -573,7 +582,7 @@ add_device (CcPowerPanel *panel, UpDevice *device)
g_string_append (status, "</small>");
/* create the new widget */
- row = gtk_list_box_row_new ();
+ row = no_prelight_row_new ();
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (row), hbox);
widget = gtk_label_new ("");
@@ -1395,7 +1404,7 @@ add_brightness_row (CcPowerPanel *self,
CcPowerPanelPrivate *priv = self->priv;
GtkWidget *row, *box, *label, *box2, *w, *scale;
- row = gtk_list_box_row_new ();
+ row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (row), box);
label = gtk_label_new (text);
@@ -1482,7 +1491,7 @@ add_power_saving_section (CcPowerPanel *self)
gtk_container_add (GTK_CONTAINER (widget), row);
gtk_size_group_add_widget (priv->row_sizegroup, row);
- priv->dim_screen_row = row = gtk_list_box_row_new ();
+ priv->dim_screen_row = row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 50);
gtk_container_add (GTK_CONTAINER (row), box);
@@ -1507,7 +1516,7 @@ add_power_saving_section (CcPowerPanel *self)
gtk_container_add (GTK_CONTAINER (widget), row);
gtk_size_group_add_widget (priv->row_sizegroup, row);
- row = gtk_list_box_row_new ();
+ row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 50);
gtk_container_add (GTK_CONTAINER (row), box);
@@ -1537,7 +1546,7 @@ add_power_saving_section (CcPowerPanel *self)
gtk_size_group_add_widget (priv->row_sizegroup, row);
#ifdef HAVE_NETWORK_MANAGER
- priv->wifi_row = row = gtk_list_box_row_new ();
+ priv->wifi_row = row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 50);
gtk_container_add (GTK_CONTAINER (row), box);
@@ -1567,7 +1576,7 @@ add_power_saving_section (CcPowerPanel *self)
gtk_container_add (GTK_CONTAINER (widget), row);
gtk_size_group_add_widget (priv->row_sizegroup, row);
- priv->mobile_row = row = gtk_list_box_row_new ();
+ priv->mobile_row = row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 50);
gtk_container_add (GTK_CONTAINER (row), box);
@@ -1630,7 +1639,7 @@ add_power_saving_section (CcPowerPanel *self)
"/org/gnome/SettingsDaemon/Rfkill",
"org.freedesktop.DBus.Properties",
NULL, NULL);
- row = gtk_list_box_row_new ();
+ row = no_prelight_row_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 50);
gtk_container_add (GTK_CONTAINER (row), box);
label = gtk_label_new (_("_Bluetooth"));
diff --git a/panels/printers/new-printer-dialog.ui b/panels/printers/new-printer-dialog.ui
index 1f9a115..751bce2 100644
--- a/panels/printers/new-printer-dialog.ui
+++ b/panels/printers/new-printer-dialog.ui
@@ -122,15 +122,15 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="shadow_type">in</property>
+ <property name="transition-type">none</property>
<child>
- <object class="GtkStack" id="stack">
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="transition-type">none</property>
+ <property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="devices-treeview">
<property name="visible">True</property>
@@ -141,25 +141,25 @@
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>
</object>
- <packing>
- <property name="name">standard-page</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="no-devices-label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="sensitive">False</property>
- <property name="label" translatable="yes" comments="Translators: No printers were found">No printers detected.</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="name">no-printers-page</property>
- </packing>
</child>
</object>
+ <packing>
+ <property name="name">standard-page</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="no-devices-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="sensitive">False</property>
+ <property name="label" translatable="yes" comments="Translators: No printers were found">No printers detected.</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="name">no-printers-page</property>
+ </packing>
</child>
</object>
<packing>
diff --git a/panels/region/cc-input-chooser.c b/panels/region/cc-input-chooser.c
index bb620f8..26a30a2 100644
--- a/panels/region/cc-input-chooser.c
+++ b/panels/region/cc-input-chooser.c
@@ -1022,7 +1022,11 @@ get_locale_infos (GtkWidget *chooser)
if (!gnome_parse_locale (*locale, &lang_code, &country_code, NULL, NULL))
continue;
- simple_locale = g_strdup_printf ("%s_%s.utf8", lang_code, country_code);
+ if (country_code != NULL)
+ simple_locale = g_strdup_printf ("%s_%s.utf8", lang_code, country_code);
+ else
+ simple_locale = g_strdup_printf ("%s.utf8", lang_code);
+
if (g_hash_table_contains (priv->locales, simple_locale))
{
g_free (simple_locale);
@@ -1060,10 +1064,13 @@ get_locale_infos (GtkWidget *chooser)
add_ids_to_set (layouts_with_locale, list);
g_list_free (list);
- list = gnome_xkb_info_get_layouts_for_country (priv->xkb_info, country_code);
- add_rows_to_table (chooser, info, list, INPUT_SOURCE_TYPE_XKB, id);
- add_ids_to_set (layouts_with_locale, list);
- g_list_free (list);
+ if (country_code != NULL)
+ {
+ list = gnome_xkb_info_get_layouts_for_country (priv->xkb_info, country_code);
+ add_rows_to_table (chooser, info, list, INPUT_SOURCE_TYPE_XKB, id);
+ add_ids_to_set (layouts_with_locale, list);
+ g_list_free (list);
+ }
g_free (lang_code);
g_free (country_code);
diff --git a/panels/region/format-chooser.ui b/panels/region/format-chooser.ui
index a936a0b..c500e32 100644
--- a/panels/region/format-chooser.ui
+++ b/panels/region/format-chooser.ui
@@ -9,42 +9,24 @@
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="use_header_bar">1</property>
- <child internal-child="headerbar">
- <object class="GtkHeaderBar" id="format-chooser-header-bar">
+ <child type="action">
+ <object class="GtkButton" id="ok-button">
+ <property name="label" translatable="yes">_Done</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="show_close_button">False</property>
- <child>
- <object class="GtkButton" id="ok-button">
- <property name="label" translatable="yes">_Done</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <property name="valign">center</property>
- <style>
- <class name="text-button"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="cancel-button">
- <property name="label" translatable="yes">_Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="use_underline">True</property>
- <property name="valign">center</property>
- <style>
- <class name="text-button"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">start</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <property name="valign">center</property>
+ </object>
+ </child>
+ <child type="action">
+ <object class="GtkButton" id="cancel-button">
+ <property name="label" translatable="yes">_Cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_underline">True</property>
+ <property name="valign">center</property>
</object>
</child>
<child internal-child="vbox">
@@ -353,7 +335,7 @@
</object>
</child>
<action-widgets>
- <action-widget response="-5">ok-button</action-widget>
+ <action-widget response="-5" default="true">ok-button</action-widget>
<action-widget response="-6">cancel-button</action-widget>
</action-widgets>
</object>
diff --git a/panels/region/input-chooser.ui b/panels/region/input-chooser.ui
index 747d7ae..e93d483 100644
--- a/panels/region/input-chooser.ui
+++ b/panels/region/input-chooser.ui
@@ -8,42 +8,24 @@
<property name="destroy_with_parent">True</property>
<property name="resizable">True</property>
<property name="use_header_bar">1</property>
- <child internal-child="headerbar">
- <object class="GtkHeaderBar" id="input-dialog-header-bar">
+ <child type="action">
+ <object class="GtkButton" id="cancel-button">
+ <property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="show_close_button">False</property>
- <child>
- <object class="GtkButton" id="cancel-button">
- <property name="label" translatable="yes">_Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="use_underline">True</property>
- <property name="valign">center</property>
- <style>
- <class name="text-button"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">start</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="add-button">
- <property name="label" translatable="yes">_Add</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="use_underline">True</property>
- <property name="valign">center</property>
- <style>
- <class name="text-button"/>
- <class name="suggested-action"/>
- </style>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="use_underline">True</property>
+ <property name="valign">center</property>
+ </object>
+ </child>
+ <child type="action">
+ <object class="GtkButton" id="add-button">
+ <property name="label" translatable="yes">_Add</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="sensitive">False</property>
+ <property name="use_underline">True</property>
+ <property name="valign">center</property>
</object>
</child>
<child internal-child="vbox">
@@ -90,7 +72,7 @@
</object>
</child>
<action-widgets>
- <action-widget response="-5">add-button</action-widget>
+ <action-widget response="-5" default="true">add-button</action-widget>
<action-widget response="-6">cancel-button</action-widget>
</action-widgets>
</object>
diff --git a/panels/search/cc-search-panel.c b/panels/search/cc-search-panel.c
index 717c3e7..d2a0f3b 100644
--- a/panels/search/cc-search-panel.c
+++ b/panels/search/cc-search-panel.c
@@ -36,6 +36,7 @@ struct _CcSearchPanelPrivate
GtkWidget *up_button;
GtkWidget *down_button;
+ GCancellable *load_cancellable;
GSettings *search_settings;
GHashTable *sort_order;
@@ -545,95 +546,146 @@ search_panel_add_one_provider (CcSearchPanel *self,
}
static void
-next_search_provider_ready (GObject *source,
- GAsyncResult *res,
- gpointer user_data)
+search_providers_discover_ready (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
{
- CcSearchPanel *self = user_data;
- GFile *providers_location, *provider;
- GList *files;
+ GList *providers, *l;
+ GFile *provider;
+ CcSearchPanel *self = CC_SEARCH_PANEL (source);
GError *error = NULL;
- gchar *path;
- files = g_file_enumerator_next_files_finish (G_FILE_ENUMERATOR (source),
- res, &error);
- providers_location = g_file_enumerator_get_container (G_FILE_ENUMERATOR (source));
+ providers = g_task_propagate_pointer (G_TASK (result), &error);
- if (error != NULL)
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
- path = g_file_get_path (providers_location);
+ g_error_free (error);
+ return;
+ }
- g_warning ("Error reading from %s: %s - search providers might be missing from the panel",
- path, error->message);
+ g_clear_object (&self->priv->load_cancellable);
- g_error_free (error);
- g_free (path);
+ if (providers == NULL)
+ {
+ search_panel_set_no_providers (self);
+ return;
}
- if (files != NULL)
+ for (l = providers; l != NULL; l = l->next)
{
- provider = g_file_get_child (providers_location, g_file_info_get_name (files->data));
+ provider = l->data;
search_panel_add_one_provider (self, provider);
g_object_unref (provider);
-
- g_file_enumerator_next_files_async (G_FILE_ENUMERATOR (source), 1,
- G_PRIORITY_DEFAULT, NULL,
- next_search_provider_ready, self);
- }
- else
- {
- /* propagate a write to GSettings, to make sure we always have
- * all the providers in the list.
- */
- search_panel_propagate_sort_order (self);
}
- g_list_free_full (files, g_object_unref);
+ /* propagate a write to GSettings, to make sure we always have
+ * all the providers in the list.
+ */
+ search_panel_propagate_sort_order (self);
+ g_list_free (providers);
}
-static void
-enumerate_search_providers_ready (GObject *source,
- GAsyncResult *res,
- gpointer user_data)
+static GList *
+search_providers_discover_one_directory (const gchar *system_dir,
+ GCancellable *cancellable)
{
- CcSearchPanel *self = user_data;
+ GList *providers = NULL;
+ gchar *providers_path;
+ GFile *providers_location, *provider;
+ GFileInfo *info;
GFileEnumerator *enumerator;
GError *error = NULL;
- gchar *path;
- enumerator = g_file_enumerate_children_finish (G_FILE (source), res, &error);
+ providers_path = g_build_filename (system_dir, "gnome-shell", "search-providers", NULL);
+ providers_location = g_file_new_for_path (providers_path);
+
+ enumerator = g_file_enumerate_children (providers_location,
+ "standard::type,standard::name,standard::content-type",
+ G_FILE_QUERY_INFO_NONE,
+ cancellable, &error);
+
if (error != NULL)
{
- path = g_file_get_path (G_FILE (source));
-
- if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) &&
+ !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("Error opening %s: %s - search provider configuration won't be possible",
- path, error->message);
+ providers_path, error->message);
+ g_clear_error (&error);
- search_panel_set_no_providers (self);
- g_error_free (error);
- return;
+ goto out;
+ }
+
+ while ((info = g_file_enumerator_next_file (enumerator, cancellable, &error)) != NULL)
+ {
+ provider = g_file_get_child (providers_location, g_file_info_get_name (info));
+ providers = g_list_prepend (providers, provider);
+ g_object_unref (info);
+ }
+
+ if (error != NULL)
+ {
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_warning ("Error reading from %s: %s - search providers might be missing from the panel",
+ providers_path, error->message);
+ g_clear_error (&error);
+ }
+
+ out:
+ g_clear_object (&enumerator);
+ g_clear_object (&providers_location);
+ g_free (providers_path);
+
+ return providers;
+}
+
+static void
+search_providers_discover_thread (GTask *task,
+ gpointer source_object,
+ gpointer task_data,
+ GCancellable *cancellable)
+{
+ GList *providers = NULL;
+ const gchar * const *system_data_dirs;
+ int idx;
+
+ system_data_dirs = g_get_system_data_dirs ();
+ for (idx = 0; system_data_dirs[idx] != NULL; idx++)
+ {
+ providers = g_list_concat (search_providers_discover_one_directory (system_data_dirs[idx], cancellable),
+ providers);
+
+ if (g_task_return_error_if_cancelled (task))
+ {
+ g_list_free_full (providers, g_object_unref);
+ return;
+ }
}
- g_file_enumerator_next_files_async (enumerator, 1,
- G_PRIORITY_DEFAULT, NULL,
- next_search_provider_ready, self);
- g_object_unref (enumerator);
+ g_task_return_pointer (task, providers, NULL);
}
static void
populate_search_providers (CcSearchPanel *self)
{
- GFile *providers_location;
-
- providers_location = g_file_new_for_path (DATADIR "/gnome-shell/search-providers");
- g_file_enumerate_children_async (providers_location,
- "standard::type,standard::name,standard::content-type",
- G_FILE_QUERY_INFO_NONE,
- G_PRIORITY_DEFAULT,
- NULL,
- enumerate_search_providers_ready, self);
- g_object_unref (providers_location);
+ GTask *task;
+
+ self->priv->load_cancellable = g_cancellable_new ();
+ task = g_task_new (self, self->priv->load_cancellable,
+ search_providers_discover_ready, self);
+ g_task_run_in_thread (task, search_providers_discover_thread);
+ g_object_unref (task);
+}
+
+static void
+cc_search_panel_dispose (GObject *object)
+{
+ CcSearchPanelPrivate *priv = CC_SEARCH_PANEL (object)->priv;
+
+ if (priv->load_cancellable != NULL)
+ g_cancellable_cancel (priv->load_cancellable);
+ g_clear_object (&priv->load_cancellable);
+
+ G_OBJECT_CLASS (cc_search_panel_parent_class)->dispose (object);
}
static void
@@ -752,6 +804,7 @@ cc_search_panel_class_init (CcSearchPanelClass *klass)
GObjectClass *oclass = G_OBJECT_CLASS (klass);
oclass->constructed = cc_search_panel_constructed;
+ oclass->dispose = cc_search_panel_dispose;
oclass->finalize = cc_search_panel_finalize;
g_type_class_add_private (klass, sizeof (CcSearchPanelPrivate));
diff --git a/panels/sound/gvc-mixer-dialog.c b/panels/sound/gvc-mixer-dialog.c
index 3cb59d8..a576dd2 100644
--- a/panels/sound/gvc-mixer-dialog.c
+++ b/panels/sound/gvc-mixer-dialog.c
@@ -755,16 +755,6 @@ on_stream_is_muted_notify (GObject *object,
}
-static void
-save_bar_for_stream (GvcMixerDialog *dialog,
- GvcMixerStream *stream,
- GtkWidget *bar)
-{
- g_hash_table_insert (dialog->priv->bars,
- GUINT_TO_POINTER (gvc_mixer_stream_get_id (stream)),
- bar);
-}
-
static GtkWidget *
create_bar (GvcMixerDialog *dialog,
gboolean add_to_size_group,
@@ -990,6 +980,9 @@ bar_set_stream (GvcMixerDialog *dialog,
"value-changed",
G_CALLBACK (on_adjustment_value_changed),
dialog);
+ g_hash_table_insert (dialog->priv->bars,
+ GUINT_TO_POINTER (gvc_mixer_stream_get_id (stream)),
+ bar);
}
}
@@ -1037,7 +1030,6 @@ add_stream (GvcMixerDialog *dialog,
g_signal_handlers_disconnect_by_func (old_stream, on_stream_volume_notify, dialog);
g_hash_table_remove (dialog->priv->bars, GUINT_TO_POINTER (gvc_mixer_stream_get_id (old_stream)));
}
- save_bar_for_stream (dialog, stream, bar);
bar_set_stream (dialog, bar, stream);
gtk_widget_show (bar);
}
diff --git a/panels/universal-access/uap.ui b/panels/universal-access/uap.ui
index 287db68..e98b075 100644
--- a/panels/universal-access/uap.ui
+++ b/panels/universal-access/uap.ui
@@ -97,6 +97,8 @@
<object class="GtkListBoxRow" id="row_highcontrast">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="selectable">False</property>
+ <property name="activatable">False</property>
<child>
<object class="GtkBox" id="box_highcontrast">
<property name="visible">True</property>
@@ -142,6 +144,8 @@
<object class="GtkListBoxRow" id="row_large_text">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="selectable">False</property>
+ <property name="activatable">False</property>
<child>
<object class="GtkBox" id="box_large_text">
<property name="visible">True</property>
@@ -480,6 +484,8 @@
<object class="GtkListBoxRow" id="row_screen_keyboard">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="selectable">False</property>
+ <property name="activatable">False</property>
<child>
<object class="GtkBox" id="box_screen_keyboard">
<property name="visible">True</property>
@@ -625,6 +631,8 @@
<object class="GtkListBoxRow" id="row_mouse_keys">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="selectable">False</property>
+ <property name="activatable">False</property>
<child>
<object class="GtkBox" id="box_mouse_keys">
<property name="visible">True</property>
diff --git a/panels/user-accounts/Makefile.am b/panels/user-accounts/Makefile.am
index 5ef4c33..1de5719 100644
--- a/panels/user-accounts/Makefile.am
+++ b/panels/user-accounts/Makefile.am
@@ -37,8 +37,8 @@ libuser_accounts_la_SOURCES = \
pw-utils.c \
um-photo-dialog.h \
um-photo-dialog.c \
- um-crop-area.h \
- um-crop-area.c \
+ cc-crop-area.h \
+ cc-crop-area.c \
um-fingerprint-dialog.h \
um-fingerprint-dialog.c \
um-utils.h \
diff --git a/panels/user-accounts/cc-crop-area.c b/panels/user-accounts/cc-crop-area.c
new file mode 100644
index 0000000..1b6e407
--- /dev/null
+++ b/panels/user-accounts/cc-crop-area.c
@@ -0,0 +1,817 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright 2009 Red Hat, Inc,
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Written by: Matthias Clasen <mclasen@redhat.com>
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include "cc-crop-area.h"
+
+struct _CcCropAreaPrivate {
+ GdkPixbuf *browse_pixbuf;
+ GdkPixbuf *pixbuf;
+ GdkPixbuf *color_shifted;
+ gdouble scale;
+ GdkRectangle image;
+ GdkCursorType current_cursor;
+ GdkRectangle crop;
+ gint active_region;
+ gint last_press_x;
+ gint last_press_y;
+ gint base_width;
+ gint base_height;
+ gdouble aspect;
+};
+
+G_DEFINE_TYPE (CcCropArea, cc_crop_area, GTK_TYPE_DRAWING_AREA);
+
+static inline guchar
+shift_color_byte (guchar b,
+ int shift)
+{
+ return CLAMP(b + shift, 0, 255);
+}
+
+static void
+shift_colors (GdkPixbuf *pixbuf,
+ gint red,
+ gint green,
+ gint blue,
+ gint alpha)
+{
+ gint x, y, offset, y_offset, rowstride, width, height;
+ guchar *pixels;
+ gint channels;
+
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+ rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+ pixels = gdk_pixbuf_get_pixels (pixbuf);
+ channels = gdk_pixbuf_get_n_channels (pixbuf);
+
+ for (y = 0; y < height; y++) {
+ y_offset = y * rowstride;
+ for (x = 0; x < width; x++) {
+ offset = y_offset + x * channels;
+ if (red != 0)
+ pixels[offset] = shift_color_byte (pixels[offset], red);
+ if (green != 0)
+ pixels[offset + 1] = shift_color_byte (pixels[offset + 1], green);
+ if (blue != 0)
+ pixels[offset + 2] = shift_color_byte (pixels[offset + 2], blue);
+ if (alpha != 0 && channels >= 4)
+ pixels[offset + 3] = shift_color_byte (pixels[offset + 3], blue);
+ }
+ }
+}
+
+static void
+update_pixbufs (CcCropArea *area)
+{
+ gint width;
+ gint height;
+ GtkAllocation allocation;
+ gdouble scale;
+ GdkRGBA color;
+ guint32 pixel;
+ gint dest_x, dest_y, dest_width, dest_height;
+ GtkWidget *widget;
+ GtkStyleContext *context;
+
+ widget = GTK_WIDGET (area);
+ gtk_widget_get_allocation (widget, &allocation);
+ context = gtk_widget_get_style_context (widget);
+
+ if (area->priv->pixbuf == NULL ||
+ gdk_pixbuf_get_width (area->priv->pixbuf) != allocation.width ||
+ gdk_pixbuf_get_height (area->priv->pixbuf) != allocation.height) {
+ if (area->priv->pixbuf != NULL)
+ g_object_unref (area->priv->pixbuf);
+ area->priv->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+ gdk_pixbuf_get_has_alpha (area->priv->browse_pixbuf),
+ 8,
+ allocation.width, allocation.height);
+
+ gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), &color);
+ pixel = (((gint)(color.red * 1.0)) << 16) |
+ (((gint)(color.green * 1.0)) << 8) |
+ ((gint)(color.blue * 1.0));
+ gdk_pixbuf_fill (area->priv->pixbuf, pixel);
+
+ width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
+ height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
+
+ scale = allocation.height / (gdouble)height;
+ if (scale * width > allocation.width)
+ scale = allocation.width / (gdouble)width;
+
+ dest_width = width * scale;
+ dest_height = height * scale;
+ dest_x = (allocation.width - dest_width) / 2;
+ dest_y = (allocation.height - dest_height) / 2,
+
+ gdk_pixbuf_scale (area->priv->browse_pixbuf,
+ area->priv->pixbuf,
+ dest_x, dest_y,
+ dest_width, dest_height,
+ dest_x, dest_y,
+ scale, scale,
+ GDK_INTERP_BILINEAR);
+
+ if (area->priv->color_shifted)
+ g_object_unref (area->priv->color_shifted);
+ area->priv->color_shifted = gdk_pixbuf_copy (area->priv->pixbuf);
+ shift_colors (area->priv->color_shifted, -32, -32, -32, 0);
+
+ if (area->priv->scale == 0.0) {
+ area->priv->crop.width = 2 * area->priv->base_width / scale;
+ area->priv->crop.height = 2 * area->priv->base_height / scale;
+ area->priv->crop.x = (gdk_pixbuf_get_width (area->priv->browse_pixbuf) - area->priv->crop.width) / 2;
+ area->priv->crop.y = (gdk_pixbuf_get_height (area->priv->browse_pixbuf) - area->priv->crop.height) / 2;
+ }
+
+ area->priv->scale = scale;
+ area->priv->image.x = dest_x;
+ area->priv->image.y = dest_y;
+ area->priv->image.width = dest_width;
+ area->priv->image.height = dest_height;
+ }
+}
+
+static void
+crop_to_widget (CcCropArea *area,
+ GdkRectangle *crop)
+{
+ crop->x = area->priv->image.x + area->priv->crop.x * area->priv->scale;
+ crop->y = area->priv->image.y + area->priv->crop.y * area->priv->scale;
+ crop->width = area->priv->crop.width * area->priv->scale;
+ crop->height = area->priv->crop.height * area->priv->scale;
+}
+
+typedef enum {
+ OUTSIDE,
+ INSIDE,
+ TOP,
+ TOP_LEFT,
+ TOP_RIGHT,
+ BOTTOM,
+ BOTTOM_LEFT,
+ BOTTOM_RIGHT,
+ LEFT,
+ RIGHT
+} Location;
+
+static gboolean
+cc_crop_area_draw (GtkWidget *widget,
+ cairo_t *cr)
+{
+ GdkRectangle crop;
+ gint width, height;
+ CcCropArea *uarea = CC_CROP_AREA (widget);
+
+ if (uarea->priv->browse_pixbuf == NULL)
+ return FALSE;
+
+ update_pixbufs (uarea);
+
+ width = gdk_pixbuf_get_width (uarea->priv->pixbuf);
+ height = gdk_pixbuf_get_height (uarea->priv->pixbuf);
+ crop_to_widget (uarea, &crop);
+
+ gdk_cairo_set_source_pixbuf (cr, uarea->priv->color_shifted, 0, 0);
+ cairo_rectangle (cr, 0, 0, width, crop.y);
+ cairo_rectangle (cr, 0, crop.y, crop.x, crop.height);
+ cairo_rectangle (cr, crop.x + crop.width, crop.y, width - crop.x - crop.width, crop.height);
+ cairo_rectangle (cr, 0, crop.y + crop.height, width, height - crop.y - crop.height);
+ cairo_fill (cr);
+
+ gdk_cairo_set_source_pixbuf (cr, uarea->priv->pixbuf, 0, 0);
+ cairo_rectangle (cr, crop.x, crop.y, crop.width, crop.height);
+ cairo_fill (cr);
+
+ if (uarea->priv->active_region != OUTSIDE) {
+ gint x1, x2, y1, y2;
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_set_line_width (cr, 1.0);
+ x1 = crop.x + crop.width / 3.0;
+ x2 = crop.x + 2 * crop.width / 3.0;
+ y1 = crop.y + crop.height / 3.0;
+ y2 = crop.y + 2 * crop.height / 3.0;
+
+ cairo_move_to (cr, x1 + 0.5, crop.y);
+ cairo_line_to (cr, x1 + 0.5, crop.y + crop.height);
+
+ cairo_move_to (cr, x2 + 0.5, crop.y);
+ cairo_line_to (cr, x2 + 0.5, crop.y + crop.height);
+
+ cairo_move_to (cr, crop.x, y1 + 0.5);
+ cairo_line_to (cr, crop.x + crop.width, y1 + 0.5);
+
+ cairo_move_to (cr, crop.x, y2 + 0.5);
+ cairo_line_to (cr, crop.x + crop.width, y2 + 0.5);
+ cairo_stroke (cr);
+ }
+
+ cairo_set_source_rgb (cr, 0, 0, 0);
+ cairo_set_line_width (cr, 1.0);
+ cairo_rectangle (cr,
+ crop.x + 0.5,
+ crop.y + 0.5,
+ crop.width - 1.0,
+ crop.height - 1.0);
+ cairo_stroke (cr);
+
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_set_line_width (cr, 2.0);
+ cairo_rectangle (cr,
+ crop.x + 2.0,
+ crop.y + 2.0,
+ crop.width - 4.0,
+ crop.height - 4.0);
+ cairo_stroke (cr);
+
+ return FALSE;
+}
+
+typedef enum {
+ BELOW,
+ LOWER,
+ BETWEEN,
+ UPPER,
+ ABOVE
+} Range;
+
+static Range
+find_range (gint x,
+ gint min,
+ gint max)
+{
+ gint tolerance = 12;
+
+ if (x < min - tolerance)
+ return BELOW;
+ if (x <= min + tolerance)
+ return LOWER;
+ if (x < max - tolerance)
+ return BETWEEN;
+ if (x <= max + tolerance)
+ return UPPER;
+ return ABOVE;
+}
+
+static Location
+find_location (GdkRectangle *rect,
+ gint x,
+ gint y)
+{
+ Range x_range, y_range;
+ Location location[5][5] = {
+ { OUTSIDE, OUTSIDE, OUTSIDE, OUTSIDE, OUTSIDE },
+ { OUTSIDE, TOP_LEFT, TOP, TOP_RIGHT, OUTSIDE },
+ { OUTSIDE, LEFT, INSIDE, RIGHT, OUTSIDE },
+ { OUTSIDE, BOTTOM_LEFT, BOTTOM, BOTTOM_RIGHT, OUTSIDE },
+ { OUTSIDE, OUTSIDE, OUTSIDE, OUTSIDE, OUTSIDE }
+ };
+
+ x_range = find_range (x, rect->x, rect->x + rect->width);
+ y_range = find_range (y, rect->y, rect->y + rect->height);
+
+ return location[y_range][x_range];
+}
+
+static void
+update_cursor (CcCropArea *area,
+ gint x,
+ gint y)
+{
+ gint cursor_type;
+ GdkRectangle crop;
+ gint region;
+
+ region = area->priv->active_region;
+ if (region == OUTSIDE) {
+ crop_to_widget (area, &crop);
+ region = find_location (&crop, x, y);
+ }
+
+ switch (region) {
+ case OUTSIDE:
+ cursor_type = GDK_LEFT_PTR;
+ break;
+ case TOP_LEFT:
+ cursor_type = GDK_TOP_LEFT_CORNER;
+ break;
+ case TOP:
+ cursor_type = GDK_TOP_SIDE;
+ break;
+ case TOP_RIGHT:
+ cursor_type = GDK_TOP_RIGHT_CORNER;
+ break;
+ case LEFT:
+ cursor_type = GDK_LEFT_SIDE;
+ break;
+ case INSIDE:
+ cursor_type = GDK_FLEUR;
+ break;
+ case RIGHT:
+ cursor_type = GDK_RIGHT_SIDE;
+ break;
+ case BOTTOM_LEFT:
+ cursor_type = GDK_BOTTOM_LEFT_CORNER;
+ break;
+ case BOTTOM:
+ cursor_type = GDK_BOTTOM_SIDE;
+ break;
+ case BOTTOM_RIGHT:
+ cursor_type = GDK_BOTTOM_RIGHT_CORNER;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ if (cursor_type != area->priv->current_cursor) {
+ GdkCursor *cursor = gdk_cursor_new (cursor_type);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (area)), cursor);
+ g_object_unref (cursor);
+ area->priv->current_cursor = cursor_type;
+ }
+}
+
+static int
+eval_radial_line (gdouble center_x, gdouble center_y,
+ gdouble bounds_x, gdouble bounds_y,
+ gdouble user_x)
+{
+ gdouble decision_slope;
+ gdouble decision_intercept;
+
+ decision_slope = (bounds_y - center_y) / (bounds_x - center_x);
+ decision_intercept = -(decision_slope * bounds_x);
+
+ return (int) (decision_slope * user_x + decision_intercept);
+}
+
+static gboolean
+cc_crop_area_motion_notify_event (GtkWidget *widget,
+ GdkEventMotion *event)
+{
+ CcCropArea *area = CC_CROP_AREA (widget);
+ gint x, y;
+ gint delta_x, delta_y;
+ gint width, height;
+ gint adj_width, adj_height;
+ gint pb_width, pb_height;
+ GdkRectangle damage;
+ gint left, right, top, bottom;
+ gdouble new_width, new_height;
+ gdouble center_x, center_y;
+ gint min_width, min_height;
+
+ if (area->priv->browse_pixbuf == NULL)
+ return FALSE;
+
+ update_cursor (area, event->x, event->y);
+
+ crop_to_widget (area, &damage);
+ gtk_widget_queue_draw_area (widget,
+ damage.x - 1, damage.y - 1,
+ damage.width + 2, damage.height + 2);
+
+ pb_width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
+ pb_height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
+
+ x = (event->x - area->priv->image.x) / area->priv->scale;
+ y = (event->y - area->priv->image.y) / area->priv->scale;
+
+ delta_x = x - area->priv->last_press_x;
+ delta_y = y - area->priv->last_press_y;
+ area->priv->last_press_x = x;
+ area->priv->last_press_y = y;
+
+ left = area->priv->crop.x;
+ right = area->priv->crop.x + area->priv->crop.width - 1;
+ top = area->priv->crop.y;
+ bottom = area->priv->crop.y + area->priv->crop.height - 1;
+
+ center_x = (left + right) / 2.0;
+ center_y = (top + bottom) / 2.0;
+
+ switch (area->priv->active_region) {
+ case INSIDE:
+ width = right - left + 1;
+ height = bottom - top + 1;
+
+ left += delta_x;
+ right += delta_x;
+ top += delta_y;
+ bottom += delta_y;
+
+ if (left < 0)
+ left = 0;
+ if (top < 0)
+ top = 0;
+ if (right > pb_width)
+ right = pb_width;
+ if (bottom > pb_height)
+ bottom = pb_height;
+
+ adj_width = right - left + 1;
+ adj_height = bottom - top + 1;
+ if (adj_width != width) {
+ if (delta_x < 0)
+ right = left + width - 1;
+ else
+ left = right - width + 1;
+ }
+ if (adj_height != height) {
+ if (delta_y < 0)
+ bottom = top + height - 1;
+ else
+ top = bottom - height + 1;
+ }
+
+ break;
+
+ case TOP_LEFT:
+ if (area->priv->aspect < 0) {
+ top = y;
+ left = x;
+ }
+ else if (y < eval_radial_line (center_x, center_y, left, top, x)) {
+ top = y;
+ new_width = (bottom - top) * area->priv->aspect;
+ left = right - new_width;
+ }
+ else {
+ left = x;
+ new_height = (right - left) / area->priv->aspect;
+ top = bottom - new_height;
+ }
+ break;
+
+ case TOP:
+ top = y;
+ if (area->priv->aspect > 0) {
+ new_width = (bottom - top) * area->priv->aspect;
+ right = left + new_width;
+ }
+ break;
+
+ case TOP_RIGHT:
+ if (area->priv->aspect < 0) {
+ top = y;
+ right = x;
+ }
+ else if (y < eval_radial_line (center_x, center_y, right, top, x)) {
+ top = y;
+ new_width = (bottom - top) * area->priv->aspect;
+ right = left + new_width;
+ }
+ else {
+ right = x;
+ new_height = (right - left) / area->priv->aspect;
+ top = bottom - new_height;
+ }
+ break;
+
+ case LEFT:
+ left = x;
+ if (area->priv->aspect > 0) {
+ new_height = (right - left) / area->priv->aspect;
+ bottom = top + new_height;
+ }
+ break;
+
+ case BOTTOM_LEFT:
+ if (area->priv->aspect < 0) {
+ bottom = y;
+ left = x;
+ }
+ else if (y < eval_radial_line (center_x, center_y, left, bottom, x)) {
+ left = x;
+ new_height = (right - left) / area->priv->aspect;
+ bottom = top + new_height;
+ }
+ else {
+ bottom = y;
+ new_width = (bottom - top) * area->priv->aspect;
+ left = right - new_width;
+ }
+ break;
+
+ case RIGHT:
+ right = x;
+ if (area->priv->aspect > 0) {
+ new_height = (right - left) / area->priv->aspect;
+ bottom = top + new_height;
+ }
+ break;
+
+ case BOTTOM_RIGHT:
+ if (area->priv->aspect < 0) {
+ bottom = y;
+ right = x;
+ }
+ else if (y < eval_radial_line (center_x, center_y, right, bottom, x)) {
+ right = x;
+ new_height = (right - left) / area->priv->aspect;
+ bottom = top + new_height;
+ }
+ else {
+ bottom = y;
+ new_width = (bottom - top) * area->priv->aspect;
+ right = left + new_width;
+ }
+ break;
+
+ case BOTTOM:
+ bottom = y;
+ if (area->priv->aspect > 0) {
+ new_width = (bottom - top) * area->priv->aspect;
+ right= left + new_width;
+ }
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ min_width = area->priv->base_width / area->priv->scale;
+ min_height = area->priv->base_height / area->priv->scale;
+
+ width = right - left + 1;
+ height = bottom - top + 1;
+ if (area->priv->aspect < 0) {
+ if (left < 0)
+ left = 0;
+ if (top < 0)
+ top = 0;
+ if (right > pb_width)
+ right = pb_width;
+ if (bottom > pb_height)
+ bottom = pb_height;
+
+ width = right - left + 1;
+ height = bottom - top + 1;
+
+ switch (area->priv->active_region) {
+ case LEFT:
+ case TOP_LEFT:
+ case BOTTOM_LEFT:
+ if (width < min_width)
+ left = right - min_width;
+ break;
+ case RIGHT:
+ case TOP_RIGHT:
+ case BOTTOM_RIGHT:
+ if (width < min_width)
+ right = left + min_width;
+ break;
+
+ default: ;
+ }
+
+ switch (area->priv->active_region) {
+ case TOP:
+ case TOP_LEFT:
+ case TOP_RIGHT:
+ if (height < min_height)
+ top = bottom - min_height;
+ break;
+ case BOTTOM:
+ case BOTTOM_LEFT:
+ case BOTTOM_RIGHT:
+ if (height < min_height)
+ bottom = top + min_height;
+ break;
+
+ default: ;
+ }
+ }
+ else {
+ if (left < 0 || top < 0 ||
+ right > pb_width || bottom > pb_height ||
+ width < min_width || height < min_height) {
+ left = area->priv->crop.x;
+ right = area->priv->crop.x + area->priv->crop.width - 1;
+ top = area->priv->crop.y;
+ bottom = area->priv->crop.y + area->priv->crop.height - 1;
+ }
+ }
+
+ area->priv->crop.x = left;
+ area->priv->crop.y = top;
+ area->priv->crop.width = right - left + 1;
+ area->priv->crop.height = bottom - top + 1;
+
+ crop_to_widget (area, &damage);
+ gtk_widget_queue_draw_area (widget,
+ damage.x - 1, damage.y - 1,
+ damage.width + 2, damage.height + 2);
+
+ return FALSE;
+}
+
+static gboolean
+cc_crop_area_button_press_event (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ CcCropArea *area = CC_CROP_AREA (widget);
+ GdkRectangle crop;
+
+ if (area->priv->browse_pixbuf == NULL)
+ return FALSE;
+
+ crop_to_widget (area, &crop);
+
+ area->priv->last_press_x = (event->x - area->priv->image.x) / area->priv->scale;
+ area->priv->last_press_y = (event->y - area->priv->image.y) / area->priv->scale;
+ area->priv->active_region = find_location (&crop, event->x, event->y);
+
+ gtk_widget_queue_draw_area (widget,
+ crop.x - 1, crop.y - 1,
+ crop.width + 2, crop.height + 2);
+
+ return FALSE;
+}
+
+static gboolean
+cc_crop_area_button_release_event (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ CcCropArea *area = CC_CROP_AREA (widget);
+ GdkRectangle crop;
+
+ if (area->priv->browse_pixbuf == NULL)
+ return FALSE;
+
+ crop_to_widget (area, &crop);
+
+ area->priv->last_press_x = -1;
+ area->priv->last_press_y = -1;
+ area->priv->active_region = OUTSIDE;
+
+ gtk_widget_queue_draw_area (widget,
+ crop.x - 1, crop.y - 1,
+ crop.width + 2, crop.height + 2);
+
+ return FALSE;
+}
+
+static void
+cc_crop_area_finalize (GObject *object)
+{
+ CcCropArea *area = CC_CROP_AREA (object);
+
+ if (area->priv->browse_pixbuf) {
+ g_object_unref (area->priv->browse_pixbuf);
+ area->priv->browse_pixbuf = NULL;
+ }
+ if (area->priv->pixbuf) {
+ g_object_unref (area->priv->pixbuf);
+ area->priv->pixbuf = NULL;
+ }
+ if (area->priv->color_shifted) {
+ g_object_unref (area->priv->color_shifted);
+ area->priv->color_shifted = NULL;
+ }
+}
+
+static void
+cc_crop_area_class_init (CcCropAreaClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ object_class->finalize = cc_crop_area_finalize;
+ widget_class->draw = cc_crop_area_draw;
+ widget_class->button_press_event = cc_crop_area_button_press_event;
+ widget_class->button_release_event = cc_crop_area_button_release_event;
+ widget_class->motion_notify_event = cc_crop_area_motion_notify_event;
+
+ g_type_class_add_private (klass, sizeof (CcCropAreaPrivate));
+}
+
+static void
+cc_crop_area_init (CcCropArea *area)
+{
+ area->priv = (G_TYPE_INSTANCE_GET_PRIVATE ((area), CC_TYPE_CROP_AREA,
+ CcCropAreaPrivate));
+
+ gtk_widget_add_events (GTK_WIDGET (area), GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK);
+
+ area->priv->scale = 0.0;
+ area->priv->image.x = 0;
+ area->priv->image.y = 0;
+ area->priv->image.width = 0;
+ area->priv->image.height = 0;
+ area->priv->active_region = OUTSIDE;
+ area->priv->base_width = 48;
+ area->priv->base_height = 48;
+ area->priv->aspect = 1;
+}
+
+GtkWidget *
+cc_crop_area_new (void)
+{
+ return g_object_new (CC_TYPE_CROP_AREA, NULL);
+}
+
+GdkPixbuf *
+cc_crop_area_get_picture (CcCropArea *area)
+{
+ gint width, height;
+
+ width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
+ height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
+ width = MIN (area->priv->crop.width, width - area->priv->crop.x);
+ height = MIN (area->priv->crop.height, height - area->priv->crop.y);
+
+ return gdk_pixbuf_new_subpixbuf (area->priv->browse_pixbuf,
+ area->priv->crop.x,
+ area->priv->crop.y,
+ width, height);
+}
+
+void
+cc_crop_area_set_picture (CcCropArea *area,
+ GdkPixbuf *pixbuf)
+{
+ int width;
+ int height;
+
+ if (area->priv->browse_pixbuf) {
+ g_object_unref (area->priv->browse_pixbuf);
+ area->priv->browse_pixbuf = NULL;
+ }
+ if (pixbuf) {
+ area->priv->browse_pixbuf = g_object_ref (pixbuf);
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+ } else {
+ width = 0;
+ height = 0;
+ }
+
+ area->priv->crop.width = 2 * area->priv->base_width;
+ area->priv->crop.height = 2 * area->priv->base_height;
+ area->priv->crop.x = (width - area->priv->crop.width) / 2;
+ area->priv->crop.y = (height - area->priv->crop.height) / 2;
+
+ area->priv->scale = 0.0;
+ area->priv->image.x = 0;
+ area->priv->image.y = 0;
+ area->priv->image.width = 0;
+ area->priv->image.height = 0;
+
+ gtk_widget_queue_draw (GTK_WIDGET (area));
+}
+
+void
+cc_crop_area_set_min_size (CcCropArea *area,
+ gint width,
+ gint height)
+{
+ area->priv->base_width = width;
+ area->priv->base_height = height;
+
+ if (area->priv->aspect > 0) {
+ area->priv->aspect = area->priv->base_width / (gdouble)area->priv->base_height;
+ }
+}
+
+void
+cc_crop_area_set_constrain_aspect (CcCropArea *area,
+ gboolean constrain)
+{
+ if (constrain) {
+ area->priv->aspect = area->priv->base_width / (gdouble)area->priv->base_height;
+ }
+ else {
+ area->priv->aspect = -1;
+ }
+}
+
diff --git a/panels/user-accounts/cc-crop-area.h b/panels/user-accounts/cc-crop-area.h
new file mode 100644
index 0000000..38657c6
--- /dev/null
+++ b/panels/user-accounts/cc-crop-area.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright © 2009 Bastien Nocera <hadess@hadess.net>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _CC_CROP_AREA_H_
+#define _CC_CROP_AREA_H_
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_CROP_AREA (cc_crop_area_get_type ())
+#define CC_CROP_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CC_TYPE_CROP_AREA, \
+ CcCropArea))
+#define CC_CROP_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CC_TYPE_CROP_AREA, \
+ CcCropAreaClass))
+#define CC_IS_CROP_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CC_TYPE_CROP_AREA))
+#define CC_IS_CROP_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CC_TYPE_CROP_AREA))
+#define CC_CROP_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CC_TYPE_CROP_AREA, \
+ CcCropAreaClass))
+
+typedef struct _CcCropAreaClass CcCropAreaClass;
+typedef struct _CcCropArea CcCropArea;
+typedef struct _CcCropAreaPrivate CcCropAreaPrivate;
+
+struct _CcCropAreaClass {
+ GtkDrawingAreaClass parent_class;
+};
+
+struct _CcCropArea {
+ GtkDrawingArea parent_instance;
+ CcCropAreaPrivate *priv;
+};
+
+GType cc_crop_area_get_type (void) G_GNUC_CONST;
+
+GtkWidget *cc_crop_area_new (void);
+GdkPixbuf *cc_crop_area_get_picture (CcCropArea *area);
+void cc_crop_area_set_picture (CcCropArea *area,
+ GdkPixbuf *pixbuf);
+void cc_crop_area_set_min_size (CcCropArea *area,
+ gint width,
+ gint height);
+void cc_crop_area_set_constrain_aspect (CcCropArea *area,
+ gboolean constrain);
+
+G_END_DECLS
+
+#endif /* _CC_CROP_AREA_H_ */
diff --git a/panels/user-accounts/um-crop-area.c b/panels/user-accounts/um-crop-area.c
deleted file mode 100644
index 2f2461c..0000000
--- a/panels/user-accounts/um-crop-area.c
+++ /dev/null
@@ -1,817 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright 2009 Red Hat, Inc,
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- * Written by: Matthias Clasen <mclasen@redhat.com>
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include "um-crop-area.h"
-
-struct _UmCropAreaPrivate {
- GdkPixbuf *browse_pixbuf;
- GdkPixbuf *pixbuf;
- GdkPixbuf *color_shifted;
- gdouble scale;
- GdkRectangle image;
- GdkCursorType current_cursor;
- GdkRectangle crop;
- gint active_region;
- gint last_press_x;
- gint last_press_y;
- gint base_width;
- gint base_height;
- gdouble aspect;
-};
-
-G_DEFINE_TYPE (UmCropArea, um_crop_area, GTK_TYPE_DRAWING_AREA);
-
-static inline guchar
-shift_color_byte (guchar b,
- int shift)
-{
- return CLAMP(b + shift, 0, 255);
-}
-
-static void
-shift_colors (GdkPixbuf *pixbuf,
- gint red,
- gint green,
- gint blue,
- gint alpha)
-{
- gint x, y, offset, y_offset, rowstride, width, height;
- guchar *pixels;
- gint channels;
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
- channels = gdk_pixbuf_get_n_channels (pixbuf);
-
- for (y = 0; y < height; y++) {
- y_offset = y * rowstride;
- for (x = 0; x < width; x++) {
- offset = y_offset + x * channels;
- if (red != 0)
- pixels[offset] = shift_color_byte (pixels[offset], red);
- if (green != 0)
- pixels[offset + 1] = shift_color_byte (pixels[offset + 1], green);
- if (blue != 0)
- pixels[offset + 2] = shift_color_byte (pixels[offset + 2], blue);
- if (alpha != 0 && channels >= 4)
- pixels[offset + 3] = shift_color_byte (pixels[offset + 3], blue);
- }
- }
-}
-
-static void
-update_pixbufs (UmCropArea *area)
-{
- gint width;
- gint height;
- GtkAllocation allocation;
- gdouble scale;
- GdkRGBA color;
- guint32 pixel;
- gint dest_x, dest_y, dest_width, dest_height;
- GtkWidget *widget;
- GtkStyleContext *context;
-
- widget = GTK_WIDGET (area);
- gtk_widget_get_allocation (widget, &allocation);
- context = gtk_widget_get_style_context (widget);
-
- if (area->priv->pixbuf == NULL ||
- gdk_pixbuf_get_width (area->priv->pixbuf) != allocation.width ||
- gdk_pixbuf_get_height (area->priv->pixbuf) != allocation.height) {
- if (area->priv->pixbuf != NULL)
- g_object_unref (area->priv->pixbuf);
- area->priv->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- gdk_pixbuf_get_has_alpha (area->priv->browse_pixbuf),
- 8,
- allocation.width, allocation.height);
-
- gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), &color);
- pixel = (((gint)(color.red * 1.0)) << 16) |
- (((gint)(color.green * 1.0)) << 8) |
- ((gint)(color.blue * 1.0));
- gdk_pixbuf_fill (area->priv->pixbuf, pixel);
-
- width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
- height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
-
- scale = allocation.height / (gdouble)height;
- if (scale * width > allocation.width)
- scale = allocation.width / (gdouble)width;
-
- dest_width = width * scale;
- dest_height = height * scale;
- dest_x = (allocation.width - dest_width) / 2;
- dest_y = (allocation.height - dest_height) / 2,
-
- gdk_pixbuf_scale (area->priv->browse_pixbuf,
- area->priv->pixbuf,
- dest_x, dest_y,
- dest_width, dest_height,
- dest_x, dest_y,
- scale, scale,
- GDK_INTERP_BILINEAR);
-
- if (area->priv->color_shifted)
- g_object_unref (area->priv->color_shifted);
- area->priv->color_shifted = gdk_pixbuf_copy (area->priv->pixbuf);
- shift_colors (area->priv->color_shifted, -32, -32, -32, 0);
-
- if (area->priv->scale == 0.0) {
- area->priv->crop.width = 2 * area->priv->base_width / scale;
- area->priv->crop.height = 2 * area->priv->base_height / scale;
- area->priv->crop.x = (gdk_pixbuf_get_width (area->priv->browse_pixbuf) - area->priv->crop.width) / 2;
- area->priv->crop.y = (gdk_pixbuf_get_height (area->priv->browse_pixbuf) - area->priv->crop.height) / 2;
- }
-
- area->priv->scale = scale;
- area->priv->image.x = dest_x;
- area->priv->image.y = dest_y;
- area->priv->image.width = dest_width;
- area->priv->image.height = dest_height;
- }
-}
-
-static void
-crop_to_widget (UmCropArea *area,
- GdkRectangle *crop)
-{
- crop->x = area->priv->image.x + area->priv->crop.x * area->priv->scale;
- crop->y = area->priv->image.y + area->priv->crop.y * area->priv->scale;
- crop->width = area->priv->crop.width * area->priv->scale;
- crop->height = area->priv->crop.height * area->priv->scale;
-}
-
-typedef enum {
- OUTSIDE,
- INSIDE,
- TOP,
- TOP_LEFT,
- TOP_RIGHT,
- BOTTOM,
- BOTTOM_LEFT,
- BOTTOM_RIGHT,
- LEFT,
- RIGHT
-} Location;
-
-static gboolean
-um_crop_area_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- GdkRectangle crop;
- gint width, height;
- UmCropArea *uarea = UM_CROP_AREA (widget);
-
- if (uarea->priv->browse_pixbuf == NULL)
- return FALSE;
-
- update_pixbufs (uarea);
-
- width = gdk_pixbuf_get_width (uarea->priv->pixbuf);
- height = gdk_pixbuf_get_height (uarea->priv->pixbuf);
- crop_to_widget (uarea, &crop);
-
- gdk_cairo_set_source_pixbuf (cr, uarea->priv->color_shifted, 0, 0);
- cairo_rectangle (cr, 0, 0, width, crop.y);
- cairo_rectangle (cr, 0, crop.y, crop.x, crop.height);
- cairo_rectangle (cr, crop.x + crop.width, crop.y, width - crop.x - crop.width, crop.height);
- cairo_rectangle (cr, 0, crop.y + crop.height, width, height - crop.y - crop.height);
- cairo_fill (cr);
-
- gdk_cairo_set_source_pixbuf (cr, uarea->priv->pixbuf, 0, 0);
- cairo_rectangle (cr, crop.x, crop.y, crop.width, crop.height);
- cairo_fill (cr);
-
- if (uarea->priv->active_region != OUTSIDE) {
- gint x1, x2, y1, y2;
- cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_set_line_width (cr, 1.0);
- x1 = crop.x + crop.width / 3.0;
- x2 = crop.x + 2 * crop.width / 3.0;
- y1 = crop.y + crop.height / 3.0;
- y2 = crop.y + 2 * crop.height / 3.0;
-
- cairo_move_to (cr, x1 + 0.5, crop.y);
- cairo_line_to (cr, x1 + 0.5, crop.y + crop.height);
-
- cairo_move_to (cr, x2 + 0.5, crop.y);
- cairo_line_to (cr, x2 + 0.5, crop.y + crop.height);
-
- cairo_move_to (cr, crop.x, y1 + 0.5);
- cairo_line_to (cr, crop.x + crop.width, y1 + 0.5);
-
- cairo_move_to (cr, crop.x, y2 + 0.5);
- cairo_line_to (cr, crop.x + crop.width, y2 + 0.5);
- cairo_stroke (cr);
- }
-
- cairo_set_source_rgb (cr, 0, 0, 0);
- cairo_set_line_width (cr, 1.0);
- cairo_rectangle (cr,
- crop.x + 0.5,
- crop.y + 0.5,
- crop.width - 1.0,
- crop.height - 1.0);
- cairo_stroke (cr);
-
- cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_set_line_width (cr, 2.0);
- cairo_rectangle (cr,
- crop.x + 2.0,
- crop.y + 2.0,
- crop.width - 4.0,
- crop.height - 4.0);
- cairo_stroke (cr);
-
- return FALSE;
-}
-
-typedef enum {
- BELOW,
- LOWER,
- BETWEEN,
- UPPER,
- ABOVE
-} Range;
-
-static Range
-find_range (gint x,
- gint min,
- gint max)
-{
- gint tolerance = 12;
-
- if (x < min - tolerance)
- return BELOW;
- if (x <= min + tolerance)
- return LOWER;
- if (x < max - tolerance)
- return BETWEEN;
- if (x <= max + tolerance)
- return UPPER;
- return ABOVE;
-}
-
-static Location
-find_location (GdkRectangle *rect,
- gint x,
- gint y)
-{
- Range x_range, y_range;
- Location location[5][5] = {
- { OUTSIDE, OUTSIDE, OUTSIDE, OUTSIDE, OUTSIDE },
- { OUTSIDE, TOP_LEFT, TOP, TOP_RIGHT, OUTSIDE },
- { OUTSIDE, LEFT, INSIDE, RIGHT, OUTSIDE },
- { OUTSIDE, BOTTOM_LEFT, BOTTOM, BOTTOM_RIGHT, OUTSIDE },
- { OUTSIDE, OUTSIDE, OUTSIDE, OUTSIDE, OUTSIDE }
- };
-
- x_range = find_range (x, rect->x, rect->x + rect->width);
- y_range = find_range (y, rect->y, rect->y + rect->height);
-
- return location[y_range][x_range];
-}
-
-static void
-update_cursor (UmCropArea *area,
- gint x,
- gint y)
-{
- gint cursor_type;
- GdkRectangle crop;
- gint region;
-
- region = area->priv->active_region;
- if (region == OUTSIDE) {
- crop_to_widget (area, &crop);
- region = find_location (&crop, x, y);
- }
-
- switch (region) {
- case OUTSIDE:
- cursor_type = GDK_LEFT_PTR;
- break;
- case TOP_LEFT:
- cursor_type = GDK_TOP_LEFT_CORNER;
- break;
- case TOP:
- cursor_type = GDK_TOP_SIDE;
- break;
- case TOP_RIGHT:
- cursor_type = GDK_TOP_RIGHT_CORNER;
- break;
- case LEFT:
- cursor_type = GDK_LEFT_SIDE;
- break;
- case INSIDE:
- cursor_type = GDK_FLEUR;
- break;
- case RIGHT:
- cursor_type = GDK_RIGHT_SIDE;
- break;
- case BOTTOM_LEFT:
- cursor_type = GDK_BOTTOM_LEFT_CORNER;
- break;
- case BOTTOM:
- cursor_type = GDK_BOTTOM_SIDE;
- break;
- case BOTTOM_RIGHT:
- cursor_type = GDK_BOTTOM_RIGHT_CORNER;
- break;
- default:
- g_assert_not_reached ();
- }
-
- if (cursor_type != area->priv->current_cursor) {
- GdkCursor *cursor = gdk_cursor_new (cursor_type);
- gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (area)), cursor);
- g_object_unref (cursor);
- area->priv->current_cursor = cursor_type;
- }
-}
-
-static int
-eval_radial_line (gdouble center_x, gdouble center_y,
- gdouble bounds_x, gdouble bounds_y,
- gdouble user_x)
-{
- gdouble decision_slope;
- gdouble decision_intercept;
-
- decision_slope = (bounds_y - center_y) / (bounds_x - center_x);
- decision_intercept = -(decision_slope * bounds_x);
-
- return (int) (decision_slope * user_x + decision_intercept);
-}
-
-static gboolean
-um_crop_area_motion_notify_event (GtkWidget *widget,
- GdkEventMotion *event)
-{
- UmCropArea *area = UM_CROP_AREA (widget);
- gint x, y;
- gint delta_x, delta_y;
- gint width, height;
- gint adj_width, adj_height;
- gint pb_width, pb_height;
- GdkRectangle damage;
- gint left, right, top, bottom;
- gdouble new_width, new_height;
- gdouble center_x, center_y;
- gint min_width, min_height;
-
- if (area->priv->browse_pixbuf == NULL)
- return FALSE;
-
- update_cursor (area, event->x, event->y);
-
- crop_to_widget (area, &damage);
- gtk_widget_queue_draw_area (widget,
- damage.x - 1, damage.y - 1,
- damage.width + 2, damage.height + 2);
-
- pb_width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
- pb_height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
-
- x = (event->x - area->priv->image.x) / area->priv->scale;
- y = (event->y - area->priv->image.y) / area->priv->scale;
-
- delta_x = x - area->priv->last_press_x;
- delta_y = y - area->priv->last_press_y;
- area->priv->last_press_x = x;
- area->priv->last_press_y = y;
-
- left = area->priv->crop.x;
- right = area->priv->crop.x + area->priv->crop.width - 1;
- top = area->priv->crop.y;
- bottom = area->priv->crop.y + area->priv->crop.height - 1;
-
- center_x = (left + right) / 2.0;
- center_y = (top + bottom) / 2.0;
-
- switch (area->priv->active_region) {
- case INSIDE:
- width = right - left + 1;
- height = bottom - top + 1;
-
- left += delta_x;
- right += delta_x;
- top += delta_y;
- bottom += delta_y;
-
- if (left < 0)
- left = 0;
- if (top < 0)
- top = 0;
- if (right > pb_width)
- right = pb_width;
- if (bottom > pb_height)
- bottom = pb_height;
-
- adj_width = right - left + 1;
- adj_height = bottom - top + 1;
- if (adj_width != width) {
- if (delta_x < 0)
- right = left + width - 1;
- else
- left = right - width + 1;
- }
- if (adj_height != height) {
- if (delta_y < 0)
- bottom = top + height - 1;
- else
- top = bottom - height + 1;
- }
-
- break;
-
- case TOP_LEFT:
- if (area->priv->aspect < 0) {
- top = y;
- left = x;
- }
- else if (y < eval_radial_line (center_x, center_y, left, top, x)) {
- top = y;
- new_width = (bottom - top) * area->priv->aspect;
- left = right - new_width;
- }
- else {
- left = x;
- new_height = (right - left) / area->priv->aspect;
- top = bottom - new_height;
- }
- break;
-
- case TOP:
- top = y;
- if (area->priv->aspect > 0) {
- new_width = (bottom - top) * area->priv->aspect;
- right = left + new_width;
- }
- break;
-
- case TOP_RIGHT:
- if (area->priv->aspect < 0) {
- top = y;
- right = x;
- }
- else if (y < eval_radial_line (center_x, center_y, right, top, x)) {
- top = y;
- new_width = (bottom - top) * area->priv->aspect;
- right = left + new_width;
- }
- else {
- right = x;
- new_height = (right - left) / area->priv->aspect;
- top = bottom - new_height;
- }
- break;
-
- case LEFT:
- left = x;
- if (area->priv->aspect > 0) {
- new_height = (right - left) / area->priv->aspect;
- bottom = top + new_height;
- }
- break;
-
- case BOTTOM_LEFT:
- if (area->priv->aspect < 0) {
- bottom = y;
- left = x;
- }
- else if (y < eval_radial_line (center_x, center_y, left, bottom, x)) {
- left = x;
- new_height = (right - left) / area->priv->aspect;
- bottom = top + new_height;
- }
- else {
- bottom = y;
- new_width = (bottom - top) * area->priv->aspect;
- left = right - new_width;
- }
- break;
-
- case RIGHT:
- right = x;
- if (area->priv->aspect > 0) {
- new_height = (right - left) / area->priv->aspect;
- bottom = top + new_height;
- }
- break;
-
- case BOTTOM_RIGHT:
- if (area->priv->aspect < 0) {
- bottom = y;
- right = x;
- }
- else if (y < eval_radial_line (center_x, center_y, right, bottom, x)) {
- right = x;
- new_height = (right - left) / area->priv->aspect;
- bottom = top + new_height;
- }
- else {
- bottom = y;
- new_width = (bottom - top) * area->priv->aspect;
- right = left + new_width;
- }
- break;
-
- case BOTTOM:
- bottom = y;
- if (area->priv->aspect > 0) {
- new_width = (bottom - top) * area->priv->aspect;
- right= left + new_width;
- }
- break;
-
- default:
- return FALSE;
- }
-
- min_width = area->priv->base_width / area->priv->scale;
- min_height = area->priv->base_height / area->priv->scale;
-
- width = right - left + 1;
- height = bottom - top + 1;
- if (area->priv->aspect < 0) {
- if (left < 0)
- left = 0;
- if (top < 0)
- top = 0;
- if (right > pb_width)
- right = pb_width;
- if (bottom > pb_height)
- bottom = pb_height;
-
- width = right - left + 1;
- height = bottom - top + 1;
-
- switch (area->priv->active_region) {
- case LEFT:
- case TOP_LEFT:
- case BOTTOM_LEFT:
- if (width < min_width)
- left = right - min_width;
- break;
- case RIGHT:
- case TOP_RIGHT:
- case BOTTOM_RIGHT:
- if (width < min_width)
- right = left + min_width;
- break;
-
- default: ;
- }
-
- switch (area->priv->active_region) {
- case TOP:
- case TOP_LEFT:
- case TOP_RIGHT:
- if (height < min_height)
- top = bottom - min_height;
- break;
- case BOTTOM:
- case BOTTOM_LEFT:
- case BOTTOM_RIGHT:
- if (height < min_height)
- bottom = top + min_height;
- break;
-
- default: ;
- }
- }
- else {
- if (left < 0 || top < 0 ||
- right > pb_width || bottom > pb_height ||
- width < min_width || height < min_height) {
- left = area->priv->crop.x;
- right = area->priv->crop.x + area->priv->crop.width - 1;
- top = area->priv->crop.y;
- bottom = area->priv->crop.y + area->priv->crop.height - 1;
- }
- }
-
- area->priv->crop.x = left;
- area->priv->crop.y = top;
- area->priv->crop.width = right - left + 1;
- area->priv->crop.height = bottom - top + 1;
-
- crop_to_widget (area, &damage);
- gtk_widget_queue_draw_area (widget,
- damage.x - 1, damage.y - 1,
- damage.width + 2, damage.height + 2);
-
- return FALSE;
-}
-
-static gboolean
-um_crop_area_button_press_event (GtkWidget *widget,
- GdkEventButton *event)
-{
- UmCropArea *area = UM_CROP_AREA (widget);
- GdkRectangle crop;
-
- if (area->priv->browse_pixbuf == NULL)
- return FALSE;
-
- crop_to_widget (area, &crop);
-
- area->priv->last_press_x = (event->x - area->priv->image.x) / area->priv->scale;
- area->priv->last_press_y = (event->y - area->priv->image.y) / area->priv->scale;
- area->priv->active_region = find_location (&crop, event->x, event->y);
-
- gtk_widget_queue_draw_area (widget,
- crop.x - 1, crop.y - 1,
- crop.width + 2, crop.height + 2);
-
- return FALSE;
-}
-
-static gboolean
-um_crop_area_button_release_event (GtkWidget *widget,
- GdkEventButton *event)
-{
- UmCropArea *area = UM_CROP_AREA (widget);
- GdkRectangle crop;
-
- if (area->priv->browse_pixbuf == NULL)
- return FALSE;
-
- crop_to_widget (area, &crop);
-
- area->priv->last_press_x = -1;
- area->priv->last_press_y = -1;
- area->priv->active_region = OUTSIDE;
-
- gtk_widget_queue_draw_area (widget,
- crop.x - 1, crop.y - 1,
- crop.width + 2, crop.height + 2);
-
- return FALSE;
-}
-
-static void
-um_crop_area_finalize (GObject *object)
-{
- UmCropArea *area = UM_CROP_AREA (object);
-
- if (area->priv->browse_pixbuf) {
- g_object_unref (area->priv->browse_pixbuf);
- area->priv->browse_pixbuf = NULL;
- }
- if (area->priv->pixbuf) {
- g_object_unref (area->priv->pixbuf);
- area->priv->pixbuf = NULL;
- }
- if (area->priv->color_shifted) {
- g_object_unref (area->priv->color_shifted);
- area->priv->color_shifted = NULL;
- }
-}
-
-static void
-um_crop_area_class_init (UmCropAreaClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- object_class->finalize = um_crop_area_finalize;
- widget_class->draw = um_crop_area_draw;
- widget_class->button_press_event = um_crop_area_button_press_event;
- widget_class->button_release_event = um_crop_area_button_release_event;
- widget_class->motion_notify_event = um_crop_area_motion_notify_event;
-
- g_type_class_add_private (klass, sizeof (UmCropAreaPrivate));
-}
-
-static void
-um_crop_area_init (UmCropArea *area)
-{
- area->priv = (G_TYPE_INSTANCE_GET_PRIVATE ((area), UM_TYPE_CROP_AREA,
- UmCropAreaPrivate));
-
- gtk_widget_add_events (GTK_WIDGET (area), GDK_POINTER_MOTION_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK);
-
- area->priv->scale = 0.0;
- area->priv->image.x = 0;
- area->priv->image.y = 0;
- area->priv->image.width = 0;
- area->priv->image.height = 0;
- area->priv->active_region = OUTSIDE;
- area->priv->base_width = 48;
- area->priv->base_height = 48;
- area->priv->aspect = 1;
-}
-
-GtkWidget *
-um_crop_area_new (void)
-{
- return g_object_new (UM_TYPE_CROP_AREA, NULL);
-}
-
-GdkPixbuf *
-um_crop_area_get_picture (UmCropArea *area)
-{
- gint width, height;
-
- width = gdk_pixbuf_get_width (area->priv->browse_pixbuf);
- height = gdk_pixbuf_get_height (area->priv->browse_pixbuf);
- width = MIN (area->priv->crop.width, width - area->priv->crop.x);
- height = MIN (area->priv->crop.height, height - area->priv->crop.y);
-
- return gdk_pixbuf_new_subpixbuf (area->priv->browse_pixbuf,
- area->priv->crop.x,
- area->priv->crop.y,
- width, height);
-}
-
-void
-um_crop_area_set_picture (UmCropArea *area,
- GdkPixbuf *pixbuf)
-{
- int width;
- int height;
-
- if (area->priv->browse_pixbuf) {
- g_object_unref (area->priv->browse_pixbuf);
- area->priv->browse_pixbuf = NULL;
- }
- if (pixbuf) {
- area->priv->browse_pixbuf = g_object_ref (pixbuf);
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- } else {
- width = 0;
- height = 0;
- }
-
- area->priv->crop.width = 2 * area->priv->base_width;
- area->priv->crop.height = 2 * area->priv->base_height;
- area->priv->crop.x = (width - area->priv->crop.width) / 2;
- area->priv->crop.y = (height - area->priv->crop.height) / 2;
-
- area->priv->scale = 0.0;
- area->priv->image.x = 0;
- area->priv->image.y = 0;
- area->priv->image.width = 0;
- area->priv->image.height = 0;
-
- gtk_widget_queue_draw (GTK_WIDGET (area));
-}
-
-void
-um_crop_area_set_min_size (UmCropArea *area,
- gint width,
- gint height)
-{
- area->priv->base_width = width;
- area->priv->base_height = height;
-
- if (area->priv->aspect > 0) {
- area->priv->aspect = area->priv->base_width / (gdouble)area->priv->base_height;
- }
-}
-
-void
-um_crop_area_set_constrain_aspect (UmCropArea *area,
- gboolean constrain)
-{
- if (constrain) {
- area->priv->aspect = area->priv->base_width / (gdouble)area->priv->base_height;
- }
- else {
- area->priv->aspect = -1;
- }
-}
-
diff --git a/panels/user-accounts/um-crop-area.h b/panels/user-accounts/um-crop-area.h
deleted file mode 100644
index 8992957..0000000
--- a/panels/user-accounts/um-crop-area.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright © 2009 Bastien Nocera <hadess@hadess.net>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _UM_CROP_AREA_H_
-#define _UM_CROP_AREA_H_
-
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define UM_TYPE_CROP_AREA (um_crop_area_get_type ())
-#define UM_CROP_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UM_TYPE_CROP_AREA, \
- UmCropArea))
-#define UM_CROP_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UM_TYPE_CROP_AREA, \
- UmCropAreaClass))
-#define UM_IS_CROP_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UM_TYPE_CROP_AREA))
-#define UM_IS_CROP_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UM_TYPE_CROP_AREA))
-#define UM_CROP_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UM_TYPE_CROP_AREA, \
- UmCropAreaClass))
-
-typedef struct _UmCropAreaClass UmCropAreaClass;
-typedef struct _UmCropArea UmCropArea;
-typedef struct _UmCropAreaPrivate UmCropAreaPrivate;
-
-struct _UmCropAreaClass {
- GtkDrawingAreaClass parent_class;
-};
-
-struct _UmCropArea {
- GtkDrawingArea parent_instance;
- UmCropAreaPrivate *priv;
-};
-
-GType um_crop_area_get_type (void) G_GNUC_CONST;
-
-GtkWidget *um_crop_area_new (void);
-GdkPixbuf *um_crop_area_get_picture (UmCropArea *area);
-void um_crop_area_set_picture (UmCropArea *area,
- GdkPixbuf *pixbuf);
-void um_crop_area_set_min_size (UmCropArea *area,
- gint width,
- gint height);
-void um_crop_area_set_constrain_aspect (UmCropArea *area,
- gboolean constrain);
-
-G_END_DECLS
-
-#endif /* _UM_CROP_AREA_H_ */
diff --git a/panels/user-accounts/um-photo-dialog.c b/panels/user-accounts/um-photo-dialog.c
index 13fa8e7..31205c8 100644
--- a/panels/user-accounts/um-photo-dialog.c
+++ b/panels/user-accounts/um-photo-dialog.c
@@ -36,7 +36,7 @@
#endif /* HAVE_CHEESE */
#include "um-photo-dialog.h"
-#include "um-crop-area.h"
+#include "cc-crop-area.h"
#include "um-utils.h"
#define ROW_SPAN 6
@@ -70,7 +70,7 @@ crop_dialog_response (GtkWidget *dialog,
return;
}
- pb = um_crop_area_get_picture (UM_CROP_AREA (um->crop_area));
+ pb = cc_crop_area_get_picture (CC_CROP_AREA (um->crop_area));
pb2 = gdk_pixbuf_scale_simple (pb, 96, 96, GDK_INTERP_BILINEAR);
set_user_icon_data (um->user, pb2);
@@ -105,10 +105,10 @@ um_photo_dialog_crop (UmPhotoDialog *um,
G_CALLBACK (crop_dialog_response), um);
/* Content */
- um->crop_area = um_crop_area_new ();
- um_crop_area_set_min_size (UM_CROP_AREA (um->crop_area), 48, 48);
- um_crop_area_set_constrain_aspect (UM_CROP_AREA (um->crop_area), TRUE);
- um_crop_area_set_picture (UM_CROP_AREA (um->crop_area), pixbuf);
+ um->crop_area = cc_crop_area_new ();
+ cc_crop_area_set_min_size (CC_CROP_AREA (um->crop_area), 48, 48);
+ cc_crop_area_set_constrain_aspect (CC_CROP_AREA (um->crop_area), TRUE);
+ cc_crop_area_set_picture (CC_CROP_AREA (um->crop_area), pixbuf);
frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (frame), um->crop_area);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
diff --git a/po/es.po b/po/es.po
index 767cb95..5d250d2 100644
diff --git a/po/kk.po b/po/kk.po
index 77df294..a025bdd 100644
diff --git a/po/ms.po b/po/ms.po
index dfca7e9..1f2d990 100644
diff --git a/po/nl.po b/po/nl.po
index dc3085f..8bce224 100644
diff --git a/po/ru.po b/po/ru.po
index 9d172ab..ebe503e 100644
diff --git a/shell/main.c b/shell/main.c
index 3bf139e..2eec2f5 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -37,6 +37,9 @@ main (int argc, char **argv)
GtkApplication *application;
int status;
+ /* FIXME: remove this when GOA uses WebKit2 */
+ g_setenv("G_TLS_GNUTLS_PRIORITY", "NORMAL:%COMPAT:!VERS-SSL3.0", FALSE);
+
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
Reply to: