Merged revisions 97640 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Wed, 9 Jan 2008 22:27:50 +0000 (22:27 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 9 Jan 2008 22:27:50 +0000 (22:27 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r97640 | russell | 2008-01-09 16:26:33 -0600 (Wed, 09 Jan 2008) | 3 lines

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/trunk@97641 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx/pbx_gtkconsole.c

index 2cf4665..2348a8d 100644 (file)
@@ -44,6 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/logger.h"
 #include "asterisk/cli.h"
 #include "asterisk/utils.h"
+#include "asterisk/paths.h"
 
 AST_MUTEX_DEFINE_STATIC(verb_lock);
 
@@ -53,8 +54,6 @@ static int inuse=0;
 static int clipipe[2];
 static int cleanupid = -1;
 
-static char *dtext = "Asterisk PBX Console (GTK Version)";
-
 static GtkWidget *window;
 static GtkWidget *quit;
 static GtkWidget *closew;
@@ -71,7 +70,7 @@ static void update_statusbar(char *msg)
        gtk_statusbar_push(GTK_STATUSBAR(statusbar), 1, msg);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
        if (inuse) {
                /* Kill off the main thread */
@@ -97,7 +96,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];
        struct timeval tv;
@@ -105,8 +104,6 @@ static void __verboser(const char *stuff, int opos, int replacelast, int complet
        s2[0] = (char *)stuff;
        s2[1] = NULL;
        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);
        if (!ast_tvzero(last)) {
                gdk_threads_leave();
@@ -127,11 +124,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);
        /* Lock appropriately if we're really being called in verbose mode */
-       __verboser(stuff, opos, replacelast, complete);
+       __verboser(stuff);
        ast_mutex_unlock(&verb_lock);
 }
 
@@ -156,7 +153,7 @@ static void cliinput(void *data, int source, GdkInputCondition ic)
                        c++;
                        n = *c;
                        *c = '\0';
-                       __verboser(l, 0, 0, 1);
+                       __verboser(l);
                        *(c - 1) = '\0';
                        *c = n;
                        l = c;
@@ -173,14 +170,13 @@ static void cliinput(void *data, int source, GdkInputCondition ic)
 
 }
 
-
 static void remove_module(void)
 {
        int res;
        char *module;
        char buf[256];
        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();
                res = ast_unload_resource(module, 0);
                gdk_threads_enter();
@@ -193,13 +189,14 @@ static void remove_module(void)
                }
        }
 }
-static int reload_module(void *mod)
+
+static int reload(void)
 {
        int res, x;
        char *module;
        char buf[256];
        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);
                if (module) {
                        gdk_threads_leave();
@@ -287,7 +284,7 @@ static int mod_update(void)
        char *module= NULL;
        /* Update the mod stuff */
        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_clear(GTK_CLIST(modules));
@@ -413,7 +410,7 @@ static int show_console(void)
        gtk_signal_connect(GTK_OBJECT(add), "clicked",
                        GTK_SIGNAL_FUNC (add_module), window);
        gtk_signal_connect(GTK_OBJECT(reloadw), "clicked",
-                       GTK_SIGNAL_FUNC (reload_module), window);
+                       GTK_SIGNAL_FUNC (reload), window);
                
        bbox = gtk_vbox_new(FALSE, 5);
        gtk_widget_show(bbox);
@@ -469,7 +466,7 @@ static int show_console(void)
 }
 
 
-static int load_module(void *mod)
+static int load_module(void)
 {
        if (pipe(clipipe)) {
                ast_log(LOG_WARNING, "Unable to create CLI pipe\n");
@@ -492,14 +489,8 @@ static int load_module(void *mod)
        return AST_MODULE_LOAD_SUCCESS;
 }
 
-static const char *description(void)
-{
-       return dtext;
-}
-
-static const char *key(void)
-{
-       return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_0, reload_module, NULL, NULL);
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "GTK Console",
+               .load = load_module,
+               .unload = unload_module,
+               .reload = reload,
+              );