Skip to content

Commit

Permalink
re-implement right panel toggling
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandervdm committed May 25, 2021
1 parent a705dfc commit bf88cbc
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
11 changes: 11 additions & 0 deletions data/ui/gummi.glade
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,16 @@
<signal name="toggled" handler="on_menu_toolbar_toggled" swapped="no"/>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="menu_rightpane">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_Right pane</property>
<property name="use-underline">True</property>
<signal name="toggled" handler="on_menu_rightpane_toggled" swapped="no"/>
<accelerator key="F8" signal="activate"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="menuitem1">
<property name="visible">True</property>
Expand Down Expand Up @@ -1745,6 +1755,7 @@ active document to be saved. </property>
<object class="GtkBox" id="box_rightpane">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<child>
<object class="GtkNotebook" id="right_notebook">
<property name="visible">True</property>
Expand Down
1 change: 1 addition & 0 deletions src/configfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const gchar default_config[] =
"mainwindow_max = false\n"
"toolbar = true\n"
"statusbar = true\n"
"rightpane = true\n"
"snippets = true\n"
"[Editor]\n"
"font_str = Monospace 14\n"
Expand Down
12 changes: 11 additions & 1 deletion src/gui/gui-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ GummiGui* gui_init (GtkBuilder* builder) {
g->menu_toolbar =
GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menu_toolbar"));
g->menu_statusbar =
GTK_CHECK_MENU_ITEM(gtk_builder_get_object (builder, "menu_statusbar"));
GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menu_statusbar"));
g->menu_rightpane =
GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menu_rightpane"));
g->statusid =
gtk_statusbar_get_context_id (GTK_STATUSBAR (g->statusbar), "Gummi");
g->recent[0] =
Expand Down Expand Up @@ -226,6 +228,14 @@ GummiGui* gui_init (GtkBuilder* builder) {
gtk_widget_hide (GTK_WIDGET (g->statusbar));
}

if (config_get_boolean ("Interface", "rightpane")) {
gtk_check_menu_item_set_active (g->menu_rightpane, TRUE);
gtk_widget_show (GTK_WIDGET (g->rightpane));
} else {
gtk_check_menu_item_set_active (g->menu_rightpane, FALSE);
gtk_widget_hide (GTK_WIDGET (g->rightpane));
}

g->menu_autosync =
GTK_CHECK_MENU_ITEM (gtk_builder_get_object (builder, "menu_autosync"));

Expand Down
1 change: 1 addition & 0 deletions src/gui/gui-main.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ struct _GummiGui {
GtkCheckMenuItem* menu_snippets;
GtkCheckMenuItem* menu_toolbar;
GtkCheckMenuItem* menu_statusbar;
GtkCheckMenuItem* menu_rightpane;
GtkCheckMenuItem* menu_autosync;
GtkMenuItem* recent[5];
gint insens_widget_size;
Expand Down
13 changes: 13 additions & 0 deletions src/gui/gui-menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,19 @@ void on_menu_toolbar_toggled (GtkWidget *widget, void *user) {
}
}

G_MODULE_EXPORT
void on_menu_rightpane_toggled (GtkWidget *widget, void *user) {
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) {
gtk_widget_show (GTK_WIDGET (gui->rightpane));
config_set_boolean ("Interface", "rightpane", TRUE);
gtk_toggle_tool_button_set_active (gui->previewgui->preview_pause, FALSE);
} else {
gtk_widget_hide (GTK_WIDGET (gui->rightpane));
config_set_boolean ("Interface", "rightpane", FALSE);
gtk_toggle_tool_button_set_active (gui->previewgui->preview_pause, TRUE);
}
}

G_MODULE_EXPORT
void on_menu_fullscreen_toggled (GtkWidget *widget, void *user) {
if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)))
Expand Down

0 comments on commit bf88cbc

Please sign in to comment.