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
|
/*****************************************************************
*
* crxvt-gb.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 gchar crxvt_command_gb[STR_BUFFER_SIZE];
extern gchar crxvt_bg[STR_BUFFER_SIZE];
extern gchar crxvt_fg[STR_BUFFER_SIZE];
extern gchar crxvt_fonts_gb[STR_BUFFER_SIZE];
extern gchar crxvt_im[STR_BUFFER_SIZE];
GtkWidget *entry[5];
void ok_crxvt_gb(GtkWidget *button, gpointer *data)
{
strcpy(crxvt_command_gb,gtk_entry_get_text(GTK_ENTRY(entry[0])));
strcpy(crxvt_bg,gtk_entry_get_text(GTK_ENTRY(entry[1])));
strcpy(crxvt_fg,gtk_entry_get_text(GTK_ENTRY(entry[2])));
strcpy(crxvt_fonts_gb,gtk_entry_get_text(GTK_ENTRY(entry[3])));
strcpy(crxvt_im,gtk_entry_get_text(GTK_ENTRY(entry[4])));
}
void def_crxvt_gb(GtkWidget *button, gpointer *data)
{
gtk_entry_set_text(GTK_ENTRY(entry[0]),CRXVT_COMMAND_GB);
gtk_entry_set_text(GTK_ENTRY(entry[1]),CRXVT_BG);
gtk_entry_set_text(GTK_ENTRY(entry[2]),CRXVT_FG);
gtk_entry_set_text(GTK_ENTRY(entry[3]),CRXVT_FONTS_GB);
gtk_entry_set_text(GTK_ENTRY(entry[4]),CRXVT_IM);
}
void help_crxvt_gb(GtkWidget *button, gpointer *data)
{
show_help("crxvt_opt",_("Help - crxvt Options"),600,300);
}
void crxvt_gb(GtkWidget *button, gpointer *data)
{
gchar *command;
command = g_strconcat(crxvt_command_gb," -bg ",crxvt_bg," -fg ",crxvt_fg,
" -fm \"",crxvt_fonts_gb,"\" -im ",crxvt_im," &",NULL);
system(command);
}
void crxvt_gb_opt(GtkWidget *button, gpointer *data)
{
/* entry[]: 0.command 1.bg 2.fg 3.fonts 4.im */
GtkWidget *win;
GtkWidget *vbox;
GtkWidget *hbox;
/* buttons */
GtkWidget *ok_button;
GtkWidget *cancel_button;
GtkWidget *def_button;
GtkWidget *help_button;
GtkWidget *separator;
/* Make the button inactive */
win = make_opt_win(_("Options - crxvt"),button);
vbox = gtk_vbox_new(FALSE,0);
/* Make Option: make_opt(label,entry,number,value) */
hbox = make_opt(_("Command: "),entry,0,crxvt_command_gb);
gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,1);
hbox = make_opt(_("Background: "),entry,1,crxvt_bg);
gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,1);
hbox = make_opt(_("Foreground: "),entry,2,crxvt_fg);
gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,1);
hbox = make_fonts_opt(_("Fonts: "),entry,3,crxvt_fonts_gb,win);
gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,1);
hbox = make_opt(_("XIM Server Name: "),entry,4,crxvt_im);
gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,1);
/* OK CANEL DEFAULT HELP */
ok_button = gtk_button_new_with_label(_("OK"));
gtk_signal_connect(GTK_OBJECT(ok_button),"clicked",
GTK_SIGNAL_FUNC(ok_crxvt_gb),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_crxvt_gb),NULL);
help_button = gtk_button_new_with_label(_("Help"));
gtk_signal_connect(GTK_OBJECT(help_button),"clicked",
GTK_SIGNAL_FUNC(help_crxvt_gb),NULL);
/* Make buttons: make_button(ok,canel,def,help,win); */
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);
/* show window */
gtk_container_add(GTK_CONTAINER(win),vbox);
gtk_widget_show_all(win);
}
void crxvt_gb_help(GtkWidget *button, gpointer *data)
{
show_help("crxvt_help",_("Help - crxvt"),500,200);
}
|