diff options
Diffstat (limited to 'source4/gtk/common/select.c')
-rw-r--r-- | source4/gtk/common/select.c | 378 |
1 files changed, 188 insertions, 190 deletions
diff --git a/source4/gtk/common/select.c b/source4/gtk/common/select.c index 4e4d14dbe2..fd8303241f 100644 --- a/source4/gtk/common/select.c +++ b/source4/gtk/common/select.c @@ -31,65 +31,65 @@ const char *gtk_select_domain_dialog_get_domain(GtkSelectDomainDialog *d) void gtk_select_domain_dialog_init (GtkSelectDomainDialog *select_domain_dialog) { - GtkWidget *dialog_vbox1; - GtkWidget *hbox1; - GtkWidget *label1; - GtkWidget *scrolledwindow1; - GtkWidget *dialog_action_area1; - GtkWidget *cancelbutton1; - GtkWidget *okbutton1; - GtkCellRenderer *renderer; - GtkTreeViewColumn *curcol; - - gtk_window_set_title (GTK_WINDOW (select_domain_dialog), "Select Domain"); - - dialog_vbox1 = GTK_DIALOG (select_domain_dialog)->vbox; - gtk_widget_show (dialog_vbox1); - - hbox1 = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox1, TRUE, TRUE, 0); - - label1 = gtk_label_new ("Domain:"); - gtk_widget_show (label1); - gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0); - - select_domain_dialog->entry_domain = gtk_entry_new (); - gtk_widget_show (select_domain_dialog->entry_domain); - gtk_box_pack_start (GTK_BOX (hbox1), select_domain_dialog->entry_domain, TRUE, TRUE, 0); - - scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_show (scrolledwindow1); - gtk_box_pack_start (GTK_BOX (dialog_vbox1), scrolledwindow1, TRUE, TRUE, 0); - - select_domain_dialog->list_domains = gtk_tree_view_new (); - gtk_widget_show (select_domain_dialog->list_domains); - gtk_container_add (GTK_CONTAINER (scrolledwindow1), select_domain_dialog->list_domains); - - curcol = gtk_tree_view_column_new (); - gtk_tree_view_column_set_title(curcol, "Name"); - renderer = gtk_cell_renderer_text_new(); - gtk_tree_view_column_pack_start(curcol, renderer, True); - gtk_tree_view_append_column(GTK_TREE_VIEW(select_domain_dialog->list_domains), curcol); - gtk_tree_view_column_add_attribute(curcol, renderer, "text", 0); - - select_domain_dialog->store_domains = gtk_list_store_new(1, G_TYPE_STRING); - gtk_tree_view_set_model(GTK_TREE_VIEW(select_domain_dialog->list_domains), GTK_TREE_MODEL(select_domain_dialog->store_domains)); - g_object_unref(select_domain_dialog->store_domains); - - dialog_action_area1 = GTK_DIALOG (select_domain_dialog)->action_area; - gtk_widget_show (dialog_action_area1); - gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); - - cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel"); - gtk_widget_show (cancelbutton1); - gtk_dialog_add_action_widget (GTK_DIALOG (select_domain_dialog), cancelbutton1, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT); - - okbutton1 = gtk_button_new_from_stock ("gtk-ok"); - gtk_widget_show (okbutton1); - gtk_dialog_add_action_widget (GTK_DIALOG (select_domain_dialog), okbutton1, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT); + GtkWidget *dialog_vbox1; + GtkWidget *hbox1; + GtkWidget *label1; + GtkWidget *scrolledwindow1; + GtkWidget *dialog_action_area1; + GtkWidget *cancelbutton1; + GtkWidget *okbutton1; + GtkCellRenderer *renderer; + GtkTreeViewColumn *curcol; + + gtk_window_set_title (GTK_WINDOW (select_domain_dialog), "Select Domain"); + + dialog_vbox1 = GTK_DIALOG (select_domain_dialog)->vbox; + gtk_widget_show (dialog_vbox1); + + hbox1 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox1, TRUE, TRUE, 0); + + label1 = gtk_label_new ("Domain:"); + gtk_widget_show (label1); + gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0); + + select_domain_dialog->entry_domain = gtk_entry_new (); + gtk_widget_show (select_domain_dialog->entry_domain); + gtk_box_pack_start (GTK_BOX (hbox1), select_domain_dialog->entry_domain, TRUE, TRUE, 0); + + scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow1); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), scrolledwindow1, TRUE, TRUE, 0); + + select_domain_dialog->list_domains = gtk_tree_view_new (); + gtk_widget_show (select_domain_dialog->list_domains); + gtk_container_add (GTK_CONTAINER (scrolledwindow1), select_domain_dialog->list_domains); + + curcol = gtk_tree_view_column_new (); + gtk_tree_view_column_set_title(curcol, "Name"); + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_column_pack_start(curcol, renderer, True); + gtk_tree_view_append_column(GTK_TREE_VIEW(select_domain_dialog->list_domains), curcol); + gtk_tree_view_column_add_attribute(curcol, renderer, "text", 0); + + select_domain_dialog->store_domains = gtk_list_store_new(1, G_TYPE_STRING); + gtk_tree_view_set_model(GTK_TREE_VIEW(select_domain_dialog->list_domains), GTK_TREE_MODEL(select_domain_dialog->store_domains)); + g_object_unref(select_domain_dialog->store_domains); + + dialog_action_area1 = GTK_DIALOG (select_domain_dialog)->action_area; + gtk_widget_show (dialog_action_area1); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); + + cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel"); + gtk_widget_show (cancelbutton1); + gtk_dialog_add_action_widget (GTK_DIALOG (select_domain_dialog), cancelbutton1, GTK_RESPONSE_CANCEL); + GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT); + + okbutton1 = gtk_button_new_from_stock ("gtk-ok"); + gtk_widget_show (okbutton1); + gtk_dialog_add_action_widget (GTK_DIALOG (select_domain_dialog), okbutton1, GTK_RESPONSE_OK); + GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT); } struct policy_handle gtk_select_domain_dialog_get_handle(GtkSelectDomainDialog *d) @@ -103,85 +103,85 @@ struct policy_handle gtk_select_domain_dialog_get_handle(GtkSelectDomainDialog * GType gtk_select_domain_dialog_get_type () { - static GType mytype = 0; - - if (!mytype) - { - static const GTypeInfo myinfo = - { - sizeof (GtkSelectDomainDialogClass), - NULL, - NULL, - NULL, - NULL, - NULL, - sizeof(GtkSelectDomainDialog), - 0, - (GInstanceInitFunc) gtk_select_domain_dialog_init, - }; - - mytype = g_type_register_static (GTK_TYPE_DIALOG, - "GtkSelectDomainDialog", &myinfo, 0); - } - - return mytype; + static GType mytype = 0; + + if (!mytype) + { + static const GTypeInfo myinfo = + { + sizeof (GtkSelectDomainDialogClass), + NULL, + NULL, + NULL, + NULL, + NULL, + sizeof(GtkSelectDomainDialog), + 0, + (GInstanceInitFunc) gtk_select_domain_dialog_init, + }; + + mytype = g_type_register_static (GTK_TYPE_DIALOG, + "GtkSelectDomainDialog", &myinfo, 0); + } + + return mytype; } GtkWidget *gtk_select_domain_dialog_new (struct dcerpc_pipe *sam_pipe) { GtkSelectDomainDialog *d = gtk_type_new (gtk_select_domain_dialog_get_type ()); - NTSTATUS status; - struct samr_EnumDomains r; + NTSTATUS status; + struct samr_EnumDomains r; struct samr_Connect cr; struct samr_Close dr; struct policy_handle handle; - uint32_t resume_handle = 0; - int i; + uint32_t resume_handle = 0; + int i; TALLOC_CTX *mem_ctx = talloc_init("gtk_select_domain_dialog_new"); d->sam_pipe = sam_pipe; - cr.in.system_name = 0; - cr.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; - cr.out.handle = &handle; - - status = dcerpc_samr_Connect(sam_pipe, mem_ctx, &cr); - if (!NT_STATUS_IS_OK(status)) { + cr.in.system_name = 0; + cr.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; + cr.out.handle = &handle; + + status = dcerpc_samr_Connect(sam_pipe, mem_ctx, &cr); + if (!NT_STATUS_IS_OK(status)) { gtk_show_ntstatus(NULL, status); talloc_destroy(mem_ctx); return GTK_WIDGET(d); - } - - r.in.handle = &handle; - r.in.resume_handle = &resume_handle; - r.in.buf_size = (uint32_t)-1; - r.out.resume_handle = &resume_handle; - - status = dcerpc_samr_EnumDomains(sam_pipe, mem_ctx, &r); - if (!NT_STATUS_IS_OK(status)) { - gtk_show_ntstatus(NULL, status); - } else if (r.out.sam) { - for (i=0;i<r.out.sam->count;i++) { - GtkTreeIter iter; + } + + r.in.handle = &handle; + r.in.resume_handle = &resume_handle; + r.in.buf_size = (uint32_t)-1; + r.out.resume_handle = &resume_handle; + + status = dcerpc_samr_EnumDomains(sam_pipe, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + gtk_show_ntstatus(NULL, status); + } else if (r.out.sam) { + for (i=0;i<r.out.sam->count;i++) { + GtkTreeIter iter; printf("- %s\n", r.out.sam->entries[i].name.name); - gtk_list_store_append(d->store_domains, &iter); - gtk_list_store_set (d->store_domains, &iter, 0, r.out.sam->entries[i].name.name, -1); - } + gtk_list_store_append(d->store_domains, &iter); + gtk_list_store_set (d->store_domains, &iter, 0, r.out.sam->entries[i].name.name, -1); + } } - dr.in.handle = &handle; - dr.out.handle = &handle; - - status = dcerpc_samr_Close(sam_pipe, mem_ctx, &dr); - if (!NT_STATUS_IS_OK(status)) { + dr.in.handle = &handle; + dr.out.handle = &handle; + + status = dcerpc_samr_Close(sam_pipe, mem_ctx, &dr); + if (!NT_STATUS_IS_OK(status)) { gtk_show_ntstatus(NULL, status); talloc_destroy(mem_ctx); - return GTK_WIDGET ( d ); - } + return GTK_WIDGET ( d ); + } talloc_destroy(mem_ctx); - return GTK_WIDGET ( d ); + return GTK_WIDGET ( d ); } @@ -193,88 +193,86 @@ const char *gtk_select_host_dialog_get_host (GtkSelectHostDialog *d) void gtk_select_host_dialog_init (GtkSelectHostDialog *select_host_dialog) { - GtkWidget *dialog_vbox2; - GtkWidget *hbox2; - GtkWidget *label2; - GtkWidget *entry_host; - GtkWidget *scrolledwindow2; - GtkWidget *dialog_action_area2; - GtkWidget *cancelbutton2; - GtkWidget *okbutton2; - - gtk_window_set_title (GTK_WINDOW (select_host_dialog), "Select Host"); - - dialog_vbox2 = GTK_DIALOG (select_host_dialog)->vbox; - gtk_widget_show (dialog_vbox2); - - hbox2 = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox2); - gtk_box_pack_start (GTK_BOX (dialog_vbox2), hbox2, TRUE, TRUE, 0); - - label2 = gtk_label_new ("Host"); - gtk_widget_show (label2); - gtk_box_pack_start (GTK_BOX (hbox2), label2, FALSE, FALSE, 0); - - select_host_dialog->entry_host = gtk_entry_new (); - gtk_widget_show (select_host_dialog->entry_host); - gtk_box_pack_start (GTK_BOX (hbox2), select_host_dialog->entry_host, TRUE, TRUE, 0); - - scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_show (scrolledwindow2); - gtk_box_pack_start (GTK_BOX (dialog_vbox2), scrolledwindow2, TRUE, TRUE, 0); - - select_host_dialog->tree_host = gtk_tree_view_new (); - gtk_widget_show (select_host_dialog->tree_host); - gtk_container_add (GTK_CONTAINER (scrolledwindow2), select_host_dialog->tree_host); - - select_host_dialog->store_host = gtk_tree_store_new(1, G_TYPE_STRING); - gtk_tree_view_set_model(GTK_TREE_VIEW(select_host_dialog->tree_host), GTK_TREE_MODEL(select_host_dialog->store_host)); - g_object_unref(select_host_dialog->store_host); - - dialog_action_area2 = GTK_DIALOG (select_host_dialog)->action_area; - gtk_widget_show (dialog_action_area2); - gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area2), GTK_BUTTONBOX_END); - - cancelbutton2 = gtk_button_new_from_stock ("gtk-cancel"); - gtk_widget_show (cancelbutton2); - gtk_dialog_add_action_widget (GTK_DIALOG (select_host_dialog), cancelbutton2, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (cancelbutton2, GTK_CAN_DEFAULT); - - okbutton2 = gtk_button_new_from_stock ("gtk-ok"); - gtk_widget_show (okbutton2); - gtk_dialog_add_action_widget (GTK_DIALOG (select_host_dialog), okbutton2, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (okbutton2, GTK_CAN_DEFAULT); + GtkWidget *dialog_vbox2; + GtkWidget *hbox2; + GtkWidget *label2; + GtkWidget *entry_host; + GtkWidget *scrolledwindow2; + GtkWidget *dialog_action_area2; + GtkWidget *cancelbutton2; + GtkWidget *okbutton2; + + gtk_window_set_title (GTK_WINDOW (select_host_dialog), "Select Host"); + + dialog_vbox2 = GTK_DIALOG (select_host_dialog)->vbox; + gtk_widget_show (dialog_vbox2); + + hbox2 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox2); + gtk_box_pack_start (GTK_BOX (dialog_vbox2), hbox2, TRUE, TRUE, 0); + + label2 = gtk_label_new ("Host"); + gtk_widget_show (label2); + gtk_box_pack_start (GTK_BOX (hbox2), label2, FALSE, FALSE, 0); + + select_host_dialog->entry_host = gtk_entry_new (); + gtk_widget_show (select_host_dialog->entry_host); + gtk_box_pack_start (GTK_BOX (hbox2), select_host_dialog->entry_host, TRUE, TRUE, 0); + + scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow2); + gtk_box_pack_start (GTK_BOX (dialog_vbox2), scrolledwindow2, TRUE, TRUE, 0); + + select_host_dialog->tree_host = gtk_tree_view_new (); + gtk_widget_show (select_host_dialog->tree_host); + gtk_container_add (GTK_CONTAINER (scrolledwindow2), select_host_dialog->tree_host); + + select_host_dialog->store_host = gtk_tree_store_new(1, G_TYPE_STRING); + gtk_tree_view_set_model(GTK_TREE_VIEW(select_host_dialog->tree_host), GTK_TREE_MODEL(select_host_dialog->store_host)); + g_object_unref(select_host_dialog->store_host); + + dialog_action_area2 = GTK_DIALOG (select_host_dialog)->action_area; + gtk_widget_show (dialog_action_area2); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area2), GTK_BUTTONBOX_END); + + cancelbutton2 = gtk_button_new_from_stock ("gtk-cancel"); + gtk_widget_show (cancelbutton2); + gtk_dialog_add_action_widget (GTK_DIALOG (select_host_dialog), cancelbutton2, GTK_RESPONSE_CANCEL); + GTK_WIDGET_SET_FLAGS (cancelbutton2, GTK_CAN_DEFAULT); + + okbutton2 = gtk_button_new_from_stock ("gtk-ok"); + gtk_widget_show (okbutton2); + gtk_dialog_add_action_widget (GTK_DIALOG (select_host_dialog), okbutton2, GTK_RESPONSE_OK); + GTK_WIDGET_SET_FLAGS (okbutton2, GTK_CAN_DEFAULT); } GType gtk_select_host_dialog_get_type () { - static GType mytype = 0; - - if (!mytype) - { - static const GTypeInfo myinfo = - { - sizeof (GtkSelectHostDialogClass), - NULL, - NULL, - NULL, - NULL, - NULL, - sizeof(GtkSelectHostDialog), - 0, - (GInstanceInitFunc) gtk_select_host_dialog_init, - }; - - mytype = g_type_register_static (GTK_TYPE_DIALOG, - "GtkSelectHostDialog", &myinfo, 0); - } - - return mytype; + static GType mytype = 0; + + if (!mytype) + { + static const GTypeInfo myinfo = + { + sizeof (GtkSelectHostDialogClass), + NULL, + NULL, + NULL, + NULL, + NULL, + sizeof(GtkSelectHostDialog), + 0, + (GInstanceInitFunc) gtk_select_host_dialog_init, + }; + + mytype = g_type_register_static (GTK_TYPE_DIALOG, + "GtkSelectHostDialog", &myinfo, 0); + } + + return mytype; } GtkWidget *gtk_select_host_dialog_new (BOOL nocredentials) { return GTK_WIDGET ( gtk_type_new (gtk_select_host_dialog_get_type ())); } - - |