64 |
|
|
65 |
static NPNetscapeFuncs browserFunctions; |
static NPNetscapeFuncs browserFunctions; |
66 |
|
|
67 |
|
static GMutex *mutex_appletviewer_process = NULL; |
68 |
static gint send_message_to_appletviewer (gchar const* value); |
static gint send_message_to_appletviewer (gchar const* value); |
69 |
static gint receive_message_from_appletviewer (gchar* string); |
static gint receive_message_from_appletviewer (gchar* string); |
70 |
static gboolean callbackViewerRead (GIOChannel* source, |
static gboolean callbackViewerRead (GIOChannel* source, |
85 |
char *instance_id; |
char *instance_id; |
86 |
}; |
}; |
87 |
|
|
88 |
|
static NPError start_appletviewer_process (void); |
89 |
|
|
90 |
static GIOChannel *output_to_appletviewer = NULL; |
static GIOChannel *output_to_appletviewer = NULL; |
91 |
static GIOChannel *input_from_appletviewer = NULL; |
static GIOChannel *input_from_appletviewer = NULL; |
92 |
|
|
128 |
if (!instance) |
if (!instance) |
129 |
return NPERR_INVALID_INSTANCE_ERROR; |
return NPERR_INVALID_INSTANCE_ERROR; |
130 |
|
|
131 |
|
NPError tmp = NPERR_NO_ERROR; |
132 |
|
|
133 |
|
g_mutex_lock (mutex_appletviewer_process); |
134 |
|
if (! output_to_appletviewer) // Start appletviewer process if necessary. |
135 |
|
tmp = start_appletviewer_process(); |
136 |
|
g_mutex_unlock (mutex_appletviewer_process); |
137 |
|
|
138 |
|
if (tmp != NPERR_NO_ERROR) |
139 |
|
return tmp; |
140 |
|
|
141 |
GCJPluginData* data = NULL; |
GCJPluginData* data = NULL; |
142 |
|
|
143 |
gcjplugindata_new (&data); |
gcjplugindata_new (&data); |
514 |
pluginTable->urlnotify = NewNPP_URLNotifyProc(GCJ_URLNotify); |
pluginTable->urlnotify = NewNPP_URLNotifyProc(GCJ_URLNotify); |
515 |
pluginTable->getvalue = NewNPP_GetValueProc(GCJ_GetValue); |
pluginTable->getvalue = NewNPP_GetValueProc(GCJ_GetValue); |
516 |
|
|
517 |
|
mutex_appletviewer_process = g_mutex_new (); |
518 |
|
|
519 |
|
return NPERR_NO_ERROR; |
520 |
|
} |
521 |
|
|
522 |
|
static NPError |
523 |
|
start_appletviewer_process(void) |
524 |
|
{ |
525 |
|
|
526 |
// Add install prefix to PATH. |
// Add install prefix to PATH. |
527 |
char *searchpath = getenv("PATH"); |
char *searchpath = getenv("PATH"); |
528 |
char *newpath = NULL; |
char *newpath = NULL; |
555 |
g_printerr ("GCJ_New: Error: %s\n", strerror (errno)); |
g_printerr ("GCJ_New: Error: %s\n", strerror (errno)); |
556 |
return NPERR_GENERIC_ERROR; |
return NPERR_GENERIC_ERROR; |
557 |
} |
} |
|
|
|
558 |
GError *err = NULL; |
GError *err = NULL; |
559 |
gchar *command_line [3] = { |
gchar *command_line [3] = { |
560 |
GCJAPPLETVIEWER_EXECUTABLE, |
GCJAPPLETVIEWER_EXECUTABLE, |