Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reloading config on signal #40

Closed
disarmer opened this issue Jan 20, 2014 · 5 comments
Closed

Reloading config on signal #40

disarmer opened this issue Jan 20, 2014 · 5 comments

Comments

@disarmer
Copy link

Hi!
Is there are ways to reload config properly? I'm trying to change font of working tilda instance by reloading config on SIGHUP or other signal(like in nginx), but i have no idea how to apply visual settings due my poor C skill.

static void termination_handler (G_GNUC_UNUSED gint signum) {
    if (signum == SIGHUP) {
        DEBUG_FUNCTION ("reload_handler");
        gint instance = get_instance_number ();
        gchar *config_file = get_config_file_name (instance);
        DEBUG_FUNCTION (config_file);
        config_init (config_file);
        parse_cli (0,*"");
    } else {
        DEBUG_FUNCTION ("termination_handler");
        gtk_main_quit ();
   }
}

It works, but window appearance didn't change

@lanoxx
Copy link
Owner

lanoxx commented Jan 20, 2014

Hi,

updating the config does not necessarily change the value for the current application. Because the callbacks are not called, check wizard.c to see which functions is responsible for initializing the config, you probably also need to call that function.

@lanoxx
Copy link
Owner

lanoxx commented Jan 21, 2014

Hi,

I checked again, the function which updates the font is button_font_font_set_cb in wizard.c. Here is the function trace:

button_font_font_set_cb()
connect_wizard_signals()
wizard()

Only wizard() is visible outside of wizard.c, so you will probably want to move the following code out of button_font_font_set_cb and into a new function, so you can call it from outside wizard.c:

for (i=0; i<g_list_length (tw->terms); i++) {
    tt = g_list_nth_data (tw->terms, i);
    PangoFontDescription *description =
        pango_font_description_from_string (font);
    vte_terminal_set_font (VTE_TERMINAL(tt->vte_term), description);
}

@disarmer
Copy link
Author

Yeah, i'm found it too, but i don't know how to pass tilda_tindow tw to signal handler. Only global variable? But it's ugly

@lanoxx
Copy link
Owner

lanoxx commented Jan 21, 2014

@disarmer
Copy link
Author

I got! May be it will be useful for someone: #41

Thanks a lot for help and tilda =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants