summaryrefslogtreecommitdiff
path: root/source4/gtk/tools/gwsam.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2004-10-11 20:06:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:48 -0500
commit8e1ffff226e3016a38301a773ed8aa55bad5b710 (patch)
tree1cc15a9ac0c6f2f8a5dd56d1722347b151e99039 /source4/gtk/tools/gwsam.c
parent4d69d2d52b273359b481e1a7b99b9db3711d2768 (diff)
downloadsamba-8e1ffff226e3016a38301a773ed8aa55bad5b710.tar.gz
samba-8e1ffff226e3016a38301a773ed8aa55bad5b710.tar.bz2
samba-8e1ffff226e3016a38301a773ed8aa55bad5b710.zip
r2920: Support passing a handle to a SAMR pipe to a RPC Binding or Select
Host dialog so that one can select a domain from the list of known domains. (This used to be commit 5e0bab891199c888bdf87faa29acc38d9ca5151b)
Diffstat (limited to 'source4/gtk/tools/gwsam.c')
-rw-r--r--source4/gtk/tools/gwsam.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/source4/gtk/tools/gwsam.c b/source4/gtk/tools/gwsam.c
index 951096ddef..a085c49897 100644
--- a/source4/gtk/tools/gwsam.c
+++ b/source4/gtk/tools/gwsam.c
@@ -27,6 +27,7 @@ struct dcerpc_pipe *sam_pipe = NULL;
struct policy_handle domain_handle;
GtkWidget *mainwin;
GtkWidget *seldomain;
+GtkWidget *mnu_disconnect;
void update_grouplist(void)
{
@@ -112,7 +113,7 @@ void on_connect_activate (GtkMenuItem *menuitem, gpointer user_data)
TALLOC_CTX *mem_ctx;
gint result;
- d = GTK_RPC_BINDING_DIALOG(gtk_rpc_binding_dialog_new(FALSE));
+ d = GTK_RPC_BINDING_DIALOG(gtk_rpc_binding_dialog_new(FALSE, NULL));
result = gtk_dialog_run(GTK_DIALOG(d));
switch(result) {
case GTK_RESPONSE_ACCEPT:
@@ -137,16 +138,25 @@ void on_connect_activate (GtkMenuItem *menuitem, gpointer user_data)
mem_ctx = talloc_init("connect");
status = dcerpc_samr_Connect(sam_pipe, mem_ctx, &r);
- talloc_destroy(mem_ctx);
if (!NT_STATUS_IS_OK(status)) {
gtk_show_ntstatus(mainwin, status);
sam_pipe = NULL;
gtk_widget_destroy(GTK_WIDGET(d));
+ talloc_destroy(mem_ctx);
return;
}
gtk_widget_set_sensitive (seldomain, TRUE);
+ gtk_widget_set_sensitive (mnu_disconnect, TRUE);
+ gtk_window_set_title (GTK_WINDOW (mainwin), talloc_asprintf(mem_ctx, "User Manager - Connected to %s", gtk_rpc_binding_dialog_get_host(d)));
gtk_widget_destroy(GTK_WIDGET(d));
+ talloc_destroy(mem_ctx);
+}
+
+void on_disconnect_activate (GtkMenuItem *menuitem, gpointer user_data)
+{
+ gtk_widget_set_sensitive (mnu_disconnect, FALSE);
+ gtk_window_set_title (GTK_WINDOW (mainwin), "User Manager");
}
void
@@ -265,6 +275,11 @@ create_mainwindow (void)
gtk_widget_show (mnu_connect);
gtk_container_add (GTK_CONTAINER (menuitem1_menu), mnu_connect);
+ mnu_disconnect = gtk_menu_item_new_with_mnemonic ("_Disconnect");
+ gtk_widget_show (mnu_disconnect);
+ gtk_widget_set_sensitive (mnu_disconnect, FALSE);
+ gtk_container_add (GTK_CONTAINER (menuitem1_menu), mnu_disconnect);
+
seldomain = gtk_menu_item_new_with_mnemonic("_Select Domain");
gtk_widget_show(seldomain);
gtk_widget_set_sensitive (seldomain, FALSE);
@@ -378,6 +393,9 @@ create_mainwindow (void)
g_signal_connect ((gpointer) mnu_connect, "activate",
G_CALLBACK (on_connect_activate),
NULL);
+ g_signal_connect ((gpointer) mnu_disconnect, "activate",
+ G_CALLBACK (on_disconnect_activate),
+ NULL);
g_signal_connect ((gpointer) quit, "activate",
G_CALLBACK (on_quit_activate),
NULL);