Commit 1c6ec5cbe91bc82d4bb1c9fc876cf844170f4ff6

Authored by perry
1 parent dff90b4a
Exists in master

Ticket #62: Implementando tratamento de sessoes no gnome.

src/Makefile.linux
@@ -9,8 +9,8 @@ RELEASE_OBJECTS=$(foreach SRC, $(basename $(SOURCES)), obj/Release/src/$(SRC).$( @@ -9,8 +9,8 @@ RELEASE_OBJECTS=$(foreach SRC, $(basename $(SOURCES)), obj/Release/src/$(SRC).$(
9 obj/Debug/src/%.$(OBJEXT): src/%.c Makefile src/*.h src/*.mak 9 obj/Debug/src/%.$(OBJEXT): src/%.c Makefile src/*.h src/*.mak
10 @echo $< ... 10 @echo $< ...
11 @mkdir -p `dirname $@` 11 @mkdir -p `dirname $@`
12 -# -DG_ERRORCHECK_MUTEXES  
13 - @$(CC) -DDEBUG=1 -DG3270_CORE $(CFLAGS) -I./src -ggdb -o $@ -c $< 12 +# -DG_ERRORCHECK_MUTEXES
  13 + @$(CC) -DDEBUG=1 -DG3270_CORE -DG_ERRORCHECK_MUTEXES $(CFLAGS) -I./src -ggdb -o $@ -c $<
14 14
15 obj/Release/src/%.$(OBJEXT): src/%.c Makefile src/*.h src/*.mak 15 obj/Release/src/%.$(OBJEXT): src/%.c Makefile src/*.h src/*.mak
16 @echo $< ... 16 @echo $< ...
@@ -615,8 +615,12 @@ @@ -615,8 +615,12 @@
615 "name", "g3270", 615 "name", "g3270",
616 "authors", authors, 616 "authors", authors,
617 "license", license, 617 "license", license,
618 -// "logo", icon,  
619 - "comments", _("3270 Terminal emulator for Gnome/GTK.\nBuild " BUILD), 618 + "logo", icon,
  619 +#ifdef USE_GNOME
  620 + "comments", _("3270 Terminal emulator for Gnome.\nBuild " BUILD),
  621 +#else
  622 + "comments", _("3270 Terminal emulator for GTK.\nBuild " BUILD),
  623 +#endif
620 #ifdef VERSION 624 #ifdef VERSION
621 "version", VERSION, 625 "version", VERSION,
622 #endif 626 #endif
@@ -399,6 +399,10 @@ static gint session_die(GnomeClient* client, gpointer client_data) @@ -399,6 +399,10 @@ static gint session_die(GnomeClient* client, gpointer client_data)
399 399
400 int main(int argc, char **argv) 400 int main(int argc, char **argv)
401 { 401 {
  402 +#ifdef USE_GNOME
  403 + GnomeProgram *program;
  404 + GOptionContext *context;
  405 +#endif
402 406
403 printf(PROJECT_NAME " Build " BUILD "\n"); 407 printf(PROJECT_NAME " Build " BUILD "\n");
404 fflush(stdout); 408 fflush(stdout);
@@ -415,13 +419,24 @@ static gint session_die(GnomeClient* client, gpointer client_data) @@ -415,13 +419,24 @@ static gint session_die(GnomeClient* client, gpointer client_data)
415 419
416 #ifdef USE_GNOME 420 #ifdef USE_GNOME
417 421
418 - gnome_init(PROJECT_NAME, PROJECT_VERSION, argc, argv); 422 + context = g_option_context_new (_("- 3270 Emulator for Gnome"));
  423 +
  424 + program = gnome_program_init ( PROJECT_NAME,
  425 + PROJECT_VERSION,
  426 + LIBGNOMEUI_MODULE, argc, argv,
  427 + GNOME_PARAM_GOPTION_CONTEXT, context,
  428 + GNOME_PARAM_HUMAN_READABLE_NAME,
  429 + _("3270 Emulator"),
  430 + NULL
  431 + );
419 432
  433 + CHKPoint();
420 client = gnome_master_client(); 434 client = gnome_master_client();
421 DBGPrintf("Gnome: %p",client); 435 DBGPrintf("Gnome: %p",client);
422 - gtk_signal_connect(GTK_OBJECT (client), "save_yourself", GTK_SIGNAL_FUNC(save_session), argv[0]);  
423 - gtk_signal_connect(GTK_OBJECT (client), "die", GTK_SIGNAL_FUNC(session_die), NULL); 436 + gtk_signal_connect(GTK_OBJECT(client), "save_yourself", GTK_SIGNAL_FUNC(save_session), argv[0]);
  437 + gtk_signal_connect(GTK_OBJECT(client), "die", GTK_SIGNAL_FUNC(session_die), NULL);
424 DBGMessage("Gnome session setup finished"); 438 DBGMessage("Gnome session setup finished");
  439 + CHKPoint();
425 440
426 #else 441 #else
427 442
@@ -442,7 +457,7 @@ static gint session_die(GnomeClient* client, gpointer client_data) @@ -442,7 +457,7 @@ static gint session_die(GnomeClient* client, gpointer client_data)
442 if(!cl_hostname) 457 if(!cl_hostname)
443 cl_hostname = getenv("HOST3270_0"); 458 cl_hostname = getenv("HOST3270_0");
444 459
445 - DBGMessage(cl_hostname); 460 +// DBGMessage(cl_hostname);
446 CreateMainWindow(cl_hostname); 461 CreateMainWindow(cl_hostname);
447 462
448 if(terminal) 463 if(terminal)
@@ -64,7 +64,7 @@ @@ -64,7 +64,7 @@
64 64
65 data->entry.item_type = g_strdup(key); 65 data->entry.item_type = g_strdup(key);
66 66
67 - DBGPrintf("Type: %s item_type: %s",type,key); 67 +// DBGPrintf("Type: %s item_type: %s",type,key);
68 68
69 } 69 }
70 70
@@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
77 { 77 {
78 if(string) 78 if(string)
79 { 79 {
80 - DBGPrintf("Releasing \"%s\"",(char *) string); 80 +// DBGPrintf("Releasing \"%s\"",(char *) string);
81 g_free(string); 81 g_free(string);
82 } 82 }
83 } 83 }
@@ -98,7 +98,7 @@ @@ -98,7 +98,7 @@
98 if(!item->entry.callback && item->toggle) 98 if(!item->entry.callback && item->toggle)
99 Action(item,"toggle"); 99 Action(item,"toggle");
100 100
101 - DBGPrintf("%p %s %p %s",(void *) item->entry.callback_action,item->entry.path,item->entry.callback,item->toggle ? "Toggle" : ""); 101 +// DBGPrintf("%p %s %p %s",(void *) item->entry.callback_action,item->entry.path,item->entry.callback,item->toggle ? "Toggle" : "");
102 102
103 gtk_item_factory_create_item( factory, 103 gtk_item_factory_create_item( factory,
104 (GtkItemFactoryEntry *) &item->entry, 104 (GtkItemFactoryEntry *) &item->entry,
@@ -34,17 +34,17 @@ @@ -34,17 +34,17 @@
34 static void SetObjectParameter(GObject *obj, const char *name, const char *string) 34 static void SetObjectParameter(GObject *obj, const char *name, const char *string)
35 { 35 {
36 DBGPrintf("Allocating \"%s\"",string); 36 DBGPrintf("Allocating \"%s\"",string);
37 - g_object_set_data_full(obj,name,g_strdup((char *) string),ReleaseString); 37 + g_object_set_data_full(obj,name,g_strdup((char *) string),ReleaseString);
38 } 38 }
39 39
40 static void ProcessDefinition(PARAMETER *prm, GObject * (*proc)(PARAMETER *p, void *data), void *data) 40 static void ProcessDefinition(PARAMETER *prm, GObject * (*proc)(PARAMETER *p, void *data), void *data)
41 { 41 {
42 GObject *obj; 42 GObject *obj;
43 - 43 +
44 if(!prm->item) 44 if(!prm->item)
45 return; 45 return;
46 46
47 - DBGPrintf("%s=%p",prm->item,prm->action); 47 +// DBGPrintf("%s=%p",prm->item,prm->action);
48 48
49 obj = proc(prm,data); 49 obj = proc(prm,data);
50 50
@@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
56 } 56 }
57 57
58 free(prm->item); 58 free(prm->item);
59 - 59 +
60 memset(prm,0,sizeof(PARAMETER)); 60 memset(prm,0,sizeof(PARAMETER));
61 } 61 }
62 62
@@ -123,7 +123,7 @@ @@ -123,7 +123,7 @@
123 { "script", Parm }, 123 { "script", Parm },
124 { "command", Parm }, 124 { "command", Parm },
125 { "option", Parm } 125 { "option", Parm }
126 - 126 +
127 }; 127 };
128 128
129 char buffer[1024]; 129 char buffer[1024];
@@ -162,13 +162,13 @@ @@ -162,13 +162,13 @@
162 ptr = strchr(ln,'='); 162 ptr = strchr(ln,'=');
163 if(ptr) 163 if(ptr)
164 { 164 {
165 - DBGMessage(ln); 165 +// DBGMessage(ln);
166 *ptr++ = 0; 166 *ptr++ = 0;
167 for(f=0;f< (sizeof(cmd)/sizeof(struct _cmd));f++) 167 for(f=0;f< (sizeof(cmd)/sizeof(struct _cmd));f++)
168 { 168 {
169 if(!strcmp(cmd[f].key,ln)) 169 if(!strcmp(cmd[f].key,ln))
170 { 170 {
171 - DBGPrintf("%s set to %s in (%s)",ln,ptr,parm.item); 171 +// DBGPrintf("%s set to %s in (%s)",ln,ptr,parm.item);
172 cmd[f].exec(&parm,ptr); 172 cmd[f].exec(&parm,ptr);
173 } 173 }
174 } 174 }
@@ -182,7 +182,7 @@ @@ -182,7 +182,7 @@
182 } 182 }
183 183
184 #ifdef __GTK_TOOL_ITEM_H__ 184 #ifdef __GTK_TOOL_ITEM_H__
185 - 185 +
186 static GObject *AddToolbar(PARAMETER *p, GtkWidget *toolbar) 186 static GObject *AddToolbar(PARAMETER *p, GtkWidget *toolbar)
187 { 187 {
188 GtkToolItem *item = 0; 188 GtkToolItem *item = 0;
@@ -202,7 +202,7 @@ @@ -202,7 +202,7 @@
202 202
203 if(item) 203 if(item)
204 gtk_toolbar_insert(GTK_TOOLBAR(toolbar),GTK_TOOL_ITEM(item),-1); 204 gtk_toolbar_insert(GTK_TOOLBAR(toolbar),GTK_TOOL_ITEM(item),-1);
205 - 205 +
206 return G_OBJECT(item); 206 return G_OBJECT(item);
207 } 207 }
208 #endif 208 #endif
@@ -219,7 +219,7 @@ @@ -219,7 +219,7 @@
219 FILE *in = fopen(filename,"r"); 219 FILE *in = fopen(filename,"r");
220 220
221 DBGPrintf("%s: %p",filename,in); 221 DBGPrintf("%s: %p",filename,in);
222 - 222 +
223 if(!in) 223 if(!in)
224 return 0; 224 return 0;
225 225