[gnome-builder/wip/gtk4-port: 523/1774] plugins/editorui: add popover for encodings
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 523/1774] plugins/editorui: add popover for encodings
- Date: Mon, 11 Jul 2022 22:31:15 +0000 (UTC)
commit 5d5091ce422b10d6858fecbb1385ffbe3cea11b2
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 8 21:40:44 2022 -0700
plugins/editorui: add popover for encodings
Still needs to be wired up to an action of course.
src/plugins/editorui/gbp-editorui-workspace-addin.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
---
diff --git a/src/plugins/editorui/gbp-editorui-workspace-addin.c
b/src/plugins/editorui/gbp-editorui-workspace-addin.c
index 71689ce19..d305e0d91 100644
--- a/src/plugins/editorui/gbp-editorui-workspace-addin.c
+++ b/src/plugins/editorui/gbp-editorui-workspace-addin.c
@@ -51,6 +51,9 @@ struct _GbpEditoruiWorkspaceAddin
GtkMenuButton *position;
GbpEditoruiPositionLabel *position_label;
+ GtkMenuButton *encoding;
+ GtkLabel *encoding_label;
+
guint queued_cursor_moved;
};
@@ -259,6 +262,7 @@ gbp_editorui_workspace_addin_load (IdeWorkspaceAddin *addin,
{
GbpEditoruiWorkspaceAddin *self = (GbpEditoruiWorkspaceAddin *)addin;
g_autoptr(GSimpleActionGroup) group = NULL;
+ g_autoptr(GMenuModel) encoding_menu = NULL;
GtkPopover *popover;
GMenu *menu;
@@ -303,6 +307,19 @@ gbp_editorui_workspace_addin_load (IdeWorkspaceAddin *addin,
self,
G_CONNECT_SWAPPED);
+ /* Encoding */
+ encoding_menu = ide_editor_encoding_menu_new ("editorui.encoding");
+ self->encoding_label = g_object_new (GTK_TYPE_LABEL,
+ "label", "UTF-8",
+ NULL);
+ self->encoding = g_object_new (GTK_TYPE_MENU_BUTTON,
+ "menu-model", encoding_menu,
+ "direction", GTK_ARROW_UP,
+ "visible", FALSE,
+ "child", self->encoding_label,
+ NULL);
+ panel_statusbar_add_suffix (self->statusbar, GTK_WIDGET (self->encoding));
+
/* Line ending */
menu = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT, "editorui-line-ends-menu");
self->line_ends_label = g_object_new (GTK_TYPE_LABEL,
@@ -403,6 +420,7 @@ gbp_editorui_workspace_addin_page_changed (IdeWorkspaceAddin *addin,
gtk_widget_set_visible (GTK_WIDGET (self->indentation), page != NULL);
gtk_widget_set_visible (GTK_WIDGET (self->line_ends), page != NULL);
gtk_widget_set_visible (GTK_WIDGET (self->position), page != NULL);
+ gtk_widget_set_visible (GTK_WIDGET (self->encoding), page != NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]