diff options
author | b0ric <b0risov.alexandr@rambler.ru> | 2009-08-03 15:59:50 +0300 |
---|---|---|
committer | b0ric <b0risov.alexandr@rambler.ru> | 2009-08-03 15:59:50 +0300 |
commit | 89f0dd1c94c08e6f6d972c23dff1a5e40ba5d0e5 (patch) | |
tree | b05524a9c21701d4c32dba9848a6799a82de272a /main.c | |
parent | 1d7ffa606ae1a0bbf3539c6eb592bc37c370effd (diff) |
WordExtract GUI prototype
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 38 |
1 files changed, 22 insertions, 16 deletions
@@ -17,9 +17,11 @@ */ #include <sys/stat.h> +#include <gtk/gtk.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "interface.h" #include "dict.h" #include "word.h" #include "subtitle.h" @@ -35,21 +37,14 @@ void create_dict_file(char *path); int main(int argc, char *argv[]) { + GtkWidget *main_window; FILE *subtitle; FILE *fdict; char optpath[PATH_LENGTH] = {0}; char dictfile[PATH_LENGTH] = {0}; - if (argc == 2) { - if (!(subtitle = fopen(argv[1], "r"))) { - perror(argv[1]); - exit(1); - } - } - else { - printf("Usage: %s <subtitle filename>\n", argv[0]); - exit(1); - } + gtk_init(&argc, &argv); + strcpy(optpath, getenv("HOME")); strcat(optpath, OPT_FOLDER); strcat(dictfile, optpath); @@ -63,12 +58,23 @@ int main(int argc, char *argv[]) } } dict = load_dict(fdict); + lang = ENG; + + main_window = create_main_window(); + gtk_widget_show(main_window); + + /*main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(main_window), "WordExtract"); + gtk_window_set_default_size(GTK_WINDOW(main_window), 800, 600); + gtk_window_set_position(GTK_WINDOW(main_window), GTK_WIN_POS_CENTER); + gtk_widget_show(main_window);*/ + + gtk_main(); //TODO: process subtitle extension to detect format - lang = ENG; - process_srt(subtitle); - print_words(words); - fclose(subtitle); + //process_srt(subtitle); + //print_words(words); + //fclose(subtitle); free_words(dict); fclose(fdict); return 0; @@ -82,7 +88,7 @@ void create_dict_file(char *path) char file[PATH_LENGTH] = {0}; if (stat(path, &st)) { - fprintf(stdout, "%s: Creating directory\n", path); + fprintf(stderr, "%s: Creating directory\n", path); if (mkdir(path, mode_0755)) { perror(path); exit(1); @@ -90,7 +96,7 @@ void create_dict_file(char *path) } strcat(file, path); strcat(file, DICT_FILE); - fprintf(stdout, "%s: Creating blank dictionary file\n", file); + fprintf(stderr, "%s: Creating blank dictionary file\n", file); if (!(fdict = fopen(file, "w"))) { perror(file); exit(1); |