示例#1
0
static void
text_buffer_update_sensitivity (GtkTextBuffer *buffer,
				TargetCallbackData *target_data)
{
	g_assert (GTK_IS_TEXT_BUFFER (buffer));
	g_assert (target_data != NULL);

	if (gtk_text_buffer_get_selection_bounds (buffer, NULL, NULL)) {
		set_clipboard_menu_items_sensitive (target_data->action_group);
	} else {
		set_clipboard_menu_items_insensitive (target_data->action_group);
	}
}
static void
selection_changed_callback (GtkWidget *widget,
			    gpointer callback_data)
{
	TargetCallbackData *target_data;
	GtkEditable *editable;
	int start, end;

	target_data = (TargetCallbackData *) callback_data;
	g_assert (target_data != NULL);

	editable = GTK_EDITABLE (widget);
	g_assert (editable != NULL);

	if (gtk_editable_get_selection_bounds (editable, &start, &end) && start != end) {
		set_clipboard_menu_items_sensitive (target_data->action_group);
	} else {
		set_clipboard_menu_items_insensitive (target_data->action_group);
	}
}