Merge pull request 'Command fixes' (#35) from YanTheKaller/ubl-settings-update:master into master

Reviewed-on: #35
pull/109/head^2^2 v2.2
Dmitry Razumov 1 year ago
commit e92c8cfcf9

@ -44,7 +44,6 @@ void yon_save_interface( main_window *widgets){
case 3:yon_config_register(AUTOUPDATE_mode,AUTOUPDATE_mode_command,"system"); case 3:yon_config_register(AUTOUPDATE_mode,AUTOUPDATE_mode_command,"system");
break; break;
} }
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UpdateIntervalDefaultCheck))){ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UpdateIntervalDefaultCheck))){
yon_config_remove_by_key(AUTOUPDATE_interval); yon_config_remove_by_key(AUTOUPDATE_interval);
} else { } else {
@ -347,6 +346,7 @@ void yon_interface_update(main_window *widgets){
} }
autoupdate_config = config(AUTOUPDATE_interval); autoupdate_config = config(AUTOUPDATE_interval);
if (!yon_char_is_empty(autoupdate_config)){ if (!yon_char_is_empty(autoupdate_config)){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UpdateIntervalDefaultCheck),0);
if (strstr(autoupdate_config,"min")){ if (strstr(autoupdate_config,"min")){
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),0); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),0);
} else if (autoupdate_config[strlen(autoupdate_config)-1]=='h'){ } else if (autoupdate_config[strlen(autoupdate_config)-1]=='h'){
@ -357,6 +357,8 @@ void yon_interface_update(main_window *widgets){
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),3); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UpdateIntervalCombo),3);
} }
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->UpdateIntervalSpin),atol(autoupdate_config)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->UpdateIntervalSpin),atol(autoupdate_config));
} else {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UpdateIntervalDefaultCheck),1);
} }
} }
@ -735,10 +737,62 @@ void on_repo_edit(GtkWidget *,main_window *widgets){
if (size>1&&!yon_char_is_empty(parsed[1])){ //siglevel if (size>1&&!yon_char_is_empty(parsed[1])){ //siglevel
int cur_size; int cur_size;
config_str siglevel = yon_char_parse(parsed[1],&cur_size,","); config_str siglevel = yon_char_parse(parsed[1],&cur_size,",");
gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->RepoSignCheckCombo),siglevel[0]); if (!strcmp(siglevel[0],"Never")){
gtk_combo_box_set_active_id(GTK_COMBO_BOX(window->RepoSignConditionCombo),siglevel[1]); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->NeverRadio),1);
} else if (!strcmp(siglevel[0],"Optional")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->OptionalRadio),1);
} else if (!strcmp(siglevel[0],"Required")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->RequiredRadio),1);
} else if (!strcmp(siglevel[0],"TrustedOnly")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->TrustedOnlyRadio),1);
} else if (!strcmp(siglevel[0],"TrustAll")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->TrustAllRadio),1);
}
if (!strcmp(siglevel[1],"PackageNever")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->PackageNeverRadio),1);
} else if (!strcmp(siglevel[1],"DatabaseNever")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DatabaseNeverRadio),1);
} else if (!strcmp(siglevel[1],"PackageOptional")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->PackageOptionalRadio),1);
} else if (!strcmp(siglevel[1],"DatabaseOptional")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DatabaseOptionalRadio),1);
} else if (!strcmp(siglevel[1],"PackageRequired")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->PackageRequiredRadio),1);
} else if (!strcmp(siglevel[1],"DatabaseRequired")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DatabaseRequiredRadio),1);
} else if (!strcmp(siglevel[1],"PackageTrustedOnly")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->PackageTrustedOnlyRadio),1);
} else if (!strcmp(siglevel[1],"DatabaseTrustedOnly")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DatabaseTrustedOnlyRadio),1);
} else if (!strcmp(siglevel[1],"PackageTrustAll")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->PackageTrustAllRadio),1);
} else if (!strcmp(siglevel[1],"DatabaseTrustAll")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->DatabaseTrustAllRadio),1);
}
} }
if (size>2&&!yon_char_is_empty(parsed[2])){} //usage if (size>2&&!yon_char_is_empty(parsed[2])){
int usage_size;
config_str usage = yon_char_parse(parsed[2],&usage_size,",");
for (int i=0;i<usage_size;i++){
if (!strcmp(usage[i],"All")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsageDefaultCheck),1);
} else {
if (!strcmp(usage[i],"Sync")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsageEnableUpdateCheck),1);
}
if (!strcmp(usage[i],"Search")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsageEnableSearchCheck),1);
}
if (!strcmp(usage[i],"Install")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsageEnableInsallCheck),1);
}
if (!strcmp(usage[i],"Upgrade")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsageSysupgradeCheck),1);
}
}
}
if (usage_size) yon_char_parsed_free(usage,usage_size);
} //usage
if (size<3||yon_char_is_empty(parsed[3])||strcmp(parsed[3],"disable")){ //disable if (size<3||yon_char_is_empty(parsed[3])||strcmp(parsed[3],"disable")){ //disable
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->EnabledCheck),1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->EnabledCheck),1);
} }
@ -972,8 +1026,31 @@ void on_repo_accept_clicked(GtkWidget *, dictionary *dict){
} else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DatabaseTrustAllRadio))){ } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->DatabaseTrustAllRadio))){
sign_level_condiition="DatabaseTrustAll"; sign_level_condiition="DatabaseTrustAll";
} }
char *usage = "";
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsageDefaultCheck))){
usage = "All";
} else {
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsageEnableUpdateCheck))){
usage = yon_char_new("Sync");
}
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsageEnableSearchCheck))){
char *temp = yon_char_unite(usage,!yon_char_is_empty(usage)?",":"","Search",NULL);
if (!yon_char_is_empty(usage)) free(usage);
usage=temp;
}
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsageEnableInsallCheck))){
char *temp = yon_char_unite(usage,!yon_char_is_empty(usage)?",":"","Install",NULL);
if (!yon_char_is_empty(usage)) free(usage);
usage=temp;
}
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsageSysupgradeCheck))){
char *temp = yon_char_unite(usage,!yon_char_is_empty(usage)?",":"","Upgrade",NULL);
if (!yon_char_is_empty(usage)) free(usage);
usage=temp;
}
}
char *final = yon_char_unite(sources,";",sign_level_package,",",sign_level_condiition,";",";",enabled?"":"disable",NULL); char *final = yon_char_unite(sources,";",sign_level_package,",",sign_level_condiition,";",usage,";",enabled?"":"disable",NULL);
if (!yon_char_is_empty(window->name)&&strcmp(repo_name,window->name)){ if (!yon_char_is_empty(window->name)&&strcmp(repo_name,window->name)){
yon_config_remove_by_key(REOSITORY_command(window->name)); yon_config_remove_by_key(REOSITORY_command(window->name));
@ -1294,6 +1371,10 @@ repo_add_window *yon_repo_add_window_new(){
g_signal_connect(G_OBJECT(window->RepoSourceButton),"clicked",G_CALLBACK(on_file_chooser_open),window->RepoSourceEntry); 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); g_signal_connect(G_OBJECT(window->RepoSourceAddButton),"clicked",G_CALLBACK(on_repo_source_add),window);
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
g_signal_connect(G_OBJECT(window->UsageDefaultCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UsageEnableInsallCheck);
g_signal_connect(G_OBJECT(window->UsageDefaultCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UsageEnableSearchCheck);
g_signal_connect(G_OBJECT(window->UsageDefaultCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UsageEnableUpdateCheck);
g_signal_connect(G_OBJECT(window->UsageDefaultCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->UsageSysupgradeCheck);
gtk_widget_show(window->Window); gtk_widget_show(window->Window);
return window; return window;
@ -1519,6 +1600,8 @@ void yon_main_window_complete(main_window *widgets){
g_signal_connect(G_OBJECT(widgets->UpdateRepoListCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->UpdateRepoTree); g_signal_connect(G_OBJECT(widgets->UpdateRepoListCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->UpdateRepoTree);
g_signal_connect(G_OBJECT(widgets->PublicationCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->PublicationTree); g_signal_connect(G_OBJECT(widgets->PublicationCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->PublicationTree);
g_signal_connect(G_OBJECT(widgets->PublicationCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->PublicationUpdateButton); g_signal_connect(G_OBJECT(widgets->PublicationCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->PublicationUpdateButton);
g_signal_connect(G_OBJECT(widgets->UpdateIntervalDefaultCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),widgets->UpdateIntervalCombo);
g_signal_connect(G_OBJECT(widgets->UpdateIntervalDefaultCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),widgets->UpdateIntervalSpin);
GList *list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->WebPublicationTree)); GList *list = gtk_tree_view_get_columns(GTK_TREE_VIEW(widgets->WebPublicationTree));

@ -75,8 +75,9 @@
#define AUTOUPDATE_interval "AUTOUPDATE[interval]" #define AUTOUPDATE_interval "AUTOUPDATE[interval]"
#define AUTOUPDATE_interval_command "ubconfig --source global get [update] AUTOUPDATE[interval]" #define AUTOUPDATE_interval_command "ubconfig --source global get [update] AUTOUPDATE[interval]"
#define AUTOUPDATE_repos "AUTOUPDATE[repos]" #define AUTOUPDATE_repos "AUTOUPDATE[repos]"
#define AUTOUPDATE_repos_command "bconfig --source global get [update] AUTOUPDATE[repos]" #define AUTOUPDATE_repos_command "ubconfig --source global get [update] AUTOUPDATE[repos]"
#define AUTOUPDATE_timestamp "AUTOUPDATE[timestamp]" #define AUTOUPDATE_timestamp "AUTOUPDATE[timestamp]"
#define AUTOUPDATE_timestamp_command "ubconfig --source global get [update] AUTOUPDATE[timestamp]"
typedef char* string; typedef char* string;
string version_application; string version_application;

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 --> <!-- Generated with glade 3.38.2 -->
<interface domain="ubl-settings-update"> <interface domain="ubl-settings-update">
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<!-- interface-css-provider-path ubl-settings-update.css --> <!-- interface-css-provider-path ubl-settings-update.css -->

@ -326,6 +326,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<child> <child>
<object class="GtkSpinButton" id="UpdateIntervalSpin"> <object class="GtkSpinButton" id="UpdateIntervalSpin">
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="adjustment">adjustment1</property> <property name="adjustment">adjustment1</property>
</object> </object>
@ -338,6 +339,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<child> <child>
<object class="GtkComboBoxText" id="UpdateIntervalCombo"> <object class="GtkComboBoxText" id="UpdateIntervalCombo">
<property name="visible">True</property> <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="active">0</property> <property name="active">0</property>
<items> <items>
@ -1543,6 +1545,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="model">MirrorList</property> <property name="model">MirrorList</property>
<property name="enable-grid-lines">both</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection"/> <object class="GtkTreeSelection"/>
</child> </child>

Loading…
Cancel
Save