modest_window_add_to_menu.
g_return_if_fail (MODEST_IS_ACCOUNTS_WINDOW(self));
/* Settings menu buttons */
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_new_account"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_on_new_account),
- NULL);
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self),
- dngettext(GETTEXT_PACKAGE,
- "mcen_me_edit_account",
- "mcen_me_edit_accounts",
- 2),
- NULL,
- APP_MENU_CALLBACK (modest_ui_actions_on_accounts),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_edit_accounts));
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_globalsmtpservers"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_on_smtp_servers),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_tools_smtp_servers));
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_sendandreceive"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_on_send_receive),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_send_receive_all));
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_outbox_cancelsend"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_cancel_send),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_cancel_sending_all));
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_options"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_on_settings),
- NULL);
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_new_account"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_new_account),
+ NULL);
+ modest_window_add_to_menu (MODEST_WINDOW (self),
+ dngettext(GETTEXT_PACKAGE,
+ "mcen_me_edit_account",
+ "mcen_me_edit_accounts",
+ 2),
+ NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_accounts),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_edit_accounts));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_inbox_globalsmtpservers"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_smtp_servers),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_tools_smtp_servers));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_inbox_sendandreceive"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_send_receive),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_send_receive_all));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_outbox_cancelsend"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_cancel_send),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_cancel_sending_all));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_inbox_options"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_settings),
+ NULL);
}
g_return_if_fail (MODEST_IS_FOLDER_WINDOW(self));
/* folders actions */
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_new_folder"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_on_new_folder),
- NULL);
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_rename_folder"), NULL,
- APP_MENU_CALLBACK (set_rename_edit_mode),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_rename_folder));
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_move_folder"), NULL,
- APP_MENU_CALLBACK (set_moveto_edit_mode),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_folder_window_move_to));
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_delete_folder"), NULL,
- APP_MENU_CALLBACK (set_delete_edit_mode),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_folder_window_delete));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_new_folder"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_new_folder),
+ NULL);
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_rename_folder"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (set_rename_edit_mode),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_rename_folder));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_move_folder"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (set_moveto_edit_mode),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_folder_window_move_to));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_delete_folder"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (set_delete_edit_mode),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_folder_window_delete));
/* send receive actions should be only one visible always */
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_sendandreceive"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_on_send_receive),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_send_receive));
-
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_outbox_cancelsend"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_cancel_send),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_cancel_sending_all));
-
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self),
- dngettext(GETTEXT_PACKAGE,
- "mcen_me_edit_account",
- "mcen_me_edit_accounts",
- 1),
- NULL, APP_MENU_CALLBACK (edit_account),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_edit_accounts));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_inbox_sendandreceive"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_send_receive),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_send_receive));
+
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_outbox_cancelsend"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_cancel_send),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_cancel_sending_all));
+
+ modest_window_add_to_menu (MODEST_WINDOW (self),
+ dngettext(GETTEXT_PACKAGE,
+ "mcen_me_edit_account",
+ "mcen_me_edit_accounts",
+ 1),
+ NULL, MODEST_WINDOW_MENU_CALLBACK (edit_account),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_edit_accounts));
}
static void
g_return_if_fail (MODEST_IS_HEADER_WINDOW(self));
priv = MODEST_HEADER_WINDOW_GET_PRIVATE (self);
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_new_message"), "<Control>n",
- APP_MENU_CALLBACK (modest_ui_actions_on_new_msg),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_new_msg));
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self),
- dngettext(GETTEXT_PACKAGE,
- "mcen_me_move_message",
- "mcen_me_move_messages",
- 2),
- NULL,
- APP_MENU_CALLBACK (set_moveto_edit_mode),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_move_to));
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_delete_messages"), NULL,
- APP_MENU_CALLBACK (set_delete_edit_mode),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_delete));
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_folder_details"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_on_details),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_details));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_new_message"), "<Control>n",
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_new_msg),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_new_msg));
+ modest_window_add_to_menu (MODEST_WINDOW (self),
+ dngettext(GETTEXT_PACKAGE,
+ "mcen_me_move_message",
+ "mcen_me_move_messages",
+ 2),
+ NULL,
+ MODEST_WINDOW_MENU_CALLBACK (set_moveto_edit_mode),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_move_to));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_delete_messages"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (set_delete_edit_mode),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_delete));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_folder_details"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_details),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_details));
priv->sort_button = hildon_button_new (MODEST_EDITABLE_SIZE,
HILDON_BUTTON_ARRANGEMENT_VERTICAL);
hildon_button_set_title (HILDON_BUTTON (priv->sort_button), _("mcen_me_sort"));
hildon_button_set_value_alignment (HILDON_BUTTON (priv->sort_button), 0.5, 0.5);
modest_hildon2_window_add_button_to_menu (MODEST_HILDON2_WINDOW (self), GTK_BUTTON (priv->sort_button),
modest_ui_dimming_rules_on_sort);
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_sendandreceive"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_on_send_receive),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_send_receive));
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_outbox_cancelsend"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_cancel_send),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_cancel_sending_all));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_inbox_sendandreceive"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_send_receive),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_send_receive));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_outbox_cancelsend"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_cancel_send),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_cancel_sending_all));
}
static void
gboolean show_toolbar);
static void modest_hildon2_window_add_toolbar (ModestWindow *self,
GtkToolbar *toolbar);
+static void modest_hildon2_window_add_to_menu (ModestWindow *window,
+ const gchar *label,
+ const gchar *accelerator,
+ ModestWindowMenuCallback callback,
+ ModestDimmingCallback dimming_callback);
static void modest_hildon2_window_set_title (ModestWindow *self,
const gchar *title);
static gboolean modest_hildon2_window_toggle_menu (HildonWindow *window,
modest_window_class->zoom_plus_func = on_zoom_minus_plus_not_implemented;
modest_window_class->show_toolbar_func = modest_hildon2_window_show_toolbar;
modest_window_class->add_toolbar_func = modest_hildon2_window_add_toolbar;
+ modest_window_class->add_to_menu_func = modest_hildon2_window_add_to_menu;
modest_window_class->set_title_func = modest_hildon2_window_set_title;
modest_window_class->show_progress_func = modest_hildon2_window_show_progress;
gtk_widget_show (GTK_WIDGET (button));
}
-void
+static void
modest_hildon2_window_add_to_menu (ModestHildon2Window *self,
gchar *label,
const gchar *accelerator,
- ModestHildon2AppMenuCallback callback,
+ ModestWindowMenuCallback callback,
ModestDimmingCallback dimming_callback)
{
ModestHildon2WindowPrivate *priv = NULL;
void (*edit_mode_changed) (ModestHildon2Window *self, gint edit_mode, gboolean enabled);
};
-typedef void (*ModestHildon2AppMenuCallback) (GObject *control, gpointer userdata);
typedef gboolean (*ModestHildon2EditModeCallback) (ModestHildon2Window *self);
-#define APP_MENU_CALLBACK(x) ((ModestHildon2AppMenuCallback) (x))
#define EDIT_MODE_CALLBACK(x) ((ModestHildon2EditModeCallback) (x))
/* edit mode id for no edit mode */
*/
GType modest_hildon2_window_get_type (void) G_GNUC_CONST;
-/**
- * modest_hildon2_window_add_to_menu:
- * @self: a #ModestHildon2Window
- * @label: the label of the button added to menu
- * @callback: a #ModestHildon2AppMenuCallback
- * @dimming_callback: a #ModestDimmingCallback or %NULL for no dimming rule
- *
- * creates a button in the window #HildonAppMenu, with label @label.
- * It will call @callback, and will configure @dimming_callback for
- * dimming.
- */
-void
-modest_hildon2_window_add_to_menu (ModestHildon2Window *self,
- gchar *label,
- const gchar *accelerator,
- ModestHildon2AppMenuCallback callback,
- ModestDimmingCallback dimming_callback);
/**
* modest_hildon2_window_add_button_to_menu:
priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self);
/* Settings menu buttons */
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_editor_checknames"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_on_check_names),
- NULL);
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_undo"), "<Ctrl>z",
- APP_MENU_CALLBACK (modest_ui_actions_on_undo),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_undo));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_editor_checknames"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_check_names),
+ NULL);
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_inbox_undo"), "<Ctrl>z",
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_undo),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_undo));
priv->cc_button = hildon_check_button_new (0);
gtk_button_set_label (GTK_BUTTON (priv->cc_button), _("mcen_me_editor_showcc"));
gtk_button_set_alignment (GTK_BUTTON (priv->bcc_button), 0.5, 0.5);
gtk_button_set_alignment (GTK_BUTTON (priv->bcc_button), 0.5, 0.5);
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_editor_attach_inlineimage"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_on_insert_image),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_set_style));
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_editor_add_attachment"), NULL,
- APP_MENU_CALLBACK (modest_msg_edit_window_add_attachment_clicked),
- NULL);
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_remove_attachments"), NULL,
- APP_MENU_CALLBACK (modest_ui_actions_on_remove_attachments),
- MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_editor_remove_attachment));
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_message_settings"), NULL,
- APP_MENU_CALLBACK (on_message_settings),
- NULL);
- modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_viewer_find"), "<Ctrl>f",
- APP_MENU_CALLBACK (modest_ui_actions_on_toggle_find_in_page),
- NULL);
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_editor_attach_inlineimage"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_insert_image),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_set_style));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_editor_add_attachment"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_msg_edit_window_add_attachment_clicked),
+ NULL);
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_inbox_remove_attachments"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_remove_attachments),
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_editor_remove_attachment));
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_message_settings"), NULL,
+ MODEST_WINDOW_MENU_CALLBACK (on_message_settings),
+ NULL);
+ modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_viewer_find"), "<Ctrl>f",
+ MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_toggle_find_in_page),
+ NULL);
}
static void
#include <glib-object.h>
#include <gtk/gtk.h>
+#include <modest-shell-window.h>
G_BEGIN_DECLS
static void modest_window_add_toolbar_default (ModestWindow *window,
GtkToolbar *toolbar);
+static void modest_window_add_to_menu_default (ModestWindow *self,
+ const gchar *label,
+ const gchar *accelerator,
+ ModestWindowMenuCallback callback,
+ ModestDimmingCallback dimming_callback);
+
static void modest_window_set_title_default (ModestWindow *window,
const gchar *title);
klass->zoom_minus_func = modest_window_zoom_minus_default;
klass->show_toolbar_func = modest_window_show_toolbar_default;
klass->add_toolbar_func = modest_window_add_toolbar_default;
+ klass->add_to_menu_func = modest_window_add_to_menu_default;
klass->set_title_func = modest_window_set_title_default;
klass->disconnect_signals_func = modest_window_disconnect_signals_default;
klass->show_progress_func = modest_window_show_progress_default;
}
void
+modest_window_add_to_menu (ModestWindow *window,
+ const gchar *label,
+ const gchar *accelerator,
+ ModestWindowMenuCallback callback,
+ ModestDimmingCallback dimming_callback);
+{
+ MODEST_WINDOW_GET_CLASS (window)->add_to_menu_func (window,
+ label,
+ accelerator,
+ callback,
+ dimming_callback);
+}
+
+void
modest_window_set_title (ModestWindow *window,
const gchar *title)
{
}
static void
+modest_window_add_to_menu_default (ModestWindow *window,
+ const gchar *label,
+ const gchar *accelerator,
+ ModestWindowMenuCallback callback,
+ ModestDimmingCallback dimming_callback);
+{
+ g_warning ("modest: You should implement %s", __FUNCTION__);
+}
+
+static void
modest_window_set_title_default (ModestWindow *window,
const gchar *title)
{
#ifndef __MODEST_WINDOW_H__
#define __MODEST_WINDOW_H__
-#include <glib-object.h>
-#include <tny-account-store.h>
-
-G_BEGIN_DECLS
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
+#include <glib-object.h>
#include <gtk/gtk.h>
-
+#include <modest-dimming-rule.h>
+
+G_BEGIN_DECLS
+
/*
* admittedly, the ifdefs for gtk and maemo are rather ugly; still
* this way is probably the easiest to maintain
typedef struct _ModestWindow ModestWindow;
typedef struct _ModestWindowClass ModestWindowClass;
+typedef void (*ModestWindowMenuCallback) (GObject *control, gpointer userdata);
+#define MODEST_WINDOW_MENU_CALLBACK(x) ((ModestWindowMenuCallback) (x))
+
struct _ModestWindow {
ModestWindowParent parent;
};
void (*show_progress_func) (ModestWindow *self, gboolean show);
void (*add_toolbar_func) (ModestWindow *self, GtkToolbar *toolbar);
void (*set_title_func) (ModestWindow *self, const gchar *title);
+ void (*add_to_menu_func) (ModestWindow *self,
+ const gchar *label,
+ const gchar *accelerator,
+ ModestWindowMenuCallback callback,
+ ModestDimmingCallback dimming_callback);
};
/**
void modest_window_set_title (ModestWindow *self, const gchar *title);
+/**
+ * modest_window_add_to_menu:
+ * @self: a #ModestWindow
+ * @label: the label of the button added to menu
+ * @callback: a #ModestWindowMenuCallback
+ * @dimming_callback: a #ModestDimmingCallback or %NULL for no dimming rule
+ *
+ * creates a menu item in the window @self, with label @label.
+ * It will call @callback, and will configure @dimming_callback for
+ * dimming.
+ */
+void modest_window_add_to_menu (ModestWindow *self,
+ const gchar *label,
+ const gchar *accelerator,
+ ModestWindowMenuCallback callback,
+ ModestDimmingCallback dimming_callback);
+
+
G_END_DECLS