Fixed section management errors

pull/37/head
parent a5c0a611ab
commit 1e37e87854

@ -495,7 +495,7 @@ void on_sections_add(GtkWidget *button, actionWidgets *widgets){
SectionSettingSegment *segment=yon_create_section_setting(category_name,category_categories); SectionSettingSegment *segment=yon_create_section_setting(category_name,category_categories);
dictionary *newsection = yon_dictionary_get_last(main_config.SettingsSections); dictionary *newsection = yon_dictionary_get_last(main_config.SettingsSections);
newsection=yon_dictionary_create_with_data_connected(newsection,category_name,segment); newsection=yon_dictionary_create_with_data_connected(newsection,category_name,segment);
printf("%s\n",category_name); // printf("%s\n",category_name);
dictionary *newsec=yon_dictionary_create_empty(); dictionary *newsec=yon_dictionary_create_empty();
newsec=yon_section_new(newsec,category_name,category_categories); newsec=yon_section_new(newsec,category_name,category_categories);
main_config.sections=yon_dictionary_create_with_data_connected(main_config.sections,category_name,newsec->data); main_config.sections=yon_dictionary_create_with_data_connected(main_config.sections,category_name,newsec->data);
@ -656,7 +656,7 @@ void on_reveal_banner(GtkWidget *button, actionWidgets *widgets){
} }
void on_double_click_changed(GtkWidget *Switch, gboolean state, dictionary *widgetsD){ void on_double_click_changed(GtkWidget *Switch, gboolean state, dictionary *widgetsD){
printf("%s\n","SGRBHSDRFJHNSDRJHNSDRJHNDRDJR"); // printf("%s\n","SGRBHSDRFJHNSDRJHNSDRJHNDRDJR");
*main_config.currentDoubleClick=state; *main_config.currentDoubleClick=state;
update_double_clicks(widgetsD); update_double_clicks(widgetsD);
} }
@ -1089,11 +1089,8 @@ char *yon_char_divide_search(char *source, char* dividepos, int delete_divider){
void yon_set_default_sections(dictionary *section){ void yon_set_default_sections(dictionary *section){
yon_section_new(section,"Personal","X-UBL-SettingsManager;X-UBL-PersonalSettings;"); yon_section_new(section,"Personal","X-UBL-SettingsManager;X-UBL-PersonalSettings;");
section=yon_dictionary_create_conneced(section);
yon_section_new(section,"Hardware","X-UBL-SettingsManager;X-UBL-HardwareSettings;"); yon_section_new(section,"Hardware","X-UBL-SettingsManager;X-UBL-HardwareSettings;");
section=yon_dictionary_create_conneced(section);
yon_section_new(section,"System","X-UBL-SettingsManager;X-UBL-SystemSettings;"); yon_section_new(section,"System","X-UBL-SettingsManager;X-UBL-SystemSettings;");
section=yon_dictionary_create_conneced(section);
yon_section_new(section,"Misc","X-UBL-SettingsManager;X-UBL-MiscSettings;"); yon_section_new(section,"Misc","X-UBL-SettingsManager;X-UBL-MiscSettings;");
} }
@ -1187,21 +1184,18 @@ void yon_check_path(char *path){
} }
dictionary *yon_section_new(dictionary *section, char *section_name, char *categories){ dictionary *yon_section_new(dictionary *section, char *section_name, char *categories){
section->next=NULL;
IconSection *sct=malloc(sizeof(IconSection)); IconSection *sct=malloc(sizeof(IconSection));
dictionary *dict=yon_dictionary_create_empty();//malloc(sizeof(dictionary));
sct->section=section_name; sct->section=section_name;
sct->categories=categories; sct->categories=categories;
dict->data=sct; if (!section->data&&!section->prev){
if (!section->data){ section->data=sct;
section->data=dict->data;
section->first=section; section->first=section;
section->key=section_name; section->key=section_name;
} else { } else {
dict->first=section->first; section=yon_dictionary_get_last(section);
section->next=dict; section->next=yon_dictionary_create_conneced(section);
dict->prev=section; section->next->data=sct;
dict->key=section_name; section->next->key=section_name;
section=section->next; section=section->next;
} }
@ -1284,6 +1278,14 @@ dictionary *yon_dictionary_rip(dictionary *dict){
} }
} }
dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect){
dictionary *dict=yon_dictionary_get_last(old);
dict->next=toconnect;
toconnect->prev=dict;
toconnect->first=dict->first;
return toconnect;
}
void yon_switch_theme(dictionary **dict, dictionary *newone){ void yon_switch_theme(dictionary **dict, dictionary *newone){
dictionary *dct=*dict; dictionary *dct=*dict;
actionWidgets *widgets=(actionWidgets*)dct->data; actionWidgets *widgets=(actionWidgets*)dct->data;
@ -1610,8 +1612,9 @@ dictionary *yon_dictionary_switch_places(dictionary *dict,int aim){
} }
dictionary *yon_dictionary_get_last(dictionary *dict){ dictionary *yon_dictionary_get_last(dictionary *dict){
for (dictionary *dct=dict;dct!=NULL;dct=dct->next){} dictionary *dct=NULL;
return dict; for (dct=dict->first;dct->next!=NULL;dct=dct->next){}
return dct;
} }
void yon_main_quit(actionWidgets *widgets){ void yon_main_quit(actionWidgets *widgets){

@ -229,6 +229,7 @@ dictionary *yon_dictionary_get_last(dictionary *dict);
dictionary *yon_dictionary_switch_places(dictionary *dict,int aim); dictionary *yon_dictionary_switch_places(dictionary *dict,int aim);
dictionary *yon_dictionary_create_with_data(char *key, void *data); dictionary *yon_dictionary_create_with_data(char *key, void *data);
dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data); dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data);
dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect);
SectionSettingSegment *yon_create_section_setting(char *name, char *categories); SectionSettingSegment *yon_create_section_setting(char *name, char *categories);
void yon_segments_show(actionWidgets *widgets); void yon_segments_show(actionWidgets *widgets);
void yon_segments_hide(actionWidgets *widgets); void yon_segments_hide(actionWidgets *widgets);

@ -13,6 +13,7 @@ LabelDensity=0
User= User=
GnomeDoubleClick=false GnomeDoubleClick=false
MainDoubleClick=true MainDoubleClick=true
BannerHidden=false
[sections] [sections]
Personal=X-UBL-SettingsManager;X-UBL-PersonalSettings; Personal=X-UBL-SettingsManager;X-UBL-PersonalSettings;

@ -24,7 +24,7 @@
<property name="margin-end">20</property> <property name="margin-end">20</property>
<property name="margin-top">20</property> <property name="margin-top">20</property>
<property name="margin-bottom">20</property> <property name="margin-bottom">20</property>
<property name="icon-name">dialog-question-symbolic</property> <property name="icon-name">dialog-information-symbolic</property>
<property name="icon_size">6</property> <property name="icon_size">6</property>
</object> </object>
<packing> <packing>
@ -89,7 +89,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="pixel-size">32</property> <property name="pixel-size">32</property>
<property name="icon-name">dialog-question-symbolic</property> <property name="icon-name">dialog-information-symbolic</property>
<property name="icon_size">5</property> <property name="icon_size">5</property>
</object> </object>
</child> </child>
@ -1054,7 +1054,6 @@
</object> </object>
<object class="GtkWindow" id="SectionSettingsWindow"> <object class="GtkWindow" id="SectionSettingsWindow">
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="modal">True</property>
<property name="default-width">800</property> <property name="default-width">800</property>
<property name="default-height">600</property> <property name="default-height">600</property>
<child> <child>
@ -1250,8 +1249,8 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkButton" id="SectionSettingsCloseButton"> <object class="GtkButton" id="SectionSettingsSaveButton">
<property name="label" translatable="yes">Close</property> <property name="label" translatable="yes">Save and apply</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
@ -1266,12 +1265,12 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="SectionSettingsSaveButton"> <object class="GtkButton" id="SectionSettingsCloseButton">
<property name="label" translatable="yes">Save and apply</property> <property name="label" translatable="yes">Close</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<property name="margin-end">17</property> <property name="margin-end">15</property>
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
</object> </object>
<packing> <packing>

Loading…
Cancel
Save