/* Attachments Menu */
{ "/MenuBar/AttachmentsMenu", NULL },
{ "/MenuBar/AttachmentsMenu/ViewAttachmentMenu", G_CALLBACK(modest_ui_dimming_rules_on_view_attachments) },
- { "/MenuBar/AttachmentsMenu/SaveAttachmentMenu", G_CALLBACK(modest_ui_dimming_rules_on_view_attachments) },
+ { "/MenuBar/AttachmentsMenu/SaveAttachmentMenu", G_CALLBACK(modest_ui_dimming_rules_on_save_attachments) },
{ "/MenuBar/AttachmentsMenu/RemoveAttachmentMenu", G_CALLBACK(modest_ui_dimming_rules_on_remove_attachments) },
/* Tools Menu */
{ "/MenuBar/ToolsMenu", NULL },
- { "/MenuBar/ToolsMenu/ToolsContactsMenu", },
+ { "/MenuBar/ToolsMenu/ToolsAddToContactsMenu", G_CALLBACK (modest_ui_dimming_rules_on_add_to_contacts) },
/* Close Menu */
{ "/MenuBar/CloseMenu", NULL },
#include "modest-ui-dimming-rules.h"
#include "modest-dimming-rule.h"
#include "modest-tny-folder.h"
+#include "modest-text-utils.h"
#include <widgets/modest-attachments-view.h>
#include <modest-runtime.h>
#include <tny-simple-list.h>
return dimmed;
}
+gboolean
+modest_ui_dimming_rules_on_add_to_contacts (ModestWindow *win, gpointer user_data)
+{
+ ModestDimmingRule *rule = NULL;
+ gboolean dimmed = FALSE;
+
+ g_return_val_if_fail (MODEST_IS_DIMMING_RULE (user_data), FALSE);
+ rule = MODEST_DIMMING_RULE (user_data);
+
+ /* Check dimmed rule */
+ if (!dimmed) {
+ GtkClipboard *clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
+ gchar *selection = NULL;
+ selection = gtk_clipboard_wait_for_text (clipboard);
+
+ dimmed = !((selection != NULL) && (modest_text_utils_validate_recipient (selection)));
+ }
+
+ return dimmed;
+}
+
/* *********************** static utility functions ******************** */
static gboolean
gboolean modest_ui_dimming_rules_on_tools_smtp_servers (ModestWindow *win, gpointer user_data);
gboolean modest_ui_dimming_rules_on_cancel_sending (ModestWindow *win, gpointer user_data);
gboolean modest_ui_dimming_rules_on_send_receive (ModestWindow *win, gpointer user_data);
+gboolean modest_ui_dimming_rules_on_add_to_contacts (ModestWindow *win, gpointer user_data);
G_END_DECLS
#endif