Mercurial > dwindows
comparison gtk3/dw.c @ 2205:a43a3f80ed32
GTK: Changes to include both dw_(int_)init() functions with deprecated.
This allows binary-wise for both old style resource apps and GResource ones
to function with the same library. Which one is used depends on whether
DW_INCLUDE_DEPRECATED is defined at compile time. Some more thought needs
to be given to whether DW_INCLUDE_DEPRECATED should be included in the
dwindows-config --cflags because apps expecting GResources will fail to
compile with DW_INCLUDE_DEPRECATED defined, due to the dw_init() macro.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 29 Nov 2020 08:31:47 +0000 |
parents | b86ae2abb3b3 |
children | 3343ae3ac327 |
comparison
equal
deleted
inserted
replaced
2204:b86ae2abb3b3 | 2205:a43a3f80ed32 |
---|---|
1922 | 1922 |
1923 static GdkPixbuf *_dw_pixbuf_from_resource(unsigned int rid) | 1923 static GdkPixbuf *_dw_pixbuf_from_resource(unsigned int rid) |
1924 { | 1924 { |
1925 #if GLIB_CHECK_VERSION(2,32,0) | 1925 #if GLIB_CHECK_VERSION(2,32,0) |
1926 char resource_path[201] = {0}; | 1926 char resource_path[201] = {0}; |
1927 snprintf(resource_path, 200, "/org/dbsoft/dwindows/%u", rid); | 1927 snprintf(resource_path, 200, "/org/dbsoft/dwindows/resources/%u.png", rid); |
1928 return gdk_pixbuf_new_from_resource(resource_path, NULL); | 1928 return gdk_pixbuf_new_from_resource(resource_path, NULL); |
1929 #else | 1929 #else |
1930 return NULL; | 1930 return NULL; |
1931 #endif | 1931 #endif |
1932 } | 1932 } |
2000 * quell the warning and can be used at a later point if needed. | 2000 * quell the warning and can be used at a later point if needed. |
2001 */ | 2001 */ |
2002 } | 2002 } |
2003 #endif | 2003 #endif |
2004 | 2004 |
2005 /* | |
2006 * Initializes the Dynamic Windows engine. | |
2007 * Parameters: | |
2008 * newthread: True if this is the only thread. | |
2009 * False if there is already a message loop running. | |
2010 */ | |
2011 #ifdef DW_INCLUDE_DEPRECATED_RESOURCES | 2005 #ifdef DW_INCLUDE_DEPRECATED_RESOURCES |
2006 #undef dw_init | |
2012 int dw_int_init(DWResources *res, int newthread, int *pargc, char **pargv[]) | 2007 int dw_int_init(DWResources *res, int newthread, int *pargc, char **pargv[]) |
2013 { | 2008 { |
2014 int argc = pargc ? *pargc : 0; | 2009 int argc = pargc ? *pargc : 0; |
2015 char **argv = pargv ? *pargv : NULL; | 2010 char **argv = pargv ? *pargv : NULL; |
2016 | 2011 |
2018 { | 2013 { |
2019 _resources.resource_max = res->resource_max; | 2014 _resources.resource_max = res->resource_max; |
2020 _resources.resource_id = res->resource_id; | 2015 _resources.resource_id = res->resource_id; |
2021 _resources.resource_data = res->resource_data; | 2016 _resources.resource_data = res->resource_data; |
2022 } | 2017 } |
2023 #else | 2018 return dw_init(newthread, argc, argv); |
2019 } | |
2020 #endif | |
2021 | |
2022 /* | |
2023 * Initializes the Dynamic Windows engine. | |
2024 * Parameters: | |
2025 * newthread: True if this is the only thread. | |
2026 * False if there is already a message loop running. | |
2027 */ | |
2024 int dw_init(int newthread, int argc, char *argv[]) | 2028 int dw_init(int newthread, int argc, char *argv[]) |
2025 { | 2029 { |
2026 #endif | |
2027 /* Setup the private data directory */ | 2030 /* Setup the private data directory */ |
2028 if(argc > 0 && argv[0]) | 2031 if(argc > 0 && argv[0]) |
2029 { | 2032 { |
2030 char *pathcopy = strdup(argv[0]); | 2033 char *pathcopy = strdup(argv[0]); |
2031 char *pos = strrchr(pathcopy, '/'); | 2034 char *pos = strrchr(pathcopy, '/'); |