summaryrefslogtreecommitdiff
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
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.
-rw-r--r--share/gui/window-main.ui5
-rw-r--r--src/ld-window-main.c46
2 files changed, 50 insertions, 1 deletions
diff --git a/share/gui/window-main.ui b/share/gui/window-main.ui
index 5ab82e9..62c8436 100644
--- a/share/gui/window-main.ui
+++ b/share/gui/window-main.ui
@@ -26,6 +26,11 @@
<menuitem action="SelectAll" />
</menu>
<menu name="ViewMenu" action="ViewMenu">
+ <menuitem action="MainToolbar" />
+ <menuitem action="LibraryToolbar" />
+ <separator />
+ <menuitem action="ShowGrid" />
+ <separator />
<menuitem action="ZoomIn" />
<menuitem action="ZoomOut" />
<menuitem action="NormalSize" />
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);