1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
/*****************************************************************
*
* xacv.c
*
* Copyright (c) 2000 Kam Tik <kamtik@hongkong.com>
*
* http://debian.kamtik.net
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
******************************************************************/
#include "cpanel.h"
#include "defaults.h"
extern gboolean if_xa;
extern gboolean if_cv;
gboolean temp_xa;
gboolean temp_cv;
GtkWidget *check_xa;
GtkWidget *check_cv;
GtkWidget *entry[1];
void exec(GtkWidget *button, gpointer *data)
{
gchar *exec_command;
if(if_xa && if_cv)
exec_command = g_strconcat("xa cv ",gtk_entry_get_text(GTK_ENTRY(entry[0]))," &", NULL);
else if(if_xa)
exec_command = g_strconcat("xa ",gtk_entry_get_text(GTK_ENTRY(entry[0]))," &", NULL);
else if(if_cv)
exec_command = g_strconcat("cv ",gtk_entry_get_text(GTK_ENTRY(entry[0]))," &", NULL);
else
exec_command = g_strconcat(gtk_entry_get_text(GTK_ENTRY(entry[0]))," &", NULL);
system(exec_command);
}
void xa(GtkWidget *button, gpointer *data)
{
if(!if_xa)
temp_xa=1;
else
temp_xa=0;
}
void cv(GtkWidget *button, gpointer *data)
{
if(!if_cv)
temp_cv=1;
else
temp_cv=0;
}
void ok_xacv(GtkWidget *button, gpointer *data)
{
if_xa = temp_xa;
if_cv = temp_cv;
}
void def_xacv(GtkWidget *button, gpointer *data)
{
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check_xa),IF_XA);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check_cv),IF_CV);
}
void help_xacv(GtkWidget *button, gpointer *data)
{
show_help("xacv_opt",_("Help - XA+CV"),600,300);
}
void xacv(GtkWidget *button, gpointer *data)
{
GtkWidget *win;
GtkWidget *ok_button;
GtkWidget *cancel_button;
GtkWidget *hbox;
GtkWidget *vbox;
win = make_opt_win(_("XA+CV"),button);
vbox = gtk_vbox_new(FALSE,0);
hbox = make_opt(_("Run program: "),entry,0,"");
gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,1);
hbox = gtk_hbox_new(FALSE,0);
ok_button = gtk_button_new_with_label(_("OK"));
gtk_signal_connect(GTK_OBJECT(ok_button),"clicked",
GTK_SIGNAL_FUNC(exec),NULL);
gtk_signal_connect(GTK_OBJECT(ok_button),"clicked",
GTK_SIGNAL_FUNC(close_win),win);
gtk_box_pack_start(GTK_BOX(hbox),ok_button,FALSE,FALSE,3);
cancel_button = gtk_button_new_with_label(_("Cancel"));
gtk_signal_connect(GTK_OBJECT(cancel_button),"clicked",
GTK_SIGNAL_FUNC(close_win),win);
gtk_box_pack_start(GTK_BOX(hbox),cancel_button,FALSE,FALSE,3);
gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,2);
gtk_container_add(GTK_CONTAINER(win),vbox);
gtk_widget_show_all(win);
}
void xacv_opt(GtkWidget *button, gpointer *data)
{
GtkWidget *win;
GtkWidget *vbox;
GtkWidget *ok_button;
GtkWidget *cancel_button;
GtkWidget *def_button;
GtkWidget *help_button;
GtkWidget *separator;
GtkWidget *hbox;
temp_cv = if_cv;
temp_xa = if_xa;
win = make_opt_win(_("Option - XA+CV"),button);
vbox = gtk_vbox_new(FALSE,0);
check_xa = make_check_opt(_("Use XA"),if_xa);
gtk_signal_connect(GTK_OBJECT(check_xa),"toggled",
GTK_SIGNAL_FUNC(xa),NULL);
gtk_box_pack_start(GTK_BOX(vbox),check_xa,FALSE,FALSE,1);
check_cv = make_check_opt(_("Use CV"),if_cv);
gtk_signal_connect(GTK_OBJECT(check_cv),"toggled",
GTK_SIGNAL_FUNC(cv),NULL);
gtk_box_pack_start(GTK_BOX(vbox),check_cv,FALSE,FALSE,1);
/* --------------------------------------------------- */
ok_button = gtk_button_new_with_label(_("OK"));
gtk_signal_connect(GTK_OBJECT(ok_button),"clicked",
GTK_SIGNAL_FUNC(ok_xacv),NULL);
cancel_button = gtk_button_new_with_label(_("Cancel"));
def_button = gtk_button_new_with_label(_("Use Defaults"));
gtk_signal_connect(GTK_OBJECT(def_button),"clicked",
GTK_SIGNAL_FUNC(def_xacv),NULL);
help_button = gtk_button_new_with_label(_("Help"));
gtk_signal_connect(GTK_OBJECT(help_button),"clicked",
GTK_SIGNAL_FUNC(help_xacv),NULL);
separator = gtk_hseparator_new();
gtk_box_pack_start(GTK_BOX(vbox),separator,FALSE,FALSE,5);
hbox = make_button(ok_button,cancel_button,def_button,help_button,win,button);
gtk_box_pack_end(GTK_BOX(vbox),hbox,FALSE,FALSE,0);
gtk_container_add(GTK_CONTAINER(win),vbox);
gtk_widget_show_all(win);
}
void xacv_help(GtkWidget *button, gpointer *data)
{
show_help("xacv_help",_("Help - XA+CV"),600,300);
}
|