Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Thu, 05 Dec 2013 19:16:54 UTC Commit: 4aff511b018f43bcefa108269c78c974848b27c4 https://github.com/geany/geany/commit/4aff511b018f43bcefa108269c78c974848b27...
Log Message: ----------- Remove unnecessary allocation for VTE color settings
Modified Paths: -------------- src/keyfile.c src/prefs.c src/vte.c src/vte.h
Modified: src/keyfile.c 10 files changed, 4 insertions(+), 6 deletions(-) =================================================================== @@ -517,10 +517,10 @@ static void save_dialog_prefs(GKeyFile *config) g_key_file_set_string(config, "VTE", "font", vc->font); g_key_file_set_string(config, "VTE", "image", vc->image); g_key_file_set_string(config, "VTE", "shell", vc->shell); - tmp_string = utils_get_hex_from_color(vc->colour_fore); + tmp_string = utils_get_hex_from_color(&vc->colour_fore); g_key_file_set_string(config, "VTE", "colour_fore", tmp_string); g_free(tmp_string); - tmp_string = utils_get_hex_from_color(vc->colour_back); + tmp_string = utils_get_hex_from_color(&vc->colour_back); g_key_file_set_string(config, "VTE", "colour_back", tmp_string); g_free(tmp_string); } @@ -854,13 +854,11 @@ static void load_dialog_prefs(GKeyFile *config) vc->skip_run_script = utils_get_setting_boolean(config, "VTE", "skip_run_script", FALSE); vc->cursor_blinks = utils_get_setting_boolean(config, "VTE", "cursor_blinks", FALSE); vc->scrollback_lines = utils_get_setting_integer(config, "VTE", "scrollback_lines", 500); - vc->colour_fore = g_new0(GdkColor, 1); - vc->colour_back = g_new0(GdkColor, 1); tmp_string = utils_get_setting_string(config, "VTE", "colour_fore", "#ffffff"); - utils_parse_color(tmp_string, vc->colour_fore); + utils_parse_color(tmp_string, &vc->colour_fore); g_free(tmp_string); tmp_string = utils_get_setting_string(config, "VTE", "colour_back", "#000000"); - utils_parse_color(tmp_string, vc->colour_back); + utils_parse_color(tmp_string, &vc->colour_back); g_free(tmp_string); } #endif
Modified: src/prefs.c 4 files changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -764,10 +764,10 @@ static void prefs_init_dialog(void) gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), vc->font);
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "color_fore"); - gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), vc->colour_fore); + gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &vc->colour_fore);
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "color_back"); - gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), vc->colour_back); + gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &vc->colour_back);
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_image"); gtk_entry_set_text(GTK_ENTRY(widget), vc->image);
Modified: src/vte.c 16 files changed, 5 insertions(+), 11 deletions(-) =================================================================== @@ -313,8 +313,6 @@ void vte_close(void) g_free(vc->shell); g_free(vc->image); g_free(vc->font); - g_free(vc->colour_back); - g_free(vc->colour_fore); g_free(vc->send_cmd_prefix); g_free(vc); g_free(gtk_menu_key_accel); @@ -487,9 +485,9 @@ void vte_apply_user_settings(void) vf->vte_terminal_set_scroll_on_output(VTE_TERMINAL(vc->vte), vc->scroll_on_out); vf->vte_terminal_set_emulation(VTE_TERMINAL(vc->vte), vc->emulation); vf->vte_terminal_set_font_from_string(VTE_TERMINAL(vc->vte), vc->font); - vf->vte_terminal_set_color_foreground(VTE_TERMINAL(vc->vte), vc->colour_fore); - vf->vte_terminal_set_color_bold(VTE_TERMINAL(vc->vte), vc->colour_fore); - vf->vte_terminal_set_color_background(VTE_TERMINAL(vc->vte), vc->colour_back); + vf->vte_terminal_set_color_foreground(VTE_TERMINAL(vc->vte), &vc->colour_fore); + vf->vte_terminal_set_color_bold(VTE_TERMINAL(vc->vte), &vc->colour_fore); + vf->vte_terminal_set_color_background(VTE_TERMINAL(vc->vte), &vc->colour_back); vf->vte_terminal_set_background_image_file(VTE_TERMINAL(vc->vte), vc->image); vf->vte_terminal_set_audible_bell(VTE_TERMINAL(vc->vte), prefs.beep_on_errors); vte_set_cursor_blink_mode(); @@ -761,17 +759,13 @@ G_MODULE_EXPORT void on_term_font_set(GtkFontButton *widget, gpointer user_data)
G_MODULE_EXPORT void on_term_fg_color_set(GtkColorButton *widget, gpointer user_data) { - g_free(vc->colour_fore); - vc->colour_fore = g_new0(GdkColor, 1); - gtk_color_button_get_color(widget, vc->colour_fore); + gtk_color_button_get_color(widget, &vc->colour_fore); }
G_MODULE_EXPORT void on_term_bg_color_set(GtkColorButton *widget, gpointer user_data) { - g_free(vc->colour_back); - vc->colour_back = g_new0(GdkColor, 1); - gtk_color_button_get_color(widget, vc->colour_back); + gtk_color_button_get_color(widget, &vc->colour_back); }
Modified: src/vte.h 4 files changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -57,8 +57,8 @@ gchar *image; gchar *font; gchar *send_cmd_prefix; - GdkColor *colour_fore; - GdkColor *colour_back; + GdkColor colour_fore; + GdkColor colour_back; } VteConfig; extern VteConfig *vc;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).