diff options
author | Tim Janik <timj@gimp.org> | 1998-03-08 02:04:26 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-03-08 02:04:26 +0000 |
commit | 76d01a826ca213bcd1b7ee71acdf687de9c9d7f0 (patch) | |
tree | 541c170d68302211c261ca92fcaa7af7d0af557a | |
parent | 2395ed082603df688b4cb06ac8c51a44148ff414 (diff) | |
download | gtk+-76d01a826ca213bcd1b7ee71acdf687de9c9d7f0.tar.gz |
define the version variables in config.h.
Sun Mar 8 03:00:17 1998 Tim Janik <timj@gimp.org>
* configure.in: define the version variables in config.h.
* gtk/gtkmain.h:
* gtk/gtkmain.c: added static version variables.
* gdk/gdkpixmap.c: fixed memory leaks (gtk-gronlund-980307-1.patch.gz)
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 9 | ||||
-rw-r--r-- | acconfig.h | 5 | ||||
-rw-r--r-- | config.h.in | 5 | ||||
-rw-r--r-- | configure.in | 5 | ||||
-rw-r--r-- | gdk/gdk.c | 2 | ||||
-rw-r--r-- | gdk/gdkpixmap.c | 24 | ||||
-rw-r--r-- | gdk/x11/gdkmain-x11.c | 2 | ||||
-rw-r--r-- | gdk/x11/gdkpixmap-x11.c | 24 | ||||
-rw-r--r-- | gtk/gtkmain.c | 5 | ||||
-rw-r--r-- | gtk/gtkmain.h | 5 | ||||
-rw-r--r-- | gtk/testgtk.c | 18 | ||||
-rw-r--r-- | tests/testgtk.c | 18 |
18 files changed, 150 insertions, 26 deletions
@@ -1,3 +1,12 @@ +Sun Mar 8 03:00:17 1998 Tim Janik <timj@gimp.org> + + * configure.in: define the version variables in config.h. + + * gtk/gtkmain.h: + * gtk/gtkmain.c: added static version variables. + + * gdk/gdkpixmap.c: fixed memory leaks (gtk-gronlund-980307-1.patch.gz) + Sat Mar 7 18:46:57 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkpreview.[ch]: Added a new function, gtk_preview_reset(), diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 5df4cb0989..2ff2e688b4 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +Sun Mar 8 03:00:17 1998 Tim Janik <timj@gimp.org> + + * configure.in: define the version variables in config.h. + + * gtk/gtkmain.h: + * gtk/gtkmain.c: added static version variables. + + * gdk/gdkpixmap.c: fixed memory leaks (gtk-gronlund-980307-1.patch.gz) + Sat Mar 7 18:46:57 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkpreview.[ch]: Added a new function, gtk_preview_reset(), diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 5df4cb0989..2ff2e688b4 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +Sun Mar 8 03:00:17 1998 Tim Janik <timj@gimp.org> + + * configure.in: define the version variables in config.h. + + * gtk/gtkmain.h: + * gtk/gtkmain.c: added static version variables. + + * gdk/gdkpixmap.c: fixed memory leaks (gtk-gronlund-980307-1.patch.gz) + Sat Mar 7 18:46:57 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkpreview.[ch]: Added a new function, gtk_preview_reset(), diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 5df4cb0989..2ff2e688b4 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +Sun Mar 8 03:00:17 1998 Tim Janik <timj@gimp.org> + + * configure.in: define the version variables in config.h. + + * gtk/gtkmain.h: + * gtk/gtkmain.c: added static version variables. + + * gdk/gdkpixmap.c: fixed memory leaks (gtk-gronlund-980307-1.patch.gz) + Sat Mar 7 18:46:57 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkpreview.[ch]: Added a new function, gtk_preview_reset(), diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 5df4cb0989..2ff2e688b4 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +Sun Mar 8 03:00:17 1998 Tim Janik <timj@gimp.org> + + * configure.in: define the version variables in config.h. + + * gtk/gtkmain.h: + * gtk/gtkmain.c: added static version variables. + + * gdk/gdkpixmap.c: fixed memory leaks (gtk-gronlund-980307-1.patch.gz) + Sat Mar 7 18:46:57 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkpreview.[ch]: Added a new function, gtk_preview_reset(), diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 5df4cb0989..2ff2e688b4 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +Sun Mar 8 03:00:17 1998 Tim Janik <timj@gimp.org> + + * configure.in: define the version variables in config.h. + + * gtk/gtkmain.h: + * gtk/gtkmain.c: added static version variables. + + * gdk/gdkpixmap.c: fixed memory leaks (gtk-gronlund-980307-1.patch.gz) + Sat Mar 7 18:46:57 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkpreview.[ch]: Added a new function, gtk_preview_reset(), diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 5df4cb0989..2ff2e688b4 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +Sun Mar 8 03:00:17 1998 Tim Janik <timj@gimp.org> + + * configure.in: define the version variables in config.h. + + * gtk/gtkmain.h: + * gtk/gtkmain.c: added static version variables. + + * gdk/gdkpixmap.c: fixed memory leaks (gtk-gronlund-980307-1.patch.gz) + Sat Mar 7 18:46:57 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkpreview.[ch]: Added a new function, gtk_preview_reset(), diff --git a/acconfig.h b/acconfig.h index be2cb542cd..f4393880cc 100644 --- a/acconfig.h +++ b/acconfig.h @@ -31,6 +31,11 @@ #undef XINPUT_GXI #undef XINPUT_XFREE +#undef GTK_MAJOR_VERSION +#undef GTK_MINOR_VERSION +#undef GTK_MICRO_VERSION +#undef GTK_VERSION + /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE diff --git a/config.h.in b/config.h.in index 082633f17d..952f070cc5 100644 --- a/config.h.in +++ b/config.h.in @@ -35,6 +35,11 @@ #undef XINPUT_GXI #undef XINPUT_XFREE +#undef GTK_MAJOR_VERSION +#undef GTK_MINOR_VERSION +#undef GTK_MICRO_VERSION +#undef GTK_VERSION + /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE diff --git a/configure.in b/configure.in index db95e1a5c6..3c89a871f2 100644 --- a/configure.in +++ b/configure.in @@ -84,6 +84,11 @@ if test "x$enable_xim" = "xyes"; then CFLAGS="$CFLAGS -DUSE_XIM" fi +AC_DEFINE_UNQUOTED(GTK_MAJOR_VERSION, $GTK_MAJOR_VERSION) +AC_DEFINE_UNQUOTED(GTK_MINOR_VERSION, $GTK_MINOR_VERSION) +AC_DEFINE_UNQUOTED(GTK_MICRO_VERSION, $GTK_MICRO_VERSION) +AC_DEFINE_UNQUOTED(GTK_VERSION, "$GTK_VERSION") + # Find the X11 include and library directories AC_PATH_X AC_PATH_XTRA @@ -270,7 +270,7 @@ gdk_init (int *argc, int argc_orig = *argc; char **argv_orig; - argv_orig = malloc ((argc_orig + 1) * sizeof (char*)); + argv_orig = g_malloc ((argc_orig + 1) * sizeof (char*)); for (i = 0; i < argc_orig; i++) argv_orig[i] = g_strdup ((*argv)[i]); argv_orig[argc_orig] = NULL; diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index ab131e6aca..81adacc41a 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -320,8 +320,7 @@ gdk_pixmap_extract_color (gchar *buffer) return NULL; else if (ptr[0] == '#') { - retcol = g_new(gchar, strlen (ptr) + 1); - strcpy (retcol, ptr); + retcol = g_strdup (ptr); return retcol; } @@ -346,8 +345,7 @@ gdk_pixmap_extract_color (gchar *buffer) } } - retcol = g_new(gchar, strlen (color) + 1); - strcpy (retcol, color); + retcol = g_strdup (color); return retcol; } @@ -366,7 +364,7 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, GdkGC *gc; GdkColor tmp_color; gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt; - gchar *buffer = NULL, *color_name = NULL, pixel_str[32]; + gchar *buffer = NULL, pixel_str[32]; guint buffer_size = 0; _GdkPixmapColor *colors = NULL, *color = NULL; gulong index; @@ -399,6 +397,8 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, for (cnt = 0; cnt < num_cols; cnt++) { + gchar *color_name; + gdk_pixmap_seek_char (infile, '"'); fseek (infile, -1, SEEK_CUR); gdk_pixmap_read_string (infile, &buffer, &buffer_size); @@ -409,9 +409,6 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, colors[cnt].color_string[n] = 0; colors[cnt].transparent = FALSE; - if (color_name != NULL) - g_free (color_name); - color_name = gdk_pixmap_extract_color (&buffer[cpp]); if (color_name != NULL) @@ -428,6 +425,8 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, colors[cnt].transparent = TRUE; } + g_free (color_name); + gdk_color_alloc (colormap, &colors[cnt].color); } @@ -527,7 +526,7 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, GdkGC *gc; GdkColor tmp_color; gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt, i; - gchar *buffer, *color_name = NULL, pixel_str[32]; + gchar *buffer, pixel_str[32]; _GdkPixmapColor *colors = NULL, *color = NULL; gulong index; @@ -550,6 +549,8 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, for (cnt = 0; cnt < num_cols; cnt++) { + gchar *color_name; + buffer = data[i++]; colors[cnt].color_string = g_new(gchar, cpp + 1); @@ -558,9 +559,6 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, colors[cnt].color_string[n] = 0; colors[cnt].transparent = FALSE; - if (color_name != NULL) - g_free (color_name); - color_name = gdk_pixmap_extract_color (&buffer[cpp]); if (color_name != NULL) @@ -577,6 +575,8 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, colors[cnt].transparent = TRUE; } + g_free (color_name); + gdk_color_alloc (colormap, &colors[cnt].color); } diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index b778d3d795..5e6b436fb8 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -270,7 +270,7 @@ gdk_init (int *argc, int argc_orig = *argc; char **argv_orig; - argv_orig = malloc ((argc_orig + 1) * sizeof (char*)); + argv_orig = g_malloc ((argc_orig + 1) * sizeof (char*)); for (i = 0; i < argc_orig; i++) argv_orig[i] = g_strdup ((*argv)[i]); argv_orig[argc_orig] = NULL; diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c index ab131e6aca..81adacc41a 100644 --- a/gdk/x11/gdkpixmap-x11.c +++ b/gdk/x11/gdkpixmap-x11.c @@ -320,8 +320,7 @@ gdk_pixmap_extract_color (gchar *buffer) return NULL; else if (ptr[0] == '#') { - retcol = g_new(gchar, strlen (ptr) + 1); - strcpy (retcol, ptr); + retcol = g_strdup (ptr); return retcol; } @@ -346,8 +345,7 @@ gdk_pixmap_extract_color (gchar *buffer) } } - retcol = g_new(gchar, strlen (color) + 1); - strcpy (retcol, color); + retcol = g_strdup (color); return retcol; } @@ -366,7 +364,7 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, GdkGC *gc; GdkColor tmp_color; gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt; - gchar *buffer = NULL, *color_name = NULL, pixel_str[32]; + gchar *buffer = NULL, pixel_str[32]; guint buffer_size = 0; _GdkPixmapColor *colors = NULL, *color = NULL; gulong index; @@ -399,6 +397,8 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, for (cnt = 0; cnt < num_cols; cnt++) { + gchar *color_name; + gdk_pixmap_seek_char (infile, '"'); fseek (infile, -1, SEEK_CUR); gdk_pixmap_read_string (infile, &buffer, &buffer_size); @@ -409,9 +409,6 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, colors[cnt].color_string[n] = 0; colors[cnt].transparent = FALSE; - if (color_name != NULL) - g_free (color_name); - color_name = gdk_pixmap_extract_color (&buffer[cpp]); if (color_name != NULL) @@ -428,6 +425,8 @@ gdk_pixmap_create_from_xpm (GdkWindow *window, colors[cnt].transparent = TRUE; } + g_free (color_name); + gdk_color_alloc (colormap, &colors[cnt].color); } @@ -527,7 +526,7 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, GdkGC *gc; GdkColor tmp_color; gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt, i; - gchar *buffer, *color_name = NULL, pixel_str[32]; + gchar *buffer, pixel_str[32]; _GdkPixmapColor *colors = NULL, *color = NULL; gulong index; @@ -550,6 +549,8 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, for (cnt = 0; cnt < num_cols; cnt++) { + gchar *color_name; + buffer = data[i++]; colors[cnt].color_string = g_new(gchar, cpp + 1); @@ -558,9 +559,6 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, colors[cnt].color_string[n] = 0; colors[cnt].transparent = FALSE; - if (color_name != NULL) - g_free (color_name); - color_name = gdk_pixmap_extract_color (&buffer[cpp]); if (color_name != NULL) @@ -577,6 +575,8 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window, colors[cnt].transparent = TRUE; } + g_free (color_name); + gdk_color_alloc (colormap, &colors[cnt].color); } diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 3dc5645cd4..25de9353f0 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -32,6 +32,7 @@ #include "gtkwidget.h" #include "gtkwindow.h" #include "gtkprivate.h" +#include "../config.h" /* Private type definitions @@ -119,6 +120,10 @@ static gint gtk_idle_compare (gpointer a, static gint gtk_timeout_compare (gpointer a, gpointer b); +const guint gtk_major_version = GTK_MAJOR_VERSION; +const guint gtk_minor_version = GTK_MINOR_VERSION; +const guint gtk_micro_version = GTK_MICRO_VERSION; + static gboolean iteration_done = FALSE; static guint main_level = 0; static gint initialized = FALSE; diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h index ef8597c1d7..d87ff8030c 100644 --- a/gtk/gtkmain.h +++ b/gtk/gtkmain.h @@ -36,6 +36,11 @@ typedef gint (*GtkKeySnoopFunc) (GtkWidget *grab_widget, GdkEventKey *event, gpointer func_data); +/* Gtk version. + */ +extern const guint gtk_major_version; +extern const guint gtk_minor_version; +extern const guint gtk_micro_version; /* Initialization, exit, mainloop and miscellaneous routines */ diff --git a/gtk/testgtk.c b/gtk/testgtk.c index 4978c6d1e3..4859fcc595 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -5267,6 +5267,8 @@ create_main_window () GtkWidget *box2; GtkWidget *scrolled_window; GtkWidget *button; + GtkWidget *label; + gchar buffer[64]; GtkWidget *separator; int i; @@ -5286,6 +5288,22 @@ create_main_window () gtk_container_add (GTK_CONTAINER (window), box1); gtk_widget_show (box1); + if (gtk_micro_version > 0) + sprintf (buffer, + "Gtk+ v%d.%d.%d", + gtk_major_version, + gtk_minor_version, + gtk_micro_version); + else + sprintf (buffer, + "Gtk+ v%d.%d", + gtk_major_version, + gtk_minor_version); + + label = gtk_label_new (buffer); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0); + scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_container_border_width (GTK_CONTAINER (scrolled_window), 10); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), diff --git a/tests/testgtk.c b/tests/testgtk.c index 4978c6d1e3..4859fcc595 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -5267,6 +5267,8 @@ create_main_window () GtkWidget *box2; GtkWidget *scrolled_window; GtkWidget *button; + GtkWidget *label; + gchar buffer[64]; GtkWidget *separator; int i; @@ -5286,6 +5288,22 @@ create_main_window () gtk_container_add (GTK_CONTAINER (window), box1); gtk_widget_show (box1); + if (gtk_micro_version > 0) + sprintf (buffer, + "Gtk+ v%d.%d.%d", + gtk_major_version, + gtk_minor_version, + gtk_micro_version); + else + sprintf (buffer, + "Gtk+ v%d.%d", + gtk_major_version, + gtk_minor_version); + + label = gtk_label_new (buffer); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0); + scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_container_border_width (GTK_CONTAINER (scrolled_window), 10); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), |