"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dialer.c" between
jpilot-1.8.2.tar.gz and jpilot-2_0_1.tar.gz

About: J-Pilot is a desktop organizer application for Palm Pilot (PalmOS) devices. Ported to GTK3.

dialer.c  (jpilot-1.8.2):dialer.c  (jpilot-2_0_1)
skipping to change at line 38 skipping to change at line 38
#include "utils.h" #include "utils.h"
#include "log.h" #include "log.h"
#include "prefs.h" #include "prefs.h"
/********************************* Constants **********************************/ /********************************* Constants **********************************/
#define CHOOSE_PHONE 1 #define CHOOSE_PHONE 1
#define CHOOSE_EXT 2 #define CHOOSE_EXT 2
/****************************** Prototypes ************************************/ /****************************** Prototypes ************************************/
struct dialog_data { struct dialog_data {
GtkWidget *entry_pre1; GtkWidget *entry_pre1;
GtkWidget *entry_pre2; GtkWidget *entry_pre2;
GtkWidget *entry_pre3; GtkWidget *entry_pre3;
GtkWidget *check_pre1; GtkWidget *check_pre1;
GtkWidget *check_pre2; GtkWidget *check_pre2;
GtkWidget *check_pre3; GtkWidget *check_pre3;
GtkWidget *entry_phone; GtkWidget *entry_phone;
GtkWidget *entry_ext; GtkWidget *entry_ext;
GtkWidget *entry_command; GtkWidget *entry_command;
GtkWidget *label_prefix; GtkWidget *label_prefix;
}; };
/****************************** Main Code *************************************/ /****************************** Main Code *************************************/
static void cb_dialog_button(GtkWidget *widget, gpointer data) static void cb_dialog_button(GtkWidget *widget, gpointer data) {
{ GtkWidget *w;
GtkWidget *w;
w = gtk_widget_get_toplevel(widget);
w = gtk_widget_get_toplevel(widget); g_object_get_data(G_OBJECT(w), "dialog_data");
gtk_object_get_data(GTK_OBJECT(w), "dialog_data"); gtk_widget_destroy(GTK_WIDGET(w));
gtk_widget_destroy(GTK_WIDGET(w));
} }
static gboolean cb_destroy_dialog(GtkWidget *widget) static gboolean cb_destroy_dialog(GtkWidget *widget) {
{ struct dialog_data *Pdata;
struct dialog_data *Pdata; const gchar *txt;
const gchar *txt;
Pdata = g_object_get_data(G_OBJECT(widget), "dialog_data");
Pdata = gtk_object_get_data(GTK_OBJECT(widget), "dialog_data"); if (!Pdata) {
if (!Pdata) { return TRUE;
return TRUE; }
} txt = gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre1));
txt = gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre1)); set_pref(PREF_PHONE_PREFIX1, 0, txt, FALSE);
set_pref(PREF_PHONE_PREFIX1, 0, txt, FALSE); txt = gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre2));
txt = gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre2)); set_pref(PREF_PHONE_PREFIX2, 0, txt, FALSE);
set_pref(PREF_PHONE_PREFIX2, 0, txt, FALSE); txt = gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre3));
txt = gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre3)); set_pref(PREF_PHONE_PREFIX3, 0, txt, FALSE);
set_pref(PREF_PHONE_PREFIX3, 0, txt, FALSE); txt = gtk_entry_get_text(GTK_ENTRY(Pdata->entry_command));
txt = gtk_entry_get_text(GTK_ENTRY(Pdata->entry_command)); set_pref(PREF_DIAL_COMMAND, 0, txt, FALSE);
set_pref(PREF_DIAL_COMMAND, 0, txt, FALSE);
set_pref(PREF_CHECK_PREFIX1, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
set_pref(PREF_CHECK_PREFIX1, GTK_TOGGLE_BUTTON(Pdata->check_pre1)->active, Pdata->check_pre1)),
NULL, FALSE); NULL, FALSE);
set_pref(PREF_CHECK_PREFIX2, GTK_TOGGLE_BUTTON(Pdata->check_pre2)->active, set_pref(PREF_CHECK_PREFIX2, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
NULL, FALSE); Pdata->check_pre2)),
set_pref(PREF_CHECK_PREFIX3, GTK_TOGGLE_BUTTON(Pdata->check_pre3)->active, NULL, FALSE);
NULL, TRUE); set_pref(PREF_CHECK_PREFIX3, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
Pdata->check_pre3)),
NULL, TRUE);
gtk_main_quit(); gtk_main_quit();
return TRUE; return TRUE;
} }
static void set_prefix_label(struct dialog_data *Pdata) static void set_prefix_label(struct dialog_data *Pdata) {
{ char str[70];
char str[70];
g_snprintf(str, sizeof(str), "%s%s%s",
g_snprintf(str, sizeof(str), "%s%s%s", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Pdata->check_pre1)
GTK_TOGGLE_BUTTON(Pdata->check_pre1)->active ? ) ?
gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre1)) : "", gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre1)) : "",
GTK_TOGGLE_BUTTON(Pdata->check_pre2)->active ? gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Pdata->check_pre2)
gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre2)) : "", ) ?
GTK_TOGGLE_BUTTON(Pdata->check_pre3)->active ? gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre2)) : "",
gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre3)) : ""); gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Pdata->check_pre3)
gtk_label_set_text(GTK_LABEL(Pdata->label_prefix), str); ) ?
gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre3)) : "");
gtk_label_set_text(GTK_LABEL(Pdata->label_prefix), str);
} }
static void cb_prefix_change(GtkWidget *widget, gpointer data) static void cb_prefix_change(GtkWidget *widget, gpointer data) {
{ set_prefix_label(data);
set_prefix_label(data);
} }
static void dialer(gpointer data, int phone_or_ext) static void dialer(gpointer data, int phone_or_ext) {
{ struct dialog_data *Pdata;
struct dialog_data *Pdata; char str[70];
char str[70]; char null_str[] = "";
char null_str[]=""; const char *Pext;
const char *Pext; char command[1024];
char command[1024]; const char *pref_command;
const char *pref_command; char c1, c2;
char c1, c2; int i, len;
int i, len;
Pdata = data;
Pdata=data; if (phone_or_ext == CHOOSE_PHONE) {
if (phone_or_ext==CHOOSE_PHONE) { g_snprintf(str, sizeof(str), "%s%s%s%s",
g_snprintf(str, sizeof(str), "%s%s%s%s", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Pdata->check_p
GTK_TOGGLE_BUTTON(Pdata->check_pre1)->active ? re1)) ?
gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre1)) : "", gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre1)) : "",
GTK_TOGGLE_BUTTON(Pdata->check_pre2)->active ? gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Pdata->check_p
gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre2)) : "", re2)) ?
GTK_TOGGLE_BUTTON(Pdata->check_pre3)->active ? gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre2)) : "",
gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre3)) : "", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Pdata->check_p
gtk_entry_get_text(GTK_ENTRY(Pdata->entry_phone))); re3)) ?
} gtk_entry_get_text(GTK_ENTRY(Pdata->entry_pre3)) : "",
if (phone_or_ext==CHOOSE_EXT) { gtk_entry_get_text(GTK_ENTRY(Pdata->entry_phone)));
Pext=gtk_entry_get_text(GTK_ENTRY(Pdata->entry_ext)); }
if (!Pext) Pext=null_str; if (phone_or_ext == CHOOSE_EXT) {
g_strlcpy(str, Pext, sizeof(str)); Pext = gtk_entry_get_text(GTK_ENTRY(Pdata->entry_ext));
} if (!Pext) Pext = null_str;
g_strlcpy(str, Pext, sizeof(str));
pref_command = gtk_entry_get_text(GTK_ENTRY(Pdata->entry_command)); }
/* Make a system call command string */
memset(command, 0, sizeof(command)); pref_command = gtk_entry_get_text(GTK_ENTRY(Pdata->entry_command));
for (i=0; i<MAX_PREF_LEN-1; i++) { /* Make a system call command string */
c1 = pref_command[i]; memset(command, 0, sizeof(command));
c2 = pref_command[i+1]; for (i = 0; i < MAX_PREF_LEN - 1; i++) {
len = strlen(command); c1 = pref_command[i];
/* expand '%n' */ c2 = pref_command[i + 1];
if (c1=='%') { len = strlen(command);
if (c2=='n') { /* expand '%n' */
i++; if (c1 == '%') {
strncat(command, str, 1022-len); if (c2 == 'n') {
continue; i++;
} strncat(command, str, 1022 - len);
} continue;
if (len<1020) { }
command[len++]=c1; }
command[len]='\0'; if (len < 1020) {
} command[len++] = c1;
if (c1=='\0') { command[len] = '\0';
break; }
} if (c1 == '\0') {
} break;
command[1022]='\0'; }
}
jp_logf(JP_LOG_STDOUT|JP_LOG_FILE, _("executing command = [%s]\n"), command); command[1022] = '\0';
if (system(command) == -1) {
jp_logf(JP_LOG_WARN, "system call failed %s %d\n", __FILE__, __LINE__); jp_logf(JP_LOG_STDOUT | JP_LOG_FILE, _("executing command = [%s]\n"), comman
} d);
if (system(command) == -1) {
jp_logf(JP_LOG_WARN, "system call failed %s %d\n", __FILE__, __LINE__);
}
} }
static void cb_dial_ext(GtkWidget *widget, gpointer data) static void cb_dial_ext(GtkWidget *widget, gpointer data) {
{ dialer(data, CHOOSE_EXT);
dialer(data, CHOOSE_EXT);
} }
static void cb_dial_phone(GtkWidget *widget, gpointer data) static void cb_dial_phone(GtkWidget *widget, gpointer data) {
{ dialer(data, CHOOSE_PHONE);
dialer(data, CHOOSE_PHONE);
} }
/* /*
* Dialog window for calling external dialing program * Dialog window for calling external dialing program
*/ */
int dialog_dial(GtkWindow *main_window, char *string, char *ext) int dialog_dial(GtkWindow *main_window, char *string, char *ext) {
{ GtkWidget *button, *label;
GtkWidget *button, *label; GtkWidget *hbox1, *vbox1;
GtkWidget *hbox1, *vbox1; GtkWidget *dialog;
GtkWidget *dialog; GtkWidget *entry;
GtkWidget *entry; GtkWidget *checkbox1, *checkbox2, *checkbox3;
GtkWidget *checkbox1, *checkbox2, *checkbox3; struct dialog_data *Pdata;
struct dialog_data *Pdata; long use_prefix;
long use_prefix; const char *prefix;
const char *prefix; const char *dial_command;
const char *dial_command;
dialog = gtk_widget_new(GTK_TYPE_WINDOW,
dialog = gtk_widget_new(GTK_TYPE_WINDOW, "type", GTK_WINDOW_TOPLEVEL,
"type", GTK_WINDOW_TOPLEVEL, "title", _("Phone Dialer"),
"title", _("Phone Dialer"), NULL);
NULL);
gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
g_signal_connect(G_OBJECT(dialog), "destroy",
gtk_signal_connect(GTK_OBJECT(dialog), "destroy", G_CALLBACK(cb_destroy_dialog), dialog);
GTK_SIGNAL_FUNC(cb_destroy_dialog), dialog);
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(main_window));
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(main_window));
/* Set up a data structure for the window */
/* Set up a data structure for the window */ Pdata = malloc(sizeof(struct dialog_data));
Pdata = malloc(sizeof(struct dialog_data));
g_object_set_data(G_OBJECT(dialog), "dialog_data", Pdata);
gtk_object_set_data(GTK_OBJECT(dialog), "dialog_data", Pdata);
vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
vbox1 = gtk_vbox_new(FALSE, 2);
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
gtk_container_add(GTK_CONTAINER(dialog), vbox1);
gtk_container_add(GTK_CONTAINER(dialog), vbox1);
/* Prefix 1 */
/* Prefix 1 */ hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
hbox1 = gtk_hbox_new(FALSE, 2); gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5);
gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2);
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2);
get_pref(PREF_PHONE_PREFIX1, NULL, &prefix);
get_pref(PREF_PHONE_PREFIX1, NULL, &prefix); get_pref(PREF_CHECK_PREFIX1, &use_prefix, NULL);
get_pref(PREF_CHECK_PREFIX1, &use_prefix, NULL);
checkbox1 = gtk_check_button_new();
checkbox1 = gtk_check_button_new(); gtk_box_pack_start(GTK_BOX(hbox1), checkbox1, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox1), checkbox1, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox1), use_prefix);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox1), use_prefix);
label = gtk_label_new(_("Prefix 1"));
label = gtk_label_new(_("Prefix 1")); gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2);
gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2);
entry = gtk_entry_new();
entry = gtk_entry_new_with_max_length(32); gtk_entry_set_max_length(GTK_ENTRY(entry), 32);
gtk_entry_set_text(GTK_ENTRY(entry), prefix); gtk_entry_set_text(GTK_ENTRY(entry), prefix);
gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 1); gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 1);
Pdata->entry_pre1=entry; Pdata->entry_pre1 = entry;
Pdata->check_pre1=checkbox1; Pdata->check_pre1 = checkbox1;
/* Prefix 2 */ /* Prefix 2 */
hbox1 = gtk_hbox_new(FALSE, 2); hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5); gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5);
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2);
get_pref(PREF_PHONE_PREFIX2, NULL, &prefix); get_pref(PREF_PHONE_PREFIX2, NULL, &prefix);
get_pref(PREF_CHECK_PREFIX2, &use_prefix, NULL); get_pref(PREF_CHECK_PREFIX2, &use_prefix, NULL);
checkbox2 = gtk_check_button_new(); checkbox2 = gtk_check_button_new();
gtk_box_pack_start(GTK_BOX(hbox1), checkbox2, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox1), checkbox2, FALSE, FALSE, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox2), use_prefix); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox2), use_prefix);
label = gtk_label_new(_("Prefix 2")); label = gtk_label_new(_("Prefix 2"));
gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2);
entry = gtk_entry_new_with_max_length(32); entry = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(entry), prefix); gtk_entry_set_max_length(GTK_ENTRY(entry), 32);
gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 1); gtk_entry_set_text(GTK_ENTRY(entry), prefix);
gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 1);
Pdata->entry_pre2=entry;
Pdata->check_pre2=checkbox2; Pdata->entry_pre2 = entry;
Pdata->check_pre2 = checkbox2;
/* Prefix 3 */
hbox1 = gtk_hbox_new(FALSE, 2); /* Prefix 3 */
gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5); hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2); gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5);
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2);
get_pref(PREF_PHONE_PREFIX3, NULL, &prefix);
get_pref(PREF_CHECK_PREFIX3, &use_prefix, NULL); get_pref(PREF_PHONE_PREFIX3, NULL, &prefix);
get_pref(PREF_CHECK_PREFIX3, &use_prefix, NULL);
checkbox3 = gtk_check_button_new();
gtk_box_pack_start(GTK_BOX(hbox1), checkbox3, FALSE, FALSE, 0); checkbox3 = gtk_check_button_new();
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox3), use_prefix); gtk_box_pack_start(GTK_BOX(hbox1), checkbox3, FALSE, FALSE, 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox3), use_prefix);
label = gtk_label_new(_("Prefix 3"));
gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2); label = gtk_label_new(_("Prefix 3"));
gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2);
entry = gtk_entry_new_with_max_length(32);
gtk_entry_set_text(GTK_ENTRY(entry), prefix); entry = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 1); gtk_entry_set_max_length(GTK_ENTRY(entry), 32);
gtk_entry_set_text(GTK_ENTRY(entry), prefix);
Pdata->entry_pre3=entry; gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 1);
Pdata->check_pre3=checkbox3;
Pdata->entry_pre3 = entry;
/* Phone number entry */ Pdata->check_pre3 = checkbox3;
hbox1 = gtk_hbox_new(FALSE, 2);
gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5); /* Phone number entry */
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2); hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5);
label = gtk_label_new(_("Phone number:")); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2);
gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2);
label = gtk_label_new(_("Phone number:"));
/* Prefix label */ gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2);
label = gtk_label_new("");
gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2); /* Prefix label */
Pdata->label_prefix=label; label = gtk_label_new("");
set_prefix_label(Pdata); gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2);
Pdata->label_prefix = label;
entry = gtk_entry_new_with_max_length(32); set_prefix_label(Pdata);
gtk_entry_set_text(GTK_ENTRY(entry), string);
gtk_signal_connect(GTK_OBJECT(entry), "activate", entry = gtk_entry_new();
GTK_SIGNAL_FUNC(cb_dial_ext), Pdata); gtk_entry_set_max_length(GTK_ENTRY(entry), 32);
gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 1); gtk_entry_set_text(GTK_ENTRY(entry), string);
g_signal_connect(G_OBJECT(entry), "activate",
Pdata->entry_phone=entry; G_CALLBACK(cb_dial_ext), Pdata);
gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 1);
/* Dial Phone Button */
button = gtk_button_new_with_label(_("Dial")); Pdata->entry_phone = entry;
gtk_signal_connect(GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(cb_dial_phone), Pdata); /* Dial Phone Button */
gtk_box_pack_start(GTK_BOX(hbox1), button, TRUE, TRUE, 1); button = gtk_button_new_with_label(_("Dial"));
g_signal_connect(G_OBJECT(button), "clicked",
gtk_widget_grab_focus(GTK_WIDGET(button)); G_CALLBACK(cb_dial_phone), Pdata);
gtk_box_pack_start(GTK_BOX(hbox1), button, TRUE, TRUE, 1);
/* Extension */
hbox1 = gtk_hbox_new(FALSE, 2); gtk_widget_grab_focus(GTK_WIDGET(button));
gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5);
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2); /* Extension */
hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
label = gtk_label_new(_("Extension")); gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5);
gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2);
entry = gtk_entry_new_with_max_length(32); label = gtk_label_new(_("Extension"));
gtk_entry_set_text(GTK_ENTRY(entry), ext); gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2);
gtk_signal_connect(GTK_OBJECT(entry), "activate",
GTK_SIGNAL_FUNC(cb_dial_ext), Pdata); entry = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 1); gtk_entry_set_max_length(GTK_ENTRY(entry), 32);
gtk_entry_set_text(GTK_ENTRY(entry), ext);
Pdata->entry_ext=entry; g_signal_connect(G_OBJECT(entry), "activate",
G_CALLBACK(cb_dial_ext), Pdata);
/* Dial Phone Button */ gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 1);
button = gtk_button_new_with_label(_("Dial"));
gtk_signal_connect(GTK_OBJECT(button), "clicked", Pdata->entry_ext = entry;
GTK_SIGNAL_FUNC(cb_dial_ext), Pdata);
gtk_box_pack_start(GTK_BOX(hbox1), button, TRUE, TRUE, 1); /* Dial Phone Button */
button = gtk_button_new_with_label(_("Dial"));
/* Command Entry */ g_signal_connect(G_OBJECT(button), "clicked",
hbox1 = gtk_hbox_new(FALSE, 2); G_CALLBACK(cb_dial_ext), Pdata);
gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5); gtk_box_pack_start(GTK_BOX(hbox1), button, TRUE, TRUE, 1);
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2);
/* Command Entry */
label = gtk_label_new(_("Dial Command")); hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2); gtk_container_set_border_width(GTK_CONTAINER(hbox1), 5);
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2);
entry = gtk_entry_new_with_max_length(100);
gtk_entry_set_text(GTK_ENTRY(entry), ext); label = gtk_label_new(_("Dial Command"));
gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 1); gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, FALSE, 2);
get_pref(PREF_DIAL_COMMAND, NULL, &dial_command); entry = gtk_entry_new();
if (dial_command) { gtk_entry_set_max_length(GTK_ENTRY(entry), 100);
gtk_entry_set_text(GTK_ENTRY(entry), dial_command); gtk_entry_set_text(GTK_ENTRY(entry), ext);
} gtk_box_pack_start(GTK_BOX(hbox1), entry, TRUE, TRUE, 1);
Pdata->entry_command=entry; get_pref(PREF_DIAL_COMMAND, NULL, &dial_command);
if (dial_command) {
/* Button Box */ gtk_entry_set_text(GTK_ENTRY(entry), dial_command);
hbox1 = gtk_hbutton_box_new(); }
gtk_container_set_border_width(GTK_CONTAINER(hbox1), 7);
gtk_button_box_set_layout(GTK_BUTTON_BOX (hbox1), GTK_BUTTONBOX_END); Pdata->entry_command = entry;
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2);
/* Button Box */
/* Buttons */ hbox1 = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); gtk_container_set_border_width(GTK_CONTAINER(hbox1), 7);
gtk_signal_connect(GTK_OBJECT(button), "clicked", gtk_button_box_set_layout(GTK_BUTTON_BOX (hbox1), GTK_BUTTONBOX_END);
GTK_SIGNAL_FUNC(cb_dialog_button), gtk_box_pack_start(GTK_BOX(vbox1), hbox1, FALSE, FALSE, 2);
GINT_TO_POINTER(DIALOG_SAID_1));
gtk_box_pack_start(GTK_BOX(hbox1), button, TRUE, TRUE, 1); /* Buttons */
button = gtk_button_new_with_label("Close");
/* We do this down here because the Pdata structure wasn't complete earlier * g_signal_connect(G_OBJECT(button), "clicked",
/ G_CALLBACK(cb_dialog_button),
gtk_signal_connect(GTK_OBJECT(checkbox1), "clicked", GINT_TO_POINTER(DIALOG_SAID_1));
GTK_SIGNAL_FUNC(cb_prefix_change), Pdata); gtk_box_pack_start(GTK_BOX(hbox1), button, TRUE, TRUE, 1);
gtk_signal_connect(GTK_OBJECT(checkbox2), "clicked",
GTK_SIGNAL_FUNC(cb_prefix_change), Pdata); /* We do this down here because the Pdata structure wasn't complete earlier
gtk_signal_connect(GTK_OBJECT(checkbox3), "clicked", */
GTK_SIGNAL_FUNC(cb_prefix_change), Pdata); g_signal_connect(G_OBJECT(checkbox1), "clicked",
gtk_signal_connect(GTK_OBJECT(Pdata->entry_pre1), "changed", G_CALLBACK(cb_prefix_change), Pdata);
GTK_SIGNAL_FUNC(cb_prefix_change), Pdata); g_signal_connect(G_OBJECT(checkbox2), "clicked",
gtk_signal_connect(GTK_OBJECT(Pdata->entry_pre2), "changed", G_CALLBACK(cb_prefix_change), Pdata);
GTK_SIGNAL_FUNC(cb_prefix_change), Pdata); g_signal_connect(G_OBJECT(checkbox3), "clicked",
gtk_signal_connect(GTK_OBJECT(Pdata->entry_pre3), "changed", G_CALLBACK(cb_prefix_change), Pdata);
GTK_SIGNAL_FUNC(cb_prefix_change), Pdata); g_signal_connect(G_OBJECT(Pdata->entry_pre1), "changed",
G_CALLBACK(cb_prefix_change), Pdata);
g_signal_connect(G_OBJECT(Pdata->entry_pre2), "changed",
G_CALLBACK(cb_prefix_change), Pdata);
g_signal_connect(G_OBJECT(Pdata->entry_pre3), "changed",
G_CALLBACK(cb_prefix_change), Pdata);
gtk_widget_show_all(dialog); gtk_widget_show_all(dialog);
gtk_main(); gtk_main();
free(Pdata); free(Pdata);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
 End of changes. 15 change blocks. 
326 lines changed or deleted 334 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)