Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <gtk/gtk.h>
- #include <stdio.h>
- #include <string.h>
- #include <time.h>
- void create_window(int , char **);
- int load_file(void);
- void usage(char *);
- void rm_file(char *);
- void save_note(gchar *);
- struct date_t carga_fecha(void);
- struct date_t {
- int day, mon, year, hor, min;
- };
- int main(int argc, char **argv) {
- if(argc < 2) {
- usage(argv[0]);
- exit(1);
- } else {
- //If there are at least one argument, continue, else, close the app.
- if(strcmp(argv[1],"-d") == 0) {
- } else if(strcmp(argv[1],"-n") == 0) {
- //If there's chossen the new note option, create a GTK dialog to create it.
- create_window(argc, argv);
- } else if(strcmp(argv[1], "-r") == 0) {
- } else {
- usage(argv[0]);
- exit(1);
- }
- }
- return 0;
- }
- void usage(char *s) {
- /**
- * Shows the app usage
- */
- printf("[USAGE] %s [-d|-n|-r] <note> <-g --user=Username --pass=Password --note=note>\n\t-d: Display the most recent notes by the stdout\n\t-n: Create a GTK+ dialog for create the note\n\t-r: If provided remove the notes, else display the notes for chosing which note are going to be removed",s);
- }
- void save_note(gchar *note) {
- /**
- * Saves the note in the file descriptor provided by load_file()
- */
- int file;
- }
- int load_file(void) {
- /**
- * Returns a file descriptor of the file, if the file doesn't exist create it. The file name is: dd-mm-yyyy-hh-mm.note.
- */
- char *file_name;
- struct date_t current_date;
- }
- struct date_t load_date(void) {
- /**
- * Returns a struct with all the information about current date (day, month, year, hour and minute).
- */
- struct date_t current_date;
- long int time_ms = time(0); // Takes the time in miliseconds since 1970.
- }
- void create_window(int argc, char **argv) {
- /**
- * Creates a GTK+ dialog for editing the note
- */
- GtkWidget *window, *save_button, *text_box, *container;
- gtk_init(&argc, &argv);
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title((GtkWindow *) window, "Notes");
- gtk_window_set_default_size((GtkWindow *) window, 300,160);
- g_signal_connect((GObject *) window, "delete-event", (GCallback) gtk_main_quit, NULL);
- save_button = gtk_button_new_with_label("Save");
- g_signal_connect((GObject *) save_button, "clicked", (GCallback) save_note, NULL /*By the way*/);
- container = gtk_vbox_new(FALSE, 1);
- text_box = gtk_text_new(NULL, NULL);
- gtk_text_set_editable((GtkText *) text_box, TRUE);
- gtk_box_pack_start((GtkBox *) container, text_box, FALSE, FALSE, 0);
- gtk_box_pack_start((GtkBox *) container, save_button, FALSE, FALSE, 0);
- gtk_container_add((GtkContainer *) window, container);
- gtk_widget_show_all(window);
- gtk_main();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement