Problems with panel applet



Hello,

Please, point me to the right list if this is not the one.

I have an application that works both stand alone and with an
Gnome applet. So, for example, if I call 'gkdial' it will open
the application window and will not mess with gnome stuff...
If I call it 'gkdial -a' or by an symbolic link 'gkdial_applet'
it will create the window but won't show it 'till the user
asks by clicking on the applet and will, thus, create this
applet on the panel... a simple thing, containing 2 buttons
and 2 xpms to indicate data flow

Now, I cannot get the applet to work. I already ported all
applet stuff, but I cannot use the BONOBO... macro to
include the main function automagicaly... I must use my
own main because of the nature of my program. So I did,
on the main function:

[...]
#ifdef HAVE_GNOME
  if (!strcmp ("gkdial_applet", g_basename(argv[0])))
    is_applet = TRUE;

  if (is_applet)
    gnome_program_init ("GkDial", "0", LIBGNOMEUI_MODULE,
			argc, argv, GNOME_PARAM_NONE);
  else
#endif
    gtk_init(&argc, &argv);
[...]
  create_main_window();

#ifdef HAVE_GNOME
  if (is_applet)
    return panel_applet_factory_main ("OAFIID:GNOME_GkDial_Factory", 
				      PANEL_TYPE_APPLET,
				      gkdial_factory, NULL);
#endif
[...]

there's the gkdial_factory function:

#ifdef HAVE_GNOME
static gboolean
gkdial_factory (PanelApplet *papplet, const gchar *iid,
		gpointer data)
{
  gboolean retval = FALSE;
  
  applet = GTK_WIDGET(papplet);
  is_applet = TRUE;

  printf ("AAAPPPLLLEETTT\n");
  fflush (stdout);

  if (!strcmp (iid, "OAFIID:GNOME_GkDial"))
    retval = create_panel_applet (papplet); 
  else
    printf ("AAAAAAAAAAAAAAHHHHHHHHH: %s\n", iid);

  printf ("retval: %d\n", retval);
  
  check_config ();

  /* 
     adding timeout... checking for connection 
     displaying log
  */
  check_timeout = gtk_timeout_add (CHK_TIMEOUT, check_connection, NULL);

  return retval;
}
#endif

those printf's are debug stuff =D... the problem is that when I call
gkdial_applet, is_applet is set correctly, gnome_program_init is called
but this appears:

gkdial_applet (pid:7698): GnomeUI-WARNING **: While connecting to session
manager: Could not open network socket.

and the return panel_applet_factory... thing is also called, but it seems
to block because 'AAAPPLLEETT' never pops on the screen.... important
to say that if I let create_main_window() show the program window it works
ok... but the applet doesn't appear on the panel

now, this happens this way when I call the program through an xterm... if
I call it through the panel 'AAAPPPLLLEETTT' appears and retval == 1
the relevant part of create_panel_applet():

gboolean
create_panel_applet (PanelApplet *papplet)
{
  /* creates the main applet */
  papplet = panel_applet_new ();
  if (!papplet)
    {
      gk_dialog (GTK_MESSAGE_ERROR,
		 _("Couldn't connect applet to panel..."));
      is_applet = FALSE;
      return FALSE;
    }
[...]
  return TRUE;
}

so, create_panel_applet seems to be returning TRUE... I just don't know what
the problem could be... I'm lost.... creating applets for gnome 1.4 seemed
easier to me =D

[]s!

-- 
kov debian org: Gustavo Noronha <http://www.metainfo.org/kov>
Debian: <http://www.debian.org> * <http://debian-br.cipsga.org.br>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]