* Lesser General Public License for more details.
*
* 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.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
void
selection_toggled (GtkWidget *widget)
{
- if (GTK_TOGGLE_BUTTON(widget)->active)
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
{
have_selection = gtk_selection_owner_set (selection_widget,
GDK_SELECTION_PRIMARY,
{
if (have_selection)
{
- if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == widget->window)
+ if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == gtk_widget_get_window (widget))
gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY,
GDK_CURRENT_TIME);
have_selection = FALSE;
}
void
-selection_received (GtkWidget *widget, GtkSelectionData *data)
+selection_received (GtkWidget *widget, GtkSelectionData *selection_data)
{
int position;
int i;
SelType seltype;
char *str;
+ guchar *data;
GtkTextBuffer *buffer;
-
- if (data->length < 0)
+ GdkAtom type;
+
+ if (gtk_selection_data_get_length (selection_data) < 0)
{
g_print("Error retrieving selection\n");
return;
}
+ type = gtk_selection_data_get_data_type (selection_data);
+
seltype = SEL_TYPE_NONE;
for (i=0; i<LAST_SEL_TYPE; i++)
{
- if (seltypes[i] == data->type)
+ if (seltypes[i] == type)
{
seltype = i;
break;
if (seltype == SEL_TYPE_NONE)
{
- char *name = gdk_atom_name (data->type);
+ char *name = gdk_atom_name (type);
g_print("Don't know how to handle type: %s\n",
name?name:"<unknown>");
return;
gtk_text_buffer_set_text (buffer, "", -1);
position = 0;
- while (position < data->length)
+ while (position < gtk_selection_data_get_length (selection_data))
{
+ data = (guchar *) gtk_selection_data_get_data (selection_data);
switch (seltype)
{
case ATOM:
- str = stringify_atom (data->data, &position);
+ str = stringify_atom (data, &position);
break;
case COMPOUND_TEXT:
case STRING:
case TEXT:
- str = stringify_text (data->data, &position);
+ str = stringify_text (data, &position);
break;
case BITMAP:
case DRAWABLE:
case PIXMAP:
case WINDOW:
case COLORMAP:
- str = stringify_xid (data->data, &position);
+ str = stringify_xid (data, &position);
break;
case INTEGER:
case PIXEL:
- str = stringify_integer (data->data, &position);
+ str = stringify_integer (data, &position);
break;
case SPAN:
- str = stringify_span (data->data, &position);
+ str = stringify_span (data, &position);
break;
default:
{
- char *name = gdk_atom_name (data->type);
+ char *name = gdk_atom_name (gtk_selection_data_get_data_type (selection_data));
g_print("Can't convert type %s to string\n",
name?name:"<unknown>");
- position = data->length;
+ position = gtk_selection_data_get_length (selection_data);
continue;
}
}
GtkWidget *action_area, *content_area;
GtkWidget *dialog;
GtkWidget *button;
- GtkWidget *table;
+ GtkWidget *vbox;
GtkWidget *label;
GtkWidget *entry;
GtkWidget *hbox;
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
- table = gtk_table_new (4, 2, FALSE);
- gtk_container_set_border_width (GTK_CONTAINER(table), 10);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
- gtk_table_set_row_spacing (GTK_TABLE (table), 0, 5);
- gtk_table_set_row_spacing (GTK_TABLE (table), 1, 2);
- gtk_table_set_row_spacing (GTK_TABLE (table), 2, 2);
- gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
- gtk_box_pack_start (GTK_BOX (content_area), table, TRUE, TRUE, 0);
- gtk_widget_show (table);
+ gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
+ gtk_widget_show (vbox);
selection_button = gtk_toggle_button_new_with_label ("Claim Selection");
- gtk_table_attach (GTK_TABLE (table), selection_button, 0, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_container_add (GTK_CONTAINER (vbox), selection_button);
gtk_widget_show (selection_button);
g_signal_connect (selection_button, "toggled",
selection_text = gtk_text_view_new ();
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (scrolled), selection_text);
- gtk_table_attach_defaults (GTK_TABLE (table), scrolled, 0, 1, 1, 2);
+ gtk_container_add (GTK_CONTAINER (vbox), scrolled);
gtk_widget_show (selection_text);
- hbox = gtk_hbox_new (FALSE, 2);
- gtk_table_attach (GTK_TABLE (table), hbox, 0, 2, 3, 4,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+ gtk_container_add (GTK_CONTAINER (vbox), hbox);
gtk_widget_show (hbox);
label = gtk_label_new ("Target:");