Branch: refs/heads/master Author: Matthew Brush matt@geany.org Committer: Matthew Brush matt@geany.org Date: Fri, 12 Jan 2018 21:45:38 UTC Commit: 7e1ab31c18ab977f1756c7afa3eeb4061b9eb09e https://github.com/geany/geany/commit/7e1ab31c18ab977f1756c7afa3eeb4061b9eb0...
Log Message: ----------- Return GdkColor via out parameter rather than return value
For some reason the TravisCI build has `-Waggregate-return` enabled as an error even though it's completely valid code. Also constify the input `color_name` argument to `load_color` function.
Modified Paths: -------------- src/msgwindow.c
Modified: src/msgwindow.c 21 lines changed, 9 insertions(+), 12 deletions(-) =================================================================== @@ -117,9 +117,8 @@ void msgwin_set_messages_dir(const gchar *messages_dir) }
-GdkColor load_color(gchar *color_name) { - GdkColor color; - +void load_color(const gchar *color_name, GdkColor *color) +{ #if GTK_CHECK_VERSION(3, 0, 0) GdkRGBA rgba_color; GtkWidgetPath *path = gtk_widget_path_new(); @@ -131,9 +130,9 @@ GdkColor load_color(gchar *color_name) { gtk_style_context_set_path(ctx, path); gtk_style_context_get_color(ctx, gtk_style_context_get_state(ctx), &rgba_color);
- color.red = 0xffff * rgba_color.red; - color.green = 0xffff * rgba_color.green; - color.blue = 0xffff * rgba_color.blue; + color->red = 0xffff * rgba_color.red; + color->green = 0xffff * rgba_color.green; + color->blue = 0xffff * rgba_color.blue;
gtk_widget_path_unref(path); g_object_unref(ctx); @@ -142,12 +141,10 @@ GdkColor load_color(gchar *color_name) {
GtkSettings *settings = gtk_settings_get_default(); GtkStyle *style = gtk_rc_get_style_by_paths(settings, path, NULL, GTK_TYPE_WIDGET); - color = style->fg[GTK_STATE_NORMAL]; + *color = style->fg[GTK_STATE_NORMAL];
g_free(path); #endif - - return color; }
@@ -170,9 +167,9 @@ void msgwin_init(void) ui_widget_modify_font_from_string(msgwindow.scribble, interface_prefs.msgwin_font); g_signal_connect(msgwindow.scribble, "populate-popup", G_CALLBACK(on_scribble_populate), NULL);
- color_error = load_color("geany-compiler-error"); - color_context = load_color("geany-compiler-context"); - color_message = load_color("geany-compiler-message"); + load_color("geany-compiler-error", &color_error); + load_color("geany-compiler-context", &color_context); + load_color("geany-compiler-message", &color_message); }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).