Commit ee418191 authored by Ell's avatar Ell

app: various GimpDashboard improvements

Refactor GimpDashboard to autogenerate the UI based on a
description of the different variables, fields, and groups.

Allow individual groups to be expanded/collapsed, and individual
fields to be enabled/disabled.  Save the relevant state in the
dashboard's aux-info.

Add fields for the new GeglStats properties, as per GEGL commit
25c39ce6c9bb618f06ac96d118e624be66464d74.  The new fields are not
enabled by default.

Add "reset" action, to clear the history, and reset cumulative
data.
parent 354891d2
......@@ -43,7 +43,13 @@ static const GimpActionEntry dashboard_actions[] =
{ "dashboard-update-interval", NULL,
NC_("dashboard-action", "Update Interval") },
{ "dashboard-history-duration", NULL,
NC_("dashboard-action", "History Duration") }
NC_("dashboard-action", "History Duration") },
{ "dashboard-reset", GIMP_ICON_RESET,
NC_("dashboard-action", "Reset"), NULL,
NC_("dashboard-action", "Reset cumulative data"),
G_CALLBACK (dashboard_reset_cmd_callback),
GIMP_HELP_DASHBOARD_RESET },
};
static const GimpToggleActionEntry dashboard_toggle_actions[] =
......@@ -149,7 +155,7 @@ dashboard_actions_update (GimpActionGroup *group,
#define SET_ACTIVE(action,condition) \
gimp_action_group_set_action_active (group, action, (condition) != 0)
switch (dashboard->update_interval)
switch (gimp_dashboard_get_update_interval (dashboard))
{
case GIMP_DASHBOARD_UPDATE_INTERVAL_0_25_SEC:
SET_ACTIVE ("dashboard-update-interval-0-25-sec", TRUE);
......@@ -168,7 +174,7 @@ dashboard_actions_update (GimpActionGroup *group,
break;
}
switch (dashboard->history_duration)
switch (gimp_dashboard_get_history_duration (dashboard))
{
case GIMP_DASHBOARD_HISTORY_DURATION_15_SEC:
SET_ACTIVE ("dashboard-history-duration-15-sec", TRUE);
......@@ -188,7 +194,7 @@ dashboard_actions_update (GimpActionGroup *group,
}
SET_ACTIVE ("dashboard-low-swap-space-warning",
dashboard->low_swap_space_warning);
gimp_dashboard_get_low_swap_space_warning (dashboard));
#undef SET_ACTIVE
}
......@@ -61,6 +61,15 @@ dashboard_history_duration_cmd_callback (GtkAction *action,
gimp_dashboard_set_history_duration (dashboard, history_duration);
}
void
dashboard_reset_cmd_callback (GtkAction *action,
gpointer data)
{
GimpDashboard *dashboard = GIMP_DASHBOARD (data);
gimp_dashboard_reset (dashboard);
}
void
dashboard_low_swap_space_warning_cmd_callback (GtkAction *action,
gpointer data)
......
......@@ -26,6 +26,9 @@ void dashboard_history_duration_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
void dashboard_reset_cmd_callback (GtkAction *action,
gpointer data);
void dashboard_low_swap_space_warning_cmd_callback (GtkAction *action,
gpointer data);
......
This diff is collapsed.
......@@ -33,34 +33,14 @@
#define GIMP_DASHBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DASHBOARD, GimpDashboardClass))
typedef struct _GimpDashboardClass GimpDashboardClass;
typedef struct _GimpDashboardPrivate GimpDashboardPrivate;
typedef struct _GimpDashboardClass GimpDashboardClass;
struct _GimpDashboard
{
GimpEditor parent_instance;
GimpEditor parent_instance;
Gimp *gimp;
GtkWidget *cache_meter;
GtkWidget *cache_occupied_label;
GtkWidget *cache_limit_label;
GtkWidget *swap_meter;
GtkWidget *swap_occupied_label;
GtkWidget *swap_size_label;
GtkWidget *swap_limit_label;
gint timeout_id;
gint low_swap_space_idle_id;
GThread *thread;
GMutex mutex;
GCond cond;
gboolean quit;
GimpDashboardUpdateInteval update_interval;
GimpDashboardHistoryDuration history_duration;
gboolean low_swap_space_warning;
GimpDashboardPrivate *priv;
};
struct _GimpDashboardClass
......@@ -69,17 +49,24 @@ struct _GimpDashboardClass
};
GType gimp_dashboard_get_type (void) G_GNUC_CONST;
GType gimp_dashboard_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_dashboard_new (Gimp *gimp,
GimpMenuFactory *menu_factory);
void gimp_dashboard_reset (GimpDashboard *dashboard);
void gimp_dashboard_set_update_interval (GimpDashboard *dashboard,
GimpDashboardUpdateInteval update_interval);
GimpDashboardUpdateInteval gimp_dashboard_get_update_interval (GimpDashboard *dashboard);
GtkWidget * gimp_dashboard_new (Gimp *gimp,
GimpMenuFactory *menu_factory);
void gimp_dashboard_set_history_duration (GimpDashboard *dashboard,
GimpDashboardHistoryDuration history_duration);
GimpDashboardHistoryDuration gimp_dashboard_get_history_duration (GimpDashboard *dashboard);
void gimp_dashboard_set_update_interval (GimpDashboard *dashboard,
GimpDashboardUpdateInteval update_interval);
void gimp_dashboard_set_history_duration (GimpDashboard *dashboard,
GimpDashboardHistoryDuration history_duration);
void gimp_dashboard_set_low_swap_space_warning (GimpDashboard *dashboard,
gboolean low_swap_space_warning);
void gimp_dashboard_set_low_swap_space_warning (GimpDashboard *dashboard,
gboolean low_swap_space_warning);
gboolean gimp_dashboard_get_low_swap_space_warning (GimpDashboard *dashboard);
#endif /* __GIMP_DASHBOARD_H__ */
......@@ -665,6 +665,7 @@
#define GIMP_HELP_DASHBOARD_DIALOG "gimp-dashboard-dialog"
#define GIMP_HELP_DASHBOARD_UPDATE_INTERVAL "gimp-dashboard-update-interval"
#define GIMP_HELP_DASHBOARD_HISTORY_DURATION "gimp-dashboard-history-duration"
#define GIMP_HELP_DASHBOARD_RESET "gimp-dashboard-reset"
#define GIMP_HELP_DASHBOARD_LOW_SWAP_SPACE_WARNING "gimp-dashboard-low-swap-space-warning"
#define GIMP_HELP_DOCK "gimp-dock"
......
......@@ -17,6 +17,7 @@
<menuitem action="dashboard-history-duration-120-sec" />
<menuitem action="dashboard-history-duration-240-sec" />
</menu>
<menuitem action="dashboard-reset" />
<separator />
<menuitem action="dashboard-low-swap-space-warning" />
</popup>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment