~ubuntu-branches/ubuntu/trusty/gadmin-samba/trusty

« back to all changes in this revision

Viewing changes to src/deactivate_button_clicked.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-05-04 15:03:00 UTC
  • Revision ID: james.westby@ubuntu.com-20080504150300-cwpi1c1j49dxmbv3
Tags: upstream-0.2.4
ImportĀ upstreamĀ versionĀ 0.2.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GADMIN-SAMBA, an easy to use GTK+ frontend for the SAMBA file and print server.
 
2
 * Copyright (C) 2006, 2007, 2008 Magnus Loef <magnus-swe@telia.com> 
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 3 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
12
 * See the GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License along
 
15
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
16
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
17
 *
 
18
*/
 
19
 
 
20
 
 
21
 
 
22
#include "../config.h"
 
23
#include <gtk/gtk.h>
 
24
#include <stdio.h>
 
25
#include <string.h>
 
26
#include "widgets.h"
 
27
#include "gettext.h"
 
28
#include "commands.h"
 
29
#include "show_info.h"
 
30
#include "commands.h"
 
31
 
 
32
extern int activated;
 
33
extern int global_smbd_activated;
 
34
extern int global_nmbd_activated;
 
35
extern int global_winbindd_activated;
 
36
 
 
37
 
 
38
 
 
39
void deactivate_button_clicked(struct w *widgets)
 
40
{
 
41
    gchar *stop, *info;
 
42
 
 
43
    /* We dont want it started by init at boot */
 
44
    init_stop(widgets);
 
45
 
 
46
    if( ! activated )
 
47
      return;
 
48
 
 
49
    /* Killall -15 makes a graceful shutdown but leaves
 
50
       the users logged on. This is not the desired
 
51
       result for the admin here, hence -9 */
 
52
    if( global_winbindd_activated )
 
53
    {
 
54
        stop = g_strdup_printf("killall -9 %s", WINBINDD_BINARY);
 
55
        if( ! run_command(stop) )
 
56
        {
 
57
            info = g_strdup_printf("Stopping samba (winbindd) failed.\n");
 
58
            show_info(info);
 
59
            g_free(info);
 
60
        }
 
61
        g_free(stop);
 
62
    }
 
63
    
 
64
    stop = g_strdup_printf("killall -9 %s", SMBD_BINARY);
 
65
    if( ! run_command(stop) )
 
66
    {
 
67
        info = g_strdup_printf("Stopping samba (smbd) failed.\n");
 
68
        show_info(info);
 
69
        g_free(info);
 
70
    }
 
71
    g_free(stop);
 
72
 
 
73
    if( global_nmbd_activated )
 
74
    {
 
75
        stop = g_strdup_printf("killall -9 %s", NMBD_BINARY);
 
76
        if( ! run_command(stop) )
 
77
        {
 
78
            info = g_strdup_printf("Stopping samba (nmbd) failed.\n");
 
79
            show_info(info);
 
80
            g_free(info);
 
81
        }
 
82
        g_free(stop);
 
83
    }
 
84
}