comparison src/prefs.c @ 5838:6aa7651c7c15

[gaim-migrate @ 6269] regain the ability to remember what plugins we had loaded committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 12 Jun 2003 05:01:11 +0000
parents fb9209877f37
children 96e5b32e75ad
comparison
equal deleted inserted replaced
5837:a48c338dff6c 5838:6aa7651c7c15
98 gaim_prefs_add_none("/core"); 98 gaim_prefs_add_none("/core");
99 gaim_prefs_add_none("/plugins"); 99 gaim_prefs_add_none("/plugins");
100 gaim_prefs_add_none("/plugins/core"); 100 gaim_prefs_add_none("/plugins/core");
101 gaim_prefs_add_none("/plugins/lopl"); 101 gaim_prefs_add_none("/plugins/lopl");
102 gaim_prefs_add_none("/plugins/prpl"); 102 gaim_prefs_add_none("/plugins/prpl");
103 gaim_prefs_add_string_list("/plugins/loaded", NULL);
103 104
104 /* XXX: this is where you would want to put prefs declarations */ 105 /* XXX: this is where you would want to put prefs declarations */
105 106
106 /* Away */ 107 /* Away */
107 gaim_prefs_add_none("/core/away"); 108 gaim_prefs_add_none("/core/away");
761 pref_value = attribute_values[i]; 762 pref_value = attribute_values[i];
762 } 763 }
763 } 764 }
764 765
765 if(!strcmp(element_name, "item")) { 766 if(!strcmp(element_name, "item")) {
766 struct gaim_pref *pref = find_pref(prefs_stack->data); 767 struct gaim_pref *pref;
768
769 pref_name_full = g_string_new("");
770
771 for(tmp = prefs_stack; tmp; tmp = tmp->next) {
772 pref_name_full = g_string_prepend(pref_name_full, tmp->data);
773 pref_name_full = g_string_prepend_c(pref_name_full, '/');
774 }
775
776 pref = find_pref(pref_name_full->str);
777
767 if(pref) { 778 if(pref) {
768 pref->value.stringlist = g_list_append(pref->value.stringlist, 779 pref->value.stringlist = g_list_append(pref->value.stringlist,
769 g_strdup(pref_value)); 780 g_strdup(pref_value));
770 } 781 }
771 return; 782 } else {
772 } else if(!pref_name || !strcmp(pref_name, "/")) { 783 if(!pref_name || !strcmp(pref_name, "/"))
773 return; 784 return;
774 } 785
775 786 pref_name_full = g_string_new(pref_name);
776 pref_name_full = g_string_new(pref_name); 787
777 788 for(tmp = prefs_stack; tmp; tmp = tmp->next) {
778 for(tmp = prefs_stack; tmp; tmp = tmp->next) { 789 pref_name_full = g_string_prepend_c(pref_name_full, '/');
790 pref_name_full = g_string_prepend(pref_name_full, tmp->data);
791 }
792
779 pref_name_full = g_string_prepend_c(pref_name_full, '/'); 793 pref_name_full = g_string_prepend_c(pref_name_full, '/');
780 pref_name_full = g_string_prepend(pref_name_full, tmp->data); 794
781 } 795 switch(pref_type) {
782 796 case GAIM_PREF_NONE:
783 pref_name_full = g_string_prepend_c(pref_name_full, '/'); 797 break;
784 798 case GAIM_PREF_BOOLEAN:
785 switch(pref_type) { 799 gaim_prefs_set_bool(pref_name_full->str, atoi(pref_value));
786 case GAIM_PREF_NONE: 800 break;
787 break; 801 case GAIM_PREF_INT:
788 case GAIM_PREF_BOOLEAN: 802 gaim_prefs_set_int(pref_name_full->str, atoi(pref_value));
789 gaim_prefs_set_bool(pref_name_full->str, atoi(pref_value)); 803 break;
790 break; 804 case GAIM_PREF_STRING:
791 case GAIM_PREF_INT: 805 gaim_prefs_set_string(pref_name_full->str, pref_value);
792 gaim_prefs_set_int(pref_name_full->str, atoi(pref_value)); 806 break;
793 break; 807 case GAIM_PREF_STRING_LIST:
794 case GAIM_PREF_STRING: 808 gaim_prefs_set_string_list(pref_name_full->str, NULL);
795 gaim_prefs_set_string(pref_name_full->str, pref_value); 809 break;
796 break; 810 }
797 case GAIM_PREF_STRING_LIST: 811 prefs_stack = g_list_prepend(prefs_stack, g_strdup(pref_name));
798 break; 812 g_string_free(pref_name_full, TRUE);
799 } 813 }
800
801 prefs_stack = g_list_prepend(prefs_stack, g_strdup(pref_name));
802 g_string_free(pref_name_full, TRUE);
803 } 814 }
804 815
805 static void prefs_end_element_handler(GMarkupParseContext *context, 816 static void prefs_end_element_handler(GMarkupParseContext *context,
806 const gchar *element_name, gpointer user_data, GError **error) { 817 const gchar *element_name, gpointer user_data, GError **error) {
807 if(!strcmp(element_name, "pref")) { 818 if(!strcmp(element_name, "pref")) {