Exemplo n.º 1
0
static void
pnl_dock_overlay_edge_add (GtkContainer *container,
                           GtkWidget    *child)
{
  PnlDockOverlayEdge *self = (PnlDockOverlayEdge *)container;

  g_assert (PNL_IS_DOCK_OVERLAY_EDGE (self));
  g_assert (GTK_IS_WIDGET (child));

  GTK_CONTAINER_CLASS (pnl_dock_overlay_edge_parent_class)->add (container, child);

  pnl_dock_overlay_edge_update_edge (self);

  if (PNL_IS_DOCK_ITEM (child))
    pnl_dock_item_adopt (PNL_DOCK_ITEM (self), PNL_DOCK_ITEM (child));
}
Exemplo n.º 2
0
gint
main (gint   argc,
      gchar *argv[])
{
  GtkBuilder *builder = NULL;
  GtkWindow *window = NULL;
  GActionGroup *group;
  GtkWidget *dockbin;
  GtkWidget *dockoverlay;
  GtkCssProvider *provider;
  GError *error = NULL;

  gtk_init (&argc, &argv);

  provider = gtk_css_provider_new ();
  gtk_css_provider_load_from_path (provider, "test-panel.css", &error);
  g_assert_no_error (error);
  gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
                                             GTK_STYLE_PROVIDER (provider),
                                             GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

  builder = gtk_builder_new ();
  gtk_builder_add_callback_symbol (builder, "toggle_all", G_CALLBACK (toggle_all));
  gtk_builder_add_from_file (builder, "test-panel.ui", &error);
  g_assert_no_error (error);

  window = GTK_WINDOW (gtk_builder_get_object (builder, "window"));
  g_signal_connect (window, "delete-event", gtk_main_quit, NULL);

  dockoverlay = GTK_WIDGET (gtk_builder_get_object (builder, "dockoverlay"));
  _pnl_dock_item_printf (PNL_DOCK_ITEM (dockoverlay));

  dockbin = GTK_WIDGET (gtk_builder_get_object (builder, "dockbin"));
  group = gtk_widget_get_action_group (dockbin, "dockbin");
  gtk_widget_insert_action_group (GTK_WIDGET (window), "dockbin", group);

  gtk_builder_connect_signals (builder, dockbin);

  gtk_window_present (window);
  gtk_main ();

  g_clear_object (&builder);

  return 0;
}