comparison gtk/dw.c @ 590:2111cdb6c451

Updates to the GtkMozEmbed code.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 24 May 2005 21:09:37 +0000
parents 1b398af1ec38
children 98a667881e44
comparison
equal deleted inserted replaced
589:bb439280ece2 590:2111cdb6c451
1875 } 1875 }
1876 1876
1877 /* Try to load the mozilla embed shared libary */ 1877 /* Try to load the mozilla embed shared libary */
1878 #ifdef USE_GTKMOZEMBED 1878 #ifdef USE_GTKMOZEMBED
1879 #include <ctype.h> 1879 #include <ctype.h>
1880
1881 static char _dw_mozdir[1024];
1882
1880 void init_mozembed(void) 1883 void init_mozembed(void)
1881 { 1884 {
1882 void *handle = NULL; 1885 void *handle = NULL;
1883 FILE *fp = popen("pkg-config --libs-only-L mozilla-gtkmozembed", "r"); 1886 FILE *fp = popen("pkg-config --libs-only-L mozilla-gtkmozembed", "r");
1884 char output[1024];
1885 1887
1886 /* First we try to get the correct location 1888 /* First we try to get the correct location
1887 * from pkg-config. 1889 * from pkg-config.
1888 */ 1890 */
1889 if(fp) 1891 if(fp)
1890 { 1892 {
1891 fgets(output, 1024, fp); 1893 fgets(_dw_mozdir, 1024, fp);
1892 1894
1893 printf("Output: %s\n", output); 1895 if(_dw_mozdir[0] == '-' && _dw_mozdir[1] == 'L')
1894 if(output[0] == '-' && output[1] == 'L') 1896 {
1895 { 1897 int x, len = strlen(_dw_mozdir);
1896 int x, len = strlen(output);
1897 1898
1898 for(x=len;x>0;x--) 1899 for(x=len;x>0;x--)
1899 { 1900 {
1900 if(!isalpha(output[x]) && !isnumber(output[x]) && output[x] != '/') 1901 if(!isalpha(_dw_mozdir[x]) && !isnumber(_dw_mozdir[x]) && _dw_mozdir[x] != '/')
1901 output[x] = 0; 1902 _dw_mozdir[x] = 0;
1902 } 1903 }
1903 strncat(output, "/libgtkembedmoz.so", 1024); 1904 strncat(_dw_mozdir, "/libgtkembedmoz.so", 1024);
1904 handle = dlopen(&output[2], RTLD_NOW); 1905 handle = dlopen(&_dw_mozdir[2], RTLD_NOW);
1905 if(!handle)
1906 printf("Output: %s Error: %s\n", &output[2], dlerror());
1907 } 1906 }
1908 fclose(fp); 1907 fclose(fp);
1909 } 1908 }
1910 /* Try the default path */ 1909 /* Try the default path */
1911 if(!handle) 1910 if(!handle)
1912 handle = dlopen("libgtkembedmoz.so", RTLD_NOW); 1911 {
1912 strncpy(_dw_mozdir, "libgtkembedmoz.so", 1024);
1913 handle = dlopen(_dw_mozdir, RTLD_NOW);
1914 }
1913 /* Finally try some common locations */ 1915 /* Finally try some common locations */
1914 if(!handle) 1916 if(!handle)
1915 handle = dlopen("/usr/X11R6/lib/mozilla/libgtkembedmoz.so", RTLD_NOW); 1917 {
1918 strncpy(_dw_mozdir, "/usr/X11R6/lib/mozilla/libgtkembedmoz.so", 1024);
1919 handle = dlopen(_dw_mozdir, RTLD_NOW);
1920 }
1916 if(!handle) 1921 if(!handle)
1917 handle = dlopen("/usr/lib/mozilla/libgtkembedmoz.so", RTLD_NOW); 1922 {
1923 strncpy(_dw_mozdir, "/usr/lib/mozilla/libgtkembedmoz.so", 1024);
1924 handle = dlopen(_dw_mozdir, RTLD_NOW);
1925 }
1918 if(!handle) 1926 if(!handle)
1919 handle = dlopen("/usr/local/lib/mozilla/libgtkembedmoz.so", RTLD_NOW); 1927 {
1928 strncpy(_dw_mozdir, "/usr/local/lib/mozilla/libgtkembedmoz.so", 1024);
1929 handle = dlopen(_dw_mozdir, RTLD_NOW);
1930 }
1920 1931
1921 /* If we loaded it, grab the symbols we want */ 1932 /* If we loaded it, grab the symbols we want */
1922 if(handle) 1933 if(handle)
1923 { 1934 {
1924 _gtk_moz_embed_go_back = dlsym(handle, "gtk_moz_embed_go_back"); 1935 _gtk_moz_embed_go_back = dlsym(handle, "gtk_moz_embed_go_back");
1928 _gtk_moz_embed_stop_load = dlsym(handle, "gtk_moz_embed_stop_load"); 1939 _gtk_moz_embed_stop_load = dlsym(handle, "gtk_moz_embed_stop_load");
1929 _gtk_moz_embed_render_data = dlsym(handle, "gtk_moz_embed_render_data"); 1940 _gtk_moz_embed_render_data = dlsym(handle, "gtk_moz_embed_render_data");
1930 _dw_moz_embed_get_type = dlsym(handle, "gtk_moz_embed_get_type"); 1941 _dw_moz_embed_get_type = dlsym(handle, "gtk_moz_embed_get_type");
1931 _gtk_moz_embed_new = dlsym(handle, "gtk_moz_embed_new"); 1942 _gtk_moz_embed_new = dlsym(handle, "gtk_moz_embed_new");
1932 } 1943 }
1944 else
1945 _dw_mozdir[0] = 0;
1933 } 1946 }
1934 #endif 1947 #endif
1935 1948
1936 /* 1949 /*
1937 * Initializes the Dynamic Windows engine. 1950 * Initializes the Dynamic Windows engine.
8090 box = tmp; 8103 box = tmp;
8091 8104
8092 if(!item) 8105 if(!item)
8093 { 8106 {
8094 item = gtk_label_new(""); 8107 item = gtk_label_new("");
8095 gtk_widget_show(item); 8108 gtk_widget_show_all(item);
8096 } 8109 }
8097 8110
8098 tmpitem = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_boxhandle"); 8111 tmpitem = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_boxhandle");
8099 8112
8100 if(GTK_IS_TABLE(box)) 8113 if(GTK_IS_TABLE(box))
9394 box = tmp; 9407 box = tmp;
9395 9408
9396 if(!item) 9409 if(!item)
9397 { 9410 {
9398 item = gtk_label_new(""); 9411 item = gtk_label_new("");
9399 gtk_widget_show(item); 9412 gtk_widget_show_all(item);
9400 } 9413 }
9401 9414
9402 tmpitem = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_boxhandle"); 9415 tmpitem = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_boxhandle");
9403 9416
9404 if(GTK_IS_TABLE(box)) 9417 if(GTK_IS_TABLE(box))