Exemplo n.º 1
0
static void
sp_button_set_action (SPButton *button, SPAction *action)
{
	GtkWidget *child;

	if (button->action) {
		nr_active_object_remove_listener_by_data ((NRActiveObject *) button->action, button);
		nr_object_unref ((NRObject *) button->action);
		child = gtk_bin_get_child (GTK_BIN (button));
		if (child) {
			gtk_container_remove (GTK_CONTAINER (button), child);
		}
	}
	button->action = action;
	if (action) {
		button->action = (SPAction *) nr_object_ref ((NRObject *) action);
		nr_active_object_add_listener ((NRActiveObject *) action, (NRObjectEventVector *) &button_event_vector, sizeof (SPActionEventVector), button);
		if (action->image) {
			child = sp_icon_new (button->lsize, action->image);
			gtk_widget_show (child);
			gtk_container_add (GTK_CONTAINER (button), child);
		}
	}

	if (button->tooltips) {
		sp_button_set_composed_tooltip (button->tooltips, (GtkWidget *) button, action);
	}
}
Exemplo n.º 2
0
static void sp_button_set_action(SPButton *button, SPAction *action)
{
    GtkWidget *child;

    if (button->action) {
        button->c_set_active.disconnect();
        button->c_set_sensitive.disconnect();
        child = gtk_bin_get_child(GTK_BIN(button));
        if (child) {
            gtk_container_remove(GTK_CONTAINER(button), child);
        }
        g_object_unref(button->action);
    }
    button->action = action;
    if (action) {
        g_object_ref(action);
        button->c_set_active = action->signal_set_active.connect(
            sigc::bind<0>(sigc::ptr_fun(&sp_button_action_set_active), SP_BUTTON(button)));
        button->c_set_sensitive = action->signal_set_sensitive.connect(
            sigc::bind<0>(sigc::ptr_fun(&gtk_widget_set_sensitive), GTK_WIDGET(button)));
        if (action->image) {
            child = sp_icon_new(button->lsize, action->image);
            gtk_widget_show(child);
            gtk_container_add(GTK_CONTAINER(button), child);
        }
    }

    sp_button_set_composed_tooltip(GTK_WIDGET(button), action);
}
Exemplo n.º 3
0
static void
sp_button_action_set_shortcut (SPAction *action, unsigned int /*shortcut*/, void *data)
{
	SPButton *button=SP_BUTTON (data);
	if (button->tooltips) {
		sp_button_set_composed_tooltip (button->tooltips, GTK_WIDGET (button), action);
	}
}