<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Code</property>
+ <property name="label" translatable="yes">CN</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<object class="GtkEntry" id="entry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="max_length">10</property>
<property name="invisible_char">●</property>
</object>
<packing>
<object class="GtkEntry" id="entry2">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="max_length">100</property>
<property name="invisible_char">●</property>
</object>
<packing>
<object class="GtkEntry" id="entry3">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="max_length">100</property>
<property name="invisible_char">●</property>
</object>
<packing>
<object class="GtkEntry" id="entry5">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="max_length">10</property>
<property name="invisible_char">●</property>
</object>
<packing>
static void
autesmbldap_edit_user ()
{
- /*GtkTreeIter iter;
- gchar *code;
+ GtkTreeIter iter;
+ gchar *cn;
+
+ GtkListStore *lstore;
+ GtkTreeSelection *selection;
+ gchar *str_type;
+ guint col_cn;
- if (gtk_tree_selection_get_selected (sel_users, NULL, &iter))
+ GtkWidget *w;
+ GtkWidget *dialog;
+
+ if (gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)) == 0)
+ {
+ lstore = lstore_users;
+ selection = sel_users;
+ str_type = g_strdup ("user");
+ col_cn = COL_USERS_CN;
+ }
+ else if (gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)) == 1)
+ {
+ lstore = lstore_groups;
+ selection = sel_groups;
+ str_type = g_strdup ("group");
+ col_cn = COL_GROUPS_CN;
+ }
+ else
{
- GtkWidget *w;
+ dialog = gtk_message_dialog_new (autesmbldap_get_gtkwidget_parent_gtkwindow (w_users),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Wrong notebook page.");
+ return;
+ }
- gtk_tree_model_get (GTK_TREE_MODEL (lstore_users), &iter,
- COL_CODE, &code,
+ if (gtk_tree_selection_get_selected (selection, NULL, &iter))
+ {
+ gtk_tree_model_get (GTK_TREE_MODEL (lstore), &iter,
+ col_cn, &cn,
-1);
- User *u = user_new (gtkbuilder, gdaex, guifile, formdir, code);
+ if (gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)) == 0)
+ {
+ /*User *u = user_new (gtkbuilder, gdaex, guifile, formdir, NULL);
- g_signal_connect (G_OBJECT (u), "aggiornato",
- G_CALLBACK (autesmbldap_on_user_aggiornato), NULL);
+ g_signal_connect (G_OBJECT (u), "aggiornato",
+ G_CALLBACK (autesmbldap_on_user_aggiornato), NULL);
+
+ w = user_get_widget (u);*/
+ }
+ else if (gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)) == 1)
+ {
+ Group *u = group_new (gtkbuilder, guifile, ldap, cn, groups_ou, base_dn);
+
+ g_signal_connect (G_OBJECT (u), "aggiornato",
+ G_CALLBACK (autesmbldap_on_group_aggiornato), NULL);
+
+ w = group_get_widget (u);
+ }
+ else
+ {
+ dialog = gtk_message_dialog_new (autesmbldap_get_gtkwidget_parent_gtkwindow (w_users),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Wrong notebook page.");
+ return;
+ }
- w = user_get_widget (u);
gtk_window_set_transient_for (GTK_WINDOW (w), autesmbldap_get_gtkwidget_parent_gtkwindow (w_users));
gtk_widget_show (w);
}
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK,
- "Occorre prima selezionare un modello");
+ "You must select a %s before.", str_type);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
- }*/
+ }
}
static void
GroupPrivate *priv = GROUP_GET_PRIVATE (group);
+ if (g_strcmp0 (priv->cn, "") == 0)
+ {
+ autesmbldap_exec_ssh_command (g_strdup_printf ("sudo /usr/sbin/smbldap-groupadd -a \"%s\"",
+ gtk_entry_get_text (GTK_ENTRY (priv->txt_cn))));
+ priv->cn = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->txt_cn)));
+ group_carica (group);
+ }
+ else
+ {
+ autesmbldap_exec_ssh_command (g_strdup_printf ("sudo /usr/sbin/smbldap-groupmod -n \"%s\" \"%s\"",
+ gtk_entry_get_text (GTK_ENTRY (priv->txt_cn)), priv->cn));
+ }
+
/*if (gdaex_execute (priv->gdaex, sql) == 1)
{*/
- if (g_strcmp0 (priv->cn, "") == 0)
- {
- autesmbldap_exec_ssh_command (g_strdup_printf ("sudo /usr/sbin/smbldap-groupadd -a %s",
- gtk_entry_get_text (GTK_ENTRY (priv->txt_cn))));
- priv->cn = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->txt_cn)));
- group_carica (group);
- }
- else
- {
- /* TODO */
- return;
- }
-
g_signal_emit (group, klass->aggiornato_signal_id, 0);
dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),