Пример #1
0
/* Black magic! */
static void pp_monkey_patch_gtk_menu_bar(GtkMenuBar *bar)
{
    GtkMenuBarClass *klass = GTK_MENU_BAR_GET_CLASS(bar);
    GtkMenuShellClass *menu_shell_class = g_type_class_peek_parent(klass);
    GtkContainerClass *container_class =
        g_type_class_peek_parent(menu_shell_class);
    GtkWidgetClass *widget_class = g_type_class_peek_parent(container_class);
    GTK_WIDGET_CLASS(klass)->realize = widget_class->realize;
}
Пример #2
0
/**************************************************************************
  Create an auxiliary menubar (i.e., not the main menubar at the top of
  the window).
**************************************************************************/
GtkWidget *gtk_aux_menu_bar_new(void) {
  GtkWidget *menubar = gtk_menu_bar_new();

  /*
   * Ubuntu Linux's Ayatana/Unity desktop environment likes to steal the
   * application's main menu bar from its window and put it at the top of
   * the screen. It needs a hint in order not to steal menu bars other
   * than the main one. Gory details at
   * https://bugs.launchpad.net/ubuntu/+source/freeciv/+bug/743265
   */
  if (g_object_class_find_property(
        G_OBJECT_CLASS(GTK_MENU_BAR_GET_CLASS(menubar)), "ubuntu-local")) {
    g_object_set(G_OBJECT(menubar), "ubuntu-local", TRUE, NULL);
  }

  return menubar;
}