Sync menu WIP

pull/235/head
Ivan Dmitrievich Yartsev 10 months ago
parent 11de595707
commit f842f66db1

@ -19,8 +19,8 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add
} else if (self == window->UsersBootCheck){
window->user_boot = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck));
} else if (self == window->UsersShutdownCheck){
window->user_shutdown = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck));
// } else if (self == window->UsersShutdownCheck){
// window->user_shutdown = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck));
}
}
@ -67,24 +67,24 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add
if (window->password_hash)
yon_config_remove_by_key(HASHPASSWD_parameter);
}
char *sync = "";
int boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck));
int shutdown_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck));
if (!boot_active&&!shutdown_active){
if (window->user_boot>-1||window->user_boot>-1)
yon_config_remove_by_key(USERADD_SYNC_parameter);
} else {
if (boot_active){
if (window->user_boot>-1)
sync = "boot";
}
if (shutdown_active){
if (window->user_shutdown>-1)
sync = yon_char_unite(sync,yon_char_is_empty(sync)?"":",","shutdown",NULL);
}
if (window->user_boot>-1||window->user_boot>-1)
yon_config_register(USERADD_SYNC_parameter,USERADD_SYNC_parameter_command,sync);
}
// char *sync = "";
// int boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck));
// int shutdown_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck));
// if (!boot_active&&!shutdown_active){
// if (window->user_boot>-1||window->user_boot>-1)
// yon_config_remove_by_key(USERADD_SYNC_parameter);
// } else {
// if (boot_active){
// if (window->user_boot>-1)
// sync = "boot";
// }
// if (shutdown_active){
// if (window->user_shutdown>-1)
// sync = yon_char_unite(sync,yon_char_is_empty(sync)?"":",","shutdown",NULL);
// }
// if (window->user_boot>-1||window->user_boot>-1)
// yon_config_register(USERADD_SYNC_parameter,USERADD_SYNC_parameter_command,sync);
// }
}
ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){
@ -105,7 +105,17 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton");
window->AcceptButton=yon_gtk_builder_get_widget(builder,"AcceptButton");
window->UsersBootCheck=yon_gtk_builder_get_widget(builder,"UsersBootCheck");
window->UsersShutdownCheck=yon_gtk_builder_get_widget(builder,"UsersShutdownCheck");
window->UsersShutdownSwitch=yon_gtk_builder_get_widget(builder,"UsersShutdownSwitch");
window->UserShutdownRevealer=yon_gtk_builder_get_widget(builder,"UserShutdownRevealer");
window->UsersTree=yon_gtk_builder_get_widget(builder,"UsersTree");
window->UserAddButton=yon_gtk_builder_get_widget(builder,"UserAddButton");
window->UserRemoveButton=yon_gtk_builder_get_widget(builder,"UserRemoveButton");
window->GroupsBootCheck=yon_gtk_builder_get_widget(builder,"GroupsBootCheck");
window->GroupsShutdownSwitch=yon_gtk_builder_get_widget(builder,"GroupsShutdownSwitch");
window->GroupShutdownRevealer=yon_gtk_builder_get_widget(builder,"GroupShutdownRevealer");
window->GroupsTree=yon_gtk_builder_get_widget(builder,"GroupsTree");
window->GroupAddButton=yon_gtk_builder_get_widget(builder,"GroupAddButton");
window->GroupRemoveButton=yon_gtk_builder_get_widget(builder,"GroupRemoveButton");
window->default_password=NULL;
window->default_root_password=NULL;
@ -123,7 +133,7 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersBootCheck),1);
}
if (strstr(sync_parameters,"shutdown")){
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsersShutdownCheck),1);
gtk_switch_set_active(GTK_SWITCH(window->UsersShutdownSwitch),1);
}
}
@ -215,7 +225,11 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
g_signal_connect(G_OBJECT(window->PasswordHashCombo),"changed",G_CALLBACK(on_additional_settings_changed),window);
g_signal_connect(G_OBJECT(window->DefaultUserAdministratorCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window);
g_signal_connect(G_OBJECT(window->UsersBootCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window);
g_signal_connect(G_OBJECT(window->UsersShutdownCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window);
g_signal_connect(G_OBJECT(window->UsersShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window);
g_signal_connect(G_OBJECT(window->GroupsBootCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window);
g_signal_connect(G_OBJECT(window->GroupsShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window);
yon_gtk_revealer_set_from_switch(GTK_REVEALER(window->UserShutdownRevealer),GTK_SWITCH(window->UsersShutdownSwitch));
yon_gtk_revealer_set_from_switch(GTK_REVEALER(window->GroupShutdownRevealer),GTK_SWITCH(window->GroupsShutdownSwitch));
// g_signal_connect(G_OBJECT(window->UsersBootCheck),"toggled",G_CALLBACK(on_users_boot_toggled),NULL);
// g_signal_connect(G_OBJECT(window->UsersShutdownCheck),"toggled",G_CALLBACK(on_users_shutdown_toggled),NULL);
@ -228,6 +242,8 @@ void on_ubl_settings_usergroups_additional_settings_open(GtkWidget *, main_windo
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window));
g_signal_connect(G_OBJECT(window->UsersBootCheck),"toggled",G_CALLBACK(on_additional_settings_changed),window);
g_signal_connect(G_OBJECT(window->UsersShutdownSwitch),"activate",G_CALLBACK(on_additional_settings_changed),window);
gtk_widget_show(window->Window);
}

@ -243,7 +243,18 @@ typedef struct{
GtkWidget *AcceptButton;
GtkWidget *EncryptAllPasswordsButton;
GtkWidget *UsersBootCheck;
GtkWidget *UsersShutdownCheck;
GtkWidget *UsersShutdownSwitch;
GtkWidget *UserShutdownRevealer;
GtkWidget *UsersTree;
GtkWidget *UserAddButton;
GtkWidget *UserRemoveButton;
GtkWidget *GroupsBootCheck;
GtkWidget *GroupsShutdownSwitch;
GtkWidget *GroupShutdownRevealer;
GtkWidget *GroupsTree;
GtkWidget *GroupAddButton;
GtkWidget *GroupRemoveButton;
const char *default_user_name;
const char *default_password;

@ -103,8 +103,10 @@
#define DESCRYPT_DESCRIPTION_LABEL _("descrypt (Hash function from the DES family of algorithms)")
#define NTHASH_DESCRIPTION_LABEL _("NTHash (Hash function from the NT Windows family of algorithms)")
#define ADDITIONAL_BOOT_LABEL _("While booting the operating system, apply the settings of all users from the configuration")
#define ADDITIONAL_SHUTDOWN_LABEL _("While shutdown, save the settings of all users with UID>=1000 to the configuration")
#define ADDITIONAL_USER_BOOT_LABEL _("While booting the operating system, apply the settings of all users from the configuration")
#define ADDITIONAL_USER_SHUTDOWN_LABEL _("While shutdown, save the settings of all users with UID>=1000 to the configuration")
#define ADDITIONAL_GROUP_BOOT_LABEL _("While booting the operating system, apply the settings of all groups from the configuration")
#define ADDITIONAL_GROUP_SHUTDOWN_LABEL _("While shutdown, save the settings of all groups with GID>=1000 to the configuration")
//ubl-settings-usergroups-group-creation.glade
#define CONFIGURE_GROUP_TITLE_LABEL _("Configure group")

@ -13,7 +13,18 @@
<column type="gint"/>
</columns>
</object>
<object class="GtkListStore" id="UsersShutdownList"/>
<object class="GtkListStore" id="UsersShutdownList">
<columns>
<!-- column-name Active -->
<column type="gboolean"/>
<!-- column-name Target -->
<column type="gchararray"/>
<!-- column-name MinValue -->
<column type="gulong"/>
<!-- column-name MaxValue -->
<column type="gulong"/>
</columns>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
@ -39,6 +50,26 @@
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.ubl-settings-usergroups.lock-symbolic</property>
</object>
<object class="GtkImage" id="image6">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.increase-symbolic</property>
</object>
<object class="GtkImage" id="image7">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.trash-symbolic</property>
</object>
<object class="GtkImage" id="image8">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.increase-symbolic</property>
</object>
<object class="GtkImage" id="image9">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.trash-symbolic</property>
</object>
<object class="GtkWindow" id="Window">
<property name="width-request">600</property>
<property name="can-focus">False</property>
@ -442,7 +473,7 @@
</packing>
</child>
<child>
<object class="GtkSwitch" id="UserShutdownSwitch">
<object class="GtkSwitch" id="UsersShutdownSwitch">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
@ -464,20 +495,107 @@
<object class="GtkRevealer" id="UserShutdownRevealer">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="transition-type">slide-up</property>
<child>
<object class="GtkScrolledWindow">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<property name="min-content-height">150</property>
<property name="can-focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkTreeView" id="UsersTree">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">UsersShutdownList</property>
<property name="enable-grid-lines">both</property>
<property name="shadow-type">in</property>
<property name="min-content-height">150</property>
<child>
<object class="GtkTreeView" id="UsersTree">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">UsersShutdownList</property>
<property name="enable-grid-lines">both</property>
<child>
<object class="GtkTreeViewColumn">
<child>
<object class="GtkCellRendererToggle"/>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Syncronization type</property>
<child>
<object class="GtkCellRendererText"/>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Minimal UID</property>
<child>
<object class="GtkCellRendererText"/>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Maximum UID</property>
<child>
<object class="GtkCellRendererText"/>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkButton" id="UserAddButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image6</property>
<style>
<class name="thin"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="UserRemoveButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image7</property>
<style>
<class name="thin"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
@ -500,14 +618,14 @@
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="GroupsBootCheck">
<property name="label" translatable="yes">While booting the operating system, apply the settings of all users from the configuration</property>
<property name="label" translatable="yes">While booting the operating system, apply the settings of all groups from the configuration</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
@ -547,7 +665,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">While shutdown, save the settings of all users with UID&gt;=1000 to the configuration</property>
<property name="label" translatable="yes">While shutdown, save the settings of all groups with GID&gt;=1000 to the configuration</property>
</object>
<packing>
<property name="expand">False</property>
@ -556,7 +674,7 @@
</packing>
</child>
<child>
<object class="GtkSwitch" id="GroupShutdownSwitch">
<object class="GtkSwitch" id="GroupsShutdownSwitch">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
@ -580,18 +698,107 @@
<property name="can-focus">False</property>
<property name="transition-type">slide-up</property>
<child>
<object class="GtkScrolledWindow">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<property name="min-content-height">150</property>
<property name="can-focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkTreeView" id="GroupsTree">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">GroupsShutdownList</property>
<property name="enable-grid-lines">both</property>
<property name="shadow-type">in</property>
<property name="min-content-height">150</property>
<child>
<object class="GtkTreeView" id="GroupsTree">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">GroupsShutdownList</property>
<property name="enable-grid-lines">both</property>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">column</property>
<child>
<object class="GtkCellRendererToggle"/>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">column</property>
<child>
<object class="GtkCellRendererText"/>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">column</property>
<child>
<object class="GtkCellRendererText"/>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">column</property>
<child>
<object class="GtkCellRendererText"/>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkButton" id="GroupAddButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image8</property>
<style>
<class name="thin"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="GroupRemoveButton">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image9</property>
<style>
<class name="thin"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
@ -614,7 +821,7 @@
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>

Loading…
Cancel
Save