Skip to content

Commit

Permalink
LinGUI: Add ActivityFontFamily preference (hidden)
Browse files Browse the repository at this point in the history
Add a monospace font name to this option in preferences.json to
change the font in the activity log. Not exposed in the UI.
  • Loading branch information
robxnano authored and galad87 committed Nov 29, 2023
1 parent 7fe1f56 commit 4397e3e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
1 change: 1 addition & 0 deletions gtk/data/internal_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
},
"Preferences": {
"ActivityFontSize": 8,
"ActivityFontFamily": "monospace",
"CustomTmpEnable": false,
"CustomTmpDir": "",
"DiskFreeCheck": true,
Expand Down
8 changes: 4 additions & 4 deletions gtk/src/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -4785,17 +4785,17 @@ activity_font_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_pref_set(ud->prefs, name);

int size = ghb_dict_get_int(ud->prefs, "ActivityFontSize");
const char *font = ghb_dict_get_string(ud->prefs, "ActivityFontFamily");

const gchar *css_template =
" \n\
#activity_view \n\
.ghb-monospace \n\
{ \n\
font-family: monospace; \n\
font-family: %s; \n\
font-size: %dpt; \n\
font-weight: 300; \n\
} \n\
";
char * css = g_strdup_printf(css_template, size);
char * css = g_strdup_printf(css_template, font, size);
GtkCssProvider * provider = gtk_css_provider_new();

ghb_css_provider_load_from_data(provider, css, -1);
Expand Down
11 changes: 3 additions & 8 deletions gtk/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,13 +639,13 @@ const gchar *MyCSS =
" min-height: 3px;"
"}"

"#preview_hud"
".ghb-preview-hud"
"{"
" border-radius: 16px;"
" border-width: 1px;"
"}"

".preview-image-frame"
".ghb-preview-image-frame"
"{"
" background-color: black;"
"}"
Expand All @@ -666,7 +666,7 @@ const gchar *MyCSS =
" min-width: 50px;"
"}"

"#activity_view"
".ghb-monospace"
"{"
" font-family: monospace;"
" font-size: 8pt;"
Expand Down Expand Up @@ -1093,11 +1093,6 @@ ghb_activate_cb(GApplication * app, signal_user_data_t * ud)
g_object_ref(ud->extra_activity_buffer);
ud->queue_activity_buffer = gtk_text_buffer_new(NULL);

// Must set the names of the widgets that I want to modify
// style for.
gtk_widget_set_name(GHB_WIDGET(ud->builder, "preview_hud"), "preview_hud");
gtk_widget_set_name(GHB_WIDGET(ud->builder, "activity_view"), "activity_view");

// Redirect stderr to the activity window
ghb_preview_init(ud);
IoRedirect(ud);
Expand Down
9 changes: 8 additions & 1 deletion gtk/src/ui-gtk3/ghb.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,9 @@ Resets the queue job to pending and ready to run again.</property>
<property name="editable">False</property>
<property name="wrap-mode">char</property>
<property name="cursor-visible">False</property>
<style>
<class name="ghb-monospace"/>
</style>
</object>
</child>
</object>
Expand Down Expand Up @@ -1761,6 +1764,9 @@ Resets the queue job to pending and ready to run again.</property>
<property name="editable">False</property>
<property name="wrap-mode">char</property>
<property name="cursor-visible">False</property>
<style>
<class name="ghb-monospace"/>
</style>
</object>
</child>
</object>
Expand Down Expand Up @@ -8991,7 +8997,7 @@ Uncheck this if you want to allow changing each title's settings independently.<
</object>
</child>
<style>
<class name="preview-image-frame"/>
<class name="ghb-preview-image-frame"/>
</style>
</object>
</child>
Expand All @@ -9006,6 +9012,7 @@ Uncheck this if you want to allow changing each title's settings independently.<
<signal name="enter-notify-event" handler="hud_enter_cb" swapped="no"/>
<signal name="leave-notify-event" handler="hud_leave_cb" swapped="no"/>
<style>
<class name="ghb-preview-hud"/>
<class name="osd"/>
<class name="app-notification"/>
</style>
Expand Down

0 comments on commit 4397e3e

Please sign in to comment.