Index: gastman.c =================================================================== RCS file: /usr/cvsroot/gastman/gastman.c,v retrieving revision 1.2 diff -u -r1.2 gastman.c --- gastman.c 25 Mar 2003 19:45:15 -0000 1.2 +++ gastman.c 30 Mar 2003 07:27:29 -0000 @@ -595,7 +595,7 @@ strncpy(cur->icon, icon, sizeof(cur->icon) - 1); strncpy(cur->chans, chans, sizeof(cur->chans) - 1); strncpy(cur->label, label, sizeof(cur->label) - 1); - snprintf(cur->ident, sizeof(cur->ident), "[%s]exten[%s]", curhost, cur->name); + snprintf(cur->ident, sizeof(cur->ident), "[%s]exten[%s:%s]", curhost, cur->name, cur->chans); if ((cur->name[0] != '_') && (cur->name[0] != '\0')) { if (strlen(cur->label)) snprintf(tmp, sizeof(tmp), "%s - %s", cur->name, cur->label); @@ -612,6 +612,13 @@ } } +char *get_old_ident(void *pvt, char *old_ident, int old_ident_size) +{ + struct ast_exten *exten = pvt; + snprintf(old_ident, old_ident_size, "[%s]exten[%s]", curhost, exten->name); + return old_ident; +} + static char *exten_file(void) { static char fn[256]; @@ -688,15 +695,23 @@ char *exten = NULL, *chans = NULL, *icon = NULL, *label = NULL; struct ast_exten *cur; if (!gui_exten(&exten, &chans, &icon, &label, "Add Extension")) { - cur = extens; - while(cur) { - if (!strcasecmp(cur->name, exten)) - break; - cur = cur->next; - } - if (cur) { - gui_show_message("In Use", "Sorry, that extension already exists!\n"); + if (strlen(exten)) { + cur = extens; + while(cur) { + if (!strcasecmp(cur->name, exten)) + break; + cur = cur->next; + } + if (cur) { + gui_show_message("In Use", "Sorry, that extension already exists!\n"); + } else { + alloc_exten(exten, chans, icon, label); + save_extens(); + check_extens(); + update_channels(); + } } else { + /* Blank extension (i.e. channel indicator) */ alloc_exten(exten, chans, icon, label); save_extens(); check_extens(); Index: gastman.h =================================================================== RCS file: /usr/cvsroot/gastman/gastman.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 gastman.h --- gastman.h 12 Feb 2003 13:59:25 -0000 1.1.1.1 +++ gastman.h 30 Mar 2003 07:27:29 -0000 @@ -69,5 +69,6 @@ char *gastman_complete(const char *orig, int *pos); char *gastman_prevhist(void); char *gastman_nexthist(void); +char *get_old_ident(void *pvt, char *buffer, int buffersize); #endif Index: gui.c =================================================================== RCS file: /usr/cvsroot/gastman/gui.c,v retrieving revision 1.2 diff -u -r1.2 gui.c --- gui.c 25 Mar 2003 19:45:15 -0000 1.2 +++ gui.c 30 Mar 2003 07:27:31 -0000 @@ -736,7 +736,18 @@ fprintf(stderr, "Not null terminated?!? (%s, %d)\n", (char *)data.data, data.size); else if (sscanf((char *)data.data, "%d:%d", &x, &y) != 2) fprintf(stderr, "Whoa, weird...\n"); - + else { + char old_ident[80]; + get_old_ident(obj->pvt, old_ident, 80); + key.data = old_ident; + key.size = strlen(old_ident) + 1; +#ifdef __FreeBSD__ + if (!(res = db->get(db, &key, &data, 0))) +#else + if (!(res = db->get(db, NULL, &key, &data, 0))) +#endif + sscanf((char *)data.data, "%d:%d", &x, &y); + } } } if (!x && !y) { @@ -1408,6 +1419,12 @@ gastman_add_exten(); } +static void edit_exten(gpointer callback_data, guint callback_action, GtkWidget *widget) +{ + if (current) + gastman_double_click(current->pvt); +} + static void del_exten(gpointer callback_data, guint callback_action, GtkWidget *widget) { if (current) @@ -1445,8 +1462,10 @@ static GtkItemFactoryEntry entries[] = { { "/_File", NULL, NULL, 0, "" }, { "/_File/_Quit", "Q", quit_program, 0, "" }, - { "/_New", NULL, NULL, 0, "" }, - { "/_New/_Exten", "E", new_exten, 0, "" }, + { "/_Exten", NULL, NULL, 0, "" }, + { "/_Exten/_New", "N", new_exten, 0, "" }, + { "/_Exten/_Edit", "E", edit_exten, 0, "" }, + { "/_Exten/_Delete", "D", del_exten, 0, "" }, }; static GtkItemFactoryEntry callentries[] = { @@ -1461,6 +1480,7 @@ { "/Separator", NULL, NULL, 0, "" }, { "/_Originate", "O", originate_exten, 0, "" }, { "/_Delete", "D", del_exten, 0, "" }, + { "/_Edit", "E", edit_exten, 0, "" }, }; static int schedid = -1;