summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bf28b56)
raw | patch | inline | side by side (parent: bf28b56)
author | Kalle Wallin <kaw@linux.se> | |
Mon, 19 Apr 2004 22:10:13 +0000 (22:10 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Mon, 19 Apr 2004 22:10:13 +0000 (22:10 +0000) |
command.c | patch | blob | history | |
conf.c | patch | blob | history | |
list_window.c | patch | blob | history | |
main.c | patch | blob | history | |
options.c | patch | blob | history | |
screen_utils.c | patch | blob | history | |
support.c | patch | blob | history |
diff --git a/command.c b/command.c
index 15ebd502afc8f54bba5b23ccfbba76cd8c9dcdb2..75dd75ee938d313b1194a1ccdc85d7a4e783c744 100644 (file)
--- a/command.c
+++ b/command.c
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
{ { DWN, '.', 0 }, CMD_LIST_NEXT, "down",
"Move cursor down" },
{ { HOME, 0x01, 0 }, CMD_LIST_FIRST, "home",
- "Home" },
+ "Home " },
{ { END, 0x05, 0 }, CMD_LIST_LAST, "end",
- "End" },
+ "End " },
{ { PGUP, 'A', 0 }, CMD_LIST_PREVIOUS_PAGE, "pgup",
"Page up" },
{ { PGDN, 'B', 0 }, CMD_LIST_NEXT_PAGE, "pgdn",
"Browse screen" },
{ {'u', 0, 0 }, CMD_SCREEN_UPDATE, "update",
"Update screen" },
+#ifdef ENABLE_KEYDEF_SCREEN
+ { {'K', 0, 0 }, CMD_SCREEN_KEYDEF, "screen-keyedit",
+ "Key edit screen" },
+#endif
{ { 'q', 0, 0 }, CMD_QUIT, "quit",
"Quit " PACKAGE },
{ { -1, -1, -1 }, CMD_NONE, NULL, NULL }
};
+command_definition_t *
+get_command_definitions(void)
+{
+ return cmds;
+}
+
char *
key2str(int key)
{
- static char buf[2];
+ static char buf[4];
+ int i;
buf[0] = 0;
switch(key)
return "Shift+Tab";
case ESC:
return "Esc";
- case F1:
- return "F1";
- case F2:
- return "F2";
- case F3:
- return "F3";
- case F4:
- return "F4";
- case F5:
- return "F5";
- case F6:
- return "F6";
+ case KEY_IC:
+ return "Insert";
default:
- snprintf(buf, 2, "%c", key);
+ for(i=0; i<=63; i++)
+ if( key==KEY_F(i) )
+ {
+ snprintf(buf, 4, "F%d", i );
+ return buf;
+ }
+ snprintf(buf, 4, "%c", key);
}
return buf;
}
return CMD_NONE;
}
+
command_t
-get_key_command(int key)
+find_key_command(int key, command_definition_t *cmds)
{
int i;
i=0;
- while( cmds[i].name )
+ while( cmds && cmds[i].name )
{
if( cmds[i].keys[0] == key ||
cmds[i].keys[1] == key ||
return CMD_NONE;
}
+command_t
+get_key_command(int key)
+{
+ return find_key_command(key, cmds);
+}
+
command_t
get_keyboard_command(void)
index a8deb89a3b07d14dd3d7b06de4c4162b7e3000e4..0c0448ed4e9f9200774796ae24332607b4dd371c 100644 (file)
--- a/conf.c
+++ b/conf.c
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <ctype.h>
#include <stdio.h>
#include <errno.h>
return 0;
}
+int
+check_user_conf_dir(void)
+{
+ int retval;
+ char *dirname = g_build_filename(g_get_home_dir(), "." PACKAGE, NULL);
+
+ if( g_file_test(dirname, G_FILE_TEST_IS_DIR) )
+ {
+ g_free(dirname);
+ return 0;
+ }
+ retval = mkdir(dirname, 0755);
+ g_free(dirname);
+ return retval;
+}
+
+char *
+get_user_key_binding_filename(void)
+{
+ return g_build_filename(g_get_home_dir(), "." PACKAGE, "keys", NULL);
+}
+
int
read_configuration(options_t *options)
}
/* check for user key bindings ~/.ncmpc/keys */
- filename = g_build_filename(g_get_home_dir(), "." PACKAGE, "keys", NULL);
+ filename = get_user_key_binding_filename();
if( !g_file_test(filename, G_FILE_TEST_IS_REGULAR) )
{
g_free(filename);
read_rc_file(filename, options);
g_free(filename);
filename = NULL;
- //write_key_bindings(stderr);
}
return 0;
diff --git a/list_window.c b/list_window.c
index 5a07f603fd5910551dae1f7cec94aed7cbc9e8ee..fcb25ca314490faa58f98b590086a4ab54d1f535 100644 (file)
--- a/list_window.c
+++ b/list_window.c
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
index cfa1151d996410ecdfd765031edddf103c45aae7..07a623b8da2549ee124d6a2e38dfeca686e0ec5f 100644 (file)
--- a/main.c
+++ b/main.c
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/options.c b/options.c
index 81f67bd87d4e4ee81b6bf5cfd688e8bc54ed8a70..16a61ece08e7cdd81973c19cef70f54ae89b7d1b 100644 (file)
--- a/options.c
+++ b/options.c
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/screen_utils.c b/screen_utils.c
index b93069c22959259324ef8adc04aa95ab4906fb20..c9fff74c4b2fe776b5a1b84cf9ae47ec393aad4d 100644 (file)
--- a/screen_utils.c
+++ b/screen_utils.c
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
diff --git a/support.c b/support.c
index 564fd9b83825d19246d8b53f8d07741062ab6f96..d292e846234a746e16ce90df31034b903dcba969 100644 (file)
--- a/support.c
+++ b/support.c
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>