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

Add GSettings for LoadGraph UI colors #247

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

xcodian
Copy link

@xcodian xcodian commented Jan 29, 2023

Makes the background color and grid color for the load graphs configurable instead of being hardcoded to #FFFFFF and #E3E3E3.

New GSettings keys added to the schema:

  • load-graph-background-color (default: #FFFFFF)
  • load-graph-grid-color (default: #E3E3E3)

Fixes: #88

Makes the background color and grid color for the load graphs
configurable instead of being hardcoded to #FFFFFF and #E3E3E3.

New GSettings keys added to the schema:
* load-graph-background-color    (default: #FFFFFF)
* load-graph-grid-color          (default: #E3E3E3)

Fixes: mate-desktop#88
Copy link
Member

@zhuyaliang zhuyaliang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add blank lines at the end of each file?

Commit a28f81a accidentally added an
unnecessary blank line to:
- src/interface.cpp
- src/load-graph.cpp
- src/load-graph.h
- src/procman-app.cpp
- src/procman.h
- src/org.mate.system-monitor.gschema.xml.in

This commit reverts this by removing the new lines.
@xcodian
Copy link
Author

xcodian commented Jan 30, 2023

My mistake, my editor automatically added them and I didn't notice in the diff.
Commit 4e336a9 should have removed them now.

@zhuyaliang
Copy link
Member

There is a problem. When the load-graph-background-color and load-graph-grid-color GSettings is changed, no emit configure_event signal, so the background will not be cleared and repaint.

 g_signal_connect (G_OBJECT(disp), "configure_event",
                      G_CALLBACK (load_graph_configure), graph);

static gboolean
load_graph_configure (GtkWidget *widget,
                      GdkEventConfigure *event,
                      gpointer data_ptr)
{                     
....
    graph->clear_background();
....
}   

if (graph->background == NULL) {
        draw_background(graph);
}     

I think it should add clear_background:

    else if (g_str_equal (key, "load-graph-background-color")) {
        gdk_rgba_parse (&procdata->config.load_graph_background_color, color);
        procdata->cpu_graph->background_color = procdata->config.load_graph_background_color;
        procdata->mem_graph->background_color = procdata->config.load_graph_background_color;
        procdata->net_graph->background_color = procdata->config.load_graph_background_color;
        procdata->cpu_graph->clear_background (); 
        procdata->mem_graph->clear_background (); 
        procdata->net_graph->clear_background (); 
    }   
    else if (g_str_equal (key, "load-graph-grid-color")) {
        gdk_rgba_parse (&procdata->config.load_graph_grid_color, color);
        procdata->cpu_graph->grid_color = procdata->config.load_graph_grid_color;
        procdata->mem_graph->grid_color = procdata->config.load_graph_grid_color;
        procdata->net_graph->grid_color = procdata->config.load_graph_grid_color;
        procdata->cpu_graph->clear_background (); 
        procdata->mem_graph->clear_background (); 
        procdata->net_graph->clear_background (); 
    }   

Maybe there is a better way. This is just my suggestion

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

Successfully merging this pull request may close these issues.

Resources tab graph backgrounds hardcoded white
2 participants