From: <kr_...@us...> - 2003-05-01 19:35:41
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv12134/port/src/cbits/GTK Modified Files: Frame.c Internals.h Util.c Window.c Log Message: Added proper initialization for libgnome. Unfortunately the initialization requires that the application name should be constant during program execution. That means that the modified 'start' function should have two additional arguments: the application name and the application version (the latest is also required from libgnome for proper initialization). Index: Frame.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Frame.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Frame.c 26 Apr 2003 21:39:20 -0000 1.7 --- Frame.c 1 May 2003 19:35:36 -0000 1.8 *************** *** 6,9 **** --- 6,10 ---- char *gAppName = NULL; + char *gAppVersion = NULL; GtkWidget *gFrameWidget = NULL; GtkWidget *gClientWidget = NULL; *************** *** 298,301 **** --- 299,303 ---- /* Create the window. */ gFrameWidget = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(gFrameWidget), gAppName); gtk_signal_connect (GTK_OBJECT(gFrameWidget), "delete-event", GTK_SIGNAL_FUNC(frame_delete_handler), *************** *** 324,337 **** gtk_widget_show_all(gFrameWidget); - } - - char *osGetProcessTitle() - { - return gAppName; - } - - void osSetProcessTitle(char *szAppName) - { - gAppName = strdup(szAppName); - updateFrameTitle(); } --- 326,328 ---- Index: Internals.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Internals.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Internals.h 23 Apr 2003 21:58:11 -0000 1.1 --- Internals.h 1 May 2003 19:35:36 -0000 1.2 *************** *** 8,12 **** extern int gDocumentInterface; ! extern char *gAppName, *gWindowName; extern GtkWidget *gFrameWidget; extern GtkWidget *gClientWidget; --- 8,12 ---- extern int gDocumentInterface; ! extern char *gAppName, *gAppVersion, *gWindowName; extern GtkWidget *gFrameWidget; extern GtkWidget *gClientWidget; *************** *** 18,23 **** void createMDIFrame(); void createSDIFrame(); - - void updateFrameTitle(); extern void rfree(void *ptr); --- 18,21 ---- Index: Util.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Util.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Util.c 9 Apr 2003 17:17:42 -0000 1.15 --- Util.c 1 May 2003 19:35:36 -0000 1.16 *************** *** 26,30 **** } ! void osInit(int DocumentInterface) { if (!bInitialized) --- 26,30 ---- } ! void osInit(char *appName, char *appVersion, int DocumentInterface) { if (!bInitialized) *************** *** 35,45 **** gtk_set_locale(); getProgArgv(&margc, &margv); ! gtk_init(&margc,&margv); ! setProgArgv(margc, margv); bInitialized = TRUE; gDocumentInterface = DocumentInterface; - - gAppName = NULL; gFrameWidget = NULL; gClientWidget = NULL; --- 35,45 ---- gtk_set_locale(); getProgArgv(&margc, &margv); ! gnome_program_init(appName, appVersion, LIBGNOMEUI_MODULE, ! margc, margv, GNOME_PARAM_POPT_TABLE, GNOME_PARAM_NONE); bInitialized = TRUE; + gAppName = strdup(appName); + gAppVersion = strdup(appVersion); gDocumentInterface = DocumentInterface; gFrameWidget = NULL; gClientWidget = NULL; *************** *** 112,159 **** return s; }; - - void updateFrameTitle() - { - char *title; - - if (gAppName && *gAppName) - { - if (gDocumentInterface == 2) - { - int index; - GtkWidget *label; - - index = gtk_notebook_get_current_page(GTK_NOTEBOOK(gClientWidget)); - - if (index > 0) - { - label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gClientWidget),gtk_notebook_get_nth_page(GTK_NOTEBOOK(gClientWidget),index)); - gWindowName = gtk_label_get_text(GTK_LABEL(label)); - } - else - { - gWindowName = NULL; - } - } - - if (gWindowName && *gWindowName) - { - title = rmalloc(strlen(gAppName)+strlen(gWindowName)+6); - - if (title) - { - strcpy(title, gAppName); - strcat(title, " - ["); - strcat(title, gWindowName); - strcat(title, "]"); - gtk_window_set_title(GTK_WINDOW(gFrameWidget), title); - } - - rfree(title); - } - else - gtk_window_set_title(GTK_WINDOW(gFrameWidget), gAppName); - } - else - gtk_window_set_title(GTK_WINDOW(gFrameWidget), gWindowName); - } --- 112,113 ---- Index: Window.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Window.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Window.c 27 Apr 2003 18:19:14 -0000 1.16 --- Window.c 1 May 2003 19:35:36 -0000 1.17 *************** *** 525,529 **** { gWindowName = strdup(title); ! updateFrameTitle(); } } --- 525,551 ---- { gWindowName = strdup(title); ! ! if (gAppName && *gAppName) ! { ! if (gWindowName && *gWindowName) ! { ! title = rmalloc(strlen(gAppName)+strlen(gWindowName)+6); ! ! if (title) ! { ! strcpy(title, gAppName); ! strcat(title, " - ["); ! strcat(title, gWindowName); ! strcat(title, "]"); ! gtk_window_set_title(GTK_WINDOW(gFrameWidget), title); ! } ! ! rfree(title); ! } ! else ! gtk_window_set_title(GTK_WINDOW(gFrameWidget), gAppName); ! } ! else ! gtk_window_set_title(GTK_WINDOW(gFrameWidget), gWindowName); } } |