X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/494eb3886664d6470d103f088e03f10ca364a977..64d557a287f0e695856d6bc579293b399b8a07ea:/src/clipboard.c diff --git a/src/clipboard.c b/src/clipboard.c index 84ff6392..3a6f4910 100644 --- a/src/clipboard.c +++ b/src/clipboard.c @@ -19,9 +19,21 @@ * */ -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + +#include + #include "viking.h" @@ -51,11 +63,6 @@ static void clip_get ( GtkClipboard *c, GtkSelectionData *selection_data, guint // g_print("clip_get: vc = %p, size = %d\n", vc, sizeof(*vc) + vc->len); gtk_selection_data_set ( selection_data, selection_data->target, 8, (void *)vc, sizeof(*vc) + vc->len ); } - if (info==1) { - if (vc->type == VIK_CLIPBOARD_DATA_LAYER) { - gtk_selection_data_set_text ( selection_data, VIK_LAYER(vc->clipboard)->name, -1 ); - } - } } static void clip_clear ( GtkClipboard *c, gpointer p ) @@ -74,7 +81,7 @@ static void clip_receive_viking ( GtkClipboard *c, GtkSelectionData *sd, gpointe VikLayersPanel *vlp = p; vik_clipboard_t *vc; if (sd->length == -1) { - g_warning ( "paste failed" ); + g_warning ( _("paste failed") ); return; } // g_print("clip receive: target = %s, type = %s\n", gdk_atom_name(sd->target), gdk_atom_name(sd->type)); @@ -84,7 +91,7 @@ static void clip_receive_viking ( GtkClipboard *c, GtkSelectionData *sd, gpointe // g_print(" sd->data = %p, sd->length = %d, vc->len = %d\n", sd->data, sd->length, vc->len); if (sd->length != sizeof(*vc) + vc->len) { - g_warning ( "wrong clipboard data size" ); + g_warning ( _("wrong clipboard data size") ); return; } @@ -102,7 +109,10 @@ static void clip_receive_viking ( GtkClipboard *c, GtkSelectionData *sd, gpointe vik_layer_get_interface(vc->layer_type)->paste_item ( sel, vc->subtype, vc->data, vc->len); } else - a_dialog_error_msg_extra ( VIK_GTK_WINDOW_FROM_WIDGET(GTK_WIDGET(vlp)), "The clipboard contains sublayer data for a %s layers. You must select a layer of this type to paste the clipboard data.", vik_layer_get_interface(vc->layer_type)->name ); + a_dialog_error_msg_extra ( VIK_GTK_WINDOW_FROM_WIDGET(GTK_WIDGET(vlp)), + _("The clipboard contains sublayer data for %s layers. " + "You must select a layer of this type to paste the clipboard data."), + vik_layer_get_interface(vc->layer_type)->name ); } } @@ -206,7 +216,7 @@ static void clip_add_wp(VikLayersPanel *vlp, struct LatLon *coord) if (sel && sel->type == VIK_LAYER_TRW) { vik_trw_layer_new_waypoint ( VIK_TRW_LAYER(sel), VIK_GTK_WINDOW_FROM_LAYER(sel), &vc ); } else { - a_dialog_error_msg_extra ( VIK_GTK_WINDOW_FROM_WIDGET(GTK_WIDGET(vlp)), "In order to paste a waypoint, please select an appropriate layer to paste into.", NULL); + a_dialog_error_msg_extra ( VIK_GTK_WINDOW_FROM_WIDGET(GTK_WIDGET(vlp)), _("In order to paste a waypoint, please select an appropriate layer to paste into."), NULL); } } @@ -311,10 +321,10 @@ void a_clipboard_copy_selected ( VikLayersPanel *vlp ) return; vik_treeview_get_selected_iter ( sel->vt, &iter ); + layer_type = sel->type; if ( vik_treeview_item_get_type ( sel->vt, &iter ) == VIK_TREEVIEW_TYPE_SUBLAYER ) { type = VIK_CLIPBOARD_DATA_SUBLAYER; - layer_type = sel->type; if ( vik_layer_get_interface(layer_type)->copy_item) { subtype = vik_treeview_item_get_data(sel->vt, &iter); vik_layer_get_interface(layer_type)->copy_item(sel, subtype, vik_treeview_item_get_pointer(sel->vt, &iter), &data, &len );