* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
#include <stdio.h>
#include <string.h>
-#include "gtk.h"
+#define GTK_ENABLE_BROKEN
+#include "gtk/gtk.h"
typedef enum {
SEL_TYPE_NONE,
static int have_selection = FALSE;
+GtkWidget *selection_widget;
GtkWidget *selection_text;
GtkWidget *selection_button;
GString *selection_string = NULL;
{
if (GTK_TOGGLE_BUTTON(widget)->active)
{
- have_selection = gtk_selection_owner_set (widget,
+ have_selection = gtk_selection_owner_set (selection_widget,
GDK_SELECTION_PRIMARY,
GDK_CURRENT_TIME);
if (!have_selection)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(widget), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), FALSE);
}
else
{
selection_clear (GtkWidget *widget, GdkEventSelection *event)
{
have_selection = FALSE;
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(widget), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(selection_button), FALSE);
return TRUE;
}
if (seltype == SEL_TYPE_NONE)
{
char *name = gdk_atom_name (data->type);
- g_print("Don't know how to handle type: %s (%ld)\n",
- name?name:"<unknown>",
- data->type);
+ g_print("Don't know how to handle type: %s\n",
+ name?name:"<unknown>");
return;
}
default:
{
char *name = gdk_atom_name (data->type);
- g_print("Can't convert type %s (%ld) to string\n",
- name?name:"<unknown>",
- data->type);
+ g_print("Can't convert type %s to string\n",
+ name?name:"<unknown>");
position = data->length;
continue;
}
void
paste (GtkWidget *widget, GtkWidget *entry)
{
- char *name;
+ const char *name;
GdkAtom atom;
name = gtk_entry_get_text (GTK_ENTRY(entry));
return;
}
- gtk_selection_convert (selection_button, GDK_SELECTION_PRIMARY, atom,
+ gtk_selection_convert (selection_widget, GDK_SELECTION_PRIMARY, atom,
GDK_CURRENT_TIME);
}
init_atoms();
+ selection_widget = gtk_invisible_new ();
+
dialog = gtk_dialog_new ();
gtk_widget_set_name (dialog, "Test Input");
gtk_container_set_border_width (GTK_CONTAINER(dialog), 0);
gtk_signal_connect (GTK_OBJECT(selection_button), "toggled",
GTK_SIGNAL_FUNC (selection_toggled), NULL);
- gtk_signal_connect (GTK_OBJECT(selection_button), "selection_clear_event",
+ gtk_signal_connect (GTK_OBJECT(selection_widget), "selection_clear_event",
GTK_SIGNAL_FUNC (selection_clear), NULL);
- gtk_signal_connect (GTK_OBJECT(selection_button), "selection_received",
+ gtk_signal_connect (GTK_OBJECT(selection_widget), "selection_received",
GTK_SIGNAL_FUNC (selection_received), NULL);
- gtk_selection_add_targets (selection_button, GDK_SELECTION_PRIMARY,
+ gtk_selection_add_targets (selection_widget, GDK_SELECTION_PRIMARY,
targetlist, ntargets);
- gtk_signal_connect (GTK_OBJECT(selection_button), "selection_get",
+ gtk_signal_connect (GTK_OBJECT(selection_widget), "selection_get",
GTK_SIGNAL_FUNC (selection_get), NULL);
selection_text = gtk_text_new (NULL, NULL);