static void restore_sizes (ModestMainWindow *self);
static void save_sizes (ModestMainWindow *self);
-static void modest_main_window_create_toolbar (ModestWindow *window);
static void modest_main_window_show_toolbar (ModestWindow *window,
gboolean show_toolbar);
parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = modest_main_window_finalize;
- modest_window_class->create_toolbar_func = modest_main_window_create_toolbar;
modest_window_class->show_toolbar_func = modest_main_window_show_toolbar;
g_type_class_add_private (gobject_class, sizeof(ModestMainWindowPrivate));
}
static void
-modest_main_window_create_toolbar (ModestWindow *self)
-{
- GtkWidget *reply_button, *menu;
- ModestWindowPrivate *parent_priv;
-
- parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
-
- /* Toolbar */
- parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager,
- "/ToolBar");
-
- /* Set homogeneous toolbar */
- gtk_container_foreach (GTK_CONTAINER (parent_priv->toolbar),
- set_homogeneous, NULL);
-
- /* Set reply button tap and hold menu */
- reply_button = gtk_ui_manager_get_widget (parent_priv->ui_manager,
- "/ToolBar/ToolbarMessageReply");
- menu = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolbarReplyContextMenu");
- gtk_widget_tap_and_hold_setup (GTK_WIDGET (reply_button), menu, NULL, 0);
-}
-
-static void
modest_main_window_show_toolbar (ModestWindow *self,
gboolean show_toolbar)
{
ModestWindowPrivate *parent_priv;
+ GtkWidget *reply_button = NULL, *menu = NULL;
parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
- if (!parent_priv->toolbar)
- return;
+ if (!parent_priv->toolbar && show_toolbar) {
+ parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager,
+ "/ToolBar");
+
+ /* Set homogeneous toolbar */
+ gtk_container_foreach (GTK_CONTAINER (parent_priv->toolbar),
+ set_homogeneous, NULL);
- if (show_toolbar) {
+ /* Add to window */
hildon_window_add_toolbar (HILDON_WINDOW (self),
GTK_TOOLBAR (parent_priv->toolbar));
- gtk_widget_show_all (GTK_WIDGET (self));
- } else
- hildon_window_remove_toolbar (HILDON_WINDOW (self),
- GTK_TOOLBAR (parent_priv->toolbar));
+
+ /* Set reply button tap and hold menu */
+ reply_button = gtk_ui_manager_get_widget (parent_priv->ui_manager,
+ "/ToolBar/ToolbarMessageReply");
+ menu = gtk_ui_manager_get_widget (parent_priv->ui_manager,
+ "/ToolbarReplyContextMenu");
+ gtk_widget_tap_and_hold_setup (GTK_WIDGET (reply_button), menu, NULL, 0);
+ }
+
+
+ if (show_toolbar)
+ gtk_widget_show (GTK_WIDGET (parent_priv->toolbar));
+ else
+ gtk_widget_hide (GTK_WIDGET (parent_priv->toolbar));
}
static gdouble modest_msg_edit_window_get_zoom (ModestWindow *window);
static gboolean modest_msg_edit_window_zoom_minus (ModestWindow *window);
static gboolean modest_msg_edit_window_zoom_plus (ModestWindow *window);
-static void modest_msg_edit_window_create_toolbar (ModestWindow *window);
static void modest_msg_edit_window_show_toolbar (ModestWindow *window,
gboolean show_toolbar);
modest_window_class->get_zoom_func = modest_msg_edit_window_get_zoom;
modest_window_class->zoom_plus_func = modest_msg_edit_window_zoom_plus;
modest_window_class->zoom_minus_func = modest_msg_edit_window_zoom_minus;
- modest_window_class->create_toolbar_func = modest_msg_edit_window_create_toolbar;
modest_window_class->show_toolbar_func = modest_msg_edit_window_show_toolbar;
g_type_class_add_private (gobject_class, sizeof(ModestMsgEditWindowPrivate));
gtk_widget_hide (priv->bcc_caption);
}
-
-static void
-modest_msg_edit_window_create_toolbar (ModestWindow *self)
-{
- /* FIXME: we can not just use the code of
- modest_msg_edit_window_setup_toolbar because it has a
- mixture of both initialization and creation code. */
-}
-
static void
modest_msg_edit_window_show_toolbar (ModestWindow *self,
gboolean show_toolbar)
parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
- if (!parent_priv->toolbar)
- return;
+ /* FIXME: we can not just use the code of
+ modest_msg_edit_window_setup_toolbar because it has a
+ mixture of both initialization and creation code. */
- if (show_toolbar) {
- hildon_window_add_toolbar (HILDON_WINDOW (self),
- GTK_TOOLBAR (parent_priv->toolbar));
- gtk_widget_show_all (GTK_WIDGET (self));
- } else
- hildon_window_remove_toolbar (HILDON_WINDOW (self),
- GTK_TOOLBAR (parent_priv->toolbar));
+ if (show_toolbar)
+ gtk_widget_show (GTK_WIDGET (parent_priv->toolbar));
+ else
+ gtk_widget_hide (GTK_WIDGET (parent_priv->toolbar));
}
static void modest_msg_view_window_update_dimmed (ModestMsgViewWindow *window);
static void modest_msg_view_window_update_priority (ModestMsgViewWindow *window);
-static void modest_msg_view_window_create_toolbar (ModestWindow *window);
static void modest_msg_view_window_show_toolbar (ModestWindow *window,
gboolean show_toolbar);
modest_window_class->get_zoom_func = modest_msg_view_window_get_zoom;
modest_window_class->zoom_minus_func = modest_msg_view_window_zoom_minus;
modest_window_class->zoom_plus_func = modest_msg_view_window_zoom_plus;
- modest_window_class->create_toolbar_func = modest_msg_view_window_create_toolbar;
modest_window_class->show_toolbar_func = modest_msg_view_window_show_toolbar;
g_type_class_add_private (gobject_class, sizeof(ModestMsgViewWindowPrivate));
}
}
-static void
-modest_msg_view_window_create_toolbar (ModestWindow *self)
-{
- GtkWidget *reply_button, *menu;
- ModestWindowPrivate *parent_priv;
-
- parent_priv = MODEST_WINDOW_GET_PRIVATE (self);
-
- /* Toolbar */
- parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar");
-
- /* Set homogeneous */
- gtk_container_foreach (GTK_CONTAINER (parent_priv->toolbar),
- set_homogeneous, NULL);
-
- /* Set reply button tap and hold menu */
- reply_button = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar/ToolbarMessageReply");
- menu = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolbarReplyCSM");
- gtk_widget_tap_and_hold_setup (GTK_WIDGET (reply_button), menu, NULL, 0);
-}
-
static void
modest_msg_view_window_show_toolbar (ModestWindow *self,
gboolean show_toolbar)
{
ModestWindowPrivate *parent_priv;
+ GtkWidget *reply_button = NULL, *menu = NULL;
parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
- if (!parent_priv->toolbar)
- return;
+ if (!parent_priv->toolbar && show_toolbar) {
+ parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager,
+ "/ToolBar");
- if (show_toolbar) {
+ /* Set homogeneous toolbar */
+ gtk_container_foreach (GTK_CONTAINER (parent_priv->toolbar),
+ set_homogeneous, NULL);
+
+ /* Add to window */
hildon_window_add_toolbar (HILDON_WINDOW (self),
GTK_TOOLBAR (parent_priv->toolbar));
- gtk_widget_show_all (GTK_WIDGET (self));
- } else
- hildon_window_remove_toolbar (HILDON_WINDOW (self),
- GTK_TOOLBAR (parent_priv->toolbar));
+
+
+ /* Set reply button tap and hold menu */
+ reply_button = gtk_ui_manager_get_widget (parent_priv->ui_manager,
+ "/ToolBar/ToolbarMessageReply");
+ menu = gtk_ui_manager_get_widget (parent_priv->ui_manager,
+ "/ToolbarReplyCSM");
+ gtk_widget_tap_and_hold_setup (GTK_WIDGET (reply_button), menu, NULL, 0);
+ }
+
+
+ if (show_toolbar)
+ gtk_widget_show (GTK_WIDGET (parent_priv->toolbar));
+ else
+ gtk_widget_hide (GTK_WIDGET (parent_priv->toolbar));
}
{ "ViewBccField", NULL, N_("Bcc: filed"), NULL, N_("Shows the Bcc: field"), G_CALLBACK (modest_ui_actions_on_toggle_show_bcc), TRUE },
/* Fullscreen toggle */
- { "ViewToggleFullscreen", GTK_STOCK_FULLSCREEN, N_("Show fullscreen"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_fullscreen), FALSE},
+ { "ViewToggleFullscreen", NULL, N_("Show fullscreen"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_fullscreen), FALSE},
/* Rich text editor functions */
{ "ActionsBold", GTK_STOCK_BOLD, N_("Bold"), NULL, N_("Use bold"), G_CALLBACK (modest_ui_actions_on_toggle_bold), FALSE },
show = priv->show_toolbars_fullscreen;
else
show = priv->show_toolbars;
- modest_window_view_toolbar (window, show);
+ modest_window_show_toolbar (window, show);
}
static void
while (win) {
if (on) {
gtk_window_fullscreen (GTK_WINDOW (win->data));
- modest_window_view_toolbar (MODEST_WINDOW (win->data),
+ modest_window_show_toolbar (MODEST_WINDOW (win->data),
priv->show_toolbars_fullscreen);
} else {
gtk_window_unfullscreen (GTK_WINDOW (win->data));
- modest_window_view_toolbar (MODEST_WINDOW (win->data),
+ modest_window_show_toolbar (MODEST_WINDOW (win->data),
priv->show_toolbars);
}
win = g_list_next (win);
GList *win = priv->window_list;
while (win) {
- modest_window_view_toolbar (MODEST_WINDOW (win->data),
+ modest_window_show_toolbar (MODEST_WINDOW (win->data),
show_toolbars);
win = g_list_next (win);
}
static gdouble modest_window_get_zoom_default (ModestWindow *window);
static gboolean modest_window_zoom_plus_default (ModestWindow *window);
static gboolean modest_window_zoom_minus_default (ModestWindow *window);
-static void modest_window_create_toolbar_default (ModestWindow *window);
static void modest_window_show_toolbar_default (ModestWindow *window,
gboolean show_toolbar);
klass->get_zoom_func = modest_window_get_zoom_default;
klass->zoom_plus_func = modest_window_zoom_plus_default;
klass->zoom_minus_func = modest_window_zoom_minus_default;
- klass->create_toolbar_func = modest_window_create_toolbar_default;
klass->show_toolbar_func = modest_window_show_toolbar_default;
g_type_class_add_private (gobject_class, sizeof(ModestWindowPrivate));
return MODEST_WINDOW_GET_CLASS (window)->zoom_minus_func (window);
}
-static void
-modest_window_create_toolbar (ModestWindow *window)
-{
- MODEST_WINDOW_GET_CLASS (window)->create_toolbar_func (window);
-}
-
-static void
+void
modest_window_show_toolbar (ModestWindow *window,
gboolean show_toolbar)
{
show_toolbar);
}
-void
-modest_window_view_toolbar (ModestWindow *window,
- gboolean show_toolbar)
-{
- ModestWindowPrivate *priv;
-
- priv = MODEST_WINDOW_GET_PRIVATE(window);
-
- /* Lazy strategy, we create the toolbar just when there is no
- toolbar and we want to show it */
- if (!priv->toolbar && show_toolbar)
- modest_window_create_toolbar (window);
-
- if (priv->toolbar)
- modest_window_show_toolbar (window, show_toolbar);
-}
-
/* Default implementations */
}
static void
-modest_window_create_toolbar_default (ModestWindow *window)
-{
- g_warning ("modest: You should implement %s", __FUNCTION__);
-}
-
-static void
modest_window_show_toolbar_default (ModestWindow *window,
gboolean show_toolbar)
{
#include <hildon-widgets/hildon-window.h>
typedef HildonWindow ModestWindowParent;
typedef HildonWindowClass ModestWindowParentClass;
-#endif /*MODEST_PLATFORM_MAEMO */
#ifndef GTK_STOCK_FULLSCREEN
#define GTK_STOCK_FULLSCREEN ""
#endif /*GTK_STOCK_FULLSCREEN*/
+#endif /*MODEST_PLATFORM_MAEMO */
+
/* convenience macros */
#define MODEST_TYPE_WINDOW (modest_window_get_type())
#define MODEST_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_WINDOW,ModestWindow))
gdouble (*get_zoom_func) (ModestWindow *self);
gboolean (*zoom_plus_func) (ModestWindow *self);
gboolean (*zoom_minus_func) (ModestWindow *self);
- /* Used by view_toolbar, with no public interface */
- void (*create_toolbar_func) (ModestWindow *self);
void (*show_toolbar_func) (ModestWindow *self, gboolean show_toolbar);
};
/**
- * modest_window_view_toolbar:
+ * modest_window_show_toolbar:
* @window:
* @view_toolbar: whether or not the toolbar should be shown
*
* shows/hides the window toolbar
**/
-void modest_window_view_toolbar (ModestWindow *window,
- gboolean view_toolbar);
+void modest_window_show_toolbar (ModestWindow *window,
+ gboolean show_toolbar);
G_END_DECLS