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>
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.
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.
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.
22
#include "../config.h"
31
#include "show_info.h"
32
#include "populate_shell_combo.h"
36
void populate_shell_combo(GtkWidget *shell_combo)
43
gchar *combo_text=NULL;
46
/* Append a /dev/null shell first and select it */
47
combo_text = g_strdup_printf("/dev/null");
48
utf8 = g_locale_to_utf8(combo_text, strlen(combo_text), NULL, NULL, NULL);
49
gtk_combo_box_append_text(GTK_COMBO_BOX(shell_combo), utf8);
50
gtk_combo_box_set_active(GTK_COMBO_BOX(shell_combo), 0);
53
if((fp=fopen(SHELLS_FILE, "r"))==NULL)
55
info = g_strdup_printf(_("Cant find the shells file here:\n%s\n"), SHELLS_FILE);
60
fseek(fp, 0, SEEK_END);
61
conf_size = ftell(fp);
64
line = allocate(conf_size+2);
65
new_buf = allocate(conf_size+2);
68
while(fgets(line, conf_size, fp)!=NULL)
70
/* Append all other shells but not /dev/null */
71
if( strlen(line) > 3 && ! strstr(line, "#") && ! strstr(line, "/dev/null") )
74
strcpy(new_buf, line);
75
utf8 = g_locale_to_utf8(new_buf, strlen(new_buf)-1, NULL, NULL, NULL);
76
gtk_combo_box_append_text(GTK_COMBO_BOX(shell_combo), utf8);