GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Oct 30, 2014 2:27 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Using GTK+ 2.x and GTK+ 3 in the same process is not support
PostPosted: Mon Sep 24, 2012 6:50 pm 
Offline
Familiar Face

Joined: Sat Mar 03, 2012 2:45 am
Posts: 18
Hello All,

I am receiving error "Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported" when trying to run the code below. I have googled the error and all i am seeing is remove the gtk 3 library's which i have done. I am trying to add a webkit to a scrolledwindow in a glade file. Any suggestions? Thank You
Code:
#include <config.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <webkit/webkit.h>
#include <stdio.h>
#include <string.h>

static WebKitWebView* web_view;

typedef struct _Private Private;
static struct _Private
{
   
};

static struct Private* priv = NULL;

/* #define UI_FILE PACKAGE_DATA_DIR"/ui/myproject.ui" */
#define UI_FILE "src/myproject.ui"
#define TOP_WINDOW "window"

void
destroy (GtkWidget *widget, gpointer data)
{
   gtk_main_quit ();
}

static GtkWidget* create_window (void)
{
   GtkWidget *window;
   GtkBuilder *builder;
   GError* error = NULL;

   /* Load UI from file */
   builder = gtk_builder_new ();
   if (!gtk_builder_add_from_file (builder, UI_FILE, &error))
   {
      g_critical ("Couldn't load builder file: %s", error->message);
      g_error_free (error);
   }

   /* Auto-connect signal handlers */
   gtk_builder_connect_signals (builder, NULL);

   /* Get the window object from the ui file */
   window = GTK_WIDGET (gtk_builder_get_object (builder, TOP_WINDOW));
        if (!window)
        {
                g_critical ("Widget \"%s\" is missing in file %s.",
            TOP_WINDOW,
            UI_FILE);
        }

   priv = g_malloc (sizeof (struct _Private));

   g_object_unref (builder);
   
   return window;
}

int main (int argc, char *argv[])
{
    GtkBuilder *builder;
    GtkWidget  *window;
    GtkWidget  *scrolled_window;
   
#ifdef ENABLE_NLS
   bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   textdomain (GETTEXT_PACKAGE);
#endif
   
   gtk_init (&argc, &argv);
   
   builder = gtk_builder_new ();
    gtk_builder_add_from_file (builder, UI_FILE, NULL);
    scrolled_window = GTK_WIDGET (gtk_builder_get_object (builder, "scrolledwindow"));

    web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
    gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (web_view));
   
    gtk_builder_connect_signals (builder, NULL);

    g_object_unref (G_OBJECT (builder));
                 
    gchar* uri = (gchar*) (argc > 1 ? argv[1] : "http://www.google.com");
    webkit_web_view_open (web_view, uri);
   
   window = create_window ();

   gtk_widget_show (window);
   gtk_main ();
   g_free (priv);
   return 0;
}


Top
 Profile  
 
 Post subject: Re: Using GTK+ 2.x and GTK+ 3 in the same process is not sup
PostPosted: Mon Sep 24, 2012 7:20 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 766
Location: UK
Hi,

You can not use both GTK+ v2 and v3 in the same process. This has never been supported and never will be.

You do not say what versions of the libraries you are using. What I expect you are doing is using GTK+ v3 and a version of webkit that links with GTK+ v2. What you need is the version of webkit that depends on GTK+ v3. You should be able to find the development package in the repository of your distribution.

_________________
E.


Top
 Profile  
 
 Post subject: Re: Using GTK+ 2.x and GTK+ 3 in the same process is not sup
PostPosted: Tue Sep 25, 2012 3:36 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
Yes, from what I see the error has nothing to do with your code but rather how it is configured and compiled. Are you using pkg-config to check for the libraries? In it you can define the required versions so that there is no conflict. This is much easier to see if you are able to learn how to use the autotools and set up a configure script and makefiles.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group