Exemplo n.º 1
0
GtkWidget *balsa_toolbar_new(BalsaToolbarModel * model,
                             GActionMap        * action_map)
{
    toolbar_info *info;
    GtkWidget *toolbar;

    info = g_new(toolbar_info, 1);
    info->model = model;
    info->menu = NULL;

    toolbar = gtk_toolbar_new();
    g_object_set_data_full(G_OBJECT(toolbar), BALSA_TOOLBAR_ACTION_MAP,
                           g_object_ref(action_map),
                           (GDestroyNotify) g_object_unref);
    tm_populate(toolbar, model);

    g_signal_connect(model, "changed", G_CALLBACK(tm_changed_cb), toolbar);
    g_signal_connect(toolbar, "realize", G_CALLBACK(tm_realize_cb), model);
    g_object_weak_ref(G_OBJECT(toolbar),
                      (GWeakNotify) tm_toolbar_weak_notify, info);

    g_signal_connect(toolbar, "button-press-event",
                     G_CALLBACK(tm_button_press_cb), info);
    g_signal_connect(toolbar, "popup-menu", G_CALLBACK(tm_popup_menu_cb),
                     info);

    gtk_widget_show_all(toolbar);

    return toolbar;
}
Exemplo n.º 2
0
/* Update a real toolbar when the model has changed.
 */
static void
tm_changed_cb(BalsaToolbarModel * model, GtkWidget * toolbar)
{
    balsa_toolbar_remove_all(toolbar);
    tm_populate(toolbar, model);
    tm_save_model(model);
}