diff --git a/source/ubinstall-gtk-advanced.c b/source/ubinstall-gtk-advanced.c index e9cdcbd..396e0d6 100644 --- a/source/ubinstall-gtk-advanced.c +++ b/source/ubinstall-gtk-advanced.c @@ -1,5 +1,8 @@ #include "ubinstall-gtk.h" +#define toggled_icon_name "com.ublinux.libublsettingsui-gtk3.toggled-symbolic" +#define untoggled_icon_name "com.ublinux.libublsettingsui-gtk3.untoggled-symbolic" + advanced_section *yon_advanced_section_new(); void yon_advanced_section_remove(); @@ -83,7 +86,19 @@ void yon_advanced_update(main_window *widgets){ for (int i=0;iRemoveButton),"clicked",G_CALLBACK(on_advanced_part_remove),widgets); + g_signal_connect(G_OBJECT(part->RemoveButton),"clicked",G_CALLBACK(on_advanced_part_remove),widgets); + g_signal_connect(G_OBJECT(part->SystemSectionToggle),"clicked",G_CALLBACK(on_advanced_section_toggled),widgets); + g_signal_connect(G_OBJECT(part->UserDataSectionToggle),"clicked",G_CALLBACK(on_advanced_section_toggled),widgets); + if (i==0){ + gtk_widget_set_sensitive(part->SystemSectionToggle,0); + gtk_widget_set_sensitive(part->UserDataSectionToggle,0); + GtkWidget *SystemImage = gtk_button_get_image(GTK_BUTTON(part->SystemSectionToggle)); + GtkWidget *UserImage = gtk_button_get_image(GTK_BUTTON(part->UserDataSectionToggle)); + gtk_image_set_from_icon_name(GTK_IMAGE(SystemImage),toggled_icon_name,GTK_ICON_SIZE_BUTTON); + gtk_image_set_from_icon_name(GTK_IMAGE(UserImage),toggled_icon_name,GTK_ICON_SIZE_BUTTON); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(part->SystemSectionToggle),1); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(part->UserDataSectionToggle),1); + } yon_advanced_partition_set_from_section(part,sections[i]); gtk_box_pack_start(GTK_BOX(widgets->AdvancedPartitionAddBox),part->MainBox,0,0,0); @@ -98,19 +113,39 @@ void yon_advanced_update(main_window *widgets){ } void on_advanced_partition_create(GtkWidget *, main_window *widgets){ - GtkTreeIter iter, *last_found; + GtkTreeIter iter, *last_unvalid = NULL; + int found = 0; for_iter(GTK_TREE_MODEL(widgets->DevicesList),&iter){ char *target; int active; gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),&iter,0,&target,5,&active,-1); if (active){ - if (sections_size==2) break; - advanced_section *section = yon_advanced_section_new(); - section->partition = target; - sections[sections_size]=section; - sections_size++; + if (!yon_advanced_section_get(target)){ + last_unvalid = gtk_tree_iter_copy(&iter); + } else { + found=1; + if (sections_size==2) break; + advanced_section *section = yon_advanced_section_new(); + section->part_source = PART_SOURCE_DEVICE; + section->partition = target; + sections[sections_size]=section; + sections_size++; + break; + } } } + if (!found&&last_unvalid){ + char *target; + int active; + gtk_tree_model_get(GTK_TREE_MODEL(widgets->DevicesList),last_unvalid,0,&target,5,&active,-1); + + if (sections_size==2) return; + advanced_section *section = yon_advanced_section_new(); + section->part_source = PART_SOURCE_DEVICE; + section->partition = target; + sections[sections_size]=section; + sections_size++; + } yon_advanced_update(widgets); } @@ -124,6 +159,7 @@ void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets){ if (!status){ if (sections_size==2) return; advanced_section *section = yon_advanced_section_new(); + section->part_source = PART_SOURCE_PART; sections[sections_size]=section; sections_size++; } else { @@ -135,6 +171,7 @@ void on_advanced_partition_add(GtkWidget *, char *path, main_window *widgets){ } void yon_install_advanced_init(main_window *){ + } void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_window *widgets){ @@ -153,8 +190,8 @@ void on_install_advanced_partition_chosen(GtkCellRenderer*, gchar *path, main_wi if (chosen<2){ gtk_list_store_set(widgets->PartitionsList,&iter,7,!status,-1); chosen++; - advanced_section *section = yon_advanced_section_new(); + section->part_source = PART_SOURCE_PART; section->partition = target_part; sections[sections_size]=section; sections_size++; @@ -279,6 +316,28 @@ int yon_advanced_get_part_size(main_window *widgets){ return size; } +void on_advanced_section_toggled(GtkWidget *self, main_window *widgets){ + advanced_partition *part = g_object_get_data(G_OBJECT(self),"advanced_partition"); + gtk_widget_set_sensitive(self,0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(self),1); + GtkWidget *image = gtk_button_get_image(GTK_BUTTON(self)); + gtk_image_set_from_icon_name(GTK_IMAGE(image),toggled_icon_name,GTK_ICON_SIZE_BUTTON); + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->AdvancedPartitionAddBox)); + GList *iter; + for (iter=list;iter;iter=iter->next){ + advanced_partition *compare_part = g_object_get_data(G_OBJECT(iter->data),"advanced_partition"); + if (part != compare_part) { + GtkWidget *cur_toggle = self == part->SystemSectionToggle?compare_part->SystemSectionToggle:compare_part->UserDataSectionToggle; + g_signal_handlers_block_by_func(G_OBJECT(cur_toggle),G_CALLBACK(on_advanced_section_toggled),widgets); + gtk_widget_set_sensitive(cur_toggle,1); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cur_toggle),0); + g_signal_handlers_unblock_by_func(G_OBJECT(cur_toggle),G_CALLBACK(on_advanced_section_toggled),widgets); + GtkWidget *compare_image = gtk_button_get_image(GTK_BUTTON(cur_toggle)); + gtk_image_set_from_icon_name(GTK_IMAGE(compare_image),untoggled_icon_name,GTK_ICON_SIZE_BUTTON); + } + } +} + advanced_partition *yon_advanced_partition_new(){ advanced_partition *part = new(advanced_partition); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_advanced_part); @@ -302,11 +361,13 @@ advanced_partition *yon_advanced_partition_new(){ yon_gtk_revealer_set_from_switch(GTK_REVEALER(part->FormatRevealer),GTK_SWITCH(part->FormatSwitch)); g_signal_connect(G_OBJECT(part->EncryptionButton),"clicked",G_CALLBACK(on_advanced_password_clicked),part); - // g_signal_connect(G_OBJECT(part->SystemSectionToggle),"clicked",G_CALLBACK(on_advanced_system_toggled),part); - // g_signal_connect(G_OBJECT(part->UserDataSectionToggle),"clicked",G_CALLBACK(on_advanced_user_toggled),part); + + yon_fs_type_setup(GTK_COMBO_BOX_TEXT(part->FileSystemTypeCombo)); g_object_set_data(G_OBJECT(part->MainBox),"advanced_partition",part); g_object_set_data(G_OBJECT(part->RemoveButton),"advanced_partition",part); + g_object_set_data(G_OBJECT(part->SystemSectionToggle),"advanced_partition",part); + g_object_set_data(G_OBJECT(part->UserDataSectionToggle),"advanced_partition",part); return part; } diff --git a/source/ubinstall-gtk-installation.c b/source/ubinstall-gtk-installation.c index 8dbc822..1ee56ae 100644 --- a/source/ubinstall-gtk-installation.c +++ b/source/ubinstall-gtk-installation.c @@ -305,6 +305,9 @@ void on_partition_changed(GtkWidget *self, main_window *widgets){ if (self==widgets->NextInstallationSysSectionTree||self == widgets->NextInstallationSizeTypeSpin){ yon_set_max_size_from_partition(GTK_TREE_VIEW(widgets->NextInstallationSysSectionTree),GTK_SPIN_BUTTON(widgets->NextInstallationSizeSpin),GTK_COMBO_BOX(widgets->NextInstallationSizeTypeSpin)); } + if (self==widgets->AdvancedPartitionTree){ + + } } diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index cbf9a58..b2c195b 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -3,6 +3,37 @@ config main_config; // //functions +// void yon_encryption_type_setup(GtkComboBoxText *target){ +// int size; +// config_str enc_types = yon_resource_open_file(encryptions_path,&size); +// for (int i=0;i + + 100 + 1 + 10 + True False @@ -11,12 +16,12 @@ True False - gtk-missing-image + com.ublinux.libublsettingsui-gtk3.untoggled-symbolic True False - gtk-missing-image + com.ublinux.libublsettingsui-gtk3.untoggled-symbolic True @@ -90,6 +95,9 @@ True True image2 + False @@ -105,6 +113,9 @@ True True image3 + False @@ -198,6 +209,7 @@ True True + adjustment1 False @@ -209,6 +221,7 @@ True False + 0 Mb Gb @@ -261,6 +274,7 @@ True False + 0 Default @@ -324,6 +338,7 @@ True False + 0 Off diff --git a/ubinstall-gtk.css b/ubinstall-gtk.css index f7f4c36..0636e16 100644 --- a/ubinstall-gtk.css +++ b/ubinstall-gtk.css @@ -323,4 +323,9 @@ treeview row:nth-child(even) { background-color: #ffffff; } button { min-width: 26px; min-height: 24px; +} + +.unsensitiveblock:disabled { + opacity:1; + background:@theme_selected_bg_color; } \ No newline at end of file diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 918b567..0c189a4 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -6884,90 +6884,95 @@ separately into the selected partition. - + True - True + False + 0 in - 105 - + True - True - DevicesList - 0 - - - none - - + False - + + 125 + True + True + DevicesList + 0 - - - 6 - 5 - + + + + + 6 + 5 + + + - - - - - Device - - - 0 - + + Device + + + + 0 + + + - - - - - Description - - - 1 - + + Description + + + + 1 + + + - - - - - Label - - - 2 - + + Label + + + + 2 + + + - - - - - Size - - - 3 - + + Size + + + + 3 + + + - - - - - Serial - - - 4 - + + Serial + + + + 4 + + + + + + False @@ -7050,90 +7055,95 @@ separately into the selected partition. - + True - True + False + 0 in - 140 - + True - True - PartitionsList - 0 - - - none - - + False - + + 125 + True + True + PartitionsList + 0 - - - 8 - 7 - + + + + + 8 + 7 + + + - - - - - Section - - - 0 - + + Section + + + + 0 + + + - - - - - Capacity - - - 1 - + + Capacity + + + + 1 + + + - - - - - Free space - - - 2 - + + Free space + + + + 2 + + + - - - - - File system - - - 3 - + + File system + + + + 3 + + + - - - - - Label - - - 4 - + + Label + + + + 4 + + + + + + False @@ -9836,9 +9846,6 @@ separately into the selected partition. True DevicesList 0 - - - Device @@ -9940,9 +9947,6 @@ separately into the selected partition. True PartitionsList 0 - - - Section