Add buttons to the statusbar to show/hide the panels
This commit is contained in:
parent
3a6de664e1
commit
c78bf46d38
|
@ -179,10 +179,6 @@ xed_statusbar_init (XedStatusbar *statusbar)
|
||||||
gtk_box_pack_start (GTK_BOX (statusbar),
|
gtk_box_pack_start (GTK_BOX (statusbar),
|
||||||
statusbar->priv->error_frame,
|
statusbar->priv->error_frame,
|
||||||
FALSE, TRUE, 0);
|
FALSE, TRUE, 0);
|
||||||
|
|
||||||
gtk_box_reorder_child (GTK_BOX (statusbar),
|
|
||||||
statusbar->priv->error_frame,
|
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,6 +53,9 @@ struct _XedWindowPrivate
|
||||||
|
|
||||||
GtkWidget *tab_width_combo;
|
GtkWidget *tab_width_combo;
|
||||||
GtkWidget *language_combo;
|
GtkWidget *language_combo;
|
||||||
|
GtkWidget *show_side_pane_button;
|
||||||
|
GtkWidget *show_bottom_pane_button;
|
||||||
|
GtkWidget *bottom_pane_button_revealer;
|
||||||
|
|
||||||
XedMessageBus *message_bus;
|
XedMessageBus *message_bus;
|
||||||
PeasExtensionSet *extensions;
|
PeasExtensionSet *extensions;
|
||||||
|
|
|
@ -1619,6 +1619,10 @@ static void
|
||||||
create_statusbar (XedWindow *window,
|
create_statusbar (XedWindow *window,
|
||||||
GtkWidget *main_box)
|
GtkWidget *main_box)
|
||||||
{
|
{
|
||||||
|
GtkWidget *image;
|
||||||
|
GtkWidget *button_box;
|
||||||
|
GtkAction *action;
|
||||||
|
|
||||||
xed_debug (DEBUG_WINDOW);
|
xed_debug (DEBUG_WINDOW);
|
||||||
|
|
||||||
window->priv->statusbar = xed_statusbar_new ();
|
window->priv->statusbar = xed_statusbar_new ();
|
||||||
|
@ -1649,6 +1653,38 @@ create_statusbar (XedWindow *window,
|
||||||
g_signal_connect(G_OBJECT (window->priv->language_combo), "changed",
|
g_signal_connect(G_OBJECT (window->priv->language_combo), "changed",
|
||||||
G_CALLBACK (language_combo_changed), window);
|
G_CALLBACK (language_combo_changed), window);
|
||||||
|
|
||||||
|
button_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
|
||||||
|
gtk_widget_set_margin_top (button_box, 4);
|
||||||
|
gtk_widget_set_margin_bottom (button_box, 4);
|
||||||
|
gtk_box_pack_start (GTK_BOX (window->priv->statusbar), button_box, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
window->priv->show_side_pane_button = gtk_toggle_button_new ();
|
||||||
|
image = gtk_image_new_from_icon_name ("view-left-pane-symbolic", GTK_ICON_SIZE_INVALID);
|
||||||
|
gtk_image_set_pixel_size (GTK_IMAGE (image), 12);
|
||||||
|
gtk_container_add (GTK_CONTAINER (window->priv->show_side_pane_button), image);
|
||||||
|
gtk_box_pack_start (GTK_BOX (button_box), window->priv->show_side_pane_button, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
action = gtk_action_group_get_action (window->priv->panes_action_group, "ViewSidePane");
|
||||||
|
gtk_activatable_set_related_action (GTK_ACTIVATABLE (window->priv->show_side_pane_button), action);
|
||||||
|
gtk_widget_set_tooltip_text (window->priv->show_side_pane_button, gtk_action_get_tooltip (action));
|
||||||
|
|
||||||
|
window->priv->bottom_pane_button_revealer = gtk_revealer_new ();
|
||||||
|
gtk_revealer_set_transition_type (GTK_REVEALER (window->priv->bottom_pane_button_revealer),
|
||||||
|
GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
|
||||||
|
gtk_box_pack_start (GTK_BOX (button_box), window->priv->bottom_pane_button_revealer, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
window->priv->show_bottom_pane_button = gtk_toggle_button_new ();
|
||||||
|
image = gtk_image_new_from_icon_name ("view-bottom-pane-symbolic", GTK_ICON_SIZE_INVALID);
|
||||||
|
gtk_image_set_pixel_size (GTK_IMAGE (image), 12);
|
||||||
|
gtk_container_add (GTK_CONTAINER (window->priv->show_bottom_pane_button), image);
|
||||||
|
gtk_container_add (GTK_CONTAINER (window->priv->bottom_pane_button_revealer), window->priv->show_bottom_pane_button);
|
||||||
|
|
||||||
|
action = gtk_action_group_get_action (window->priv->panes_action_group, "ViewBottomPane");
|
||||||
|
gtk_activatable_set_related_action (GTK_ACTIVATABLE (window->priv->show_bottom_pane_button), action);
|
||||||
|
gtk_widget_set_tooltip_text (window->priv->show_bottom_pane_button, gtk_action_get_tooltip (action));
|
||||||
|
|
||||||
|
gtk_widget_show_all (button_box);
|
||||||
|
|
||||||
g_signal_connect_after(G_OBJECT (window->priv->statusbar), "show",
|
g_signal_connect_after(G_OBJECT (window->priv->statusbar), "show",
|
||||||
G_CALLBACK (statusbar_visibility_changed), window);
|
G_CALLBACK (statusbar_visibility_changed), window);
|
||||||
|
|
||||||
|
@ -1659,6 +1695,7 @@ create_statusbar (XedWindow *window,
|
||||||
|
|
||||||
gtk_box_pack_end (GTK_BOX (main_box), window->priv->searchbar, FALSE, FALSE, 0);
|
gtk_box_pack_end (GTK_BOX (main_box), window->priv->searchbar, FALSE, FALSE, 0);
|
||||||
|
|
||||||
|
gtk_box_reorder_child (GTK_BOX (window->priv->statusbar), button_box, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static XedWindow *
|
static XedWindow *
|
||||||
|
@ -3131,7 +3168,9 @@ bottom_panel_item_removed (XedPanel *panel,
|
||||||
if (xed_panel_get_n_items (panel) == 0)
|
if (xed_panel_get_n_items (panel) == 0)
|
||||||
{
|
{
|
||||||
GtkAction *action;
|
GtkAction *action;
|
||||||
|
|
||||||
gtk_widget_hide (GTK_WIDGET (panel));
|
gtk_widget_hide (GTK_WIDGET (panel));
|
||||||
|
gtk_revealer_set_reveal_child (GTK_REVEALER (window->priv->bottom_pane_button_revealer), FALSE);
|
||||||
action = gtk_action_group_get_action (window->priv->panes_action_group, "ViewBottomPane");
|
action = gtk_action_group_get_action (window->priv->panes_action_group, "ViewBottomPane");
|
||||||
gtk_action_set_sensitive (action, FALSE);
|
gtk_action_set_sensitive (action, FALSE);
|
||||||
}
|
}
|
||||||
|
@ -3148,6 +3187,9 @@ bottom_panel_item_added (XedPanel *panel,
|
||||||
{
|
{
|
||||||
GtkAction *action;
|
GtkAction *action;
|
||||||
gboolean show;
|
gboolean show;
|
||||||
|
|
||||||
|
gtk_revealer_set_reveal_child (GTK_REVEALER (window->priv->bottom_pane_button_revealer), TRUE);
|
||||||
|
|
||||||
action = gtk_action_group_get_action (window->priv->panes_action_group, "ViewBottomPane");
|
action = gtk_action_group_get_action (window->priv->panes_action_group, "ViewBottomPane");
|
||||||
gtk_action_set_sensitive (action, TRUE);
|
gtk_action_set_sensitive (action, TRUE);
|
||||||
show = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
show = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
||||||
|
@ -3163,9 +3205,7 @@ create_bottom_panel (XedWindow *window)
|
||||||
{
|
{
|
||||||
xed_debug (DEBUG_WINDOW);
|
xed_debug (DEBUG_WINDOW);
|
||||||
window->priv->bottom_panel = xed_panel_new (GTK_ORIENTATION_HORIZONTAL);
|
window->priv->bottom_panel = xed_panel_new (GTK_ORIENTATION_HORIZONTAL);
|
||||||
gtk_paned_pack2 (GTK_PANED(window->priv->vpaned), window->priv->bottom_panel,
|
gtk_paned_pack2 (GTK_PANED (window->priv->vpaned), window->priv->bottom_panel, FALSE, FALSE);
|
||||||
FALSE,
|
|
||||||
FALSE);
|
|
||||||
g_signal_connect_after(window->priv->bottom_panel, "show", G_CALLBACK (bottom_panel_visibility_changed), window);
|
g_signal_connect_after(window->priv->bottom_panel, "show", G_CALLBACK (bottom_panel_visibility_changed), window);
|
||||||
g_signal_connect_after(window->priv->bottom_panel, "hide", G_CALLBACK (bottom_panel_visibility_changed), window);
|
g_signal_connect_after(window->priv->bottom_panel, "hide", G_CALLBACK (bottom_panel_visibility_changed), window);
|
||||||
}
|
}
|
||||||
|
@ -3195,16 +3235,21 @@ init_panels_visibility (XedWindow *window)
|
||||||
{
|
{
|
||||||
gtk_widget_show (window->priv->bottom_panel);
|
gtk_widget_show (window->priv->bottom_panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_revealer_set_reveal_child (GTK_REVEALER (window->priv->bottom_pane_button_revealer), TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GtkAction *action;
|
GtkAction *action;
|
||||||
|
|
||||||
action = gtk_action_group_get_action (window->priv->panes_action_group, "ViewBottomPane");
|
action = gtk_action_group_get_action (window->priv->panes_action_group, "ViewBottomPane");
|
||||||
gtk_action_set_sensitive (action, FALSE);
|
gtk_action_set_sensitive (action, FALSE);
|
||||||
|
gtk_revealer_set_reveal_child (GTK_REVEALER (window->priv->bottom_pane_button_revealer), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start track sensitivity after the initial state is set */
|
/* start track sensitivity after the initial state is set */
|
||||||
window->priv->bottom_panel_item_removed_handler_id = g_signal_connect(window->priv->bottom_panel, "item_removed",
|
window->priv->bottom_panel_item_removed_handler_id =
|
||||||
|
g_signal_connect (window->priv->bottom_panel, "item_removed",
|
||||||
G_CALLBACK (bottom_panel_item_removed), window);
|
G_CALLBACK (bottom_panel_item_removed), window);
|
||||||
|
|
||||||
g_signal_connect(window->priv->bottom_panel, "item_added", G_CALLBACK (bottom_panel_item_added), window);
|
g_signal_connect(window->priv->bottom_panel, "item_added", G_CALLBACK (bottom_panel_item_added), window);
|
||||||
|
|
Loading…
Reference in New Issue