Skip to content

Commit

Permalink
Major update since last commit
Browse files Browse the repository at this point in the history
Makefile - used to make the project
todo.c - The core of the project, written in C.
todo.glade - GTK glade specification (not used actively)
todo2.glade - GTK glade specification (actively used - at present)
  • Loading branch information
mrerrormessage committed Apr 5, 2011
1 parent 801838d commit 39586e7
Show file tree
Hide file tree
Showing 4 changed files with 413 additions and 4 deletions.
7 changes: 7 additions & 0 deletions Makefile
@@ -0,0 +1,7 @@
CC=gcc
CFLAGS=-Wall -g
GTKFLAGS=$(pkg-config --cflags --libs gtk+-2.0 gmodule-2.0)


all:
$(CC) `pkg-config --cflags --libs gtk+-2.0` $(CFLAGS) -o todo todo.c
66 changes: 66 additions & 0 deletions todo.c
@@ -0,0 +1,66 @@
//code by Robert Grider
//Mar 11, 2010

#include <gtk/gtk.h>
#include <stdlib.h>


struct todo_item{
GtkCheckButton * button;
char * description;
struct todo_item * next;
};

struct todo_state{
GtkTextBuffer * buf;
GtkButton * addButton;
struct todo_item * first;
};


void on_add_item( GtkWidget * addbutton, gpointer data);
void on_item_complete( GtkWidget * checkbutton, gpointer data);
void add_new_task( struct todo_state * ts, char * description);
struct todo_state* init_todo_state();
struct todo_item * init_todo_item( char * desc );


int main( int argc, char ** argv){

GtkBuilder * builder;
GtkWidget * window;
GtkWidget * button;
GtkTextBuffer * buf;

GError * error = NULL;

//initializations
gtk_init( &argc, &argv);
builder = gtk_builder_new();

if( ! gtk_builder_add_from_file(builder, "todo2.glade", &error) ){
g_warning( "%s", error->message);
g_free( error );
return(1);
}


//get objects here and put them in the todo structure
window = GTK_WIDGET ( gtk_builder_get_object(builder, "window1" ) );

//connect the signals here



//after signals connected
gtk_builder_connect_signals( builder, NULL );

//destroy builder
g_object_unref( G_OBJECT( builder ) );

//show and run
gtk_widget_show( window );
gtk_main();

return( 0 );
}
34 changes: 30 additions & 4 deletions todo.glade
Expand Up @@ -3,6 +3,8 @@
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="window1">
<property name="width_request">500</property>
<property name="height_request">300</property>
<child>
<object class="GtkVPaned" id="vpaned1">
<property name="visible">True</property>
Expand Down Expand Up @@ -151,7 +153,7 @@
<property name="orientation">vertical</property>
<child>
<object class="GtkVBox" id="vbox2">
<property name="height_request">30</property>
<property name="height_request">73</property>
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
Expand All @@ -160,24 +162,29 @@
<property name="label" translatable="yes">To-Do:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry1">
<property name="height_request">26</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
<property name="caps_lock_warning">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0.9100000262260437</property>
<property name="xalign">0.89999997615814209</property>
<property name="xscale">0.5</property>
<child>
<object class="GtkButton" id="button1">
Expand All @@ -195,6 +202,7 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
Expand All @@ -210,11 +218,12 @@
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="yscale">0</property>
<property name="bottom_padding">40</property>
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkCheckButton" id="checkbutton1">
<property name="label" translatable="yes">checkbutton</property>
Expand All @@ -226,11 +235,28 @@
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">2</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
<object class="GtkCheckButton" id="checkbutton2">
<property name="label" translatable="yes">checkbutton</property>
<property name="height_request">40</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="image_position">right</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">2</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
Expand Down

0 comments on commit 39586e7

Please sign in to comment.