config: save window and height.

If the user finds a comfortable size let's remember it.

Someone is bound to ask for that, just make it happen.
This commit is contained in:
Alastair Poole 2020-04-18 20:56:04 +01:00
parent f73d85c136
commit b33d69db8a
3 changed files with 17 additions and 3 deletions

View File

@ -11,6 +11,8 @@ typedef struct _Evisum_Config
int sort_type;
Eina_Bool sort_reverse;
int data_unit;
int width;
int height;
} Evisum_Config;
void config_init(void);

View File

@ -27,11 +27,18 @@ typedef struct _Item_Cache {
static void
_config_save(Ui *ui)
{
Evas_Coord w, h;
if (!_evisum_config) return;
if (!ui->ready) return;
evas_object_geometry_get(ui->win, NULL, NULL, &w, &h);
_evisum_config->sort_type = ui->sort_type;
_evisum_config->sort_reverse = ui->sort_reverse;
_evisum_config->data_unit = ui->data_unit;
_evisum_config->width = w;
_evisum_config->height = h;
config_save(_evisum_config);
}
@ -43,6 +50,11 @@ _config_load(Ui *ui)
ui->sort_type = _evisum_config->sort_type;
ui->sort_reverse = _evisum_config->sort_reverse;
ui->data_unit = _evisum_config->data_unit == 0 ? DATA_UNIT_MB : _evisum_config->data_unit;
if (_evisum_config->width > 0 && _evisum_config->height > 0)
{
evas_object_resize(ui->win, _evisum_config->width, _evisum_config->height);
}
}
static void
@ -2808,6 +2820,7 @@ _evisum_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
elm_genlist_clear(ui->genlist_procs);
_process_panel_update(ui);
_config_save(ui);
}
void

View File

@ -5,8 +5,8 @@
#include "process.h"
#include "configuration.h"
#define EVISUM_SIZE_WIDTH 600
#define EVISUM_SIZE_HEIGHT 520
#define EVISUM_SIZE_WIDTH 640
#define EVISUM_SIZE_HEIGHT 480
typedef enum
{
@ -52,7 +52,6 @@ typedef enum
SORT_BY_CPU_USAGE,
} Sort_Type;
#define TEXT_FIELD_MAX 65535
#define TAB_BTN_SIZE 75
typedef struct Ui