[gnome-love] bonobo_dock woes..



Hi,

I'm a developer learning to use the new GNOME 2.0 APIs and stumbled upon
troubles and questions on how to bonobo_dock works.

I'm want to create a vertical floating dockable toolbar to hold icon
buttons and that should span the whole left side of the application.

I have created a subfunction that returns a pointer to the BonoboDock
which I later add to the window container.

But I have two problems, the first is that I cant get the dock to float
(ie, there is no handle on the dock), the second is to get the dock to
spann the whole side of the container, not only just the size of the
items added to the dock.

I also find it amusing that there is no API reference for the new
bonobo/bonobo-ui 2.0 aswell as gnome/gnome-ui 2.0 APIs at the development site.
Only Gnome 1.0 APIs seams to be available except for Glib and GTK+ 2.0.

Screenshot of test app displaying the BonoboDock on the left side, the
test xpm pixmap is a little big so the size is a bit larger than the standard
BonoboWindow xml-ui generated toolbar on the top.

http://c64.org/~nr/bonobodock.gif

- nr

#include <libbonoboui.h>
#include <gtk/gtk.h>

#include "../xpm/tb_mount.xpm"

static const char rcsid[] = "$Id$";

GtkWidget *
gcharts_toolbar_new(void)
{
  BonoboDockItemBehavior behavior;
  GtkWidget *dock;
  GtkWidget *dock_item1;
  GtkWidget *dock_item2;
  GtkWidget *button1;
  GtkWidget *button2;
  GtkWidget *button_pixmap1;
  GtkWidget *button_pixmap2;
  GtkStyle *style;
  GdkPixmap *pixmap1 = NULL;
  GdkPixmap *pixmap2 = NULL;
  GdkBitmap *mask;
  GdkColor *background;
  GdkColormap *colormap;

  style = gtk_widget_get_default_style();
  background = &style->bg[GTK_STATE_NORMAL];
  colormap = gdk_colormap_get_system();
  pixmap1 = gdk_pixmap_colormap_create_from_xpm_d(NULL, colormap,
    &mask, background, tb_mount_xpm);
  pixmap2 = gdk_pixmap_colormap_create_from_xpm_d(NULL, colormap,
    &mask, background, tb_mount_xpm);

  button_pixmap1 = gtk_pixmap_new(pixmap1, mask);
  button_pixmap2 = gtk_pixmap_new(pixmap2, mask);

  dock = bonobo_dock_new();
  dock_item1 = bonobo_dock_item_new("button1", behavior);
  dock_item2 = bonobo_dock_item_new("button2", behavior);

  button1 = gtk_button_new();
  gtk_button_set_relief(GTK_BUTTON (button1), GTK_RELIEF_NONE);
  button2 = gtk_button_new();
  gtk_button_set_relief(GTK_BUTTON (button2), GTK_RELIEF_NONE);

  gtk_container_add(GTK_CONTAINER (button1), GTK_WIDGET (button_pixmap1));
  gtk_container_add(GTK_CONTAINER (dock_item1), GTK_WIDGET (button1));

  gtk_container_add(GTK_CONTAINER (button2), GTK_WIDGET (button_pixmap2));
  gtk_container_add(GTK_CONTAINER (dock_item2), GTK_WIDGET (button2));

  bonobo_dock_add_item(BONOBO_DOCK (dock), BONOBO_DOCK_ITEM (dock_item1),
    BONOBO_DOCK_TOP, 0, 0, 0, TRUE);
  bonobo_dock_add_item(BONOBO_DOCK (dock), BONOBO_DOCK_ITEM (dock_item2),
    BONOBO_DOCK_BOTTOM, 0, 0, 0, TRUE);

  return dock;
}




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