aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2014-08-01 01:15:44 +0800
committerMilan Crha <mcrha@redhat.com>2014-08-01 01:15:44 +0800
commitbb3a6069c17573ab08e6bb1a3c0fe51f9c7d6a41 (patch)
tree6cad4b3d570e4666c1bddc01107e0cd61d6c1abb
parent959d8034aae6b214e2a540e54b708f173e2803fe (diff)
downloadgsoc2013-evolution-bb3a6069c17573ab08e6bb1a3c0fe51f9c7d6a41.tar
gsoc2013-evolution-bb3a6069c17573ab08e6bb1a3c0fe51f9c7d6a41.tar.gz
gsoc2013-evolution-bb3a6069c17573ab08e6bb1a3c0fe51f9c7d6a41.tar.bz2
gsoc2013-evolution-bb3a6069c17573ab08e6bb1a3c0fe51f9c7d6a41.tar.lz
gsoc2013-evolution-bb3a6069c17573ab08e6bb1a3c0fe51f9c7d6a41.tar.xz
gsoc2013-evolution-bb3a6069c17573ab08e6bb1a3c0fe51f9c7d6a41.tar.zst
gsoc2013-evolution-bb3a6069c17573ab08e6bb1a3c0fe51f9c7d6a41.zip
Bug 733918 - Color chooser for citation color is not working in Composer
-rw-r--r--e-util/e-color-chooser-widget.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/e-util/e-color-chooser-widget.c b/e-util/e-color-chooser-widget.c
index c1357ea572..7091324e1f 100644
--- a/e-util/e-color-chooser-widget.c
+++ b/e-util/e-color-chooser-widget.c
@@ -53,6 +53,8 @@ G_DEFINE_TYPE (
e_color_chooser_widget,
GTK_TYPE_COLOR_CHOOSER_WIDGET);
+static gboolean (* origin_swatch_button_press_event) (GtkWidget *widget, GdkEventButton *event);
+
/* UGLY UGLY UGLY!
* GtkColorChooserWidget sends "color-activated" signal
* only when user double-clicks the color. This is totally stupid
@@ -71,15 +73,23 @@ static gboolean
color_chooser_widget_button_press_event (GtkWidget *widget,
GdkEventButton *event)
{
- if ((event->type == GDK_BUTTON_PRESS) &&
- (event->button == GDK_BUTTON_PRIMARY)) {
+ GtkWidget *parent;
- g_signal_emit_by_name (widget, "activate");
+ g_return_val_if_fail (origin_swatch_button_press_event != NULL, FALSE);
+
+ /* Override the behaviour only for GtkColorSwatch which is part of the EColorChooserWidget */
+ parent = widget;
+ while (parent && !E_IS_COLOR_CHOOSER_WIDGET (parent))
+ parent = gtk_widget_get_parent (parent);
+ if (parent &&
+ event->type == GDK_BUTTON_PRESS &&
+ event->button == GDK_BUTTON_PRIMARY) {
+ g_signal_emit_by_name (widget, "activate");
return TRUE;
}
- return FALSE;
+ return origin_swatch_button_press_event (widget, event);
}
static void
@@ -230,6 +240,7 @@ e_color_chooser_widget_init (EColorChooserWidget *widget)
if (swatch) {
GtkWidgetClass *swatch_class;
swatch_class = GTK_WIDGET_GET_CLASS (swatch);
+ origin_swatch_button_press_event = swatch_class->button_press_event;
swatch_class->button_press_event = color_chooser_widget_button_press_event;
}