From: <ale...@us...> - 2003-11-03 00:34:48
|
Update of /cvsroot/morphix/datetimeconf/src In directory sc8-pr-cvs1:/tmp/cvs-serv5939/src Modified Files: main.c main.h Log Message: some datetime cleanups Index: main.c =================================================================== RCS file: /cvsroot/morphix/datetimeconf/src/main.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** main.c 28 Oct 2003 01:49:06 -0000 1.4 --- main.c 3 Nov 2003 00:34:45 -0000 1.5 *************** *** 62,65 **** --- 62,85 ---- ntp_changed = FALSE; utc_changed = FALSE; + timezone_map_loc = NULL; + cross_green_loc = NULL; + cross_red_loc = NULL; + + gint length = strlen(PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps/map480.png"); + timezone_map_loc = (gchar *)malloc(length + 1); + strcpy(timezone_map_loc,PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps/map480.png"); + length = strlen(PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps/cross-green.png"); + cross_green_loc = (gchar *)malloc(length +1); + strcpy(cross_green_loc,PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps/cross-green.png"); + + length = strlen(PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps/cross-red.png"); + cross_red_loc = (gchar *)malloc(length +1); + strcpy(cross_red_loc,PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps/cross-red.png"); + if (timezone_map_loc == NULL || + cross_green_loc == NULL || + cross_red_loc == NULL) { + debug("Can't find pixmaps in %s\n",PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps"); + exit(1); + } } *************** *** 114,117 **** --- 134,140 ---- int quit_conf() { free_zone_info(); + free(timezone_map_loc); + free(cross_green_loc); + free(cross_red_loc); exit(0); } *************** *** 238,250 **** GError *err = NULL; GtkWidget *drawarea = lookup_widget(MainWindow,"drawingarea1"); ! GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(TIMEZONE_MAP,&err); if (pixbuf == NULL) { ! debug("Error: %s\n",err->message); ! err = NULL; ! GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(TIMEZONE_MAP_2,&err); ! if (pixbuf == NULL) { ! return FALSE; ! } } gtk_widget_show_all(drawarea); --- 261,268 ---- GError *err = NULL; GtkWidget *drawarea = lookup_widget(MainWindow,"drawingarea1"); ! GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(timezone_map_loc,&err); if (pixbuf == NULL) { ! return FALSE; } gtk_widget_show_all(drawarea); *************** *** 269,278 **** gboolean draw_cross(int x, int y) { GtkWidget *drawarea = lookup_widget(MainWindow,"drawingarea1"); ! GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(CROSS_GREEN,NULL); if (pixbuf == NULL) { ! GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(CROSS_GREEN_2,NULL); ! if (pixbuf == NULL) { ! return FALSE; ! } } gdk_draw_pixbuf(drawarea->window, --- 287,293 ---- gboolean draw_cross(int x, int y) { GtkWidget *drawarea = lookup_widget(MainWindow,"drawingarea1"); ! GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(cross_green_loc,NULL); if (pixbuf == NULL) { ! return FALSE; } gdk_draw_pixbuf(drawarea->window, *************** *** 291,300 **** gboolean draw_red_cross(int x, int y) { GtkWidget *drawarea = lookup_widget(MainWindow,"drawingarea1"); ! GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(CROSS_RED,NULL); if (pixbuf == NULL) { ! GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(CROSS_RED_2,NULL); ! if (pixbuf == NULL) { ! return FALSE; ! } } gdk_draw_pixbuf(drawarea->window, --- 306,312 ---- gboolean draw_red_cross(int x, int y) { GtkWidget *drawarea = lookup_widget(MainWindow,"drawingarea1"); ! GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(cross_red_loc,NULL); if (pixbuf == NULL) { ! return FALSE; } gdk_draw_pixbuf(drawarea->window, Index: main.h =================================================================== RCS file: /cvsroot/morphix/datetimeconf/src/main.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.h 28 Oct 2003 01:49:06 -0000 1.3 --- main.h 3 Nov 2003 00:34:45 -0000 1.4 *************** *** 8,12 **** #define MAP_HEIGHT 240 #define MAP_WIDTH 480 ! #define TIMEZONE_MAP "../pixmaps/map480.png" #define TIMEZONE_MAP_2 "/usr/share/datetimeconf/pixmaps/map480.png" --- 8,12 ---- #define MAP_HEIGHT 240 #define MAP_WIDTH 480 ! /* #define TIMEZONE_MAP "../pixmaps/map480.png" #define TIMEZONE_MAP_2 "/usr/share/datetimeconf/pixmaps/map480.png" *************** *** 17,21 **** #define CROSS_RED "../pixmaps/cross-red.png" #define CROSS_RED_2 "/usr/share/datetimeconf/pixmaps/cross-red.png" ! #define DEBUG --- 17,21 ---- #define CROSS_RED "../pixmaps/cross-red.png" #define CROSS_RED_2 "/usr/share/datetimeconf/pixmaps/cross-red.png" ! */ #define DEBUG *************** *** 25,28 **** --- 25,32 ---- #define debug (void) #endif + + gchar *timezone_map_loc; + gchar *cross_green_loc + gchar *cross_red_loc; enum { |