const gchar *new_account);
static GtkWidget *_create_addressbook_box (GtkSizeGroup *title_size_group, GtkSizeGroup *value_size_group,
const gchar *label, GtkWidget *control);
+static void max_chars_banner_unref (ModestMsgEditWindow *self, GObject *old_ref);
static void DEBUG_BUFFER (WPTextBuffer *buffer)
{
#ifdef DEBUG
GtkWidget *app_menu;
GtkWidget *cc_button;
GtkWidget *bcc_button;
+
+ GtkWidget *max_chars_banner;
};
#define MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
priv->references = NULL;
priv->in_reply_to = NULL;
+ priv->max_chars_banner = NULL;
if (!is_wp_text_buffer_started) {
is_wp_text_buffer_started = TRUE;
modest_msg_edit_window_finalize (GObject *obj)
{
ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (obj);
-
+
+ if (priv->max_chars_banner) {
+ g_object_weak_unref (G_OBJECT (priv->max_chars_banner), (GWeakNotify) max_chars_banner_unref, obj);
+ priv->max_chars_banner = FALSE;
+ }
+
/* Sanity check: shouldn't be needed, the window mgr should
call this function before */
modest_msg_edit_window_disconnect_signals (MODEST_WINDOW (obj));
priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
if (editor == NULL) {
- GtkWidget *view_focus;
+ GtkWidget *view_focus, *parent;
view_focus = gtk_window_get_focus (GTK_WINDOW (window));
/* This code should be kept in sync with ModestRecptEditor. The
hbox recpt editor inherits from, we'll need to go up in the
hierarchy to know if the text view is part of the recpt editor
or if it's a different text entry */
-
- if (gtk_widget_get_parent (view_focus)) {
- GtkWidget *first_parent;
-
- first_parent = gtk_widget_get_parent (view_focus);
- if (gtk_widget_get_parent (first_parent) &&
- MODEST_IS_RECPT_EDITOR (gtk_widget_get_parent (first_parent))) {
- editor = MODEST_RECPT_EDITOR (gtk_widget_get_parent (first_parent));
- }
- }
+ parent = gtk_widget_get_parent (view_focus);
+ if (parent && MODEST_IS_RECPT_EDITOR (parent))
+ editor = MODEST_RECPT_EDITOR (parent);
if (editor == NULL)
editor = MODEST_RECPT_EDITOR (priv->to_field);
-
}
modest_address_book_select_addresses (editor, GTK_WINDOW (window));
gint offset;
glong utf8_len;
+ ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
+
gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buffer), &end_iter);
offset = gtk_text_iter_get_offset (&end_iter);
}
if (offset + utf8_len > MAX_BODY_LENGTH) {
- hildon_banner_show_information (GTK_WIDGET (window), NULL,
- _CS("ckdg_ib_maximum_characters_reached"));
+ if (priv->max_chars_banner == NULL) {
+ priv->max_chars_banner = hildon_banner_show_information (GTK_WIDGET (window), NULL,
+ _CS("ckdg_ib_maximum_characters_reached"));
+ g_object_weak_ref (G_OBJECT (priv->max_chars_banner), (GWeakNotify) max_chars_banner_unref, window);
+ }
}
}
box = gtk_hbox_new (FALSE, 0);
- align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
+ align = gtk_alignment_new (0.0, 0.0, 1.0, 0.0);
gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 0, MODEST_MARGIN_DEFAULT);
abook_button = hildon_gtk_button_new (HILDON_SIZE_FINGER_HEIGHT);
return box;
}
+
+static void
+max_chars_banner_unref (ModestMsgEditWindow *self, GObject *old_ref)
+{
+ ModestMsgEditWindowPrivate *priv = NULL;
+
+ g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW(self));
+
+ priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self);
+ priv->max_chars_banner = NULL;
+}