From: Darren S. <ds...@us...> - 2006-02-17 18:46:13
|
Update of /cvsroot/xine/gnome-xine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15002/src Modified Files: script_engine.c Log Message: Add a "JS console has new content" indicator. Remove some debug printf()s. Index: script_engine.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/script_engine.c,v retrieving revision 1.74 retrieving revision 1.75 diff -u -r1.74 -r1.75 --- script_engine.c 17 Feb 2006 03:09:40 -0000 1.74 +++ script_engine.c 17 Feb 2006 18:46:07 -0000 1.75 @@ -58,6 +58,8 @@ */ se_o_t *event_obj = NULL; +static se_o_t *js_icon_obj = NULL; + static JSRuntime *rt=NULL; /* global */ static GSList *se_chain; @@ -80,6 +82,17 @@ gtk_tree_path_free (path); } +static void se_js_icon (int flag) +{ + if (!GTK_WIDGET_VISIBLE (se_window)) + { + int oldv = se_prop_get_int (gse, js_icon_obj, "v"); + int newv = oldv | flag; + if (oldv != newv) + se_prop_set_int (gse, js_icon_obj, "v", newv); + } +} + void se_result_cb (void *data, const char *format, ...) { va_list ap; @@ -92,6 +105,7 @@ free (msg); se_store_text (GTK_STOCK_DIALOG_INFO, text); free (text); + se_js_icon (1); } void se_error_cb (const char *msg, const JSErrorReport *report) @@ -100,6 +114,7 @@ GTK_STOCK_DIALOG_ERROR, GTK_STOCK_DIALOG_WARNING, GTK_STOCK_DIALOG_ERROR, GTK_STOCK_DIALOG_QUESTION }; + static const char flag[] = { 8, 4, 8, 2 }; char *message = g_markup_printf_escaped ("<i>%s</i>", msg); ssize_t l = strlen (message) - 4; @@ -127,6 +142,7 @@ free (stmt); se_store_text (type[report->flags & 3], text); free (text); + se_js_icon (flag[report->flags & 3]); } int se_eval_ext (se_t *se, const gchar *script, se_o_t *obj, @@ -368,7 +384,10 @@ if (GTK_WIDGET_VISIBLE (se_window)) gtk_widget_hide (se_window); else + { window_show (se_window, NULL); + se_prop_set_int (gse, js_icon_obj, "v", 0); + } *rval = JSVAL_VOID; return JS_TRUE; @@ -1072,7 +1091,6 @@ v.s = p->value = strdup (value); p->se_type = SE_TYPE_STRING; se_prop_listeners (se, o, p, v); -printf("set property %s to %s\n", id, value); } else se_prop_create (se, o, id, value, NULL, 0, SE_TYPE_STRING, FALSE); @@ -1192,7 +1210,6 @@ default:; } } -printf("get property %s, value %p %s\n", id,p->value,p->value); return p->value; } @@ -1797,6 +1814,9 @@ se_prop_create (se, event_obj, "stream_end", "", NULL, 0, SE_TYPE_STRING, FALSE); + js_icon_obj = se_create_object (se, NULL, "__js", NULL, SE_GROUP_HIDDEN, NULL); + se_prop_create_int (se, js_icon_obj, "v", 0, TRUE); + return se; } |