Сделал таблицу generate

pull/24/head
Igor Belitskiy 2 years ago
parent 0efc525246
commit 9fb0e73b34

@ -136,6 +136,7 @@ void entry_user_disk(GtkWidget *self,int* flag_update) {
g_object_ref(cfg_custom_gui.user.liststore);
gtk_list_store_clear(cfg_custom_gui.user.liststore);
}
wrapper_fill_tree_view_generate(&all_config, &cfg_custom_gui);
}
void entry_groups_disk(GtkWidget *self,int* flag_update) {
if (flag_update) {
@ -151,6 +152,7 @@ void entry_groups_disk(GtkWidget *self,int* flag_update) {
g_object_ref(cfg_custom_gui.group.liststore);
gtk_list_store_clear(cfg_custom_gui.group.liststore);
}
wrapper_fill_tree_view_generate(&all_config, &cfg_custom_gui);
}
void entry_project_disk(GtkWidget *self,int* flag_update) {
if (flag_update) {
@ -163,6 +165,7 @@ void entry_project_disk(GtkWidget *self,int* flag_update) {
g_object_ref(cfg_custom_gui.project.liststore);
gtk_list_store_clear(cfg_custom_gui.project.liststore);
}
wrapper_fill_tree_view_generate(&all_config, &cfg_custom_gui);
}
void tree_view_select_user(GtkWidget* self) {

@ -69,8 +69,6 @@ char* format_actors(vector* vec_actors) {
return str_all;
}
int fill_tree_view_project(config_all* all_config,hotebook* widget , char* str_fill, int flag_gui_add) {
GtkTreeModel *model = GTK_TREE_MODEL(widget->liststore);
if (flag_gui_add == 0) {
@ -169,3 +167,74 @@ char* wrapper_str_time(size_t seconds) {
return t.str_time;
}
char* quota_type(char* str_quota) {
if (strcmp(str_quota, "usrquota")==0) {
return STR_USER;
}
else if (strcmp(str_quota, "grpquota")==0) {
return STR_GROUP;
}
else if (strcmp(str_quota, "prjquota")==0) {
return STR_PROJECT;
}
}
char quota_fill_generate(char* str_quota, config_u_g_p* _config, GtkListStore* list_store, GtkTreeIter* iter) {
int index = -1;
if (strcmp(str_quota, "usrquota")==0) {
index = 3;
}
else if (strcmp(str_quota, "grpquota")==0) {
index = 4;
}
else if (strcmp(str_quota, "prjquota")==0) {
index = 5;
}
if (index != -1) {
gtk_list_store_set(list_store,iter,index,format_actors(&_config->actors), -1);
}
}
int pars_status_generate(vector* vec_remove, char* disk) {
int flag = -1;
if (vec_remove->vectorList.total > 0) {
for (int i = 0; i < vec_remove->vectorList.total; i++) {
disk_status* _config = (disk_status*)vec_remove->pfVectorGet(vec_remove, i);
if (strstr(_config->device, disk)) {
flag=1;
}
}
}
if (flag<0) {
return 1;
}
return flag;
}
int fill_tree_view_generate(vector* vec_fill, vector* vec_remove, char* str_fill, GtkWidget* tree_view, GtkListStore* liststoreGeneral) {
GtkTreeModel *model = GTK_TREE_MODEL(liststoreGeneral);
if (vec_fill->vectorList.total > 0) {
for (int i = 0; i < vec_fill->vectorList.total; i++) {
config_u_g_p* _config = (config_u_g_p*)vec_fill->pfVectorGet(vec_fill, i);
GtkTreeIter iter;
gtk_list_store_append(liststoreGeneral,&iter);
char* deferring_size = wrapper_str_time(_config->deferring_size);
char* deferring_file = wrapper_str_time(_config->deferring_file);
quota_fill_generate(str_fill, _config,liststoreGeneral,&iter);
gtk_list_store_set(liststoreGeneral,&iter,
0,pars_status_generate(vec_remove,_config->UNIX_file),
1,quota_type(str_fill),
2,_config->UNIX_file,
6,philos_format_cfg_str_size_memory("", _config->soft_restriction_size,_config->soft_restriction_size_pow),
7,philos_format_cfg_str_size_memory("", _config->severe_limitation_size,_config->severe_limitation_size_pow),
8,yon_char_from_int(_config->soft_restriction_file),
9,yon_char_from_int(_config->severe_limitation_file),
10,deferring_size,
11,deferring_file,
-1);
}
}
gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view), model);
return 1;
}

@ -64,4 +64,5 @@ char* format_actors(vector* vec_actors);
void model_free_vector_string(vector* vec_str);
int fill_tree_view_user_group(config_all* all_config, char* disk, hotebook* widget,char* str_fill , int flag_gui_add);
int fill_tree_view_project(config_all* all_config, hotebook* widget, char* str_fill , int flag_gui_add);
int fill_tree_view_generate(vector* vec_fill, vector* vec_remove, char* str_fill, GtkWidget* tree_view, GtkListStore* liststoreGeneral);
#endif

@ -129,6 +129,15 @@ void config_init(config_settings_gui* main_config){
_main_config->lock_save_local=0;
}
void wrapper_fill_tree_view_generate(config_all* all_config, custom_window* custom) {
g_object_ref(custom->liststoreGeneral);
gtk_list_store_clear(custom->liststoreGeneral);
fill_tree_view_generate(&all_config->v_user, &all_config->v_remove, "usrquota",custom->treeViewGeneral, custom->liststoreGeneral);
fill_tree_view_generate(&all_config->v_group, &all_config->v_remove, "grpquota",custom->treeViewGeneral, custom->liststoreGeneral);
fill_tree_view_generate(&all_config->v_project, &all_config->v_remove, "prjquota",custom->treeViewGeneral, custom->liststoreGeneral);
}
main_window *setup_window(main_window* widgets, custom_window* custom_widgets){
/* Widgets getting | Получение виджетов */
widgets = malloc(sizeof(main_window));
@ -220,7 +229,8 @@ custom_window *setup_window_custom(custom_window* custom_widgets, GtkBuilder *bu
custom_widgets->group.liststore = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreGroups"));
custom_widgets->project.liststore = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreProject"));
custom_widgets->liststoreGeneral = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststoreGeneral"));
custom_widgets->treeViewGeneral = yon_gtk_builder_get_widget(builder,"GeneralQuotasTree");
custom_widgets->user.spinWeeksSize = yon_gtk_builder_get_widget(builder,"generalUsersSizWeeksSpin");
custom_widgets->group.spinWeeksSize = yon_gtk_builder_get_widget(builder,"generalGroupsSizeWeeksSpi");
custom_widgets->project.spinWeeksSize = yon_gtk_builder_get_widget(builder,"generalProjectSizWeeksSpin");

@ -87,7 +87,7 @@ typedef struct {
} main_window;
typedef struct {
GtkWidget *treeViewMain;
GtkWidget *treeViewGeneral;
GtkListStore *liststoreGeneral;
hotebook user;
hotebook group;
@ -128,4 +128,5 @@ int wrapper_select_tree_view(hotebook* widgets);
int tree_view_edit(config_all* _all_config, vector* vec_temp, hotebook* widgets);
void set_time_spin(hotebook* widgets, size_t seconds_file, size_t seconds_size);
void template_set_status_disk(GtkWidget* self,hotebook* widgets);
void wrapper_fill_tree_view_generate(config_all* all_config, custom_window* custom);
#endif

@ -66,4 +66,9 @@
#define DAYS _("d ")
#define HOURS _("h ")
#define MINUTES _("m ")
#define SAVE_FAILED_LABEL
#define SAVE_FAILED_LABEL
#define STR_USER _("User");
#define STR_GROUP _("Group");
#define STR_PROJECT _("Project");

@ -47,6 +47,7 @@ temp_set_window *temp_setup_window_base(char* __glade_path) {
}
return temp_widgets;
}
temp_set_window *temp_setup_window_custom(temp_set_window* temp_widgets, GtkBuilder *builder) {
vector_init(&temp_vec_actors);
temp_widgets->lblSetUGP = yon_gtk_builder_get_widget(builder, "lblSetUGP");

@ -1598,7 +1598,34 @@ translated and supported by community.</property>
</object>
</child>
</object>
<object class="GtkListStore" id="liststoreGeneral"/>
<object class="GtkListStore" id="liststoreGeneral">
<columns>
<!-- column-name gboolean1 -->
<column type="gboolean"/>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
<!-- column-name gchararray2 -->
<column type="gchararray"/>
<!-- column-name gchararray3 -->
<column type="gchararray"/>
<!-- column-name gchararray4 -->
<column type="gchararray"/>
<!-- column-name gchararray5 -->
<column type="gchararray"/>
<!-- column-name gchararray6 -->
<column type="gchararray"/>
<!-- column-name gchararray7 -->
<column type="gchararray"/>
<!-- column-name gchararray8 -->
<column type="gchararray"/>
<!-- column-name gchararray9 -->
<column type="gchararray"/>
<!-- column-name gchararray10 -->
<column type="gchararray"/>
<!-- column-name gchararray11 -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="liststoreGroups">
<columns>
<!-- column-name gchararray1 -->
@ -2080,7 +2107,7 @@ translated and supported by community.</property>
<object class="GtkTreeView" id="GeneralQuotasTree">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">liststoreUser</property>
<property name="model">liststoreGeneral</property>
<property name="search-column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
@ -2090,7 +2117,10 @@ translated and supported by community.</property>
<property name="title" translatable="yes">Status</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<object class="GtkCellRendererToggle"/>
<attributes>
<attribute name="active">0</attribute>
</attributes>
</child>
</object>
</child>
@ -2100,6 +2130,9 @@ translated and supported by community.</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
@ -2110,6 +2143,9 @@ Project</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
@ -2119,6 +2155,9 @@ Project</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
@ -2128,6 +2167,9 @@ Project</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">4</attribute>
</attributes>
</child>
</object>
</child>
@ -2137,6 +2179,9 @@ Project</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">5</attribute>
</attributes>
</child>
</object>
</child>
@ -2148,6 +2193,9 @@ Restriction
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">6</attribute>
</attributes>
</child>
</object>
</child>
@ -2159,6 +2207,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">7</attribute>
</attributes>
</child>
</object>
</child>
@ -2170,6 +2221,9 @@ Restriction
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">8</attribute>
</attributes>
</child>
</object>
</child>
@ -2181,6 +2235,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">9</attribute>
</attributes>
</child>
</object>
</child>
@ -2191,6 +2248,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">10</attribute>
</attributes>
</child>
</object>
</child>
@ -2201,6 +2261,9 @@ limitation
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">11</attribute>
</attributes>
</child>
</object>
</child>

Loading…
Cancel
Save