mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
Make pbx_gtkconsole build ... but doesn't actually load on my system still
(related to issue #11706) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@97640 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -51,6 +51,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/options.h"
|
#include "asterisk/options.h"
|
||||||
#include "asterisk/cli.h"
|
#include "asterisk/cli.h"
|
||||||
#include "asterisk/utils.h"
|
#include "asterisk/utils.h"
|
||||||
|
#include "asterisk/paths.h"
|
||||||
|
|
||||||
AST_MUTEX_DEFINE_STATIC(verb_lock);
|
AST_MUTEX_DEFINE_STATIC(verb_lock);
|
||||||
|
|
||||||
@@ -60,8 +61,6 @@ static int inuse=0;
|
|||||||
static int clipipe[2];
|
static int clipipe[2];
|
||||||
static int cleanupid = -1;
|
static int cleanupid = -1;
|
||||||
|
|
||||||
static char *dtext = "Asterisk PBX Console (GTK Version)";
|
|
||||||
|
|
||||||
static GtkWidget *window;
|
static GtkWidget *window;
|
||||||
static GtkWidget *quit;
|
static GtkWidget *quit;
|
||||||
static GtkWidget *closew;
|
static GtkWidget *closew;
|
||||||
@@ -78,7 +77,7 @@ static void update_statusbar(char *msg)
|
|||||||
gtk_statusbar_push(GTK_STATUSBAR(statusbar), 1, msg);
|
gtk_statusbar_push(GTK_STATUSBAR(statusbar), 1, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int unload_module(void *mod)
|
static int unload_module(void)
|
||||||
{
|
{
|
||||||
if (inuse) {
|
if (inuse) {
|
||||||
/* Kill off the main thread */
|
/* Kill off the main thread */
|
||||||
@@ -104,7 +103,7 @@ static int cleanup(void *useless)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void __verboser(const char *stuff, int opos, int replacelast, int complete)
|
static void __verboser(const char *stuff)
|
||||||
{
|
{
|
||||||
char *s2[2];
|
char *s2[2];
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@@ -112,8 +111,6 @@ static void __verboser(const char *stuff, int opos, int replacelast, int complet
|
|||||||
s2[0] = (char *)stuff;
|
s2[0] = (char *)stuff;
|
||||||
s2[1] = NULL;
|
s2[1] = NULL;
|
||||||
gtk_clist_freeze(GTK_CLIST(verb));
|
gtk_clist_freeze(GTK_CLIST(verb));
|
||||||
if (replacelast)
|
|
||||||
gtk_clist_remove(GTK_CLIST(verb), GTK_CLIST(verb)->rows - 1);
|
|
||||||
gtk_clist_append(GTK_CLIST(verb), s2);
|
gtk_clist_append(GTK_CLIST(verb), s2);
|
||||||
if (!ast_tvzero(last)) {
|
if (!ast_tvzero(last)) {
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
@@ -134,11 +131,11 @@ static void __verboser(const char *stuff, int opos, int replacelast, int complet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void verboser(const char *stuff, int opos, int replacelast, int complete)
|
static void verboser(const char *stuff)
|
||||||
{
|
{
|
||||||
ast_mutex_lock(&verb_lock);
|
ast_mutex_lock(&verb_lock);
|
||||||
/* Lock appropriately if we're really being called in verbose mode */
|
/* Lock appropriately if we're really being called in verbose mode */
|
||||||
__verboser(stuff, opos, replacelast, complete);
|
__verboser(stuff);
|
||||||
ast_mutex_unlock(&verb_lock);
|
ast_mutex_unlock(&verb_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +160,7 @@ static void cliinput(void *data, int source, GdkInputCondition ic)
|
|||||||
c++;
|
c++;
|
||||||
n = *c;
|
n = *c;
|
||||||
*c = '\0';
|
*c = '\0';
|
||||||
__verboser(l, 0, 0, 1);
|
__verboser(l);
|
||||||
*(c - 1) = '\0';
|
*(c - 1) = '\0';
|
||||||
*c = n;
|
*c = n;
|
||||||
l = c;
|
l = c;
|
||||||
@@ -180,14 +177,13 @@ static void cliinput(void *data, int source, GdkInputCondition ic)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void remove_module(void)
|
static void remove_module(void)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
char *module;
|
char *module;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
if (GTK_CLIST(modules)->selection) {
|
if (GTK_CLIST(modules)->selection) {
|
||||||
module= (char *)gtk_clist_get_row_data(GTK_CLIST(modules), (int) GTK_CLIST(modules)->selection->data);
|
module = (char *) gtk_clist_get_row_data(GTK_CLIST(modules), (long) GTK_CLIST(modules)->selection->data);
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
res = ast_unload_resource(module, 0);
|
res = ast_unload_resource(module, 0);
|
||||||
gdk_threads_enter();
|
gdk_threads_enter();
|
||||||
@@ -200,13 +196,14 @@ static void remove_module(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static int reload_module(void *mod)
|
|
||||||
|
static int reload(void)
|
||||||
{
|
{
|
||||||
int res, x;
|
int res, x;
|
||||||
char *module;
|
char *module;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
if (GTK_CLIST(modules)->selection) {
|
if (GTK_CLIST(modules)->selection) {
|
||||||
module= (char *)gtk_clist_get_row_data(GTK_CLIST(modules), (int) GTK_CLIST(modules)->selection->data);
|
module= (char *)gtk_clist_get_row_data(GTK_CLIST(modules), (long) GTK_CLIST(modules)->selection->data);
|
||||||
module = strdup(module);
|
module = strdup(module);
|
||||||
if (module) {
|
if (module) {
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
@@ -294,7 +291,7 @@ static int mod_update(void)
|
|||||||
char *module= NULL;
|
char *module= NULL;
|
||||||
/* Update the mod stuff */
|
/* Update the mod stuff */
|
||||||
if (GTK_CLIST(modules)->selection) {
|
if (GTK_CLIST(modules)->selection) {
|
||||||
module= (char *)gtk_clist_get_row_data(GTK_CLIST(modules), (int) GTK_CLIST(modules)->selection->data);
|
module= (char *)gtk_clist_get_row_data(GTK_CLIST(modules), (long) GTK_CLIST(modules)->selection->data);
|
||||||
}
|
}
|
||||||
gtk_clist_freeze(GTK_CLIST(modules));
|
gtk_clist_freeze(GTK_CLIST(modules));
|
||||||
gtk_clist_clear(GTK_CLIST(modules));
|
gtk_clist_clear(GTK_CLIST(modules));
|
||||||
@@ -421,7 +418,7 @@ static int show_console(void)
|
|||||||
gtk_signal_connect(GTK_OBJECT(add), "clicked",
|
gtk_signal_connect(GTK_OBJECT(add), "clicked",
|
||||||
GTK_SIGNAL_FUNC (add_module), window);
|
GTK_SIGNAL_FUNC (add_module), window);
|
||||||
gtk_signal_connect(GTK_OBJECT(reloadw), "clicked",
|
gtk_signal_connect(GTK_OBJECT(reloadw), "clicked",
|
||||||
GTK_SIGNAL_FUNC (reload_module), window);
|
GTK_SIGNAL_FUNC (reload), window);
|
||||||
|
|
||||||
bbox = gtk_vbox_new(FALSE, 5);
|
bbox = gtk_vbox_new(FALSE, 5);
|
||||||
gtk_widget_show(bbox);
|
gtk_widget_show(bbox);
|
||||||
@@ -477,7 +474,7 @@ static int show_console(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int load_module(void *mod)
|
static int load_module(void)
|
||||||
{
|
{
|
||||||
if (pipe(clipipe)) {
|
if (pipe(clipipe)) {
|
||||||
ast_log(LOG_WARNING, "Unable to create CLI pipe\n");
|
ast_log(LOG_WARNING, "Unable to create CLI pipe\n");
|
||||||
@@ -501,14 +498,8 @@ static int load_module(void *mod)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *description(void)
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "GTK Console",
|
||||||
{
|
.load = load_module,
|
||||||
return dtext;
|
.unload = unload_module,
|
||||||
}
|
.reload = reload,
|
||||||
|
);
|
||||||
static const char *key(void)
|
|
||||||
{
|
|
||||||
return ASTERISK_GPL_KEY;
|
|
||||||
}
|
|
||||||
|
|
||||||
STD_MOD(MOD_0, reload_module, NULL, NULL);
|
|
||||||
|
Reference in New Issue
Block a user