aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2011-03-06 15:57:58 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2011-03-07 17:29:27 +0100
commit94cb6ee53af6b17e45106765c6aeb99f64ed1be5 (patch)
tree313959912ec12d7bb25f20b5d02994bcc45b570e /src
parentc8caca073ff7af35bbfabcdaa59e13de005e90d1 (diff)
downloadlogdiag-94cb6ee53af6b17e45106765c6aeb99f64ed1be5.tar.gz
logdiag-94cb6ee53af6b17e45106765c6aeb99f64ed1be5.tar.xz
logdiag-94cb6ee53af6b17e45106765c6aeb99f64ed1be5.zip
Add toggle actions to the View menu.
So far these settings are not saved anywhere.
Diffstat (limited to 'src')
-rw-r--r--src/ld-window-main.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/ld-window-main.c b/src/ld-window-main.c
index 7a94152..3602edb 100644
--- a/src/ld-window-main.c
+++ b/src/ld-window-main.c
@@ -101,6 +101,12 @@ static void on_action_redo (GtkAction *action, LdWindowMain *self);
static void on_action_delete (GtkAction *action, LdWindowMain *self);
static void on_action_select_all (GtkAction *action, LdWindowMain *self);
+static void on_action_main_toolbar (GtkToggleAction *action,
+ LdWindowMain *self);
+static void on_action_library_toolbar (GtkToggleAction *action,
+ LdWindowMain *self);
+static void on_action_grid (GtkToggleAction *action, LdWindowMain *self);
+
static void on_action_zoom_in (GtkAction *action, LdWindowMain *self);
static void on_action_zoom_out (GtkAction *action, LdWindowMain *self);
static void on_action_normal_size (GtkAction *action, LdWindowMain *self);
@@ -169,6 +175,19 @@ static GtkActionEntry wm_action_entries[] =
G_CALLBACK (on_action_about)}
};
+static GtkToggleActionEntry wm_toggle_action_entries[] =
+{
+ {"MainToolbar", NULL, N_("_Main Toolbar"), NULL,
+ N_("Toggle displaying of the main toolbar"),
+ G_CALLBACK (on_action_main_toolbar), TRUE},
+ {"LibraryToolbar", NULL, N_("_Library Toolbar"), NULL,
+ N_("Toggle displaying of the library toolbar"),
+ G_CALLBACK (on_action_library_toolbar), TRUE},
+ {"ShowGrid", NULL, N_("Show _Grid"), NULL,
+ N_("Toggle displaying of the grid"),
+ G_CALLBACK (on_action_grid), TRUE}
+};
+
/* ===== Generic widget methods ============================================ */
@@ -226,8 +245,12 @@ ld_window_main_init (LdWindowMain *self)
priv->action_group = gtk_action_group_new ("MainActions");
gtk_action_group_set_translation_domain
(priv->action_group, GETTEXT_DOMAIN);
- gtk_action_group_add_actions (priv->action_group, wm_action_entries,
+ gtk_action_group_add_actions
+ (priv->action_group, wm_action_entries,
G_N_ELEMENTS (wm_action_entries), self);
+ gtk_action_group_add_toggle_actions
+ (priv->action_group, wm_toggle_action_entries,
+ G_N_ELEMENTS (wm_toggle_action_entries), self);
gtk_ui_manager_insert_action_group (priv->ui_manager,
priv->action_group, 0);
@@ -899,6 +922,27 @@ on_action_select_all (GtkAction *action, LdWindowMain *self)
}
static void
+on_action_main_toolbar (GtkToggleAction *action, LdWindowMain *self)
+{
+ gtk_widget_set_visible (self->priv->toolbar,
+ gtk_toggle_action_get_active (action));
+}
+
+static void
+on_action_library_toolbar (GtkToggleAction *action, LdWindowMain *self)
+{
+ gtk_widget_set_visible (self->priv->library_toolbar,
+ gtk_toggle_action_get_active (action));
+}
+
+static void
+on_action_grid (GtkToggleAction *action, LdWindowMain *self)
+{
+ ld_diagram_view_set_show_grid (self->priv->view,
+ gtk_toggle_action_get_active (action));
+}
+
+static void
on_action_zoom_in (GtkAction *action, LdWindowMain *self)
{
ld_diagram_view_zoom_in (self->priv->view);