From 1c6ec5cbe91bc82d4bb1c9fc876cf844170f4ff6 Mon Sep 17 00:00:00 2001 From: perry Date: Mon, 10 Mar 2008 14:43:02 +0000 Subject: [PATCH] Ticket #62: Implementando tratamento de sessoes no gnome. --- src/Makefile.linux | 4 ++-- src/actions.c | 8 ++++++-- src/main.c | 23 +++++++++++++++++++---- src/menu.c | 6 +++--- src/toolbar.c | 20 ++++++++++---------- 5 files changed, 40 insertions(+), 21 deletions(-) diff --git a/src/Makefile.linux b/src/Makefile.linux index 0f40f11..34e8f66 100644 --- a/src/Makefile.linux +++ b/src/Makefile.linux @@ -9,8 +9,8 @@ RELEASE_OBJECTS=$(foreach SRC, $(basename $(SOURCES)), obj/Release/src/$(SRC).$( obj/Debug/src/%.$(OBJEXT): src/%.c Makefile src/*.h src/*.mak @echo $< ... @mkdir -p `dirname $@` -# -DG_ERRORCHECK_MUTEXES - @$(CC) -DDEBUG=1 -DG3270_CORE $(CFLAGS) -I./src -ggdb -o $@ -c $< +# -DG_ERRORCHECK_MUTEXES + @$(CC) -DDEBUG=1 -DG3270_CORE -DG_ERRORCHECK_MUTEXES $(CFLAGS) -I./src -ggdb -o $@ -c $< obj/Release/src/%.$(OBJEXT): src/%.c Makefile src/*.h src/*.mak @echo $< ... diff --git a/src/actions.c b/src/actions.c index cc750bc..140e66f 100644 --- a/src/actions.c +++ b/src/actions.c @@ -615,8 +615,12 @@ "name", "g3270", "authors", authors, "license", license, -// "logo", icon, - "comments", _("3270 Terminal emulator for Gnome/GTK.\nBuild " BUILD), + "logo", icon, +#ifdef USE_GNOME + "comments", _("3270 Terminal emulator for Gnome.\nBuild " BUILD), +#else + "comments", _("3270 Terminal emulator for GTK.\nBuild " BUILD), +#endif #ifdef VERSION "version", VERSION, #endif diff --git a/src/main.c b/src/main.c index 6abcf30..a9a8ca7 100644 --- a/src/main.c +++ b/src/main.c @@ -399,6 +399,10 @@ static gint session_die(GnomeClient* client, gpointer client_data) int main(int argc, char **argv) { +#ifdef USE_GNOME + GnomeProgram *program; + GOptionContext *context; +#endif printf(PROJECT_NAME " Build " BUILD "\n"); fflush(stdout); @@ -415,13 +419,24 @@ static gint session_die(GnomeClient* client, gpointer client_data) #ifdef USE_GNOME - gnome_init(PROJECT_NAME, PROJECT_VERSION, argc, argv); + context = g_option_context_new (_("- 3270 Emulator for Gnome")); + + program = gnome_program_init ( PROJECT_NAME, + PROJECT_VERSION, + LIBGNOMEUI_MODULE, argc, argv, + GNOME_PARAM_GOPTION_CONTEXT, context, + GNOME_PARAM_HUMAN_READABLE_NAME, + _("3270 Emulator"), + NULL + ); + CHKPoint(); client = gnome_master_client(); DBGPrintf("Gnome: %p",client); - gtk_signal_connect(GTK_OBJECT (client), "save_yourself", GTK_SIGNAL_FUNC(save_session), argv[0]); - gtk_signal_connect(GTK_OBJECT (client), "die", GTK_SIGNAL_FUNC(session_die), NULL); + gtk_signal_connect(GTK_OBJECT(client), "save_yourself", GTK_SIGNAL_FUNC(save_session), argv[0]); + gtk_signal_connect(GTK_OBJECT(client), "die", GTK_SIGNAL_FUNC(session_die), NULL); DBGMessage("Gnome session setup finished"); + CHKPoint(); #else @@ -442,7 +457,7 @@ static gint session_die(GnomeClient* client, gpointer client_data) if(!cl_hostname) cl_hostname = getenv("HOST3270_0"); - DBGMessage(cl_hostname); +// DBGMessage(cl_hostname); CreateMainWindow(cl_hostname); if(terminal) diff --git a/src/menu.c b/src/menu.c index 5317d32..1d4dcd9 100644 --- a/src/menu.c +++ b/src/menu.c @@ -64,7 +64,7 @@ data->entry.item_type = g_strdup(key); - DBGPrintf("Type: %s item_type: %s",type,key); +// DBGPrintf("Type: %s item_type: %s",type,key); } @@ -77,7 +77,7 @@ { if(string) { - DBGPrintf("Releasing \"%s\"",(char *) string); +// DBGPrintf("Releasing \"%s\"",(char *) string); g_free(string); } } @@ -98,7 +98,7 @@ if(!item->entry.callback && item->toggle) Action(item,"toggle"); - DBGPrintf("%p %s %p %s",(void *) item->entry.callback_action,item->entry.path,item->entry.callback,item->toggle ? "Toggle" : ""); +// DBGPrintf("%p %s %p %s",(void *) item->entry.callback_action,item->entry.path,item->entry.callback,item->toggle ? "Toggle" : ""); gtk_item_factory_create_item( factory, (GtkItemFactoryEntry *) &item->entry, diff --git a/src/toolbar.c b/src/toolbar.c index e7b90ac..2696170 100644 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -34,17 +34,17 @@ static void SetObjectParameter(GObject *obj, const char *name, const char *string) { DBGPrintf("Allocating \"%s\"",string); - g_object_set_data_full(obj,name,g_strdup((char *) string),ReleaseString); + g_object_set_data_full(obj,name,g_strdup((char *) string),ReleaseString); } static void ProcessDefinition(PARAMETER *prm, GObject * (*proc)(PARAMETER *p, void *data), void *data) { GObject *obj; - + if(!prm->item) return; - DBGPrintf("%s=%p",prm->item,prm->action); +// DBGPrintf("%s=%p",prm->item,prm->action); obj = proc(prm,data); @@ -56,7 +56,7 @@ } free(prm->item); - + memset(prm,0,sizeof(PARAMETER)); } @@ -123,7 +123,7 @@ { "script", Parm }, { "command", Parm }, { "option", Parm } - + }; char buffer[1024]; @@ -162,13 +162,13 @@ ptr = strchr(ln,'='); if(ptr) { - DBGMessage(ln); +// DBGMessage(ln); *ptr++ = 0; for(f=0;f< (sizeof(cmd)/sizeof(struct _cmd));f++) { if(!strcmp(cmd[f].key,ln)) { - DBGPrintf("%s set to %s in (%s)",ln,ptr,parm.item); +// DBGPrintf("%s set to %s in (%s)",ln,ptr,parm.item); cmd[f].exec(&parm,ptr); } } @@ -182,7 +182,7 @@ } #ifdef __GTK_TOOL_ITEM_H__ - + static GObject *AddToolbar(PARAMETER *p, GtkWidget *toolbar) { GtkToolItem *item = 0; @@ -202,7 +202,7 @@ if(item) gtk_toolbar_insert(GTK_TOOLBAR(toolbar),GTK_TOOL_ITEM(item),-1); - + return G_OBJECT(item); } #endif @@ -219,7 +219,7 @@ FILE *in = fopen(filename,"r"); DBGPrintf("%s: %p",filename,in); - + if(!in) return 0; -- libgit2 0.21.2