Permalink
Browse files

rdis now has supports for settings configurable via lua

  • Loading branch information...
1 parent 945d73f commit 60087650bf9b6bddc3731961372c4843e7e3a28e @endeav0r committed Mar 22, 2013
Showing with 35 additions and 2 deletions.
  1. +1 −1 src/Makefile
  2. +2 −1 src/gui/rdgwindow.c
  3. +16 −0 src/script/rdis_lua.c
  4. +1 −0 src/script/rdis_lua.h
  5. +5 −0 src/settings.c
  6. +10 −0 src/settings.h
View
@@ -1,4 +1,4 @@
-OBJS=object.o rdg.o rdg_node.o rdis.o serialize.o util.o wqueue.o
+OBJS=object.o rdg.o rdg_node.o rdis.o serialize.o settings.o util.o wqueue.o
CCFLAGS=-Wall -O2 -Werror -g
INCLUDE=`pkg-config --cflags cairo` `pkg-config --cflags gtk+-3.0` \
View
@@ -2,6 +2,7 @@
#include "instruction.h"
#include "queue.h"
+#include "settings.h"
#include "util.h"
#include <string.h>
@@ -266,7 +267,7 @@ gboolean rdgwindow_image_motion_notify_event (GtkWidget * widget,
(unsigned long long) hover_ins);
return FALSE;
}
- if (ins->references->size > 0) {
+ if ((ins->references->size > 0) && (settings.reference_popup)) {
char references_text[512];
strcpy(references_text, "<span background=\"#ffffff\" font_family=\"monospace\" font=\"9.0\">");
struct _list_it * it;
View
@@ -6,6 +6,7 @@
#include "lua.h"
#include "map.h"
#include "rdgwindow.h"
+#include "settings.h"
#include "tree.h"
#include "util.h"
@@ -108,6 +109,7 @@ static const struct luaL_Reg rl_rdis_lib_f [] = {
{"dump_json", rl_rdis_dump_json},
{"rdg", rl_rdis_rdg},
{"redis_x86" , rl_rdis_redis_x86},
+ {"setting", rl_rdis_setting},
{NULL, NULL}
};
@@ -1236,4 +1238,18 @@ int rl_rdis_redis_x86 (lua_State * L)
object_delete(redis_x86);
return 1;
+}
+
+
+int rl_rdis_setting (lua_State * L)
+{
+ const char * setting_name = luaL_checkstring(L, -2);
+ int value = luaL_checkinteger(L, -1);
+
+ lua_pop(L, 2);
+
+ if (strcmp(setting_name, "reference_popup") == 0)
+ settings.reference_popup = value & 1;
+
+ return 0;
}
View
@@ -99,5 +99,6 @@ int rl_rdis_user_function (lua_State * L);
int rl_rdis_dump_json (lua_State * L);
int rl_rdis_rdg (lua_State * L);
int rl_rdis_redis_x86 (lua_State * L);
+int rl_rdis_setting (lua_State * L);
#endif
View
@@ -0,0 +1,5 @@
+#include "settings.h"
+
+struct _settings settings = {
+ 1
+};
View
@@ -0,0 +1,10 @@
+#ifndef settings_HEADER
+#define settings_HEADER
+
+struct _settings {
+ unsigned char reference_popup;
+};
+
+extern struct _settings settings;
+
+#endif

0 comments on commit 6008765

Please sign in to comment.