From: Sergio Villar SenĂ­n Date: Wed, 18 Nov 2009 13:13:12 +0000 (+0100) Subject: Overwritten the clicked method of the HildonColorButton of editor. X-Git-Tag: 3.2.1~5 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=422e9a63f72fdbb620e0986908549583b15c1b25 Overwritten the clicked method of the HildonColorButton of editor. Now it will show the Calendar color picker instead of Hildon color picker --- diff --git a/src/hildon2/modest-msg-edit-window.c b/src/hildon2/modest-msg-edit-window.c index 65ffe86..a81374c 100644 --- a/src/hildon2/modest-msg-edit-window.c +++ b/src/hildon2/modest-msg-edit-window.c @@ -76,6 +76,9 @@ #include "modest-maemo-utils.h" #include +#ifdef MODEST_USE_CALENDAR_WIDGETS +#include +#endif #define DEFAULT_FONT_SIZE 3 #define DEFAULT_FONT 2 @@ -1478,6 +1481,21 @@ set_msg (ModestMsgEditWindow *self, TnyMsg *msg, gboolean preserve_is_rich) g_free (bcc); } +#ifdef MODEST_USE_CALENDAR_WIDGETS +static void +color_button_clicked (GtkButton *button) +{ + /* Show ColorPicker dialog */ + PipCalendarColor color = pip_color_picker_select_color(PipTextColorRed, PipColorPickerText); + + /* Check if some color is selected rather than dialog is dismissed */ + if (color != PipCalendarColorInvalid) { + GdkColor *gdk_color = (GdkColor *) pip_calendar_color_get_gdkcolor(color); + if (gdk_color) + hildon_color_button_set_color ((HildonColorButton *) button, gdk_color); + } +} +#endif static void modest_msg_edit_window_setup_toolbar (ModestMsgEditWindow *window) @@ -1521,6 +1539,13 @@ modest_msg_edit_window_setup_toolbar (ModestMsgEditWindow *window) G_CALLBACK (modest_msg_edit_window_color_button_change), window); + /* Yes I know this is a horrible hack, but it works for the + moment while we don't create a ModestColorButton */ +#ifdef MODEST_USE_CALENDAR_WIDGETS + GtkButtonClass *button_class = GTK_BUTTON_CLASS (HILDON_COLOR_BUTTON_GET_CLASS (priv->font_color_button)); + button_class->clicked = color_button_clicked; +#endif + /* Font size and face placeholder */ placeholder = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar/FontAttributes"); insert_index = gtk_toolbar_get_item_index(GTK_TOOLBAR (parent_priv->toolbar), GTK_TOOL_ITEM(placeholder)); @@ -2195,14 +2220,13 @@ text_buffer_refresh_attributes (WPTextBuffer *buffer, ModestMsgEditWindow *windo void modest_msg_edit_window_select_color (ModestMsgEditWindow *window) { - WPTextBufferFormat *buffer_format = g_new0 (WPTextBufferFormat, 1); ModestMsgEditWindowPrivate *priv; GtkWidget *dialog = NULL; priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window); wp_text_buffer_get_attributes (WP_TEXT_BUFFER (priv->text_buffer), buffer_format, FALSE); - + dialog = hildon_color_chooser_new (); hildon_color_chooser_set_color (HILDON_COLOR_CHOOSER (dialog), &(buffer_format->color)); g_free (buffer_format); @@ -2220,7 +2244,6 @@ modest_msg_edit_window_select_color (ModestMsgEditWindow *window) void modest_msg_edit_window_select_background_color (ModestMsgEditWindow *window) { - ModestMsgEditWindowPrivate *priv; GtkWidget *dialog = NULL; GdkColor *old_color = NULL;