Skip to content

Commit

Permalink
Added tabs.h, tabs.c for eventual module-tab data structure, added fi…
Browse files Browse the repository at this point in the history
…le-menu.h and file-menu.c and modified makefile so no linking errors! Also did some stuff in main.c and menus.c that is not quite working yet.

git-svn-id: https://subversion.cs.uiuc.edu/svn/bang/eoh2009@153 69d76c3e-0761-0410-948c-9895a8bb34fc
  • Loading branch information
asjacob2 committed Mar 12, 2009
1 parent fd195ee commit fa12e98
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 3 deletions.
36 changes: 36 additions & 0 deletions src/app/file-menu.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include"bang-machine-utils.h"
#include"../base/bang.h"
#include<gtk/gtk.h>
#include<stdlib.h>

void BMACHINE_open_module(GtkWidget *widget) {

GtkWidget *dialog = gtk_file_chooser_dialog_new ("Open a Multiplicity module",widget,GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);

if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
{
char *filename;

filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
// do some stuff with filename
g_free (filename);
}

gtk_widget_destroy (dialog);


}
/*
void BMACHINE_close_module(GtkWidget *widget) {
}*/

/* Shut down Multiplicity */
void BMACHINE_exit() {
BANG_close();
gtk_main_quit();
}
7 changes: 7 additions & 0 deletions src/app/file-menu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef __FILE_MENU_H
#define __FILE_MENU_H
#include<gtk/gtk.h>
void BMACHINE_open_module(GtkWidget *widget);
//void BMACHINE_close_module(GtkWidget *widget);
void BMACHINE_exit();
#endif
5 changes: 4 additions & 1 deletion src/app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include"preferences.h"
#include"statusbar.h"
#include"server-menu.h"
#include"file-menu.h"
#include"tabs.h"
#include<locale.h>
#include<stdio.h>
Expand All @@ -59,6 +60,7 @@ static GtkWidget *window;
static GtkWidget *vbox;
static GtkWidget *notebook;
static GtkWidget *peers_page_label;
static GtkWidget *peers_page_body;

/**
* GTK callback when the window is about to be deleted, does not to be locked as that comes
Expand Down Expand Up @@ -110,7 +112,8 @@ int main(int argc, char **argv) {
notebook = gtk_notebook_new();

peers_page_label = gtk_label_new("Peers");
/* gtk_notebook_append_page(GTK_NOTEBOOK(notebook),peers_page_label,peers_page_label); */
peers_page_body = gtk_label_new("Your peers here!");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook),peers_page_label,peers_page_body);


gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook),TRUE);
Expand Down
5 changes: 3 additions & 2 deletions src/app/menus.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#include"server-menu.h"
#include"file-menu.h"
#include<gtk/gtk.h>
#include<stdio.h>

static const GtkActionEntry entries[] =
{
{ "FileMenuAction", NULL, "_File", "", "Access external files relevant to this program.", NULL },
{ "OpenModuleAction", GTK_STOCK_OPEN, "_Open Module", "<control>o", "Open a module.", NULL },
{ "OpenModuleAction", GTK_STOCK_OPEN, "_Open Module", "<control>o", "Open a module.", G_CALLBACK(BMACHINE_open_module) },
{ "CloseModuleAction", GTK_STOCK_CLOSE, "C_lose Module", "<control>l", "Close a module.", NULL },
{ "ExitAction", GTK_STOCK_QUIT, "E_xit", "<control>x", "Exit the program.", NULL },
{ "ExitAction", GTK_STOCK_QUIT, "E_xit", "<control>x", "Exit the program.", G_CALLBACK(BMACHINE_exit) },

{ "EditMenuAction", NULL, "_Edit", "", "Edit functionality.", NULL },
{ "EditPreferencesAction", GTK_STOCK_PREFERENCES, "_Edit Prefrences", "<control>e", "Edit your prefrences.", NULL },
Expand Down
Empty file added src/app/tabs.c
Empty file.
7 changes: 7 additions & 0 deletions src/app/tabs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef __SERVER_MENU_H
#define __SERVER_MENU_H
#include<glib.h>
#include<gtk/gtk.h>

void BMACHINE_open_module
#endif

0 comments on commit fa12e98

Please sign in to comment.