00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00026
00027
00028
00029
00030
00031 #include <liberipc/eripc.h>
00032 #include <liberipc/eripcviewer.h>
00033 #include <liberipc/eripcbusyd.h>
00034 #include <liberipc/eripccontentlister.h>
00035 #include "browserTypes.h"
00036 #include "contentLister.h"
00037 #include "browserLog.h"
00038 #include "mozilla_api.h"
00039
00040 static erClientChannel_t contentListerChannel;
00041
00042 static void contentlister_store_item_location(int category, char *item, char *location);
00043
00044 void contentlister_init()
00045 {
00046 BR_IPCPRINTF("entry");
00047 erIpcStartClient(ER_CONTENTLISTER_CHANNEL, &contentListerChannel);
00048 }
00049
00050
00051 void contentlister_request(erIpcCmd_t command, Ereader * browser)
00052 {
00053 char *item = NULL;
00054 int category;
00055 char *location = NULL;
00056 int index;
00057
00058 BR_IPCPRINTF("command %d", command.cc);
00059
00060 switch (command.cc)
00061 {
00062 case ccVwrStore:
00063 BR_IPCPRINTF("STORE - nArg %d", command.nArg);
00064
00065 if (command.nArg == 3)
00066 {
00067 for (index = 0; index < command.nArg; index++)
00068 {
00069 BR_IPCPRINTF("command.arg[%d]=%s", index, command.arg[index]);
00070 }
00071
00072 category = atoi(command.arg[1]);
00073 item = command.arg[2];
00074
00075 if ((browser) && (browser->mozEmbed))
00076 {
00077 BR_IPCPRINTF("gtk_moz_embed_get_location");
00078 location = gtk_moz_embed_get_location(GTK_MOZ_EMBED(browser->mozEmbed));
00079
00080 if (location)
00081 {
00082 BR_IPCPRINTF("category=%d item=%s location=%s", category, item, location);
00083 contentlister_store_item_location(category, item, location);
00084
00085 g_free(location);
00086 }
00087 }
00088 }
00089 else
00090 {
00091 BR_WARNPRINTF("ccVwrStore invalid argument count %d", command.nArg);
00092 }
00093 break;
00094 default:
00095 BR_IPCPRINTF("UNHANDLED COMMAND %d", command.cc);
00096 break;
00097 }
00098 return;
00099 }
00100
00110 void contentlister_store_item_location(int category, char *item, char *location)
00111 {
00112 BR_IPCPRINTF("clStore");
00113 clStore(contentListerChannel, ER_XHTML_VIEWER_UA_ID, category, item, location);
00114 }