X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkmodules.c;h=5a15925993be61c7849cf524090b0515b43c4174;hb=45ad8a06ad511ad95a74172172b9fe459bc666ad;hp=57765256bb60575ba32d6c1f0089113895de40aa;hpb=52711beba57239aadde460d49d492ef6951f9335;p=~andy%2Fgtk diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c index 57765256b..5a1592599 100644 --- a/gtk/gtkmodules.c +++ b/gtk/gtkmodules.c @@ -13,9 +13,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * License along with this library. If not, see . */ #include "config.h" @@ -25,8 +23,8 @@ #include "gtkmodules.h" #include "gtksettings.h" #include "gtkdebug.h" -#include "gtkprivate.h" /* GTK_LIBDIR */ -#include "gtkmainprivate.h" +#include "gtkprivate.h" +#include "gtkmodulesprivate.h" #include "gtkintl.h" #include @@ -55,8 +53,6 @@ get_module_path (void) { const gchar *module_path_env; const gchar *exe_prefix; - const gchar *home_dir; - gchar *home_gtk_dir = NULL; gchar *module_path; gchar *default_dir; static gchar **result = NULL; @@ -64,32 +60,21 @@ get_module_path (void) if (result) return result; - home_dir = g_get_home_dir(); - if (home_dir) - home_gtk_dir = g_build_filename (home_dir, ".gtk-3.0", NULL); - module_path_env = g_getenv ("GTK_PATH"); exe_prefix = g_getenv ("GTK_EXE_PREFIX"); if (exe_prefix) default_dir = g_build_filename (exe_prefix, "lib", "gtk-3.0", NULL); else - default_dir = g_build_filename (GTK_LIBDIR, "gtk-3.0", NULL); + default_dir = g_build_filename (_gtk_get_libdir (), "gtk-3.0", NULL); - if (module_path_env && home_gtk_dir) - module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S, - module_path_env, home_gtk_dir, default_dir, NULL); - else if (module_path_env) + if (module_path_env) module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S, module_path_env, default_dir, NULL); - else if (home_gtk_dir) - module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S, - home_gtk_dir, default_dir, NULL); else module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S, default_dir, NULL); - g_free (home_gtk_dir); g_free (default_dir); result = pango_split_file_list (module_path); @@ -259,11 +244,15 @@ cmp_module (GtkModuleInfo *info, } static gboolean -module_is_blacklisted (const gchar *name) +module_is_blacklisted (const gchar *name, + gboolean verbose) { - if (g_str_equal (name, "gail")) + if (g_str_equal (name, "gail") || + g_str_equal (name, "atk-bridge")) { - g_message ("Not loading module \"gail\": The functionality is provided by GTK natively. Please try to not load it."); + if (verbose) + g_message ("Not loading module \"%s\": The functionality is provided by GTK natively. Please try to not load it.", name); + return TRUE; } @@ -292,7 +281,9 @@ load_module (GSList *module_list, info->ref_count++; success = TRUE; + break; } + info = NULL; } if (!success) @@ -303,7 +294,7 @@ load_module (GSList *module_list, { /* Do the check this late so we only warn about existing modules, * not old modules that are still in the modules path. */ - if (module_is_blacklisted (name)) + if (module_is_blacklisted (name, TRUE)) { modinit_func = NULL; success = TRUE; @@ -374,7 +365,7 @@ load_module (GSList *module_list, } } - if (success) + if (success && info) { if (!g_slist_find (module_list, info)) { @@ -383,10 +374,13 @@ load_module (GSList *module_list, } else { - const gchar *error = g_module_error (); + if (!module_is_blacklisted (name, FALSE)) + { + const gchar *error = g_module_error (); - g_message ("Failed to load module \"%s\"%s%s", - name, error ? ": " : "", error ? error : ""); + g_message ("Failed to load module \"%s\"%s%s", + name, error ? ": " : "", error ? error : ""); + } } return module_list; @@ -502,7 +496,7 @@ display_opened_cb (GdkDisplayManager *display_manager, for (i = 0; i < gdk_display_get_n_screens (display); i++) { - GValue value = { 0, }; + GValue value = G_VALUE_INIT; g_value_init (&value, G_TYPE_STRING); @@ -590,3 +584,29 @@ _gtk_modules_settings_changed (GtkSettings *settings, new_modules, settings_destroy_notify); } + +/* Return TRUE if module_to_check causes version conflicts. + * If module_to_check is NULL, check the main module. + */ +gboolean +_gtk_module_has_mixed_deps (GModule *module_to_check) +{ + GModule *module; + gpointer func; + gboolean result; + + if (!module_to_check) + module = g_module_open (NULL, 0); + else + module = module_to_check; + + if (g_module_symbol (module, "gtk_progress_get_type", &func)) + result = TRUE; + else + result = FALSE; + + if (!module_to_check) + g_module_close (module); + + return result; +}