X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fwidgets%2Fmodest-window.h;h=64a68e8cc73f6e0a06893623f5e41b76678c0a16;hp=45a267cb7d38f6753ddccfa6e05c321e4669518a;hb=514d7488390a9c4c31a9ca5e44f78dc9329b833d;hpb=5f456f4b288067f9de646b31adabedef5a7171af diff --git a/src/widgets/modest-window.h b/src/widgets/modest-window.h index 45a267c..64a68e8 100644 --- a/src/widgets/modest-window.h +++ b/src/widgets/modest-window.h @@ -30,38 +30,29 @@ #ifndef __MODEST_WINDOW_H__ #define __MODEST_WINDOW_H__ -#include -#include - -G_BEGIN_DECLS - #ifdef HAVE_CONFIG_H #include #endif /*HAVE_CONFIG_H*/ +#include #include - + +G_BEGIN_DECLS + /* * admittedly, the ifdefs for gtk and maemo are rather ugly; still * this way is probably the easiest to maintain */ #ifdef MODEST_TOOLKIT_GTK -typedef GtkWindow ModestWindowParent; -typedef GtkWindowClass ModestWindowParentClass; -#else -#if MODEST_HILDON_API == 0 -#include +typedef GtkVBox ModestWindowParent; +typedef GtkVBoxClass ModestWindowParentClass; #else #ifdef MODEST_TOOLKIT_HILDON2 #include -#else -#include -#endif -#endif /*MODEST_HILDON_API == 0*/ -#ifdef MODEST_TOOLKIT_HILDON2 typedef HildonStackableWindow ModestWindowParent; typedef HildonStackableWindowClass ModestWindowParentClass; #else +#include typedef HildonWindow ModestWindowParent; typedef HildonWindowClass ModestWindowParentClass; #endif @@ -99,6 +90,12 @@ typedef struct _DimmedState { typedef struct _ModestWindow ModestWindow; typedef struct _ModestWindowClass ModestWindowClass; +typedef void (*ModestWindowMenuCallback) (GObject *control, gpointer userdata); +typedef gboolean (*ModestDimmingCallback) (ModestWindow *self, gpointer user_data); + +#define MODEST_WINDOW_MENU_CALLBACK(x) ((ModestWindowMenuCallback) (x)) +#define MODEST_DIMMING_CALLBACK(x) ((ModestDimmingCallback) (x)) + struct _ModestWindow { ModestWindowParent parent; }; @@ -114,8 +111,22 @@ struct _ModestWindowClass { void (*show_toolbar_func) (ModestWindow *self, gboolean show_toolbar); void (*save_state_func) (ModestWindow *self); void (*disconnect_signals_func) (ModestWindow *self); + 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 (*add_item_to_menu_func) (ModestWindow *self, + GtkWidget *widget, + ModestDimmingCallback dimming_callback); + void (*pack_toolbar_func) (ModestWindow *self, GtkPackType pack_type, GtkWidget *toolbar); + void (*edit_mode_changed) (ModestWindow *self, gint edit_mode, gboolean enabled); }; + /** * modest_window_get_type: * @@ -325,6 +336,56 @@ void modest_window_disable_dimming (ModestWindow *self); void modest_window_disconnect_signals (ModestWindow *self); +void modest_window_show_progress (ModestWindow *self, gboolean show_progress); + +void modest_window_add_toolbar (ModestWindow *self, GtkToolbar *toolbar); + +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); + +/** + * modest_window_add_item_to_menu: + * @self: a #ModestWindow + * @item: a #GtkWidget (a #GtkButton in hildon, a #GtkMenuItem in gtk) + * @dimming_callback: a #ModestDimmingCallback or %NULL for no dimming rule + * + * adds a previously configured item @item to the window menu. + * It will configure @dimming_callback for dimming. User should previously + * attach the proper signal handler for @button. + */ +void +modest_window_add_item_to_menu (ModestWindow *self, + GtkWidget *item, + ModestDimmingCallback dimming_callback); + +/** + * modest_window_pack_toolbar: + * @self: a #ModestWindow + * @pack_type: a #GtkPackType + * @toolbar: a toolbar widget + * + * packs a toolbar (widget @toolbar) in @self with @pack_type + */ +void modest_window_pack_toolbar (ModestWindow *self, + GtkPackType pack_type, + GtkWidget *toolbar); + G_END_DECLS