diff --git a/gresource.xml b/gresource.xml
index 8ddfb99..a57eede 100644
--- a/gresource.xml
+++ b/gresource.xml
@@ -6,6 +6,7 @@
ubl-settings-update-web-publication-add.glade
ubl-settings-update-mirror-add.glade
ubl-settings-update-mirror-path-add.glade
+ ubl-settings-update-repo-path-add.glade
ubl-settings-update-mirror-configure.glade
ubl-settings-update-password.glade
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 4c61581..330c856 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -36,6 +36,7 @@ set(DEPENDFILES
../ubl-settings-update-web-publication-add.glade
../ubl-settings-update-mirror-add.glade
../ubl-settings-update-mirror-path-add.glade
+ ../ubl-settings-update-repo-path-add.glade
../ubl-settings-update-mirror-configure.glade
../ubl-settings-update-password.glade
../gresource.xml
diff --git a/source/ubl-settings-update.c b/source/ubl-settings-update.c
index 06991d7..2b341cd 100644
--- a/source/ubl-settings-update.c
+++ b/source/ubl-settings-update.c
@@ -996,11 +996,11 @@ void on_repo_accept_clicked(GtkWidget *, dictionary *dict){
}
int enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->EnabledCheck));
char *sources = "";
- GList *list = gtk_container_get_children(GTK_CONTAINER(window->SourceBox));
- for (guint i=0;isections){
+
+ char *cur = yon_char_unite(gtk_combo_box_get_active_id(GTK_COMBO_BOX(((path_section*)dact->data)->TypeCombo)),"@",(char*)gtk_entry_get_text(GTK_ENTRY(((path_section*)dact->data)->PathEntry)),NULL);
+ char *temp = yon_char_unite(sources,!yon_char_is_empty(sources)?",":"",cur,NULL);
if (!yon_char_is_empty(sources)) free(sources);
sources = temp;
}
@@ -1144,16 +1144,14 @@ void on_mirror_accept(GtkWidget *,dictionary *dict){
mirror_add_window *window = yon_dictionary_get_data(dict->first->next,mirror_add_window*);
char *name = (char*)gtk_entry_get_text(GTK_ENTRY(window->NameEntry));
char *paths = "";
- GList *list = gtk_container_get_children(GTK_CONTAINER(window->PathBox));
- for (guint i=0;isections){
+
+ char *cur = yon_char_unite(gtk_combo_box_get_active_id(GTK_COMBO_BOX(((path_section*)dact->data)->TypeCombo)),"@",(char*)gtk_entry_get_text(GTK_ENTRY(((path_section*)dact->data)->PathEntry)),NULL);
char *temp = yon_char_unite(paths,!yon_char_is_empty(paths)?",":"",cur,NULL);
if (!yon_char_is_empty(paths)) free(paths);
paths = temp;
- g_list_free(container);
}
- g_list_free(list);
if (!yon_char_is_empty(window->name)&&strcmp(name,window->name)){
yon_config_remove_by_key(REPOPUBLIC_CACHE_full(window->name));
}
@@ -1261,23 +1259,50 @@ void on_password_accept(GtkWidget *,dictionary *dict){
}
-void on_mirror_path_removed(GtkWidget *, GtkWidget *target){
- if (GTK_IS_WIDGET(target)){
- gtk_widget_destroy(target);
+void on_mirror_path_removed(GtkWidget *self, mirror_add_window *window){
+ int found=0;
+ dictionary *dict = NULL;
+ for_dictionaries(dict, window->sections){
+ if (self == ((path_section*)dict->data)->PathRemoveButton){
+ found =1;
+ break;
+ }
+ }
+ if (!found) return;
+ if (GTK_IS_WIDGET(((path_section*)dict->data)->PathRemovalBox)){
+ gtk_widget_destroy(((path_section*)dict->data)->PathRemovalBox);
+ window->sections = yon_dictionary_rip(dict);
}
}
-void on_mirror_path_edit(GtkWidget*,GtkWidget *target){
- GList *container = gtk_container_get_children(GTK_CONTAINER(target));
- if (gtk_editable_get_editable(GTK_EDITABLE(g_list_nth_data(container,0)))){
- gtk_editable_set_editable(GTK_EDITABLE(g_list_nth_data(container,0)),0);
- GtkWidget *image = gtk_button_get_image(GTK_BUTTON(g_list_nth_data(container,1)));
- gtk_entry_set_has_frame(GTK_ENTRY(g_list_nth_data(container,0)),0);
+void on_mirror_path_edit(GtkWidget *self,mirror_add_window *window){
+ int active = 0;
+ dictionary *cur = NULL;
+ dictionary *dict = NULL;
+ for_dictionaries(dict, window->sections){
+ if (self == ((path_section*)dict->data)->PathEditButton){
+
+ cur = dict;
+ break;
+ }
+ if (((path_section*)dict->data)->edits) {
+ active = 1;
+ }
+ }
+ if (!cur||active) return;
+ if (gtk_editable_get_editable(GTK_EDITABLE(((path_section*)dict->data)->PathEntry))){
+ ((path_section*)dict->data)->edits=1;
+ gtk_editable_set_editable(GTK_EDITABLE(((path_section*)dict->data)->PathEntry),0);
+ gtk_widget_set_sensitive(((path_section*)dict->data)->TypeCombo,0);
+ GtkWidget *image = gtk_button_get_image(GTK_BUTTON(((path_section*)dict->data)->PathEditButton));
+ gtk_entry_set_has_frame(GTK_ENTRY(((path_section*)dict->data)->PathEntry),0);
gtk_image_set_from_icon_name(GTK_IMAGE(image),edit_icon_name,GTK_ICON_SIZE_BUTTON);
} else {
- gtk_editable_set_editable(GTK_EDITABLE(g_list_nth_data(container,0)),1);
- GtkWidget *image = gtk_button_get_image(GTK_BUTTON(g_list_nth_data(container,1)));
- gtk_entry_set_has_frame(GTK_ENTRY(g_list_nth_data(container,0)),1);
+ ((path_section*)dict->data)->edits=0;
+ gtk_widget_set_sensitive(((path_section*)dict->data)->TypeCombo,1);
+ gtk_editable_set_editable(GTK_EDITABLE(((path_section*)dict->data)->PathEntry),1);
+ GtkWidget *image = gtk_button_get_image(GTK_BUTTON(((path_section*)dict->data)->PathEditButton));
+ gtk_entry_set_has_frame(GTK_ENTRY(((path_section*)dict->data)->PathEntry),1);
gtk_image_set_from_icon_name(GTK_IMAGE(image),accept_icon_name,GTK_ICON_SIZE_BUTTON);
}
}
@@ -1289,14 +1314,26 @@ void on_mirror_path_add(GtkWidget *, mirror_add_window *window){
yon_ubl_status_highlight_incorrect(window->TypeEntry);
return;
}
- char *type = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->TypeCombo));
- char *full_name = yon_char_unite(type,"@",target,NULL);
- gtk_entry_set_text(GTK_ENTRY(window->TypeEntry),"");
+
GtkBuilder *builder = gtk_builder_new_from_resource(glade_mirror_path_add_path);
- gtk_box_pack_start(GTK_BOX(window->PathBox),yon_gtk_builder_get_widget(builder,"PathRemovalBox"),0,0,2);
- gtk_entry_set_text(GTK_ENTRY(gtk_builder_get_object(builder,"PathEntry")),full_name);
- g_signal_connect(gtk_builder_get_object(builder,"PathEditButton"),"clicked",G_CALLBACK(on_mirror_path_edit),gtk_builder_get_object(builder,"PathRemovalBox"));
- g_signal_connect(gtk_builder_get_object(builder,"PathRemoveButton"),"clicked",G_CALLBACK(on_mirror_path_removed),gtk_builder_get_object(builder,"PathRemovalBox"));
+
+ path_section *section = malloc(sizeof(path_section));
+ section->PathRemovalBox = yon_gtk_builder_get_widget(builder,"PathRemovalBox");
+ section->PathEditButton = yon_gtk_builder_get_widget(builder,"PathEditButton");
+ section->PathEntry = yon_gtk_builder_get_widget(builder,"PathEntry");
+ section->PathRemoveButton = yon_gtk_builder_get_widget(builder,"PathRemoveButton");
+ section->TypeCombo = yon_gtk_builder_get_widget(builder,"TypeCombo");
+ section->edits=0;
+
+ gtk_combo_box_set_active_id(GTK_COMBO_BOX(section->TypeCombo),gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->TypeCombo)));
+ yon_dictionary_add_or_create_if_exists_with_data(window->sections,(char*)target,section);
+
+ gtk_entry_set_text(GTK_ENTRY(section->PathEntry),target);
+ gtk_entry_set_text(GTK_ENTRY(window->TypeEntry),"");
+ gtk_box_pack_start(GTK_BOX(window->PathBox),section->PathRemovalBox,0,0,2);
+
+ g_signal_connect(gtk_builder_get_object(builder,"PathEditButton"),"clicked",G_CALLBACK(on_mirror_path_edit),window);
+ g_signal_connect(gtk_builder_get_object(builder,"PathRemoveButton"),"clicked",G_CALLBACK(on_mirror_path_removed),window);
}
@@ -1307,14 +1344,25 @@ void on_repo_source_add(GtkWidget *, repo_add_window *window){
yon_ubl_status_highlight_incorrect(window->RepoSourceEntry);
return;
}
- char *type = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->RepoSourceCombo));
- char *full_name = yon_char_append(type,target);
+
+ GtkBuilder *builder = gtk_builder_new_from_resource(glade_repo_path_add_path);
+
+ path_section *section = malloc(sizeof(path_section));
+ section->PathRemovalBox = yon_gtk_builder_get_widget(builder,"PathRemovalBox");
+ section->PathEditButton = yon_gtk_builder_get_widget(builder,"PathEditButton");
+ section->PathEntry = yon_gtk_builder_get_widget(builder,"PathEntry");
+ section->PathRemoveButton = yon_gtk_builder_get_widget(builder,"PathRemoveButton");
+ section->TypeCombo = yon_gtk_builder_get_widget(builder,"TypeCombo");
+ section->edits=0;
+
+ gtk_combo_box_set_active_id(GTK_COMBO_BOX(section->TypeCombo),gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->RepoSourceCombo)));
+ yon_dictionary_add_or_create_if_exists_with_data(window->sections,(char*)target,section);
+
+ gtk_entry_set_text(GTK_ENTRY(section->PathEntry),target);
gtk_entry_set_text(GTK_ENTRY(window->RepoSourceEntry),"");
- GtkBuilder *builder = gtk_builder_new_from_resource(glade_mirror_path_add_path);
- gtk_box_pack_start(GTK_BOX(window->SourceBox),yon_gtk_builder_get_widget(builder,"PathRemovalBox"),0,0,2);
- gtk_entry_set_text(GTK_ENTRY(gtk_builder_get_object(builder,"PathEntry")),full_name);
- g_signal_connect(gtk_builder_get_object(builder,"PathEditButton"),"clicked",G_CALLBACK(on_mirror_path_edit),gtk_builder_get_object(builder,"PathRemovalBox"));
- g_signal_connect(gtk_builder_get_object(builder,"PathRemoveButton"),"clicked",G_CALLBACK(on_mirror_path_removed),gtk_builder_get_object(builder,"PathRemovalBox"));
+ gtk_box_pack_start(GTK_BOX(window->SourceBox),section->PathRemovalBox,0,0,2);
+ g_signal_connect(gtk_builder_get_object(builder,"PathEditButton"),"clicked",G_CALLBACK(on_mirror_path_edit),window);
+ g_signal_connect(gtk_builder_get_object(builder,"PathRemoveButton"),"clicked",G_CALLBACK(on_mirror_path_removed),window);
}
void on_file_chooser_open(GtkWidget *, GtkEntry *target){
@@ -1388,6 +1436,7 @@ repo_add_window *yon_repo_add_window_new(){
window->PackageTrustAllRadio = yon_gtk_builder_get_widget(builder,"PackageTrustAllRadio");
window->DatabaseTrustAllRadio = yon_gtk_builder_get_widget(builder,"DatabaseTrustAllRadio");
+ window->sections = NULL;
window->name=NULL;
g_signal_connect(G_OBJECT(window->RepoSourceButton),"clicked",G_CALLBACK(on_file_chooser_open),window->RepoSourceEntry);
g_signal_connect(G_OBJECT(window->RepoSourceAddButton),"clicked",G_CALLBACK(on_repo_source_add),window);
@@ -1499,6 +1548,7 @@ mirror_add_window *yon_mirror_add_window_new(){
window->HeadLabel = yon_gtk_builder_get_widget(builder,"HeadLabel");
window->PathBox = yon_gtk_builder_get_widget(builder,"PathBox");
+ window->sections = NULL;
window->name=NULL;
g_signal_connect(G_OBJECT(window->TypeButton),"clicked",G_CALLBACK(on_file_chooser_open),window->TypeEntry);
diff --git a/source/ubl-settings-update.h b/source/ubl-settings-update.h
index 6a9e348..3fa2caf 100644
--- a/source/ubl-settings-update.h
+++ b/source/ubl-settings-update.h
@@ -28,6 +28,7 @@
#define glade_mirror_configure_path "/com/ublinux/ui/ubl-settings-update-mirror-configure.glade"
#define glade_mirror_add_path "/com/ublinux/ui/ubl-settings-update-mirror-add.glade"
#define glade_mirror_path_add_path "/com/ublinux/ui/ubl-settings-update-mirror-path-add.glade"
+#define glade_repo_path_add_path "/com/ublinux/ui/ubl-settings-update-repo-path-add.glade"
#define glade_password_path "/com/ublinux/ui/ubl-settings-update-password.glade"
#define banner_path "/com/ublinux/images/ubl-settings-update-banner.png"
#define CssPath "/com/ublinux/css/ubl-settings-update.css"
@@ -144,6 +145,7 @@ typedef struct {
} main_window;
typedef struct {
+ dictionary *sections;
GtkWidget *Window;
GtkWidget *HeadLabel;
GtkWidget *StatusBox;
@@ -211,6 +213,7 @@ typedef struct {
} web_publication_add_window;
typedef struct {
+ dictionary *sections;
GtkWidget *Window;
GtkWidget *HeadLabel;
GtkWidget *StatusBox;
@@ -278,6 +281,15 @@ typedef struct {
GtkWidget *AcceptButton;
} documentation_confirmation_window;
+typedef struct {
+ GtkWidget *PathRemovalBox;
+ GtkWidget *PathEntry;
+ GtkWidget *PathEditButton;
+ GtkWidget *PathRemoveButton;
+ GtkWidget *TypeCombo;
+ int edits;
+} path_section;
+
void on_save_done(main_window *, config_str output, int size);
void on_toggle_button_toggled(GtkWidget *self, main_window *widgets);
@@ -344,8 +356,8 @@ void on_selection_changed(GtkWidget *self, main_window *widgets);
void yon_interface_update(main_window *widgets);
void on_mirror_path_add(GtkWidget *, mirror_add_window *window);
-void on_mirror_path_removed(GtkWidget *, GtkWidget *target);
-void on_mirror_path_edit(GtkWidget*,GtkWidget *target);
+void on_mirror_path_removed(GtkWidget *, mirror_add_window *);
+void on_mirror_path_edit(GtkWidget*,mirror_add_window *);
void on_repo_source_add(GtkWidget *, repo_add_window *window);
void on_cell_renderer_toggle_toggled(GtkWidget *self, gchar* path, GtkWidget *table);
diff --git a/ubl-settings-update-mirror-path-add.glade b/ubl-settings-update-mirror-path-add.glade
index bc6bbf8..5bc6933 100644
--- a/ubl-settings-update-mirror-path-add.glade
+++ b/ubl-settings-update-mirror-path-add.glade
@@ -39,9 +39,14 @@
-