static gboolean modest_msg_view_window_key_event (GtkWidget *window,
GdkEventKey *event,
gpointer userdata);
+static gboolean modest_msg_view_window_toggle_menu (HildonWindow *window,
+ guint button,
+ guint32 time);
static void modest_msg_view_window_update_priority (ModestMsgViewWindow *window);
static void modest_msg_view_window_show_toolbar (ModestWindow *window,
static void add_to_menu (ModestMsgViewWindow *self,
HildonAppMenu *menu,
gchar *label,
- GCallback callback);
-static void setup_menu (ModestMsgViewWindow *self);
+ GCallback callback,
+ ModestDimmingRulesGroup *group,
+ GCallback dimming_callback);
+static void setup_menu (ModestMsgViewWindow *self,
+ ModestDimmingRulesGroup *group);
/* list my signals */
enum {
modest_msg_view_window_class_init (ModestMsgViewWindowClass *klass)
{
GObjectClass *gobject_class;
+ HildonWindowClass *hildon_window_class;
ModestWindowClass *modest_window_class;
GtkBindingSet *binding_set;
gobject_class = (GObjectClass*) klass;
+ hildon_window_class = (HildonWindowClass *) klass;
modest_window_class = (ModestWindowClass *) klass;
parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = modest_msg_view_window_finalize;
+ hildon_window_class->toggle_menu = modest_msg_view_window_toggle_menu;
+
modest_window_class->set_zoom_func = modest_msg_view_window_set_zoom;
modest_window_class->get_zoom_func = modest_msg_view_window_get_zoom;
modest_window_class->zoom_minus_func = modest_msg_view_window_zoom_minus;
priv->msg_uid = g_strdup (msg_uid);
/* Menubar */
- setup_menu (self);
parent_priv->menubar = NULL;
parent_priv->ui_dimming_manager = modest_ui_dimming_manager_new();
toolbar_rules_group = modest_dimming_rules_group_new (MODEST_DIMMING_RULES_TOOLBAR, TRUE);
clipboard_rules_group = modest_dimming_rules_group_new (MODEST_DIMMING_RULES_CLIPBOARD, FALSE);
+ setup_menu (self, menu_rules_group);
/* Add common dimming rules */
modest_dimming_rules_group_add_rules (menu_rules_group,
modest_msg_view_menu_dimming_entries,
ModestWindowMgr *mgr;
ModestWindow *msg_win = NULL;
gboolean found;
-
+
header = tny_msg_get_header (TNY_MSG (mime_part));
- mgr = modest_runtime_get_window_mgr ();
+ mgr = modest_runtime_get_window_mgr ();
found = modest_window_mgr_find_registered_header (mgr, header, &msg_win);
if (found) {
/* if it's found, but there is no msg_win, it's probably in the process of being created;
* thus, we don't do anything */
g_warning ("window for is already being created");
- } else {
+ } else {
/* it's not found, so create a new window for it */
modest_window_mgr_register_header (mgr, header, attachment_uid); /* register the uid before building the window */
gchar *account = g_strdup (modest_window_get_active_account (MODEST_WINDOW (window)));
if (!account)
account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr ());
msg_win = modest_msg_view_window_new_for_attachment (TNY_MSG (mime_part), account, attachment_uid);
- modest_window_set_zoom (MODEST_WINDOW (msg_win),
+ modest_window_set_zoom (MODEST_WINDOW (msg_win),
modest_window_get_zoom (MODEST_WINDOW (window)));
modest_window_mgr_register_window (mgr, msg_win, MODEST_WINDOW (window));
gtk_widget_show_all (GTK_WIDGET (msg_win));
add_to_menu (ModestMsgViewWindow *self,
HildonAppMenu *menu,
gchar *label,
- GCallback callback)
+ GCallback callback,
+ ModestDimmingRulesGroup *dimming_group,
+ GCallback dimming_callback)
{
GtkWidget *button;
button = gtk_button_new_with_label (label);
g_signal_connect_after (G_OBJECT (button), "clicked",
callback, (gpointer) self);
+ modest_dimming_rules_group_add_widget_rule (dimming_group,
+ button,
+ dimming_callback,
+ MODEST_WINDOW (self));
hildon_app_menu_append (menu, GTK_BUTTON (button));
}
static void
-setup_menu (ModestMsgViewWindow *self)
+setup_menu (ModestMsgViewWindow *self, ModestDimmingRulesGroup *group)
{
ModestMsgViewWindowPrivate *priv = NULL;
GtkWidget *app_menu;
/* Settings menu buttons */
add_to_menu (self, HILDON_APP_MENU (app_menu), _("mcen_me_inbox_reply"),
- G_CALLBACK (modest_ui_actions_on_reply));
+ G_CALLBACK (modest_ui_actions_on_reply),
+ group, G_CALLBACK (modest_ui_dimming_rules_on_reply_msg));
add_to_menu (self, HILDON_APP_MENU (app_menu), _("mcen_me_inbox_replytoall"),
- G_CALLBACK (modest_ui_actions_on_reply_all));
+ G_CALLBACK (modest_ui_actions_on_reply_all),
+ group, G_CALLBACK (modest_ui_dimming_rules_on_reply_msg));
add_to_menu (self, HILDON_APP_MENU (app_menu), _("mcen_me_inbox_forward"),
- G_CALLBACK (modest_ui_actions_on_forward));
+ G_CALLBACK (modest_ui_actions_on_forward),
+ group, G_CALLBACK (modest_ui_dimming_rules_on_reply_msg));
add_to_menu (self, HILDON_APP_MENU (app_menu), _("mcen_me_viewer_newemail"),
- G_CALLBACK (modest_ui_actions_on_new_msg));
+ G_CALLBACK (modest_ui_actions_on_new_msg),
+ group, G_CALLBACK (modest_ui_dimming_rules_on_new_msg));
add_to_menu (self, HILDON_APP_MENU (app_menu), _("mcen_me_inbox_messagedetails"),
- G_CALLBACK (modest_ui_actions_on_details));
+ G_CALLBACK (modest_ui_actions_on_details),
+ group, G_CALLBACK (modest_ui_dimming_rules_on_details));
add_to_menu (self, HILDON_APP_MENU (app_menu), _("mcen_me_viewer_save_attachments"),
- G_CALLBACK (modest_ui_actions_save_attachments));
+ G_CALLBACK (modest_ui_actions_save_attachments),
+ group, G_CALLBACK (modest_ui_dimming_rules_on_save_attachments));
add_to_menu (self, HILDON_APP_MENU (app_menu), _("mcen_me_inbox_remove_attachments"),
- G_CALLBACK (modest_ui_actions_remove_attachments));
+ G_CALLBACK (modest_ui_actions_remove_attachments),
+ group, G_CALLBACK (modest_ui_dimming_rules_on_remove_attachments));
add_to_menu (self, HILDON_APP_MENU (app_menu), _("mcen_me_viewer_addtocontacts"),
- G_CALLBACK (modest_ui_actions_on_add_to_contacts));
+ G_CALLBACK (modest_ui_actions_on_add_to_contacts),
+ group, G_CALLBACK (modest_ui_dimming_rules_on_add_to_contacts));
-
hildon_stackable_window_set_main_menu (HILDON_STACKABLE_WINDOW (self),
HILDON_APP_MENU (app_menu));
}
+
+static gboolean
+modest_msg_view_window_toggle_menu (HildonWindow *window,
+ guint button,
+ guint32 time)
+{
+ modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (window));
+
+ return HILDON_WINDOW_CLASS (parent_class)->toggle_menu (window, button, time);
+}