diff --git a/build-aux/flatpak/org.gnome.Gtranslator.json b/build-aux/flatpak/org.gnome.Gtranslator.json index 2c0551c671f581e7301e9ddee9d4e5f415e40715..aaf59b4433ab74d0ca4e85c7dc17d954b325731d 100644 --- a/build-aux/flatpak/org.gnome.Gtranslator.json +++ b/build-aux/flatpak/org.gnome.Gtranslator.json @@ -9,6 +9,7 @@ ], "desktop-file-name-suffix" : "(Development) ", "finish-args" : [ + "--device=dri", "--share=ipc", "--share=network", "--socket=fallback-x11", diff --git a/data/org.gnome.Gtranslator.gschema.xml.in b/data/org.gnome.Gtranslator.gschema.xml.in index 0605235533acfbc162134df6afe8ccd0843e3236..da3467eb7bf157902fcc7d7ab24b9df74659eaea 100644 --- a/data/org.gnome.Gtranslator.gschema.xml.in +++ b/data/org.gnome.Gtranslator.gschema.xml.in @@ -105,13 +105,6 @@ Style for switchers in the side panel. - - 'classic' - Color scheme - - Name of a gtksourceview color scheme to use for syntax highlighting. - - 'id' Message list sort order diff --git a/src/codeview/gtr-viewer.c b/src/codeview/gtr-viewer.c index 418f772d787dca9942d1905c2a44109cf3b662d5..35a5731d3d8997692fbcdbbc664289aecb816c40 100644 --- a/src/codeview/gtr-viewer.c +++ b/src/codeview/gtr-viewer.c @@ -47,6 +47,40 @@ struct _GtrViewer G_DEFINE_TYPE_WITH_PRIVATE (GtrViewer, gtr_viewer, GTK_TYPE_WINDOW) +static void +source_view_update_theme (GtrViewer *dlg) +{ + AdwStyleManager *manager; + GtkSourceStyleSchemeManager *scheme_manager; + GtkSourceStyleScheme *scheme; + const gchar *scheme_name; + GtkSourceView *view; + GtkTextBuffer *buffer; + GtrViewerPrivate *priv = gtr_viewer_get_instance_private (dlg); + + view = GTK_SOURCE_VIEW (priv->view); + + manager = adw_style_manager_get_default (); + + if (adw_style_manager_get_dark (manager)) + scheme_name = "Adwaita-dark"; + else + scheme_name = "Adwaita"; + + scheme_manager = gtk_source_style_scheme_manager_get_default (); + scheme = gtk_source_style_scheme_manager_get_scheme (scheme_manager, + scheme_name); + + buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); + gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (buffer), scheme); +} + +static void +notify_dark_cb (GtrViewer *dlg) +{ + source_view_update_theme (dlg); +} + static void gtr_viewer_init (GtrViewer *dlg) { @@ -59,6 +93,7 @@ gtr_viewer_init (GtrViewer *dlg) }; GtrViewerPrivate *priv = gtr_viewer_get_instance_private (dlg); GError *error = NULL; + AdwStyleManager *manager; gtk_window_set_title (GTK_WINDOW (dlg), _("Source Viewer")); gtk_window_set_default_size (GTK_WINDOW (dlg), 800, 600); @@ -99,6 +134,11 @@ gtr_viewer_init (GtrViewer *dlg) /* Source view */ priv->view = gtk_source_view_new (); + source_view_update_theme (dlg); + manager = adw_style_manager_get_default (); + g_signal_connect_swapped (manager, "notify::dark", + G_CALLBACK (notify_dark_cb), dlg); + gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->view), FALSE); gtk_widget_set_visible (priv->view, TRUE); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), priv->view); diff --git a/src/codeview/gtr-viewer.ui b/src/codeview/gtr-viewer.ui index 660fd75a9d3014fe268a7d50c8cf5f068260532f..99a3c25accd34ca726d65bf0450595b9d732d476 100644 --- a/src/codeview/gtr-viewer.ui +++ b/src/codeview/gtr-viewer.ui @@ -2,7 +2,6 @@ - False 6 6 6 @@ -12,20 +11,17 @@ True - False vertical 2 True - False True vertical 6 True - False 0 Source code @@ -36,7 +32,6 @@ True - True True diff --git a/src/gtr-application.c b/src/gtr-application.c index 9b6486946d12d49c54f5f1a2bf344dc564eb637a..ddc77cfd12775e0fc4d100436164cf103bff587c 100644 --- a/src/gtr-application.c +++ b/src/gtr-application.c @@ -596,11 +596,12 @@ gtr_application_startup (GApplication *application) GtrApplication *app = GTR_APPLICATION (application); GtrApplicationPrivate *priv = gtr_application_get_instance_private (app); - g_application_set_resource_base_path (application, "/org/gnome/translator"); G_APPLICATION_CLASS (gtr_application_parent_class)->startup (application); g_set_application_name (_("Translation Editor")); gtk_window_set_default_icon_name (PACKAGE_APPID); + gtk_source_init (); + /* Custom css */ priv->provider = gtk_css_provider_new (); gtk_css_provider_load_from_resource (priv->provider, "/org/gnome/translator/styles.css"); @@ -608,9 +609,6 @@ gtr_application_startup (GApplication *application) gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (priv->provider), 600); - adw_style_manager_set_color_scheme (adw_style_manager_get_default (), - ADW_COLOR_SCHEME_PREFER_LIGHT); - g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application); @@ -677,10 +675,6 @@ gtr_application_setup_window (GApplication *application, window = gtr_application_create_window (GTR_APPLICATION (application)); gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (window)); - /** loading custom styles **/ - if (g_strrstr (PACKAGE_APPID, "Devel") != NULL) - gtk_widget_add_css_class (GTK_WIDGET (window), "devel"); - /* If it is the first run, the default directory was created in this * run, then we show the First run greeter */ @@ -738,6 +732,7 @@ gtr_application_new () return GTR_APPLICATION (g_object_new (GTR_TYPE_APPLICATION, "application-id", PACKAGE_APPID, "flags", G_APPLICATION_HANDLES_OPEN, + "resource-base-path", "/org/gnome/translator/", NULL)); } diff --git a/src/gtr-context.ui b/src/gtr-context.ui index 7933c68d16109418a806fbefbc19c4c85c871af1..71f863f7c7f9977039392ae802594c7f2ba3b0eb 100644 --- a/src/gtr-context.ui +++ b/src/gtr-context.ui @@ -15,7 +15,6 @@ 1 - 1 6 @@ -45,7 +44,6 @@ - 1 0 word notesbuffer @@ -62,7 +60,6 @@ - 1 0 word commentsbuffer @@ -79,7 +76,6 @@ - 1 diff --git a/src/gtr-dl-teams.ui b/src/gtr-dl-teams.ui index 446cbf2933a0f8e605f735919e045235ff46a3a4..2939f930cc9643c8f8c8c836ea74ac5da9724e30 100644 --- a/src/gtr-dl-teams.ui +++ b/src/gtr-dl-teams.ui @@ -21,10 +21,6 @@ About Translation Editor app.about - - Quit - app.quit - @@ -163,8 +159,8 @@ - Load file - end + Load File + center